blob: 962359ddcc9ecd9ac0c3b6836b8a438a2d274435 [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 Lane7dcdf022013-12-11 14:45:27 -08005950class bsn_pdu_rx_reply(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07005951 version = 4
5952 type = 4
5953 experimenter = 6035143
5954 subtype = 34
5955
Rich Lane7b0f2012013-11-22 14:15:26 -08005956 def __init__(self, xid=None, status=None, port_no=None, slot_num=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005957 if xid != None:
5958 self.xid = xid
5959 else:
5960 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07005961 if status != None:
5962 self.status = status
5963 else:
5964 self.status = 0
Rich Lane7b0f2012013-11-22 14:15:26 -08005965 if port_no != None:
5966 self.port_no = port_no
5967 else:
5968 self.port_no = 0
5969 if slot_num != None:
5970 self.slot_num = slot_num
5971 else:
5972 self.slot_num = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08005973 return
Rich Lane6f4978c2013-10-20 21:33:52 -07005974
5975 def pack(self):
5976 packed = []
5977 packed.append(struct.pack("!B", self.version))
5978 packed.append(struct.pack("!B", self.type))
5979 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5980 packed.append(struct.pack("!L", self.xid))
5981 packed.append(struct.pack("!L", self.experimenter))
5982 packed.append(struct.pack("!L", self.subtype))
5983 packed.append(struct.pack("!L", self.status))
Rich Lane7b0f2012013-11-22 14:15:26 -08005984 packed.append(util.pack_port_no(self.port_no))
5985 packed.append(struct.pack("!B", self.slot_num))
Rich Lane6f4978c2013-10-20 21:33:52 -07005986 length = sum([len(x) for x in packed])
5987 packed[2] = struct.pack("!H", length)
5988 return ''.join(packed)
5989
5990 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005991 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07005992 obj = bsn_pdu_rx_reply()
Rich Lane6f4978c2013-10-20 21:33:52 -07005993 _version = reader.read("!B")[0]
5994 assert(_version == 4)
5995 _type = reader.read("!B")[0]
5996 assert(_type == 4)
5997 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005998 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08005999 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -07006000 obj.xid = reader.read("!L")[0]
6001 _experimenter = reader.read("!L")[0]
6002 assert(_experimenter == 6035143)
6003 _subtype = reader.read("!L")[0]
6004 assert(_subtype == 34)
6005 obj.status = reader.read("!L")[0]
Rich Lane7b0f2012013-11-22 14:15:26 -08006006 obj.port_no = util.unpack_port_no(reader)
6007 obj.slot_num = reader.read("!B")[0]
Rich Lane6f4978c2013-10-20 21:33:52 -07006008 return obj
6009
6010 def __eq__(self, other):
6011 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07006012 if self.xid != other.xid: return False
6013 if self.status != other.status: return False
Rich Lane7b0f2012013-11-22 14:15:26 -08006014 if self.port_no != other.port_no: return False
6015 if self.slot_num != other.slot_num: return False
Rich Lane6f4978c2013-10-20 21:33:52 -07006016 return True
6017
Rich Lane6f4978c2013-10-20 21:33:52 -07006018 def pretty_print(self, q):
6019 q.text("bsn_pdu_rx_reply {")
6020 with q.group():
6021 with q.indent(2):
6022 q.breakable()
6023 q.text("xid = ");
6024 if self.xid != None:
6025 q.text("%#x" % self.xid)
6026 else:
6027 q.text('None')
6028 q.text(","); q.breakable()
6029 q.text("status = ");
6030 q.text("%#x" % self.status)
Rich Lane7b0f2012013-11-22 14:15:26 -08006031 q.text(","); q.breakable()
6032 q.text("port_no = ");
6033 q.text(util.pretty_port(self.port_no))
6034 q.text(","); q.breakable()
6035 q.text("slot_num = ");
6036 q.text("%#x" % self.slot_num)
Rich Lane6f4978c2013-10-20 21:33:52 -07006037 q.breakable()
6038 q.text('}')
6039
Rich Lane7dcdf022013-12-11 14:45:27 -08006040bsn_header.subtypes[34] = bsn_pdu_rx_reply
6041
6042class bsn_pdu_rx_request(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07006043 version = 4
6044 type = 4
6045 experimenter = 6035143
6046 subtype = 33
6047
6048 def __init__(self, xid=None, timeout_ms=None, port_no=None, slot_num=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006049 if xid != None:
6050 self.xid = xid
6051 else:
6052 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07006053 if timeout_ms != None:
6054 self.timeout_ms = timeout_ms
6055 else:
6056 self.timeout_ms = 0
6057 if port_no != None:
6058 self.port_no = port_no
6059 else:
6060 self.port_no = 0
6061 if slot_num != None:
6062 self.slot_num = slot_num
6063 else:
6064 self.slot_num = 0
6065 if data != None:
6066 self.data = data
6067 else:
6068 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08006069 return
Rich Lane6f4978c2013-10-20 21:33:52 -07006070
6071 def pack(self):
6072 packed = []
6073 packed.append(struct.pack("!B", self.version))
6074 packed.append(struct.pack("!B", self.type))
6075 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6076 packed.append(struct.pack("!L", self.xid))
6077 packed.append(struct.pack("!L", self.experimenter))
6078 packed.append(struct.pack("!L", self.subtype))
6079 packed.append(struct.pack("!L", self.timeout_ms))
6080 packed.append(util.pack_port_no(self.port_no))
6081 packed.append(struct.pack("!B", self.slot_num))
6082 packed.append('\x00' * 3)
6083 packed.append(self.data)
6084 length = sum([len(x) for x in packed])
6085 packed[2] = struct.pack("!H", length)
6086 return ''.join(packed)
6087
6088 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006089 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07006090 obj = bsn_pdu_rx_request()
Rich Lane6f4978c2013-10-20 21:33:52 -07006091 _version = reader.read("!B")[0]
6092 assert(_version == 4)
6093 _type = reader.read("!B")[0]
6094 assert(_type == 4)
6095 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006096 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006097 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -07006098 obj.xid = reader.read("!L")[0]
6099 _experimenter = reader.read("!L")[0]
6100 assert(_experimenter == 6035143)
6101 _subtype = reader.read("!L")[0]
6102 assert(_subtype == 33)
6103 obj.timeout_ms = reader.read("!L")[0]
6104 obj.port_no = util.unpack_port_no(reader)
6105 obj.slot_num = reader.read("!B")[0]
6106 reader.skip(3)
6107 obj.data = str(reader.read_all())
6108 return obj
6109
6110 def __eq__(self, other):
6111 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07006112 if self.xid != other.xid: return False
6113 if self.timeout_ms != other.timeout_ms: return False
6114 if self.port_no != other.port_no: return False
6115 if self.slot_num != other.slot_num: return False
6116 if self.data != other.data: return False
6117 return True
6118
Rich Lane6f4978c2013-10-20 21:33:52 -07006119 def pretty_print(self, q):
6120 q.text("bsn_pdu_rx_request {")
6121 with q.group():
6122 with q.indent(2):
6123 q.breakable()
6124 q.text("xid = ");
6125 if self.xid != None:
6126 q.text("%#x" % self.xid)
6127 else:
6128 q.text('None')
6129 q.text(","); q.breakable()
6130 q.text("timeout_ms = ");
6131 q.text("%#x" % self.timeout_ms)
6132 q.text(","); q.breakable()
6133 q.text("port_no = ");
6134 q.text(util.pretty_port(self.port_no))
6135 q.text(","); q.breakable()
6136 q.text("slot_num = ");
6137 q.text("%#x" % self.slot_num)
6138 q.text(","); q.breakable()
6139 q.text("data = ");
6140 q.pp(self.data)
6141 q.breakable()
6142 q.text('}')
6143
Rich Lane7dcdf022013-12-11 14:45:27 -08006144bsn_header.subtypes[33] = bsn_pdu_rx_request
6145
6146class bsn_pdu_rx_timeout(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07006147 version = 4
6148 type = 4
6149 experimenter = 6035143
6150 subtype = 35
6151
6152 def __init__(self, xid=None, port_no=None, slot_num=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006153 if xid != None:
6154 self.xid = xid
6155 else:
6156 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07006157 if port_no != None:
6158 self.port_no = port_no
6159 else:
6160 self.port_no = 0
6161 if slot_num != None:
6162 self.slot_num = slot_num
6163 else:
6164 self.slot_num = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08006165 return
Rich Lane6f4978c2013-10-20 21:33:52 -07006166
6167 def pack(self):
6168 packed = []
6169 packed.append(struct.pack("!B", self.version))
6170 packed.append(struct.pack("!B", self.type))
6171 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6172 packed.append(struct.pack("!L", self.xid))
6173 packed.append(struct.pack("!L", self.experimenter))
6174 packed.append(struct.pack("!L", self.subtype))
6175 packed.append(util.pack_port_no(self.port_no))
6176 packed.append(struct.pack("!B", self.slot_num))
6177 length = sum([len(x) for x in packed])
6178 packed[2] = struct.pack("!H", length)
6179 return ''.join(packed)
6180
6181 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006182 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07006183 obj = bsn_pdu_rx_timeout()
Rich Lane6f4978c2013-10-20 21:33:52 -07006184 _version = reader.read("!B")[0]
6185 assert(_version == 4)
6186 _type = reader.read("!B")[0]
6187 assert(_type == 4)
6188 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006189 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006190 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -07006191 obj.xid = reader.read("!L")[0]
6192 _experimenter = reader.read("!L")[0]
6193 assert(_experimenter == 6035143)
6194 _subtype = reader.read("!L")[0]
6195 assert(_subtype == 35)
6196 obj.port_no = util.unpack_port_no(reader)
6197 obj.slot_num = reader.read("!B")[0]
6198 return obj
6199
6200 def __eq__(self, other):
6201 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07006202 if self.xid != other.xid: return False
6203 if self.port_no != other.port_no: return False
6204 if self.slot_num != other.slot_num: return False
6205 return True
6206
Rich Lane6f4978c2013-10-20 21:33:52 -07006207 def pretty_print(self, q):
6208 q.text("bsn_pdu_rx_timeout {")
6209 with q.group():
6210 with q.indent(2):
6211 q.breakable()
6212 q.text("xid = ");
6213 if self.xid != None:
6214 q.text("%#x" % self.xid)
6215 else:
6216 q.text('None')
6217 q.text(","); q.breakable()
6218 q.text("port_no = ");
6219 q.text(util.pretty_port(self.port_no))
6220 q.text(","); q.breakable()
6221 q.text("slot_num = ");
6222 q.text("%#x" % self.slot_num)
6223 q.breakable()
6224 q.text('}')
6225
Rich Lane7dcdf022013-12-11 14:45:27 -08006226bsn_header.subtypes[35] = bsn_pdu_rx_timeout
6227
6228class bsn_pdu_tx_reply(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07006229 version = 4
6230 type = 4
6231 experimenter = 6035143
6232 subtype = 32
6233
Rich Lane7b0f2012013-11-22 14:15:26 -08006234 def __init__(self, xid=None, status=None, port_no=None, slot_num=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006235 if xid != None:
6236 self.xid = xid
6237 else:
6238 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07006239 if status != None:
6240 self.status = status
6241 else:
6242 self.status = 0
Rich Lane7b0f2012013-11-22 14:15:26 -08006243 if port_no != None:
6244 self.port_no = port_no
6245 else:
6246 self.port_no = 0
6247 if slot_num != None:
6248 self.slot_num = slot_num
6249 else:
6250 self.slot_num = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08006251 return
Rich Lane6f4978c2013-10-20 21:33:52 -07006252
6253 def pack(self):
6254 packed = []
6255 packed.append(struct.pack("!B", self.version))
6256 packed.append(struct.pack("!B", self.type))
6257 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6258 packed.append(struct.pack("!L", self.xid))
6259 packed.append(struct.pack("!L", self.experimenter))
6260 packed.append(struct.pack("!L", self.subtype))
6261 packed.append(struct.pack("!L", self.status))
Rich Lane7b0f2012013-11-22 14:15:26 -08006262 packed.append(util.pack_port_no(self.port_no))
6263 packed.append(struct.pack("!B", self.slot_num))
Rich Lane6f4978c2013-10-20 21:33:52 -07006264 length = sum([len(x) for x in packed])
6265 packed[2] = struct.pack("!H", length)
6266 return ''.join(packed)
6267
6268 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006269 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07006270 obj = bsn_pdu_tx_reply()
Rich Lane6f4978c2013-10-20 21:33:52 -07006271 _version = reader.read("!B")[0]
6272 assert(_version == 4)
6273 _type = reader.read("!B")[0]
6274 assert(_type == 4)
6275 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006276 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006277 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -07006278 obj.xid = reader.read("!L")[0]
6279 _experimenter = reader.read("!L")[0]
6280 assert(_experimenter == 6035143)
6281 _subtype = reader.read("!L")[0]
6282 assert(_subtype == 32)
6283 obj.status = reader.read("!L")[0]
Rich Lane7b0f2012013-11-22 14:15:26 -08006284 obj.port_no = util.unpack_port_no(reader)
6285 obj.slot_num = reader.read("!B")[0]
Rich Lane6f4978c2013-10-20 21:33:52 -07006286 return obj
6287
6288 def __eq__(self, other):
6289 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07006290 if self.xid != other.xid: return False
6291 if self.status != other.status: return False
Rich Lane7b0f2012013-11-22 14:15:26 -08006292 if self.port_no != other.port_no: return False
6293 if self.slot_num != other.slot_num: return False
Rich Lane6f4978c2013-10-20 21:33:52 -07006294 return True
6295
Rich Lane6f4978c2013-10-20 21:33:52 -07006296 def pretty_print(self, q):
6297 q.text("bsn_pdu_tx_reply {")
6298 with q.group():
6299 with q.indent(2):
6300 q.breakable()
6301 q.text("xid = ");
6302 if self.xid != None:
6303 q.text("%#x" % self.xid)
6304 else:
6305 q.text('None')
6306 q.text(","); q.breakable()
6307 q.text("status = ");
6308 q.text("%#x" % self.status)
Rich Lane7b0f2012013-11-22 14:15:26 -08006309 q.text(","); q.breakable()
6310 q.text("port_no = ");
6311 q.text(util.pretty_port(self.port_no))
6312 q.text(","); q.breakable()
6313 q.text("slot_num = ");
6314 q.text("%#x" % self.slot_num)
Rich Lane6f4978c2013-10-20 21:33:52 -07006315 q.breakable()
6316 q.text('}')
6317
Rich Lane7dcdf022013-12-11 14:45:27 -08006318bsn_header.subtypes[32] = bsn_pdu_tx_reply
6319
6320class bsn_pdu_tx_request(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07006321 version = 4
6322 type = 4
6323 experimenter = 6035143
6324 subtype = 31
6325
6326 def __init__(self, xid=None, tx_interval_ms=None, port_no=None, slot_num=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006327 if xid != None:
6328 self.xid = xid
6329 else:
6330 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07006331 if tx_interval_ms != None:
6332 self.tx_interval_ms = tx_interval_ms
6333 else:
6334 self.tx_interval_ms = 0
6335 if port_no != None:
6336 self.port_no = port_no
6337 else:
6338 self.port_no = 0
6339 if slot_num != None:
6340 self.slot_num = slot_num
6341 else:
6342 self.slot_num = 0
6343 if data != None:
6344 self.data = data
6345 else:
6346 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08006347 return
Rich Lane6f4978c2013-10-20 21:33:52 -07006348
6349 def pack(self):
6350 packed = []
6351 packed.append(struct.pack("!B", self.version))
6352 packed.append(struct.pack("!B", self.type))
6353 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6354 packed.append(struct.pack("!L", self.xid))
6355 packed.append(struct.pack("!L", self.experimenter))
6356 packed.append(struct.pack("!L", self.subtype))
6357 packed.append(struct.pack("!L", self.tx_interval_ms))
6358 packed.append(util.pack_port_no(self.port_no))
6359 packed.append(struct.pack("!B", self.slot_num))
6360 packed.append('\x00' * 3)
6361 packed.append(self.data)
6362 length = sum([len(x) for x in packed])
6363 packed[2] = struct.pack("!H", length)
6364 return ''.join(packed)
6365
6366 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006367 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07006368 obj = bsn_pdu_tx_request()
Rich Lane6f4978c2013-10-20 21:33:52 -07006369 _version = reader.read("!B")[0]
6370 assert(_version == 4)
6371 _type = reader.read("!B")[0]
6372 assert(_type == 4)
6373 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006374 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006375 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -07006376 obj.xid = reader.read("!L")[0]
6377 _experimenter = reader.read("!L")[0]
6378 assert(_experimenter == 6035143)
6379 _subtype = reader.read("!L")[0]
6380 assert(_subtype == 31)
6381 obj.tx_interval_ms = reader.read("!L")[0]
6382 obj.port_no = util.unpack_port_no(reader)
6383 obj.slot_num = reader.read("!B")[0]
6384 reader.skip(3)
6385 obj.data = str(reader.read_all())
6386 return obj
6387
6388 def __eq__(self, other):
6389 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07006390 if self.xid != other.xid: return False
6391 if self.tx_interval_ms != other.tx_interval_ms: return False
6392 if self.port_no != other.port_no: return False
6393 if self.slot_num != other.slot_num: return False
6394 if self.data != other.data: return False
6395 return True
6396
Rich Lane6f4978c2013-10-20 21:33:52 -07006397 def pretty_print(self, q):
6398 q.text("bsn_pdu_tx_request {")
6399 with q.group():
6400 with q.indent(2):
6401 q.breakable()
6402 q.text("xid = ");
6403 if self.xid != None:
6404 q.text("%#x" % self.xid)
6405 else:
6406 q.text('None')
6407 q.text(","); q.breakable()
6408 q.text("tx_interval_ms = ");
6409 q.text("%#x" % self.tx_interval_ms)
6410 q.text(","); q.breakable()
6411 q.text("port_no = ");
6412 q.text(util.pretty_port(self.port_no))
6413 q.text(","); q.breakable()
6414 q.text("slot_num = ");
6415 q.text("%#x" % self.slot_num)
6416 q.text(","); q.breakable()
6417 q.text("data = ");
6418 q.pp(self.data)
6419 q.breakable()
6420 q.text('}')
6421
Rich Lane7dcdf022013-12-11 14:45:27 -08006422bsn_header.subtypes[31] = bsn_pdu_tx_request
6423
6424class bsn_port_counter_stats_reply(bsn_stats_reply):
6425 version = 4
6426 type = 19
6427 stats_type = 65535
6428 experimenter = 6035143
6429 subtype = 8
6430
6431 def __init__(self, xid=None, flags=None, entries=None):
6432 if xid != None:
6433 self.xid = xid
6434 else:
6435 self.xid = None
6436 if flags != None:
6437 self.flags = flags
6438 else:
6439 self.flags = 0
6440 if entries != None:
6441 self.entries = entries
6442 else:
6443 self.entries = []
6444 return
6445
6446 def pack(self):
6447 packed = []
6448 packed.append(struct.pack("!B", self.version))
6449 packed.append(struct.pack("!B", self.type))
6450 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6451 packed.append(struct.pack("!L", self.xid))
6452 packed.append(struct.pack("!H", self.stats_type))
6453 packed.append(struct.pack("!H", self.flags))
6454 packed.append('\x00' * 4)
6455 packed.append(struct.pack("!L", self.experimenter))
6456 packed.append(struct.pack("!L", self.subtype))
6457 packed.append(loxi.generic_util.pack_list(self.entries))
6458 length = sum([len(x) for x in packed])
6459 packed[2] = struct.pack("!H", length)
6460 return ''.join(packed)
6461
6462 @staticmethod
6463 def unpack(reader):
6464 obj = bsn_port_counter_stats_reply()
6465 _version = reader.read("!B")[0]
6466 assert(_version == 4)
6467 _type = reader.read("!B")[0]
6468 assert(_type == 19)
6469 _length = reader.read("!H")[0]
6470 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006471 reader = orig_reader.slice(_length, 4)
Rich Lane7dcdf022013-12-11 14:45:27 -08006472 obj.xid = reader.read("!L")[0]
6473 _stats_type = reader.read("!H")[0]
6474 assert(_stats_type == 65535)
6475 obj.flags = reader.read("!H")[0]
6476 reader.skip(4)
6477 _experimenter = reader.read("!L")[0]
6478 assert(_experimenter == 6035143)
6479 _subtype = reader.read("!L")[0]
6480 assert(_subtype == 8)
6481 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_port_counter_stats_entry.unpack)
6482 return obj
6483
6484 def __eq__(self, other):
6485 if type(self) != type(other): return False
6486 if self.xid != other.xid: return False
6487 if self.flags != other.flags: return False
6488 if self.entries != other.entries: return False
6489 return True
6490
6491 def pretty_print(self, q):
6492 q.text("bsn_port_counter_stats_reply {")
6493 with q.group():
6494 with q.indent(2):
6495 q.breakable()
6496 q.text("xid = ");
6497 if self.xid != None:
6498 q.text("%#x" % self.xid)
6499 else:
6500 q.text('None')
6501 q.text(","); q.breakable()
6502 q.text("flags = ");
6503 q.text("%#x" % self.flags)
6504 q.text(","); q.breakable()
6505 q.text("entries = ");
6506 q.pp(self.entries)
6507 q.breakable()
6508 q.text('}')
6509
6510bsn_stats_reply.subtypes[8] = bsn_port_counter_stats_reply
6511
6512class bsn_port_counter_stats_request(bsn_stats_request):
6513 version = 4
6514 type = 18
6515 stats_type = 65535
6516 experimenter = 6035143
6517 subtype = 8
6518
6519 def __init__(self, xid=None, flags=None, port_no=None):
6520 if xid != None:
6521 self.xid = xid
6522 else:
6523 self.xid = None
6524 if flags != None:
6525 self.flags = flags
6526 else:
6527 self.flags = 0
6528 if port_no != None:
6529 self.port_no = port_no
6530 else:
6531 self.port_no = 0
6532 return
6533
6534 def pack(self):
6535 packed = []
6536 packed.append(struct.pack("!B", self.version))
6537 packed.append(struct.pack("!B", self.type))
6538 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6539 packed.append(struct.pack("!L", self.xid))
6540 packed.append(struct.pack("!H", self.stats_type))
6541 packed.append(struct.pack("!H", self.flags))
6542 packed.append('\x00' * 4)
6543 packed.append(struct.pack("!L", self.experimenter))
6544 packed.append(struct.pack("!L", self.subtype))
6545 packed.append(util.pack_port_no(self.port_no))
6546 length = sum([len(x) for x in packed])
6547 packed[2] = struct.pack("!H", length)
6548 return ''.join(packed)
6549
6550 @staticmethod
6551 def unpack(reader):
6552 obj = bsn_port_counter_stats_request()
6553 _version = reader.read("!B")[0]
6554 assert(_version == 4)
6555 _type = reader.read("!B")[0]
6556 assert(_type == 18)
6557 _length = reader.read("!H")[0]
6558 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006559 reader = orig_reader.slice(_length, 4)
Rich Lane7dcdf022013-12-11 14:45:27 -08006560 obj.xid = reader.read("!L")[0]
6561 _stats_type = reader.read("!H")[0]
6562 assert(_stats_type == 65535)
6563 obj.flags = reader.read("!H")[0]
6564 reader.skip(4)
6565 _experimenter = reader.read("!L")[0]
6566 assert(_experimenter == 6035143)
6567 _subtype = reader.read("!L")[0]
6568 assert(_subtype == 8)
6569 obj.port_no = util.unpack_port_no(reader)
6570 return obj
6571
6572 def __eq__(self, other):
6573 if type(self) != type(other): return False
6574 if self.xid != other.xid: return False
6575 if self.flags != other.flags: return False
6576 if self.port_no != other.port_no: return False
6577 return True
6578
6579 def pretty_print(self, q):
6580 q.text("bsn_port_counter_stats_request {")
6581 with q.group():
6582 with q.indent(2):
6583 q.breakable()
6584 q.text("xid = ");
6585 if self.xid != None:
6586 q.text("%#x" % self.xid)
6587 else:
6588 q.text('None')
6589 q.text(","); q.breakable()
6590 q.text("flags = ");
6591 q.text("%#x" % self.flags)
6592 q.text(","); q.breakable()
6593 q.text("port_no = ");
6594 q.text(util.pretty_port(self.port_no))
6595 q.breakable()
6596 q.text('}')
6597
6598bsn_stats_request.subtypes[8] = bsn_port_counter_stats_request
6599
Rich Lane5454b682014-01-14 17:07:36 -08006600class bsn_role_status(bsn_header):
6601 version = 4
6602 type = 4
6603 experimenter = 6035143
6604 subtype = 55
6605
6606 def __init__(self, xid=None, role=None, reason=None, generation_id=None):
6607 if xid != None:
6608 self.xid = xid
6609 else:
6610 self.xid = None
6611 if role != None:
6612 self.role = role
6613 else:
6614 self.role = 0
6615 if reason != None:
6616 self.reason = reason
6617 else:
6618 self.reason = 0
6619 if generation_id != None:
6620 self.generation_id = generation_id
6621 else:
6622 self.generation_id = 0
6623 return
6624
6625 def pack(self):
6626 packed = []
6627 packed.append(struct.pack("!B", self.version))
6628 packed.append(struct.pack("!B", self.type))
6629 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6630 packed.append(struct.pack("!L", self.xid))
6631 packed.append(struct.pack("!L", self.experimenter))
6632 packed.append(struct.pack("!L", self.subtype))
6633 packed.append(struct.pack("!L", self.role))
6634 packed.append(struct.pack("!B", self.reason))
6635 packed.append('\x00' * 3)
6636 packed.append(struct.pack("!Q", self.generation_id))
6637 length = sum([len(x) for x in packed])
6638 packed[2] = struct.pack("!H", length)
6639 return ''.join(packed)
6640
6641 @staticmethod
6642 def unpack(reader):
6643 obj = bsn_role_status()
6644 _version = reader.read("!B")[0]
6645 assert(_version == 4)
6646 _type = reader.read("!B")[0]
6647 assert(_type == 4)
6648 _length = reader.read("!H")[0]
6649 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006650 reader = orig_reader.slice(_length, 4)
Rich Lane5454b682014-01-14 17:07:36 -08006651 obj.xid = reader.read("!L")[0]
6652 _experimenter = reader.read("!L")[0]
6653 assert(_experimenter == 6035143)
6654 _subtype = reader.read("!L")[0]
6655 assert(_subtype == 55)
6656 obj.role = reader.read("!L")[0]
6657 obj.reason = reader.read("!B")[0]
6658 reader.skip(3)
6659 obj.generation_id = reader.read("!Q")[0]
6660 return obj
6661
6662 def __eq__(self, other):
6663 if type(self) != type(other): return False
6664 if self.xid != other.xid: return False
6665 if self.role != other.role: return False
6666 if self.reason != other.reason: return False
6667 if self.generation_id != other.generation_id: return False
6668 return True
6669
6670 def pretty_print(self, q):
6671 q.text("bsn_role_status {")
6672 with q.group():
6673 with q.indent(2):
6674 q.breakable()
6675 q.text("xid = ");
6676 if self.xid != None:
6677 q.text("%#x" % self.xid)
6678 else:
6679 q.text('None')
6680 q.text(","); q.breakable()
6681 q.text("role = ");
6682 q.text("%#x" % self.role)
6683 q.text(","); q.breakable()
6684 q.text("reason = ");
6685 q.text("%#x" % self.reason)
6686 q.text(","); q.breakable()
6687 q.text("generation_id = ");
6688 q.text("%#x" % self.generation_id)
6689 q.breakable()
6690 q.text('}')
6691
6692bsn_header.subtypes[55] = bsn_role_status
6693
Rich Lane95f7fc92014-01-27 17:08:16 -08006694class bsn_set_aux_cxns_reply(bsn_header):
6695 version = 4
6696 type = 4
6697 experimenter = 6035143
6698 subtype = 59
6699
6700 def __init__(self, xid=None, num_aux=None, status=None):
6701 if xid != None:
6702 self.xid = xid
6703 else:
6704 self.xid = None
6705 if num_aux != None:
6706 self.num_aux = num_aux
6707 else:
6708 self.num_aux = 0
6709 if status != None:
6710 self.status = status
6711 else:
6712 self.status = 0
6713 return
6714
6715 def pack(self):
6716 packed = []
6717 packed.append(struct.pack("!B", self.version))
6718 packed.append(struct.pack("!B", self.type))
6719 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6720 packed.append(struct.pack("!L", self.xid))
6721 packed.append(struct.pack("!L", self.experimenter))
6722 packed.append(struct.pack("!L", self.subtype))
6723 packed.append(struct.pack("!L", self.num_aux))
6724 packed.append(struct.pack("!L", self.status))
6725 length = sum([len(x) for x in packed])
6726 packed[2] = struct.pack("!H", length)
6727 return ''.join(packed)
6728
6729 @staticmethod
6730 def unpack(reader):
6731 obj = bsn_set_aux_cxns_reply()
6732 _version = reader.read("!B")[0]
6733 assert(_version == 4)
6734 _type = reader.read("!B")[0]
6735 assert(_type == 4)
6736 _length = reader.read("!H")[0]
6737 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006738 reader = orig_reader.slice(_length, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -08006739 obj.xid = reader.read("!L")[0]
6740 _experimenter = reader.read("!L")[0]
6741 assert(_experimenter == 6035143)
6742 _subtype = reader.read("!L")[0]
6743 assert(_subtype == 59)
6744 obj.num_aux = reader.read("!L")[0]
6745 obj.status = reader.read("!L")[0]
6746 return obj
6747
6748 def __eq__(self, other):
6749 if type(self) != type(other): return False
6750 if self.xid != other.xid: return False
6751 if self.num_aux != other.num_aux: return False
6752 if self.status != other.status: return False
6753 return True
6754
6755 def pretty_print(self, q):
6756 q.text("bsn_set_aux_cxns_reply {")
6757 with q.group():
6758 with q.indent(2):
6759 q.breakable()
6760 q.text("xid = ");
6761 if self.xid != None:
6762 q.text("%#x" % self.xid)
6763 else:
6764 q.text('None')
6765 q.text(","); q.breakable()
6766 q.text("num_aux = ");
6767 q.text("%#x" % self.num_aux)
6768 q.text(","); q.breakable()
6769 q.text("status = ");
6770 q.text("%#x" % self.status)
6771 q.breakable()
6772 q.text('}')
6773
6774bsn_header.subtypes[59] = bsn_set_aux_cxns_reply
6775
6776class bsn_set_aux_cxns_request(bsn_header):
6777 version = 4
6778 type = 4
6779 experimenter = 6035143
6780 subtype = 58
6781
6782 def __init__(self, xid=None, num_aux=None):
6783 if xid != None:
6784 self.xid = xid
6785 else:
6786 self.xid = None
6787 if num_aux != None:
6788 self.num_aux = num_aux
6789 else:
6790 self.num_aux = 0
6791 return
6792
6793 def pack(self):
6794 packed = []
6795 packed.append(struct.pack("!B", self.version))
6796 packed.append(struct.pack("!B", self.type))
6797 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6798 packed.append(struct.pack("!L", self.xid))
6799 packed.append(struct.pack("!L", self.experimenter))
6800 packed.append(struct.pack("!L", self.subtype))
6801 packed.append(struct.pack("!L", self.num_aux))
6802 length = sum([len(x) for x in packed])
6803 packed[2] = struct.pack("!H", length)
6804 return ''.join(packed)
6805
6806 @staticmethod
6807 def unpack(reader):
6808 obj = bsn_set_aux_cxns_request()
6809 _version = reader.read("!B")[0]
6810 assert(_version == 4)
6811 _type = reader.read("!B")[0]
6812 assert(_type == 4)
6813 _length = reader.read("!H")[0]
6814 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006815 reader = orig_reader.slice(_length, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -08006816 obj.xid = reader.read("!L")[0]
6817 _experimenter = reader.read("!L")[0]
6818 assert(_experimenter == 6035143)
6819 _subtype = reader.read("!L")[0]
6820 assert(_subtype == 58)
6821 obj.num_aux = reader.read("!L")[0]
6822 return obj
6823
6824 def __eq__(self, other):
6825 if type(self) != type(other): return False
6826 if self.xid != other.xid: return False
6827 if self.num_aux != other.num_aux: return False
6828 return True
6829
6830 def pretty_print(self, q):
6831 q.text("bsn_set_aux_cxns_request {")
6832 with q.group():
6833 with q.indent(2):
6834 q.breakable()
6835 q.text("xid = ");
6836 if self.xid != None:
6837 q.text("%#x" % self.xid)
6838 else:
6839 q.text('None')
6840 q.text(","); q.breakable()
6841 q.text("num_aux = ");
6842 q.text("%#x" % self.num_aux)
6843 q.breakable()
6844 q.text('}')
6845
6846bsn_header.subtypes[58] = bsn_set_aux_cxns_request
6847
Rich Lane7dcdf022013-12-11 14:45:27 -08006848class bsn_set_lacp_reply(bsn_header):
Rich Lane7b0f2012013-11-22 14:15:26 -08006849 version = 4
6850 type = 4
6851 experimenter = 6035143
6852 subtype = 42
6853
6854 def __init__(self, xid=None, status=None, port_no=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006855 if xid != None:
6856 self.xid = xid
6857 else:
6858 self.xid = None
Rich Lane7b0f2012013-11-22 14:15:26 -08006859 if status != None:
6860 self.status = status
6861 else:
6862 self.status = 0
6863 if port_no != None:
6864 self.port_no = port_no
6865 else:
6866 self.port_no = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08006867 return
Rich Lane7b0f2012013-11-22 14:15:26 -08006868
6869 def pack(self):
6870 packed = []
6871 packed.append(struct.pack("!B", self.version))
6872 packed.append(struct.pack("!B", self.type))
6873 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6874 packed.append(struct.pack("!L", self.xid))
6875 packed.append(struct.pack("!L", self.experimenter))
6876 packed.append(struct.pack("!L", self.subtype))
6877 packed.append(struct.pack("!L", self.status))
6878 packed.append(util.pack_port_no(self.port_no))
6879 length = sum([len(x) for x in packed])
6880 packed[2] = struct.pack("!H", length)
6881 return ''.join(packed)
6882
6883 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006884 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -08006885 obj = bsn_set_lacp_reply()
Rich Lane7b0f2012013-11-22 14:15:26 -08006886 _version = reader.read("!B")[0]
6887 assert(_version == 4)
6888 _type = reader.read("!B")[0]
6889 assert(_type == 4)
6890 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006891 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006892 reader = orig_reader.slice(_length, 4)
Rich Lane7b0f2012013-11-22 14:15:26 -08006893 obj.xid = reader.read("!L")[0]
6894 _experimenter = reader.read("!L")[0]
6895 assert(_experimenter == 6035143)
6896 _subtype = reader.read("!L")[0]
6897 assert(_subtype == 42)
6898 obj.status = reader.read("!L")[0]
6899 obj.port_no = util.unpack_port_no(reader)
6900 return obj
6901
6902 def __eq__(self, other):
6903 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -08006904 if self.xid != other.xid: return False
6905 if self.status != other.status: return False
6906 if self.port_no != other.port_no: return False
6907 return True
6908
Rich Lane7b0f2012013-11-22 14:15:26 -08006909 def pretty_print(self, q):
6910 q.text("bsn_set_lacp_reply {")
6911 with q.group():
6912 with q.indent(2):
6913 q.breakable()
6914 q.text("xid = ");
6915 if self.xid != None:
6916 q.text("%#x" % self.xid)
6917 else:
6918 q.text('None')
6919 q.text(","); q.breakable()
6920 q.text("status = ");
6921 q.text("%#x" % self.status)
6922 q.text(","); q.breakable()
6923 q.text("port_no = ");
6924 q.text(util.pretty_port(self.port_no))
6925 q.breakable()
6926 q.text('}')
6927
Rich Lane7dcdf022013-12-11 14:45:27 -08006928bsn_header.subtypes[42] = bsn_set_lacp_reply
6929
6930class bsn_set_lacp_request(bsn_header):
Rich Lane7b0f2012013-11-22 14:15:26 -08006931 version = 4
6932 type = 4
6933 experimenter = 6035143
6934 subtype = 41
6935
6936 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 -08006937 if xid != None:
6938 self.xid = xid
6939 else:
6940 self.xid = None
Rich Lane7b0f2012013-11-22 14:15:26 -08006941 if enabled != None:
6942 self.enabled = enabled
6943 else:
6944 self.enabled = 0
6945 if port_no != None:
6946 self.port_no = port_no
6947 else:
6948 self.port_no = 0
6949 if actor_sys_priority != None:
6950 self.actor_sys_priority = actor_sys_priority
6951 else:
6952 self.actor_sys_priority = 0
6953 if actor_sys_mac != None:
6954 self.actor_sys_mac = actor_sys_mac
6955 else:
6956 self.actor_sys_mac = [0,0,0,0,0,0]
6957 if actor_port_priority != None:
6958 self.actor_port_priority = actor_port_priority
6959 else:
6960 self.actor_port_priority = 0
6961 if actor_port_num != None:
6962 self.actor_port_num = actor_port_num
6963 else:
6964 self.actor_port_num = 0
6965 if actor_key != None:
6966 self.actor_key = actor_key
6967 else:
6968 self.actor_key = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08006969 return
Rich Lane7b0f2012013-11-22 14:15:26 -08006970
6971 def pack(self):
6972 packed = []
6973 packed.append(struct.pack("!B", self.version))
6974 packed.append(struct.pack("!B", self.type))
6975 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6976 packed.append(struct.pack("!L", self.xid))
6977 packed.append(struct.pack("!L", self.experimenter))
6978 packed.append(struct.pack("!L", self.subtype))
6979 packed.append(struct.pack("!B", self.enabled))
6980 packed.append('\x00' * 3)
6981 packed.append(util.pack_port_no(self.port_no))
6982 packed.append(struct.pack("!H", self.actor_sys_priority))
6983 packed.append(struct.pack("!6B", *self.actor_sys_mac))
6984 packed.append(struct.pack("!H", self.actor_port_priority))
6985 packed.append(struct.pack("!H", self.actor_port_num))
6986 packed.append(struct.pack("!H", self.actor_key))
6987 length = sum([len(x) for x in packed])
6988 packed[2] = struct.pack("!H", length)
6989 return ''.join(packed)
6990
6991 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006992 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -08006993 obj = bsn_set_lacp_request()
Rich Lane7b0f2012013-11-22 14:15:26 -08006994 _version = reader.read("!B")[0]
6995 assert(_version == 4)
6996 _type = reader.read("!B")[0]
6997 assert(_type == 4)
6998 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006999 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007000 reader = orig_reader.slice(_length, 4)
Rich Lane7b0f2012013-11-22 14:15:26 -08007001 obj.xid = reader.read("!L")[0]
7002 _experimenter = reader.read("!L")[0]
7003 assert(_experimenter == 6035143)
7004 _subtype = reader.read("!L")[0]
7005 assert(_subtype == 41)
7006 obj.enabled = reader.read("!B")[0]
7007 reader.skip(3)
7008 obj.port_no = util.unpack_port_no(reader)
7009 obj.actor_sys_priority = reader.read("!H")[0]
7010 obj.actor_sys_mac = list(reader.read('!6B'))
7011 obj.actor_port_priority = reader.read("!H")[0]
7012 obj.actor_port_num = reader.read("!H")[0]
7013 obj.actor_key = reader.read("!H")[0]
7014 return obj
7015
7016 def __eq__(self, other):
7017 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -08007018 if self.xid != other.xid: return False
7019 if self.enabled != other.enabled: return False
7020 if self.port_no != other.port_no: return False
7021 if self.actor_sys_priority != other.actor_sys_priority: return False
7022 if self.actor_sys_mac != other.actor_sys_mac: return False
7023 if self.actor_port_priority != other.actor_port_priority: return False
7024 if self.actor_port_num != other.actor_port_num: return False
7025 if self.actor_key != other.actor_key: return False
7026 return True
7027
Rich Lane7b0f2012013-11-22 14:15:26 -08007028 def pretty_print(self, q):
7029 q.text("bsn_set_lacp_request {")
7030 with q.group():
7031 with q.indent(2):
7032 q.breakable()
7033 q.text("xid = ");
7034 if self.xid != None:
7035 q.text("%#x" % self.xid)
7036 else:
7037 q.text('None')
7038 q.text(","); q.breakable()
7039 q.text("enabled = ");
7040 q.text("%#x" % self.enabled)
7041 q.text(","); q.breakable()
7042 q.text("port_no = ");
7043 q.text(util.pretty_port(self.port_no))
7044 q.text(","); q.breakable()
7045 q.text("actor_sys_priority = ");
7046 q.text("%#x" % self.actor_sys_priority)
7047 q.text(","); q.breakable()
7048 q.text("actor_sys_mac = ");
7049 q.text(util.pretty_mac(self.actor_sys_mac))
7050 q.text(","); q.breakable()
7051 q.text("actor_port_priority = ");
7052 q.text("%#x" % self.actor_port_priority)
7053 q.text(","); q.breakable()
7054 q.text("actor_port_num = ");
7055 q.text("%#x" % self.actor_port_num)
7056 q.text(","); q.breakable()
7057 q.text("actor_key = ");
7058 q.text("%#x" % self.actor_key)
7059 q.breakable()
7060 q.text('}')
7061
Rich Lane7dcdf022013-12-11 14:45:27 -08007062bsn_header.subtypes[41] = bsn_set_lacp_request
7063
7064class bsn_set_mirroring(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07007065 version = 4
7066 type = 4
7067 experimenter = 6035143
Rich Lanec2ee4b82013-04-24 17:12:38 -07007068 subtype = 3
7069
7070 def __init__(self, xid=None, report_mirror_ports=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007071 if xid != None:
7072 self.xid = xid
7073 else:
7074 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07007075 if report_mirror_ports != None:
7076 self.report_mirror_ports = report_mirror_ports
7077 else:
7078 self.report_mirror_ports = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08007079 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07007080
7081 def pack(self):
7082 packed = []
7083 packed.append(struct.pack("!B", self.version))
7084 packed.append(struct.pack("!B", self.type))
7085 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7086 packed.append(struct.pack("!L", self.xid))
7087 packed.append(struct.pack("!L", self.experimenter))
7088 packed.append(struct.pack("!L", self.subtype))
7089 packed.append(struct.pack("!B", self.report_mirror_ports))
7090 packed.append('\x00' * 3)
7091 length = sum([len(x) for x in packed])
7092 packed[2] = struct.pack("!H", length)
7093 return ''.join(packed)
7094
7095 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007096 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07007097 obj = bsn_set_mirroring()
Dan Talaycof6202252013-07-02 01:00:29 -07007098 _version = reader.read("!B")[0]
7099 assert(_version == 4)
7100 _type = reader.read("!B")[0]
7101 assert(_type == 4)
7102 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007103 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007104 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07007105 obj.xid = reader.read("!L")[0]
7106 _experimenter = reader.read("!L")[0]
7107 assert(_experimenter == 6035143)
7108 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007109 assert(_subtype == 3)
Dan Talaycof6202252013-07-02 01:00:29 -07007110 obj.report_mirror_ports = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007111 reader.skip(3)
7112 return obj
7113
7114 def __eq__(self, other):
7115 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07007116 if self.xid != other.xid: return False
7117 if self.report_mirror_ports != other.report_mirror_ports: return False
7118 return True
7119
Rich Lanec2ee4b82013-04-24 17:12:38 -07007120 def pretty_print(self, q):
7121 q.text("bsn_set_mirroring {")
7122 with q.group():
7123 with q.indent(2):
7124 q.breakable()
7125 q.text("xid = ");
7126 if self.xid != None:
7127 q.text("%#x" % self.xid)
7128 else:
7129 q.text('None')
7130 q.text(","); q.breakable()
7131 q.text("report_mirror_ports = ");
7132 q.text("%#x" % self.report_mirror_ports)
7133 q.breakable()
7134 q.text('}')
7135
Rich Lane7dcdf022013-12-11 14:45:27 -08007136bsn_header.subtypes[3] = bsn_set_mirroring
7137
7138class bsn_set_pktin_suppression_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07007139 version = 4
7140 type = 4
7141 experimenter = 6035143
7142 subtype = 25
7143
7144 def __init__(self, xid=None, status=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007145 if xid != None:
7146 self.xid = xid
7147 else:
7148 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07007149 if status != None:
7150 self.status = status
7151 else:
7152 self.status = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08007153 return
Dan Talaycof6202252013-07-02 01:00:29 -07007154
7155 def pack(self):
7156 packed = []
7157 packed.append(struct.pack("!B", self.version))
7158 packed.append(struct.pack("!B", self.type))
7159 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7160 packed.append(struct.pack("!L", self.xid))
7161 packed.append(struct.pack("!L", self.experimenter))
7162 packed.append(struct.pack("!L", self.subtype))
7163 packed.append(struct.pack("!L", self.status))
7164 length = sum([len(x) for x in packed])
7165 packed[2] = struct.pack("!H", length)
7166 return ''.join(packed)
7167
7168 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007169 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07007170 obj = bsn_set_pktin_suppression_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07007171 _version = reader.read("!B")[0]
7172 assert(_version == 4)
7173 _type = reader.read("!B")[0]
7174 assert(_type == 4)
7175 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007176 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007177 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07007178 obj.xid = reader.read("!L")[0]
7179 _experimenter = reader.read("!L")[0]
7180 assert(_experimenter == 6035143)
7181 _subtype = reader.read("!L")[0]
7182 assert(_subtype == 25)
7183 obj.status = reader.read("!L")[0]
7184 return obj
7185
7186 def __eq__(self, other):
7187 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07007188 if self.xid != other.xid: return False
7189 if self.status != other.status: return False
7190 return True
7191
Dan Talaycof6202252013-07-02 01:00:29 -07007192 def pretty_print(self, q):
7193 q.text("bsn_set_pktin_suppression_reply {")
7194 with q.group():
7195 with q.indent(2):
7196 q.breakable()
7197 q.text("xid = ");
7198 if self.xid != None:
7199 q.text("%#x" % self.xid)
7200 else:
7201 q.text('None')
7202 q.text(","); q.breakable()
7203 q.text("status = ");
7204 q.text("%#x" % self.status)
7205 q.breakable()
7206 q.text('}')
7207
Rich Lane7dcdf022013-12-11 14:45:27 -08007208bsn_header.subtypes[25] = bsn_set_pktin_suppression_reply
7209
7210class bsn_set_pktin_suppression_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07007211 version = 4
7212 type = 4
7213 experimenter = 6035143
Rich Lanec2ee4b82013-04-24 17:12:38 -07007214 subtype = 11
7215
7216 def __init__(self, xid=None, enabled=None, idle_timeout=None, hard_timeout=None, priority=None, cookie=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007217 if xid != None:
7218 self.xid = xid
7219 else:
7220 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07007221 if enabled != None:
7222 self.enabled = enabled
7223 else:
7224 self.enabled = 0
7225 if idle_timeout != None:
7226 self.idle_timeout = idle_timeout
7227 else:
7228 self.idle_timeout = 0
7229 if hard_timeout != None:
7230 self.hard_timeout = hard_timeout
7231 else:
7232 self.hard_timeout = 0
7233 if priority != None:
7234 self.priority = priority
7235 else:
7236 self.priority = 0
7237 if cookie != None:
7238 self.cookie = cookie
7239 else:
7240 self.cookie = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08007241 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07007242
7243 def pack(self):
7244 packed = []
7245 packed.append(struct.pack("!B", self.version))
7246 packed.append(struct.pack("!B", self.type))
7247 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7248 packed.append(struct.pack("!L", self.xid))
7249 packed.append(struct.pack("!L", self.experimenter))
7250 packed.append(struct.pack("!L", self.subtype))
7251 packed.append(struct.pack("!B", self.enabled))
7252 packed.append('\x00' * 1)
7253 packed.append(struct.pack("!H", self.idle_timeout))
7254 packed.append(struct.pack("!H", self.hard_timeout))
7255 packed.append(struct.pack("!H", self.priority))
7256 packed.append(struct.pack("!Q", self.cookie))
7257 length = sum([len(x) for x in packed])
7258 packed[2] = struct.pack("!H", length)
7259 return ''.join(packed)
7260
7261 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007262 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07007263 obj = bsn_set_pktin_suppression_request()
Dan Talaycof6202252013-07-02 01:00:29 -07007264 _version = reader.read("!B")[0]
7265 assert(_version == 4)
7266 _type = reader.read("!B")[0]
7267 assert(_type == 4)
7268 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007269 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007270 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07007271 obj.xid = reader.read("!L")[0]
7272 _experimenter = reader.read("!L")[0]
7273 assert(_experimenter == 6035143)
7274 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007275 assert(_subtype == 11)
Dan Talaycof6202252013-07-02 01:00:29 -07007276 obj.enabled = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007277 reader.skip(1)
Dan Talaycof6202252013-07-02 01:00:29 -07007278 obj.idle_timeout = reader.read("!H")[0]
7279 obj.hard_timeout = reader.read("!H")[0]
7280 obj.priority = reader.read("!H")[0]
7281 obj.cookie = reader.read("!Q")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007282 return obj
7283
7284 def __eq__(self, other):
7285 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07007286 if self.xid != other.xid: return False
7287 if self.enabled != other.enabled: return False
7288 if self.idle_timeout != other.idle_timeout: return False
7289 if self.hard_timeout != other.hard_timeout: return False
7290 if self.priority != other.priority: return False
7291 if self.cookie != other.cookie: return False
7292 return True
7293
Rich Lanec2ee4b82013-04-24 17:12:38 -07007294 def pretty_print(self, q):
Dan Talaycof6202252013-07-02 01:00:29 -07007295 q.text("bsn_set_pktin_suppression_request {")
Rich Lanec2ee4b82013-04-24 17:12:38 -07007296 with q.group():
7297 with q.indent(2):
7298 q.breakable()
7299 q.text("xid = ");
7300 if self.xid != None:
7301 q.text("%#x" % self.xid)
7302 else:
7303 q.text('None')
7304 q.text(","); q.breakable()
7305 q.text("enabled = ");
7306 q.text("%#x" % self.enabled)
7307 q.text(","); q.breakable()
7308 q.text("idle_timeout = ");
7309 q.text("%#x" % self.idle_timeout)
7310 q.text(","); q.breakable()
7311 q.text("hard_timeout = ");
7312 q.text("%#x" % self.hard_timeout)
7313 q.text(","); q.breakable()
7314 q.text("priority = ");
7315 q.text("%#x" % self.priority)
7316 q.text(","); q.breakable()
7317 q.text("cookie = ");
7318 q.text("%#x" % self.cookie)
7319 q.breakable()
7320 q.text('}')
7321
Rich Lane7dcdf022013-12-11 14:45:27 -08007322bsn_header.subtypes[11] = bsn_set_pktin_suppression_request
7323
7324class bsn_set_switch_pipeline_reply(bsn_header):
7325 version = 4
7326 type = 4
7327 experimenter = 6035143
7328 subtype = 54
7329
7330 def __init__(self, xid=None, status=None):
7331 if xid != None:
7332 self.xid = xid
7333 else:
7334 self.xid = None
7335 if status != None:
7336 self.status = status
7337 else:
7338 self.status = 0
7339 return
7340
7341 def pack(self):
7342 packed = []
7343 packed.append(struct.pack("!B", self.version))
7344 packed.append(struct.pack("!B", self.type))
7345 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7346 packed.append(struct.pack("!L", self.xid))
7347 packed.append(struct.pack("!L", self.experimenter))
7348 packed.append(struct.pack("!L", self.subtype))
7349 packed.append(struct.pack("!L", self.status))
7350 length = sum([len(x) for x in packed])
7351 packed[2] = struct.pack("!H", length)
7352 return ''.join(packed)
7353
7354 @staticmethod
7355 def unpack(reader):
7356 obj = bsn_set_switch_pipeline_reply()
7357 _version = reader.read("!B")[0]
7358 assert(_version == 4)
7359 _type = reader.read("!B")[0]
7360 assert(_type == 4)
7361 _length = reader.read("!H")[0]
7362 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007363 reader = orig_reader.slice(_length, 4)
Rich Lane7dcdf022013-12-11 14:45:27 -08007364 obj.xid = reader.read("!L")[0]
7365 _experimenter = reader.read("!L")[0]
7366 assert(_experimenter == 6035143)
7367 _subtype = reader.read("!L")[0]
7368 assert(_subtype == 54)
7369 obj.status = reader.read("!L")[0]
7370 return obj
7371
7372 def __eq__(self, other):
7373 if type(self) != type(other): return False
7374 if self.xid != other.xid: return False
7375 if self.status != other.status: return False
7376 return True
7377
7378 def pretty_print(self, q):
7379 q.text("bsn_set_switch_pipeline_reply {")
7380 with q.group():
7381 with q.indent(2):
7382 q.breakable()
7383 q.text("xid = ");
7384 if self.xid != None:
7385 q.text("%#x" % self.xid)
7386 else:
7387 q.text('None')
7388 q.text(","); q.breakable()
7389 q.text("status = ");
7390 q.text("%#x" % self.status)
7391 q.breakable()
7392 q.text('}')
7393
7394bsn_header.subtypes[54] = bsn_set_switch_pipeline_reply
7395
7396class bsn_set_switch_pipeline_request(bsn_header):
7397 version = 4
7398 type = 4
7399 experimenter = 6035143
7400 subtype = 53
7401
7402 def __init__(self, xid=None, pipeline=None):
7403 if xid != None:
7404 self.xid = xid
7405 else:
7406 self.xid = None
7407 if pipeline != None:
7408 self.pipeline = pipeline
7409 else:
7410 self.pipeline = ""
7411 return
7412
7413 def pack(self):
7414 packed = []
7415 packed.append(struct.pack("!B", self.version))
7416 packed.append(struct.pack("!B", self.type))
7417 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7418 packed.append(struct.pack("!L", self.xid))
7419 packed.append(struct.pack("!L", self.experimenter))
7420 packed.append(struct.pack("!L", self.subtype))
7421 packed.append(struct.pack("!256s", self.pipeline))
7422 length = sum([len(x) for x in packed])
7423 packed[2] = struct.pack("!H", length)
7424 return ''.join(packed)
7425
7426 @staticmethod
7427 def unpack(reader):
7428 obj = bsn_set_switch_pipeline_request()
7429 _version = reader.read("!B")[0]
7430 assert(_version == 4)
7431 _type = reader.read("!B")[0]
7432 assert(_type == 4)
7433 _length = reader.read("!H")[0]
7434 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007435 reader = orig_reader.slice(_length, 4)
Rich Lane7dcdf022013-12-11 14:45:27 -08007436 obj.xid = reader.read("!L")[0]
7437 _experimenter = reader.read("!L")[0]
7438 assert(_experimenter == 6035143)
7439 _subtype = reader.read("!L")[0]
7440 assert(_subtype == 53)
7441 obj.pipeline = reader.read("!256s")[0].rstrip("\x00")
7442 return obj
7443
7444 def __eq__(self, other):
7445 if type(self) != type(other): return False
7446 if self.xid != other.xid: return False
7447 if self.pipeline != other.pipeline: return False
7448 return True
7449
7450 def pretty_print(self, q):
7451 q.text("bsn_set_switch_pipeline_request {")
7452 with q.group():
7453 with q.indent(2):
7454 q.breakable()
7455 q.text("xid = ");
7456 if self.xid != None:
7457 q.text("%#x" % self.xid)
7458 else:
7459 q.text('None')
7460 q.text(","); q.breakable()
7461 q.text("pipeline = ");
7462 q.pp(self.pipeline)
7463 q.breakable()
7464 q.text('}')
7465
7466bsn_header.subtypes[53] = bsn_set_switch_pipeline_request
7467
7468class bsn_switch_pipeline_stats_reply(bsn_stats_reply):
7469 version = 4
7470 type = 19
7471 stats_type = 65535
7472 experimenter = 6035143
7473 subtype = 6
7474
7475 def __init__(self, xid=None, flags=None, entries=None):
7476 if xid != None:
7477 self.xid = xid
7478 else:
7479 self.xid = None
7480 if flags != None:
7481 self.flags = flags
7482 else:
7483 self.flags = 0
7484 if entries != None:
7485 self.entries = entries
7486 else:
7487 self.entries = []
7488 return
7489
7490 def pack(self):
7491 packed = []
7492 packed.append(struct.pack("!B", self.version))
7493 packed.append(struct.pack("!B", self.type))
7494 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7495 packed.append(struct.pack("!L", self.xid))
7496 packed.append(struct.pack("!H", self.stats_type))
7497 packed.append(struct.pack("!H", self.flags))
7498 packed.append('\x00' * 4)
7499 packed.append(struct.pack("!L", self.experimenter))
7500 packed.append(struct.pack("!L", self.subtype))
7501 packed.append(loxi.generic_util.pack_list(self.entries))
7502 length = sum([len(x) for x in packed])
7503 packed[2] = struct.pack("!H", length)
7504 return ''.join(packed)
7505
7506 @staticmethod
7507 def unpack(reader):
7508 obj = bsn_switch_pipeline_stats_reply()
7509 _version = reader.read("!B")[0]
7510 assert(_version == 4)
7511 _type = reader.read("!B")[0]
7512 assert(_type == 19)
7513 _length = reader.read("!H")[0]
7514 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007515 reader = orig_reader.slice(_length, 4)
Rich Lane7dcdf022013-12-11 14:45:27 -08007516 obj.xid = reader.read("!L")[0]
7517 _stats_type = reader.read("!H")[0]
7518 assert(_stats_type == 65535)
7519 obj.flags = reader.read("!H")[0]
7520 reader.skip(4)
7521 _experimenter = reader.read("!L")[0]
7522 assert(_experimenter == 6035143)
7523 _subtype = reader.read("!L")[0]
7524 assert(_subtype == 6)
7525 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_switch_pipeline_stats_entry.unpack)
7526 return obj
7527
7528 def __eq__(self, other):
7529 if type(self) != type(other): return False
7530 if self.xid != other.xid: return False
7531 if self.flags != other.flags: return False
7532 if self.entries != other.entries: return False
7533 return True
7534
7535 def pretty_print(self, q):
7536 q.text("bsn_switch_pipeline_stats_reply {")
7537 with q.group():
7538 with q.indent(2):
7539 q.breakable()
7540 q.text("xid = ");
7541 if self.xid != None:
7542 q.text("%#x" % self.xid)
7543 else:
7544 q.text('None')
7545 q.text(","); q.breakable()
7546 q.text("flags = ");
7547 q.text("%#x" % self.flags)
7548 q.text(","); q.breakable()
7549 q.text("entries = ");
7550 q.pp(self.entries)
7551 q.breakable()
7552 q.text('}')
7553
7554bsn_stats_reply.subtypes[6] = bsn_switch_pipeline_stats_reply
7555
7556class bsn_switch_pipeline_stats_request(bsn_stats_request):
7557 version = 4
7558 type = 18
7559 stats_type = 65535
7560 experimenter = 6035143
7561 subtype = 6
7562
7563 def __init__(self, xid=None, flags=None):
7564 if xid != None:
7565 self.xid = xid
7566 else:
7567 self.xid = None
7568 if flags != None:
7569 self.flags = flags
7570 else:
7571 self.flags = 0
7572 return
7573
7574 def pack(self):
7575 packed = []
7576 packed.append(struct.pack("!B", self.version))
7577 packed.append(struct.pack("!B", self.type))
7578 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7579 packed.append(struct.pack("!L", self.xid))
7580 packed.append(struct.pack("!H", self.stats_type))
7581 packed.append(struct.pack("!H", self.flags))
7582 packed.append('\x00' * 4)
7583 packed.append(struct.pack("!L", self.experimenter))
7584 packed.append(struct.pack("!L", self.subtype))
7585 length = sum([len(x) for x in packed])
7586 packed[2] = struct.pack("!H", length)
7587 return ''.join(packed)
7588
7589 @staticmethod
7590 def unpack(reader):
7591 obj = bsn_switch_pipeline_stats_request()
7592 _version = reader.read("!B")[0]
7593 assert(_version == 4)
7594 _type = reader.read("!B")[0]
7595 assert(_type == 18)
7596 _length = reader.read("!H")[0]
7597 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007598 reader = orig_reader.slice(_length, 4)
Rich Lane7dcdf022013-12-11 14:45:27 -08007599 obj.xid = reader.read("!L")[0]
7600 _stats_type = reader.read("!H")[0]
7601 assert(_stats_type == 65535)
7602 obj.flags = reader.read("!H")[0]
7603 reader.skip(4)
7604 _experimenter = reader.read("!L")[0]
7605 assert(_experimenter == 6035143)
7606 _subtype = reader.read("!L")[0]
7607 assert(_subtype == 6)
7608 return obj
7609
7610 def __eq__(self, other):
7611 if type(self) != type(other): return False
7612 if self.xid != other.xid: return False
7613 if self.flags != other.flags: return False
7614 return True
7615
7616 def pretty_print(self, q):
7617 q.text("bsn_switch_pipeline_stats_request {")
7618 with q.group():
7619 with q.indent(2):
7620 q.breakable()
7621 q.text("xid = ");
7622 if self.xid != None:
7623 q.text("%#x" % self.xid)
7624 else:
7625 q.text('None')
7626 q.text(","); q.breakable()
7627 q.text("flags = ");
7628 q.text("%#x" % self.flags)
7629 q.breakable()
7630 q.text('}')
7631
7632bsn_stats_request.subtypes[6] = bsn_switch_pipeline_stats_request
7633
Rich Lane9ec3fca2014-02-26 16:22:56 -08007634class bsn_table_checksum_stats_reply(bsn_stats_reply):
7635 version = 4
7636 type = 19
7637 stats_type = 65535
7638 experimenter = 6035143
7639 subtype = 11
7640
7641 def __init__(self, xid=None, flags=None, entries=None):
7642 if xid != None:
7643 self.xid = xid
7644 else:
7645 self.xid = None
7646 if flags != None:
7647 self.flags = flags
7648 else:
7649 self.flags = 0
7650 if entries != None:
7651 self.entries = entries
7652 else:
7653 self.entries = []
7654 return
7655
7656 def pack(self):
7657 packed = []
7658 packed.append(struct.pack("!B", self.version))
7659 packed.append(struct.pack("!B", self.type))
7660 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7661 packed.append(struct.pack("!L", self.xid))
7662 packed.append(struct.pack("!H", self.stats_type))
7663 packed.append(struct.pack("!H", self.flags))
7664 packed.append('\x00' * 4)
7665 packed.append(struct.pack("!L", self.experimenter))
7666 packed.append(struct.pack("!L", self.subtype))
7667 packed.append(loxi.generic_util.pack_list(self.entries))
7668 length = sum([len(x) for x in packed])
7669 packed[2] = struct.pack("!H", length)
7670 return ''.join(packed)
7671
7672 @staticmethod
7673 def unpack(reader):
7674 obj = bsn_table_checksum_stats_reply()
7675 _version = reader.read("!B")[0]
7676 assert(_version == 4)
7677 _type = reader.read("!B")[0]
7678 assert(_type == 19)
7679 _length = reader.read("!H")[0]
7680 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007681 reader = orig_reader.slice(_length, 4)
Rich Lane9ec3fca2014-02-26 16:22:56 -08007682 obj.xid = reader.read("!L")[0]
7683 _stats_type = reader.read("!H")[0]
7684 assert(_stats_type == 65535)
7685 obj.flags = reader.read("!H")[0]
7686 reader.skip(4)
7687 _experimenter = reader.read("!L")[0]
7688 assert(_experimenter == 6035143)
7689 _subtype = reader.read("!L")[0]
7690 assert(_subtype == 11)
7691 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_table_checksum_stats_entry.unpack)
7692 return obj
7693
7694 def __eq__(self, other):
7695 if type(self) != type(other): return False
7696 if self.xid != other.xid: return False
7697 if self.flags != other.flags: return False
7698 if self.entries != other.entries: return False
7699 return True
7700
7701 def pretty_print(self, q):
7702 q.text("bsn_table_checksum_stats_reply {")
7703 with q.group():
7704 with q.indent(2):
7705 q.breakable()
7706 q.text("xid = ");
7707 if self.xid != None:
7708 q.text("%#x" % self.xid)
7709 else:
7710 q.text('None')
7711 q.text(","); q.breakable()
7712 q.text("flags = ");
7713 q.text("%#x" % self.flags)
7714 q.text(","); q.breakable()
7715 q.text("entries = ");
7716 q.pp(self.entries)
7717 q.breakable()
7718 q.text('}')
7719
7720bsn_stats_reply.subtypes[11] = bsn_table_checksum_stats_reply
7721
7722class bsn_table_checksum_stats_request(bsn_stats_request):
7723 version = 4
7724 type = 18
7725 stats_type = 65535
7726 experimenter = 6035143
7727 subtype = 11
7728
7729 def __init__(self, xid=None, flags=None):
7730 if xid != None:
7731 self.xid = xid
7732 else:
7733 self.xid = None
7734 if flags != None:
7735 self.flags = flags
7736 else:
7737 self.flags = 0
7738 return
7739
7740 def pack(self):
7741 packed = []
7742 packed.append(struct.pack("!B", self.version))
7743 packed.append(struct.pack("!B", self.type))
7744 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7745 packed.append(struct.pack("!L", self.xid))
7746 packed.append(struct.pack("!H", self.stats_type))
7747 packed.append(struct.pack("!H", self.flags))
7748 packed.append('\x00' * 4)
7749 packed.append(struct.pack("!L", self.experimenter))
7750 packed.append(struct.pack("!L", self.subtype))
7751 length = sum([len(x) for x in packed])
7752 packed[2] = struct.pack("!H", length)
7753 return ''.join(packed)
7754
7755 @staticmethod
7756 def unpack(reader):
7757 obj = bsn_table_checksum_stats_request()
7758 _version = reader.read("!B")[0]
7759 assert(_version == 4)
7760 _type = reader.read("!B")[0]
7761 assert(_type == 18)
7762 _length = reader.read("!H")[0]
7763 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007764 reader = orig_reader.slice(_length, 4)
Rich Lane9ec3fca2014-02-26 16:22:56 -08007765 obj.xid = reader.read("!L")[0]
7766 _stats_type = reader.read("!H")[0]
7767 assert(_stats_type == 65535)
7768 obj.flags = reader.read("!H")[0]
7769 reader.skip(4)
7770 _experimenter = reader.read("!L")[0]
7771 assert(_experimenter == 6035143)
7772 _subtype = reader.read("!L")[0]
7773 assert(_subtype == 11)
7774 return obj
7775
7776 def __eq__(self, other):
7777 if type(self) != type(other): return False
7778 if self.xid != other.xid: return False
7779 if self.flags != other.flags: return False
7780 return True
7781
7782 def pretty_print(self, q):
7783 q.text("bsn_table_checksum_stats_request {")
7784 with q.group():
7785 with q.indent(2):
7786 q.breakable()
7787 q.text("xid = ");
7788 if self.xid != None:
7789 q.text("%#x" % self.xid)
7790 else:
7791 q.text('None')
7792 q.text(","); q.breakable()
7793 q.text("flags = ");
7794 q.text("%#x" % self.flags)
7795 q.breakable()
7796 q.text('}')
7797
7798bsn_stats_request.subtypes[11] = bsn_table_checksum_stats_request
7799
7800class bsn_table_set_buckets_size(bsn_header):
7801 version = 4
7802 type = 4
7803 experimenter = 6035143
7804 subtype = 61
7805
7806 def __init__(self, xid=None, table_id=None, buckets_size=None):
7807 if xid != None:
7808 self.xid = xid
7809 else:
7810 self.xid = None
7811 if table_id != None:
7812 self.table_id = table_id
7813 else:
7814 self.table_id = 0
7815 if buckets_size != None:
7816 self.buckets_size = buckets_size
7817 else:
7818 self.buckets_size = 0
7819 return
7820
7821 def pack(self):
7822 packed = []
7823 packed.append(struct.pack("!B", self.version))
7824 packed.append(struct.pack("!B", self.type))
7825 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7826 packed.append(struct.pack("!L", self.xid))
7827 packed.append(struct.pack("!L", self.experimenter))
7828 packed.append(struct.pack("!L", self.subtype))
Rich Lane5587ab12014-06-30 11:19:09 -07007829 packed.append('\x00' * 1)
7830 packed.append(struct.pack("!B", self.table_id))
Rich Lane9ec3fca2014-02-26 16:22:56 -08007831 packed.append('\x00' * 2)
7832 packed.append(struct.pack("!L", self.buckets_size))
7833 length = sum([len(x) for x in packed])
7834 packed[2] = struct.pack("!H", length)
7835 return ''.join(packed)
7836
7837 @staticmethod
7838 def unpack(reader):
7839 obj = bsn_table_set_buckets_size()
7840 _version = reader.read("!B")[0]
7841 assert(_version == 4)
7842 _type = reader.read("!B")[0]
7843 assert(_type == 4)
7844 _length = reader.read("!H")[0]
7845 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007846 reader = orig_reader.slice(_length, 4)
Rich Lane9ec3fca2014-02-26 16:22:56 -08007847 obj.xid = reader.read("!L")[0]
7848 _experimenter = reader.read("!L")[0]
7849 assert(_experimenter == 6035143)
7850 _subtype = reader.read("!L")[0]
7851 assert(_subtype == 61)
Rich Lane5587ab12014-06-30 11:19:09 -07007852 reader.skip(1)
7853 obj.table_id = reader.read("!B")[0]
Rich Lane9ec3fca2014-02-26 16:22:56 -08007854 reader.skip(2)
7855 obj.buckets_size = reader.read("!L")[0]
7856 return obj
7857
7858 def __eq__(self, other):
7859 if type(self) != type(other): return False
7860 if self.xid != other.xid: return False
7861 if self.table_id != other.table_id: return False
7862 if self.buckets_size != other.buckets_size: return False
7863 return True
7864
7865 def pretty_print(self, q):
7866 q.text("bsn_table_set_buckets_size {")
7867 with q.group():
7868 with q.indent(2):
7869 q.breakable()
7870 q.text("xid = ");
7871 if self.xid != None:
7872 q.text("%#x" % self.xid)
7873 else:
7874 q.text('None')
7875 q.text(","); q.breakable()
7876 q.text("table_id = ");
7877 q.text("%#x" % self.table_id)
7878 q.text(","); q.breakable()
7879 q.text("buckets_size = ");
7880 q.text("%#x" % self.buckets_size)
7881 q.breakable()
7882 q.text('}')
7883
7884bsn_header.subtypes[61] = bsn_table_set_buckets_size
7885
Rich Lane7dcdf022013-12-11 14:45:27 -08007886class bsn_time_reply(bsn_header):
Rich Lane7b0f2012013-11-22 14:15:26 -08007887 version = 4
7888 type = 4
7889 experimenter = 6035143
7890 subtype = 45
7891
7892 def __init__(self, xid=None, time_ms=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007893 if xid != None:
7894 self.xid = xid
7895 else:
7896 self.xid = None
Rich Lane7b0f2012013-11-22 14:15:26 -08007897 if time_ms != None:
7898 self.time_ms = time_ms
7899 else:
7900 self.time_ms = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08007901 return
Rich Lane7b0f2012013-11-22 14:15:26 -08007902
7903 def pack(self):
7904 packed = []
7905 packed.append(struct.pack("!B", self.version))
7906 packed.append(struct.pack("!B", self.type))
7907 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7908 packed.append(struct.pack("!L", self.xid))
7909 packed.append(struct.pack("!L", self.experimenter))
7910 packed.append(struct.pack("!L", self.subtype))
7911 packed.append(struct.pack("!Q", self.time_ms))
7912 length = sum([len(x) for x in packed])
7913 packed[2] = struct.pack("!H", length)
7914 return ''.join(packed)
7915
7916 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007917 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -08007918 obj = bsn_time_reply()
Rich Lane7b0f2012013-11-22 14:15:26 -08007919 _version = reader.read("!B")[0]
7920 assert(_version == 4)
7921 _type = reader.read("!B")[0]
7922 assert(_type == 4)
7923 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007924 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007925 reader = orig_reader.slice(_length, 4)
Rich Lane7b0f2012013-11-22 14:15:26 -08007926 obj.xid = reader.read("!L")[0]
7927 _experimenter = reader.read("!L")[0]
7928 assert(_experimenter == 6035143)
7929 _subtype = reader.read("!L")[0]
7930 assert(_subtype == 45)
7931 obj.time_ms = reader.read("!Q")[0]
7932 return obj
7933
7934 def __eq__(self, other):
7935 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -08007936 if self.xid != other.xid: return False
7937 if self.time_ms != other.time_ms: return False
7938 return True
7939
Rich Lane7b0f2012013-11-22 14:15:26 -08007940 def pretty_print(self, q):
7941 q.text("bsn_time_reply {")
7942 with q.group():
7943 with q.indent(2):
7944 q.breakable()
7945 q.text("xid = ");
7946 if self.xid != None:
7947 q.text("%#x" % self.xid)
7948 else:
7949 q.text('None')
7950 q.text(","); q.breakable()
7951 q.text("time_ms = ");
7952 q.text("%#x" % self.time_ms)
7953 q.breakable()
7954 q.text('}')
7955
Rich Lane7dcdf022013-12-11 14:45:27 -08007956bsn_header.subtypes[45] = bsn_time_reply
7957
7958class bsn_time_request(bsn_header):
Rich Lane7b0f2012013-11-22 14:15:26 -08007959 version = 4
7960 type = 4
7961 experimenter = 6035143
7962 subtype = 44
7963
7964 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007965 if xid != None:
7966 self.xid = xid
7967 else:
7968 self.xid = None
7969 return
Rich Lane7b0f2012013-11-22 14:15:26 -08007970
7971 def pack(self):
7972 packed = []
7973 packed.append(struct.pack("!B", self.version))
7974 packed.append(struct.pack("!B", self.type))
7975 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7976 packed.append(struct.pack("!L", self.xid))
7977 packed.append(struct.pack("!L", self.experimenter))
7978 packed.append(struct.pack("!L", self.subtype))
7979 length = sum([len(x) for x in packed])
7980 packed[2] = struct.pack("!H", length)
7981 return ''.join(packed)
7982
7983 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007984 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -08007985 obj = bsn_time_request()
Rich Lane7b0f2012013-11-22 14:15:26 -08007986 _version = reader.read("!B")[0]
7987 assert(_version == 4)
7988 _type = reader.read("!B")[0]
7989 assert(_type == 4)
7990 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007991 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007992 reader = orig_reader.slice(_length, 4)
Rich Lane7b0f2012013-11-22 14:15:26 -08007993 obj.xid = reader.read("!L")[0]
7994 _experimenter = reader.read("!L")[0]
7995 assert(_experimenter == 6035143)
7996 _subtype = reader.read("!L")[0]
7997 assert(_subtype == 44)
7998 return obj
7999
8000 def __eq__(self, other):
8001 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -08008002 if self.xid != other.xid: return False
8003 return True
8004
Rich Lane7b0f2012013-11-22 14:15:26 -08008005 def pretty_print(self, q):
8006 q.text("bsn_time_request {")
8007 with q.group():
8008 with q.indent(2):
8009 q.breakable()
8010 q.text("xid = ");
8011 if self.xid != None:
8012 q.text("%#x" % self.xid)
8013 else:
8014 q.text('None')
8015 q.breakable()
8016 q.text('}')
8017
Rich Lane7dcdf022013-12-11 14:45:27 -08008018bsn_header.subtypes[44] = bsn_time_request
8019
8020class bsn_virtual_port_create_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07008021 version = 4
8022 type = 4
8023 experimenter = 6035143
8024 subtype = 16
8025
8026 def __init__(self, xid=None, status=None, vport_no=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08008027 if xid != None:
8028 self.xid = xid
8029 else:
8030 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07008031 if status != None:
8032 self.status = status
8033 else:
8034 self.status = 0
8035 if vport_no != None:
8036 self.vport_no = vport_no
8037 else:
8038 self.vport_no = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08008039 return
Dan Talaycof6202252013-07-02 01:00:29 -07008040
8041 def pack(self):
8042 packed = []
8043 packed.append(struct.pack("!B", self.version))
8044 packed.append(struct.pack("!B", self.type))
8045 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8046 packed.append(struct.pack("!L", self.xid))
8047 packed.append(struct.pack("!L", self.experimenter))
8048 packed.append(struct.pack("!L", self.subtype))
8049 packed.append(struct.pack("!L", self.status))
8050 packed.append(struct.pack("!L", self.vport_no))
8051 length = sum([len(x) for x in packed])
8052 packed[2] = struct.pack("!H", length)
8053 return ''.join(packed)
8054
8055 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08008056 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07008057 obj = bsn_virtual_port_create_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07008058 _version = reader.read("!B")[0]
8059 assert(_version == 4)
8060 _type = reader.read("!B")[0]
8061 assert(_type == 4)
8062 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08008063 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08008064 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07008065 obj.xid = reader.read("!L")[0]
8066 _experimenter = reader.read("!L")[0]
8067 assert(_experimenter == 6035143)
8068 _subtype = reader.read("!L")[0]
8069 assert(_subtype == 16)
8070 obj.status = reader.read("!L")[0]
8071 obj.vport_no = reader.read("!L")[0]
8072 return obj
8073
8074 def __eq__(self, other):
8075 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07008076 if self.xid != other.xid: return False
8077 if self.status != other.status: return False
8078 if self.vport_no != other.vport_no: return False
8079 return True
8080
Dan Talaycof6202252013-07-02 01:00:29 -07008081 def pretty_print(self, q):
8082 q.text("bsn_virtual_port_create_reply {")
8083 with q.group():
8084 with q.indent(2):
8085 q.breakable()
8086 q.text("xid = ");
8087 if self.xid != None:
8088 q.text("%#x" % self.xid)
8089 else:
8090 q.text('None')
8091 q.text(","); q.breakable()
8092 q.text("status = ");
8093 q.text("%#x" % self.status)
8094 q.text(","); q.breakable()
8095 q.text("vport_no = ");
8096 q.text("%#x" % self.vport_no)
8097 q.breakable()
8098 q.text('}')
8099
Rich Lane7dcdf022013-12-11 14:45:27 -08008100bsn_header.subtypes[16] = bsn_virtual_port_create_reply
8101
8102class bsn_virtual_port_create_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07008103 version = 4
8104 type = 4
8105 experimenter = 6035143
8106 subtype = 15
8107
8108 def __init__(self, xid=None, vport=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08008109 if xid != None:
8110 self.xid = xid
8111 else:
8112 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07008113 if vport != None:
8114 self.vport = vport
8115 else:
Rich Lane93b33132014-04-21 12:20:58 -07008116 self.vport = common.bsn_vport()
Rich Lane7dcdf022013-12-11 14:45:27 -08008117 return
Dan Talaycof6202252013-07-02 01:00:29 -07008118
8119 def pack(self):
8120 packed = []
8121 packed.append(struct.pack("!B", self.version))
8122 packed.append(struct.pack("!B", self.type))
8123 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8124 packed.append(struct.pack("!L", self.xid))
8125 packed.append(struct.pack("!L", self.experimenter))
8126 packed.append(struct.pack("!L", self.subtype))
8127 packed.append(self.vport.pack())
8128 length = sum([len(x) for x in packed])
8129 packed[2] = struct.pack("!H", length)
8130 return ''.join(packed)
8131
8132 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08008133 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07008134 obj = bsn_virtual_port_create_request()
Dan Talaycof6202252013-07-02 01:00:29 -07008135 _version = reader.read("!B")[0]
8136 assert(_version == 4)
8137 _type = reader.read("!B")[0]
8138 assert(_type == 4)
8139 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08008140 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08008141 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07008142 obj.xid = reader.read("!L")[0]
8143 _experimenter = reader.read("!L")[0]
8144 assert(_experimenter == 6035143)
8145 _subtype = reader.read("!L")[0]
8146 assert(_subtype == 15)
Rich Lane93b33132014-04-21 12:20:58 -07008147 obj.vport = common.bsn_vport.unpack(reader)
Dan Talaycof6202252013-07-02 01:00:29 -07008148 return obj
8149
8150 def __eq__(self, other):
8151 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07008152 if self.xid != other.xid: return False
8153 if self.vport != other.vport: return False
8154 return True
8155
Dan Talaycof6202252013-07-02 01:00:29 -07008156 def pretty_print(self, q):
8157 q.text("bsn_virtual_port_create_request {")
8158 with q.group():
8159 with q.indent(2):
8160 q.breakable()
8161 q.text("xid = ");
8162 if self.xid != None:
8163 q.text("%#x" % self.xid)
8164 else:
8165 q.text('None')
8166 q.text(","); q.breakable()
8167 q.text("vport = ");
8168 q.pp(self.vport)
8169 q.breakable()
8170 q.text('}')
8171
Rich Lane7dcdf022013-12-11 14:45:27 -08008172bsn_header.subtypes[15] = bsn_virtual_port_create_request
8173
8174class bsn_virtual_port_remove_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07008175 version = 4
8176 type = 4
8177 experimenter = 6035143
8178 subtype = 26
8179
8180 def __init__(self, xid=None, status=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08008181 if xid != None:
8182 self.xid = xid
8183 else:
8184 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07008185 if status != None:
8186 self.status = status
8187 else:
8188 self.status = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08008189 return
Dan Talaycof6202252013-07-02 01:00:29 -07008190
8191 def pack(self):
8192 packed = []
8193 packed.append(struct.pack("!B", self.version))
8194 packed.append(struct.pack("!B", self.type))
8195 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8196 packed.append(struct.pack("!L", self.xid))
8197 packed.append(struct.pack("!L", self.experimenter))
8198 packed.append(struct.pack("!L", self.subtype))
8199 packed.append(struct.pack("!L", self.status))
8200 length = sum([len(x) for x in packed])
8201 packed[2] = struct.pack("!H", length)
8202 return ''.join(packed)
8203
8204 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08008205 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07008206 obj = bsn_virtual_port_remove_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07008207 _version = reader.read("!B")[0]
8208 assert(_version == 4)
8209 _type = reader.read("!B")[0]
8210 assert(_type == 4)
8211 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08008212 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08008213 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07008214 obj.xid = reader.read("!L")[0]
8215 _experimenter = reader.read("!L")[0]
8216 assert(_experimenter == 6035143)
8217 _subtype = reader.read("!L")[0]
8218 assert(_subtype == 26)
8219 obj.status = reader.read("!L")[0]
8220 return obj
8221
8222 def __eq__(self, other):
8223 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07008224 if self.xid != other.xid: return False
8225 if self.status != other.status: return False
8226 return True
8227
Dan Talaycof6202252013-07-02 01:00:29 -07008228 def pretty_print(self, q):
8229 q.text("bsn_virtual_port_remove_reply {")
8230 with q.group():
8231 with q.indent(2):
8232 q.breakable()
8233 q.text("xid = ");
8234 if self.xid != None:
8235 q.text("%#x" % self.xid)
8236 else:
8237 q.text('None')
8238 q.text(","); q.breakable()
8239 q.text("status = ");
8240 q.text("%#x" % self.status)
8241 q.breakable()
8242 q.text('}')
8243
Rich Lane7dcdf022013-12-11 14:45:27 -08008244bsn_header.subtypes[26] = bsn_virtual_port_remove_reply
8245
8246class bsn_virtual_port_remove_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07008247 version = 4
8248 type = 4
8249 experimenter = 6035143
8250 subtype = 17
8251
8252 def __init__(self, xid=None, vport_no=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08008253 if xid != None:
8254 self.xid = xid
8255 else:
8256 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07008257 if vport_no != None:
8258 self.vport_no = vport_no
8259 else:
8260 self.vport_no = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08008261 return
Dan Talaycof6202252013-07-02 01:00:29 -07008262
8263 def pack(self):
8264 packed = []
8265 packed.append(struct.pack("!B", self.version))
8266 packed.append(struct.pack("!B", self.type))
8267 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8268 packed.append(struct.pack("!L", self.xid))
8269 packed.append(struct.pack("!L", self.experimenter))
8270 packed.append(struct.pack("!L", self.subtype))
8271 packed.append(struct.pack("!L", self.vport_no))
8272 length = sum([len(x) for x in packed])
8273 packed[2] = struct.pack("!H", length)
8274 return ''.join(packed)
8275
8276 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08008277 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07008278 obj = bsn_virtual_port_remove_request()
Dan Talaycof6202252013-07-02 01:00:29 -07008279 _version = reader.read("!B")[0]
8280 assert(_version == 4)
8281 _type = reader.read("!B")[0]
8282 assert(_type == 4)
8283 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08008284 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08008285 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07008286 obj.xid = reader.read("!L")[0]
8287 _experimenter = reader.read("!L")[0]
8288 assert(_experimenter == 6035143)
8289 _subtype = reader.read("!L")[0]
8290 assert(_subtype == 17)
8291 obj.vport_no = reader.read("!L")[0]
8292 return obj
8293
8294 def __eq__(self, other):
8295 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07008296 if self.xid != other.xid: return False
8297 if self.vport_no != other.vport_no: return False
8298 return True
8299
Dan Talaycof6202252013-07-02 01:00:29 -07008300 def pretty_print(self, q):
8301 q.text("bsn_virtual_port_remove_request {")
8302 with q.group():
8303 with q.indent(2):
8304 q.breakable()
8305 q.text("xid = ");
8306 if self.xid != None:
8307 q.text("%#x" % self.xid)
8308 else:
8309 q.text('None')
8310 q.text(","); q.breakable()
8311 q.text("vport_no = ");
8312 q.text("%#x" % self.vport_no)
8313 q.breakable()
8314 q.text('}')
8315
Rich Lane7dcdf022013-12-11 14:45:27 -08008316bsn_header.subtypes[17] = bsn_virtual_port_remove_request
8317
8318class bsn_vlan_counter_stats_reply(bsn_stats_reply):
8319 version = 4
8320 type = 19
8321 stats_type = 65535
8322 experimenter = 6035143
8323 subtype = 9
8324
8325 def __init__(self, xid=None, flags=None, entries=None):
8326 if xid != None:
8327 self.xid = xid
8328 else:
8329 self.xid = None
8330 if flags != None:
8331 self.flags = flags
8332 else:
8333 self.flags = 0
8334 if entries != None:
8335 self.entries = entries
8336 else:
8337 self.entries = []
8338 return
8339
8340 def pack(self):
8341 packed = []
8342 packed.append(struct.pack("!B", self.version))
8343 packed.append(struct.pack("!B", self.type))
8344 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8345 packed.append(struct.pack("!L", self.xid))
8346 packed.append(struct.pack("!H", self.stats_type))
8347 packed.append(struct.pack("!H", self.flags))
8348 packed.append('\x00' * 4)
8349 packed.append(struct.pack("!L", self.experimenter))
8350 packed.append(struct.pack("!L", self.subtype))
8351 packed.append(loxi.generic_util.pack_list(self.entries))
8352 length = sum([len(x) for x in packed])
8353 packed[2] = struct.pack("!H", length)
8354 return ''.join(packed)
8355
8356 @staticmethod
8357 def unpack(reader):
8358 obj = bsn_vlan_counter_stats_reply()
8359 _version = reader.read("!B")[0]
8360 assert(_version == 4)
8361 _type = reader.read("!B")[0]
8362 assert(_type == 19)
8363 _length = reader.read("!H")[0]
8364 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08008365 reader = orig_reader.slice(_length, 4)
Rich Lane7dcdf022013-12-11 14:45:27 -08008366 obj.xid = reader.read("!L")[0]
8367 _stats_type = reader.read("!H")[0]
8368 assert(_stats_type == 65535)
8369 obj.flags = reader.read("!H")[0]
8370 reader.skip(4)
8371 _experimenter = reader.read("!L")[0]
8372 assert(_experimenter == 6035143)
8373 _subtype = reader.read("!L")[0]
8374 assert(_subtype == 9)
8375 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_vlan_counter_stats_entry.unpack)
8376 return obj
8377
8378 def __eq__(self, other):
8379 if type(self) != type(other): return False
8380 if self.xid != other.xid: return False
8381 if self.flags != other.flags: return False
8382 if self.entries != other.entries: return False
8383 return True
8384
8385 def pretty_print(self, q):
8386 q.text("bsn_vlan_counter_stats_reply {")
8387 with q.group():
8388 with q.indent(2):
8389 q.breakable()
8390 q.text("xid = ");
8391 if self.xid != None:
8392 q.text("%#x" % self.xid)
8393 else:
8394 q.text('None')
8395 q.text(","); q.breakable()
8396 q.text("flags = ");
8397 q.text("%#x" % self.flags)
8398 q.text(","); q.breakable()
8399 q.text("entries = ");
8400 q.pp(self.entries)
8401 q.breakable()
8402 q.text('}')
8403
8404bsn_stats_reply.subtypes[9] = bsn_vlan_counter_stats_reply
8405
8406class bsn_vlan_counter_stats_request(bsn_stats_request):
8407 version = 4
8408 type = 18
8409 stats_type = 65535
8410 experimenter = 6035143
8411 subtype = 9
8412
8413 def __init__(self, xid=None, flags=None, vlan_vid=None):
8414 if xid != None:
8415 self.xid = xid
8416 else:
8417 self.xid = None
8418 if flags != None:
8419 self.flags = flags
8420 else:
8421 self.flags = 0
8422 if vlan_vid != None:
8423 self.vlan_vid = vlan_vid
8424 else:
8425 self.vlan_vid = 0
8426 return
8427
8428 def pack(self):
8429 packed = []
8430 packed.append(struct.pack("!B", self.version))
8431 packed.append(struct.pack("!B", self.type))
8432 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8433 packed.append(struct.pack("!L", self.xid))
8434 packed.append(struct.pack("!H", self.stats_type))
8435 packed.append(struct.pack("!H", self.flags))
8436 packed.append('\x00' * 4)
8437 packed.append(struct.pack("!L", self.experimenter))
8438 packed.append(struct.pack("!L", self.subtype))
8439 packed.append(struct.pack("!H", self.vlan_vid))
8440 length = sum([len(x) for x in packed])
8441 packed[2] = struct.pack("!H", length)
8442 return ''.join(packed)
8443
8444 @staticmethod
8445 def unpack(reader):
8446 obj = bsn_vlan_counter_stats_request()
8447 _version = reader.read("!B")[0]
8448 assert(_version == 4)
8449 _type = reader.read("!B")[0]
8450 assert(_type == 18)
8451 _length = reader.read("!H")[0]
8452 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08008453 reader = orig_reader.slice(_length, 4)
Rich Lane7dcdf022013-12-11 14:45:27 -08008454 obj.xid = reader.read("!L")[0]
8455 _stats_type = reader.read("!H")[0]
8456 assert(_stats_type == 65535)
8457 obj.flags = reader.read("!H")[0]
8458 reader.skip(4)
8459 _experimenter = reader.read("!L")[0]
8460 assert(_experimenter == 6035143)
8461 _subtype = reader.read("!L")[0]
8462 assert(_subtype == 9)
8463 obj.vlan_vid = reader.read("!H")[0]
8464 return obj
8465
8466 def __eq__(self, other):
8467 if type(self) != type(other): return False
8468 if self.xid != other.xid: return False
8469 if self.flags != other.flags: return False
8470 if self.vlan_vid != other.vlan_vid: return False
8471 return True
8472
8473 def pretty_print(self, q):
8474 q.text("bsn_vlan_counter_stats_request {")
8475 with q.group():
8476 with q.indent(2):
8477 q.breakable()
8478 q.text("xid = ");
8479 if self.xid != None:
8480 q.text("%#x" % self.xid)
8481 else:
8482 q.text('None')
8483 q.text(","); q.breakable()
8484 q.text("flags = ");
8485 q.text("%#x" % self.flags)
8486 q.text(","); q.breakable()
8487 q.text("vlan_vid = ");
8488 q.text("%#x" % self.vlan_vid)
8489 q.breakable()
8490 q.text('}')
8491
8492bsn_stats_request.subtypes[9] = bsn_vlan_counter_stats_request
8493
Rich Lane5587ab12014-06-30 11:19:09 -07008494class bsn_vrf_counter_stats_reply(bsn_stats_reply):
8495 version = 4
8496 type = 19
8497 stats_type = 65535
8498 experimenter = 6035143
8499 subtype = 15
8500
8501 def __init__(self, xid=None, flags=None, entries=None):
8502 if xid != None:
8503 self.xid = xid
8504 else:
8505 self.xid = None
8506 if flags != None:
8507 self.flags = flags
8508 else:
8509 self.flags = 0
8510 if entries != None:
8511 self.entries = entries
8512 else:
8513 self.entries = []
8514 return
8515
8516 def pack(self):
8517 packed = []
8518 packed.append(struct.pack("!B", self.version))
8519 packed.append(struct.pack("!B", self.type))
8520 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8521 packed.append(struct.pack("!L", self.xid))
8522 packed.append(struct.pack("!H", self.stats_type))
8523 packed.append(struct.pack("!H", self.flags))
8524 packed.append('\x00' * 4)
8525 packed.append(struct.pack("!L", self.experimenter))
8526 packed.append(struct.pack("!L", self.subtype))
8527 packed.append(loxi.generic_util.pack_list(self.entries))
8528 length = sum([len(x) for x in packed])
8529 packed[2] = struct.pack("!H", length)
8530 return ''.join(packed)
8531
8532 @staticmethod
8533 def unpack(reader):
8534 obj = bsn_vrf_counter_stats_reply()
8535 _version = reader.read("!B")[0]
8536 assert(_version == 4)
8537 _type = reader.read("!B")[0]
8538 assert(_type == 19)
8539 _length = reader.read("!H")[0]
8540 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08008541 reader = orig_reader.slice(_length, 4)
Rich Lane5587ab12014-06-30 11:19:09 -07008542 obj.xid = reader.read("!L")[0]
8543 _stats_type = reader.read("!H")[0]
8544 assert(_stats_type == 65535)
8545 obj.flags = reader.read("!H")[0]
8546 reader.skip(4)
8547 _experimenter = reader.read("!L")[0]
8548 assert(_experimenter == 6035143)
8549 _subtype = reader.read("!L")[0]
8550 assert(_subtype == 15)
8551 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_vrf_counter_stats_entry.unpack)
8552 return obj
8553
8554 def __eq__(self, other):
8555 if type(self) != type(other): return False
8556 if self.xid != other.xid: return False
8557 if self.flags != other.flags: return False
8558 if self.entries != other.entries: return False
8559 return True
8560
8561 def pretty_print(self, q):
8562 q.text("bsn_vrf_counter_stats_reply {")
8563 with q.group():
8564 with q.indent(2):
8565 q.breakable()
8566 q.text("xid = ");
8567 if self.xid != None:
8568 q.text("%#x" % self.xid)
8569 else:
8570 q.text('None')
8571 q.text(","); q.breakable()
8572 q.text("flags = ");
8573 q.text("%#x" % self.flags)
8574 q.text(","); q.breakable()
8575 q.text("entries = ");
8576 q.pp(self.entries)
8577 q.breakable()
8578 q.text('}')
8579
8580bsn_stats_reply.subtypes[15] = bsn_vrf_counter_stats_reply
8581
8582class bsn_vrf_counter_stats_request(bsn_stats_request):
8583 version = 4
8584 type = 18
8585 stats_type = 65535
8586 experimenter = 6035143
8587 subtype = 15
8588
8589 def __init__(self, xid=None, flags=None, vrf=None):
8590 if xid != None:
8591 self.xid = xid
8592 else:
8593 self.xid = None
8594 if flags != None:
8595 self.flags = flags
8596 else:
8597 self.flags = 0
8598 if vrf != None:
8599 self.vrf = vrf
8600 else:
8601 self.vrf = 0
8602 return
8603
8604 def pack(self):
8605 packed = []
8606 packed.append(struct.pack("!B", self.version))
8607 packed.append(struct.pack("!B", self.type))
8608 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8609 packed.append(struct.pack("!L", self.xid))
8610 packed.append(struct.pack("!H", self.stats_type))
8611 packed.append(struct.pack("!H", self.flags))
8612 packed.append('\x00' * 4)
8613 packed.append(struct.pack("!L", self.experimenter))
8614 packed.append(struct.pack("!L", self.subtype))
8615 packed.append(struct.pack("!L", self.vrf))
8616 length = sum([len(x) for x in packed])
8617 packed[2] = struct.pack("!H", length)
8618 return ''.join(packed)
8619
8620 @staticmethod
8621 def unpack(reader):
8622 obj = bsn_vrf_counter_stats_request()
8623 _version = reader.read("!B")[0]
8624 assert(_version == 4)
8625 _type = reader.read("!B")[0]
8626 assert(_type == 18)
8627 _length = reader.read("!H")[0]
8628 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08008629 reader = orig_reader.slice(_length, 4)
Rich Lane5587ab12014-06-30 11:19:09 -07008630 obj.xid = reader.read("!L")[0]
8631 _stats_type = reader.read("!H")[0]
8632 assert(_stats_type == 65535)
8633 obj.flags = reader.read("!H")[0]
8634 reader.skip(4)
8635 _experimenter = reader.read("!L")[0]
8636 assert(_experimenter == 6035143)
8637 _subtype = reader.read("!L")[0]
8638 assert(_subtype == 15)
8639 obj.vrf = reader.read("!L")[0]
8640 return obj
8641
8642 def __eq__(self, other):
8643 if type(self) != type(other): return False
8644 if self.xid != other.xid: return False
8645 if self.flags != other.flags: return False
8646 if self.vrf != other.vrf: return False
8647 return True
8648
8649 def pretty_print(self, q):
8650 q.text("bsn_vrf_counter_stats_request {")
8651 with q.group():
8652 with q.indent(2):
8653 q.breakable()
8654 q.text("xid = ");
8655 if self.xid != None:
8656 q.text("%#x" % self.xid)
8657 else:
8658 q.text('None')
8659 q.text(","); q.breakable()
8660 q.text("flags = ");
8661 q.text("%#x" % self.flags)
8662 q.text(","); q.breakable()
8663 q.text("vrf = ");
8664 q.text("%#x" % self.vrf)
8665 q.breakable()
8666 q.text('}')
8667
8668bsn_stats_request.subtypes[15] = bsn_vrf_counter_stats_request
8669
Rich Lane7dcdf022013-12-11 14:45:27 -08008670class desc_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -07008671 version = 4
8672 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -07008673 stats_type = 0
8674
8675 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 -08008676 if xid != None:
8677 self.xid = xid
8678 else:
8679 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07008680 if flags != None:
8681 self.flags = flags
8682 else:
8683 self.flags = 0
8684 if mfr_desc != None:
8685 self.mfr_desc = mfr_desc
8686 else:
8687 self.mfr_desc = ""
8688 if hw_desc != None:
8689 self.hw_desc = hw_desc
8690 else:
8691 self.hw_desc = ""
8692 if sw_desc != None:
8693 self.sw_desc = sw_desc
8694 else:
8695 self.sw_desc = ""
8696 if serial_num != None:
8697 self.serial_num = serial_num
8698 else:
8699 self.serial_num = ""
8700 if dp_desc != None:
8701 self.dp_desc = dp_desc
8702 else:
8703 self.dp_desc = ""
Rich Lane7dcdf022013-12-11 14:45:27 -08008704 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07008705
8706 def pack(self):
8707 packed = []
8708 packed.append(struct.pack("!B", self.version))
8709 packed.append(struct.pack("!B", self.type))
8710 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8711 packed.append(struct.pack("!L", self.xid))
8712 packed.append(struct.pack("!H", self.stats_type))
8713 packed.append(struct.pack("!H", self.flags))
8714 packed.append('\x00' * 4)
8715 packed.append(struct.pack("!256s", self.mfr_desc))
8716 packed.append(struct.pack("!256s", self.hw_desc))
8717 packed.append(struct.pack("!256s", self.sw_desc))
8718 packed.append(struct.pack("!32s", self.serial_num))
8719 packed.append(struct.pack("!256s", self.dp_desc))
8720 length = sum([len(x) for x in packed])
8721 packed[2] = struct.pack("!H", length)
8722 return ''.join(packed)
8723
8724 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08008725 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07008726 obj = desc_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07008727 _version = reader.read("!B")[0]
8728 assert(_version == 4)
8729 _type = reader.read("!B")[0]
8730 assert(_type == 19)
8731 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08008732 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08008733 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07008734 obj.xid = reader.read("!L")[0]
8735 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07008736 assert(_stats_type == 0)
Dan Talaycof6202252013-07-02 01:00:29 -07008737 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07008738 reader.skip(4)
8739 obj.mfr_desc = reader.read("!256s")[0].rstrip("\x00")
8740 obj.hw_desc = reader.read("!256s")[0].rstrip("\x00")
8741 obj.sw_desc = reader.read("!256s")[0].rstrip("\x00")
8742 obj.serial_num = reader.read("!32s")[0].rstrip("\x00")
8743 obj.dp_desc = reader.read("!256s")[0].rstrip("\x00")
8744 return obj
8745
8746 def __eq__(self, other):
8747 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07008748 if self.xid != other.xid: return False
8749 if self.flags != other.flags: return False
8750 if self.mfr_desc != other.mfr_desc: return False
8751 if self.hw_desc != other.hw_desc: return False
8752 if self.sw_desc != other.sw_desc: return False
8753 if self.serial_num != other.serial_num: return False
8754 if self.dp_desc != other.dp_desc: return False
8755 return True
8756
Rich Lanec2ee4b82013-04-24 17:12:38 -07008757 def pretty_print(self, q):
8758 q.text("desc_stats_reply {")
8759 with q.group():
8760 with q.indent(2):
8761 q.breakable()
8762 q.text("xid = ");
8763 if self.xid != None:
8764 q.text("%#x" % self.xid)
8765 else:
8766 q.text('None')
8767 q.text(","); q.breakable()
8768 q.text("flags = ");
8769 q.text("%#x" % self.flags)
8770 q.text(","); q.breakable()
8771 q.text("mfr_desc = ");
8772 q.pp(self.mfr_desc)
8773 q.text(","); q.breakable()
8774 q.text("hw_desc = ");
8775 q.pp(self.hw_desc)
8776 q.text(","); q.breakable()
8777 q.text("sw_desc = ");
8778 q.pp(self.sw_desc)
8779 q.text(","); q.breakable()
8780 q.text("serial_num = ");
8781 q.pp(self.serial_num)
8782 q.text(","); q.breakable()
8783 q.text("dp_desc = ");
8784 q.pp(self.dp_desc)
8785 q.breakable()
8786 q.text('}')
8787
Rich Lane7dcdf022013-12-11 14:45:27 -08008788stats_reply.subtypes[0] = desc_stats_reply
8789
8790class desc_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -07008791 version = 4
8792 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -07008793 stats_type = 0
8794
8795 def __init__(self, xid=None, flags=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08008796 if xid != None:
8797 self.xid = xid
8798 else:
8799 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07008800 if flags != None:
8801 self.flags = flags
8802 else:
8803 self.flags = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08008804 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07008805
8806 def pack(self):
8807 packed = []
8808 packed.append(struct.pack("!B", self.version))
8809 packed.append(struct.pack("!B", self.type))
8810 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8811 packed.append(struct.pack("!L", self.xid))
8812 packed.append(struct.pack("!H", self.stats_type))
8813 packed.append(struct.pack("!H", self.flags))
8814 packed.append('\x00' * 4)
8815 length = sum([len(x) for x in packed])
8816 packed[2] = struct.pack("!H", length)
8817 return ''.join(packed)
8818
8819 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08008820 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07008821 obj = desc_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -07008822 _version = reader.read("!B")[0]
8823 assert(_version == 4)
8824 _type = reader.read("!B")[0]
8825 assert(_type == 18)
8826 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08008827 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08008828 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07008829 obj.xid = reader.read("!L")[0]
8830 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07008831 assert(_stats_type == 0)
Dan Talaycof6202252013-07-02 01:00:29 -07008832 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07008833 reader.skip(4)
8834 return obj
8835
8836 def __eq__(self, other):
8837 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07008838 if self.xid != other.xid: return False
8839 if self.flags != other.flags: return False
8840 return True
8841
Rich Lanec2ee4b82013-04-24 17:12:38 -07008842 def pretty_print(self, q):
8843 q.text("desc_stats_request {")
8844 with q.group():
8845 with q.indent(2):
8846 q.breakable()
8847 q.text("xid = ");
8848 if self.xid != None:
8849 q.text("%#x" % self.xid)
8850 else:
8851 q.text('None')
8852 q.text(","); q.breakable()
8853 q.text("flags = ");
8854 q.text("%#x" % self.flags)
8855 q.breakable()
8856 q.text('}')
8857
Rich Lane7dcdf022013-12-11 14:45:27 -08008858stats_request.subtypes[0] = desc_stats_request
8859
8860class echo_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -07008861 version = 4
8862 type = 3
Rich Lanec2ee4b82013-04-24 17:12:38 -07008863
8864 def __init__(self, xid=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08008865 if xid != None:
8866 self.xid = xid
8867 else:
8868 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07008869 if data != None:
8870 self.data = data
8871 else:
Dan Talaycof6202252013-07-02 01:00:29 -07008872 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08008873 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07008874
8875 def pack(self):
8876 packed = []
8877 packed.append(struct.pack("!B", self.version))
8878 packed.append(struct.pack("!B", self.type))
8879 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8880 packed.append(struct.pack("!L", self.xid))
8881 packed.append(self.data)
8882 length = sum([len(x) for x in packed])
8883 packed[2] = struct.pack("!H", length)
8884 return ''.join(packed)
8885
8886 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08008887 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07008888 obj = echo_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07008889 _version = reader.read("!B")[0]
8890 assert(_version == 4)
8891 _type = reader.read("!B")[0]
8892 assert(_type == 3)
8893 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08008894 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08008895 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07008896 obj.xid = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07008897 obj.data = str(reader.read_all())
8898 return obj
8899
8900 def __eq__(self, other):
8901 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07008902 if self.xid != other.xid: return False
8903 if self.data != other.data: return False
8904 return True
8905
Rich Lanec2ee4b82013-04-24 17:12:38 -07008906 def pretty_print(self, q):
8907 q.text("echo_reply {")
8908 with q.group():
8909 with q.indent(2):
8910 q.breakable()
8911 q.text("xid = ");
8912 if self.xid != None:
8913 q.text("%#x" % self.xid)
8914 else:
8915 q.text('None')
8916 q.text(","); q.breakable()
8917 q.text("data = ");
8918 q.pp(self.data)
8919 q.breakable()
8920 q.text('}')
8921
Rich Lane7dcdf022013-12-11 14:45:27 -08008922message.subtypes[3] = echo_reply
8923
8924class echo_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -07008925 version = 4
8926 type = 2
Rich Lanec2ee4b82013-04-24 17:12:38 -07008927
8928 def __init__(self, xid=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08008929 if xid != None:
8930 self.xid = xid
8931 else:
8932 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07008933 if data != None:
8934 self.data = data
8935 else:
Dan Talaycof6202252013-07-02 01:00:29 -07008936 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08008937 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07008938
8939 def pack(self):
8940 packed = []
8941 packed.append(struct.pack("!B", self.version))
8942 packed.append(struct.pack("!B", self.type))
8943 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8944 packed.append(struct.pack("!L", self.xid))
8945 packed.append(self.data)
8946 length = sum([len(x) for x in packed])
8947 packed[2] = struct.pack("!H", length)
8948 return ''.join(packed)
8949
8950 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08008951 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07008952 obj = echo_request()
Dan Talaycof6202252013-07-02 01:00:29 -07008953 _version = reader.read("!B")[0]
8954 assert(_version == 4)
8955 _type = reader.read("!B")[0]
8956 assert(_type == 2)
8957 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08008958 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08008959 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07008960 obj.xid = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07008961 obj.data = str(reader.read_all())
8962 return obj
8963
8964 def __eq__(self, other):
8965 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07008966 if self.xid != other.xid: return False
8967 if self.data != other.data: return False
8968 return True
8969
Rich Lanec2ee4b82013-04-24 17:12:38 -07008970 def pretty_print(self, q):
8971 q.text("echo_request {")
8972 with q.group():
8973 with q.indent(2):
8974 q.breakable()
8975 q.text("xid = ");
8976 if self.xid != None:
8977 q.text("%#x" % self.xid)
8978 else:
8979 q.text('None')
8980 q.text(","); q.breakable()
8981 q.text("data = ");
8982 q.pp(self.data)
8983 q.breakable()
8984 q.text('}')
8985
Rich Lane7dcdf022013-12-11 14:45:27 -08008986message.subtypes[2] = echo_request
8987
8988class experimenter_error_msg(error_msg):
Dan Talaycof6202252013-07-02 01:00:29 -07008989 version = 4
8990 type = 1
Rich Lane6f4978c2013-10-20 21:33:52 -07008991 err_type = 65535
Rich Lanec2ee4b82013-04-24 17:12:38 -07008992
Rich Lane6f4978c2013-10-20 21:33:52 -07008993 def __init__(self, xid=None, subtype=None, experimenter=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08008994 if xid != None:
8995 self.xid = xid
8996 else:
8997 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07008998 if subtype != None:
8999 self.subtype = subtype
Rich Lanec2ee4b82013-04-24 17:12:38 -07009000 else:
Rich Lane6f4978c2013-10-20 21:33:52 -07009001 self.subtype = 0
9002 if experimenter != None:
9003 self.experimenter = experimenter
Rich Lanec2ee4b82013-04-24 17:12:38 -07009004 else:
Rich Lane6f4978c2013-10-20 21:33:52 -07009005 self.experimenter = 0
Rich Lanec2ee4b82013-04-24 17:12:38 -07009006 if data != None:
9007 self.data = data
9008 else:
Dan Talaycof6202252013-07-02 01:00:29 -07009009 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08009010 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07009011
9012 def pack(self):
9013 packed = []
9014 packed.append(struct.pack("!B", self.version))
9015 packed.append(struct.pack("!B", self.type))
9016 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9017 packed.append(struct.pack("!L", self.xid))
9018 packed.append(struct.pack("!H", self.err_type))
Rich Lane6f4978c2013-10-20 21:33:52 -07009019 packed.append(struct.pack("!H", self.subtype))
9020 packed.append(struct.pack("!L", self.experimenter))
Rich Lanec2ee4b82013-04-24 17:12:38 -07009021 packed.append(self.data)
9022 length = sum([len(x) for x in packed])
9023 packed[2] = struct.pack("!H", length)
9024 return ''.join(packed)
9025
9026 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08009027 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07009028 obj = experimenter_error_msg()
Dan Talaycof6202252013-07-02 01:00:29 -07009029 _version = reader.read("!B")[0]
9030 assert(_version == 4)
9031 _type = reader.read("!B")[0]
9032 assert(_type == 1)
9033 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08009034 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08009035 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07009036 obj.xid = reader.read("!L")[0]
Rich Lane6f4978c2013-10-20 21:33:52 -07009037 _err_type = reader.read("!H")[0]
9038 assert(_err_type == 65535)
9039 obj.subtype = reader.read("!H")[0]
9040 obj.experimenter = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009041 obj.data = str(reader.read_all())
9042 return obj
9043
9044 def __eq__(self, other):
9045 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07009046 if self.xid != other.xid: return False
Rich Lane6f4978c2013-10-20 21:33:52 -07009047 if self.subtype != other.subtype: return False
9048 if self.experimenter != other.experimenter: return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07009049 if self.data != other.data: return False
9050 return True
9051
Rich Lanec2ee4b82013-04-24 17:12:38 -07009052 def pretty_print(self, q):
Rich Lane6f4978c2013-10-20 21:33:52 -07009053 q.text("experimenter_error_msg {")
Rich Lanec2ee4b82013-04-24 17:12:38 -07009054 with q.group():
9055 with q.indent(2):
9056 q.breakable()
9057 q.text("xid = ");
9058 if self.xid != None:
9059 q.text("%#x" % self.xid)
9060 else:
9061 q.text('None')
9062 q.text(","); q.breakable()
Rich Lane6f4978c2013-10-20 21:33:52 -07009063 q.text("subtype = ");
9064 q.text("%#x" % self.subtype)
Rich Lanec2ee4b82013-04-24 17:12:38 -07009065 q.text(","); q.breakable()
Rich Lane6f4978c2013-10-20 21:33:52 -07009066 q.text("experimenter = ");
9067 q.text("%#x" % self.experimenter)
Rich Lanec2ee4b82013-04-24 17:12:38 -07009068 q.text(","); q.breakable()
9069 q.text("data = ");
9070 q.pp(self.data)
9071 q.breakable()
9072 q.text('}')
9073
Rich Lane7dcdf022013-12-11 14:45:27 -08009074error_msg.subtypes[65535] = experimenter_error_msg
9075
9076class features_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -07009077 version = 4
9078 type = 6
Rich Lanec2ee4b82013-04-24 17:12:38 -07009079
9080 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 -08009081 if xid != None:
9082 self.xid = xid
9083 else:
9084 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07009085 if datapath_id != None:
9086 self.datapath_id = datapath_id
9087 else:
9088 self.datapath_id = 0
9089 if n_buffers != None:
9090 self.n_buffers = n_buffers
9091 else:
9092 self.n_buffers = 0
9093 if n_tables != None:
9094 self.n_tables = n_tables
9095 else:
9096 self.n_tables = 0
9097 if auxiliary_id != None:
9098 self.auxiliary_id = auxiliary_id
9099 else:
9100 self.auxiliary_id = 0
9101 if capabilities != None:
9102 self.capabilities = capabilities
9103 else:
9104 self.capabilities = 0
9105 if reserved != None:
9106 self.reserved = reserved
9107 else:
9108 self.reserved = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08009109 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07009110
9111 def pack(self):
9112 packed = []
9113 packed.append(struct.pack("!B", self.version))
9114 packed.append(struct.pack("!B", self.type))
9115 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9116 packed.append(struct.pack("!L", self.xid))
9117 packed.append(struct.pack("!Q", self.datapath_id))
9118 packed.append(struct.pack("!L", self.n_buffers))
9119 packed.append(struct.pack("!B", self.n_tables))
9120 packed.append(struct.pack("!B", self.auxiliary_id))
9121 packed.append('\x00' * 2)
9122 packed.append(struct.pack("!L", self.capabilities))
9123 packed.append(struct.pack("!L", self.reserved))
9124 length = sum([len(x) for x in packed])
9125 packed[2] = struct.pack("!H", length)
9126 return ''.join(packed)
9127
9128 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08009129 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07009130 obj = features_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07009131 _version = reader.read("!B")[0]
9132 assert(_version == 4)
9133 _type = reader.read("!B")[0]
9134 assert(_type == 6)
9135 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08009136 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08009137 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07009138 obj.xid = reader.read("!L")[0]
9139 obj.datapath_id = reader.read("!Q")[0]
9140 obj.n_buffers = reader.read("!L")[0]
9141 obj.n_tables = reader.read("!B")[0]
9142 obj.auxiliary_id = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009143 reader.skip(2)
Dan Talaycof6202252013-07-02 01:00:29 -07009144 obj.capabilities = reader.read("!L")[0]
9145 obj.reserved = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009146 return obj
9147
9148 def __eq__(self, other):
9149 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07009150 if self.xid != other.xid: return False
9151 if self.datapath_id != other.datapath_id: return False
9152 if self.n_buffers != other.n_buffers: return False
9153 if self.n_tables != other.n_tables: return False
9154 if self.auxiliary_id != other.auxiliary_id: return False
9155 if self.capabilities != other.capabilities: return False
9156 if self.reserved != other.reserved: return False
9157 return True
9158
Rich Lanec2ee4b82013-04-24 17:12:38 -07009159 def pretty_print(self, q):
9160 q.text("features_reply {")
9161 with q.group():
9162 with q.indent(2):
9163 q.breakable()
9164 q.text("xid = ");
9165 if self.xid != None:
9166 q.text("%#x" % self.xid)
9167 else:
9168 q.text('None')
9169 q.text(","); q.breakable()
9170 q.text("datapath_id = ");
9171 q.text("%#x" % self.datapath_id)
9172 q.text(","); q.breakable()
9173 q.text("n_buffers = ");
9174 q.text("%#x" % self.n_buffers)
9175 q.text(","); q.breakable()
9176 q.text("n_tables = ");
9177 q.text("%#x" % self.n_tables)
9178 q.text(","); q.breakable()
9179 q.text("auxiliary_id = ");
9180 q.text("%#x" % self.auxiliary_id)
9181 q.text(","); q.breakable()
9182 q.text("capabilities = ");
9183 q.text("%#x" % self.capabilities)
9184 q.text(","); q.breakable()
9185 q.text("reserved = ");
9186 q.text("%#x" % self.reserved)
9187 q.breakable()
9188 q.text('}')
9189
Rich Lane7dcdf022013-12-11 14:45:27 -08009190message.subtypes[6] = features_reply
9191
9192class features_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -07009193 version = 4
9194 type = 5
Rich Lanec2ee4b82013-04-24 17:12:38 -07009195
9196 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08009197 if xid != None:
9198 self.xid = xid
9199 else:
9200 self.xid = None
9201 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07009202
9203 def pack(self):
9204 packed = []
9205 packed.append(struct.pack("!B", self.version))
9206 packed.append(struct.pack("!B", self.type))
9207 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9208 packed.append(struct.pack("!L", self.xid))
9209 length = sum([len(x) for x in packed])
9210 packed[2] = struct.pack("!H", length)
9211 return ''.join(packed)
9212
9213 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08009214 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07009215 obj = features_request()
Dan Talaycof6202252013-07-02 01:00:29 -07009216 _version = reader.read("!B")[0]
9217 assert(_version == 4)
9218 _type = reader.read("!B")[0]
9219 assert(_type == 5)
9220 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08009221 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08009222 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07009223 obj.xid = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009224 return obj
9225
9226 def __eq__(self, other):
9227 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07009228 if self.xid != other.xid: return False
9229 return True
9230
Rich Lanec2ee4b82013-04-24 17:12:38 -07009231 def pretty_print(self, q):
9232 q.text("features_request {")
9233 with q.group():
9234 with q.indent(2):
9235 q.breakable()
9236 q.text("xid = ");
9237 if self.xid != None:
9238 q.text("%#x" % self.xid)
9239 else:
9240 q.text('None')
9241 q.breakable()
9242 q.text('}')
9243
Rich Lane7dcdf022013-12-11 14:45:27 -08009244message.subtypes[5] = features_request
9245
9246class flow_mod(message):
9247 subtypes = {}
9248
Rich Lane95f7fc92014-01-27 17:08:16 -08009249 version = 4
9250 type = 14
9251
9252 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):
9253 if xid != None:
9254 self.xid = xid
9255 else:
9256 self.xid = None
9257 if cookie != None:
9258 self.cookie = cookie
9259 else:
9260 self.cookie = 0
9261 if cookie_mask != None:
9262 self.cookie_mask = cookie_mask
9263 else:
9264 self.cookie_mask = 0
9265 if table_id != None:
9266 self.table_id = table_id
9267 else:
9268 self.table_id = 0
9269 if _command != None:
9270 self._command = _command
9271 else:
9272 self._command = 0
9273 if idle_timeout != None:
9274 self.idle_timeout = idle_timeout
9275 else:
9276 self.idle_timeout = 0
9277 if hard_timeout != None:
9278 self.hard_timeout = hard_timeout
9279 else:
9280 self.hard_timeout = 0
9281 if priority != None:
9282 self.priority = priority
9283 else:
9284 self.priority = 0
9285 if buffer_id != None:
9286 self.buffer_id = buffer_id
9287 else:
9288 self.buffer_id = 0
9289 if out_port != None:
9290 self.out_port = out_port
9291 else:
9292 self.out_port = 0
9293 if out_group != None:
9294 self.out_group = out_group
9295 else:
9296 self.out_group = 0
9297 if flags != None:
9298 self.flags = flags
9299 else:
9300 self.flags = 0
9301 if match != None:
9302 self.match = match
9303 else:
9304 self.match = common.match()
9305 if instructions != None:
9306 self.instructions = instructions
9307 else:
9308 self.instructions = []
9309 return
9310
9311 def pack(self):
9312 packed = []
9313 packed.append(struct.pack("!B", self.version))
9314 packed.append(struct.pack("!B", self.type))
9315 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9316 packed.append(struct.pack("!L", self.xid))
9317 packed.append(struct.pack("!Q", self.cookie))
9318 packed.append(struct.pack("!Q", self.cookie_mask))
9319 packed.append(struct.pack("!B", self.table_id))
9320 packed.append(util.pack_fm_cmd(self._command))
9321 packed.append(struct.pack("!H", self.idle_timeout))
9322 packed.append(struct.pack("!H", self.hard_timeout))
9323 packed.append(struct.pack("!H", self.priority))
9324 packed.append(struct.pack("!L", self.buffer_id))
9325 packed.append(util.pack_port_no(self.out_port))
9326 packed.append(struct.pack("!L", self.out_group))
9327 packed.append(struct.pack("!H", self.flags))
9328 packed.append('\x00' * 2)
9329 packed.append(self.match.pack())
9330 packed.append(loxi.generic_util.pack_list(self.instructions))
9331 length = sum([len(x) for x in packed])
9332 packed[2] = struct.pack("!H", length)
9333 return ''.join(packed)
9334
Rich Lane7dcdf022013-12-11 14:45:27 -08009335 @staticmethod
9336 def unpack(reader):
9337 subtype, = reader.peek('B', 25)
Rich Lane95f7fc92014-01-27 17:08:16 -08009338 subclass = flow_mod.subtypes.get(subtype)
9339 if subclass:
9340 return subclass.unpack(reader)
9341
9342 obj = flow_mod()
9343 _version = reader.read("!B")[0]
9344 assert(_version == 4)
9345 _type = reader.read("!B")[0]
9346 assert(_type == 14)
9347 _length = reader.read("!H")[0]
9348 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08009349 reader = orig_reader.slice(_length, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -08009350 obj.xid = reader.read("!L")[0]
9351 obj.cookie = reader.read("!Q")[0]
9352 obj.cookie_mask = reader.read("!Q")[0]
9353 obj.table_id = reader.read("!B")[0]
9354 obj._command = util.unpack_fm_cmd(reader)
9355 obj.idle_timeout = reader.read("!H")[0]
9356 obj.hard_timeout = reader.read("!H")[0]
9357 obj.priority = reader.read("!H")[0]
9358 obj.buffer_id = reader.read("!L")[0]
9359 obj.out_port = util.unpack_port_no(reader)
9360 obj.out_group = reader.read("!L")[0]
9361 obj.flags = reader.read("!H")[0]
9362 reader.skip(2)
9363 obj.match = common.match.unpack(reader)
9364 obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack)
9365 return obj
9366
9367 def __eq__(self, other):
9368 if type(self) != type(other): return False
9369 if self.xid != other.xid: return False
9370 if self.cookie != other.cookie: return False
9371 if self.cookie_mask != other.cookie_mask: return False
9372 if self.table_id != other.table_id: return False
9373 if self._command != other._command: return False
9374 if self.idle_timeout != other.idle_timeout: return False
9375 if self.hard_timeout != other.hard_timeout: return False
9376 if self.priority != other.priority: return False
9377 if self.buffer_id != other.buffer_id: return False
9378 if self.out_port != other.out_port: return False
9379 if self.out_group != other.out_group: return False
9380 if self.flags != other.flags: return False
9381 if self.match != other.match: return False
9382 if self.instructions != other.instructions: return False
9383 return True
9384
9385 def pretty_print(self, q):
9386 q.text("flow_mod {")
9387 with q.group():
9388 with q.indent(2):
9389 q.breakable()
9390 q.text("xid = ");
9391 if self.xid != None:
9392 q.text("%#x" % self.xid)
9393 else:
9394 q.text('None')
9395 q.text(","); q.breakable()
9396 q.text("cookie = ");
9397 q.text("%#x" % self.cookie)
9398 q.text(","); q.breakable()
9399 q.text("cookie_mask = ");
9400 q.text("%#x" % self.cookie_mask)
9401 q.text(","); q.breakable()
9402 q.text("table_id = ");
9403 q.text("%#x" % self.table_id)
9404 q.text(","); q.breakable()
9405 q.text("idle_timeout = ");
9406 q.text("%#x" % self.idle_timeout)
9407 q.text(","); q.breakable()
9408 q.text("hard_timeout = ");
9409 q.text("%#x" % self.hard_timeout)
9410 q.text(","); q.breakable()
9411 q.text("priority = ");
9412 q.text("%#x" % self.priority)
9413 q.text(","); q.breakable()
9414 q.text("buffer_id = ");
9415 q.text("%#x" % self.buffer_id)
9416 q.text(","); q.breakable()
9417 q.text("out_port = ");
9418 q.text(util.pretty_port(self.out_port))
9419 q.text(","); q.breakable()
9420 q.text("out_group = ");
9421 q.text("%#x" % self.out_group)
9422 q.text(","); q.breakable()
9423 q.text("flags = ");
9424 q.text("%#x" % self.flags)
9425 q.text(","); q.breakable()
9426 q.text("match = ");
9427 q.pp(self.match)
9428 q.text(","); q.breakable()
9429 q.text("instructions = ");
9430 q.pp(self.instructions)
9431 q.breakable()
9432 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -08009433
9434message.subtypes[14] = flow_mod
9435
9436class flow_add(flow_mod):
Dan Talaycof6202252013-07-02 01:00:29 -07009437 version = 4
9438 type = 14
9439 _command = 0
Rich Lanec2ee4b82013-04-24 17:12:38 -07009440
9441 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 -08009442 if xid != None:
9443 self.xid = xid
9444 else:
9445 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07009446 if cookie != None:
9447 self.cookie = cookie
9448 else:
9449 self.cookie = 0
9450 if cookie_mask != None:
9451 self.cookie_mask = cookie_mask
9452 else:
9453 self.cookie_mask = 0
9454 if table_id != None:
9455 self.table_id = table_id
9456 else:
9457 self.table_id = 0
9458 if idle_timeout != None:
9459 self.idle_timeout = idle_timeout
9460 else:
9461 self.idle_timeout = 0
9462 if hard_timeout != None:
9463 self.hard_timeout = hard_timeout
9464 else:
9465 self.hard_timeout = 0
9466 if priority != None:
9467 self.priority = priority
9468 else:
9469 self.priority = 0
9470 if buffer_id != None:
9471 self.buffer_id = buffer_id
9472 else:
9473 self.buffer_id = 0
9474 if out_port != None:
9475 self.out_port = out_port
9476 else:
9477 self.out_port = 0
9478 if out_group != None:
9479 self.out_group = out_group
9480 else:
9481 self.out_group = 0
9482 if flags != None:
9483 self.flags = flags
9484 else:
9485 self.flags = 0
9486 if match != None:
9487 self.match = match
9488 else:
9489 self.match = common.match()
9490 if instructions != None:
9491 self.instructions = instructions
9492 else:
9493 self.instructions = []
Rich Lane7dcdf022013-12-11 14:45:27 -08009494 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07009495
9496 def pack(self):
9497 packed = []
9498 packed.append(struct.pack("!B", self.version))
9499 packed.append(struct.pack("!B", self.type))
9500 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9501 packed.append(struct.pack("!L", self.xid))
9502 packed.append(struct.pack("!Q", self.cookie))
9503 packed.append(struct.pack("!Q", self.cookie_mask))
9504 packed.append(struct.pack("!B", self.table_id))
Dan Talaycof6202252013-07-02 01:00:29 -07009505 packed.append(util.pack_fm_cmd(self._command))
Rich Lanec2ee4b82013-04-24 17:12:38 -07009506 packed.append(struct.pack("!H", self.idle_timeout))
9507 packed.append(struct.pack("!H", self.hard_timeout))
9508 packed.append(struct.pack("!H", self.priority))
9509 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -07009510 packed.append(util.pack_port_no(self.out_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -07009511 packed.append(struct.pack("!L", self.out_group))
9512 packed.append(struct.pack("!H", self.flags))
9513 packed.append('\x00' * 2)
9514 packed.append(self.match.pack())
Rich Lane7dcdf022013-12-11 14:45:27 -08009515 packed.append(loxi.generic_util.pack_list(self.instructions))
Rich Lanec2ee4b82013-04-24 17:12:38 -07009516 length = sum([len(x) for x in packed])
9517 packed[2] = struct.pack("!H", length)
9518 return ''.join(packed)
9519
9520 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08009521 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07009522 obj = flow_add()
Dan Talaycof6202252013-07-02 01:00:29 -07009523 _version = reader.read("!B")[0]
9524 assert(_version == 4)
9525 _type = reader.read("!B")[0]
9526 assert(_type == 14)
9527 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08009528 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08009529 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07009530 obj.xid = reader.read("!L")[0]
9531 obj.cookie = reader.read("!Q")[0]
9532 obj.cookie_mask = reader.read("!Q")[0]
9533 obj.table_id = reader.read("!B")[0]
9534 __command = util.unpack_fm_cmd(reader)
9535 assert(__command == 0)
9536 obj.idle_timeout = reader.read("!H")[0]
9537 obj.hard_timeout = reader.read("!H")[0]
9538 obj.priority = reader.read("!H")[0]
9539 obj.buffer_id = reader.read("!L")[0]
9540 obj.out_port = util.unpack_port_no(reader)
9541 obj.out_group = reader.read("!L")[0]
9542 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009543 reader.skip(2)
9544 obj.match = common.match.unpack(reader)
Rich Lane7dcdf022013-12-11 14:45:27 -08009545 obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -07009546 return obj
9547
9548 def __eq__(self, other):
9549 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07009550 if self.xid != other.xid: return False
9551 if self.cookie != other.cookie: return False
9552 if self.cookie_mask != other.cookie_mask: return False
9553 if self.table_id != other.table_id: return False
9554 if self.idle_timeout != other.idle_timeout: return False
9555 if self.hard_timeout != other.hard_timeout: return False
9556 if self.priority != other.priority: return False
9557 if self.buffer_id != other.buffer_id: return False
9558 if self.out_port != other.out_port: return False
9559 if self.out_group != other.out_group: return False
9560 if self.flags != other.flags: return False
9561 if self.match != other.match: return False
9562 if self.instructions != other.instructions: return False
9563 return True
9564
Rich Lanec2ee4b82013-04-24 17:12:38 -07009565 def pretty_print(self, q):
9566 q.text("flow_add {")
9567 with q.group():
9568 with q.indent(2):
9569 q.breakable()
9570 q.text("xid = ");
9571 if self.xid != None:
9572 q.text("%#x" % self.xid)
9573 else:
9574 q.text('None')
9575 q.text(","); q.breakable()
9576 q.text("cookie = ");
9577 q.text("%#x" % self.cookie)
9578 q.text(","); q.breakable()
9579 q.text("cookie_mask = ");
9580 q.text("%#x" % self.cookie_mask)
9581 q.text(","); q.breakable()
9582 q.text("table_id = ");
9583 q.text("%#x" % self.table_id)
9584 q.text(","); q.breakable()
9585 q.text("idle_timeout = ");
9586 q.text("%#x" % self.idle_timeout)
9587 q.text(","); q.breakable()
9588 q.text("hard_timeout = ");
9589 q.text("%#x" % self.hard_timeout)
9590 q.text(","); q.breakable()
9591 q.text("priority = ");
9592 q.text("%#x" % self.priority)
9593 q.text(","); q.breakable()
9594 q.text("buffer_id = ");
9595 q.text("%#x" % self.buffer_id)
9596 q.text(","); q.breakable()
9597 q.text("out_port = ");
9598 q.text(util.pretty_port(self.out_port))
9599 q.text(","); q.breakable()
9600 q.text("out_group = ");
9601 q.text("%#x" % self.out_group)
9602 q.text(","); q.breakable()
9603 q.text("flags = ");
9604 q.text("%#x" % self.flags)
9605 q.text(","); q.breakable()
9606 q.text("match = ");
9607 q.pp(self.match)
9608 q.text(","); q.breakable()
9609 q.text("instructions = ");
9610 q.pp(self.instructions)
9611 q.breakable()
9612 q.text('}')
9613
Rich Lane7dcdf022013-12-11 14:45:27 -08009614flow_mod.subtypes[0] = flow_add
9615
9616class flow_delete(flow_mod):
Dan Talaycof6202252013-07-02 01:00:29 -07009617 version = 4
9618 type = 14
9619 _command = 3
Rich Lanec2ee4b82013-04-24 17:12:38 -07009620
9621 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 -08009622 if xid != None:
9623 self.xid = xid
9624 else:
9625 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07009626 if cookie != None:
9627 self.cookie = cookie
9628 else:
9629 self.cookie = 0
9630 if cookie_mask != None:
9631 self.cookie_mask = cookie_mask
9632 else:
9633 self.cookie_mask = 0
9634 if table_id != None:
9635 self.table_id = table_id
9636 else:
9637 self.table_id = 0
9638 if idle_timeout != None:
9639 self.idle_timeout = idle_timeout
9640 else:
9641 self.idle_timeout = 0
9642 if hard_timeout != None:
9643 self.hard_timeout = hard_timeout
9644 else:
9645 self.hard_timeout = 0
9646 if priority != None:
9647 self.priority = priority
9648 else:
9649 self.priority = 0
9650 if buffer_id != None:
9651 self.buffer_id = buffer_id
9652 else:
9653 self.buffer_id = 0
9654 if out_port != None:
9655 self.out_port = out_port
9656 else:
9657 self.out_port = 0
9658 if out_group != None:
9659 self.out_group = out_group
9660 else:
9661 self.out_group = 0
9662 if flags != None:
9663 self.flags = flags
9664 else:
9665 self.flags = 0
9666 if match != None:
9667 self.match = match
9668 else:
9669 self.match = common.match()
9670 if instructions != None:
9671 self.instructions = instructions
9672 else:
9673 self.instructions = []
Rich Lane7dcdf022013-12-11 14:45:27 -08009674 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07009675
9676 def pack(self):
9677 packed = []
9678 packed.append(struct.pack("!B", self.version))
9679 packed.append(struct.pack("!B", self.type))
9680 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9681 packed.append(struct.pack("!L", self.xid))
9682 packed.append(struct.pack("!Q", self.cookie))
9683 packed.append(struct.pack("!Q", self.cookie_mask))
9684 packed.append(struct.pack("!B", self.table_id))
Dan Talaycof6202252013-07-02 01:00:29 -07009685 packed.append(util.pack_fm_cmd(self._command))
Rich Lanec2ee4b82013-04-24 17:12:38 -07009686 packed.append(struct.pack("!H", self.idle_timeout))
9687 packed.append(struct.pack("!H", self.hard_timeout))
9688 packed.append(struct.pack("!H", self.priority))
9689 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -07009690 packed.append(util.pack_port_no(self.out_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -07009691 packed.append(struct.pack("!L", self.out_group))
9692 packed.append(struct.pack("!H", self.flags))
9693 packed.append('\x00' * 2)
9694 packed.append(self.match.pack())
Rich Lane7dcdf022013-12-11 14:45:27 -08009695 packed.append(loxi.generic_util.pack_list(self.instructions))
Rich Lanec2ee4b82013-04-24 17:12:38 -07009696 length = sum([len(x) for x in packed])
9697 packed[2] = struct.pack("!H", length)
9698 return ''.join(packed)
9699
9700 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08009701 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07009702 obj = flow_delete()
Dan Talaycof6202252013-07-02 01:00:29 -07009703 _version = reader.read("!B")[0]
9704 assert(_version == 4)
9705 _type = reader.read("!B")[0]
9706 assert(_type == 14)
9707 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08009708 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08009709 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07009710 obj.xid = reader.read("!L")[0]
9711 obj.cookie = reader.read("!Q")[0]
9712 obj.cookie_mask = reader.read("!Q")[0]
9713 obj.table_id = reader.read("!B")[0]
9714 __command = util.unpack_fm_cmd(reader)
9715 assert(__command == 3)
9716 obj.idle_timeout = reader.read("!H")[0]
9717 obj.hard_timeout = reader.read("!H")[0]
9718 obj.priority = reader.read("!H")[0]
9719 obj.buffer_id = reader.read("!L")[0]
9720 obj.out_port = util.unpack_port_no(reader)
9721 obj.out_group = reader.read("!L")[0]
9722 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009723 reader.skip(2)
9724 obj.match = common.match.unpack(reader)
Rich Lane7dcdf022013-12-11 14:45:27 -08009725 obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -07009726 return obj
9727
9728 def __eq__(self, other):
9729 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07009730 if self.xid != other.xid: return False
9731 if self.cookie != other.cookie: return False
9732 if self.cookie_mask != other.cookie_mask: return False
9733 if self.table_id != other.table_id: return False
9734 if self.idle_timeout != other.idle_timeout: return False
9735 if self.hard_timeout != other.hard_timeout: return False
9736 if self.priority != other.priority: return False
9737 if self.buffer_id != other.buffer_id: return False
9738 if self.out_port != other.out_port: return False
9739 if self.out_group != other.out_group: return False
9740 if self.flags != other.flags: return False
9741 if self.match != other.match: return False
9742 if self.instructions != other.instructions: return False
9743 return True
9744
Rich Lanec2ee4b82013-04-24 17:12:38 -07009745 def pretty_print(self, q):
9746 q.text("flow_delete {")
9747 with q.group():
9748 with q.indent(2):
9749 q.breakable()
9750 q.text("xid = ");
9751 if self.xid != None:
9752 q.text("%#x" % self.xid)
9753 else:
9754 q.text('None')
9755 q.text(","); q.breakable()
9756 q.text("cookie = ");
9757 q.text("%#x" % self.cookie)
9758 q.text(","); q.breakable()
9759 q.text("cookie_mask = ");
9760 q.text("%#x" % self.cookie_mask)
9761 q.text(","); q.breakable()
9762 q.text("table_id = ");
9763 q.text("%#x" % self.table_id)
9764 q.text(","); q.breakable()
9765 q.text("idle_timeout = ");
9766 q.text("%#x" % self.idle_timeout)
9767 q.text(","); q.breakable()
9768 q.text("hard_timeout = ");
9769 q.text("%#x" % self.hard_timeout)
9770 q.text(","); q.breakable()
9771 q.text("priority = ");
9772 q.text("%#x" % self.priority)
9773 q.text(","); q.breakable()
9774 q.text("buffer_id = ");
9775 q.text("%#x" % self.buffer_id)
9776 q.text(","); q.breakable()
9777 q.text("out_port = ");
9778 q.text(util.pretty_port(self.out_port))
9779 q.text(","); q.breakable()
9780 q.text("out_group = ");
9781 q.text("%#x" % self.out_group)
9782 q.text(","); q.breakable()
9783 q.text("flags = ");
9784 q.text("%#x" % self.flags)
9785 q.text(","); q.breakable()
9786 q.text("match = ");
9787 q.pp(self.match)
9788 q.text(","); q.breakable()
9789 q.text("instructions = ");
9790 q.pp(self.instructions)
9791 q.breakable()
9792 q.text('}')
9793
Rich Lane7dcdf022013-12-11 14:45:27 -08009794flow_mod.subtypes[3] = flow_delete
9795
9796class flow_delete_strict(flow_mod):
Dan Talaycof6202252013-07-02 01:00:29 -07009797 version = 4
9798 type = 14
9799 _command = 4
Rich Lanec2ee4b82013-04-24 17:12:38 -07009800
9801 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 -08009802 if xid != None:
9803 self.xid = xid
9804 else:
9805 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07009806 if cookie != None:
9807 self.cookie = cookie
9808 else:
9809 self.cookie = 0
9810 if cookie_mask != None:
9811 self.cookie_mask = cookie_mask
9812 else:
9813 self.cookie_mask = 0
9814 if table_id != None:
9815 self.table_id = table_id
9816 else:
9817 self.table_id = 0
9818 if idle_timeout != None:
9819 self.idle_timeout = idle_timeout
9820 else:
9821 self.idle_timeout = 0
9822 if hard_timeout != None:
9823 self.hard_timeout = hard_timeout
9824 else:
9825 self.hard_timeout = 0
9826 if priority != None:
9827 self.priority = priority
9828 else:
9829 self.priority = 0
9830 if buffer_id != None:
9831 self.buffer_id = buffer_id
9832 else:
9833 self.buffer_id = 0
9834 if out_port != None:
9835 self.out_port = out_port
9836 else:
9837 self.out_port = 0
9838 if out_group != None:
9839 self.out_group = out_group
9840 else:
9841 self.out_group = 0
9842 if flags != None:
9843 self.flags = flags
9844 else:
9845 self.flags = 0
9846 if match != None:
9847 self.match = match
9848 else:
9849 self.match = common.match()
9850 if instructions != None:
9851 self.instructions = instructions
9852 else:
9853 self.instructions = []
Rich Lane7dcdf022013-12-11 14:45:27 -08009854 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07009855
9856 def pack(self):
9857 packed = []
9858 packed.append(struct.pack("!B", self.version))
9859 packed.append(struct.pack("!B", self.type))
9860 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9861 packed.append(struct.pack("!L", self.xid))
9862 packed.append(struct.pack("!Q", self.cookie))
9863 packed.append(struct.pack("!Q", self.cookie_mask))
9864 packed.append(struct.pack("!B", self.table_id))
Dan Talaycof6202252013-07-02 01:00:29 -07009865 packed.append(util.pack_fm_cmd(self._command))
Rich Lanec2ee4b82013-04-24 17:12:38 -07009866 packed.append(struct.pack("!H", self.idle_timeout))
9867 packed.append(struct.pack("!H", self.hard_timeout))
9868 packed.append(struct.pack("!H", self.priority))
9869 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -07009870 packed.append(util.pack_port_no(self.out_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -07009871 packed.append(struct.pack("!L", self.out_group))
9872 packed.append(struct.pack("!H", self.flags))
9873 packed.append('\x00' * 2)
9874 packed.append(self.match.pack())
Rich Lane7dcdf022013-12-11 14:45:27 -08009875 packed.append(loxi.generic_util.pack_list(self.instructions))
Rich Lanec2ee4b82013-04-24 17:12:38 -07009876 length = sum([len(x) for x in packed])
9877 packed[2] = struct.pack("!H", length)
9878 return ''.join(packed)
9879
9880 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08009881 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07009882 obj = flow_delete_strict()
Dan Talaycof6202252013-07-02 01:00:29 -07009883 _version = reader.read("!B")[0]
9884 assert(_version == 4)
9885 _type = reader.read("!B")[0]
9886 assert(_type == 14)
9887 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08009888 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08009889 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07009890 obj.xid = reader.read("!L")[0]
9891 obj.cookie = reader.read("!Q")[0]
9892 obj.cookie_mask = reader.read("!Q")[0]
9893 obj.table_id = reader.read("!B")[0]
9894 __command = util.unpack_fm_cmd(reader)
9895 assert(__command == 4)
9896 obj.idle_timeout = reader.read("!H")[0]
9897 obj.hard_timeout = reader.read("!H")[0]
9898 obj.priority = reader.read("!H")[0]
9899 obj.buffer_id = reader.read("!L")[0]
9900 obj.out_port = util.unpack_port_no(reader)
9901 obj.out_group = reader.read("!L")[0]
9902 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009903 reader.skip(2)
9904 obj.match = common.match.unpack(reader)
Rich Lane7dcdf022013-12-11 14:45:27 -08009905 obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -07009906 return obj
9907
9908 def __eq__(self, other):
9909 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07009910 if self.xid != other.xid: return False
9911 if self.cookie != other.cookie: return False
9912 if self.cookie_mask != other.cookie_mask: return False
9913 if self.table_id != other.table_id: return False
9914 if self.idle_timeout != other.idle_timeout: return False
9915 if self.hard_timeout != other.hard_timeout: return False
9916 if self.priority != other.priority: return False
9917 if self.buffer_id != other.buffer_id: return False
9918 if self.out_port != other.out_port: return False
9919 if self.out_group != other.out_group: return False
9920 if self.flags != other.flags: return False
9921 if self.match != other.match: return False
9922 if self.instructions != other.instructions: return False
9923 return True
9924
Rich Lanec2ee4b82013-04-24 17:12:38 -07009925 def pretty_print(self, q):
9926 q.text("flow_delete_strict {")
9927 with q.group():
9928 with q.indent(2):
9929 q.breakable()
9930 q.text("xid = ");
9931 if self.xid != None:
9932 q.text("%#x" % self.xid)
9933 else:
9934 q.text('None')
9935 q.text(","); q.breakable()
9936 q.text("cookie = ");
9937 q.text("%#x" % self.cookie)
9938 q.text(","); q.breakable()
9939 q.text("cookie_mask = ");
9940 q.text("%#x" % self.cookie_mask)
9941 q.text(","); q.breakable()
9942 q.text("table_id = ");
9943 q.text("%#x" % self.table_id)
9944 q.text(","); q.breakable()
9945 q.text("idle_timeout = ");
9946 q.text("%#x" % self.idle_timeout)
9947 q.text(","); q.breakable()
9948 q.text("hard_timeout = ");
9949 q.text("%#x" % self.hard_timeout)
9950 q.text(","); q.breakable()
9951 q.text("priority = ");
9952 q.text("%#x" % self.priority)
9953 q.text(","); q.breakable()
9954 q.text("buffer_id = ");
9955 q.text("%#x" % self.buffer_id)
9956 q.text(","); q.breakable()
9957 q.text("out_port = ");
9958 q.text(util.pretty_port(self.out_port))
9959 q.text(","); q.breakable()
9960 q.text("out_group = ");
9961 q.text("%#x" % self.out_group)
9962 q.text(","); q.breakable()
9963 q.text("flags = ");
9964 q.text("%#x" % self.flags)
9965 q.text(","); q.breakable()
9966 q.text("match = ");
9967 q.pp(self.match)
9968 q.text(","); q.breakable()
9969 q.text("instructions = ");
9970 q.pp(self.instructions)
9971 q.breakable()
9972 q.text('}')
9973
Rich Lane7dcdf022013-12-11 14:45:27 -08009974flow_mod.subtypes[4] = flow_delete_strict
9975
9976class flow_mod_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -07009977 version = 4
9978 type = 1
9979 err_type = 5
9980
9981 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08009982 if xid != None:
9983 self.xid = xid
9984 else:
9985 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07009986 if code != None:
9987 self.code = code
9988 else:
9989 self.code = 0
9990 if data != None:
9991 self.data = data
9992 else:
9993 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08009994 return
Rich Lane6f4978c2013-10-20 21:33:52 -07009995
9996 def pack(self):
9997 packed = []
9998 packed.append(struct.pack("!B", self.version))
9999 packed.append(struct.pack("!B", self.type))
10000 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10001 packed.append(struct.pack("!L", self.xid))
10002 packed.append(struct.pack("!H", self.err_type))
10003 packed.append(struct.pack("!H", self.code))
10004 packed.append(self.data)
10005 length = sum([len(x) for x in packed])
10006 packed[2] = struct.pack("!H", length)
10007 return ''.join(packed)
10008
10009 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080010010 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -070010011 obj = flow_mod_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -070010012 _version = reader.read("!B")[0]
10013 assert(_version == 4)
10014 _type = reader.read("!B")[0]
10015 assert(_type == 1)
10016 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080010017 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080010018 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -070010019 obj.xid = reader.read("!L")[0]
10020 _err_type = reader.read("!H")[0]
10021 assert(_err_type == 5)
10022 obj.code = reader.read("!H")[0]
10023 obj.data = str(reader.read_all())
10024 return obj
10025
10026 def __eq__(self, other):
10027 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -070010028 if self.xid != other.xid: return False
10029 if self.code != other.code: return False
10030 if self.data != other.data: return False
10031 return True
10032
Rich Lane6f4978c2013-10-20 21:33:52 -070010033 def pretty_print(self, q):
10034 q.text("flow_mod_failed_error_msg {")
10035 with q.group():
10036 with q.indent(2):
10037 q.breakable()
10038 q.text("xid = ");
10039 if self.xid != None:
10040 q.text("%#x" % self.xid)
10041 else:
10042 q.text('None')
10043 q.text(","); q.breakable()
10044 q.text("code = ");
10045 q.text("%#x" % self.code)
10046 q.text(","); q.breakable()
10047 q.text("data = ");
10048 q.pp(self.data)
10049 q.breakable()
10050 q.text('}')
10051
Rich Lane7dcdf022013-12-11 14:45:27 -080010052error_msg.subtypes[5] = flow_mod_failed_error_msg
10053
10054class flow_modify(flow_mod):
Dan Talaycof6202252013-07-02 01:00:29 -070010055 version = 4
10056 type = 14
10057 _command = 1
Rich Lanec2ee4b82013-04-24 17:12:38 -070010058
10059 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 -080010060 if xid != None:
10061 self.xid = xid
10062 else:
10063 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070010064 if cookie != None:
10065 self.cookie = cookie
10066 else:
10067 self.cookie = 0
10068 if cookie_mask != None:
10069 self.cookie_mask = cookie_mask
10070 else:
10071 self.cookie_mask = 0
10072 if table_id != None:
10073 self.table_id = table_id
10074 else:
10075 self.table_id = 0
10076 if idle_timeout != None:
10077 self.idle_timeout = idle_timeout
10078 else:
10079 self.idle_timeout = 0
10080 if hard_timeout != None:
10081 self.hard_timeout = hard_timeout
10082 else:
10083 self.hard_timeout = 0
10084 if priority != None:
10085 self.priority = priority
10086 else:
10087 self.priority = 0
10088 if buffer_id != None:
10089 self.buffer_id = buffer_id
10090 else:
10091 self.buffer_id = 0
10092 if out_port != None:
10093 self.out_port = out_port
10094 else:
10095 self.out_port = 0
10096 if out_group != None:
10097 self.out_group = out_group
10098 else:
10099 self.out_group = 0
10100 if flags != None:
10101 self.flags = flags
10102 else:
10103 self.flags = 0
10104 if match != None:
10105 self.match = match
10106 else:
10107 self.match = common.match()
10108 if instructions != None:
10109 self.instructions = instructions
10110 else:
10111 self.instructions = []
Rich Lane7dcdf022013-12-11 14:45:27 -080010112 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070010113
10114 def pack(self):
10115 packed = []
10116 packed.append(struct.pack("!B", self.version))
10117 packed.append(struct.pack("!B", self.type))
10118 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10119 packed.append(struct.pack("!L", self.xid))
10120 packed.append(struct.pack("!Q", self.cookie))
10121 packed.append(struct.pack("!Q", self.cookie_mask))
10122 packed.append(struct.pack("!B", self.table_id))
Dan Talaycof6202252013-07-02 01:00:29 -070010123 packed.append(util.pack_fm_cmd(self._command))
Rich Lanec2ee4b82013-04-24 17:12:38 -070010124 packed.append(struct.pack("!H", self.idle_timeout))
10125 packed.append(struct.pack("!H", self.hard_timeout))
10126 packed.append(struct.pack("!H", self.priority))
10127 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -070010128 packed.append(util.pack_port_no(self.out_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -070010129 packed.append(struct.pack("!L", self.out_group))
10130 packed.append(struct.pack("!H", self.flags))
10131 packed.append('\x00' * 2)
10132 packed.append(self.match.pack())
Rich Lane7dcdf022013-12-11 14:45:27 -080010133 packed.append(loxi.generic_util.pack_list(self.instructions))
Rich Lanec2ee4b82013-04-24 17:12:38 -070010134 length = sum([len(x) for x in packed])
10135 packed[2] = struct.pack("!H", length)
10136 return ''.join(packed)
10137
10138 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080010139 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070010140 obj = flow_modify()
Dan Talaycof6202252013-07-02 01:00:29 -070010141 _version = reader.read("!B")[0]
10142 assert(_version == 4)
10143 _type = reader.read("!B")[0]
10144 assert(_type == 14)
10145 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080010146 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080010147 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070010148 obj.xid = reader.read("!L")[0]
10149 obj.cookie = reader.read("!Q")[0]
10150 obj.cookie_mask = reader.read("!Q")[0]
10151 obj.table_id = reader.read("!B")[0]
10152 __command = util.unpack_fm_cmd(reader)
10153 assert(__command == 1)
10154 obj.idle_timeout = reader.read("!H")[0]
10155 obj.hard_timeout = reader.read("!H")[0]
10156 obj.priority = reader.read("!H")[0]
10157 obj.buffer_id = reader.read("!L")[0]
10158 obj.out_port = util.unpack_port_no(reader)
10159 obj.out_group = reader.read("!L")[0]
10160 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010161 reader.skip(2)
10162 obj.match = common.match.unpack(reader)
Rich Lane7dcdf022013-12-11 14:45:27 -080010163 obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070010164 return obj
10165
10166 def __eq__(self, other):
10167 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070010168 if self.xid != other.xid: return False
10169 if self.cookie != other.cookie: return False
10170 if self.cookie_mask != other.cookie_mask: return False
10171 if self.table_id != other.table_id: return False
10172 if self.idle_timeout != other.idle_timeout: return False
10173 if self.hard_timeout != other.hard_timeout: return False
10174 if self.priority != other.priority: return False
10175 if self.buffer_id != other.buffer_id: return False
10176 if self.out_port != other.out_port: return False
10177 if self.out_group != other.out_group: return False
10178 if self.flags != other.flags: return False
10179 if self.match != other.match: return False
10180 if self.instructions != other.instructions: return False
10181 return True
10182
Rich Lanec2ee4b82013-04-24 17:12:38 -070010183 def pretty_print(self, q):
10184 q.text("flow_modify {")
10185 with q.group():
10186 with q.indent(2):
10187 q.breakable()
10188 q.text("xid = ");
10189 if self.xid != None:
10190 q.text("%#x" % self.xid)
10191 else:
10192 q.text('None')
10193 q.text(","); q.breakable()
10194 q.text("cookie = ");
10195 q.text("%#x" % self.cookie)
10196 q.text(","); q.breakable()
10197 q.text("cookie_mask = ");
10198 q.text("%#x" % self.cookie_mask)
10199 q.text(","); q.breakable()
10200 q.text("table_id = ");
10201 q.text("%#x" % self.table_id)
10202 q.text(","); q.breakable()
10203 q.text("idle_timeout = ");
10204 q.text("%#x" % self.idle_timeout)
10205 q.text(","); q.breakable()
10206 q.text("hard_timeout = ");
10207 q.text("%#x" % self.hard_timeout)
10208 q.text(","); q.breakable()
10209 q.text("priority = ");
10210 q.text("%#x" % self.priority)
10211 q.text(","); q.breakable()
10212 q.text("buffer_id = ");
10213 q.text("%#x" % self.buffer_id)
10214 q.text(","); q.breakable()
10215 q.text("out_port = ");
10216 q.text(util.pretty_port(self.out_port))
10217 q.text(","); q.breakable()
10218 q.text("out_group = ");
10219 q.text("%#x" % self.out_group)
10220 q.text(","); q.breakable()
10221 q.text("flags = ");
10222 q.text("%#x" % self.flags)
10223 q.text(","); q.breakable()
10224 q.text("match = ");
10225 q.pp(self.match)
10226 q.text(","); q.breakable()
10227 q.text("instructions = ");
10228 q.pp(self.instructions)
10229 q.breakable()
10230 q.text('}')
10231
Rich Lane7dcdf022013-12-11 14:45:27 -080010232flow_mod.subtypes[1] = flow_modify
10233
10234class flow_modify_strict(flow_mod):
Dan Talaycof6202252013-07-02 01:00:29 -070010235 version = 4
10236 type = 14
10237 _command = 2
Rich Lanec2ee4b82013-04-24 17:12:38 -070010238
10239 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 -080010240 if xid != None:
10241 self.xid = xid
10242 else:
10243 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070010244 if cookie != None:
10245 self.cookie = cookie
10246 else:
10247 self.cookie = 0
10248 if cookie_mask != None:
10249 self.cookie_mask = cookie_mask
10250 else:
10251 self.cookie_mask = 0
10252 if table_id != None:
10253 self.table_id = table_id
10254 else:
10255 self.table_id = 0
10256 if idle_timeout != None:
10257 self.idle_timeout = idle_timeout
10258 else:
10259 self.idle_timeout = 0
10260 if hard_timeout != None:
10261 self.hard_timeout = hard_timeout
10262 else:
10263 self.hard_timeout = 0
10264 if priority != None:
10265 self.priority = priority
10266 else:
10267 self.priority = 0
10268 if buffer_id != None:
10269 self.buffer_id = buffer_id
10270 else:
10271 self.buffer_id = 0
10272 if out_port != None:
10273 self.out_port = out_port
10274 else:
10275 self.out_port = 0
10276 if out_group != None:
10277 self.out_group = out_group
10278 else:
10279 self.out_group = 0
10280 if flags != None:
10281 self.flags = flags
10282 else:
10283 self.flags = 0
10284 if match != None:
10285 self.match = match
10286 else:
10287 self.match = common.match()
10288 if instructions != None:
10289 self.instructions = instructions
10290 else:
10291 self.instructions = []
Rich Lane7dcdf022013-12-11 14:45:27 -080010292 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070010293
10294 def pack(self):
10295 packed = []
10296 packed.append(struct.pack("!B", self.version))
10297 packed.append(struct.pack("!B", self.type))
10298 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10299 packed.append(struct.pack("!L", self.xid))
10300 packed.append(struct.pack("!Q", self.cookie))
10301 packed.append(struct.pack("!Q", self.cookie_mask))
10302 packed.append(struct.pack("!B", self.table_id))
Dan Talaycof6202252013-07-02 01:00:29 -070010303 packed.append(util.pack_fm_cmd(self._command))
Rich Lanec2ee4b82013-04-24 17:12:38 -070010304 packed.append(struct.pack("!H", self.idle_timeout))
10305 packed.append(struct.pack("!H", self.hard_timeout))
10306 packed.append(struct.pack("!H", self.priority))
10307 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -070010308 packed.append(util.pack_port_no(self.out_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -070010309 packed.append(struct.pack("!L", self.out_group))
10310 packed.append(struct.pack("!H", self.flags))
10311 packed.append('\x00' * 2)
10312 packed.append(self.match.pack())
Rich Lane7dcdf022013-12-11 14:45:27 -080010313 packed.append(loxi.generic_util.pack_list(self.instructions))
Rich Lanec2ee4b82013-04-24 17:12:38 -070010314 length = sum([len(x) for x in packed])
10315 packed[2] = struct.pack("!H", length)
10316 return ''.join(packed)
10317
10318 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080010319 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070010320 obj = flow_modify_strict()
Dan Talaycof6202252013-07-02 01:00:29 -070010321 _version = reader.read("!B")[0]
10322 assert(_version == 4)
10323 _type = reader.read("!B")[0]
10324 assert(_type == 14)
10325 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080010326 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080010327 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070010328 obj.xid = reader.read("!L")[0]
10329 obj.cookie = reader.read("!Q")[0]
10330 obj.cookie_mask = reader.read("!Q")[0]
10331 obj.table_id = reader.read("!B")[0]
10332 __command = util.unpack_fm_cmd(reader)
10333 assert(__command == 2)
10334 obj.idle_timeout = reader.read("!H")[0]
10335 obj.hard_timeout = reader.read("!H")[0]
10336 obj.priority = reader.read("!H")[0]
10337 obj.buffer_id = reader.read("!L")[0]
10338 obj.out_port = util.unpack_port_no(reader)
10339 obj.out_group = reader.read("!L")[0]
10340 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010341 reader.skip(2)
10342 obj.match = common.match.unpack(reader)
Rich Lane7dcdf022013-12-11 14:45:27 -080010343 obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070010344 return obj
10345
10346 def __eq__(self, other):
10347 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070010348 if self.xid != other.xid: return False
10349 if self.cookie != other.cookie: return False
10350 if self.cookie_mask != other.cookie_mask: return False
10351 if self.table_id != other.table_id: return False
10352 if self.idle_timeout != other.idle_timeout: return False
10353 if self.hard_timeout != other.hard_timeout: return False
10354 if self.priority != other.priority: return False
10355 if self.buffer_id != other.buffer_id: return False
10356 if self.out_port != other.out_port: return False
10357 if self.out_group != other.out_group: return False
10358 if self.flags != other.flags: return False
10359 if self.match != other.match: return False
10360 if self.instructions != other.instructions: return False
10361 return True
10362
Rich Lanec2ee4b82013-04-24 17:12:38 -070010363 def pretty_print(self, q):
10364 q.text("flow_modify_strict {")
10365 with q.group():
10366 with q.indent(2):
10367 q.breakable()
10368 q.text("xid = ");
10369 if self.xid != None:
10370 q.text("%#x" % self.xid)
10371 else:
10372 q.text('None')
10373 q.text(","); q.breakable()
10374 q.text("cookie = ");
10375 q.text("%#x" % self.cookie)
10376 q.text(","); q.breakable()
10377 q.text("cookie_mask = ");
10378 q.text("%#x" % self.cookie_mask)
10379 q.text(","); q.breakable()
10380 q.text("table_id = ");
10381 q.text("%#x" % self.table_id)
10382 q.text(","); q.breakable()
10383 q.text("idle_timeout = ");
10384 q.text("%#x" % self.idle_timeout)
10385 q.text(","); q.breakable()
10386 q.text("hard_timeout = ");
10387 q.text("%#x" % self.hard_timeout)
10388 q.text(","); q.breakable()
10389 q.text("priority = ");
10390 q.text("%#x" % self.priority)
10391 q.text(","); q.breakable()
10392 q.text("buffer_id = ");
10393 q.text("%#x" % self.buffer_id)
10394 q.text(","); q.breakable()
10395 q.text("out_port = ");
10396 q.text(util.pretty_port(self.out_port))
10397 q.text(","); q.breakable()
10398 q.text("out_group = ");
10399 q.text("%#x" % self.out_group)
10400 q.text(","); q.breakable()
10401 q.text("flags = ");
10402 q.text("%#x" % self.flags)
10403 q.text(","); q.breakable()
10404 q.text("match = ");
10405 q.pp(self.match)
10406 q.text(","); q.breakable()
10407 q.text("instructions = ");
10408 q.pp(self.instructions)
10409 q.breakable()
10410 q.text('}')
10411
Rich Lane7dcdf022013-12-11 14:45:27 -080010412flow_mod.subtypes[2] = flow_modify_strict
10413
10414class flow_removed(message):
Dan Talaycof6202252013-07-02 01:00:29 -070010415 version = 4
10416 type = 11
Rich Lanec2ee4b82013-04-24 17:12:38 -070010417
10418 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 -080010419 if xid != None:
10420 self.xid = xid
10421 else:
10422 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070010423 if cookie != None:
10424 self.cookie = cookie
10425 else:
10426 self.cookie = 0
10427 if priority != None:
10428 self.priority = priority
10429 else:
10430 self.priority = 0
10431 if reason != None:
10432 self.reason = reason
10433 else:
10434 self.reason = 0
10435 if table_id != None:
10436 self.table_id = table_id
10437 else:
10438 self.table_id = 0
10439 if duration_sec != None:
10440 self.duration_sec = duration_sec
10441 else:
10442 self.duration_sec = 0
10443 if duration_nsec != None:
10444 self.duration_nsec = duration_nsec
10445 else:
10446 self.duration_nsec = 0
10447 if idle_timeout != None:
10448 self.idle_timeout = idle_timeout
10449 else:
10450 self.idle_timeout = 0
10451 if hard_timeout != None:
10452 self.hard_timeout = hard_timeout
10453 else:
10454 self.hard_timeout = 0
10455 if packet_count != None:
10456 self.packet_count = packet_count
10457 else:
10458 self.packet_count = 0
10459 if byte_count != None:
10460 self.byte_count = byte_count
10461 else:
10462 self.byte_count = 0
10463 if match != None:
10464 self.match = match
10465 else:
10466 self.match = common.match()
Rich Lane7dcdf022013-12-11 14:45:27 -080010467 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070010468
10469 def pack(self):
10470 packed = []
10471 packed.append(struct.pack("!B", self.version))
10472 packed.append(struct.pack("!B", self.type))
10473 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10474 packed.append(struct.pack("!L", self.xid))
10475 packed.append(struct.pack("!Q", self.cookie))
10476 packed.append(struct.pack("!H", self.priority))
10477 packed.append(struct.pack("!B", self.reason))
10478 packed.append(struct.pack("!B", self.table_id))
10479 packed.append(struct.pack("!L", self.duration_sec))
10480 packed.append(struct.pack("!L", self.duration_nsec))
10481 packed.append(struct.pack("!H", self.idle_timeout))
10482 packed.append(struct.pack("!H", self.hard_timeout))
10483 packed.append(struct.pack("!Q", self.packet_count))
10484 packed.append(struct.pack("!Q", self.byte_count))
10485 packed.append(self.match.pack())
10486 length = sum([len(x) for x in packed])
10487 packed[2] = struct.pack("!H", length)
10488 return ''.join(packed)
10489
10490 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080010491 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070010492 obj = flow_removed()
Dan Talaycof6202252013-07-02 01:00:29 -070010493 _version = reader.read("!B")[0]
10494 assert(_version == 4)
10495 _type = reader.read("!B")[0]
10496 assert(_type == 11)
10497 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080010498 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080010499 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070010500 obj.xid = reader.read("!L")[0]
10501 obj.cookie = reader.read("!Q")[0]
10502 obj.priority = reader.read("!H")[0]
10503 obj.reason = reader.read("!B")[0]
10504 obj.table_id = reader.read("!B")[0]
10505 obj.duration_sec = reader.read("!L")[0]
10506 obj.duration_nsec = reader.read("!L")[0]
10507 obj.idle_timeout = reader.read("!H")[0]
10508 obj.hard_timeout = reader.read("!H")[0]
10509 obj.packet_count = reader.read("!Q")[0]
10510 obj.byte_count = reader.read("!Q")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010511 obj.match = common.match.unpack(reader)
10512 return obj
10513
10514 def __eq__(self, other):
10515 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070010516 if self.xid != other.xid: return False
10517 if self.cookie != other.cookie: return False
10518 if self.priority != other.priority: return False
10519 if self.reason != other.reason: return False
10520 if self.table_id != other.table_id: return False
10521 if self.duration_sec != other.duration_sec: return False
10522 if self.duration_nsec != other.duration_nsec: return False
10523 if self.idle_timeout != other.idle_timeout: return False
10524 if self.hard_timeout != other.hard_timeout: return False
10525 if self.packet_count != other.packet_count: return False
10526 if self.byte_count != other.byte_count: return False
10527 if self.match != other.match: return False
10528 return True
10529
Rich Lanec2ee4b82013-04-24 17:12:38 -070010530 def pretty_print(self, q):
10531 q.text("flow_removed {")
10532 with q.group():
10533 with q.indent(2):
10534 q.breakable()
10535 q.text("xid = ");
10536 if self.xid != None:
10537 q.text("%#x" % self.xid)
10538 else:
10539 q.text('None')
10540 q.text(","); q.breakable()
10541 q.text("cookie = ");
10542 q.text("%#x" % self.cookie)
10543 q.text(","); q.breakable()
10544 q.text("priority = ");
10545 q.text("%#x" % self.priority)
10546 q.text(","); q.breakable()
10547 q.text("reason = ");
10548 q.text("%#x" % self.reason)
10549 q.text(","); q.breakable()
10550 q.text("table_id = ");
10551 q.text("%#x" % self.table_id)
10552 q.text(","); q.breakable()
10553 q.text("duration_sec = ");
10554 q.text("%#x" % self.duration_sec)
10555 q.text(","); q.breakable()
10556 q.text("duration_nsec = ");
10557 q.text("%#x" % self.duration_nsec)
10558 q.text(","); q.breakable()
10559 q.text("idle_timeout = ");
10560 q.text("%#x" % self.idle_timeout)
10561 q.text(","); q.breakable()
10562 q.text("hard_timeout = ");
10563 q.text("%#x" % self.hard_timeout)
10564 q.text(","); q.breakable()
10565 q.text("packet_count = ");
10566 q.text("%#x" % self.packet_count)
10567 q.text(","); q.breakable()
10568 q.text("byte_count = ");
10569 q.text("%#x" % self.byte_count)
10570 q.text(","); q.breakable()
10571 q.text("match = ");
10572 q.pp(self.match)
10573 q.breakable()
10574 q.text('}')
10575
Rich Lane7dcdf022013-12-11 14:45:27 -080010576message.subtypes[11] = flow_removed
10577
10578class flow_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070010579 version = 4
10580 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070010581 stats_type = 1
10582
10583 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080010584 if xid != None:
10585 self.xid = xid
10586 else:
10587 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070010588 if flags != None:
10589 self.flags = flags
10590 else:
10591 self.flags = 0
10592 if entries != None:
10593 self.entries = entries
10594 else:
10595 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -080010596 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070010597
10598 def pack(self):
10599 packed = []
10600 packed.append(struct.pack("!B", self.version))
10601 packed.append(struct.pack("!B", self.type))
10602 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10603 packed.append(struct.pack("!L", self.xid))
10604 packed.append(struct.pack("!H", self.stats_type))
10605 packed.append(struct.pack("!H", self.flags))
10606 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080010607 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -070010608 length = sum([len(x) for x in packed])
10609 packed[2] = struct.pack("!H", length)
10610 return ''.join(packed)
10611
10612 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080010613 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070010614 obj = flow_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070010615 _version = reader.read("!B")[0]
10616 assert(_version == 4)
10617 _type = reader.read("!B")[0]
10618 assert(_type == 19)
10619 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080010620 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080010621 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070010622 obj.xid = reader.read("!L")[0]
10623 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010624 assert(_stats_type == 1)
Dan Talaycof6202252013-07-02 01:00:29 -070010625 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010626 reader.skip(4)
Rich Lane7dcdf022013-12-11 14:45:27 -080010627 obj.entries = loxi.generic_util.unpack_list(reader, common.flow_stats_entry.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070010628 return obj
10629
10630 def __eq__(self, other):
10631 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070010632 if self.xid != other.xid: return False
10633 if self.flags != other.flags: return False
10634 if self.entries != other.entries: return False
10635 return True
10636
Rich Lanec2ee4b82013-04-24 17:12:38 -070010637 def pretty_print(self, q):
10638 q.text("flow_stats_reply {")
10639 with q.group():
10640 with q.indent(2):
10641 q.breakable()
10642 q.text("xid = ");
10643 if self.xid != None:
10644 q.text("%#x" % self.xid)
10645 else:
10646 q.text('None')
10647 q.text(","); q.breakable()
10648 q.text("flags = ");
10649 q.text("%#x" % self.flags)
10650 q.text(","); q.breakable()
10651 q.text("entries = ");
10652 q.pp(self.entries)
10653 q.breakable()
10654 q.text('}')
10655
Rich Lane7dcdf022013-12-11 14:45:27 -080010656stats_reply.subtypes[1] = flow_stats_reply
10657
10658class flow_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070010659 version = 4
10660 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070010661 stats_type = 1
10662
10663 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 -080010664 if xid != None:
10665 self.xid = xid
10666 else:
10667 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070010668 if flags != None:
10669 self.flags = flags
10670 else:
10671 self.flags = 0
10672 if table_id != None:
10673 self.table_id = table_id
10674 else:
10675 self.table_id = 0
10676 if out_port != None:
10677 self.out_port = out_port
10678 else:
10679 self.out_port = 0
10680 if out_group != None:
10681 self.out_group = out_group
10682 else:
10683 self.out_group = 0
10684 if cookie != None:
10685 self.cookie = cookie
10686 else:
10687 self.cookie = 0
10688 if cookie_mask != None:
10689 self.cookie_mask = cookie_mask
10690 else:
10691 self.cookie_mask = 0
10692 if match != None:
10693 self.match = match
10694 else:
10695 self.match = common.match()
Rich Lane7dcdf022013-12-11 14:45:27 -080010696 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070010697
10698 def pack(self):
10699 packed = []
10700 packed.append(struct.pack("!B", self.version))
10701 packed.append(struct.pack("!B", self.type))
10702 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10703 packed.append(struct.pack("!L", self.xid))
10704 packed.append(struct.pack("!H", self.stats_type))
10705 packed.append(struct.pack("!H", self.flags))
10706 packed.append('\x00' * 4)
10707 packed.append(struct.pack("!B", self.table_id))
10708 packed.append('\x00' * 3)
Dan Talaycof6202252013-07-02 01:00:29 -070010709 packed.append(util.pack_port_no(self.out_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -070010710 packed.append(struct.pack("!L", self.out_group))
10711 packed.append('\x00' * 4)
10712 packed.append(struct.pack("!Q", self.cookie))
10713 packed.append(struct.pack("!Q", self.cookie_mask))
10714 packed.append(self.match.pack())
10715 length = sum([len(x) for x in packed])
10716 packed[2] = struct.pack("!H", length)
10717 return ''.join(packed)
10718
10719 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080010720 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070010721 obj = flow_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070010722 _version = reader.read("!B")[0]
10723 assert(_version == 4)
10724 _type = reader.read("!B")[0]
10725 assert(_type == 18)
10726 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080010727 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080010728 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070010729 obj.xid = reader.read("!L")[0]
10730 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010731 assert(_stats_type == 1)
Dan Talaycof6202252013-07-02 01:00:29 -070010732 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010733 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -070010734 obj.table_id = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010735 reader.skip(3)
Dan Talaycof6202252013-07-02 01:00:29 -070010736 obj.out_port = util.unpack_port_no(reader)
10737 obj.out_group = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010738 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -070010739 obj.cookie = reader.read("!Q")[0]
10740 obj.cookie_mask = reader.read("!Q")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010741 obj.match = common.match.unpack(reader)
10742 return obj
10743
10744 def __eq__(self, other):
10745 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070010746 if self.xid != other.xid: return False
10747 if self.flags != other.flags: return False
10748 if self.table_id != other.table_id: return False
10749 if self.out_port != other.out_port: return False
10750 if self.out_group != other.out_group: return False
10751 if self.cookie != other.cookie: return False
10752 if self.cookie_mask != other.cookie_mask: return False
10753 if self.match != other.match: return False
10754 return True
10755
Rich Lanec2ee4b82013-04-24 17:12:38 -070010756 def pretty_print(self, q):
10757 q.text("flow_stats_request {")
10758 with q.group():
10759 with q.indent(2):
10760 q.breakable()
10761 q.text("xid = ");
10762 if self.xid != None:
10763 q.text("%#x" % self.xid)
10764 else:
10765 q.text('None')
10766 q.text(","); q.breakable()
10767 q.text("flags = ");
10768 q.text("%#x" % self.flags)
10769 q.text(","); q.breakable()
10770 q.text("table_id = ");
10771 q.text("%#x" % self.table_id)
10772 q.text(","); q.breakable()
10773 q.text("out_port = ");
10774 q.text(util.pretty_port(self.out_port))
10775 q.text(","); q.breakable()
10776 q.text("out_group = ");
10777 q.text("%#x" % self.out_group)
10778 q.text(","); q.breakable()
10779 q.text("cookie = ");
10780 q.text("%#x" % self.cookie)
10781 q.text(","); q.breakable()
10782 q.text("cookie_mask = ");
10783 q.text("%#x" % self.cookie_mask)
10784 q.text(","); q.breakable()
10785 q.text("match = ");
10786 q.pp(self.match)
10787 q.breakable()
10788 q.text('}')
10789
Rich Lane7dcdf022013-12-11 14:45:27 -080010790stats_request.subtypes[1] = flow_stats_request
10791
10792class get_config_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -070010793 version = 4
10794 type = 8
Rich Lanec2ee4b82013-04-24 17:12:38 -070010795
10796 def __init__(self, xid=None, flags=None, miss_send_len=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080010797 if xid != None:
10798 self.xid = xid
10799 else:
10800 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070010801 if flags != None:
10802 self.flags = flags
10803 else:
10804 self.flags = 0
10805 if miss_send_len != None:
10806 self.miss_send_len = miss_send_len
10807 else:
10808 self.miss_send_len = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080010809 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070010810
10811 def pack(self):
10812 packed = []
10813 packed.append(struct.pack("!B", self.version))
10814 packed.append(struct.pack("!B", self.type))
10815 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10816 packed.append(struct.pack("!L", self.xid))
10817 packed.append(struct.pack("!H", self.flags))
10818 packed.append(struct.pack("!H", self.miss_send_len))
10819 length = sum([len(x) for x in packed])
10820 packed[2] = struct.pack("!H", length)
10821 return ''.join(packed)
10822
10823 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080010824 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070010825 obj = get_config_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070010826 _version = reader.read("!B")[0]
10827 assert(_version == 4)
10828 _type = reader.read("!B")[0]
10829 assert(_type == 8)
10830 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080010831 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080010832 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070010833 obj.xid = reader.read("!L")[0]
10834 obj.flags = reader.read("!H")[0]
10835 obj.miss_send_len = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010836 return obj
10837
10838 def __eq__(self, other):
10839 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070010840 if self.xid != other.xid: return False
10841 if self.flags != other.flags: return False
10842 if self.miss_send_len != other.miss_send_len: return False
10843 return True
10844
Rich Lanec2ee4b82013-04-24 17:12:38 -070010845 def pretty_print(self, q):
10846 q.text("get_config_reply {")
10847 with q.group():
10848 with q.indent(2):
10849 q.breakable()
10850 q.text("xid = ");
10851 if self.xid != None:
10852 q.text("%#x" % self.xid)
10853 else:
10854 q.text('None')
10855 q.text(","); q.breakable()
10856 q.text("flags = ");
10857 q.text("%#x" % self.flags)
10858 q.text(","); q.breakable()
10859 q.text("miss_send_len = ");
10860 q.text("%#x" % self.miss_send_len)
10861 q.breakable()
10862 q.text('}')
10863
Rich Lane7dcdf022013-12-11 14:45:27 -080010864message.subtypes[8] = get_config_reply
10865
10866class get_config_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -070010867 version = 4
10868 type = 7
Rich Lanec2ee4b82013-04-24 17:12:38 -070010869
10870 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080010871 if xid != None:
10872 self.xid = xid
10873 else:
10874 self.xid = None
10875 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070010876
10877 def pack(self):
10878 packed = []
10879 packed.append(struct.pack("!B", self.version))
10880 packed.append(struct.pack("!B", self.type))
10881 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10882 packed.append(struct.pack("!L", self.xid))
10883 length = sum([len(x) for x in packed])
10884 packed[2] = struct.pack("!H", length)
10885 return ''.join(packed)
10886
10887 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080010888 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070010889 obj = get_config_request()
Dan Talaycof6202252013-07-02 01:00:29 -070010890 _version = reader.read("!B")[0]
10891 assert(_version == 4)
10892 _type = reader.read("!B")[0]
10893 assert(_type == 7)
10894 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080010895 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080010896 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070010897 obj.xid = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010898 return obj
10899
10900 def __eq__(self, other):
10901 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070010902 if self.xid != other.xid: return False
10903 return True
10904
Rich Lanec2ee4b82013-04-24 17:12:38 -070010905 def pretty_print(self, q):
10906 q.text("get_config_request {")
10907 with q.group():
10908 with q.indent(2):
10909 q.breakable()
10910 q.text("xid = ");
10911 if self.xid != None:
10912 q.text("%#x" % self.xid)
10913 else:
10914 q.text('None')
10915 q.breakable()
10916 q.text('}')
10917
Rich Lane7dcdf022013-12-11 14:45:27 -080010918message.subtypes[7] = get_config_request
10919
10920class group_mod(message):
10921 subtypes = {}
10922
Rich Lane95f7fc92014-01-27 17:08:16 -080010923 version = 4
10924 type = 15
10925
10926 def __init__(self, xid=None, command=None, group_type=None, group_id=None, buckets=None):
10927 if xid != None:
10928 self.xid = xid
10929 else:
10930 self.xid = None
10931 if command != None:
10932 self.command = command
10933 else:
10934 self.command = 0
10935 if group_type != None:
10936 self.group_type = group_type
10937 else:
10938 self.group_type = 0
10939 if group_id != None:
10940 self.group_id = group_id
10941 else:
10942 self.group_id = 0
10943 if buckets != None:
10944 self.buckets = buckets
10945 else:
10946 self.buckets = []
10947 return
10948
10949 def pack(self):
10950 packed = []
10951 packed.append(struct.pack("!B", self.version))
10952 packed.append(struct.pack("!B", self.type))
10953 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10954 packed.append(struct.pack("!L", self.xid))
10955 packed.append(struct.pack("!H", self.command))
10956 packed.append(struct.pack("!B", self.group_type))
10957 packed.append('\x00' * 1)
10958 packed.append(struct.pack("!L", self.group_id))
10959 packed.append(loxi.generic_util.pack_list(self.buckets))
10960 length = sum([len(x) for x in packed])
10961 packed[2] = struct.pack("!H", length)
10962 return ''.join(packed)
10963
Rich Lane7dcdf022013-12-11 14:45:27 -080010964 @staticmethod
10965 def unpack(reader):
10966 subtype, = reader.peek('!H', 8)
Rich Lane95f7fc92014-01-27 17:08:16 -080010967 subclass = group_mod.subtypes.get(subtype)
10968 if subclass:
10969 return subclass.unpack(reader)
10970
10971 obj = group_mod()
10972 _version = reader.read("!B")[0]
10973 assert(_version == 4)
10974 _type = reader.read("!B")[0]
10975 assert(_type == 15)
10976 _length = reader.read("!H")[0]
10977 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080010978 reader = orig_reader.slice(_length, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -080010979 obj.xid = reader.read("!L")[0]
10980 obj.command = reader.read("!H")[0]
10981 obj.group_type = reader.read("!B")[0]
10982 reader.skip(1)
10983 obj.group_id = reader.read("!L")[0]
10984 obj.buckets = loxi.generic_util.unpack_list(reader, common.bucket.unpack)
10985 return obj
10986
10987 def __eq__(self, other):
10988 if type(self) != type(other): return False
10989 if self.xid != other.xid: return False
10990 if self.command != other.command: return False
10991 if self.group_type != other.group_type: return False
10992 if self.group_id != other.group_id: return False
10993 if self.buckets != other.buckets: return False
10994 return True
10995
10996 def pretty_print(self, q):
10997 q.text("group_mod {")
10998 with q.group():
10999 with q.indent(2):
11000 q.breakable()
11001 q.text("xid = ");
11002 if self.xid != None:
11003 q.text("%#x" % self.xid)
11004 else:
11005 q.text('None')
11006 q.text(","); q.breakable()
11007 q.text("group_type = ");
11008 q.text("%#x" % self.group_type)
11009 q.text(","); q.breakable()
11010 q.text("group_id = ");
11011 q.text("%#x" % self.group_id)
11012 q.text(","); q.breakable()
11013 q.text("buckets = ");
11014 q.pp(self.buckets)
11015 q.breakable()
11016 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -080011017
11018message.subtypes[15] = group_mod
11019
11020class group_add(group_mod):
Rich Lane7b0f2012013-11-22 14:15:26 -080011021 version = 4
11022 type = 15
11023 command = 0
11024
11025 def __init__(self, xid=None, group_type=None, group_id=None, buckets=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080011026 if xid != None:
11027 self.xid = xid
11028 else:
11029 self.xid = None
Rich Lane7b0f2012013-11-22 14:15:26 -080011030 if group_type != None:
11031 self.group_type = group_type
11032 else:
11033 self.group_type = 0
11034 if group_id != None:
11035 self.group_id = group_id
11036 else:
11037 self.group_id = 0
11038 if buckets != None:
11039 self.buckets = buckets
11040 else:
11041 self.buckets = []
Rich Lane7dcdf022013-12-11 14:45:27 -080011042 return
Rich Lane7b0f2012013-11-22 14:15:26 -080011043
11044 def pack(self):
11045 packed = []
11046 packed.append(struct.pack("!B", self.version))
11047 packed.append(struct.pack("!B", self.type))
11048 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11049 packed.append(struct.pack("!L", self.xid))
11050 packed.append(struct.pack("!H", self.command))
11051 packed.append(struct.pack("!B", self.group_type))
11052 packed.append('\x00' * 1)
11053 packed.append(struct.pack("!L", self.group_id))
Rich Lane7dcdf022013-12-11 14:45:27 -080011054 packed.append(loxi.generic_util.pack_list(self.buckets))
Rich Lane7b0f2012013-11-22 14:15:26 -080011055 length = sum([len(x) for x in packed])
11056 packed[2] = struct.pack("!H", length)
11057 return ''.join(packed)
11058
11059 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080011060 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -080011061 obj = group_add()
Rich Lane7b0f2012013-11-22 14:15:26 -080011062 _version = reader.read("!B")[0]
11063 assert(_version == 4)
11064 _type = reader.read("!B")[0]
11065 assert(_type == 15)
11066 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011067 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080011068 reader = orig_reader.slice(_length, 4)
Rich Lane7b0f2012013-11-22 14:15:26 -080011069 obj.xid = reader.read("!L")[0]
11070 _command = reader.read("!H")[0]
11071 assert(_command == 0)
11072 obj.group_type = reader.read("!B")[0]
11073 reader.skip(1)
11074 obj.group_id = reader.read("!L")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011075 obj.buckets = loxi.generic_util.unpack_list(reader, common.bucket.unpack)
Rich Lane7b0f2012013-11-22 14:15:26 -080011076 return obj
11077
11078 def __eq__(self, other):
11079 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -080011080 if self.xid != other.xid: return False
11081 if self.group_type != other.group_type: return False
11082 if self.group_id != other.group_id: return False
11083 if self.buckets != other.buckets: return False
11084 return True
11085
Rich Lane7b0f2012013-11-22 14:15:26 -080011086 def pretty_print(self, q):
11087 q.text("group_add {")
11088 with q.group():
11089 with q.indent(2):
11090 q.breakable()
11091 q.text("xid = ");
11092 if self.xid != None:
11093 q.text("%#x" % self.xid)
11094 else:
11095 q.text('None')
11096 q.text(","); q.breakable()
11097 q.text("group_type = ");
11098 q.text("%#x" % self.group_type)
11099 q.text(","); q.breakable()
11100 q.text("group_id = ");
11101 q.text("%#x" % self.group_id)
11102 q.text(","); q.breakable()
11103 q.text("buckets = ");
11104 q.pp(self.buckets)
11105 q.breakable()
11106 q.text('}')
11107
Rich Lane7dcdf022013-12-11 14:45:27 -080011108group_mod.subtypes[0] = group_add
11109
11110class group_delete(group_mod):
Rich Lane7b0f2012013-11-22 14:15:26 -080011111 version = 4
11112 type = 15
11113 command = 2
11114
11115 def __init__(self, xid=None, group_type=None, group_id=None, buckets=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080011116 if xid != None:
11117 self.xid = xid
11118 else:
11119 self.xid = None
Rich Lane7b0f2012013-11-22 14:15:26 -080011120 if group_type != None:
11121 self.group_type = group_type
11122 else:
11123 self.group_type = 0
11124 if group_id != None:
11125 self.group_id = group_id
11126 else:
11127 self.group_id = 0
11128 if buckets != None:
11129 self.buckets = buckets
11130 else:
11131 self.buckets = []
Rich Lane7dcdf022013-12-11 14:45:27 -080011132 return
Rich Lane7b0f2012013-11-22 14:15:26 -080011133
11134 def pack(self):
11135 packed = []
11136 packed.append(struct.pack("!B", self.version))
11137 packed.append(struct.pack("!B", self.type))
11138 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11139 packed.append(struct.pack("!L", self.xid))
11140 packed.append(struct.pack("!H", self.command))
11141 packed.append(struct.pack("!B", self.group_type))
11142 packed.append('\x00' * 1)
11143 packed.append(struct.pack("!L", self.group_id))
Rich Lane7dcdf022013-12-11 14:45:27 -080011144 packed.append(loxi.generic_util.pack_list(self.buckets))
Rich Lane7b0f2012013-11-22 14:15:26 -080011145 length = sum([len(x) for x in packed])
11146 packed[2] = struct.pack("!H", length)
11147 return ''.join(packed)
11148
11149 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080011150 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -080011151 obj = group_delete()
Rich Lane7b0f2012013-11-22 14:15:26 -080011152 _version = reader.read("!B")[0]
11153 assert(_version == 4)
11154 _type = reader.read("!B")[0]
11155 assert(_type == 15)
11156 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011157 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080011158 reader = orig_reader.slice(_length, 4)
Rich Lane7b0f2012013-11-22 14:15:26 -080011159 obj.xid = reader.read("!L")[0]
11160 _command = reader.read("!H")[0]
11161 assert(_command == 2)
11162 obj.group_type = reader.read("!B")[0]
11163 reader.skip(1)
11164 obj.group_id = reader.read("!L")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011165 obj.buckets = loxi.generic_util.unpack_list(reader, common.bucket.unpack)
Rich Lane7b0f2012013-11-22 14:15:26 -080011166 return obj
11167
11168 def __eq__(self, other):
11169 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -080011170 if self.xid != other.xid: return False
11171 if self.group_type != other.group_type: return False
11172 if self.group_id != other.group_id: return False
11173 if self.buckets != other.buckets: return False
11174 return True
11175
Rich Lane7b0f2012013-11-22 14:15:26 -080011176 def pretty_print(self, q):
11177 q.text("group_delete {")
11178 with q.group():
11179 with q.indent(2):
11180 q.breakable()
11181 q.text("xid = ");
11182 if self.xid != None:
11183 q.text("%#x" % self.xid)
11184 else:
11185 q.text('None')
11186 q.text(","); q.breakable()
11187 q.text("group_type = ");
11188 q.text("%#x" % self.group_type)
11189 q.text(","); q.breakable()
11190 q.text("group_id = ");
11191 q.text("%#x" % self.group_id)
11192 q.text(","); q.breakable()
11193 q.text("buckets = ");
11194 q.pp(self.buckets)
11195 q.breakable()
11196 q.text('}')
11197
Rich Lane7dcdf022013-12-11 14:45:27 -080011198group_mod.subtypes[2] = group_delete
11199
11200class group_desc_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070011201 version = 4
11202 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070011203 stats_type = 7
11204
11205 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080011206 if xid != None:
11207 self.xid = xid
11208 else:
11209 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070011210 if flags != None:
11211 self.flags = flags
11212 else:
11213 self.flags = 0
11214 if entries != None:
11215 self.entries = entries
11216 else:
11217 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -080011218 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070011219
11220 def pack(self):
11221 packed = []
11222 packed.append(struct.pack("!B", self.version))
11223 packed.append(struct.pack("!B", self.type))
11224 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11225 packed.append(struct.pack("!L", self.xid))
11226 packed.append(struct.pack("!H", self.stats_type))
11227 packed.append(struct.pack("!H", self.flags))
11228 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080011229 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -070011230 length = sum([len(x) for x in packed])
11231 packed[2] = struct.pack("!H", length)
11232 return ''.join(packed)
11233
11234 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080011235 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070011236 obj = group_desc_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070011237 _version = reader.read("!B")[0]
11238 assert(_version == 4)
11239 _type = reader.read("!B")[0]
11240 assert(_type == 19)
11241 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011242 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080011243 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070011244 obj.xid = reader.read("!L")[0]
11245 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011246 assert(_stats_type == 7)
Dan Talaycof6202252013-07-02 01:00:29 -070011247 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011248 reader.skip(4)
Rich Lane7dcdf022013-12-11 14:45:27 -080011249 obj.entries = loxi.generic_util.unpack_list(reader, common.group_desc_stats_entry.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070011250 return obj
11251
11252 def __eq__(self, other):
11253 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070011254 if self.xid != other.xid: return False
11255 if self.flags != other.flags: return False
11256 if self.entries != other.entries: return False
11257 return True
11258
Rich Lanec2ee4b82013-04-24 17:12:38 -070011259 def pretty_print(self, q):
11260 q.text("group_desc_stats_reply {")
11261 with q.group():
11262 with q.indent(2):
11263 q.breakable()
11264 q.text("xid = ");
11265 if self.xid != None:
11266 q.text("%#x" % self.xid)
11267 else:
11268 q.text('None')
11269 q.text(","); q.breakable()
11270 q.text("flags = ");
11271 q.text("%#x" % self.flags)
11272 q.text(","); q.breakable()
11273 q.text("entries = ");
11274 q.pp(self.entries)
11275 q.breakable()
11276 q.text('}')
11277
Rich Lane7dcdf022013-12-11 14:45:27 -080011278stats_reply.subtypes[7] = group_desc_stats_reply
11279
11280class group_desc_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070011281 version = 4
11282 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070011283 stats_type = 7
11284
11285 def __init__(self, xid=None, flags=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080011286 if xid != None:
11287 self.xid = xid
11288 else:
11289 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070011290 if flags != None:
11291 self.flags = flags
11292 else:
11293 self.flags = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080011294 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070011295
11296 def pack(self):
11297 packed = []
11298 packed.append(struct.pack("!B", self.version))
11299 packed.append(struct.pack("!B", self.type))
11300 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11301 packed.append(struct.pack("!L", self.xid))
11302 packed.append(struct.pack("!H", self.stats_type))
11303 packed.append(struct.pack("!H", self.flags))
11304 packed.append('\x00' * 4)
11305 length = sum([len(x) for x in packed])
11306 packed[2] = struct.pack("!H", length)
11307 return ''.join(packed)
11308
11309 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080011310 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070011311 obj = group_desc_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070011312 _version = reader.read("!B")[0]
11313 assert(_version == 4)
11314 _type = reader.read("!B")[0]
11315 assert(_type == 18)
11316 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011317 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080011318 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070011319 obj.xid = reader.read("!L")[0]
11320 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011321 assert(_stats_type == 7)
Dan Talaycof6202252013-07-02 01:00:29 -070011322 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011323 reader.skip(4)
11324 return obj
11325
11326 def __eq__(self, other):
11327 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070011328 if self.xid != other.xid: return False
11329 if self.flags != other.flags: return False
11330 return True
11331
Rich Lanec2ee4b82013-04-24 17:12:38 -070011332 def pretty_print(self, q):
11333 q.text("group_desc_stats_request {")
11334 with q.group():
11335 with q.indent(2):
11336 q.breakable()
11337 q.text("xid = ");
11338 if self.xid != None:
11339 q.text("%#x" % self.xid)
11340 else:
11341 q.text('None')
11342 q.text(","); q.breakable()
11343 q.text("flags = ");
11344 q.text("%#x" % self.flags)
11345 q.breakable()
11346 q.text('}')
11347
Rich Lane7dcdf022013-12-11 14:45:27 -080011348stats_request.subtypes[7] = group_desc_stats_request
11349
11350class group_features_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070011351 version = 4
11352 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070011353 stats_type = 8
11354
11355 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 -080011356 if xid != None:
11357 self.xid = xid
11358 else:
11359 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070011360 if flags != None:
11361 self.flags = flags
11362 else:
11363 self.flags = 0
11364 if types != None:
11365 self.types = types
11366 else:
11367 self.types = 0
11368 if capabilities != None:
11369 self.capabilities = capabilities
11370 else:
11371 self.capabilities = 0
11372 if max_groups_all != None:
11373 self.max_groups_all = max_groups_all
11374 else:
11375 self.max_groups_all = 0
11376 if max_groups_select != None:
11377 self.max_groups_select = max_groups_select
11378 else:
11379 self.max_groups_select = 0
11380 if max_groups_indirect != None:
11381 self.max_groups_indirect = max_groups_indirect
11382 else:
11383 self.max_groups_indirect = 0
11384 if max_groups_ff != None:
11385 self.max_groups_ff = max_groups_ff
11386 else:
11387 self.max_groups_ff = 0
11388 if actions_all != None:
11389 self.actions_all = actions_all
11390 else:
11391 self.actions_all = 0
11392 if actions_select != None:
11393 self.actions_select = actions_select
11394 else:
11395 self.actions_select = 0
11396 if actions_indirect != None:
11397 self.actions_indirect = actions_indirect
11398 else:
11399 self.actions_indirect = 0
11400 if actions_ff != None:
11401 self.actions_ff = actions_ff
11402 else:
11403 self.actions_ff = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080011404 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070011405
11406 def pack(self):
11407 packed = []
11408 packed.append(struct.pack("!B", self.version))
11409 packed.append(struct.pack("!B", self.type))
11410 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11411 packed.append(struct.pack("!L", self.xid))
11412 packed.append(struct.pack("!H", self.stats_type))
11413 packed.append(struct.pack("!H", self.flags))
11414 packed.append('\x00' * 4)
11415 packed.append(struct.pack("!L", self.types))
11416 packed.append(struct.pack("!L", self.capabilities))
11417 packed.append(struct.pack("!L", self.max_groups_all))
11418 packed.append(struct.pack("!L", self.max_groups_select))
11419 packed.append(struct.pack("!L", self.max_groups_indirect))
11420 packed.append(struct.pack("!L", self.max_groups_ff))
11421 packed.append(struct.pack("!L", self.actions_all))
11422 packed.append(struct.pack("!L", self.actions_select))
11423 packed.append(struct.pack("!L", self.actions_indirect))
11424 packed.append(struct.pack("!L", self.actions_ff))
11425 length = sum([len(x) for x in packed])
11426 packed[2] = struct.pack("!H", length)
11427 return ''.join(packed)
11428
11429 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080011430 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070011431 obj = group_features_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070011432 _version = reader.read("!B")[0]
11433 assert(_version == 4)
11434 _type = reader.read("!B")[0]
11435 assert(_type == 19)
11436 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011437 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080011438 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070011439 obj.xid = reader.read("!L")[0]
11440 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011441 assert(_stats_type == 8)
Dan Talaycof6202252013-07-02 01:00:29 -070011442 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011443 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -070011444 obj.types = reader.read("!L")[0]
11445 obj.capabilities = reader.read("!L")[0]
11446 obj.max_groups_all = reader.read("!L")[0]
11447 obj.max_groups_select = reader.read("!L")[0]
11448 obj.max_groups_indirect = reader.read("!L")[0]
11449 obj.max_groups_ff = reader.read("!L")[0]
11450 obj.actions_all = reader.read("!L")[0]
11451 obj.actions_select = reader.read("!L")[0]
11452 obj.actions_indirect = reader.read("!L")[0]
11453 obj.actions_ff = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011454 return obj
11455
11456 def __eq__(self, other):
11457 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070011458 if self.xid != other.xid: return False
11459 if self.flags != other.flags: return False
11460 if self.types != other.types: return False
11461 if self.capabilities != other.capabilities: return False
11462 if self.max_groups_all != other.max_groups_all: return False
11463 if self.max_groups_select != other.max_groups_select: return False
11464 if self.max_groups_indirect != other.max_groups_indirect: return False
11465 if self.max_groups_ff != other.max_groups_ff: return False
11466 if self.actions_all != other.actions_all: return False
11467 if self.actions_select != other.actions_select: return False
11468 if self.actions_indirect != other.actions_indirect: return False
11469 if self.actions_ff != other.actions_ff: return False
11470 return True
11471
Rich Lanec2ee4b82013-04-24 17:12:38 -070011472 def pretty_print(self, q):
11473 q.text("group_features_stats_reply {")
11474 with q.group():
11475 with q.indent(2):
11476 q.breakable()
11477 q.text("xid = ");
11478 if self.xid != None:
11479 q.text("%#x" % self.xid)
11480 else:
11481 q.text('None')
11482 q.text(","); q.breakable()
11483 q.text("flags = ");
11484 q.text("%#x" % self.flags)
11485 q.text(","); q.breakable()
11486 q.text("types = ");
11487 q.text("%#x" % self.types)
11488 q.text(","); q.breakable()
11489 q.text("capabilities = ");
11490 q.text("%#x" % self.capabilities)
11491 q.text(","); q.breakable()
11492 q.text("max_groups_all = ");
11493 q.text("%#x" % self.max_groups_all)
11494 q.text(","); q.breakable()
11495 q.text("max_groups_select = ");
11496 q.text("%#x" % self.max_groups_select)
11497 q.text(","); q.breakable()
11498 q.text("max_groups_indirect = ");
11499 q.text("%#x" % self.max_groups_indirect)
11500 q.text(","); q.breakable()
11501 q.text("max_groups_ff = ");
11502 q.text("%#x" % self.max_groups_ff)
11503 q.text(","); q.breakable()
11504 q.text("actions_all = ");
11505 q.text("%#x" % self.actions_all)
11506 q.text(","); q.breakable()
11507 q.text("actions_select = ");
11508 q.text("%#x" % self.actions_select)
11509 q.text(","); q.breakable()
11510 q.text("actions_indirect = ");
11511 q.text("%#x" % self.actions_indirect)
11512 q.text(","); q.breakable()
11513 q.text("actions_ff = ");
11514 q.text("%#x" % self.actions_ff)
11515 q.breakable()
11516 q.text('}')
11517
Rich Lane7dcdf022013-12-11 14:45:27 -080011518stats_reply.subtypes[8] = group_features_stats_reply
11519
11520class group_features_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070011521 version = 4
11522 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070011523 stats_type = 8
11524
11525 def __init__(self, xid=None, flags=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080011526 if xid != None:
11527 self.xid = xid
11528 else:
11529 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070011530 if flags != None:
11531 self.flags = flags
11532 else:
11533 self.flags = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080011534 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070011535
11536 def pack(self):
11537 packed = []
11538 packed.append(struct.pack("!B", self.version))
11539 packed.append(struct.pack("!B", self.type))
11540 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11541 packed.append(struct.pack("!L", self.xid))
11542 packed.append(struct.pack("!H", self.stats_type))
11543 packed.append(struct.pack("!H", self.flags))
11544 packed.append('\x00' * 4)
11545 length = sum([len(x) for x in packed])
11546 packed[2] = struct.pack("!H", length)
11547 return ''.join(packed)
11548
11549 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080011550 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070011551 obj = group_features_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070011552 _version = reader.read("!B")[0]
11553 assert(_version == 4)
11554 _type = reader.read("!B")[0]
11555 assert(_type == 18)
11556 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011557 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080011558 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070011559 obj.xid = reader.read("!L")[0]
11560 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011561 assert(_stats_type == 8)
Dan Talaycof6202252013-07-02 01:00:29 -070011562 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011563 reader.skip(4)
11564 return obj
11565
11566 def __eq__(self, other):
11567 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070011568 if self.xid != other.xid: return False
11569 if self.flags != other.flags: return False
11570 return True
11571
Rich Lanec2ee4b82013-04-24 17:12:38 -070011572 def pretty_print(self, q):
11573 q.text("group_features_stats_request {")
11574 with q.group():
11575 with q.indent(2):
11576 q.breakable()
11577 q.text("xid = ");
11578 if self.xid != None:
11579 q.text("%#x" % self.xid)
11580 else:
11581 q.text('None')
11582 q.text(","); q.breakable()
11583 q.text("flags = ");
11584 q.text("%#x" % self.flags)
11585 q.breakable()
11586 q.text('}')
11587
Rich Lane7dcdf022013-12-11 14:45:27 -080011588stats_request.subtypes[8] = group_features_stats_request
11589
11590class group_mod_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -070011591 version = 4
11592 type = 1
11593 err_type = 6
11594
11595 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080011596 if xid != None:
11597 self.xid = xid
11598 else:
11599 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -070011600 if code != None:
11601 self.code = code
11602 else:
11603 self.code = 0
11604 if data != None:
11605 self.data = data
11606 else:
11607 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080011608 return
Rich Lane6f4978c2013-10-20 21:33:52 -070011609
11610 def pack(self):
11611 packed = []
11612 packed.append(struct.pack("!B", self.version))
11613 packed.append(struct.pack("!B", self.type))
11614 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11615 packed.append(struct.pack("!L", self.xid))
11616 packed.append(struct.pack("!H", self.err_type))
11617 packed.append(struct.pack("!H", self.code))
11618 packed.append(self.data)
11619 length = sum([len(x) for x in packed])
11620 packed[2] = struct.pack("!H", length)
11621 return ''.join(packed)
11622
11623 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080011624 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -070011625 obj = group_mod_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -070011626 _version = reader.read("!B")[0]
11627 assert(_version == 4)
11628 _type = reader.read("!B")[0]
11629 assert(_type == 1)
11630 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011631 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080011632 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -070011633 obj.xid = reader.read("!L")[0]
11634 _err_type = reader.read("!H")[0]
11635 assert(_err_type == 6)
11636 obj.code = reader.read("!H")[0]
11637 obj.data = str(reader.read_all())
11638 return obj
11639
11640 def __eq__(self, other):
11641 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -070011642 if self.xid != other.xid: return False
11643 if self.code != other.code: return False
11644 if self.data != other.data: return False
11645 return True
11646
Rich Lane6f4978c2013-10-20 21:33:52 -070011647 def pretty_print(self, q):
11648 q.text("group_mod_failed_error_msg {")
11649 with q.group():
11650 with q.indent(2):
11651 q.breakable()
11652 q.text("xid = ");
11653 if self.xid != None:
11654 q.text("%#x" % self.xid)
11655 else:
11656 q.text('None')
11657 q.text(","); q.breakable()
11658 q.text("code = ");
11659 q.text("%#x" % self.code)
11660 q.text(","); q.breakable()
11661 q.text("data = ");
11662 q.pp(self.data)
11663 q.breakable()
11664 q.text('}')
11665
Rich Lane7dcdf022013-12-11 14:45:27 -080011666error_msg.subtypes[6] = group_mod_failed_error_msg
11667
11668class group_modify(group_mod):
Rich Lane7b0f2012013-11-22 14:15:26 -080011669 version = 4
11670 type = 15
11671 command = 1
11672
11673 def __init__(self, xid=None, group_type=None, group_id=None, buckets=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080011674 if xid != None:
11675 self.xid = xid
11676 else:
11677 self.xid = None
Rich Lane7b0f2012013-11-22 14:15:26 -080011678 if group_type != None:
11679 self.group_type = group_type
11680 else:
11681 self.group_type = 0
11682 if group_id != None:
11683 self.group_id = group_id
11684 else:
11685 self.group_id = 0
11686 if buckets != None:
11687 self.buckets = buckets
11688 else:
11689 self.buckets = []
Rich Lane7dcdf022013-12-11 14:45:27 -080011690 return
Rich Lane7b0f2012013-11-22 14:15:26 -080011691
11692 def pack(self):
11693 packed = []
11694 packed.append(struct.pack("!B", self.version))
11695 packed.append(struct.pack("!B", self.type))
11696 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11697 packed.append(struct.pack("!L", self.xid))
11698 packed.append(struct.pack("!H", self.command))
11699 packed.append(struct.pack("!B", self.group_type))
11700 packed.append('\x00' * 1)
11701 packed.append(struct.pack("!L", self.group_id))
Rich Lane7dcdf022013-12-11 14:45:27 -080011702 packed.append(loxi.generic_util.pack_list(self.buckets))
Rich Lane7b0f2012013-11-22 14:15:26 -080011703 length = sum([len(x) for x in packed])
11704 packed[2] = struct.pack("!H", length)
11705 return ''.join(packed)
11706
11707 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080011708 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -080011709 obj = group_modify()
Rich Lane7b0f2012013-11-22 14:15:26 -080011710 _version = reader.read("!B")[0]
11711 assert(_version == 4)
11712 _type = reader.read("!B")[0]
11713 assert(_type == 15)
11714 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011715 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080011716 reader = orig_reader.slice(_length, 4)
Rich Lane7b0f2012013-11-22 14:15:26 -080011717 obj.xid = reader.read("!L")[0]
11718 _command = reader.read("!H")[0]
11719 assert(_command == 1)
11720 obj.group_type = reader.read("!B")[0]
11721 reader.skip(1)
11722 obj.group_id = reader.read("!L")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011723 obj.buckets = loxi.generic_util.unpack_list(reader, common.bucket.unpack)
Rich Lane7b0f2012013-11-22 14:15:26 -080011724 return obj
11725
11726 def __eq__(self, other):
11727 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -080011728 if self.xid != other.xid: return False
11729 if self.group_type != other.group_type: return False
11730 if self.group_id != other.group_id: return False
11731 if self.buckets != other.buckets: return False
11732 return True
11733
Rich Lane7b0f2012013-11-22 14:15:26 -080011734 def pretty_print(self, q):
11735 q.text("group_modify {")
11736 with q.group():
11737 with q.indent(2):
11738 q.breakable()
11739 q.text("xid = ");
11740 if self.xid != None:
11741 q.text("%#x" % self.xid)
11742 else:
11743 q.text('None')
11744 q.text(","); q.breakable()
11745 q.text("group_type = ");
11746 q.text("%#x" % self.group_type)
11747 q.text(","); q.breakable()
11748 q.text("group_id = ");
11749 q.text("%#x" % self.group_id)
11750 q.text(","); q.breakable()
11751 q.text("buckets = ");
11752 q.pp(self.buckets)
11753 q.breakable()
11754 q.text('}')
11755
Rich Lane7dcdf022013-12-11 14:45:27 -080011756group_mod.subtypes[1] = group_modify
11757
11758class group_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070011759 version = 4
11760 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070011761 stats_type = 6
11762
11763 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080011764 if xid != None:
11765 self.xid = xid
11766 else:
11767 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070011768 if flags != None:
11769 self.flags = flags
11770 else:
11771 self.flags = 0
11772 if entries != None:
11773 self.entries = entries
11774 else:
11775 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -080011776 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070011777
11778 def pack(self):
11779 packed = []
11780 packed.append(struct.pack("!B", self.version))
11781 packed.append(struct.pack("!B", self.type))
11782 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11783 packed.append(struct.pack("!L", self.xid))
11784 packed.append(struct.pack("!H", self.stats_type))
11785 packed.append(struct.pack("!H", self.flags))
11786 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080011787 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -070011788 length = sum([len(x) for x in packed])
11789 packed[2] = struct.pack("!H", length)
11790 return ''.join(packed)
11791
11792 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080011793 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070011794 obj = group_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070011795 _version = reader.read("!B")[0]
11796 assert(_version == 4)
11797 _type = reader.read("!B")[0]
11798 assert(_type == 19)
11799 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011800 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080011801 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070011802 obj.xid = reader.read("!L")[0]
11803 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011804 assert(_stats_type == 6)
Dan Talaycof6202252013-07-02 01:00:29 -070011805 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011806 reader.skip(4)
Rich Lane7dcdf022013-12-11 14:45:27 -080011807 obj.entries = loxi.generic_util.unpack_list(reader, common.group_stats_entry.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070011808 return obj
11809
11810 def __eq__(self, other):
11811 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070011812 if self.xid != other.xid: return False
11813 if self.flags != other.flags: return False
11814 if self.entries != other.entries: return False
11815 return True
11816
Rich Lanec2ee4b82013-04-24 17:12:38 -070011817 def pretty_print(self, q):
11818 q.text("group_stats_reply {")
11819 with q.group():
11820 with q.indent(2):
11821 q.breakable()
11822 q.text("xid = ");
11823 if self.xid != None:
11824 q.text("%#x" % self.xid)
11825 else:
11826 q.text('None')
11827 q.text(","); q.breakable()
11828 q.text("flags = ");
11829 q.text("%#x" % self.flags)
11830 q.text(","); q.breakable()
11831 q.text("entries = ");
11832 q.pp(self.entries)
11833 q.breakable()
11834 q.text('}')
11835
Rich Lane7dcdf022013-12-11 14:45:27 -080011836stats_reply.subtypes[6] = group_stats_reply
11837
11838class group_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070011839 version = 4
11840 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070011841 stats_type = 6
11842
11843 def __init__(self, xid=None, flags=None, group_id=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080011844 if xid != None:
11845 self.xid = xid
11846 else:
11847 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070011848 if flags != None:
11849 self.flags = flags
11850 else:
11851 self.flags = 0
11852 if group_id != None:
11853 self.group_id = group_id
11854 else:
11855 self.group_id = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080011856 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070011857
11858 def pack(self):
11859 packed = []
11860 packed.append(struct.pack("!B", self.version))
11861 packed.append(struct.pack("!B", self.type))
11862 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11863 packed.append(struct.pack("!L", self.xid))
11864 packed.append(struct.pack("!H", self.stats_type))
11865 packed.append(struct.pack("!H", self.flags))
11866 packed.append('\x00' * 4)
11867 packed.append(struct.pack("!L", self.group_id))
11868 packed.append('\x00' * 4)
11869 length = sum([len(x) for x in packed])
11870 packed[2] = struct.pack("!H", length)
11871 return ''.join(packed)
11872
11873 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080011874 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070011875 obj = group_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070011876 _version = reader.read("!B")[0]
11877 assert(_version == 4)
11878 _type = reader.read("!B")[0]
11879 assert(_type == 18)
11880 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011881 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080011882 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070011883 obj.xid = reader.read("!L")[0]
11884 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011885 assert(_stats_type == 6)
Dan Talaycof6202252013-07-02 01:00:29 -070011886 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011887 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -070011888 obj.group_id = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011889 reader.skip(4)
11890 return obj
11891
11892 def __eq__(self, other):
11893 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070011894 if self.xid != other.xid: return False
11895 if self.flags != other.flags: return False
11896 if self.group_id != other.group_id: return False
11897 return True
11898
Rich Lanec2ee4b82013-04-24 17:12:38 -070011899 def pretty_print(self, q):
11900 q.text("group_stats_request {")
11901 with q.group():
11902 with q.indent(2):
11903 q.breakable()
11904 q.text("xid = ");
11905 if self.xid != None:
11906 q.text("%#x" % self.xid)
11907 else:
11908 q.text('None')
11909 q.text(","); q.breakable()
11910 q.text("flags = ");
11911 q.text("%#x" % self.flags)
11912 q.text(","); q.breakable()
11913 q.text("group_id = ");
11914 q.text("%#x" % self.group_id)
11915 q.breakable()
11916 q.text('}')
11917
Rich Lane7dcdf022013-12-11 14:45:27 -080011918stats_request.subtypes[6] = group_stats_request
11919
11920class hello(message):
Dan Talaycof6202252013-07-02 01:00:29 -070011921 version = 4
11922 type = 0
Rich Lanec2ee4b82013-04-24 17:12:38 -070011923
11924 def __init__(self, xid=None, elements=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080011925 if xid != None:
11926 self.xid = xid
11927 else:
11928 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070011929 if elements != None:
11930 self.elements = elements
11931 else:
11932 self.elements = []
Rich Lane7dcdf022013-12-11 14:45:27 -080011933 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070011934
11935 def pack(self):
11936 packed = []
11937 packed.append(struct.pack("!B", self.version))
11938 packed.append(struct.pack("!B", self.type))
11939 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11940 packed.append(struct.pack("!L", self.xid))
Rich Lane7dcdf022013-12-11 14:45:27 -080011941 packed.append(loxi.generic_util.pack_list(self.elements))
Rich Lanec2ee4b82013-04-24 17:12:38 -070011942 length = sum([len(x) for x in packed])
11943 packed[2] = struct.pack("!H", length)
11944 return ''.join(packed)
11945
11946 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080011947 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070011948 obj = hello()
Dan Talaycof6202252013-07-02 01:00:29 -070011949 _version = reader.read("!B")[0]
11950 assert(_version == 4)
11951 _type = reader.read("!B")[0]
11952 assert(_type == 0)
11953 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011954 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080011955 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070011956 obj.xid = reader.read("!L")[0]
Rich Lane95f7fc92014-01-27 17:08:16 -080011957 obj.elements = loxi.generic_util.unpack_list(reader, common.hello_elem.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070011958 return obj
11959
11960 def __eq__(self, other):
11961 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070011962 if self.xid != other.xid: return False
11963 if self.elements != other.elements: return False
11964 return True
11965
Rich Lanec2ee4b82013-04-24 17:12:38 -070011966 def pretty_print(self, q):
11967 q.text("hello {")
11968 with q.group():
11969 with q.indent(2):
11970 q.breakable()
11971 q.text("xid = ");
11972 if self.xid != None:
11973 q.text("%#x" % self.xid)
11974 else:
11975 q.text('None')
11976 q.text(","); q.breakable()
11977 q.text("elements = ");
11978 q.pp(self.elements)
11979 q.breakable()
11980 q.text('}')
11981
Rich Lane7dcdf022013-12-11 14:45:27 -080011982message.subtypes[0] = hello
11983
11984class hello_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -070011985 version = 4
11986 type = 1
11987 err_type = 0
11988
11989 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080011990 if xid != None:
11991 self.xid = xid
11992 else:
11993 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -070011994 if code != None:
11995 self.code = code
11996 else:
11997 self.code = 0
11998 if data != None:
11999 self.data = data
12000 else:
12001 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080012002 return
Rich Lane6f4978c2013-10-20 21:33:52 -070012003
12004 def pack(self):
12005 packed = []
12006 packed.append(struct.pack("!B", self.version))
12007 packed.append(struct.pack("!B", self.type))
12008 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12009 packed.append(struct.pack("!L", self.xid))
12010 packed.append(struct.pack("!H", self.err_type))
12011 packed.append(struct.pack("!H", self.code))
12012 packed.append(self.data)
12013 length = sum([len(x) for x in packed])
12014 packed[2] = struct.pack("!H", length)
12015 return ''.join(packed)
12016
12017 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012018 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -070012019 obj = hello_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -070012020 _version = reader.read("!B")[0]
12021 assert(_version == 4)
12022 _type = reader.read("!B")[0]
12023 assert(_type == 1)
12024 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012025 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080012026 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -070012027 obj.xid = reader.read("!L")[0]
12028 _err_type = reader.read("!H")[0]
12029 assert(_err_type == 0)
12030 obj.code = reader.read("!H")[0]
12031 obj.data = str(reader.read_all())
12032 return obj
12033
12034 def __eq__(self, other):
12035 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -070012036 if self.xid != other.xid: return False
12037 if self.code != other.code: return False
12038 if self.data != other.data: return False
12039 return True
12040
Rich Lane6f4978c2013-10-20 21:33:52 -070012041 def pretty_print(self, q):
12042 q.text("hello_failed_error_msg {")
12043 with q.group():
12044 with q.indent(2):
12045 q.breakable()
12046 q.text("xid = ");
12047 if self.xid != None:
12048 q.text("%#x" % self.xid)
12049 else:
12050 q.text('None')
12051 q.text(","); q.breakable()
12052 q.text("code = ");
12053 q.text("%#x" % self.code)
12054 q.text(","); q.breakable()
12055 q.text("data = ");
12056 q.pp(self.data)
12057 q.breakable()
12058 q.text('}')
12059
Rich Lane7dcdf022013-12-11 14:45:27 -080012060error_msg.subtypes[0] = hello_failed_error_msg
12061
12062class meter_config_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070012063 version = 4
12064 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070012065 stats_type = 10
12066
12067 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012068 if xid != None:
12069 self.xid = xid
12070 else:
12071 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070012072 if flags != None:
12073 self.flags = flags
12074 else:
12075 self.flags = 0
12076 if entries != None:
12077 self.entries = entries
12078 else:
12079 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -080012080 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070012081
12082 def pack(self):
12083 packed = []
12084 packed.append(struct.pack("!B", self.version))
12085 packed.append(struct.pack("!B", self.type))
12086 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12087 packed.append(struct.pack("!L", self.xid))
12088 packed.append(struct.pack("!H", self.stats_type))
12089 packed.append(struct.pack("!H", self.flags))
12090 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080012091 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -070012092 length = sum([len(x) for x in packed])
12093 packed[2] = struct.pack("!H", length)
12094 return ''.join(packed)
12095
12096 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012097 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070012098 obj = meter_config_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070012099 _version = reader.read("!B")[0]
12100 assert(_version == 4)
12101 _type = reader.read("!B")[0]
12102 assert(_type == 19)
12103 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012104 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080012105 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070012106 obj.xid = reader.read("!L")[0]
12107 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012108 assert(_stats_type == 10)
Dan Talaycof6202252013-07-02 01:00:29 -070012109 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012110 reader.skip(4)
Rich Lane7dcdf022013-12-11 14:45:27 -080012111 obj.entries = loxi.generic_util.unpack_list(reader, meter_band.meter_band.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070012112 return obj
12113
12114 def __eq__(self, other):
12115 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070012116 if self.xid != other.xid: return False
12117 if self.flags != other.flags: return False
12118 if self.entries != other.entries: return False
12119 return True
12120
Rich Lanec2ee4b82013-04-24 17:12:38 -070012121 def pretty_print(self, q):
12122 q.text("meter_config_stats_reply {")
12123 with q.group():
12124 with q.indent(2):
12125 q.breakable()
12126 q.text("xid = ");
12127 if self.xid != None:
12128 q.text("%#x" % self.xid)
12129 else:
12130 q.text('None')
12131 q.text(","); q.breakable()
12132 q.text("flags = ");
12133 q.text("%#x" % self.flags)
12134 q.text(","); q.breakable()
12135 q.text("entries = ");
12136 q.pp(self.entries)
12137 q.breakable()
12138 q.text('}')
12139
Rich Lane7dcdf022013-12-11 14:45:27 -080012140stats_reply.subtypes[10] = meter_config_stats_reply
12141
12142class meter_config_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070012143 version = 4
12144 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070012145 stats_type = 10
12146
12147 def __init__(self, xid=None, flags=None, meter_id=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012148 if xid != None:
12149 self.xid = xid
12150 else:
12151 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070012152 if flags != None:
12153 self.flags = flags
12154 else:
12155 self.flags = 0
12156 if meter_id != None:
12157 self.meter_id = meter_id
12158 else:
12159 self.meter_id = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080012160 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070012161
12162 def pack(self):
12163 packed = []
12164 packed.append(struct.pack("!B", self.version))
12165 packed.append(struct.pack("!B", self.type))
12166 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12167 packed.append(struct.pack("!L", self.xid))
12168 packed.append(struct.pack("!H", self.stats_type))
12169 packed.append(struct.pack("!H", self.flags))
12170 packed.append('\x00' * 4)
12171 packed.append(struct.pack("!L", self.meter_id))
12172 packed.append('\x00' * 4)
12173 length = sum([len(x) for x in packed])
12174 packed[2] = struct.pack("!H", length)
12175 return ''.join(packed)
12176
12177 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012178 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070012179 obj = meter_config_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070012180 _version = reader.read("!B")[0]
12181 assert(_version == 4)
12182 _type = reader.read("!B")[0]
12183 assert(_type == 18)
12184 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012185 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080012186 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070012187 obj.xid = reader.read("!L")[0]
12188 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012189 assert(_stats_type == 10)
Dan Talaycof6202252013-07-02 01:00:29 -070012190 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012191 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -070012192 obj.meter_id = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012193 reader.skip(4)
12194 return obj
12195
12196 def __eq__(self, other):
12197 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070012198 if self.xid != other.xid: return False
12199 if self.flags != other.flags: return False
12200 if self.meter_id != other.meter_id: return False
12201 return True
12202
Rich Lanec2ee4b82013-04-24 17:12:38 -070012203 def pretty_print(self, q):
12204 q.text("meter_config_stats_request {")
12205 with q.group():
12206 with q.indent(2):
12207 q.breakable()
12208 q.text("xid = ");
12209 if self.xid != None:
12210 q.text("%#x" % self.xid)
12211 else:
12212 q.text('None')
12213 q.text(","); q.breakable()
12214 q.text("flags = ");
12215 q.text("%#x" % self.flags)
12216 q.text(","); q.breakable()
12217 q.text("meter_id = ");
12218 q.text("%#x" % self.meter_id)
12219 q.breakable()
12220 q.text('}')
12221
Rich Lane7dcdf022013-12-11 14:45:27 -080012222stats_request.subtypes[10] = meter_config_stats_request
12223
12224class meter_features_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070012225 version = 4
12226 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070012227 stats_type = 11
12228
12229 def __init__(self, xid=None, flags=None, features=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012230 if xid != None:
12231 self.xid = xid
12232 else:
12233 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070012234 if flags != None:
12235 self.flags = flags
12236 else:
12237 self.flags = 0
12238 if features != None:
12239 self.features = features
12240 else:
12241 self.features = common.meter_features()
Rich Lane7dcdf022013-12-11 14:45:27 -080012242 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070012243
12244 def pack(self):
12245 packed = []
12246 packed.append(struct.pack("!B", self.version))
12247 packed.append(struct.pack("!B", self.type))
12248 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12249 packed.append(struct.pack("!L", self.xid))
12250 packed.append(struct.pack("!H", self.stats_type))
12251 packed.append(struct.pack("!H", self.flags))
12252 packed.append('\x00' * 4)
12253 packed.append(self.features.pack())
12254 length = sum([len(x) for x in packed])
12255 packed[2] = struct.pack("!H", length)
12256 return ''.join(packed)
12257
12258 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012259 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070012260 obj = meter_features_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070012261 _version = reader.read("!B")[0]
12262 assert(_version == 4)
12263 _type = reader.read("!B")[0]
12264 assert(_type == 19)
12265 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012266 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080012267 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070012268 obj.xid = reader.read("!L")[0]
12269 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012270 assert(_stats_type == 11)
Dan Talaycof6202252013-07-02 01:00:29 -070012271 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012272 reader.skip(4)
12273 obj.features = common.meter_features.unpack(reader)
12274 return obj
12275
12276 def __eq__(self, other):
12277 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070012278 if self.xid != other.xid: return False
12279 if self.flags != other.flags: return False
12280 if self.features != other.features: return False
12281 return True
12282
Rich Lanec2ee4b82013-04-24 17:12:38 -070012283 def pretty_print(self, q):
12284 q.text("meter_features_stats_reply {")
12285 with q.group():
12286 with q.indent(2):
12287 q.breakable()
12288 q.text("xid = ");
12289 if self.xid != None:
12290 q.text("%#x" % self.xid)
12291 else:
12292 q.text('None')
12293 q.text(","); q.breakable()
12294 q.text("flags = ");
12295 q.text("%#x" % self.flags)
12296 q.text(","); q.breakable()
12297 q.text("features = ");
12298 q.pp(self.features)
12299 q.breakable()
12300 q.text('}')
12301
Rich Lane7dcdf022013-12-11 14:45:27 -080012302stats_reply.subtypes[11] = meter_features_stats_reply
12303
12304class meter_features_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070012305 version = 4
12306 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070012307 stats_type = 11
12308
12309 def __init__(self, xid=None, flags=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012310 if xid != None:
12311 self.xid = xid
12312 else:
12313 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070012314 if flags != None:
12315 self.flags = flags
12316 else:
12317 self.flags = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080012318 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070012319
12320 def pack(self):
12321 packed = []
12322 packed.append(struct.pack("!B", self.version))
12323 packed.append(struct.pack("!B", self.type))
12324 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12325 packed.append(struct.pack("!L", self.xid))
12326 packed.append(struct.pack("!H", self.stats_type))
12327 packed.append(struct.pack("!H", self.flags))
12328 packed.append('\x00' * 4)
12329 length = sum([len(x) for x in packed])
12330 packed[2] = struct.pack("!H", length)
12331 return ''.join(packed)
12332
12333 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012334 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070012335 obj = meter_features_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070012336 _version = reader.read("!B")[0]
12337 assert(_version == 4)
12338 _type = reader.read("!B")[0]
12339 assert(_type == 18)
12340 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012341 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080012342 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070012343 obj.xid = reader.read("!L")[0]
12344 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012345 assert(_stats_type == 11)
Dan Talaycof6202252013-07-02 01:00:29 -070012346 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012347 reader.skip(4)
12348 return obj
12349
12350 def __eq__(self, other):
12351 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070012352 if self.xid != other.xid: return False
12353 if self.flags != other.flags: return False
12354 return True
12355
Rich Lanec2ee4b82013-04-24 17:12:38 -070012356 def pretty_print(self, q):
12357 q.text("meter_features_stats_request {")
12358 with q.group():
12359 with q.indent(2):
12360 q.breakable()
12361 q.text("xid = ");
12362 if self.xid != None:
12363 q.text("%#x" % self.xid)
12364 else:
12365 q.text('None')
12366 q.text(","); q.breakable()
12367 q.text("flags = ");
12368 q.text("%#x" % self.flags)
12369 q.breakable()
12370 q.text('}')
12371
Rich Lane7dcdf022013-12-11 14:45:27 -080012372stats_request.subtypes[11] = meter_features_stats_request
12373
12374class meter_mod(message):
Dan Talaycof6202252013-07-02 01:00:29 -070012375 version = 4
12376 type = 29
Rich Lanec2ee4b82013-04-24 17:12:38 -070012377
12378 def __init__(self, xid=None, command=None, flags=None, meter_id=None, meters=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012379 if xid != None:
12380 self.xid = xid
12381 else:
12382 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070012383 if command != None:
12384 self.command = command
12385 else:
12386 self.command = 0
12387 if flags != None:
12388 self.flags = flags
12389 else:
12390 self.flags = 0
12391 if meter_id != None:
12392 self.meter_id = meter_id
12393 else:
12394 self.meter_id = 0
12395 if meters != None:
12396 self.meters = meters
12397 else:
12398 self.meters = []
Rich Lane7dcdf022013-12-11 14:45:27 -080012399 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070012400
12401 def pack(self):
12402 packed = []
12403 packed.append(struct.pack("!B", self.version))
12404 packed.append(struct.pack("!B", self.type))
12405 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12406 packed.append(struct.pack("!L", self.xid))
12407 packed.append(struct.pack("!H", self.command))
12408 packed.append(struct.pack("!H", self.flags))
12409 packed.append(struct.pack("!L", self.meter_id))
Rich Lane7dcdf022013-12-11 14:45:27 -080012410 packed.append(loxi.generic_util.pack_list(self.meters))
Rich Lanec2ee4b82013-04-24 17:12:38 -070012411 length = sum([len(x) for x in packed])
12412 packed[2] = struct.pack("!H", length)
12413 return ''.join(packed)
12414
12415 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012416 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070012417 obj = meter_mod()
Dan Talaycof6202252013-07-02 01:00:29 -070012418 _version = reader.read("!B")[0]
12419 assert(_version == 4)
12420 _type = reader.read("!B")[0]
12421 assert(_type == 29)
12422 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012423 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080012424 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070012425 obj.xid = reader.read("!L")[0]
12426 obj.command = reader.read("!H")[0]
12427 obj.flags = reader.read("!H")[0]
12428 obj.meter_id = reader.read("!L")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012429 obj.meters = loxi.generic_util.unpack_list(reader, meter_band.meter_band.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070012430 return obj
12431
12432 def __eq__(self, other):
12433 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070012434 if self.xid != other.xid: return False
12435 if self.command != other.command: return False
12436 if self.flags != other.flags: return False
12437 if self.meter_id != other.meter_id: return False
12438 if self.meters != other.meters: return False
12439 return True
12440
Rich Lanec2ee4b82013-04-24 17:12:38 -070012441 def pretty_print(self, q):
12442 q.text("meter_mod {")
12443 with q.group():
12444 with q.indent(2):
12445 q.breakable()
12446 q.text("xid = ");
12447 if self.xid != None:
12448 q.text("%#x" % self.xid)
12449 else:
12450 q.text('None')
12451 q.text(","); q.breakable()
12452 q.text("command = ");
12453 q.text("%#x" % self.command)
12454 q.text(","); q.breakable()
12455 q.text("flags = ");
12456 q.text("%#x" % self.flags)
12457 q.text(","); q.breakable()
12458 q.text("meter_id = ");
12459 q.text("%#x" % self.meter_id)
12460 q.text(","); q.breakable()
12461 q.text("meters = ");
12462 q.pp(self.meters)
12463 q.breakable()
12464 q.text('}')
12465
Rich Lane7dcdf022013-12-11 14:45:27 -080012466message.subtypes[29] = meter_mod
12467
12468class meter_mod_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -070012469 version = 4
12470 type = 1
12471 err_type = 12
12472
12473 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012474 if xid != None:
12475 self.xid = xid
12476 else:
12477 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -070012478 if code != None:
12479 self.code = code
12480 else:
12481 self.code = 0
12482 if data != None:
12483 self.data = data
12484 else:
12485 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080012486 return
Rich Lane6f4978c2013-10-20 21:33:52 -070012487
12488 def pack(self):
12489 packed = []
12490 packed.append(struct.pack("!B", self.version))
12491 packed.append(struct.pack("!B", self.type))
12492 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12493 packed.append(struct.pack("!L", self.xid))
12494 packed.append(struct.pack("!H", self.err_type))
12495 packed.append(struct.pack("!H", self.code))
12496 packed.append(self.data)
12497 length = sum([len(x) for x in packed])
12498 packed[2] = struct.pack("!H", length)
12499 return ''.join(packed)
12500
12501 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012502 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -070012503 obj = meter_mod_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -070012504 _version = reader.read("!B")[0]
12505 assert(_version == 4)
12506 _type = reader.read("!B")[0]
12507 assert(_type == 1)
12508 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012509 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080012510 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -070012511 obj.xid = reader.read("!L")[0]
12512 _err_type = reader.read("!H")[0]
12513 assert(_err_type == 12)
12514 obj.code = reader.read("!H")[0]
12515 obj.data = str(reader.read_all())
12516 return obj
12517
12518 def __eq__(self, other):
12519 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -070012520 if self.xid != other.xid: return False
12521 if self.code != other.code: return False
12522 if self.data != other.data: return False
12523 return True
12524
Rich Lane6f4978c2013-10-20 21:33:52 -070012525 def pretty_print(self, q):
12526 q.text("meter_mod_failed_error_msg {")
12527 with q.group():
12528 with q.indent(2):
12529 q.breakable()
12530 q.text("xid = ");
12531 if self.xid != None:
12532 q.text("%#x" % self.xid)
12533 else:
12534 q.text('None')
12535 q.text(","); q.breakable()
12536 q.text("code = ");
12537 q.text("%#x" % self.code)
12538 q.text(","); q.breakable()
12539 q.text("data = ");
12540 q.pp(self.data)
12541 q.breakable()
12542 q.text('}')
12543
Rich Lane7dcdf022013-12-11 14:45:27 -080012544error_msg.subtypes[12] = meter_mod_failed_error_msg
12545
12546class meter_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070012547 version = 4
12548 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070012549 stats_type = 9
12550
12551 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012552 if xid != None:
12553 self.xid = xid
12554 else:
12555 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070012556 if flags != None:
12557 self.flags = flags
12558 else:
12559 self.flags = 0
12560 if entries != None:
12561 self.entries = entries
12562 else:
12563 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -080012564 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070012565
12566 def pack(self):
12567 packed = []
12568 packed.append(struct.pack("!B", self.version))
12569 packed.append(struct.pack("!B", self.type))
12570 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12571 packed.append(struct.pack("!L", self.xid))
12572 packed.append(struct.pack("!H", self.stats_type))
12573 packed.append(struct.pack("!H", self.flags))
12574 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080012575 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -070012576 length = sum([len(x) for x in packed])
12577 packed[2] = struct.pack("!H", length)
12578 return ''.join(packed)
12579
12580 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012581 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070012582 obj = meter_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070012583 _version = reader.read("!B")[0]
12584 assert(_version == 4)
12585 _type = reader.read("!B")[0]
12586 assert(_type == 19)
12587 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012588 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080012589 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070012590 obj.xid = reader.read("!L")[0]
12591 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012592 assert(_stats_type == 9)
Dan Talaycof6202252013-07-02 01:00:29 -070012593 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012594 reader.skip(4)
Rich Lane7dcdf022013-12-11 14:45:27 -080012595 obj.entries = loxi.generic_util.unpack_list(reader, common.meter_stats.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070012596 return obj
12597
12598 def __eq__(self, other):
12599 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070012600 if self.xid != other.xid: return False
12601 if self.flags != other.flags: return False
12602 if self.entries != other.entries: return False
12603 return True
12604
Rich Lanec2ee4b82013-04-24 17:12:38 -070012605 def pretty_print(self, q):
12606 q.text("meter_stats_reply {")
12607 with q.group():
12608 with q.indent(2):
12609 q.breakable()
12610 q.text("xid = ");
12611 if self.xid != None:
12612 q.text("%#x" % self.xid)
12613 else:
12614 q.text('None')
12615 q.text(","); q.breakable()
12616 q.text("flags = ");
12617 q.text("%#x" % self.flags)
12618 q.text(","); q.breakable()
12619 q.text("entries = ");
12620 q.pp(self.entries)
12621 q.breakable()
12622 q.text('}')
12623
Rich Lane7dcdf022013-12-11 14:45:27 -080012624stats_reply.subtypes[9] = meter_stats_reply
12625
12626class meter_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070012627 version = 4
12628 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070012629 stats_type = 9
12630
12631 def __init__(self, xid=None, flags=None, meter_id=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012632 if xid != None:
12633 self.xid = xid
12634 else:
12635 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070012636 if flags != None:
12637 self.flags = flags
12638 else:
12639 self.flags = 0
12640 if meter_id != None:
12641 self.meter_id = meter_id
12642 else:
12643 self.meter_id = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080012644 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070012645
12646 def pack(self):
12647 packed = []
12648 packed.append(struct.pack("!B", self.version))
12649 packed.append(struct.pack("!B", self.type))
12650 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12651 packed.append(struct.pack("!L", self.xid))
12652 packed.append(struct.pack("!H", self.stats_type))
12653 packed.append(struct.pack("!H", self.flags))
12654 packed.append('\x00' * 4)
12655 packed.append(struct.pack("!L", self.meter_id))
12656 packed.append('\x00' * 4)
12657 length = sum([len(x) for x in packed])
12658 packed[2] = struct.pack("!H", length)
12659 return ''.join(packed)
12660
12661 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012662 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070012663 obj = meter_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070012664 _version = reader.read("!B")[0]
12665 assert(_version == 4)
12666 _type = reader.read("!B")[0]
12667 assert(_type == 18)
12668 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012669 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080012670 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070012671 obj.xid = reader.read("!L")[0]
12672 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012673 assert(_stats_type == 9)
Dan Talaycof6202252013-07-02 01:00:29 -070012674 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012675 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -070012676 obj.meter_id = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012677 reader.skip(4)
12678 return obj
12679
12680 def __eq__(self, other):
12681 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070012682 if self.xid != other.xid: return False
12683 if self.flags != other.flags: return False
12684 if self.meter_id != other.meter_id: return False
12685 return True
12686
Rich Lanec2ee4b82013-04-24 17:12:38 -070012687 def pretty_print(self, q):
12688 q.text("meter_stats_request {")
12689 with q.group():
12690 with q.indent(2):
12691 q.breakable()
12692 q.text("xid = ");
12693 if self.xid != None:
12694 q.text("%#x" % self.xid)
12695 else:
12696 q.text('None')
12697 q.text(","); q.breakable()
12698 q.text("flags = ");
12699 q.text("%#x" % self.flags)
12700 q.text(","); q.breakable()
12701 q.text("meter_id = ");
12702 q.text("%#x" % self.meter_id)
12703 q.breakable()
12704 q.text('}')
12705
Rich Lane7dcdf022013-12-11 14:45:27 -080012706stats_request.subtypes[9] = meter_stats_request
12707
12708class nicira_header(experimenter):
12709 subtypes = {}
12710
Rich Lane95f7fc92014-01-27 17:08:16 -080012711 version = 4
12712 type = 4
12713 experimenter = 8992
12714
12715 def __init__(self, xid=None, subtype=None):
12716 if xid != None:
12717 self.xid = xid
12718 else:
12719 self.xid = None
12720 if subtype != None:
12721 self.subtype = subtype
12722 else:
12723 self.subtype = 0
12724 return
12725
12726 def pack(self):
12727 packed = []
12728 packed.append(struct.pack("!B", self.version))
12729 packed.append(struct.pack("!B", self.type))
12730 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12731 packed.append(struct.pack("!L", self.xid))
12732 packed.append(struct.pack("!L", self.experimenter))
12733 packed.append(struct.pack("!L", self.subtype))
12734 length = sum([len(x) for x in packed])
12735 packed[2] = struct.pack("!H", length)
12736 return ''.join(packed)
12737
Rich Lane7dcdf022013-12-11 14:45:27 -080012738 @staticmethod
12739 def unpack(reader):
12740 subtype, = reader.peek('!L', 12)
Rich Lane95f7fc92014-01-27 17:08:16 -080012741 subclass = nicira_header.subtypes.get(subtype)
12742 if subclass:
12743 return subclass.unpack(reader)
12744
12745 obj = nicira_header()
12746 _version = reader.read("!B")[0]
12747 assert(_version == 4)
12748 _type = reader.read("!B")[0]
12749 assert(_type == 4)
12750 _length = reader.read("!H")[0]
12751 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080012752 reader = orig_reader.slice(_length, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -080012753 obj.xid = reader.read("!L")[0]
12754 _experimenter = reader.read("!L")[0]
12755 assert(_experimenter == 8992)
12756 obj.subtype = reader.read("!L")[0]
12757 return obj
12758
12759 def __eq__(self, other):
12760 if type(self) != type(other): return False
12761 if self.xid != other.xid: return False
12762 if self.subtype != other.subtype: return False
12763 return True
12764
12765 def pretty_print(self, q):
12766 q.text("nicira_header {")
12767 with q.group():
12768 with q.indent(2):
12769 q.breakable()
12770 q.text("xid = ");
12771 if self.xid != None:
12772 q.text("%#x" % self.xid)
12773 else:
12774 q.text('None')
12775 q.breakable()
12776 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -080012777
12778experimenter.subtypes[8992] = nicira_header
12779
12780class packet_in(message):
Dan Talaycof6202252013-07-02 01:00:29 -070012781 version = 4
12782 type = 10
Rich Lanec2ee4b82013-04-24 17:12:38 -070012783
12784 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 -080012785 if xid != None:
12786 self.xid = xid
12787 else:
12788 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070012789 if buffer_id != None:
12790 self.buffer_id = buffer_id
12791 else:
12792 self.buffer_id = 0
12793 if total_len != None:
12794 self.total_len = total_len
12795 else:
12796 self.total_len = 0
12797 if reason != None:
12798 self.reason = reason
12799 else:
12800 self.reason = 0
12801 if table_id != None:
12802 self.table_id = table_id
12803 else:
12804 self.table_id = 0
12805 if cookie != None:
12806 self.cookie = cookie
12807 else:
12808 self.cookie = 0
12809 if match != None:
12810 self.match = match
12811 else:
12812 self.match = common.match()
12813 if data != None:
12814 self.data = data
12815 else:
Dan Talaycof6202252013-07-02 01:00:29 -070012816 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080012817 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070012818
12819 def pack(self):
12820 packed = []
12821 packed.append(struct.pack("!B", self.version))
12822 packed.append(struct.pack("!B", self.type))
12823 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12824 packed.append(struct.pack("!L", self.xid))
12825 packed.append(struct.pack("!L", self.buffer_id))
12826 packed.append(struct.pack("!H", self.total_len))
12827 packed.append(struct.pack("!B", self.reason))
12828 packed.append(struct.pack("!B", self.table_id))
12829 packed.append(struct.pack("!Q", self.cookie))
12830 packed.append(self.match.pack())
12831 packed.append('\x00' * 2)
12832 packed.append(self.data)
12833 length = sum([len(x) for x in packed])
12834 packed[2] = struct.pack("!H", length)
12835 return ''.join(packed)
12836
12837 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012838 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070012839 obj = packet_in()
Dan Talaycof6202252013-07-02 01:00:29 -070012840 _version = reader.read("!B")[0]
12841 assert(_version == 4)
12842 _type = reader.read("!B")[0]
12843 assert(_type == 10)
12844 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012845 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080012846 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070012847 obj.xid = reader.read("!L")[0]
12848 obj.buffer_id = reader.read("!L")[0]
12849 obj.total_len = reader.read("!H")[0]
12850 obj.reason = reader.read("!B")[0]
12851 obj.table_id = reader.read("!B")[0]
12852 obj.cookie = reader.read("!Q")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012853 obj.match = common.match.unpack(reader)
12854 reader.skip(2)
12855 obj.data = str(reader.read_all())
12856 return obj
12857
12858 def __eq__(self, other):
12859 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070012860 if self.xid != other.xid: return False
12861 if self.buffer_id != other.buffer_id: return False
12862 if self.total_len != other.total_len: return False
12863 if self.reason != other.reason: return False
12864 if self.table_id != other.table_id: return False
12865 if self.cookie != other.cookie: return False
12866 if self.match != other.match: return False
12867 if self.data != other.data: return False
12868 return True
12869
Rich Lanec2ee4b82013-04-24 17:12:38 -070012870 def pretty_print(self, q):
12871 q.text("packet_in {")
12872 with q.group():
12873 with q.indent(2):
12874 q.breakable()
12875 q.text("xid = ");
12876 if self.xid != None:
12877 q.text("%#x" % self.xid)
12878 else:
12879 q.text('None')
12880 q.text(","); q.breakable()
12881 q.text("buffer_id = ");
12882 q.text("%#x" % self.buffer_id)
12883 q.text(","); q.breakable()
12884 q.text("total_len = ");
12885 q.text("%#x" % self.total_len)
12886 q.text(","); q.breakable()
12887 q.text("reason = ");
12888 q.text("%#x" % self.reason)
12889 q.text(","); q.breakable()
12890 q.text("table_id = ");
12891 q.text("%#x" % self.table_id)
12892 q.text(","); q.breakable()
12893 q.text("cookie = ");
12894 q.text("%#x" % self.cookie)
12895 q.text(","); q.breakable()
12896 q.text("match = ");
12897 q.pp(self.match)
12898 q.text(","); q.breakable()
12899 q.text("data = ");
12900 q.pp(self.data)
12901 q.breakable()
12902 q.text('}')
12903
Rich Lane7dcdf022013-12-11 14:45:27 -080012904message.subtypes[10] = packet_in
12905
12906class packet_out(message):
Dan Talaycof6202252013-07-02 01:00:29 -070012907 version = 4
12908 type = 13
Rich Lanec2ee4b82013-04-24 17:12:38 -070012909
12910 def __init__(self, xid=None, buffer_id=None, in_port=None, actions=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012911 if xid != None:
12912 self.xid = xid
12913 else:
12914 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070012915 if buffer_id != None:
12916 self.buffer_id = buffer_id
12917 else:
12918 self.buffer_id = 0
12919 if in_port != None:
12920 self.in_port = in_port
12921 else:
12922 self.in_port = 0
12923 if actions != None:
12924 self.actions = actions
12925 else:
12926 self.actions = []
12927 if data != None:
12928 self.data = data
12929 else:
Dan Talaycof6202252013-07-02 01:00:29 -070012930 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080012931 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070012932
12933 def pack(self):
12934 packed = []
12935 packed.append(struct.pack("!B", self.version))
12936 packed.append(struct.pack("!B", self.type))
12937 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12938 packed.append(struct.pack("!L", self.xid))
12939 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -070012940 packed.append(util.pack_port_no(self.in_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -070012941 packed.append(struct.pack("!H", 0)) # placeholder for actions_len at index 6
12942 packed.append('\x00' * 6)
Rich Lane7dcdf022013-12-11 14:45:27 -080012943 packed.append(loxi.generic_util.pack_list(self.actions))
Rich Lanec2ee4b82013-04-24 17:12:38 -070012944 packed[6] = struct.pack("!H", len(packed[-1]))
12945 packed.append(self.data)
12946 length = sum([len(x) for x in packed])
12947 packed[2] = struct.pack("!H", length)
12948 return ''.join(packed)
12949
12950 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012951 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070012952 obj = packet_out()
Dan Talaycof6202252013-07-02 01:00:29 -070012953 _version = reader.read("!B")[0]
12954 assert(_version == 4)
12955 _type = reader.read("!B")[0]
12956 assert(_type == 13)
12957 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012958 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080012959 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070012960 obj.xid = reader.read("!L")[0]
12961 obj.buffer_id = reader.read("!L")[0]
12962 obj.in_port = util.unpack_port_no(reader)
12963 _actions_len = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012964 reader.skip(6)
Rich Lane7dcdf022013-12-11 14:45:27 -080012965 obj.actions = loxi.generic_util.unpack_list(reader.slice(_actions_len), action.action.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070012966 obj.data = str(reader.read_all())
12967 return obj
12968
12969 def __eq__(self, other):
12970 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070012971 if self.xid != other.xid: return False
12972 if self.buffer_id != other.buffer_id: return False
12973 if self.in_port != other.in_port: return False
12974 if self.actions != other.actions: return False
12975 if self.data != other.data: return False
12976 return True
12977
Rich Lanec2ee4b82013-04-24 17:12:38 -070012978 def pretty_print(self, q):
12979 q.text("packet_out {")
12980 with q.group():
12981 with q.indent(2):
12982 q.breakable()
12983 q.text("xid = ");
12984 if self.xid != None:
12985 q.text("%#x" % self.xid)
12986 else:
12987 q.text('None')
12988 q.text(","); q.breakable()
12989 q.text("buffer_id = ");
12990 q.text("%#x" % self.buffer_id)
12991 q.text(","); q.breakable()
12992 q.text("in_port = ");
12993 q.text(util.pretty_port(self.in_port))
12994 q.text(","); q.breakable()
12995 q.text("actions = ");
12996 q.pp(self.actions)
12997 q.text(","); q.breakable()
12998 q.text("data = ");
12999 q.pp(self.data)
13000 q.breakable()
13001 q.text('}')
13002
Rich Lane7dcdf022013-12-11 14:45:27 -080013003message.subtypes[13] = packet_out
13004
13005class port_desc_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070013006 version = 4
13007 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070013008 stats_type = 13
13009
13010 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080013011 if xid != None:
13012 self.xid = xid
13013 else:
13014 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070013015 if flags != None:
13016 self.flags = flags
13017 else:
13018 self.flags = 0
13019 if entries != None:
13020 self.entries = entries
13021 else:
13022 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -080013023 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070013024
13025 def pack(self):
13026 packed = []
13027 packed.append(struct.pack("!B", self.version))
13028 packed.append(struct.pack("!B", self.type))
13029 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13030 packed.append(struct.pack("!L", self.xid))
13031 packed.append(struct.pack("!H", self.stats_type))
13032 packed.append(struct.pack("!H", self.flags))
13033 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080013034 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -070013035 length = sum([len(x) for x in packed])
13036 packed[2] = struct.pack("!H", length)
13037 return ''.join(packed)
13038
13039 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080013040 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070013041 obj = port_desc_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070013042 _version = reader.read("!B")[0]
13043 assert(_version == 4)
13044 _type = reader.read("!B")[0]
13045 assert(_type == 19)
13046 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080013047 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080013048 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070013049 obj.xid = reader.read("!L")[0]
13050 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013051 assert(_stats_type == 13)
Dan Talaycof6202252013-07-02 01:00:29 -070013052 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013053 reader.skip(4)
13054 obj.entries = loxi.generic_util.unpack_list(reader, common.port_desc.unpack)
13055 return obj
13056
13057 def __eq__(self, other):
13058 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070013059 if self.xid != other.xid: return False
13060 if self.flags != other.flags: return False
13061 if self.entries != other.entries: return False
13062 return True
13063
Rich Lanec2ee4b82013-04-24 17:12:38 -070013064 def pretty_print(self, q):
13065 q.text("port_desc_stats_reply {")
13066 with q.group():
13067 with q.indent(2):
13068 q.breakable()
13069 q.text("xid = ");
13070 if self.xid != None:
13071 q.text("%#x" % self.xid)
13072 else:
13073 q.text('None')
13074 q.text(","); q.breakable()
13075 q.text("flags = ");
13076 q.text("%#x" % self.flags)
13077 q.text(","); q.breakable()
13078 q.text("entries = ");
13079 q.pp(self.entries)
13080 q.breakable()
13081 q.text('}')
13082
Rich Lane7dcdf022013-12-11 14:45:27 -080013083stats_reply.subtypes[13] = port_desc_stats_reply
13084
13085class port_desc_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070013086 version = 4
13087 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070013088 stats_type = 13
13089
13090 def __init__(self, xid=None, flags=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080013091 if xid != None:
13092 self.xid = xid
13093 else:
13094 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070013095 if flags != None:
13096 self.flags = flags
13097 else:
13098 self.flags = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080013099 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070013100
13101 def pack(self):
13102 packed = []
13103 packed.append(struct.pack("!B", self.version))
13104 packed.append(struct.pack("!B", self.type))
13105 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13106 packed.append(struct.pack("!L", self.xid))
13107 packed.append(struct.pack("!H", self.stats_type))
13108 packed.append(struct.pack("!H", self.flags))
13109 packed.append('\x00' * 4)
13110 length = sum([len(x) for x in packed])
13111 packed[2] = struct.pack("!H", length)
13112 return ''.join(packed)
13113
13114 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080013115 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070013116 obj = port_desc_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070013117 _version = reader.read("!B")[0]
13118 assert(_version == 4)
13119 _type = reader.read("!B")[0]
13120 assert(_type == 18)
13121 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080013122 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080013123 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070013124 obj.xid = reader.read("!L")[0]
13125 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013126 assert(_stats_type == 13)
Dan Talaycof6202252013-07-02 01:00:29 -070013127 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013128 reader.skip(4)
13129 return obj
13130
13131 def __eq__(self, other):
13132 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070013133 if self.xid != other.xid: return False
13134 if self.flags != other.flags: return False
13135 return True
13136
Rich Lanec2ee4b82013-04-24 17:12:38 -070013137 def pretty_print(self, q):
13138 q.text("port_desc_stats_request {")
13139 with q.group():
13140 with q.indent(2):
13141 q.breakable()
13142 q.text("xid = ");
13143 if self.xid != None:
13144 q.text("%#x" % self.xid)
13145 else:
13146 q.text('None')
13147 q.text(","); q.breakable()
13148 q.text("flags = ");
13149 q.text("%#x" % self.flags)
13150 q.breakable()
13151 q.text('}')
13152
Rich Lane7dcdf022013-12-11 14:45:27 -080013153stats_request.subtypes[13] = port_desc_stats_request
13154
13155class port_mod(message):
Dan Talaycof6202252013-07-02 01:00:29 -070013156 version = 4
13157 type = 16
Rich Lanec2ee4b82013-04-24 17:12:38 -070013158
13159 def __init__(self, xid=None, port_no=None, hw_addr=None, config=None, mask=None, advertise=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080013160 if xid != None:
13161 self.xid = xid
13162 else:
13163 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070013164 if port_no != None:
13165 self.port_no = port_no
13166 else:
13167 self.port_no = 0
13168 if hw_addr != None:
13169 self.hw_addr = hw_addr
13170 else:
13171 self.hw_addr = [0,0,0,0,0,0]
13172 if config != None:
13173 self.config = config
13174 else:
13175 self.config = 0
13176 if mask != None:
13177 self.mask = mask
13178 else:
13179 self.mask = 0
13180 if advertise != None:
13181 self.advertise = advertise
13182 else:
13183 self.advertise = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080013184 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070013185
13186 def pack(self):
13187 packed = []
13188 packed.append(struct.pack("!B", self.version))
13189 packed.append(struct.pack("!B", self.type))
13190 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13191 packed.append(struct.pack("!L", self.xid))
Dan Talaycof6202252013-07-02 01:00:29 -070013192 packed.append(util.pack_port_no(self.port_no))
Rich Lanec2ee4b82013-04-24 17:12:38 -070013193 packed.append('\x00' * 4)
13194 packed.append(struct.pack("!6B", *self.hw_addr))
13195 packed.append('\x00' * 2)
13196 packed.append(struct.pack("!L", self.config))
13197 packed.append(struct.pack("!L", self.mask))
13198 packed.append(struct.pack("!L", self.advertise))
13199 packed.append('\x00' * 4)
13200 length = sum([len(x) for x in packed])
13201 packed[2] = struct.pack("!H", length)
13202 return ''.join(packed)
13203
13204 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080013205 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070013206 obj = port_mod()
Dan Talaycof6202252013-07-02 01:00:29 -070013207 _version = reader.read("!B")[0]
13208 assert(_version == 4)
13209 _type = reader.read("!B")[0]
13210 assert(_type == 16)
13211 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080013212 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080013213 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070013214 obj.xid = reader.read("!L")[0]
13215 obj.port_no = util.unpack_port_no(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -070013216 reader.skip(4)
13217 obj.hw_addr = list(reader.read('!6B'))
13218 reader.skip(2)
Dan Talaycof6202252013-07-02 01:00:29 -070013219 obj.config = reader.read("!L")[0]
13220 obj.mask = reader.read("!L")[0]
13221 obj.advertise = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013222 reader.skip(4)
13223 return obj
13224
13225 def __eq__(self, other):
13226 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070013227 if self.xid != other.xid: return False
13228 if self.port_no != other.port_no: return False
13229 if self.hw_addr != other.hw_addr: return False
13230 if self.config != other.config: return False
13231 if self.mask != other.mask: return False
13232 if self.advertise != other.advertise: return False
13233 return True
13234
Rich Lanec2ee4b82013-04-24 17:12:38 -070013235 def pretty_print(self, q):
13236 q.text("port_mod {")
13237 with q.group():
13238 with q.indent(2):
13239 q.breakable()
13240 q.text("xid = ");
13241 if self.xid != None:
13242 q.text("%#x" % self.xid)
13243 else:
13244 q.text('None')
13245 q.text(","); q.breakable()
13246 q.text("port_no = ");
13247 q.text(util.pretty_port(self.port_no))
13248 q.text(","); q.breakable()
13249 q.text("hw_addr = ");
13250 q.text(util.pretty_mac(self.hw_addr))
13251 q.text(","); q.breakable()
13252 q.text("config = ");
13253 q.text("%#x" % self.config)
13254 q.text(","); q.breakable()
13255 q.text("mask = ");
13256 q.text("%#x" % self.mask)
13257 q.text(","); q.breakable()
13258 q.text("advertise = ");
13259 q.text("%#x" % self.advertise)
13260 q.breakable()
13261 q.text('}')
13262
Rich Lane7dcdf022013-12-11 14:45:27 -080013263message.subtypes[16] = port_mod
13264
13265class port_mod_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -070013266 version = 4
13267 type = 1
13268 err_type = 7
13269
13270 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080013271 if xid != None:
13272 self.xid = xid
13273 else:
13274 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -070013275 if code != None:
13276 self.code = code
13277 else:
13278 self.code = 0
13279 if data != None:
13280 self.data = data
13281 else:
13282 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080013283 return
Rich Lane6f4978c2013-10-20 21:33:52 -070013284
13285 def pack(self):
13286 packed = []
13287 packed.append(struct.pack("!B", self.version))
13288 packed.append(struct.pack("!B", self.type))
13289 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13290 packed.append(struct.pack("!L", self.xid))
13291 packed.append(struct.pack("!H", self.err_type))
13292 packed.append(struct.pack("!H", self.code))
13293 packed.append(self.data)
13294 length = sum([len(x) for x in packed])
13295 packed[2] = struct.pack("!H", length)
13296 return ''.join(packed)
13297
13298 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080013299 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -070013300 obj = port_mod_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -070013301 _version = reader.read("!B")[0]
13302 assert(_version == 4)
13303 _type = reader.read("!B")[0]
13304 assert(_type == 1)
13305 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080013306 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080013307 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -070013308 obj.xid = reader.read("!L")[0]
13309 _err_type = reader.read("!H")[0]
13310 assert(_err_type == 7)
13311 obj.code = reader.read("!H")[0]
13312 obj.data = str(reader.read_all())
13313 return obj
13314
13315 def __eq__(self, other):
13316 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -070013317 if self.xid != other.xid: return False
13318 if self.code != other.code: return False
13319 if self.data != other.data: return False
13320 return True
13321
Rich Lane6f4978c2013-10-20 21:33:52 -070013322 def pretty_print(self, q):
13323 q.text("port_mod_failed_error_msg {")
13324 with q.group():
13325 with q.indent(2):
13326 q.breakable()
13327 q.text("xid = ");
13328 if self.xid != None:
13329 q.text("%#x" % self.xid)
13330 else:
13331 q.text('None')
13332 q.text(","); q.breakable()
13333 q.text("code = ");
13334 q.text("%#x" % self.code)
13335 q.text(","); q.breakable()
13336 q.text("data = ");
13337 q.pp(self.data)
13338 q.breakable()
13339 q.text('}')
13340
Rich Lane7dcdf022013-12-11 14:45:27 -080013341error_msg.subtypes[7] = port_mod_failed_error_msg
13342
13343class port_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070013344 version = 4
13345 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070013346 stats_type = 4
13347
13348 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080013349 if xid != None:
13350 self.xid = xid
13351 else:
13352 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070013353 if flags != None:
13354 self.flags = flags
13355 else:
13356 self.flags = 0
13357 if entries != None:
13358 self.entries = entries
13359 else:
13360 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -080013361 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070013362
13363 def pack(self):
13364 packed = []
13365 packed.append(struct.pack("!B", self.version))
13366 packed.append(struct.pack("!B", self.type))
13367 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13368 packed.append(struct.pack("!L", self.xid))
13369 packed.append(struct.pack("!H", self.stats_type))
13370 packed.append(struct.pack("!H", self.flags))
13371 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080013372 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -070013373 length = sum([len(x) for x in packed])
13374 packed[2] = struct.pack("!H", length)
13375 return ''.join(packed)
13376
13377 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080013378 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070013379 obj = port_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070013380 _version = reader.read("!B")[0]
13381 assert(_version == 4)
13382 _type = reader.read("!B")[0]
13383 assert(_type == 19)
13384 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080013385 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080013386 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070013387 obj.xid = reader.read("!L")[0]
13388 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013389 assert(_stats_type == 4)
Dan Talaycof6202252013-07-02 01:00:29 -070013390 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013391 reader.skip(4)
13392 obj.entries = loxi.generic_util.unpack_list(reader, common.port_stats_entry.unpack)
13393 return obj
13394
13395 def __eq__(self, other):
13396 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070013397 if self.xid != other.xid: return False
13398 if self.flags != other.flags: return False
13399 if self.entries != other.entries: return False
13400 return True
13401
Rich Lanec2ee4b82013-04-24 17:12:38 -070013402 def pretty_print(self, q):
13403 q.text("port_stats_reply {")
13404 with q.group():
13405 with q.indent(2):
13406 q.breakable()
13407 q.text("xid = ");
13408 if self.xid != None:
13409 q.text("%#x" % self.xid)
13410 else:
13411 q.text('None')
13412 q.text(","); q.breakable()
13413 q.text("flags = ");
13414 q.text("%#x" % self.flags)
13415 q.text(","); q.breakable()
13416 q.text("entries = ");
13417 q.pp(self.entries)
13418 q.breakable()
13419 q.text('}')
13420
Rich Lane7dcdf022013-12-11 14:45:27 -080013421stats_reply.subtypes[4] = port_stats_reply
13422
13423class port_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070013424 version = 4
13425 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070013426 stats_type = 4
13427
13428 def __init__(self, xid=None, flags=None, port_no=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080013429 if xid != None:
13430 self.xid = xid
13431 else:
13432 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070013433 if flags != None:
13434 self.flags = flags
13435 else:
13436 self.flags = 0
13437 if port_no != None:
13438 self.port_no = port_no
13439 else:
13440 self.port_no = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080013441 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070013442
13443 def pack(self):
13444 packed = []
13445 packed.append(struct.pack("!B", self.version))
13446 packed.append(struct.pack("!B", self.type))
13447 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13448 packed.append(struct.pack("!L", self.xid))
13449 packed.append(struct.pack("!H", self.stats_type))
13450 packed.append(struct.pack("!H", self.flags))
13451 packed.append('\x00' * 4)
Dan Talaycof6202252013-07-02 01:00:29 -070013452 packed.append(util.pack_port_no(self.port_no))
Rich Lanec2ee4b82013-04-24 17:12:38 -070013453 packed.append('\x00' * 4)
13454 length = sum([len(x) for x in packed])
13455 packed[2] = struct.pack("!H", length)
13456 return ''.join(packed)
13457
13458 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080013459 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070013460 obj = port_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070013461 _version = reader.read("!B")[0]
13462 assert(_version == 4)
13463 _type = reader.read("!B")[0]
13464 assert(_type == 18)
13465 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080013466 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080013467 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070013468 obj.xid = reader.read("!L")[0]
13469 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013470 assert(_stats_type == 4)
Dan Talaycof6202252013-07-02 01:00:29 -070013471 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013472 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -070013473 obj.port_no = util.unpack_port_no(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -070013474 reader.skip(4)
13475 return obj
13476
13477 def __eq__(self, other):
13478 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070013479 if self.xid != other.xid: return False
13480 if self.flags != other.flags: return False
13481 if self.port_no != other.port_no: return False
13482 return True
13483
Rich Lanec2ee4b82013-04-24 17:12:38 -070013484 def pretty_print(self, q):
13485 q.text("port_stats_request {")
13486 with q.group():
13487 with q.indent(2):
13488 q.breakable()
13489 q.text("xid = ");
13490 if self.xid != None:
13491 q.text("%#x" % self.xid)
13492 else:
13493 q.text('None')
13494 q.text(","); q.breakable()
13495 q.text("flags = ");
13496 q.text("%#x" % self.flags)
13497 q.text(","); q.breakable()
13498 q.text("port_no = ");
13499 q.text(util.pretty_port(self.port_no))
13500 q.breakable()
13501 q.text('}')
13502
Rich Lane7dcdf022013-12-11 14:45:27 -080013503stats_request.subtypes[4] = port_stats_request
13504
13505class port_status(message):
Dan Talaycof6202252013-07-02 01:00:29 -070013506 version = 4
13507 type = 12
Rich Lanec2ee4b82013-04-24 17:12:38 -070013508
13509 def __init__(self, xid=None, reason=None, desc=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080013510 if xid != None:
13511 self.xid = xid
13512 else:
13513 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070013514 if reason != None:
13515 self.reason = reason
13516 else:
13517 self.reason = 0
13518 if desc != None:
13519 self.desc = desc
13520 else:
13521 self.desc = common.port_desc()
Rich Lane7dcdf022013-12-11 14:45:27 -080013522 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070013523
13524 def pack(self):
13525 packed = []
13526 packed.append(struct.pack("!B", self.version))
13527 packed.append(struct.pack("!B", self.type))
13528 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13529 packed.append(struct.pack("!L", self.xid))
13530 packed.append(struct.pack("!B", self.reason))
13531 packed.append('\x00' * 7)
13532 packed.append(self.desc.pack())
13533 length = sum([len(x) for x in packed])
13534 packed[2] = struct.pack("!H", length)
13535 return ''.join(packed)
13536
13537 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080013538 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070013539 obj = port_status()
Dan Talaycof6202252013-07-02 01:00:29 -070013540 _version = reader.read("!B")[0]
13541 assert(_version == 4)
13542 _type = reader.read("!B")[0]
13543 assert(_type == 12)
13544 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080013545 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080013546 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070013547 obj.xid = reader.read("!L")[0]
13548 obj.reason = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013549 reader.skip(7)
13550 obj.desc = common.port_desc.unpack(reader)
13551 return obj
13552
13553 def __eq__(self, other):
13554 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070013555 if self.xid != other.xid: return False
13556 if self.reason != other.reason: return False
13557 if self.desc != other.desc: return False
13558 return True
13559
Rich Lanec2ee4b82013-04-24 17:12:38 -070013560 def pretty_print(self, q):
13561 q.text("port_status {")
13562 with q.group():
13563 with q.indent(2):
13564 q.breakable()
13565 q.text("xid = ");
13566 if self.xid != None:
13567 q.text("%#x" % self.xid)
13568 else:
13569 q.text('None')
13570 q.text(","); q.breakable()
13571 q.text("reason = ");
13572 q.text("%#x" % self.reason)
13573 q.text(","); q.breakable()
13574 q.text("desc = ");
13575 q.pp(self.desc)
13576 q.breakable()
13577 q.text('}')
13578
Rich Lane7dcdf022013-12-11 14:45:27 -080013579message.subtypes[12] = port_status
13580
13581class queue_get_config_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -070013582 version = 4
13583 type = 23
Rich Lanec2ee4b82013-04-24 17:12:38 -070013584
13585 def __init__(self, xid=None, port=None, queues=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080013586 if xid != None:
13587 self.xid = xid
13588 else:
13589 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070013590 if port != None:
13591 self.port = port
13592 else:
13593 self.port = 0
13594 if queues != None:
13595 self.queues = queues
13596 else:
13597 self.queues = []
Rich Lane7dcdf022013-12-11 14:45:27 -080013598 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070013599
13600 def pack(self):
13601 packed = []
13602 packed.append(struct.pack("!B", self.version))
13603 packed.append(struct.pack("!B", self.type))
13604 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13605 packed.append(struct.pack("!L", self.xid))
Dan Talaycof6202252013-07-02 01:00:29 -070013606 packed.append(util.pack_port_no(self.port))
Rich Lanec2ee4b82013-04-24 17:12:38 -070013607 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080013608 packed.append(loxi.generic_util.pack_list(self.queues))
Rich Lanec2ee4b82013-04-24 17:12:38 -070013609 length = sum([len(x) for x in packed])
13610 packed[2] = struct.pack("!H", length)
13611 return ''.join(packed)
13612
13613 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080013614 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070013615 obj = queue_get_config_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070013616 _version = reader.read("!B")[0]
13617 assert(_version == 4)
13618 _type = reader.read("!B")[0]
13619 assert(_type == 23)
13620 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080013621 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080013622 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070013623 obj.xid = reader.read("!L")[0]
13624 obj.port = util.unpack_port_no(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -070013625 reader.skip(4)
Rich Lane7dcdf022013-12-11 14:45:27 -080013626 obj.queues = loxi.generic_util.unpack_list(reader, common.packet_queue.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070013627 return obj
13628
13629 def __eq__(self, other):
13630 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070013631 if self.xid != other.xid: return False
13632 if self.port != other.port: return False
13633 if self.queues != other.queues: return False
13634 return True
13635
Rich Lanec2ee4b82013-04-24 17:12:38 -070013636 def pretty_print(self, q):
13637 q.text("queue_get_config_reply {")
13638 with q.group():
13639 with q.indent(2):
13640 q.breakable()
13641 q.text("xid = ");
13642 if self.xid != None:
13643 q.text("%#x" % self.xid)
13644 else:
13645 q.text('None')
13646 q.text(","); q.breakable()
13647 q.text("port = ");
13648 q.text(util.pretty_port(self.port))
13649 q.text(","); q.breakable()
13650 q.text("queues = ");
13651 q.pp(self.queues)
13652 q.breakable()
13653 q.text('}')
13654
Rich Lane7dcdf022013-12-11 14:45:27 -080013655message.subtypes[23] = queue_get_config_reply
13656
13657class queue_get_config_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -070013658 version = 4
13659 type = 22
Rich Lanec2ee4b82013-04-24 17:12:38 -070013660
13661 def __init__(self, xid=None, port=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080013662 if xid != None:
13663 self.xid = xid
13664 else:
13665 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070013666 if port != None:
13667 self.port = port
13668 else:
13669 self.port = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080013670 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070013671
13672 def pack(self):
13673 packed = []
13674 packed.append(struct.pack("!B", self.version))
13675 packed.append(struct.pack("!B", self.type))
13676 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13677 packed.append(struct.pack("!L", self.xid))
Dan Talaycof6202252013-07-02 01:00:29 -070013678 packed.append(util.pack_port_no(self.port))
Rich Lanec2ee4b82013-04-24 17:12:38 -070013679 packed.append('\x00' * 4)
13680 length = sum([len(x) for x in packed])
13681 packed[2] = struct.pack("!H", length)
13682 return ''.join(packed)
13683
13684 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080013685 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070013686 obj = queue_get_config_request()
Dan Talaycof6202252013-07-02 01:00:29 -070013687 _version = reader.read("!B")[0]
13688 assert(_version == 4)
13689 _type = reader.read("!B")[0]
13690 assert(_type == 22)
13691 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080013692 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080013693 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070013694 obj.xid = reader.read("!L")[0]
13695 obj.port = util.unpack_port_no(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -070013696 reader.skip(4)
13697 return obj
13698
13699 def __eq__(self, other):
13700 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070013701 if self.xid != other.xid: return False
13702 if self.port != other.port: return False
13703 return True
13704
Rich Lanec2ee4b82013-04-24 17:12:38 -070013705 def pretty_print(self, q):
13706 q.text("queue_get_config_request {")
13707 with q.group():
13708 with q.indent(2):
13709 q.breakable()
13710 q.text("xid = ");
13711 if self.xid != None:
13712 q.text("%#x" % self.xid)
13713 else:
13714 q.text('None')
13715 q.text(","); q.breakable()
13716 q.text("port = ");
13717 q.text(util.pretty_port(self.port))
13718 q.breakable()
13719 q.text('}')
13720
Rich Lane7dcdf022013-12-11 14:45:27 -080013721message.subtypes[22] = queue_get_config_request
13722
13723class queue_op_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -070013724 version = 4
13725 type = 1
13726 err_type = 9
13727
13728 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080013729 if xid != None:
13730 self.xid = xid
13731 else:
13732 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -070013733 if code != None:
13734 self.code = code
13735 else:
13736 self.code = 0
13737 if data != None:
13738 self.data = data
13739 else:
13740 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080013741 return
Rich Lane6f4978c2013-10-20 21:33:52 -070013742
13743 def pack(self):
13744 packed = []
13745 packed.append(struct.pack("!B", self.version))
13746 packed.append(struct.pack("!B", self.type))
13747 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13748 packed.append(struct.pack("!L", self.xid))
13749 packed.append(struct.pack("!H", self.err_type))
13750 packed.append(struct.pack("!H", self.code))
13751 packed.append(self.data)
13752 length = sum([len(x) for x in packed])
13753 packed[2] = struct.pack("!H", length)
13754 return ''.join(packed)
13755
13756 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080013757 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -070013758 obj = queue_op_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -070013759 _version = reader.read("!B")[0]
13760 assert(_version == 4)
13761 _type = reader.read("!B")[0]
13762 assert(_type == 1)
13763 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080013764 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080013765 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -070013766 obj.xid = reader.read("!L")[0]
13767 _err_type = reader.read("!H")[0]
13768 assert(_err_type == 9)
13769 obj.code = reader.read("!H")[0]
13770 obj.data = str(reader.read_all())
13771 return obj
13772
13773 def __eq__(self, other):
13774 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -070013775 if self.xid != other.xid: return False
13776 if self.code != other.code: return False
13777 if self.data != other.data: return False
13778 return True
13779
Rich Lane6f4978c2013-10-20 21:33:52 -070013780 def pretty_print(self, q):
13781 q.text("queue_op_failed_error_msg {")
13782 with q.group():
13783 with q.indent(2):
13784 q.breakable()
13785 q.text("xid = ");
13786 if self.xid != None:
13787 q.text("%#x" % self.xid)
13788 else:
13789 q.text('None')
13790 q.text(","); q.breakable()
13791 q.text("code = ");
13792 q.text("%#x" % self.code)
13793 q.text(","); q.breakable()
13794 q.text("data = ");
13795 q.pp(self.data)
13796 q.breakable()
13797 q.text('}')
13798
Rich Lane7dcdf022013-12-11 14:45:27 -080013799error_msg.subtypes[9] = queue_op_failed_error_msg
13800
13801class queue_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070013802 version = 4
13803 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070013804 stats_type = 5
13805
13806 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080013807 if xid != None:
13808 self.xid = xid
13809 else:
13810 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070013811 if flags != None:
13812 self.flags = flags
13813 else:
13814 self.flags = 0
13815 if entries != None:
13816 self.entries = entries
13817 else:
13818 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -080013819 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070013820
13821 def pack(self):
13822 packed = []
13823 packed.append(struct.pack("!B", self.version))
13824 packed.append(struct.pack("!B", self.type))
13825 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13826 packed.append(struct.pack("!L", self.xid))
13827 packed.append(struct.pack("!H", self.stats_type))
13828 packed.append(struct.pack("!H", self.flags))
13829 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080013830 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -070013831 length = sum([len(x) for x in packed])
13832 packed[2] = struct.pack("!H", length)
13833 return ''.join(packed)
13834
13835 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080013836 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070013837 obj = queue_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070013838 _version = reader.read("!B")[0]
13839 assert(_version == 4)
13840 _type = reader.read("!B")[0]
13841 assert(_type == 19)
13842 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080013843 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080013844 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070013845 obj.xid = reader.read("!L")[0]
13846 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013847 assert(_stats_type == 5)
Dan Talaycof6202252013-07-02 01:00:29 -070013848 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013849 reader.skip(4)
13850 obj.entries = loxi.generic_util.unpack_list(reader, common.queue_stats_entry.unpack)
13851 return obj
13852
13853 def __eq__(self, other):
13854 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070013855 if self.xid != other.xid: return False
13856 if self.flags != other.flags: return False
13857 if self.entries != other.entries: return False
13858 return True
13859
Rich Lanec2ee4b82013-04-24 17:12:38 -070013860 def pretty_print(self, q):
13861 q.text("queue_stats_reply {")
13862 with q.group():
13863 with q.indent(2):
13864 q.breakable()
13865 q.text("xid = ");
13866 if self.xid != None:
13867 q.text("%#x" % self.xid)
13868 else:
13869 q.text('None')
13870 q.text(","); q.breakable()
13871 q.text("flags = ");
13872 q.text("%#x" % self.flags)
13873 q.text(","); q.breakable()
13874 q.text("entries = ");
13875 q.pp(self.entries)
13876 q.breakable()
13877 q.text('}')
13878
Rich Lane7dcdf022013-12-11 14:45:27 -080013879stats_reply.subtypes[5] = queue_stats_reply
13880
13881class queue_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070013882 version = 4
13883 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070013884 stats_type = 5
13885
13886 def __init__(self, xid=None, flags=None, port_no=None, queue_id=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080013887 if xid != None:
13888 self.xid = xid
13889 else:
13890 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070013891 if flags != None:
13892 self.flags = flags
13893 else:
13894 self.flags = 0
13895 if port_no != None:
13896 self.port_no = port_no
13897 else:
13898 self.port_no = 0
13899 if queue_id != None:
13900 self.queue_id = queue_id
13901 else:
13902 self.queue_id = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080013903 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070013904
13905 def pack(self):
13906 packed = []
13907 packed.append(struct.pack("!B", self.version))
13908 packed.append(struct.pack("!B", self.type))
13909 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13910 packed.append(struct.pack("!L", self.xid))
13911 packed.append(struct.pack("!H", self.stats_type))
13912 packed.append(struct.pack("!H", self.flags))
13913 packed.append('\x00' * 4)
Dan Talaycof6202252013-07-02 01:00:29 -070013914 packed.append(util.pack_port_no(self.port_no))
Rich Lanec2ee4b82013-04-24 17:12:38 -070013915 packed.append(struct.pack("!L", self.queue_id))
13916 length = sum([len(x) for x in packed])
13917 packed[2] = struct.pack("!H", length)
13918 return ''.join(packed)
13919
13920 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080013921 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070013922 obj = queue_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070013923 _version = reader.read("!B")[0]
13924 assert(_version == 4)
13925 _type = reader.read("!B")[0]
13926 assert(_type == 18)
13927 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080013928 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080013929 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070013930 obj.xid = reader.read("!L")[0]
13931 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013932 assert(_stats_type == 5)
Dan Talaycof6202252013-07-02 01:00:29 -070013933 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013934 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -070013935 obj.port_no = util.unpack_port_no(reader)
13936 obj.queue_id = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013937 return obj
13938
13939 def __eq__(self, other):
13940 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070013941 if self.xid != other.xid: return False
13942 if self.flags != other.flags: return False
13943 if self.port_no != other.port_no: return False
13944 if self.queue_id != other.queue_id: return False
13945 return True
13946
Rich Lanec2ee4b82013-04-24 17:12:38 -070013947 def pretty_print(self, q):
13948 q.text("queue_stats_request {")
13949 with q.group():
13950 with q.indent(2):
13951 q.breakable()
13952 q.text("xid = ");
13953 if self.xid != None:
13954 q.text("%#x" % self.xid)
13955 else:
13956 q.text('None')
13957 q.text(","); q.breakable()
13958 q.text("flags = ");
13959 q.text("%#x" % self.flags)
13960 q.text(","); q.breakable()
13961 q.text("port_no = ");
13962 q.text(util.pretty_port(self.port_no))
13963 q.text(","); q.breakable()
13964 q.text("queue_id = ");
13965 q.text("%#x" % self.queue_id)
13966 q.breakable()
13967 q.text('}')
13968
Rich Lane7dcdf022013-12-11 14:45:27 -080013969stats_request.subtypes[5] = queue_stats_request
13970
13971class role_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -070013972 version = 4
13973 type = 25
Rich Lanec2ee4b82013-04-24 17:12:38 -070013974
Rich Laned9e3f7b2013-11-04 11:40:43 -080013975 def __init__(self, xid=None, role=None, generation_id=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080013976 if xid != None:
13977 self.xid = xid
13978 else:
13979 self.xid = None
Rich Laned9e3f7b2013-11-04 11:40:43 -080013980 if role != None:
13981 self.role = role
Rich Lanec2ee4b82013-04-24 17:12:38 -070013982 else:
Rich Laned9e3f7b2013-11-04 11:40:43 -080013983 self.role = 0
13984 if generation_id != None:
13985 self.generation_id = generation_id
13986 else:
13987 self.generation_id = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080013988 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070013989
13990 def pack(self):
13991 packed = []
13992 packed.append(struct.pack("!B", self.version))
13993 packed.append(struct.pack("!B", self.type))
13994 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13995 packed.append(struct.pack("!L", self.xid))
Rich Laned9e3f7b2013-11-04 11:40:43 -080013996 packed.append(struct.pack("!L", self.role))
13997 packed.append('\x00' * 4)
13998 packed.append(struct.pack("!Q", self.generation_id))
Rich Lanec2ee4b82013-04-24 17:12:38 -070013999 length = sum([len(x) for x in packed])
14000 packed[2] = struct.pack("!H", length)
14001 return ''.join(packed)
14002
14003 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080014004 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070014005 obj = role_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070014006 _version = reader.read("!B")[0]
14007 assert(_version == 4)
14008 _type = reader.read("!B")[0]
14009 assert(_type == 25)
14010 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080014011 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080014012 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070014013 obj.xid = reader.read("!L")[0]
Rich Laned9e3f7b2013-11-04 11:40:43 -080014014 obj.role = reader.read("!L")[0]
14015 reader.skip(4)
14016 obj.generation_id = reader.read("!Q")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070014017 return obj
14018
14019 def __eq__(self, other):
14020 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070014021 if self.xid != other.xid: return False
Rich Laned9e3f7b2013-11-04 11:40:43 -080014022 if self.role != other.role: return False
14023 if self.generation_id != other.generation_id: return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070014024 return True
14025
Rich Lanec2ee4b82013-04-24 17:12:38 -070014026 def pretty_print(self, q):
14027 q.text("role_reply {")
14028 with q.group():
14029 with q.indent(2):
14030 q.breakable()
14031 q.text("xid = ");
14032 if self.xid != None:
14033 q.text("%#x" % self.xid)
14034 else:
14035 q.text('None')
14036 q.text(","); q.breakable()
Rich Laned9e3f7b2013-11-04 11:40:43 -080014037 q.text("role = ");
14038 q.text("%#x" % self.role)
14039 q.text(","); q.breakable()
14040 q.text("generation_id = ");
14041 q.text("%#x" % self.generation_id)
Rich Lanec2ee4b82013-04-24 17:12:38 -070014042 q.breakable()
14043 q.text('}')
14044
Rich Lane7dcdf022013-12-11 14:45:27 -080014045message.subtypes[25] = role_reply
14046
14047class role_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -070014048 version = 4
14049 type = 24
Rich Lanec2ee4b82013-04-24 17:12:38 -070014050
14051 def __init__(self, xid=None, role=None, generation_id=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080014052 if xid != None:
14053 self.xid = xid
14054 else:
14055 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070014056 if role != None:
14057 self.role = role
14058 else:
14059 self.role = 0
14060 if generation_id != None:
14061 self.generation_id = generation_id
14062 else:
14063 self.generation_id = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080014064 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070014065
14066 def pack(self):
14067 packed = []
14068 packed.append(struct.pack("!B", self.version))
14069 packed.append(struct.pack("!B", self.type))
14070 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14071 packed.append(struct.pack("!L", self.xid))
14072 packed.append(struct.pack("!L", self.role))
14073 packed.append('\x00' * 4)
14074 packed.append(struct.pack("!Q", self.generation_id))
14075 length = sum([len(x) for x in packed])
14076 packed[2] = struct.pack("!H", length)
14077 return ''.join(packed)
14078
14079 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080014080 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070014081 obj = role_request()
Dan Talaycof6202252013-07-02 01:00:29 -070014082 _version = reader.read("!B")[0]
14083 assert(_version == 4)
14084 _type = reader.read("!B")[0]
14085 assert(_type == 24)
14086 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080014087 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080014088 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070014089 obj.xid = reader.read("!L")[0]
14090 obj.role = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070014091 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -070014092 obj.generation_id = reader.read("!Q")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070014093 return obj
14094
14095 def __eq__(self, other):
14096 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070014097 if self.xid != other.xid: return False
14098 if self.role != other.role: return False
14099 if self.generation_id != other.generation_id: return False
14100 return True
14101
Rich Lanec2ee4b82013-04-24 17:12:38 -070014102 def pretty_print(self, q):
14103 q.text("role_request {")
14104 with q.group():
14105 with q.indent(2):
14106 q.breakable()
14107 q.text("xid = ");
14108 if self.xid != None:
14109 q.text("%#x" % self.xid)
14110 else:
14111 q.text('None')
14112 q.text(","); q.breakable()
14113 q.text("role = ");
14114 q.text("%#x" % self.role)
14115 q.text(","); q.breakable()
14116 q.text("generation_id = ");
14117 q.text("%#x" % self.generation_id)
14118 q.breakable()
14119 q.text('}')
14120
Rich Lane7dcdf022013-12-11 14:45:27 -080014121message.subtypes[24] = role_request
14122
14123class role_request_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -070014124 version = 4
14125 type = 1
14126 err_type = 11
14127
14128 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080014129 if xid != None:
14130 self.xid = xid
14131 else:
14132 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -070014133 if code != None:
14134 self.code = code
14135 else:
14136 self.code = 0
14137 if data != None:
14138 self.data = data
14139 else:
14140 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080014141 return
Rich Lane6f4978c2013-10-20 21:33:52 -070014142
14143 def pack(self):
14144 packed = []
14145 packed.append(struct.pack("!B", self.version))
14146 packed.append(struct.pack("!B", self.type))
14147 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14148 packed.append(struct.pack("!L", self.xid))
14149 packed.append(struct.pack("!H", self.err_type))
14150 packed.append(struct.pack("!H", self.code))
14151 packed.append(self.data)
14152 length = sum([len(x) for x in packed])
14153 packed[2] = struct.pack("!H", length)
14154 return ''.join(packed)
14155
14156 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080014157 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -070014158 obj = role_request_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -070014159 _version = reader.read("!B")[0]
14160 assert(_version == 4)
14161 _type = reader.read("!B")[0]
14162 assert(_type == 1)
14163 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080014164 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080014165 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -070014166 obj.xid = reader.read("!L")[0]
14167 _err_type = reader.read("!H")[0]
14168 assert(_err_type == 11)
14169 obj.code = reader.read("!H")[0]
14170 obj.data = str(reader.read_all())
14171 return obj
14172
14173 def __eq__(self, other):
14174 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -070014175 if self.xid != other.xid: return False
14176 if self.code != other.code: return False
14177 if self.data != other.data: return False
14178 return True
14179
Rich Lane6f4978c2013-10-20 21:33:52 -070014180 def pretty_print(self, q):
14181 q.text("role_request_failed_error_msg {")
14182 with q.group():
14183 with q.indent(2):
14184 q.breakable()
14185 q.text("xid = ");
14186 if self.xid != None:
14187 q.text("%#x" % self.xid)
14188 else:
14189 q.text('None')
14190 q.text(","); q.breakable()
14191 q.text("code = ");
14192 q.text("%#x" % self.code)
14193 q.text(","); q.breakable()
14194 q.text("data = ");
14195 q.pp(self.data)
14196 q.breakable()
14197 q.text('}')
14198
Rich Lane7dcdf022013-12-11 14:45:27 -080014199error_msg.subtypes[11] = role_request_failed_error_msg
14200
14201class set_config(message):
Dan Talaycof6202252013-07-02 01:00:29 -070014202 version = 4
14203 type = 9
Rich Lanec2ee4b82013-04-24 17:12:38 -070014204
14205 def __init__(self, xid=None, flags=None, miss_send_len=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080014206 if xid != None:
14207 self.xid = xid
14208 else:
14209 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070014210 if flags != None:
14211 self.flags = flags
14212 else:
14213 self.flags = 0
14214 if miss_send_len != None:
14215 self.miss_send_len = miss_send_len
14216 else:
14217 self.miss_send_len = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080014218 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070014219
14220 def pack(self):
14221 packed = []
14222 packed.append(struct.pack("!B", self.version))
14223 packed.append(struct.pack("!B", self.type))
14224 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14225 packed.append(struct.pack("!L", self.xid))
14226 packed.append(struct.pack("!H", self.flags))
14227 packed.append(struct.pack("!H", self.miss_send_len))
14228 length = sum([len(x) for x in packed])
14229 packed[2] = struct.pack("!H", length)
14230 return ''.join(packed)
14231
14232 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080014233 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070014234 obj = set_config()
Dan Talaycof6202252013-07-02 01:00:29 -070014235 _version = reader.read("!B")[0]
14236 assert(_version == 4)
14237 _type = reader.read("!B")[0]
14238 assert(_type == 9)
14239 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080014240 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080014241 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070014242 obj.xid = reader.read("!L")[0]
14243 obj.flags = reader.read("!H")[0]
14244 obj.miss_send_len = reader.read("!H")[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.miss_send_len != other.miss_send_len: return False
14252 return True
14253
Rich Lanec2ee4b82013-04-24 17:12:38 -070014254 def pretty_print(self, q):
14255 q.text("set_config {")
14256 with q.group():
14257 with q.indent(2):
14258 q.breakable()
14259 q.text("xid = ");
14260 if self.xid != None:
14261 q.text("%#x" % self.xid)
14262 else:
14263 q.text('None')
14264 q.text(","); q.breakable()
14265 q.text("flags = ");
14266 q.text("%#x" % self.flags)
14267 q.text(","); q.breakable()
14268 q.text("miss_send_len = ");
14269 q.text("%#x" % self.miss_send_len)
14270 q.breakable()
14271 q.text('}')
14272
Rich Lane7dcdf022013-12-11 14:45:27 -080014273message.subtypes[9] = set_config
14274
14275class switch_config_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -070014276 version = 4
14277 type = 1
14278 err_type = 10
14279
14280 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080014281 if xid != None:
14282 self.xid = xid
14283 else:
14284 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -070014285 if code != None:
14286 self.code = code
14287 else:
14288 self.code = 0
14289 if data != None:
14290 self.data = data
14291 else:
14292 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080014293 return
Rich Lane6f4978c2013-10-20 21:33:52 -070014294
14295 def pack(self):
14296 packed = []
14297 packed.append(struct.pack("!B", self.version))
14298 packed.append(struct.pack("!B", self.type))
14299 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14300 packed.append(struct.pack("!L", self.xid))
14301 packed.append(struct.pack("!H", self.err_type))
14302 packed.append(struct.pack("!H", self.code))
14303 packed.append(self.data)
14304 length = sum([len(x) for x in packed])
14305 packed[2] = struct.pack("!H", length)
14306 return ''.join(packed)
14307
14308 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080014309 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -070014310 obj = switch_config_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -070014311 _version = reader.read("!B")[0]
14312 assert(_version == 4)
14313 _type = reader.read("!B")[0]
14314 assert(_type == 1)
14315 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080014316 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080014317 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -070014318 obj.xid = reader.read("!L")[0]
14319 _err_type = reader.read("!H")[0]
14320 assert(_err_type == 10)
14321 obj.code = reader.read("!H")[0]
14322 obj.data = str(reader.read_all())
14323 return obj
14324
14325 def __eq__(self, other):
14326 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -070014327 if self.xid != other.xid: return False
14328 if self.code != other.code: return False
14329 if self.data != other.data: return False
14330 return True
14331
Rich Lane6f4978c2013-10-20 21:33:52 -070014332 def pretty_print(self, q):
14333 q.text("switch_config_failed_error_msg {")
14334 with q.group():
14335 with q.indent(2):
14336 q.breakable()
14337 q.text("xid = ");
14338 if self.xid != None:
14339 q.text("%#x" % self.xid)
14340 else:
14341 q.text('None')
14342 q.text(","); q.breakable()
14343 q.text("code = ");
14344 q.text("%#x" % self.code)
14345 q.text(","); q.breakable()
14346 q.text("data = ");
14347 q.pp(self.data)
14348 q.breakable()
14349 q.text('}')
14350
Rich Lane7dcdf022013-12-11 14:45:27 -080014351error_msg.subtypes[10] = switch_config_failed_error_msg
14352
14353class table_features_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -070014354 version = 4
14355 type = 1
14356 err_type = 13
14357
14358 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080014359 if xid != None:
14360 self.xid = xid
14361 else:
14362 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -070014363 if code != None:
14364 self.code = code
14365 else:
14366 self.code = 0
14367 if data != None:
14368 self.data = data
14369 else:
14370 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080014371 return
Rich Lane6f4978c2013-10-20 21:33:52 -070014372
14373 def pack(self):
14374 packed = []
14375 packed.append(struct.pack("!B", self.version))
14376 packed.append(struct.pack("!B", self.type))
14377 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14378 packed.append(struct.pack("!L", self.xid))
14379 packed.append(struct.pack("!H", self.err_type))
14380 packed.append(struct.pack("!H", self.code))
14381 packed.append(self.data)
14382 length = sum([len(x) for x in packed])
14383 packed[2] = struct.pack("!H", length)
14384 return ''.join(packed)
14385
14386 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080014387 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -070014388 obj = table_features_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -070014389 _version = reader.read("!B")[0]
14390 assert(_version == 4)
14391 _type = reader.read("!B")[0]
14392 assert(_type == 1)
14393 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080014394 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080014395 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -070014396 obj.xid = reader.read("!L")[0]
14397 _err_type = reader.read("!H")[0]
14398 assert(_err_type == 13)
14399 obj.code = reader.read("!H")[0]
14400 obj.data = str(reader.read_all())
14401 return obj
14402
14403 def __eq__(self, other):
14404 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -070014405 if self.xid != other.xid: return False
14406 if self.code != other.code: return False
14407 if self.data != other.data: return False
14408 return True
14409
Rich Lane6f4978c2013-10-20 21:33:52 -070014410 def pretty_print(self, q):
14411 q.text("table_features_failed_error_msg {")
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("code = ");
14422 q.text("%#x" % self.code)
14423 q.text(","); q.breakable()
14424 q.text("data = ");
14425 q.pp(self.data)
14426 q.breakable()
14427 q.text('}')
14428
Rich Lane7dcdf022013-12-11 14:45:27 -080014429error_msg.subtypes[13] = table_features_failed_error_msg
14430
14431class table_features_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070014432 version = 4
14433 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070014434 stats_type = 12
14435
14436 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080014437 if xid != None:
14438 self.xid = xid
14439 else:
14440 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070014441 if flags != None:
14442 self.flags = flags
14443 else:
14444 self.flags = 0
14445 if entries != None:
14446 self.entries = entries
14447 else:
14448 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -080014449 return
Rich Lanec2ee4b82013-04-24 17:12:38 -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.stats_type))
14458 packed.append(struct.pack("!H", self.flags))
14459 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080014460 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -070014461 length = sum([len(x) for x in packed])
14462 packed[2] = struct.pack("!H", length)
14463 return ''.join(packed)
14464
14465 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080014466 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070014467 obj = table_features_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070014468 _version = reader.read("!B")[0]
14469 assert(_version == 4)
14470 _type = reader.read("!B")[0]
14471 assert(_type == 19)
14472 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080014473 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080014474 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070014475 obj.xid = reader.read("!L")[0]
14476 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070014477 assert(_stats_type == 12)
Dan Talaycof6202252013-07-02 01:00:29 -070014478 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070014479 reader.skip(4)
Rich Lane7dcdf022013-12-11 14:45:27 -080014480 obj.entries = loxi.generic_util.unpack_list(reader, common.table_features.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070014481 return obj
14482
14483 def __eq__(self, other):
14484 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070014485 if self.xid != other.xid: return False
14486 if self.flags != other.flags: return False
14487 if self.entries != other.entries: return False
14488 return True
14489
Rich Lanec2ee4b82013-04-24 17:12:38 -070014490 def pretty_print(self, q):
14491 q.text("table_features_stats_reply {")
14492 with q.group():
14493 with q.indent(2):
14494 q.breakable()
14495 q.text("xid = ");
14496 if self.xid != None:
14497 q.text("%#x" % self.xid)
14498 else:
14499 q.text('None')
14500 q.text(","); q.breakable()
14501 q.text("flags = ");
14502 q.text("%#x" % self.flags)
14503 q.text(","); q.breakable()
14504 q.text("entries = ");
14505 q.pp(self.entries)
14506 q.breakable()
14507 q.text('}')
14508
Rich Lane7dcdf022013-12-11 14:45:27 -080014509stats_reply.subtypes[12] = table_features_stats_reply
14510
14511class table_features_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070014512 version = 4
14513 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070014514 stats_type = 12
14515
14516 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080014517 if xid != None:
14518 self.xid = xid
14519 else:
14520 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070014521 if flags != None:
14522 self.flags = flags
14523 else:
14524 self.flags = 0
14525 if entries != None:
14526 self.entries = entries
14527 else:
14528 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -080014529 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070014530
14531 def pack(self):
14532 packed = []
14533 packed.append(struct.pack("!B", self.version))
14534 packed.append(struct.pack("!B", self.type))
14535 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14536 packed.append(struct.pack("!L", self.xid))
14537 packed.append(struct.pack("!H", self.stats_type))
14538 packed.append(struct.pack("!H", self.flags))
14539 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080014540 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -070014541 length = sum([len(x) for x in packed])
14542 packed[2] = struct.pack("!H", length)
14543 return ''.join(packed)
14544
14545 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080014546 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070014547 obj = table_features_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070014548 _version = reader.read("!B")[0]
14549 assert(_version == 4)
14550 _type = reader.read("!B")[0]
14551 assert(_type == 18)
14552 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080014553 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080014554 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070014555 obj.xid = reader.read("!L")[0]
14556 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070014557 assert(_stats_type == 12)
Dan Talaycof6202252013-07-02 01:00:29 -070014558 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070014559 reader.skip(4)
Rich Lane7dcdf022013-12-11 14:45:27 -080014560 obj.entries = loxi.generic_util.unpack_list(reader, common.table_features.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070014561 return obj
14562
14563 def __eq__(self, other):
14564 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070014565 if self.xid != other.xid: return False
14566 if self.flags != other.flags: return False
14567 if self.entries != other.entries: return False
14568 return True
14569
Rich Lanec2ee4b82013-04-24 17:12:38 -070014570 def pretty_print(self, q):
14571 q.text("table_features_stats_request {")
14572 with q.group():
14573 with q.indent(2):
14574 q.breakable()
14575 q.text("xid = ");
14576 if self.xid != None:
14577 q.text("%#x" % self.xid)
14578 else:
14579 q.text('None')
14580 q.text(","); q.breakable()
14581 q.text("flags = ");
14582 q.text("%#x" % self.flags)
14583 q.text(","); q.breakable()
14584 q.text("entries = ");
14585 q.pp(self.entries)
14586 q.breakable()
14587 q.text('}')
14588
Rich Lane7dcdf022013-12-11 14:45:27 -080014589stats_request.subtypes[12] = table_features_stats_request
14590
14591class table_mod(message):
Dan Talaycof6202252013-07-02 01:00:29 -070014592 version = 4
14593 type = 17
Rich Lanec2ee4b82013-04-24 17:12:38 -070014594
14595 def __init__(self, xid=None, table_id=None, config=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080014596 if xid != None:
14597 self.xid = xid
14598 else:
14599 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070014600 if table_id != None:
14601 self.table_id = table_id
14602 else:
14603 self.table_id = 0
14604 if config != None:
14605 self.config = config
14606 else:
14607 self.config = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080014608 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070014609
14610 def pack(self):
14611 packed = []
14612 packed.append(struct.pack("!B", self.version))
14613 packed.append(struct.pack("!B", self.type))
14614 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14615 packed.append(struct.pack("!L", self.xid))
14616 packed.append(struct.pack("!B", self.table_id))
14617 packed.append('\x00' * 3)
14618 packed.append(struct.pack("!L", self.config))
14619 length = sum([len(x) for x in packed])
14620 packed[2] = struct.pack("!H", length)
14621 return ''.join(packed)
14622
14623 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080014624 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070014625 obj = table_mod()
Dan Talaycof6202252013-07-02 01:00:29 -070014626 _version = reader.read("!B")[0]
14627 assert(_version == 4)
14628 _type = reader.read("!B")[0]
14629 assert(_type == 17)
14630 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080014631 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080014632 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070014633 obj.xid = reader.read("!L")[0]
14634 obj.table_id = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070014635 reader.skip(3)
Dan Talaycof6202252013-07-02 01:00:29 -070014636 obj.config = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070014637 return obj
14638
14639 def __eq__(self, other):
14640 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070014641 if self.xid != other.xid: return False
14642 if self.table_id != other.table_id: return False
14643 if self.config != other.config: return False
14644 return True
14645
Rich Lanec2ee4b82013-04-24 17:12:38 -070014646 def pretty_print(self, q):
14647 q.text("table_mod {")
14648 with q.group():
14649 with q.indent(2):
14650 q.breakable()
14651 q.text("xid = ");
14652 if self.xid != None:
14653 q.text("%#x" % self.xid)
14654 else:
14655 q.text('None')
14656 q.text(","); q.breakable()
14657 q.text("table_id = ");
14658 q.text("%#x" % self.table_id)
14659 q.text(","); q.breakable()
14660 q.text("config = ");
14661 q.text("%#x" % self.config)
14662 q.breakable()
14663 q.text('}')
14664
Rich Lane7dcdf022013-12-11 14:45:27 -080014665message.subtypes[17] = table_mod
14666
14667class table_mod_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -070014668 version = 4
14669 type = 1
14670 err_type = 8
14671
14672 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080014673 if xid != None:
14674 self.xid = xid
14675 else:
14676 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -070014677 if code != None:
14678 self.code = code
14679 else:
14680 self.code = 0
14681 if data != None:
14682 self.data = data
14683 else:
14684 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080014685 return
Rich Lane6f4978c2013-10-20 21:33:52 -070014686
14687 def pack(self):
14688 packed = []
14689 packed.append(struct.pack("!B", self.version))
14690 packed.append(struct.pack("!B", self.type))
14691 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14692 packed.append(struct.pack("!L", self.xid))
14693 packed.append(struct.pack("!H", self.err_type))
14694 packed.append(struct.pack("!H", self.code))
14695 packed.append(self.data)
14696 length = sum([len(x) for x in packed])
14697 packed[2] = struct.pack("!H", length)
14698 return ''.join(packed)
14699
14700 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080014701 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -070014702 obj = table_mod_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -070014703 _version = reader.read("!B")[0]
14704 assert(_version == 4)
14705 _type = reader.read("!B")[0]
14706 assert(_type == 1)
14707 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080014708 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080014709 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -070014710 obj.xid = reader.read("!L")[0]
14711 _err_type = reader.read("!H")[0]
14712 assert(_err_type == 8)
14713 obj.code = reader.read("!H")[0]
14714 obj.data = str(reader.read_all())
14715 return obj
14716
14717 def __eq__(self, other):
14718 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -070014719 if self.xid != other.xid: return False
14720 if self.code != other.code: return False
14721 if self.data != other.data: return False
14722 return True
14723
Rich Lane6f4978c2013-10-20 21:33:52 -070014724 def pretty_print(self, q):
14725 q.text("table_mod_failed_error_msg {")
14726 with q.group():
14727 with q.indent(2):
14728 q.breakable()
14729 q.text("xid = ");
14730 if self.xid != None:
14731 q.text("%#x" % self.xid)
14732 else:
14733 q.text('None')
14734 q.text(","); q.breakable()
14735 q.text("code = ");
14736 q.text("%#x" % self.code)
14737 q.text(","); q.breakable()
14738 q.text("data = ");
14739 q.pp(self.data)
14740 q.breakable()
14741 q.text('}')
14742
Rich Lane7dcdf022013-12-11 14:45:27 -080014743error_msg.subtypes[8] = table_mod_failed_error_msg
14744
14745class table_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070014746 version = 4
14747 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070014748 stats_type = 3
14749
14750 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080014751 if xid != None:
14752 self.xid = xid
14753 else:
14754 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070014755 if flags != None:
14756 self.flags = flags
14757 else:
14758 self.flags = 0
14759 if entries != None:
14760 self.entries = entries
14761 else:
14762 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -080014763 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070014764
14765 def pack(self):
14766 packed = []
14767 packed.append(struct.pack("!B", self.version))
14768 packed.append(struct.pack("!B", self.type))
14769 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14770 packed.append(struct.pack("!L", self.xid))
14771 packed.append(struct.pack("!H", self.stats_type))
14772 packed.append(struct.pack("!H", self.flags))
14773 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080014774 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -070014775 length = sum([len(x) for x in packed])
14776 packed[2] = struct.pack("!H", length)
14777 return ''.join(packed)
14778
14779 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080014780 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070014781 obj = table_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070014782 _version = reader.read("!B")[0]
14783 assert(_version == 4)
14784 _type = reader.read("!B")[0]
14785 assert(_type == 19)
14786 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080014787 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080014788 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070014789 obj.xid = reader.read("!L")[0]
14790 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070014791 assert(_stats_type == 3)
Dan Talaycof6202252013-07-02 01:00:29 -070014792 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070014793 reader.skip(4)
14794 obj.entries = loxi.generic_util.unpack_list(reader, common.table_stats_entry.unpack)
14795 return obj
14796
14797 def __eq__(self, other):
14798 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070014799 if self.xid != other.xid: return False
14800 if self.flags != other.flags: return False
14801 if self.entries != other.entries: return False
14802 return True
14803
Rich Lanec2ee4b82013-04-24 17:12:38 -070014804 def pretty_print(self, q):
14805 q.text("table_stats_reply {")
14806 with q.group():
14807 with q.indent(2):
14808 q.breakable()
14809 q.text("xid = ");
14810 if self.xid != None:
14811 q.text("%#x" % self.xid)
14812 else:
14813 q.text('None')
14814 q.text(","); q.breakable()
14815 q.text("flags = ");
14816 q.text("%#x" % self.flags)
14817 q.text(","); q.breakable()
14818 q.text("entries = ");
14819 q.pp(self.entries)
14820 q.breakable()
14821 q.text('}')
14822
Rich Lane7dcdf022013-12-11 14:45:27 -080014823stats_reply.subtypes[3] = table_stats_reply
14824
14825class table_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070014826 version = 4
14827 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070014828 stats_type = 3
14829
14830 def __init__(self, xid=None, flags=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080014831 if xid != None:
14832 self.xid = xid
14833 else:
14834 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070014835 if flags != None:
14836 self.flags = flags
14837 else:
14838 self.flags = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080014839 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070014840
14841 def pack(self):
14842 packed = []
14843 packed.append(struct.pack("!B", self.version))
14844 packed.append(struct.pack("!B", self.type))
14845 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14846 packed.append(struct.pack("!L", self.xid))
14847 packed.append(struct.pack("!H", self.stats_type))
14848 packed.append(struct.pack("!H", self.flags))
14849 packed.append('\x00' * 4)
14850 length = sum([len(x) for x in packed])
14851 packed[2] = struct.pack("!H", length)
14852 return ''.join(packed)
14853
14854 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080014855 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070014856 obj = table_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070014857 _version = reader.read("!B")[0]
14858 assert(_version == 4)
14859 _type = reader.read("!B")[0]
14860 assert(_type == 18)
14861 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080014862 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080014863 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070014864 obj.xid = reader.read("!L")[0]
14865 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070014866 assert(_stats_type == 3)
Dan Talaycof6202252013-07-02 01:00:29 -070014867 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070014868 reader.skip(4)
14869 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 return True
14876
Rich Lanec2ee4b82013-04-24 17:12:38 -070014877 def pretty_print(self, q):
14878 q.text("table_stats_request {")
14879 with q.group():
14880 with q.indent(2):
14881 q.breakable()
14882 q.text("xid = ");
14883 if self.xid != None:
14884 q.text("%#x" % self.xid)
14885 else:
14886 q.text('None')
14887 q.text(","); q.breakable()
14888 q.text("flags = ");
14889 q.text("%#x" % self.flags)
14890 q.breakable()
14891 q.text('}')
14892
Rich Lane7dcdf022013-12-11 14:45:27 -080014893stats_request.subtypes[3] = table_stats_request
14894
Rich Lanec2ee4b82013-04-24 17:12:38 -070014895
14896def parse_header(buf):
14897 if len(buf) < 8:
14898 raise loxi.ProtocolError("too short to be an OpenFlow message")
14899 return struct.unpack_from("!BBHL", buf)
14900
14901def parse_message(buf):
14902 msg_ver, msg_type, msg_len, msg_xid = parse_header(buf)
Rich Lanefe600f52013-07-09 13:22:32 -070014903 if msg_ver != const.OFP_VERSION and msg_type != const.OFPT_HELLO:
14904 raise loxi.ProtocolError("wrong OpenFlow version (expected %d, got %d)" % (const.OFP_VERSION, msg_ver))
Rich Lanec2ee4b82013-04-24 17:12:38 -070014905 if len(buf) != msg_len:
14906 raise loxi.ProtocolError("incorrect message size")
Rich Lane7dcdf022013-12-11 14:45:27 -080014907 return message.unpack(loxi.generic_util.OFReader(buf))