blob: 2737bd17ed6030f50e0e37648ca8d1a7d5b9a4b5 [file] [log] [blame]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001# Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
2# Copyright (c) 2011, 2012 Open Networking Foundation
3# Copyright (c) 2012, 2013 Big Switch Networks, Inc.
Dan Talaycof6202252013-07-02 01:00:29 -07004# See the file LICENSE.pyloxi which should have been included in the source distribution
Rich Lanec2ee4b82013-04-24 17:12:38 -07005
Rich Lane7dcdf022013-12-11 14:45:27 -08006# Automatically generated by LOXI from template module.py
Rich Lanec2ee4b82013-04-24 17:12:38 -07007# Do not modify
8
9import struct
10import loxi
11import const
12import common
Rich Lane7dcdf022013-12-11 14:45:27 -080013import action
14import instruction
15import oxm
16import action_id
17import instruction_id
18import meter_band
Rich Lanec2ee4b82013-04-24 17:12:38 -070019import util
20import loxi.generic_util
21
Rich Lane7dcdf022013-12-11 14:45:27 -080022class message(loxi.OFObject):
23 subtypes = {}
Rich Lanec2ee4b82013-04-24 17:12:38 -070024
Rich Lane7dcdf022013-12-11 14:45:27 -080025 @staticmethod
26 def unpack(reader):
27 subtype, = reader.peek('B', 1)
28 try:
29 subclass = message.subtypes[subtype]
30 except KeyError:
31 raise loxi.ProtocolError("unknown message subtype %#x" % subtype)
32 return subclass.unpack(reader)
33
34
35class stats_reply(message):
36 subtypes = {}
37
38 @staticmethod
39 def unpack(reader):
40 subtype, = reader.peek('!H', 8)
41 try:
42 subclass = stats_reply.subtypes[subtype]
43 except KeyError:
44 raise loxi.ProtocolError("unknown stats_reply message subtype %#x" % subtype)
45 return subclass.unpack(reader)
46
47message.subtypes[19] = stats_reply
48
49class aggregate_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070050 version = 4
51 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070052 stats_type = 2
53
54 def __init__(self, xid=None, flags=None, packet_count=None, byte_count=None, flow_count=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080055 if xid != None:
56 self.xid = xid
57 else:
58 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070059 if flags != None:
60 self.flags = flags
61 else:
62 self.flags = 0
63 if packet_count != None:
64 self.packet_count = packet_count
65 else:
66 self.packet_count = 0
67 if byte_count != None:
68 self.byte_count = byte_count
69 else:
70 self.byte_count = 0
71 if flow_count != None:
72 self.flow_count = flow_count
73 else:
74 self.flow_count = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080075 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070076
77 def pack(self):
78 packed = []
79 packed.append(struct.pack("!B", self.version))
80 packed.append(struct.pack("!B", self.type))
81 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
82 packed.append(struct.pack("!L", self.xid))
83 packed.append(struct.pack("!H", self.stats_type))
84 packed.append(struct.pack("!H", self.flags))
85 packed.append('\x00' * 4)
86 packed.append(struct.pack("!Q", self.packet_count))
87 packed.append(struct.pack("!Q", self.byte_count))
88 packed.append(struct.pack("!L", self.flow_count))
89 packed.append('\x00' * 4)
90 length = sum([len(x) for x in packed])
91 packed[2] = struct.pack("!H", length)
92 return ''.join(packed)
93
94 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080095 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070096 obj = aggregate_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070097 _version = reader.read("!B")[0]
98 assert(_version == 4)
99 _type = reader.read("!B")[0]
100 assert(_type == 19)
101 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800102 orig_reader = reader
103 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700104 obj.xid = reader.read("!L")[0]
105 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700106 assert(_stats_type == 2)
Dan Talaycof6202252013-07-02 01:00:29 -0700107 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700108 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -0700109 obj.packet_count = reader.read("!Q")[0]
110 obj.byte_count = reader.read("!Q")[0]
111 obj.flow_count = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700112 reader.skip(4)
113 return obj
114
115 def __eq__(self, other):
116 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -0700117 if self.xid != other.xid: return False
118 if self.flags != other.flags: return False
119 if self.packet_count != other.packet_count: return False
120 if self.byte_count != other.byte_count: return False
121 if self.flow_count != other.flow_count: return False
122 return True
123
Rich Lanec2ee4b82013-04-24 17:12:38 -0700124 def pretty_print(self, q):
125 q.text("aggregate_stats_reply {")
126 with q.group():
127 with q.indent(2):
128 q.breakable()
129 q.text("xid = ");
130 if self.xid != None:
131 q.text("%#x" % self.xid)
132 else:
133 q.text('None')
134 q.text(","); q.breakable()
135 q.text("flags = ");
136 q.text("%#x" % self.flags)
137 q.text(","); q.breakable()
138 q.text("packet_count = ");
139 q.text("%#x" % self.packet_count)
140 q.text(","); q.breakable()
141 q.text("byte_count = ");
142 q.text("%#x" % self.byte_count)
143 q.text(","); q.breakable()
144 q.text("flow_count = ");
145 q.text("%#x" % self.flow_count)
146 q.breakable()
147 q.text('}')
148
Rich Lane7dcdf022013-12-11 14:45:27 -0800149stats_reply.subtypes[2] = aggregate_stats_reply
150
151class stats_request(message):
152 subtypes = {}
153
154 @staticmethod
155 def unpack(reader):
156 subtype, = reader.peek('!H', 8)
157 try:
158 subclass = stats_request.subtypes[subtype]
159 except KeyError:
160 raise loxi.ProtocolError("unknown stats_request message subtype %#x" % subtype)
161 return subclass.unpack(reader)
162
163message.subtypes[18] = stats_request
164
165class aggregate_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -0700166 version = 4
167 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -0700168 stats_type = 2
169
170 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 -0800171 if xid != None:
172 self.xid = xid
173 else:
174 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -0700175 if flags != None:
176 self.flags = flags
177 else:
178 self.flags = 0
179 if table_id != None:
180 self.table_id = table_id
181 else:
182 self.table_id = 0
183 if out_port != None:
184 self.out_port = out_port
185 else:
186 self.out_port = 0
187 if out_group != None:
188 self.out_group = out_group
189 else:
190 self.out_group = 0
191 if cookie != None:
192 self.cookie = cookie
193 else:
194 self.cookie = 0
195 if cookie_mask != None:
196 self.cookie_mask = cookie_mask
197 else:
198 self.cookie_mask = 0
199 if match != None:
200 self.match = match
201 else:
202 self.match = common.match()
Rich Lane7dcdf022013-12-11 14:45:27 -0800203 return
Rich Lanec2ee4b82013-04-24 17:12:38 -0700204
205 def pack(self):
206 packed = []
207 packed.append(struct.pack("!B", self.version))
208 packed.append(struct.pack("!B", self.type))
209 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
210 packed.append(struct.pack("!L", self.xid))
211 packed.append(struct.pack("!H", self.stats_type))
212 packed.append(struct.pack("!H", self.flags))
213 packed.append('\x00' * 4)
214 packed.append(struct.pack("!B", self.table_id))
215 packed.append('\x00' * 3)
Dan Talaycof6202252013-07-02 01:00:29 -0700216 packed.append(util.pack_port_no(self.out_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700217 packed.append(struct.pack("!L", self.out_group))
218 packed.append('\x00' * 4)
219 packed.append(struct.pack("!Q", self.cookie))
220 packed.append(struct.pack("!Q", self.cookie_mask))
221 packed.append(self.match.pack())
222 length = sum([len(x) for x in packed])
223 packed[2] = struct.pack("!H", length)
224 return ''.join(packed)
225
226 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800227 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700228 obj = aggregate_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -0700229 _version = reader.read("!B")[0]
230 assert(_version == 4)
231 _type = reader.read("!B")[0]
232 assert(_type == 18)
233 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800234 orig_reader = reader
235 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700236 obj.xid = reader.read("!L")[0]
237 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700238 assert(_stats_type == 2)
Dan Talaycof6202252013-07-02 01:00:29 -0700239 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700240 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -0700241 obj.table_id = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700242 reader.skip(3)
Dan Talaycof6202252013-07-02 01:00:29 -0700243 obj.out_port = util.unpack_port_no(reader)
244 obj.out_group = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700245 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -0700246 obj.cookie = reader.read("!Q")[0]
247 obj.cookie_mask = reader.read("!Q")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700248 obj.match = common.match.unpack(reader)
249 return obj
250
251 def __eq__(self, other):
252 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -0700253 if self.xid != other.xid: return False
254 if self.flags != other.flags: return False
255 if self.table_id != other.table_id: return False
256 if self.out_port != other.out_port: return False
257 if self.out_group != other.out_group: return False
258 if self.cookie != other.cookie: return False
259 if self.cookie_mask != other.cookie_mask: return False
260 if self.match != other.match: return False
261 return True
262
Rich Lanec2ee4b82013-04-24 17:12:38 -0700263 def pretty_print(self, q):
264 q.text("aggregate_stats_request {")
265 with q.group():
266 with q.indent(2):
267 q.breakable()
268 q.text("xid = ");
269 if self.xid != None:
270 q.text("%#x" % self.xid)
271 else:
272 q.text('None')
273 q.text(","); q.breakable()
274 q.text("flags = ");
275 q.text("%#x" % self.flags)
276 q.text(","); q.breakable()
277 q.text("table_id = ");
278 q.text("%#x" % self.table_id)
279 q.text(","); q.breakable()
280 q.text("out_port = ");
281 q.text(util.pretty_port(self.out_port))
282 q.text(","); q.breakable()
283 q.text("out_group = ");
284 q.text("%#x" % self.out_group)
285 q.text(","); q.breakable()
286 q.text("cookie = ");
287 q.text("%#x" % self.cookie)
288 q.text(","); q.breakable()
289 q.text("cookie_mask = ");
290 q.text("%#x" % self.cookie_mask)
291 q.text(","); q.breakable()
292 q.text("match = ");
293 q.pp(self.match)
294 q.breakable()
295 q.text('}')
296
Rich Lane7dcdf022013-12-11 14:45:27 -0800297stats_request.subtypes[2] = aggregate_stats_request
298
299class async_get_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -0700300 version = 4
301 type = 27
Rich Lanec2ee4b82013-04-24 17:12:38 -0700302
303 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 -0800304 if xid != None:
305 self.xid = xid
306 else:
307 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -0700308 if packet_in_mask_equal_master != None:
309 self.packet_in_mask_equal_master = packet_in_mask_equal_master
310 else:
311 self.packet_in_mask_equal_master = 0
312 if packet_in_mask_slave != None:
313 self.packet_in_mask_slave = packet_in_mask_slave
314 else:
315 self.packet_in_mask_slave = 0
316 if port_status_mask_equal_master != None:
317 self.port_status_mask_equal_master = port_status_mask_equal_master
318 else:
319 self.port_status_mask_equal_master = 0
320 if port_status_mask_slave != None:
321 self.port_status_mask_slave = port_status_mask_slave
322 else:
323 self.port_status_mask_slave = 0
324 if flow_removed_mask_equal_master != None:
325 self.flow_removed_mask_equal_master = flow_removed_mask_equal_master
326 else:
327 self.flow_removed_mask_equal_master = 0
328 if flow_removed_mask_slave != None:
329 self.flow_removed_mask_slave = flow_removed_mask_slave
330 else:
331 self.flow_removed_mask_slave = 0
Rich Lane7dcdf022013-12-11 14:45:27 -0800332 return
Rich Lanec2ee4b82013-04-24 17:12:38 -0700333
334 def pack(self):
335 packed = []
336 packed.append(struct.pack("!B", self.version))
337 packed.append(struct.pack("!B", self.type))
338 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
339 packed.append(struct.pack("!L", self.xid))
340 packed.append(struct.pack("!L", self.packet_in_mask_equal_master))
341 packed.append(struct.pack("!L", self.packet_in_mask_slave))
342 packed.append(struct.pack("!L", self.port_status_mask_equal_master))
343 packed.append(struct.pack("!L", self.port_status_mask_slave))
344 packed.append(struct.pack("!L", self.flow_removed_mask_equal_master))
345 packed.append(struct.pack("!L", self.flow_removed_mask_slave))
346 length = sum([len(x) for x in packed])
347 packed[2] = struct.pack("!H", length)
348 return ''.join(packed)
349
350 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800351 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700352 obj = async_get_reply()
Dan Talaycof6202252013-07-02 01:00:29 -0700353 _version = reader.read("!B")[0]
354 assert(_version == 4)
355 _type = reader.read("!B")[0]
356 assert(_type == 27)
357 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800358 orig_reader = reader
359 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700360 obj.xid = reader.read("!L")[0]
361 obj.packet_in_mask_equal_master = reader.read("!L")[0]
362 obj.packet_in_mask_slave = reader.read("!L")[0]
363 obj.port_status_mask_equal_master = reader.read("!L")[0]
364 obj.port_status_mask_slave = reader.read("!L")[0]
365 obj.flow_removed_mask_equal_master = reader.read("!L")[0]
366 obj.flow_removed_mask_slave = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700367 return obj
368
369 def __eq__(self, other):
370 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -0700371 if self.xid != other.xid: return False
372 if self.packet_in_mask_equal_master != other.packet_in_mask_equal_master: return False
373 if self.packet_in_mask_slave != other.packet_in_mask_slave: return False
374 if self.port_status_mask_equal_master != other.port_status_mask_equal_master: return False
375 if self.port_status_mask_slave != other.port_status_mask_slave: return False
376 if self.flow_removed_mask_equal_master != other.flow_removed_mask_equal_master: return False
377 if self.flow_removed_mask_slave != other.flow_removed_mask_slave: return False
378 return True
379
Rich Lanec2ee4b82013-04-24 17:12:38 -0700380 def pretty_print(self, q):
381 q.text("async_get_reply {")
382 with q.group():
383 with q.indent(2):
384 q.breakable()
385 q.text("xid = ");
386 if self.xid != None:
387 q.text("%#x" % self.xid)
388 else:
389 q.text('None')
390 q.text(","); q.breakable()
391 q.text("packet_in_mask_equal_master = ");
392 q.text("%#x" % self.packet_in_mask_equal_master)
393 q.text(","); q.breakable()
394 q.text("packet_in_mask_slave = ");
395 q.text("%#x" % self.packet_in_mask_slave)
396 q.text(","); q.breakable()
397 q.text("port_status_mask_equal_master = ");
398 q.text("%#x" % self.port_status_mask_equal_master)
399 q.text(","); q.breakable()
400 q.text("port_status_mask_slave = ");
401 q.text("%#x" % self.port_status_mask_slave)
402 q.text(","); q.breakable()
403 q.text("flow_removed_mask_equal_master = ");
404 q.text("%#x" % self.flow_removed_mask_equal_master)
405 q.text(","); q.breakable()
406 q.text("flow_removed_mask_slave = ");
407 q.text("%#x" % self.flow_removed_mask_slave)
408 q.breakable()
409 q.text('}')
410
Rich Lane7dcdf022013-12-11 14:45:27 -0800411message.subtypes[27] = async_get_reply
412
413class async_get_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -0700414 version = 4
415 type = 26
Rich Lanec2ee4b82013-04-24 17:12:38 -0700416
417 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 -0800418 if xid != None:
419 self.xid = xid
420 else:
421 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -0700422 if packet_in_mask_equal_master != None:
423 self.packet_in_mask_equal_master = packet_in_mask_equal_master
424 else:
425 self.packet_in_mask_equal_master = 0
426 if packet_in_mask_slave != None:
427 self.packet_in_mask_slave = packet_in_mask_slave
428 else:
429 self.packet_in_mask_slave = 0
430 if port_status_mask_equal_master != None:
431 self.port_status_mask_equal_master = port_status_mask_equal_master
432 else:
433 self.port_status_mask_equal_master = 0
434 if port_status_mask_slave != None:
435 self.port_status_mask_slave = port_status_mask_slave
436 else:
437 self.port_status_mask_slave = 0
438 if flow_removed_mask_equal_master != None:
439 self.flow_removed_mask_equal_master = flow_removed_mask_equal_master
440 else:
441 self.flow_removed_mask_equal_master = 0
442 if flow_removed_mask_slave != None:
443 self.flow_removed_mask_slave = flow_removed_mask_slave
444 else:
445 self.flow_removed_mask_slave = 0
Rich Lane7dcdf022013-12-11 14:45:27 -0800446 return
Rich Lanec2ee4b82013-04-24 17:12:38 -0700447
448 def pack(self):
449 packed = []
450 packed.append(struct.pack("!B", self.version))
451 packed.append(struct.pack("!B", self.type))
452 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
453 packed.append(struct.pack("!L", self.xid))
454 packed.append(struct.pack("!L", self.packet_in_mask_equal_master))
455 packed.append(struct.pack("!L", self.packet_in_mask_slave))
456 packed.append(struct.pack("!L", self.port_status_mask_equal_master))
457 packed.append(struct.pack("!L", self.port_status_mask_slave))
458 packed.append(struct.pack("!L", self.flow_removed_mask_equal_master))
459 packed.append(struct.pack("!L", self.flow_removed_mask_slave))
460 length = sum([len(x) for x in packed])
461 packed[2] = struct.pack("!H", length)
462 return ''.join(packed)
463
464 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800465 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700466 obj = async_get_request()
Dan Talaycof6202252013-07-02 01:00:29 -0700467 _version = reader.read("!B")[0]
468 assert(_version == 4)
469 _type = reader.read("!B")[0]
470 assert(_type == 26)
471 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800472 orig_reader = reader
473 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700474 obj.xid = reader.read("!L")[0]
475 obj.packet_in_mask_equal_master = reader.read("!L")[0]
476 obj.packet_in_mask_slave = reader.read("!L")[0]
477 obj.port_status_mask_equal_master = reader.read("!L")[0]
478 obj.port_status_mask_slave = reader.read("!L")[0]
479 obj.flow_removed_mask_equal_master = reader.read("!L")[0]
480 obj.flow_removed_mask_slave = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700481 return obj
482
483 def __eq__(self, other):
484 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -0700485 if self.xid != other.xid: return False
486 if self.packet_in_mask_equal_master != other.packet_in_mask_equal_master: return False
487 if self.packet_in_mask_slave != other.packet_in_mask_slave: return False
488 if self.port_status_mask_equal_master != other.port_status_mask_equal_master: return False
489 if self.port_status_mask_slave != other.port_status_mask_slave: return False
490 if self.flow_removed_mask_equal_master != other.flow_removed_mask_equal_master: return False
491 if self.flow_removed_mask_slave != other.flow_removed_mask_slave: return False
492 return True
493
Rich Lanec2ee4b82013-04-24 17:12:38 -0700494 def pretty_print(self, q):
495 q.text("async_get_request {")
496 with q.group():
497 with q.indent(2):
498 q.breakable()
499 q.text("xid = ");
500 if self.xid != None:
501 q.text("%#x" % self.xid)
502 else:
503 q.text('None')
504 q.text(","); q.breakable()
505 q.text("packet_in_mask_equal_master = ");
506 q.text("%#x" % self.packet_in_mask_equal_master)
507 q.text(","); q.breakable()
508 q.text("packet_in_mask_slave = ");
509 q.text("%#x" % self.packet_in_mask_slave)
510 q.text(","); q.breakable()
511 q.text("port_status_mask_equal_master = ");
512 q.text("%#x" % self.port_status_mask_equal_master)
513 q.text(","); q.breakable()
514 q.text("port_status_mask_slave = ");
515 q.text("%#x" % self.port_status_mask_slave)
516 q.text(","); q.breakable()
517 q.text("flow_removed_mask_equal_master = ");
518 q.text("%#x" % self.flow_removed_mask_equal_master)
519 q.text(","); q.breakable()
520 q.text("flow_removed_mask_slave = ");
521 q.text("%#x" % self.flow_removed_mask_slave)
522 q.breakable()
523 q.text('}')
524
Rich Lane7dcdf022013-12-11 14:45:27 -0800525message.subtypes[26] = async_get_request
526
527class async_set(message):
Dan Talaycof6202252013-07-02 01:00:29 -0700528 version = 4
529 type = 28
Rich Lanec2ee4b82013-04-24 17:12:38 -0700530
531 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 -0800532 if xid != None:
533 self.xid = xid
534 else:
535 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -0700536 if packet_in_mask_equal_master != None:
537 self.packet_in_mask_equal_master = packet_in_mask_equal_master
538 else:
539 self.packet_in_mask_equal_master = 0
540 if packet_in_mask_slave != None:
541 self.packet_in_mask_slave = packet_in_mask_slave
542 else:
543 self.packet_in_mask_slave = 0
544 if port_status_mask_equal_master != None:
545 self.port_status_mask_equal_master = port_status_mask_equal_master
546 else:
547 self.port_status_mask_equal_master = 0
548 if port_status_mask_slave != None:
549 self.port_status_mask_slave = port_status_mask_slave
550 else:
551 self.port_status_mask_slave = 0
552 if flow_removed_mask_equal_master != None:
553 self.flow_removed_mask_equal_master = flow_removed_mask_equal_master
554 else:
555 self.flow_removed_mask_equal_master = 0
556 if flow_removed_mask_slave != None:
557 self.flow_removed_mask_slave = flow_removed_mask_slave
558 else:
559 self.flow_removed_mask_slave = 0
Rich Lane7dcdf022013-12-11 14:45:27 -0800560 return
Rich Lanec2ee4b82013-04-24 17:12:38 -0700561
562 def pack(self):
563 packed = []
564 packed.append(struct.pack("!B", self.version))
565 packed.append(struct.pack("!B", self.type))
566 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
567 packed.append(struct.pack("!L", self.xid))
568 packed.append(struct.pack("!L", self.packet_in_mask_equal_master))
569 packed.append(struct.pack("!L", self.packet_in_mask_slave))
570 packed.append(struct.pack("!L", self.port_status_mask_equal_master))
571 packed.append(struct.pack("!L", self.port_status_mask_slave))
572 packed.append(struct.pack("!L", self.flow_removed_mask_equal_master))
573 packed.append(struct.pack("!L", self.flow_removed_mask_slave))
574 length = sum([len(x) for x in packed])
575 packed[2] = struct.pack("!H", length)
576 return ''.join(packed)
577
578 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800579 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700580 obj = async_set()
Dan Talaycof6202252013-07-02 01:00:29 -0700581 _version = reader.read("!B")[0]
582 assert(_version == 4)
583 _type = reader.read("!B")[0]
584 assert(_type == 28)
585 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800586 orig_reader = reader
587 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700588 obj.xid = reader.read("!L")[0]
589 obj.packet_in_mask_equal_master = reader.read("!L")[0]
590 obj.packet_in_mask_slave = reader.read("!L")[0]
591 obj.port_status_mask_equal_master = reader.read("!L")[0]
592 obj.port_status_mask_slave = reader.read("!L")[0]
593 obj.flow_removed_mask_equal_master = reader.read("!L")[0]
594 obj.flow_removed_mask_slave = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700595 return obj
596
597 def __eq__(self, other):
598 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -0700599 if self.xid != other.xid: return False
600 if self.packet_in_mask_equal_master != other.packet_in_mask_equal_master: return False
601 if self.packet_in_mask_slave != other.packet_in_mask_slave: return False
602 if self.port_status_mask_equal_master != other.port_status_mask_equal_master: return False
603 if self.port_status_mask_slave != other.port_status_mask_slave: return False
604 if self.flow_removed_mask_equal_master != other.flow_removed_mask_equal_master: return False
605 if self.flow_removed_mask_slave != other.flow_removed_mask_slave: return False
606 return True
607
Rich Lanec2ee4b82013-04-24 17:12:38 -0700608 def pretty_print(self, q):
609 q.text("async_set {")
610 with q.group():
611 with q.indent(2):
612 q.breakable()
613 q.text("xid = ");
614 if self.xid != None:
615 q.text("%#x" % self.xid)
616 else:
617 q.text('None')
618 q.text(","); q.breakable()
619 q.text("packet_in_mask_equal_master = ");
620 q.text("%#x" % self.packet_in_mask_equal_master)
621 q.text(","); q.breakable()
622 q.text("packet_in_mask_slave = ");
623 q.text("%#x" % self.packet_in_mask_slave)
624 q.text(","); q.breakable()
625 q.text("port_status_mask_equal_master = ");
626 q.text("%#x" % self.port_status_mask_equal_master)
627 q.text(","); q.breakable()
628 q.text("port_status_mask_slave = ");
629 q.text("%#x" % self.port_status_mask_slave)
630 q.text(","); q.breakable()
631 q.text("flow_removed_mask_equal_master = ");
632 q.text("%#x" % self.flow_removed_mask_equal_master)
633 q.text(","); q.breakable()
634 q.text("flow_removed_mask_slave = ");
635 q.text("%#x" % self.flow_removed_mask_slave)
636 q.breakable()
637 q.text('}')
638
Rich Lane7dcdf022013-12-11 14:45:27 -0800639message.subtypes[28] = async_set
640
641class error_msg(message):
642 subtypes = {}
643
644 @staticmethod
645 def unpack(reader):
646 subtype, = reader.peek('!H', 8)
647 try:
648 subclass = error_msg.subtypes[subtype]
649 except KeyError:
650 raise loxi.ProtocolError("unknown error_msg message subtype %#x" % subtype)
651 return subclass.unpack(reader)
652
653message.subtypes[1] = error_msg
654
655class bad_action_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -0700656 version = 4
657 type = 1
658 err_type = 2
659
660 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -0800661 if xid != None:
662 self.xid = xid
663 else:
664 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -0700665 if code != None:
666 self.code = code
667 else:
668 self.code = 0
669 if data != None:
670 self.data = data
671 else:
672 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -0800673 return
Rich Lane6f4978c2013-10-20 21:33:52 -0700674
675 def pack(self):
676 packed = []
677 packed.append(struct.pack("!B", self.version))
678 packed.append(struct.pack("!B", self.type))
679 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
680 packed.append(struct.pack("!L", self.xid))
681 packed.append(struct.pack("!H", self.err_type))
682 packed.append(struct.pack("!H", self.code))
683 packed.append(self.data)
684 length = sum([len(x) for x in packed])
685 packed[2] = struct.pack("!H", length)
686 return ''.join(packed)
687
688 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800689 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -0700690 obj = bad_action_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -0700691 _version = reader.read("!B")[0]
692 assert(_version == 4)
693 _type = reader.read("!B")[0]
694 assert(_type == 1)
695 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800696 orig_reader = reader
697 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -0700698 obj.xid = reader.read("!L")[0]
699 _err_type = reader.read("!H")[0]
700 assert(_err_type == 2)
701 obj.code = reader.read("!H")[0]
702 obj.data = str(reader.read_all())
703 return obj
704
705 def __eq__(self, other):
706 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -0700707 if self.xid != other.xid: return False
708 if self.code != other.code: return False
709 if self.data != other.data: return False
710 return True
711
Rich Lane6f4978c2013-10-20 21:33:52 -0700712 def pretty_print(self, q):
713 q.text("bad_action_error_msg {")
714 with q.group():
715 with q.indent(2):
716 q.breakable()
717 q.text("xid = ");
718 if self.xid != None:
719 q.text("%#x" % self.xid)
720 else:
721 q.text('None')
722 q.text(","); q.breakable()
723 q.text("code = ");
724 q.text("%#x" % self.code)
725 q.text(","); q.breakable()
726 q.text("data = ");
727 q.pp(self.data)
728 q.breakable()
729 q.text('}')
730
Rich Lane7dcdf022013-12-11 14:45:27 -0800731error_msg.subtypes[2] = bad_action_error_msg
732
733class bad_instruction_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -0700734 version = 4
735 type = 1
736 err_type = 3
737
738 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -0800739 if xid != None:
740 self.xid = xid
741 else:
742 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -0700743 if code != None:
744 self.code = code
745 else:
746 self.code = 0
747 if data != None:
748 self.data = data
749 else:
750 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -0800751 return
Rich Lane6f4978c2013-10-20 21:33:52 -0700752
753 def pack(self):
754 packed = []
755 packed.append(struct.pack("!B", self.version))
756 packed.append(struct.pack("!B", self.type))
757 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
758 packed.append(struct.pack("!L", self.xid))
759 packed.append(struct.pack("!H", self.err_type))
760 packed.append(struct.pack("!H", self.code))
761 packed.append(self.data)
762 length = sum([len(x) for x in packed])
763 packed[2] = struct.pack("!H", length)
764 return ''.join(packed)
765
766 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800767 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -0700768 obj = bad_instruction_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -0700769 _version = reader.read("!B")[0]
770 assert(_version == 4)
771 _type = reader.read("!B")[0]
772 assert(_type == 1)
773 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800774 orig_reader = reader
775 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -0700776 obj.xid = reader.read("!L")[0]
777 _err_type = reader.read("!H")[0]
778 assert(_err_type == 3)
779 obj.code = reader.read("!H")[0]
780 obj.data = str(reader.read_all())
781 return obj
782
783 def __eq__(self, other):
784 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -0700785 if self.xid != other.xid: return False
786 if self.code != other.code: return False
787 if self.data != other.data: return False
788 return True
789
Rich Lane6f4978c2013-10-20 21:33:52 -0700790 def pretty_print(self, q):
791 q.text("bad_instruction_error_msg {")
792 with q.group():
793 with q.indent(2):
794 q.breakable()
795 q.text("xid = ");
796 if self.xid != None:
797 q.text("%#x" % self.xid)
798 else:
799 q.text('None')
800 q.text(","); q.breakable()
801 q.text("code = ");
802 q.text("%#x" % self.code)
803 q.text(","); q.breakable()
804 q.text("data = ");
805 q.pp(self.data)
806 q.breakable()
807 q.text('}')
808
Rich Lane7dcdf022013-12-11 14:45:27 -0800809error_msg.subtypes[3] = bad_instruction_error_msg
810
811class bad_match_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -0700812 version = 4
813 type = 1
814 err_type = 4
815
816 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -0800817 if xid != None:
818 self.xid = xid
819 else:
820 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -0700821 if code != None:
822 self.code = code
823 else:
824 self.code = 0
825 if data != None:
826 self.data = data
827 else:
828 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -0800829 return
Rich Lane6f4978c2013-10-20 21:33:52 -0700830
831 def pack(self):
832 packed = []
833 packed.append(struct.pack("!B", self.version))
834 packed.append(struct.pack("!B", self.type))
835 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
836 packed.append(struct.pack("!L", self.xid))
837 packed.append(struct.pack("!H", self.err_type))
838 packed.append(struct.pack("!H", self.code))
839 packed.append(self.data)
840 length = sum([len(x) for x in packed])
841 packed[2] = struct.pack("!H", length)
842 return ''.join(packed)
843
844 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800845 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -0700846 obj = bad_match_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -0700847 _version = reader.read("!B")[0]
848 assert(_version == 4)
849 _type = reader.read("!B")[0]
850 assert(_type == 1)
851 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800852 orig_reader = reader
853 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -0700854 obj.xid = reader.read("!L")[0]
855 _err_type = reader.read("!H")[0]
856 assert(_err_type == 4)
857 obj.code = reader.read("!H")[0]
858 obj.data = str(reader.read_all())
859 return obj
860
861 def __eq__(self, other):
862 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -0700863 if self.xid != other.xid: return False
864 if self.code != other.code: return False
865 if self.data != other.data: return False
866 return True
867
Rich Lane6f4978c2013-10-20 21:33:52 -0700868 def pretty_print(self, q):
869 q.text("bad_match_error_msg {")
870 with q.group():
871 with q.indent(2):
872 q.breakable()
873 q.text("xid = ");
874 if self.xid != None:
875 q.text("%#x" % self.xid)
876 else:
877 q.text('None')
878 q.text(","); q.breakable()
879 q.text("code = ");
880 q.text("%#x" % self.code)
881 q.text(","); q.breakable()
882 q.text("data = ");
883 q.pp(self.data)
884 q.breakable()
885 q.text('}')
886
Rich Lane7dcdf022013-12-11 14:45:27 -0800887error_msg.subtypes[4] = bad_match_error_msg
888
889class bad_request_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -0700890 version = 4
891 type = 1
892 err_type = 1
893
894 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -0800895 if xid != None:
896 self.xid = xid
897 else:
898 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -0700899 if code != None:
900 self.code = code
901 else:
902 self.code = 0
903 if data != None:
904 self.data = data
905 else:
906 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -0800907 return
Rich Lane6f4978c2013-10-20 21:33:52 -0700908
909 def pack(self):
910 packed = []
911 packed.append(struct.pack("!B", self.version))
912 packed.append(struct.pack("!B", self.type))
913 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
914 packed.append(struct.pack("!L", self.xid))
915 packed.append(struct.pack("!H", self.err_type))
916 packed.append(struct.pack("!H", self.code))
917 packed.append(self.data)
918 length = sum([len(x) for x in packed])
919 packed[2] = struct.pack("!H", length)
920 return ''.join(packed)
921
922 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800923 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -0700924 obj = bad_request_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -0700925 _version = reader.read("!B")[0]
926 assert(_version == 4)
927 _type = reader.read("!B")[0]
928 assert(_type == 1)
929 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800930 orig_reader = reader
931 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -0700932 obj.xid = reader.read("!L")[0]
933 _err_type = reader.read("!H")[0]
934 assert(_err_type == 1)
935 obj.code = reader.read("!H")[0]
936 obj.data = str(reader.read_all())
937 return obj
938
939 def __eq__(self, other):
940 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -0700941 if self.xid != other.xid: return False
942 if self.code != other.code: return False
943 if self.data != other.data: return False
944 return True
945
Rich Lane6f4978c2013-10-20 21:33:52 -0700946 def pretty_print(self, q):
947 q.text("bad_request_error_msg {")
948 with q.group():
949 with q.indent(2):
950 q.breakable()
951 q.text("xid = ");
952 if self.xid != None:
953 q.text("%#x" % self.xid)
954 else:
955 q.text('None')
956 q.text(","); q.breakable()
957 q.text("code = ");
958 q.text("%#x" % self.code)
959 q.text(","); q.breakable()
960 q.text("data = ");
961 q.pp(self.data)
962 q.breakable()
963 q.text('}')
964
Rich Lane7dcdf022013-12-11 14:45:27 -0800965error_msg.subtypes[1] = bad_request_error_msg
966
967class barrier_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -0700968 version = 4
969 type = 21
Rich Lanec2ee4b82013-04-24 17:12:38 -0700970
971 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -0800972 if xid != None:
973 self.xid = xid
974 else:
975 self.xid = None
976 return
Rich Lanec2ee4b82013-04-24 17:12:38 -0700977
978 def pack(self):
979 packed = []
980 packed.append(struct.pack("!B", self.version))
981 packed.append(struct.pack("!B", self.type))
982 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
983 packed.append(struct.pack("!L", self.xid))
984 length = sum([len(x) for x in packed])
985 packed[2] = struct.pack("!H", length)
986 return ''.join(packed)
987
988 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800989 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700990 obj = barrier_reply()
Dan Talaycof6202252013-07-02 01:00:29 -0700991 _version = reader.read("!B")[0]
992 assert(_version == 4)
993 _type = reader.read("!B")[0]
994 assert(_type == 21)
995 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800996 orig_reader = reader
997 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700998 obj.xid = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700999 return obj
1000
1001 def __eq__(self, other):
1002 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07001003 if self.xid != other.xid: return False
1004 return True
1005
Rich Lanec2ee4b82013-04-24 17:12:38 -07001006 def pretty_print(self, q):
1007 q.text("barrier_reply {")
1008 with q.group():
1009 with q.indent(2):
1010 q.breakable()
1011 q.text("xid = ");
1012 if self.xid != None:
1013 q.text("%#x" % self.xid)
1014 else:
1015 q.text('None')
1016 q.breakable()
1017 q.text('}')
1018
Rich Lane7dcdf022013-12-11 14:45:27 -08001019message.subtypes[21] = barrier_reply
1020
1021class barrier_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -07001022 version = 4
1023 type = 20
Rich Lanec2ee4b82013-04-24 17:12:38 -07001024
1025 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001026 if xid != None:
1027 self.xid = xid
1028 else:
1029 self.xid = None
1030 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07001031
1032 def pack(self):
1033 packed = []
1034 packed.append(struct.pack("!B", self.version))
1035 packed.append(struct.pack("!B", self.type))
1036 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1037 packed.append(struct.pack("!L", self.xid))
1038 length = sum([len(x) for x in packed])
1039 packed[2] = struct.pack("!H", length)
1040 return ''.join(packed)
1041
1042 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001043 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001044 obj = barrier_request()
Dan Talaycof6202252013-07-02 01:00:29 -07001045 _version = reader.read("!B")[0]
1046 assert(_version == 4)
1047 _type = reader.read("!B")[0]
1048 assert(_type == 20)
1049 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001050 orig_reader = reader
1051 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001052 obj.xid = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001053 return obj
1054
1055 def __eq__(self, other):
1056 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07001057 if self.xid != other.xid: return False
1058 return True
1059
Rich Lanec2ee4b82013-04-24 17:12:38 -07001060 def pretty_print(self, q):
1061 q.text("barrier_request {")
1062 with q.group():
1063 with q.indent(2):
1064 q.breakable()
1065 q.text("xid = ");
1066 if self.xid != None:
1067 q.text("%#x" % self.xid)
1068 else:
1069 q.text('None')
1070 q.breakable()
1071 q.text('}')
1072
Rich Lane7dcdf022013-12-11 14:45:27 -08001073message.subtypes[20] = barrier_request
1074
1075class experimenter(message):
1076 subtypes = {}
1077
1078 @staticmethod
1079 def unpack(reader):
1080 subtype, = reader.peek('!L', 8)
1081 try:
1082 subclass = experimenter.subtypes[subtype]
1083 except KeyError:
1084 raise loxi.ProtocolError("unknown experimenter message subtype %#x" % subtype)
1085 return subclass.unpack(reader)
1086
1087message.subtypes[4] = experimenter
1088
1089class bsn_header(experimenter):
1090 subtypes = {}
1091
1092 @staticmethod
1093 def unpack(reader):
1094 subtype, = reader.peek('!L', 12)
1095 try:
1096 subclass = bsn_header.subtypes[subtype]
1097 except KeyError:
1098 raise loxi.ProtocolError("unknown bsn_header experimenter message subtype %#x" % subtype)
1099 return subclass.unpack(reader)
1100
1101experimenter.subtypes[6035143] = bsn_header
1102
1103class bsn_bw_clear_data_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001104 version = 4
1105 type = 4
1106 experimenter = 6035143
1107 subtype = 22
1108
1109 def __init__(self, xid=None, status=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001110 if xid != None:
1111 self.xid = xid
1112 else:
1113 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07001114 if status != None:
1115 self.status = status
1116 else:
1117 self.status = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08001118 return
Dan Talaycof6202252013-07-02 01:00:29 -07001119
1120 def pack(self):
1121 packed = []
1122 packed.append(struct.pack("!B", self.version))
1123 packed.append(struct.pack("!B", self.type))
1124 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1125 packed.append(struct.pack("!L", self.xid))
1126 packed.append(struct.pack("!L", self.experimenter))
1127 packed.append(struct.pack("!L", self.subtype))
1128 packed.append(struct.pack("!L", self.status))
1129 length = sum([len(x) for x in packed])
1130 packed[2] = struct.pack("!H", length)
1131 return ''.join(packed)
1132
1133 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001134 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07001135 obj = bsn_bw_clear_data_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07001136 _version = reader.read("!B")[0]
1137 assert(_version == 4)
1138 _type = reader.read("!B")[0]
1139 assert(_type == 4)
1140 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001141 orig_reader = reader
1142 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001143 obj.xid = reader.read("!L")[0]
1144 _experimenter = reader.read("!L")[0]
1145 assert(_experimenter == 6035143)
1146 _subtype = reader.read("!L")[0]
1147 assert(_subtype == 22)
1148 obj.status = reader.read("!L")[0]
1149 return obj
1150
1151 def __eq__(self, other):
1152 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07001153 if self.xid != other.xid: return False
1154 if self.status != other.status: return False
1155 return True
1156
Dan Talaycof6202252013-07-02 01:00:29 -07001157 def pretty_print(self, q):
1158 q.text("bsn_bw_clear_data_reply {")
1159 with q.group():
1160 with q.indent(2):
1161 q.breakable()
1162 q.text("xid = ");
1163 if self.xid != None:
1164 q.text("%#x" % self.xid)
1165 else:
1166 q.text('None')
1167 q.text(","); q.breakable()
1168 q.text("status = ");
1169 q.text("%#x" % self.status)
1170 q.breakable()
1171 q.text('}')
1172
Rich Lane7dcdf022013-12-11 14:45:27 -08001173bsn_header.subtypes[22] = bsn_bw_clear_data_reply
1174
1175class bsn_bw_clear_data_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001176 version = 4
1177 type = 4
1178 experimenter = 6035143
1179 subtype = 21
1180
1181 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001182 if xid != None:
1183 self.xid = xid
1184 else:
1185 self.xid = None
1186 return
Dan Talaycof6202252013-07-02 01:00:29 -07001187
1188 def pack(self):
1189 packed = []
1190 packed.append(struct.pack("!B", self.version))
1191 packed.append(struct.pack("!B", self.type))
1192 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1193 packed.append(struct.pack("!L", self.xid))
1194 packed.append(struct.pack("!L", self.experimenter))
1195 packed.append(struct.pack("!L", self.subtype))
1196 length = sum([len(x) for x in packed])
1197 packed[2] = struct.pack("!H", length)
1198 return ''.join(packed)
1199
1200 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001201 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07001202 obj = bsn_bw_clear_data_request()
Dan Talaycof6202252013-07-02 01:00:29 -07001203 _version = reader.read("!B")[0]
1204 assert(_version == 4)
1205 _type = reader.read("!B")[0]
1206 assert(_type == 4)
1207 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001208 orig_reader = reader
1209 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001210 obj.xid = reader.read("!L")[0]
1211 _experimenter = reader.read("!L")[0]
1212 assert(_experimenter == 6035143)
1213 _subtype = reader.read("!L")[0]
1214 assert(_subtype == 21)
1215 return obj
1216
1217 def __eq__(self, other):
1218 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07001219 if self.xid != other.xid: return False
1220 return True
1221
Dan Talaycof6202252013-07-02 01:00:29 -07001222 def pretty_print(self, q):
1223 q.text("bsn_bw_clear_data_request {")
1224 with q.group():
1225 with q.indent(2):
1226 q.breakable()
1227 q.text("xid = ");
1228 if self.xid != None:
1229 q.text("%#x" % self.xid)
1230 else:
1231 q.text('None')
1232 q.breakable()
1233 q.text('}')
1234
Rich Lane7dcdf022013-12-11 14:45:27 -08001235bsn_header.subtypes[21] = bsn_bw_clear_data_request
1236
1237class bsn_bw_enable_get_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001238 version = 4
1239 type = 4
1240 experimenter = 6035143
1241 subtype = 20
1242
1243 def __init__(self, xid=None, enabled=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001244 if xid != None:
1245 self.xid = xid
1246 else:
1247 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07001248 if enabled != None:
1249 self.enabled = enabled
1250 else:
1251 self.enabled = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08001252 return
Dan Talaycof6202252013-07-02 01:00:29 -07001253
1254 def pack(self):
1255 packed = []
1256 packed.append(struct.pack("!B", self.version))
1257 packed.append(struct.pack("!B", self.type))
1258 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1259 packed.append(struct.pack("!L", self.xid))
1260 packed.append(struct.pack("!L", self.experimenter))
1261 packed.append(struct.pack("!L", self.subtype))
1262 packed.append(struct.pack("!L", self.enabled))
1263 length = sum([len(x) for x in packed])
1264 packed[2] = struct.pack("!H", length)
1265 return ''.join(packed)
1266
1267 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001268 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07001269 obj = bsn_bw_enable_get_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07001270 _version = reader.read("!B")[0]
1271 assert(_version == 4)
1272 _type = reader.read("!B")[0]
1273 assert(_type == 4)
1274 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001275 orig_reader = reader
1276 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001277 obj.xid = reader.read("!L")[0]
1278 _experimenter = reader.read("!L")[0]
1279 assert(_experimenter == 6035143)
1280 _subtype = reader.read("!L")[0]
1281 assert(_subtype == 20)
1282 obj.enabled = reader.read("!L")[0]
1283 return obj
1284
1285 def __eq__(self, other):
1286 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07001287 if self.xid != other.xid: return False
1288 if self.enabled != other.enabled: return False
1289 return True
1290
Dan Talaycof6202252013-07-02 01:00:29 -07001291 def pretty_print(self, q):
1292 q.text("bsn_bw_enable_get_reply {")
1293 with q.group():
1294 with q.indent(2):
1295 q.breakable()
1296 q.text("xid = ");
1297 if self.xid != None:
1298 q.text("%#x" % self.xid)
1299 else:
1300 q.text('None')
1301 q.text(","); q.breakable()
1302 q.text("enabled = ");
1303 q.text("%#x" % self.enabled)
1304 q.breakable()
1305 q.text('}')
1306
Rich Lane7dcdf022013-12-11 14:45:27 -08001307bsn_header.subtypes[20] = bsn_bw_enable_get_reply
1308
1309class bsn_bw_enable_get_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001310 version = 4
1311 type = 4
1312 experimenter = 6035143
1313 subtype = 19
1314
1315 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001316 if xid != None:
1317 self.xid = xid
1318 else:
1319 self.xid = None
1320 return
Dan Talaycof6202252013-07-02 01:00:29 -07001321
1322 def pack(self):
1323 packed = []
1324 packed.append(struct.pack("!B", self.version))
1325 packed.append(struct.pack("!B", self.type))
1326 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1327 packed.append(struct.pack("!L", self.xid))
1328 packed.append(struct.pack("!L", self.experimenter))
1329 packed.append(struct.pack("!L", self.subtype))
1330 length = sum([len(x) for x in packed])
1331 packed[2] = struct.pack("!H", length)
1332 return ''.join(packed)
1333
1334 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001335 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07001336 obj = bsn_bw_enable_get_request()
Dan Talaycof6202252013-07-02 01:00:29 -07001337 _version = reader.read("!B")[0]
1338 assert(_version == 4)
1339 _type = reader.read("!B")[0]
1340 assert(_type == 4)
1341 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001342 orig_reader = reader
1343 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001344 obj.xid = reader.read("!L")[0]
1345 _experimenter = reader.read("!L")[0]
1346 assert(_experimenter == 6035143)
1347 _subtype = reader.read("!L")[0]
1348 assert(_subtype == 19)
1349 return obj
1350
1351 def __eq__(self, other):
1352 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07001353 if self.xid != other.xid: return False
1354 return True
1355
Dan Talaycof6202252013-07-02 01:00:29 -07001356 def pretty_print(self, q):
1357 q.text("bsn_bw_enable_get_request {")
1358 with q.group():
1359 with q.indent(2):
1360 q.breakable()
1361 q.text("xid = ");
1362 if self.xid != None:
1363 q.text("%#x" % self.xid)
1364 else:
1365 q.text('None')
1366 q.breakable()
1367 q.text('}')
1368
Rich Lane7dcdf022013-12-11 14:45:27 -08001369bsn_header.subtypes[19] = bsn_bw_enable_get_request
1370
1371class bsn_bw_enable_set_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001372 version = 4
1373 type = 4
1374 experimenter = 6035143
1375 subtype = 23
1376
1377 def __init__(self, xid=None, enable=None, status=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001378 if xid != None:
1379 self.xid = xid
1380 else:
1381 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07001382 if enable != None:
1383 self.enable = enable
1384 else:
1385 self.enable = 0
1386 if status != None:
1387 self.status = status
1388 else:
1389 self.status = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08001390 return
Dan Talaycof6202252013-07-02 01:00:29 -07001391
1392 def pack(self):
1393 packed = []
1394 packed.append(struct.pack("!B", self.version))
1395 packed.append(struct.pack("!B", self.type))
1396 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1397 packed.append(struct.pack("!L", self.xid))
1398 packed.append(struct.pack("!L", self.experimenter))
1399 packed.append(struct.pack("!L", self.subtype))
1400 packed.append(struct.pack("!L", self.enable))
1401 packed.append(struct.pack("!L", self.status))
1402 length = sum([len(x) for x in packed])
1403 packed[2] = struct.pack("!H", length)
1404 return ''.join(packed)
1405
1406 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001407 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07001408 obj = bsn_bw_enable_set_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07001409 _version = reader.read("!B")[0]
1410 assert(_version == 4)
1411 _type = reader.read("!B")[0]
1412 assert(_type == 4)
1413 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001414 orig_reader = reader
1415 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001416 obj.xid = reader.read("!L")[0]
1417 _experimenter = reader.read("!L")[0]
1418 assert(_experimenter == 6035143)
1419 _subtype = reader.read("!L")[0]
1420 assert(_subtype == 23)
1421 obj.enable = reader.read("!L")[0]
1422 obj.status = reader.read("!L")[0]
1423 return obj
1424
1425 def __eq__(self, other):
1426 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07001427 if self.xid != other.xid: return False
1428 if self.enable != other.enable: return False
1429 if self.status != other.status: return False
1430 return True
1431
Dan Talaycof6202252013-07-02 01:00:29 -07001432 def pretty_print(self, q):
1433 q.text("bsn_bw_enable_set_reply {")
1434 with q.group():
1435 with q.indent(2):
1436 q.breakable()
1437 q.text("xid = ");
1438 if self.xid != None:
1439 q.text("%#x" % self.xid)
1440 else:
1441 q.text('None')
1442 q.text(","); q.breakable()
1443 q.text("enable = ");
1444 q.text("%#x" % self.enable)
1445 q.text(","); q.breakable()
1446 q.text("status = ");
1447 q.text("%#x" % self.status)
1448 q.breakable()
1449 q.text('}')
1450
Rich Lane7dcdf022013-12-11 14:45:27 -08001451bsn_header.subtypes[23] = bsn_bw_enable_set_reply
1452
1453class bsn_bw_enable_set_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001454 version = 4
1455 type = 4
1456 experimenter = 6035143
1457 subtype = 18
1458
1459 def __init__(self, xid=None, enable=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001460 if xid != None:
1461 self.xid = xid
1462 else:
1463 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07001464 if enable != None:
1465 self.enable = enable
1466 else:
1467 self.enable = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08001468 return
Dan Talaycof6202252013-07-02 01:00:29 -07001469
1470 def pack(self):
1471 packed = []
1472 packed.append(struct.pack("!B", self.version))
1473 packed.append(struct.pack("!B", self.type))
1474 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1475 packed.append(struct.pack("!L", self.xid))
1476 packed.append(struct.pack("!L", self.experimenter))
1477 packed.append(struct.pack("!L", self.subtype))
1478 packed.append(struct.pack("!L", self.enable))
1479 length = sum([len(x) for x in packed])
1480 packed[2] = struct.pack("!H", length)
1481 return ''.join(packed)
1482
1483 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001484 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07001485 obj = bsn_bw_enable_set_request()
Dan Talaycof6202252013-07-02 01:00:29 -07001486 _version = reader.read("!B")[0]
1487 assert(_version == 4)
1488 _type = reader.read("!B")[0]
1489 assert(_type == 4)
1490 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001491 orig_reader = reader
1492 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001493 obj.xid = reader.read("!L")[0]
1494 _experimenter = reader.read("!L")[0]
1495 assert(_experimenter == 6035143)
1496 _subtype = reader.read("!L")[0]
1497 assert(_subtype == 18)
1498 obj.enable = reader.read("!L")[0]
1499 return obj
1500
1501 def __eq__(self, other):
1502 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07001503 if self.xid != other.xid: return False
1504 if self.enable != other.enable: return False
1505 return True
1506
Dan Talaycof6202252013-07-02 01:00:29 -07001507 def pretty_print(self, q):
1508 q.text("bsn_bw_enable_set_request {")
1509 with q.group():
1510 with q.indent(2):
1511 q.breakable()
1512 q.text("xid = ");
1513 if self.xid != None:
1514 q.text("%#x" % self.xid)
1515 else:
1516 q.text('None')
1517 q.text(","); q.breakable()
1518 q.text("enable = ");
1519 q.text("%#x" % self.enable)
1520 q.breakable()
1521 q.text('}')
1522
Rich Lane7dcdf022013-12-11 14:45:27 -08001523bsn_header.subtypes[18] = bsn_bw_enable_set_request
1524
1525class bsn_flow_idle(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07001526 version = 4
1527 type = 4
1528 experimenter = 6035143
1529 subtype = 40
1530
1531 def __init__(self, xid=None, cookie=None, priority=None, table_id=None, match=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001532 if xid != None:
1533 self.xid = xid
1534 else:
1535 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07001536 if cookie != None:
1537 self.cookie = cookie
1538 else:
1539 self.cookie = 0
1540 if priority != None:
1541 self.priority = priority
1542 else:
1543 self.priority = 0
1544 if table_id != None:
1545 self.table_id = table_id
1546 else:
1547 self.table_id = 0
1548 if match != None:
1549 self.match = match
1550 else:
1551 self.match = common.match()
Rich Lane7dcdf022013-12-11 14:45:27 -08001552 return
Rich Lane6f4978c2013-10-20 21:33:52 -07001553
1554 def pack(self):
1555 packed = []
1556 packed.append(struct.pack("!B", self.version))
1557 packed.append(struct.pack("!B", self.type))
1558 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1559 packed.append(struct.pack("!L", self.xid))
1560 packed.append(struct.pack("!L", self.experimenter))
1561 packed.append(struct.pack("!L", self.subtype))
1562 packed.append(struct.pack("!Q", self.cookie))
1563 packed.append(struct.pack("!H", self.priority))
1564 packed.append(struct.pack("!B", self.table_id))
1565 packed.append('\x00' * 5)
1566 packed.append(self.match.pack())
1567 length = sum([len(x) for x in packed])
1568 packed[2] = struct.pack("!H", length)
1569 return ''.join(packed)
1570
1571 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001572 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07001573 obj = bsn_flow_idle()
Rich Lane6f4978c2013-10-20 21:33:52 -07001574 _version = reader.read("!B")[0]
1575 assert(_version == 4)
1576 _type = reader.read("!B")[0]
1577 assert(_type == 4)
1578 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001579 orig_reader = reader
1580 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07001581 obj.xid = reader.read("!L")[0]
1582 _experimenter = reader.read("!L")[0]
1583 assert(_experimenter == 6035143)
1584 _subtype = reader.read("!L")[0]
1585 assert(_subtype == 40)
1586 obj.cookie = reader.read("!Q")[0]
1587 obj.priority = reader.read("!H")[0]
1588 obj.table_id = reader.read("!B")[0]
1589 reader.skip(5)
1590 obj.match = common.match.unpack(reader)
1591 return obj
1592
1593 def __eq__(self, other):
1594 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07001595 if self.xid != other.xid: return False
1596 if self.cookie != other.cookie: return False
1597 if self.priority != other.priority: return False
1598 if self.table_id != other.table_id: return False
1599 if self.match != other.match: return False
1600 return True
1601
Rich Lane6f4978c2013-10-20 21:33:52 -07001602 def pretty_print(self, q):
1603 q.text("bsn_flow_idle {")
1604 with q.group():
1605 with q.indent(2):
1606 q.breakable()
1607 q.text("xid = ");
1608 if self.xid != None:
1609 q.text("%#x" % self.xid)
1610 else:
1611 q.text('None')
1612 q.text(","); q.breakable()
1613 q.text("cookie = ");
1614 q.text("%#x" % self.cookie)
1615 q.text(","); q.breakable()
1616 q.text("priority = ");
1617 q.text("%#x" % self.priority)
1618 q.text(","); q.breakable()
1619 q.text("table_id = ");
1620 q.text("%#x" % self.table_id)
1621 q.text(","); q.breakable()
1622 q.text("match = ");
1623 q.pp(self.match)
1624 q.breakable()
1625 q.text('}')
1626
Rich Lane7dcdf022013-12-11 14:45:27 -08001627bsn_header.subtypes[40] = bsn_flow_idle
1628
1629class bsn_flow_idle_enable_get_reply(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07001630 version = 4
1631 type = 4
1632 experimenter = 6035143
1633 subtype = 39
1634
1635 def __init__(self, xid=None, enabled=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001636 if xid != None:
1637 self.xid = xid
1638 else:
1639 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07001640 if enabled != None:
1641 self.enabled = enabled
1642 else:
1643 self.enabled = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08001644 return
Rich Lane6f4978c2013-10-20 21:33:52 -07001645
1646 def pack(self):
1647 packed = []
1648 packed.append(struct.pack("!B", self.version))
1649 packed.append(struct.pack("!B", self.type))
1650 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1651 packed.append(struct.pack("!L", self.xid))
1652 packed.append(struct.pack("!L", self.experimenter))
1653 packed.append(struct.pack("!L", self.subtype))
1654 packed.append(struct.pack("!L", self.enabled))
1655 length = sum([len(x) for x in packed])
1656 packed[2] = struct.pack("!H", length)
1657 return ''.join(packed)
1658
1659 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001660 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07001661 obj = bsn_flow_idle_enable_get_reply()
Rich Lane6f4978c2013-10-20 21:33:52 -07001662 _version = reader.read("!B")[0]
1663 assert(_version == 4)
1664 _type = reader.read("!B")[0]
1665 assert(_type == 4)
1666 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001667 orig_reader = reader
1668 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07001669 obj.xid = reader.read("!L")[0]
1670 _experimenter = reader.read("!L")[0]
1671 assert(_experimenter == 6035143)
1672 _subtype = reader.read("!L")[0]
1673 assert(_subtype == 39)
1674 obj.enabled = reader.read("!L")[0]
1675 return obj
1676
1677 def __eq__(self, other):
1678 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07001679 if self.xid != other.xid: return False
1680 if self.enabled != other.enabled: return False
1681 return True
1682
Rich Lane6f4978c2013-10-20 21:33:52 -07001683 def pretty_print(self, q):
1684 q.text("bsn_flow_idle_enable_get_reply {")
1685 with q.group():
1686 with q.indent(2):
1687 q.breakable()
1688 q.text("xid = ");
1689 if self.xid != None:
1690 q.text("%#x" % self.xid)
1691 else:
1692 q.text('None')
1693 q.text(","); q.breakable()
1694 q.text("enabled = ");
1695 q.text("%#x" % self.enabled)
1696 q.breakable()
1697 q.text('}')
1698
Rich Lane7dcdf022013-12-11 14:45:27 -08001699bsn_header.subtypes[39] = bsn_flow_idle_enable_get_reply
1700
1701class bsn_flow_idle_enable_get_request(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07001702 version = 4
1703 type = 4
1704 experimenter = 6035143
1705 subtype = 38
1706
1707 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001708 if xid != None:
1709 self.xid = xid
1710 else:
1711 self.xid = None
1712 return
Rich Lane6f4978c2013-10-20 21:33:52 -07001713
1714 def pack(self):
1715 packed = []
1716 packed.append(struct.pack("!B", self.version))
1717 packed.append(struct.pack("!B", self.type))
1718 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1719 packed.append(struct.pack("!L", self.xid))
1720 packed.append(struct.pack("!L", self.experimenter))
1721 packed.append(struct.pack("!L", self.subtype))
1722 length = sum([len(x) for x in packed])
1723 packed[2] = struct.pack("!H", length)
1724 return ''.join(packed)
1725
1726 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001727 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07001728 obj = bsn_flow_idle_enable_get_request()
Rich Lane6f4978c2013-10-20 21:33:52 -07001729 _version = reader.read("!B")[0]
1730 assert(_version == 4)
1731 _type = reader.read("!B")[0]
1732 assert(_type == 4)
1733 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001734 orig_reader = reader
1735 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07001736 obj.xid = reader.read("!L")[0]
1737 _experimenter = reader.read("!L")[0]
1738 assert(_experimenter == 6035143)
1739 _subtype = reader.read("!L")[0]
1740 assert(_subtype == 38)
1741 return obj
1742
1743 def __eq__(self, other):
1744 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07001745 if self.xid != other.xid: return False
1746 return True
1747
Rich Lane6f4978c2013-10-20 21:33:52 -07001748 def pretty_print(self, q):
1749 q.text("bsn_flow_idle_enable_get_request {")
1750 with q.group():
1751 with q.indent(2):
1752 q.breakable()
1753 q.text("xid = ");
1754 if self.xid != None:
1755 q.text("%#x" % self.xid)
1756 else:
1757 q.text('None')
1758 q.breakable()
1759 q.text('}')
1760
Rich Lane7dcdf022013-12-11 14:45:27 -08001761bsn_header.subtypes[38] = bsn_flow_idle_enable_get_request
1762
1763class bsn_flow_idle_enable_set_reply(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07001764 version = 4
1765 type = 4
1766 experimenter = 6035143
1767 subtype = 37
1768
1769 def __init__(self, xid=None, enable=None, status=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001770 if xid != None:
1771 self.xid = xid
1772 else:
1773 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07001774 if enable != None:
1775 self.enable = enable
1776 else:
1777 self.enable = 0
1778 if status != None:
1779 self.status = status
1780 else:
1781 self.status = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08001782 return
Rich Lane6f4978c2013-10-20 21:33:52 -07001783
1784 def pack(self):
1785 packed = []
1786 packed.append(struct.pack("!B", self.version))
1787 packed.append(struct.pack("!B", self.type))
1788 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1789 packed.append(struct.pack("!L", self.xid))
1790 packed.append(struct.pack("!L", self.experimenter))
1791 packed.append(struct.pack("!L", self.subtype))
1792 packed.append(struct.pack("!L", self.enable))
1793 packed.append(struct.pack("!L", self.status))
1794 length = sum([len(x) for x in packed])
1795 packed[2] = struct.pack("!H", length)
1796 return ''.join(packed)
1797
1798 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001799 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07001800 obj = bsn_flow_idle_enable_set_reply()
Rich Lane6f4978c2013-10-20 21:33:52 -07001801 _version = reader.read("!B")[0]
1802 assert(_version == 4)
1803 _type = reader.read("!B")[0]
1804 assert(_type == 4)
1805 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001806 orig_reader = reader
1807 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07001808 obj.xid = reader.read("!L")[0]
1809 _experimenter = reader.read("!L")[0]
1810 assert(_experimenter == 6035143)
1811 _subtype = reader.read("!L")[0]
1812 assert(_subtype == 37)
1813 obj.enable = reader.read("!L")[0]
1814 obj.status = reader.read("!L")[0]
1815 return obj
1816
1817 def __eq__(self, other):
1818 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07001819 if self.xid != other.xid: return False
1820 if self.enable != other.enable: return False
1821 if self.status != other.status: return False
1822 return True
1823
Rich Lane6f4978c2013-10-20 21:33:52 -07001824 def pretty_print(self, q):
1825 q.text("bsn_flow_idle_enable_set_reply {")
1826 with q.group():
1827 with q.indent(2):
1828 q.breakable()
1829 q.text("xid = ");
1830 if self.xid != None:
1831 q.text("%#x" % self.xid)
1832 else:
1833 q.text('None')
1834 q.text(","); q.breakable()
1835 q.text("enable = ");
1836 q.text("%#x" % self.enable)
1837 q.text(","); q.breakable()
1838 q.text("status = ");
1839 q.text("%#x" % self.status)
1840 q.breakable()
1841 q.text('}')
1842
Rich Lane7dcdf022013-12-11 14:45:27 -08001843bsn_header.subtypes[37] = bsn_flow_idle_enable_set_reply
1844
1845class bsn_flow_idle_enable_set_request(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07001846 version = 4
1847 type = 4
1848 experimenter = 6035143
1849 subtype = 36
1850
1851 def __init__(self, xid=None, enable=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001852 if xid != None:
1853 self.xid = xid
1854 else:
1855 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07001856 if enable != None:
1857 self.enable = enable
1858 else:
1859 self.enable = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08001860 return
Rich Lane6f4978c2013-10-20 21:33:52 -07001861
1862 def pack(self):
1863 packed = []
1864 packed.append(struct.pack("!B", self.version))
1865 packed.append(struct.pack("!B", self.type))
1866 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1867 packed.append(struct.pack("!L", self.xid))
1868 packed.append(struct.pack("!L", self.experimenter))
1869 packed.append(struct.pack("!L", self.subtype))
1870 packed.append(struct.pack("!L", self.enable))
1871 length = sum([len(x) for x in packed])
1872 packed[2] = struct.pack("!H", length)
1873 return ''.join(packed)
1874
1875 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001876 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07001877 obj = bsn_flow_idle_enable_set_request()
Rich Lane6f4978c2013-10-20 21:33:52 -07001878 _version = reader.read("!B")[0]
1879 assert(_version == 4)
1880 _type = reader.read("!B")[0]
1881 assert(_type == 4)
1882 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001883 orig_reader = reader
1884 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07001885 obj.xid = reader.read("!L")[0]
1886 _experimenter = reader.read("!L")[0]
1887 assert(_experimenter == 6035143)
1888 _subtype = reader.read("!L")[0]
1889 assert(_subtype == 36)
1890 obj.enable = reader.read("!L")[0]
1891 return obj
1892
1893 def __eq__(self, other):
1894 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07001895 if self.xid != other.xid: return False
1896 if self.enable != other.enable: return False
1897 return True
1898
Rich Lane6f4978c2013-10-20 21:33:52 -07001899 def pretty_print(self, q):
1900 q.text("bsn_flow_idle_enable_set_request {")
1901 with q.group():
1902 with q.indent(2):
1903 q.breakable()
1904 q.text("xid = ");
1905 if self.xid != None:
1906 q.text("%#x" % self.xid)
1907 else:
1908 q.text('None')
1909 q.text(","); q.breakable()
1910 q.text("enable = ");
1911 q.text("%#x" % self.enable)
1912 q.breakable()
1913 q.text('}')
1914
Rich Lane7dcdf022013-12-11 14:45:27 -08001915bsn_header.subtypes[36] = bsn_flow_idle_enable_set_request
1916
1917class bsn_get_interfaces_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001918 version = 4
1919 type = 4
1920 experimenter = 6035143
Rich Lanec2ee4b82013-04-24 17:12:38 -07001921 subtype = 10
1922
1923 def __init__(self, xid=None, interfaces=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001924 if xid != None:
1925 self.xid = xid
1926 else:
1927 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07001928 if interfaces != None:
1929 self.interfaces = interfaces
1930 else:
1931 self.interfaces = []
Rich Lane7dcdf022013-12-11 14:45:27 -08001932 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07001933
1934 def pack(self):
1935 packed = []
1936 packed.append(struct.pack("!B", self.version))
1937 packed.append(struct.pack("!B", self.type))
1938 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1939 packed.append(struct.pack("!L", self.xid))
1940 packed.append(struct.pack("!L", self.experimenter))
1941 packed.append(struct.pack("!L", self.subtype))
Rich Lane7dcdf022013-12-11 14:45:27 -08001942 packed.append(loxi.generic_util.pack_list(self.interfaces))
Rich Lanec2ee4b82013-04-24 17:12:38 -07001943 length = sum([len(x) for x in packed])
1944 packed[2] = struct.pack("!H", length)
1945 return ''.join(packed)
1946
1947 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001948 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001949 obj = bsn_get_interfaces_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07001950 _version = reader.read("!B")[0]
1951 assert(_version == 4)
1952 _type = reader.read("!B")[0]
1953 assert(_type == 4)
1954 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001955 orig_reader = reader
1956 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001957 obj.xid = reader.read("!L")[0]
1958 _experimenter = reader.read("!L")[0]
1959 assert(_experimenter == 6035143)
1960 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001961 assert(_subtype == 10)
1962 obj.interfaces = loxi.generic_util.unpack_list(reader, common.bsn_interface.unpack)
1963 return obj
1964
1965 def __eq__(self, other):
1966 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07001967 if self.xid != other.xid: return False
1968 if self.interfaces != other.interfaces: return False
1969 return True
1970
Rich Lanec2ee4b82013-04-24 17:12:38 -07001971 def pretty_print(self, q):
1972 q.text("bsn_get_interfaces_reply {")
1973 with q.group():
1974 with q.indent(2):
1975 q.breakable()
1976 q.text("xid = ");
1977 if self.xid != None:
1978 q.text("%#x" % self.xid)
1979 else:
1980 q.text('None')
1981 q.text(","); q.breakable()
1982 q.text("interfaces = ");
1983 q.pp(self.interfaces)
1984 q.breakable()
1985 q.text('}')
1986
Rich Lane7dcdf022013-12-11 14:45:27 -08001987bsn_header.subtypes[10] = bsn_get_interfaces_reply
1988
1989class bsn_get_interfaces_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001990 version = 4
1991 type = 4
1992 experimenter = 6035143
Rich Lanec2ee4b82013-04-24 17:12:38 -07001993 subtype = 9
1994
1995 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001996 if xid != None:
1997 self.xid = xid
1998 else:
1999 self.xid = None
2000 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07002001
2002 def pack(self):
2003 packed = []
2004 packed.append(struct.pack("!B", self.version))
2005 packed.append(struct.pack("!B", self.type))
2006 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2007 packed.append(struct.pack("!L", self.xid))
2008 packed.append(struct.pack("!L", self.experimenter))
2009 packed.append(struct.pack("!L", self.subtype))
2010 length = sum([len(x) for x in packed])
2011 packed[2] = struct.pack("!H", length)
2012 return ''.join(packed)
2013
2014 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002015 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07002016 obj = bsn_get_interfaces_request()
Dan Talaycof6202252013-07-02 01:00:29 -07002017 _version = reader.read("!B")[0]
2018 assert(_version == 4)
2019 _type = reader.read("!B")[0]
2020 assert(_type == 4)
2021 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002022 orig_reader = reader
2023 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07002024 obj.xid = reader.read("!L")[0]
2025 _experimenter = reader.read("!L")[0]
2026 assert(_experimenter == 6035143)
2027 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07002028 assert(_subtype == 9)
2029 return obj
2030
2031 def __eq__(self, other):
2032 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07002033 if self.xid != other.xid: return False
2034 return True
2035
Rich Lanec2ee4b82013-04-24 17:12:38 -07002036 def pretty_print(self, q):
2037 q.text("bsn_get_interfaces_request {")
2038 with q.group():
2039 with q.indent(2):
2040 q.breakable()
2041 q.text("xid = ");
2042 if self.xid != None:
2043 q.text("%#x" % self.xid)
2044 else:
2045 q.text('None')
2046 q.breakable()
2047 q.text('}')
2048
Rich Lane7dcdf022013-12-11 14:45:27 -08002049bsn_header.subtypes[9] = bsn_get_interfaces_request
2050
2051class bsn_get_mirroring_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07002052 version = 4
2053 type = 4
2054 experimenter = 6035143
Rich Lanec2ee4b82013-04-24 17:12:38 -07002055 subtype = 5
2056
2057 def __init__(self, xid=None, report_mirror_ports=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002058 if xid != None:
2059 self.xid = xid
2060 else:
2061 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07002062 if report_mirror_ports != None:
2063 self.report_mirror_ports = report_mirror_ports
2064 else:
2065 self.report_mirror_ports = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08002066 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07002067
2068 def pack(self):
2069 packed = []
2070 packed.append(struct.pack("!B", self.version))
2071 packed.append(struct.pack("!B", self.type))
2072 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2073 packed.append(struct.pack("!L", self.xid))
2074 packed.append(struct.pack("!L", self.experimenter))
2075 packed.append(struct.pack("!L", self.subtype))
2076 packed.append(struct.pack("!B", self.report_mirror_ports))
2077 packed.append('\x00' * 3)
2078 length = sum([len(x) for x in packed])
2079 packed[2] = struct.pack("!H", length)
2080 return ''.join(packed)
2081
2082 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002083 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07002084 obj = bsn_get_mirroring_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07002085 _version = reader.read("!B")[0]
2086 assert(_version == 4)
2087 _type = reader.read("!B")[0]
2088 assert(_type == 4)
2089 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002090 orig_reader = reader
2091 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07002092 obj.xid = reader.read("!L")[0]
2093 _experimenter = reader.read("!L")[0]
2094 assert(_experimenter == 6035143)
2095 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07002096 assert(_subtype == 5)
Dan Talaycof6202252013-07-02 01:00:29 -07002097 obj.report_mirror_ports = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07002098 reader.skip(3)
2099 return obj
2100
2101 def __eq__(self, other):
2102 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07002103 if self.xid != other.xid: return False
2104 if self.report_mirror_ports != other.report_mirror_ports: return False
2105 return True
2106
Rich Lanec2ee4b82013-04-24 17:12:38 -07002107 def pretty_print(self, q):
2108 q.text("bsn_get_mirroring_reply {")
2109 with q.group():
2110 with q.indent(2):
2111 q.breakable()
2112 q.text("xid = ");
2113 if self.xid != None:
2114 q.text("%#x" % self.xid)
2115 else:
2116 q.text('None')
2117 q.text(","); q.breakable()
2118 q.text("report_mirror_ports = ");
2119 q.text("%#x" % self.report_mirror_ports)
2120 q.breakable()
2121 q.text('}')
2122
Rich Lane7dcdf022013-12-11 14:45:27 -08002123bsn_header.subtypes[5] = bsn_get_mirroring_reply
2124
2125class bsn_get_mirroring_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07002126 version = 4
2127 type = 4
2128 experimenter = 6035143
Rich Lanec2ee4b82013-04-24 17:12:38 -07002129 subtype = 4
2130
2131 def __init__(self, xid=None, report_mirror_ports=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002132 if xid != None:
2133 self.xid = xid
2134 else:
2135 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07002136 if report_mirror_ports != None:
2137 self.report_mirror_ports = report_mirror_ports
2138 else:
2139 self.report_mirror_ports = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08002140 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07002141
2142 def pack(self):
2143 packed = []
2144 packed.append(struct.pack("!B", self.version))
2145 packed.append(struct.pack("!B", self.type))
2146 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2147 packed.append(struct.pack("!L", self.xid))
2148 packed.append(struct.pack("!L", self.experimenter))
2149 packed.append(struct.pack("!L", self.subtype))
2150 packed.append(struct.pack("!B", self.report_mirror_ports))
2151 packed.append('\x00' * 3)
2152 length = sum([len(x) for x in packed])
2153 packed[2] = struct.pack("!H", length)
2154 return ''.join(packed)
2155
2156 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002157 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07002158 obj = bsn_get_mirroring_request()
Dan Talaycof6202252013-07-02 01:00:29 -07002159 _version = reader.read("!B")[0]
2160 assert(_version == 4)
2161 _type = reader.read("!B")[0]
2162 assert(_type == 4)
2163 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002164 orig_reader = reader
2165 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07002166 obj.xid = reader.read("!L")[0]
2167 _experimenter = reader.read("!L")[0]
2168 assert(_experimenter == 6035143)
2169 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07002170 assert(_subtype == 4)
Dan Talaycof6202252013-07-02 01:00:29 -07002171 obj.report_mirror_ports = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07002172 reader.skip(3)
2173 return obj
2174
2175 def __eq__(self, other):
2176 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07002177 if self.xid != other.xid: return False
2178 if self.report_mirror_ports != other.report_mirror_ports: return False
2179 return True
2180
Rich Lanec2ee4b82013-04-24 17:12:38 -07002181 def pretty_print(self, q):
2182 q.text("bsn_get_mirroring_request {")
2183 with q.group():
2184 with q.indent(2):
2185 q.breakable()
2186 q.text("xid = ");
2187 if self.xid != None:
2188 q.text("%#x" % self.xid)
2189 else:
2190 q.text('None')
2191 q.text(","); q.breakable()
2192 q.text("report_mirror_ports = ");
2193 q.text("%#x" % self.report_mirror_ports)
2194 q.breakable()
2195 q.text('}')
2196
Rich Lane7dcdf022013-12-11 14:45:27 -08002197bsn_header.subtypes[4] = bsn_get_mirroring_request
2198
2199class bsn_get_switch_pipeline_reply(bsn_header):
2200 version = 4
2201 type = 4
2202 experimenter = 6035143
2203 subtype = 52
2204
2205 def __init__(self, xid=None, pipeline=None):
2206 if xid != None:
2207 self.xid = xid
2208 else:
2209 self.xid = None
2210 if pipeline != None:
2211 self.pipeline = pipeline
2212 else:
2213 self.pipeline = ""
2214 return
2215
2216 def pack(self):
2217 packed = []
2218 packed.append(struct.pack("!B", self.version))
2219 packed.append(struct.pack("!B", self.type))
2220 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2221 packed.append(struct.pack("!L", self.xid))
2222 packed.append(struct.pack("!L", self.experimenter))
2223 packed.append(struct.pack("!L", self.subtype))
2224 packed.append(struct.pack("!256s", self.pipeline))
2225 length = sum([len(x) for x in packed])
2226 packed[2] = struct.pack("!H", length)
2227 return ''.join(packed)
2228
2229 @staticmethod
2230 def unpack(reader):
2231 obj = bsn_get_switch_pipeline_reply()
2232 _version = reader.read("!B")[0]
2233 assert(_version == 4)
2234 _type = reader.read("!B")[0]
2235 assert(_type == 4)
2236 _length = reader.read("!H")[0]
2237 orig_reader = reader
2238 reader = orig_reader.slice(_length - (2 + 2))
2239 obj.xid = reader.read("!L")[0]
2240 _experimenter = reader.read("!L")[0]
2241 assert(_experimenter == 6035143)
2242 _subtype = reader.read("!L")[0]
2243 assert(_subtype == 52)
2244 obj.pipeline = reader.read("!256s")[0].rstrip("\x00")
2245 return obj
2246
2247 def __eq__(self, other):
2248 if type(self) != type(other): return False
2249 if self.xid != other.xid: return False
2250 if self.pipeline != other.pipeline: return False
2251 return True
2252
2253 def pretty_print(self, q):
2254 q.text("bsn_get_switch_pipeline_reply {")
2255 with q.group():
2256 with q.indent(2):
2257 q.breakable()
2258 q.text("xid = ");
2259 if self.xid != None:
2260 q.text("%#x" % self.xid)
2261 else:
2262 q.text('None')
2263 q.text(","); q.breakable()
2264 q.text("pipeline = ");
2265 q.pp(self.pipeline)
2266 q.breakable()
2267 q.text('}')
2268
2269bsn_header.subtypes[52] = bsn_get_switch_pipeline_reply
2270
2271class bsn_get_switch_pipeline_request(bsn_header):
2272 version = 4
2273 type = 4
2274 experimenter = 6035143
2275 subtype = 51
2276
2277 def __init__(self, xid=None):
2278 if xid != None:
2279 self.xid = xid
2280 else:
2281 self.xid = None
2282 return
2283
2284 def pack(self):
2285 packed = []
2286 packed.append(struct.pack("!B", self.version))
2287 packed.append(struct.pack("!B", self.type))
2288 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2289 packed.append(struct.pack("!L", self.xid))
2290 packed.append(struct.pack("!L", self.experimenter))
2291 packed.append(struct.pack("!L", self.subtype))
2292 length = sum([len(x) for x in packed])
2293 packed[2] = struct.pack("!H", length)
2294 return ''.join(packed)
2295
2296 @staticmethod
2297 def unpack(reader):
2298 obj = bsn_get_switch_pipeline_request()
2299 _version = reader.read("!B")[0]
2300 assert(_version == 4)
2301 _type = reader.read("!B")[0]
2302 assert(_type == 4)
2303 _length = reader.read("!H")[0]
2304 orig_reader = reader
2305 reader = orig_reader.slice(_length - (2 + 2))
2306 obj.xid = reader.read("!L")[0]
2307 _experimenter = reader.read("!L")[0]
2308 assert(_experimenter == 6035143)
2309 _subtype = reader.read("!L")[0]
2310 assert(_subtype == 51)
2311 return obj
2312
2313 def __eq__(self, other):
2314 if type(self) != type(other): return False
2315 if self.xid != other.xid: return False
2316 return True
2317
2318 def pretty_print(self, q):
2319 q.text("bsn_get_switch_pipeline_request {")
2320 with q.group():
2321 with q.indent(2):
2322 q.breakable()
2323 q.text("xid = ");
2324 if self.xid != None:
2325 q.text("%#x" % self.xid)
2326 else:
2327 q.text('None')
2328 q.breakable()
2329 q.text('}')
2330
2331bsn_header.subtypes[51] = bsn_get_switch_pipeline_request
2332
2333class bsn_lacp_convergence_notif(bsn_header):
Rich Lane7b0f2012013-11-22 14:15:26 -08002334 version = 4
2335 type = 4
2336 experimenter = 6035143
2337 subtype = 43
2338
2339 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 -08002340 if xid != None:
2341 self.xid = xid
2342 else:
2343 self.xid = None
Rich Lane7b0f2012013-11-22 14:15:26 -08002344 if convergence_status != None:
2345 self.convergence_status = convergence_status
2346 else:
2347 self.convergence_status = 0
2348 if port_no != None:
2349 self.port_no = port_no
2350 else:
2351 self.port_no = 0
2352 if actor_sys_priority != None:
2353 self.actor_sys_priority = actor_sys_priority
2354 else:
2355 self.actor_sys_priority = 0
2356 if actor_sys_mac != None:
2357 self.actor_sys_mac = actor_sys_mac
2358 else:
2359 self.actor_sys_mac = [0,0,0,0,0,0]
2360 if actor_port_priority != None:
2361 self.actor_port_priority = actor_port_priority
2362 else:
2363 self.actor_port_priority = 0
2364 if actor_port_num != None:
2365 self.actor_port_num = actor_port_num
2366 else:
2367 self.actor_port_num = 0
2368 if actor_key != None:
2369 self.actor_key = actor_key
2370 else:
2371 self.actor_key = 0
2372 if partner_sys_priority != None:
2373 self.partner_sys_priority = partner_sys_priority
2374 else:
2375 self.partner_sys_priority = 0
2376 if partner_sys_mac != None:
2377 self.partner_sys_mac = partner_sys_mac
2378 else:
2379 self.partner_sys_mac = [0,0,0,0,0,0]
2380 if partner_port_priority != None:
2381 self.partner_port_priority = partner_port_priority
2382 else:
2383 self.partner_port_priority = 0
2384 if partner_port_num != None:
2385 self.partner_port_num = partner_port_num
2386 else:
2387 self.partner_port_num = 0
2388 if partner_key != None:
2389 self.partner_key = partner_key
2390 else:
2391 self.partner_key = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08002392 return
Rich Lane7b0f2012013-11-22 14:15:26 -08002393
2394 def pack(self):
2395 packed = []
2396 packed.append(struct.pack("!B", self.version))
2397 packed.append(struct.pack("!B", self.type))
2398 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2399 packed.append(struct.pack("!L", self.xid))
2400 packed.append(struct.pack("!L", self.experimenter))
2401 packed.append(struct.pack("!L", self.subtype))
2402 packed.append(struct.pack("!B", self.convergence_status))
2403 packed.append('\x00' * 3)
2404 packed.append(util.pack_port_no(self.port_no))
2405 packed.append(struct.pack("!H", self.actor_sys_priority))
2406 packed.append(struct.pack("!6B", *self.actor_sys_mac))
2407 packed.append(struct.pack("!H", self.actor_port_priority))
2408 packed.append(struct.pack("!H", self.actor_port_num))
2409 packed.append(struct.pack("!H", self.actor_key))
2410 packed.append(struct.pack("!H", self.partner_sys_priority))
2411 packed.append(struct.pack("!6B", *self.partner_sys_mac))
2412 packed.append(struct.pack("!H", self.partner_port_priority))
2413 packed.append(struct.pack("!H", self.partner_port_num))
2414 packed.append(struct.pack("!H", self.partner_key))
2415 length = sum([len(x) for x in packed])
2416 packed[2] = struct.pack("!H", length)
2417 return ''.join(packed)
2418
2419 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002420 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -08002421 obj = bsn_lacp_convergence_notif()
Rich Lane7b0f2012013-11-22 14:15:26 -08002422 _version = reader.read("!B")[0]
2423 assert(_version == 4)
2424 _type = reader.read("!B")[0]
2425 assert(_type == 4)
2426 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002427 orig_reader = reader
2428 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane7b0f2012013-11-22 14:15:26 -08002429 obj.xid = reader.read("!L")[0]
2430 _experimenter = reader.read("!L")[0]
2431 assert(_experimenter == 6035143)
2432 _subtype = reader.read("!L")[0]
2433 assert(_subtype == 43)
2434 obj.convergence_status = reader.read("!B")[0]
2435 reader.skip(3)
2436 obj.port_no = util.unpack_port_no(reader)
2437 obj.actor_sys_priority = reader.read("!H")[0]
2438 obj.actor_sys_mac = list(reader.read('!6B'))
2439 obj.actor_port_priority = reader.read("!H")[0]
2440 obj.actor_port_num = reader.read("!H")[0]
2441 obj.actor_key = reader.read("!H")[0]
2442 obj.partner_sys_priority = reader.read("!H")[0]
2443 obj.partner_sys_mac = list(reader.read('!6B'))
2444 obj.partner_port_priority = reader.read("!H")[0]
2445 obj.partner_port_num = reader.read("!H")[0]
2446 obj.partner_key = reader.read("!H")[0]
2447 return obj
2448
2449 def __eq__(self, other):
2450 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -08002451 if self.xid != other.xid: return False
2452 if self.convergence_status != other.convergence_status: return False
2453 if self.port_no != other.port_no: return False
2454 if self.actor_sys_priority != other.actor_sys_priority: return False
2455 if self.actor_sys_mac != other.actor_sys_mac: return False
2456 if self.actor_port_priority != other.actor_port_priority: return False
2457 if self.actor_port_num != other.actor_port_num: return False
2458 if self.actor_key != other.actor_key: return False
2459 if self.partner_sys_priority != other.partner_sys_priority: return False
2460 if self.partner_sys_mac != other.partner_sys_mac: return False
2461 if self.partner_port_priority != other.partner_port_priority: return False
2462 if self.partner_port_num != other.partner_port_num: return False
2463 if self.partner_key != other.partner_key: return False
2464 return True
2465
Rich Lane7b0f2012013-11-22 14:15:26 -08002466 def pretty_print(self, q):
2467 q.text("bsn_lacp_convergence_notif {")
2468 with q.group():
2469 with q.indent(2):
2470 q.breakable()
2471 q.text("xid = ");
2472 if self.xid != None:
2473 q.text("%#x" % self.xid)
2474 else:
2475 q.text('None')
2476 q.text(","); q.breakable()
2477 q.text("convergence_status = ");
2478 q.text("%#x" % self.convergence_status)
2479 q.text(","); q.breakable()
2480 q.text("port_no = ");
2481 q.text(util.pretty_port(self.port_no))
2482 q.text(","); q.breakable()
2483 q.text("actor_sys_priority = ");
2484 q.text("%#x" % self.actor_sys_priority)
2485 q.text(","); q.breakable()
2486 q.text("actor_sys_mac = ");
2487 q.text(util.pretty_mac(self.actor_sys_mac))
2488 q.text(","); q.breakable()
2489 q.text("actor_port_priority = ");
2490 q.text("%#x" % self.actor_port_priority)
2491 q.text(","); q.breakable()
2492 q.text("actor_port_num = ");
2493 q.text("%#x" % self.actor_port_num)
2494 q.text(","); q.breakable()
2495 q.text("actor_key = ");
2496 q.text("%#x" % self.actor_key)
2497 q.text(","); q.breakable()
2498 q.text("partner_sys_priority = ");
2499 q.text("%#x" % self.partner_sys_priority)
2500 q.text(","); q.breakable()
2501 q.text("partner_sys_mac = ");
2502 q.text(util.pretty_mac(self.partner_sys_mac))
2503 q.text(","); q.breakable()
2504 q.text("partner_port_priority = ");
2505 q.text("%#x" % self.partner_port_priority)
2506 q.text(","); q.breakable()
2507 q.text("partner_port_num = ");
2508 q.text("%#x" % self.partner_port_num)
2509 q.text(","); q.breakable()
2510 q.text("partner_key = ");
2511 q.text("%#x" % self.partner_key)
2512 q.breakable()
2513 q.text('}')
2514
Rich Lane7dcdf022013-12-11 14:45:27 -08002515bsn_header.subtypes[43] = bsn_lacp_convergence_notif
2516
2517class experimenter_stats_reply(stats_reply):
2518 subtypes = {}
2519
2520 @staticmethod
2521 def unpack(reader):
2522 subtype, = reader.peek('!L', 16)
2523 try:
2524 subclass = experimenter_stats_reply.subtypes[subtype]
2525 except KeyError:
2526 raise loxi.ProtocolError("unknown experimenter_stats_reply stats_reply message subtype %#x" % subtype)
2527 return subclass.unpack(reader)
2528
2529stats_reply.subtypes[65535] = experimenter_stats_reply
2530
2531class bsn_stats_reply(experimenter_stats_reply):
2532 subtypes = {}
2533
2534 @staticmethod
2535 def unpack(reader):
2536 subtype, = reader.peek('!L', 20)
2537 try:
2538 subclass = bsn_stats_reply.subtypes[subtype]
2539 except KeyError:
2540 raise loxi.ProtocolError("unknown bsn_stats_reply experimenter_stats_reply stats_reply message subtype %#x" % subtype)
2541 return subclass.unpack(reader)
2542
2543experimenter_stats_reply.subtypes[6035143] = bsn_stats_reply
2544
2545class bsn_lacp_stats_reply(bsn_stats_reply):
Rich Lane7b0f2012013-11-22 14:15:26 -08002546 version = 4
2547 type = 19
2548 stats_type = 65535
2549 experimenter = 6035143
2550 subtype = 1
2551
2552 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002553 if xid != None:
2554 self.xid = xid
2555 else:
2556 self.xid = None
Rich Lane7b0f2012013-11-22 14:15:26 -08002557 if flags != None:
2558 self.flags = flags
2559 else:
2560 self.flags = 0
2561 if entries != None:
2562 self.entries = entries
2563 else:
2564 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -08002565 return
Rich Lane7b0f2012013-11-22 14:15:26 -08002566
2567 def pack(self):
2568 packed = []
2569 packed.append(struct.pack("!B", self.version))
2570 packed.append(struct.pack("!B", self.type))
2571 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2572 packed.append(struct.pack("!L", self.xid))
2573 packed.append(struct.pack("!H", self.stats_type))
2574 packed.append(struct.pack("!H", self.flags))
2575 packed.append('\x00' * 4)
2576 packed.append(struct.pack("!L", self.experimenter))
2577 packed.append(struct.pack("!L", self.subtype))
Rich Lane7dcdf022013-12-11 14:45:27 -08002578 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lane7b0f2012013-11-22 14:15:26 -08002579 length = sum([len(x) for x in packed])
2580 packed[2] = struct.pack("!H", length)
2581 return ''.join(packed)
2582
2583 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002584 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -08002585 obj = bsn_lacp_stats_reply()
Rich Lane7b0f2012013-11-22 14:15:26 -08002586 _version = reader.read("!B")[0]
2587 assert(_version == 4)
2588 _type = reader.read("!B")[0]
2589 assert(_type == 19)
2590 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002591 orig_reader = reader
2592 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane7b0f2012013-11-22 14:15:26 -08002593 obj.xid = reader.read("!L")[0]
2594 _stats_type = reader.read("!H")[0]
2595 assert(_stats_type == 65535)
2596 obj.flags = reader.read("!H")[0]
2597 reader.skip(4)
2598 _experimenter = reader.read("!L")[0]
2599 assert(_experimenter == 6035143)
2600 _subtype = reader.read("!L")[0]
2601 assert(_subtype == 1)
2602 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_lacp_stats_entry.unpack)
2603 return obj
2604
2605 def __eq__(self, other):
2606 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -08002607 if self.xid != other.xid: return False
2608 if self.flags != other.flags: return False
2609 if self.entries != other.entries: return False
2610 return True
2611
Rich Lane7b0f2012013-11-22 14:15:26 -08002612 def pretty_print(self, q):
2613 q.text("bsn_lacp_stats_reply {")
2614 with q.group():
2615 with q.indent(2):
2616 q.breakable()
2617 q.text("xid = ");
2618 if self.xid != None:
2619 q.text("%#x" % self.xid)
2620 else:
2621 q.text('None')
2622 q.text(","); q.breakable()
2623 q.text("flags = ");
2624 q.text("%#x" % self.flags)
2625 q.text(","); q.breakable()
2626 q.text("entries = ");
2627 q.pp(self.entries)
2628 q.breakable()
2629 q.text('}')
2630
Rich Lane7dcdf022013-12-11 14:45:27 -08002631bsn_stats_reply.subtypes[1] = bsn_lacp_stats_reply
2632
2633class experimenter_stats_request(stats_request):
2634 subtypes = {}
2635
2636 @staticmethod
2637 def unpack(reader):
2638 subtype, = reader.peek('!L', 16)
2639 try:
2640 subclass = experimenter_stats_request.subtypes[subtype]
2641 except KeyError:
2642 raise loxi.ProtocolError("unknown experimenter_stats_request stats_request message subtype %#x" % subtype)
2643 return subclass.unpack(reader)
2644
2645stats_request.subtypes[65535] = experimenter_stats_request
2646
2647class bsn_stats_request(experimenter_stats_request):
2648 subtypes = {}
2649
2650 @staticmethod
2651 def unpack(reader):
2652 subtype, = reader.peek('!L', 20)
2653 try:
2654 subclass = bsn_stats_request.subtypes[subtype]
2655 except KeyError:
2656 raise loxi.ProtocolError("unknown bsn_stats_request experimenter_stats_request stats_request message subtype %#x" % subtype)
2657 return subclass.unpack(reader)
2658
2659experimenter_stats_request.subtypes[6035143] = bsn_stats_request
2660
2661class bsn_lacp_stats_request(bsn_stats_request):
Rich Lane7b0f2012013-11-22 14:15:26 -08002662 version = 4
2663 type = 18
2664 stats_type = 65535
2665 experimenter = 6035143
2666 subtype = 1
2667
2668 def __init__(self, xid=None, flags=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002669 if xid != None:
2670 self.xid = xid
2671 else:
2672 self.xid = None
Rich Lane7b0f2012013-11-22 14:15:26 -08002673 if flags != None:
2674 self.flags = flags
2675 else:
2676 self.flags = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08002677 return
Rich Lane7b0f2012013-11-22 14:15:26 -08002678
2679 def pack(self):
2680 packed = []
2681 packed.append(struct.pack("!B", self.version))
2682 packed.append(struct.pack("!B", self.type))
2683 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2684 packed.append(struct.pack("!L", self.xid))
2685 packed.append(struct.pack("!H", self.stats_type))
2686 packed.append(struct.pack("!H", self.flags))
2687 packed.append('\x00' * 4)
2688 packed.append(struct.pack("!L", self.experimenter))
2689 packed.append(struct.pack("!L", self.subtype))
2690 length = sum([len(x) for x in packed])
2691 packed[2] = struct.pack("!H", length)
2692 return ''.join(packed)
2693
2694 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002695 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -08002696 obj = bsn_lacp_stats_request()
Rich Lane7b0f2012013-11-22 14:15:26 -08002697 _version = reader.read("!B")[0]
2698 assert(_version == 4)
2699 _type = reader.read("!B")[0]
2700 assert(_type == 18)
2701 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002702 orig_reader = reader
2703 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane7b0f2012013-11-22 14:15:26 -08002704 obj.xid = reader.read("!L")[0]
2705 _stats_type = reader.read("!H")[0]
2706 assert(_stats_type == 65535)
2707 obj.flags = reader.read("!H")[0]
2708 reader.skip(4)
2709 _experimenter = reader.read("!L")[0]
2710 assert(_experimenter == 6035143)
2711 _subtype = reader.read("!L")[0]
2712 assert(_subtype == 1)
2713 return obj
2714
2715 def __eq__(self, other):
2716 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -08002717 if self.xid != other.xid: return False
2718 if self.flags != other.flags: return False
2719 return True
2720
Rich Lane7b0f2012013-11-22 14:15:26 -08002721 def pretty_print(self, q):
2722 q.text("bsn_lacp_stats_request {")
2723 with q.group():
2724 with q.indent(2):
2725 q.breakable()
2726 q.text("xid = ");
2727 if self.xid != None:
2728 q.text("%#x" % self.xid)
2729 else:
2730 q.text('None')
2731 q.text(","); q.breakable()
2732 q.text("flags = ");
2733 q.text("%#x" % self.flags)
2734 q.breakable()
2735 q.text('}')
2736
Rich Lane7dcdf022013-12-11 14:45:27 -08002737bsn_stats_request.subtypes[1] = bsn_lacp_stats_request
2738
2739class bsn_pdu_rx_reply(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07002740 version = 4
2741 type = 4
2742 experimenter = 6035143
2743 subtype = 34
2744
Rich Lane7b0f2012013-11-22 14:15:26 -08002745 def __init__(self, xid=None, status=None, port_no=None, slot_num=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002746 if xid != None:
2747 self.xid = xid
2748 else:
2749 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07002750 if status != None:
2751 self.status = status
2752 else:
2753 self.status = 0
Rich Lane7b0f2012013-11-22 14:15:26 -08002754 if port_no != None:
2755 self.port_no = port_no
2756 else:
2757 self.port_no = 0
2758 if slot_num != None:
2759 self.slot_num = slot_num
2760 else:
2761 self.slot_num = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08002762 return
Rich Lane6f4978c2013-10-20 21:33:52 -07002763
2764 def pack(self):
2765 packed = []
2766 packed.append(struct.pack("!B", self.version))
2767 packed.append(struct.pack("!B", self.type))
2768 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2769 packed.append(struct.pack("!L", self.xid))
2770 packed.append(struct.pack("!L", self.experimenter))
2771 packed.append(struct.pack("!L", self.subtype))
2772 packed.append(struct.pack("!L", self.status))
Rich Lane7b0f2012013-11-22 14:15:26 -08002773 packed.append(util.pack_port_no(self.port_no))
2774 packed.append(struct.pack("!B", self.slot_num))
Rich Lane6f4978c2013-10-20 21:33:52 -07002775 length = sum([len(x) for x in packed])
2776 packed[2] = struct.pack("!H", length)
2777 return ''.join(packed)
2778
2779 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002780 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07002781 obj = bsn_pdu_rx_reply()
Rich Lane6f4978c2013-10-20 21:33:52 -07002782 _version = reader.read("!B")[0]
2783 assert(_version == 4)
2784 _type = reader.read("!B")[0]
2785 assert(_type == 4)
2786 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002787 orig_reader = reader
2788 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07002789 obj.xid = reader.read("!L")[0]
2790 _experimenter = reader.read("!L")[0]
2791 assert(_experimenter == 6035143)
2792 _subtype = reader.read("!L")[0]
2793 assert(_subtype == 34)
2794 obj.status = reader.read("!L")[0]
Rich Lane7b0f2012013-11-22 14:15:26 -08002795 obj.port_no = util.unpack_port_no(reader)
2796 obj.slot_num = reader.read("!B")[0]
Rich Lane6f4978c2013-10-20 21:33:52 -07002797 return obj
2798
2799 def __eq__(self, other):
2800 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07002801 if self.xid != other.xid: return False
2802 if self.status != other.status: return False
Rich Lane7b0f2012013-11-22 14:15:26 -08002803 if self.port_no != other.port_no: return False
2804 if self.slot_num != other.slot_num: return False
Rich Lane6f4978c2013-10-20 21:33:52 -07002805 return True
2806
Rich Lane6f4978c2013-10-20 21:33:52 -07002807 def pretty_print(self, q):
2808 q.text("bsn_pdu_rx_reply {")
2809 with q.group():
2810 with q.indent(2):
2811 q.breakable()
2812 q.text("xid = ");
2813 if self.xid != None:
2814 q.text("%#x" % self.xid)
2815 else:
2816 q.text('None')
2817 q.text(","); q.breakable()
2818 q.text("status = ");
2819 q.text("%#x" % self.status)
Rich Lane7b0f2012013-11-22 14:15:26 -08002820 q.text(","); q.breakable()
2821 q.text("port_no = ");
2822 q.text(util.pretty_port(self.port_no))
2823 q.text(","); q.breakable()
2824 q.text("slot_num = ");
2825 q.text("%#x" % self.slot_num)
Rich Lane6f4978c2013-10-20 21:33:52 -07002826 q.breakable()
2827 q.text('}')
2828
Rich Lane7dcdf022013-12-11 14:45:27 -08002829bsn_header.subtypes[34] = bsn_pdu_rx_reply
2830
2831class bsn_pdu_rx_request(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07002832 version = 4
2833 type = 4
2834 experimenter = 6035143
2835 subtype = 33
2836
2837 def __init__(self, xid=None, timeout_ms=None, port_no=None, slot_num=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002838 if xid != None:
2839 self.xid = xid
2840 else:
2841 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07002842 if timeout_ms != None:
2843 self.timeout_ms = timeout_ms
2844 else:
2845 self.timeout_ms = 0
2846 if port_no != None:
2847 self.port_no = port_no
2848 else:
2849 self.port_no = 0
2850 if slot_num != None:
2851 self.slot_num = slot_num
2852 else:
2853 self.slot_num = 0
2854 if data != None:
2855 self.data = data
2856 else:
2857 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08002858 return
Rich Lane6f4978c2013-10-20 21:33:52 -07002859
2860 def pack(self):
2861 packed = []
2862 packed.append(struct.pack("!B", self.version))
2863 packed.append(struct.pack("!B", self.type))
2864 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2865 packed.append(struct.pack("!L", self.xid))
2866 packed.append(struct.pack("!L", self.experimenter))
2867 packed.append(struct.pack("!L", self.subtype))
2868 packed.append(struct.pack("!L", self.timeout_ms))
2869 packed.append(util.pack_port_no(self.port_no))
2870 packed.append(struct.pack("!B", self.slot_num))
2871 packed.append('\x00' * 3)
2872 packed.append(self.data)
2873 length = sum([len(x) for x in packed])
2874 packed[2] = struct.pack("!H", length)
2875 return ''.join(packed)
2876
2877 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002878 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07002879 obj = bsn_pdu_rx_request()
Rich Lane6f4978c2013-10-20 21:33:52 -07002880 _version = reader.read("!B")[0]
2881 assert(_version == 4)
2882 _type = reader.read("!B")[0]
2883 assert(_type == 4)
2884 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002885 orig_reader = reader
2886 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07002887 obj.xid = reader.read("!L")[0]
2888 _experimenter = reader.read("!L")[0]
2889 assert(_experimenter == 6035143)
2890 _subtype = reader.read("!L")[0]
2891 assert(_subtype == 33)
2892 obj.timeout_ms = reader.read("!L")[0]
2893 obj.port_no = util.unpack_port_no(reader)
2894 obj.slot_num = reader.read("!B")[0]
2895 reader.skip(3)
2896 obj.data = str(reader.read_all())
2897 return obj
2898
2899 def __eq__(self, other):
2900 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07002901 if self.xid != other.xid: return False
2902 if self.timeout_ms != other.timeout_ms: return False
2903 if self.port_no != other.port_no: return False
2904 if self.slot_num != other.slot_num: return False
2905 if self.data != other.data: return False
2906 return True
2907
Rich Lane6f4978c2013-10-20 21:33:52 -07002908 def pretty_print(self, q):
2909 q.text("bsn_pdu_rx_request {")
2910 with q.group():
2911 with q.indent(2):
2912 q.breakable()
2913 q.text("xid = ");
2914 if self.xid != None:
2915 q.text("%#x" % self.xid)
2916 else:
2917 q.text('None')
2918 q.text(","); q.breakable()
2919 q.text("timeout_ms = ");
2920 q.text("%#x" % self.timeout_ms)
2921 q.text(","); q.breakable()
2922 q.text("port_no = ");
2923 q.text(util.pretty_port(self.port_no))
2924 q.text(","); q.breakable()
2925 q.text("slot_num = ");
2926 q.text("%#x" % self.slot_num)
2927 q.text(","); q.breakable()
2928 q.text("data = ");
2929 q.pp(self.data)
2930 q.breakable()
2931 q.text('}')
2932
Rich Lane7dcdf022013-12-11 14:45:27 -08002933bsn_header.subtypes[33] = bsn_pdu_rx_request
2934
2935class bsn_pdu_rx_timeout(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07002936 version = 4
2937 type = 4
2938 experimenter = 6035143
2939 subtype = 35
2940
2941 def __init__(self, xid=None, port_no=None, slot_num=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002942 if xid != None:
2943 self.xid = xid
2944 else:
2945 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07002946 if port_no != None:
2947 self.port_no = port_no
2948 else:
2949 self.port_no = 0
2950 if slot_num != None:
2951 self.slot_num = slot_num
2952 else:
2953 self.slot_num = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08002954 return
Rich Lane6f4978c2013-10-20 21:33:52 -07002955
2956 def pack(self):
2957 packed = []
2958 packed.append(struct.pack("!B", self.version))
2959 packed.append(struct.pack("!B", self.type))
2960 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2961 packed.append(struct.pack("!L", self.xid))
2962 packed.append(struct.pack("!L", self.experimenter))
2963 packed.append(struct.pack("!L", self.subtype))
2964 packed.append(util.pack_port_no(self.port_no))
2965 packed.append(struct.pack("!B", self.slot_num))
2966 length = sum([len(x) for x in packed])
2967 packed[2] = struct.pack("!H", length)
2968 return ''.join(packed)
2969
2970 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002971 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07002972 obj = bsn_pdu_rx_timeout()
Rich Lane6f4978c2013-10-20 21:33:52 -07002973 _version = reader.read("!B")[0]
2974 assert(_version == 4)
2975 _type = reader.read("!B")[0]
2976 assert(_type == 4)
2977 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002978 orig_reader = reader
2979 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07002980 obj.xid = reader.read("!L")[0]
2981 _experimenter = reader.read("!L")[0]
2982 assert(_experimenter == 6035143)
2983 _subtype = reader.read("!L")[0]
2984 assert(_subtype == 35)
2985 obj.port_no = util.unpack_port_no(reader)
2986 obj.slot_num = reader.read("!B")[0]
2987 return obj
2988
2989 def __eq__(self, other):
2990 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07002991 if self.xid != other.xid: return False
2992 if self.port_no != other.port_no: return False
2993 if self.slot_num != other.slot_num: return False
2994 return True
2995
Rich Lane6f4978c2013-10-20 21:33:52 -07002996 def pretty_print(self, q):
2997 q.text("bsn_pdu_rx_timeout {")
2998 with q.group():
2999 with q.indent(2):
3000 q.breakable()
3001 q.text("xid = ");
3002 if self.xid != None:
3003 q.text("%#x" % self.xid)
3004 else:
3005 q.text('None')
3006 q.text(","); q.breakable()
3007 q.text("port_no = ");
3008 q.text(util.pretty_port(self.port_no))
3009 q.text(","); q.breakable()
3010 q.text("slot_num = ");
3011 q.text("%#x" % self.slot_num)
3012 q.breakable()
3013 q.text('}')
3014
Rich Lane7dcdf022013-12-11 14:45:27 -08003015bsn_header.subtypes[35] = bsn_pdu_rx_timeout
3016
3017class bsn_pdu_tx_reply(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07003018 version = 4
3019 type = 4
3020 experimenter = 6035143
3021 subtype = 32
3022
Rich Lane7b0f2012013-11-22 14:15:26 -08003023 def __init__(self, xid=None, status=None, port_no=None, slot_num=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08003024 if xid != None:
3025 self.xid = xid
3026 else:
3027 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07003028 if status != None:
3029 self.status = status
3030 else:
3031 self.status = 0
Rich Lane7b0f2012013-11-22 14:15:26 -08003032 if port_no != None:
3033 self.port_no = port_no
3034 else:
3035 self.port_no = 0
3036 if slot_num != None:
3037 self.slot_num = slot_num
3038 else:
3039 self.slot_num = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08003040 return
Rich Lane6f4978c2013-10-20 21:33:52 -07003041
3042 def pack(self):
3043 packed = []
3044 packed.append(struct.pack("!B", self.version))
3045 packed.append(struct.pack("!B", self.type))
3046 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3047 packed.append(struct.pack("!L", self.xid))
3048 packed.append(struct.pack("!L", self.experimenter))
3049 packed.append(struct.pack("!L", self.subtype))
3050 packed.append(struct.pack("!L", self.status))
Rich Lane7b0f2012013-11-22 14:15:26 -08003051 packed.append(util.pack_port_no(self.port_no))
3052 packed.append(struct.pack("!B", self.slot_num))
Rich Lane6f4978c2013-10-20 21:33:52 -07003053 length = sum([len(x) for x in packed])
3054 packed[2] = struct.pack("!H", length)
3055 return ''.join(packed)
3056
3057 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003058 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07003059 obj = bsn_pdu_tx_reply()
Rich Lane6f4978c2013-10-20 21:33:52 -07003060 _version = reader.read("!B")[0]
3061 assert(_version == 4)
3062 _type = reader.read("!B")[0]
3063 assert(_type == 4)
3064 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003065 orig_reader = reader
3066 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07003067 obj.xid = reader.read("!L")[0]
3068 _experimenter = reader.read("!L")[0]
3069 assert(_experimenter == 6035143)
3070 _subtype = reader.read("!L")[0]
3071 assert(_subtype == 32)
3072 obj.status = reader.read("!L")[0]
Rich Lane7b0f2012013-11-22 14:15:26 -08003073 obj.port_no = util.unpack_port_no(reader)
3074 obj.slot_num = reader.read("!B")[0]
Rich Lane6f4978c2013-10-20 21:33:52 -07003075 return obj
3076
3077 def __eq__(self, other):
3078 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07003079 if self.xid != other.xid: return False
3080 if self.status != other.status: return False
Rich Lane7b0f2012013-11-22 14:15:26 -08003081 if self.port_no != other.port_no: return False
3082 if self.slot_num != other.slot_num: return False
Rich Lane6f4978c2013-10-20 21:33:52 -07003083 return True
3084
Rich Lane6f4978c2013-10-20 21:33:52 -07003085 def pretty_print(self, q):
3086 q.text("bsn_pdu_tx_reply {")
3087 with q.group():
3088 with q.indent(2):
3089 q.breakable()
3090 q.text("xid = ");
3091 if self.xid != None:
3092 q.text("%#x" % self.xid)
3093 else:
3094 q.text('None')
3095 q.text(","); q.breakable()
3096 q.text("status = ");
3097 q.text("%#x" % self.status)
Rich Lane7b0f2012013-11-22 14:15:26 -08003098 q.text(","); q.breakable()
3099 q.text("port_no = ");
3100 q.text(util.pretty_port(self.port_no))
3101 q.text(","); q.breakable()
3102 q.text("slot_num = ");
3103 q.text("%#x" % self.slot_num)
Rich Lane6f4978c2013-10-20 21:33:52 -07003104 q.breakable()
3105 q.text('}')
3106
Rich Lane7dcdf022013-12-11 14:45:27 -08003107bsn_header.subtypes[32] = bsn_pdu_tx_reply
3108
3109class bsn_pdu_tx_request(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07003110 version = 4
3111 type = 4
3112 experimenter = 6035143
3113 subtype = 31
3114
3115 def __init__(self, xid=None, tx_interval_ms=None, port_no=None, slot_num=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08003116 if xid != None:
3117 self.xid = xid
3118 else:
3119 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07003120 if tx_interval_ms != None:
3121 self.tx_interval_ms = tx_interval_ms
3122 else:
3123 self.tx_interval_ms = 0
3124 if port_no != None:
3125 self.port_no = port_no
3126 else:
3127 self.port_no = 0
3128 if slot_num != None:
3129 self.slot_num = slot_num
3130 else:
3131 self.slot_num = 0
3132 if data != None:
3133 self.data = data
3134 else:
3135 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08003136 return
Rich Lane6f4978c2013-10-20 21:33:52 -07003137
3138 def pack(self):
3139 packed = []
3140 packed.append(struct.pack("!B", self.version))
3141 packed.append(struct.pack("!B", self.type))
3142 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3143 packed.append(struct.pack("!L", self.xid))
3144 packed.append(struct.pack("!L", self.experimenter))
3145 packed.append(struct.pack("!L", self.subtype))
3146 packed.append(struct.pack("!L", self.tx_interval_ms))
3147 packed.append(util.pack_port_no(self.port_no))
3148 packed.append(struct.pack("!B", self.slot_num))
3149 packed.append('\x00' * 3)
3150 packed.append(self.data)
3151 length = sum([len(x) for x in packed])
3152 packed[2] = struct.pack("!H", length)
3153 return ''.join(packed)
3154
3155 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003156 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07003157 obj = bsn_pdu_tx_request()
Rich Lane6f4978c2013-10-20 21:33:52 -07003158 _version = reader.read("!B")[0]
3159 assert(_version == 4)
3160 _type = reader.read("!B")[0]
3161 assert(_type == 4)
3162 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003163 orig_reader = reader
3164 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07003165 obj.xid = reader.read("!L")[0]
3166 _experimenter = reader.read("!L")[0]
3167 assert(_experimenter == 6035143)
3168 _subtype = reader.read("!L")[0]
3169 assert(_subtype == 31)
3170 obj.tx_interval_ms = reader.read("!L")[0]
3171 obj.port_no = util.unpack_port_no(reader)
3172 obj.slot_num = reader.read("!B")[0]
3173 reader.skip(3)
3174 obj.data = str(reader.read_all())
3175 return obj
3176
3177 def __eq__(self, other):
3178 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07003179 if self.xid != other.xid: return False
3180 if self.tx_interval_ms != other.tx_interval_ms: return False
3181 if self.port_no != other.port_no: return False
3182 if self.slot_num != other.slot_num: return False
3183 if self.data != other.data: return False
3184 return True
3185
Rich Lane6f4978c2013-10-20 21:33:52 -07003186 def pretty_print(self, q):
3187 q.text("bsn_pdu_tx_request {")
3188 with q.group():
3189 with q.indent(2):
3190 q.breakable()
3191 q.text("xid = ");
3192 if self.xid != None:
3193 q.text("%#x" % self.xid)
3194 else:
3195 q.text('None')
3196 q.text(","); q.breakable()
3197 q.text("tx_interval_ms = ");
3198 q.text("%#x" % self.tx_interval_ms)
3199 q.text(","); q.breakable()
3200 q.text("port_no = ");
3201 q.text(util.pretty_port(self.port_no))
3202 q.text(","); q.breakable()
3203 q.text("slot_num = ");
3204 q.text("%#x" % self.slot_num)
3205 q.text(","); q.breakable()
3206 q.text("data = ");
3207 q.pp(self.data)
3208 q.breakable()
3209 q.text('}')
3210
Rich Lane7dcdf022013-12-11 14:45:27 -08003211bsn_header.subtypes[31] = bsn_pdu_tx_request
3212
3213class bsn_port_counter_stats_reply(bsn_stats_reply):
3214 version = 4
3215 type = 19
3216 stats_type = 65535
3217 experimenter = 6035143
3218 subtype = 8
3219
3220 def __init__(self, xid=None, flags=None, entries=None):
3221 if xid != None:
3222 self.xid = xid
3223 else:
3224 self.xid = None
3225 if flags != None:
3226 self.flags = flags
3227 else:
3228 self.flags = 0
3229 if entries != None:
3230 self.entries = entries
3231 else:
3232 self.entries = []
3233 return
3234
3235 def pack(self):
3236 packed = []
3237 packed.append(struct.pack("!B", self.version))
3238 packed.append(struct.pack("!B", self.type))
3239 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3240 packed.append(struct.pack("!L", self.xid))
3241 packed.append(struct.pack("!H", self.stats_type))
3242 packed.append(struct.pack("!H", self.flags))
3243 packed.append('\x00' * 4)
3244 packed.append(struct.pack("!L", self.experimenter))
3245 packed.append(struct.pack("!L", self.subtype))
3246 packed.append(loxi.generic_util.pack_list(self.entries))
3247 length = sum([len(x) for x in packed])
3248 packed[2] = struct.pack("!H", length)
3249 return ''.join(packed)
3250
3251 @staticmethod
3252 def unpack(reader):
3253 obj = bsn_port_counter_stats_reply()
3254 _version = reader.read("!B")[0]
3255 assert(_version == 4)
3256 _type = reader.read("!B")[0]
3257 assert(_type == 19)
3258 _length = reader.read("!H")[0]
3259 orig_reader = reader
3260 reader = orig_reader.slice(_length - (2 + 2))
3261 obj.xid = reader.read("!L")[0]
3262 _stats_type = reader.read("!H")[0]
3263 assert(_stats_type == 65535)
3264 obj.flags = reader.read("!H")[0]
3265 reader.skip(4)
3266 _experimenter = reader.read("!L")[0]
3267 assert(_experimenter == 6035143)
3268 _subtype = reader.read("!L")[0]
3269 assert(_subtype == 8)
3270 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_port_counter_stats_entry.unpack)
3271 return obj
3272
3273 def __eq__(self, other):
3274 if type(self) != type(other): return False
3275 if self.xid != other.xid: return False
3276 if self.flags != other.flags: return False
3277 if self.entries != other.entries: return False
3278 return True
3279
3280 def pretty_print(self, q):
3281 q.text("bsn_port_counter_stats_reply {")
3282 with q.group():
3283 with q.indent(2):
3284 q.breakable()
3285 q.text("xid = ");
3286 if self.xid != None:
3287 q.text("%#x" % self.xid)
3288 else:
3289 q.text('None')
3290 q.text(","); q.breakable()
3291 q.text("flags = ");
3292 q.text("%#x" % self.flags)
3293 q.text(","); q.breakable()
3294 q.text("entries = ");
3295 q.pp(self.entries)
3296 q.breakable()
3297 q.text('}')
3298
3299bsn_stats_reply.subtypes[8] = bsn_port_counter_stats_reply
3300
3301class bsn_port_counter_stats_request(bsn_stats_request):
3302 version = 4
3303 type = 18
3304 stats_type = 65535
3305 experimenter = 6035143
3306 subtype = 8
3307
3308 def __init__(self, xid=None, flags=None, port_no=None):
3309 if xid != None:
3310 self.xid = xid
3311 else:
3312 self.xid = None
3313 if flags != None:
3314 self.flags = flags
3315 else:
3316 self.flags = 0
3317 if port_no != None:
3318 self.port_no = port_no
3319 else:
3320 self.port_no = 0
3321 return
3322
3323 def pack(self):
3324 packed = []
3325 packed.append(struct.pack("!B", self.version))
3326 packed.append(struct.pack("!B", self.type))
3327 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3328 packed.append(struct.pack("!L", self.xid))
3329 packed.append(struct.pack("!H", self.stats_type))
3330 packed.append(struct.pack("!H", self.flags))
3331 packed.append('\x00' * 4)
3332 packed.append(struct.pack("!L", self.experimenter))
3333 packed.append(struct.pack("!L", self.subtype))
3334 packed.append(util.pack_port_no(self.port_no))
3335 length = sum([len(x) for x in packed])
3336 packed[2] = struct.pack("!H", length)
3337 return ''.join(packed)
3338
3339 @staticmethod
3340 def unpack(reader):
3341 obj = bsn_port_counter_stats_request()
3342 _version = reader.read("!B")[0]
3343 assert(_version == 4)
3344 _type = reader.read("!B")[0]
3345 assert(_type == 18)
3346 _length = reader.read("!H")[0]
3347 orig_reader = reader
3348 reader = orig_reader.slice(_length - (2 + 2))
3349 obj.xid = reader.read("!L")[0]
3350 _stats_type = reader.read("!H")[0]
3351 assert(_stats_type == 65535)
3352 obj.flags = reader.read("!H")[0]
3353 reader.skip(4)
3354 _experimenter = reader.read("!L")[0]
3355 assert(_experimenter == 6035143)
3356 _subtype = reader.read("!L")[0]
3357 assert(_subtype == 8)
3358 obj.port_no = util.unpack_port_no(reader)
3359 return obj
3360
3361 def __eq__(self, other):
3362 if type(self) != type(other): return False
3363 if self.xid != other.xid: return False
3364 if self.flags != other.flags: return False
3365 if self.port_no != other.port_no: return False
3366 return True
3367
3368 def pretty_print(self, q):
3369 q.text("bsn_port_counter_stats_request {")
3370 with q.group():
3371 with q.indent(2):
3372 q.breakable()
3373 q.text("xid = ");
3374 if self.xid != None:
3375 q.text("%#x" % self.xid)
3376 else:
3377 q.text('None')
3378 q.text(","); q.breakable()
3379 q.text("flags = ");
3380 q.text("%#x" % self.flags)
3381 q.text(","); q.breakable()
3382 q.text("port_no = ");
3383 q.text(util.pretty_port(self.port_no))
3384 q.breakable()
3385 q.text('}')
3386
3387bsn_stats_request.subtypes[8] = bsn_port_counter_stats_request
3388
3389class bsn_set_lacp_reply(bsn_header):
Rich Lane7b0f2012013-11-22 14:15:26 -08003390 version = 4
3391 type = 4
3392 experimenter = 6035143
3393 subtype = 42
3394
3395 def __init__(self, xid=None, status=None, port_no=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08003396 if xid != None:
3397 self.xid = xid
3398 else:
3399 self.xid = None
Rich Lane7b0f2012013-11-22 14:15:26 -08003400 if status != None:
3401 self.status = status
3402 else:
3403 self.status = 0
3404 if port_no != None:
3405 self.port_no = port_no
3406 else:
3407 self.port_no = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08003408 return
Rich Lane7b0f2012013-11-22 14:15:26 -08003409
3410 def pack(self):
3411 packed = []
3412 packed.append(struct.pack("!B", self.version))
3413 packed.append(struct.pack("!B", self.type))
3414 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3415 packed.append(struct.pack("!L", self.xid))
3416 packed.append(struct.pack("!L", self.experimenter))
3417 packed.append(struct.pack("!L", self.subtype))
3418 packed.append(struct.pack("!L", self.status))
3419 packed.append(util.pack_port_no(self.port_no))
3420 length = sum([len(x) for x in packed])
3421 packed[2] = struct.pack("!H", length)
3422 return ''.join(packed)
3423
3424 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003425 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -08003426 obj = bsn_set_lacp_reply()
Rich Lane7b0f2012013-11-22 14:15:26 -08003427 _version = reader.read("!B")[0]
3428 assert(_version == 4)
3429 _type = reader.read("!B")[0]
3430 assert(_type == 4)
3431 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003432 orig_reader = reader
3433 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane7b0f2012013-11-22 14:15:26 -08003434 obj.xid = reader.read("!L")[0]
3435 _experimenter = reader.read("!L")[0]
3436 assert(_experimenter == 6035143)
3437 _subtype = reader.read("!L")[0]
3438 assert(_subtype == 42)
3439 obj.status = reader.read("!L")[0]
3440 obj.port_no = util.unpack_port_no(reader)
3441 return obj
3442
3443 def __eq__(self, other):
3444 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -08003445 if self.xid != other.xid: return False
3446 if self.status != other.status: return False
3447 if self.port_no != other.port_no: return False
3448 return True
3449
Rich Lane7b0f2012013-11-22 14:15:26 -08003450 def pretty_print(self, q):
3451 q.text("bsn_set_lacp_reply {")
3452 with q.group():
3453 with q.indent(2):
3454 q.breakable()
3455 q.text("xid = ");
3456 if self.xid != None:
3457 q.text("%#x" % self.xid)
3458 else:
3459 q.text('None')
3460 q.text(","); q.breakable()
3461 q.text("status = ");
3462 q.text("%#x" % self.status)
3463 q.text(","); q.breakable()
3464 q.text("port_no = ");
3465 q.text(util.pretty_port(self.port_no))
3466 q.breakable()
3467 q.text('}')
3468
Rich Lane7dcdf022013-12-11 14:45:27 -08003469bsn_header.subtypes[42] = bsn_set_lacp_reply
3470
3471class bsn_set_lacp_request(bsn_header):
Rich Lane7b0f2012013-11-22 14:15:26 -08003472 version = 4
3473 type = 4
3474 experimenter = 6035143
3475 subtype = 41
3476
3477 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 -08003478 if xid != None:
3479 self.xid = xid
3480 else:
3481 self.xid = None
Rich Lane7b0f2012013-11-22 14:15:26 -08003482 if enabled != None:
3483 self.enabled = enabled
3484 else:
3485 self.enabled = 0
3486 if port_no != None:
3487 self.port_no = port_no
3488 else:
3489 self.port_no = 0
3490 if actor_sys_priority != None:
3491 self.actor_sys_priority = actor_sys_priority
3492 else:
3493 self.actor_sys_priority = 0
3494 if actor_sys_mac != None:
3495 self.actor_sys_mac = actor_sys_mac
3496 else:
3497 self.actor_sys_mac = [0,0,0,0,0,0]
3498 if actor_port_priority != None:
3499 self.actor_port_priority = actor_port_priority
3500 else:
3501 self.actor_port_priority = 0
3502 if actor_port_num != None:
3503 self.actor_port_num = actor_port_num
3504 else:
3505 self.actor_port_num = 0
3506 if actor_key != None:
3507 self.actor_key = actor_key
3508 else:
3509 self.actor_key = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08003510 return
Rich Lane7b0f2012013-11-22 14:15:26 -08003511
3512 def pack(self):
3513 packed = []
3514 packed.append(struct.pack("!B", self.version))
3515 packed.append(struct.pack("!B", self.type))
3516 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3517 packed.append(struct.pack("!L", self.xid))
3518 packed.append(struct.pack("!L", self.experimenter))
3519 packed.append(struct.pack("!L", self.subtype))
3520 packed.append(struct.pack("!B", self.enabled))
3521 packed.append('\x00' * 3)
3522 packed.append(util.pack_port_no(self.port_no))
3523 packed.append(struct.pack("!H", self.actor_sys_priority))
3524 packed.append(struct.pack("!6B", *self.actor_sys_mac))
3525 packed.append(struct.pack("!H", self.actor_port_priority))
3526 packed.append(struct.pack("!H", self.actor_port_num))
3527 packed.append(struct.pack("!H", self.actor_key))
3528 length = sum([len(x) for x in packed])
3529 packed[2] = struct.pack("!H", length)
3530 return ''.join(packed)
3531
3532 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003533 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -08003534 obj = bsn_set_lacp_request()
Rich Lane7b0f2012013-11-22 14:15:26 -08003535 _version = reader.read("!B")[0]
3536 assert(_version == 4)
3537 _type = reader.read("!B")[0]
3538 assert(_type == 4)
3539 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003540 orig_reader = reader
3541 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane7b0f2012013-11-22 14:15:26 -08003542 obj.xid = reader.read("!L")[0]
3543 _experimenter = reader.read("!L")[0]
3544 assert(_experimenter == 6035143)
3545 _subtype = reader.read("!L")[0]
3546 assert(_subtype == 41)
3547 obj.enabled = reader.read("!B")[0]
3548 reader.skip(3)
3549 obj.port_no = util.unpack_port_no(reader)
3550 obj.actor_sys_priority = reader.read("!H")[0]
3551 obj.actor_sys_mac = list(reader.read('!6B'))
3552 obj.actor_port_priority = reader.read("!H")[0]
3553 obj.actor_port_num = reader.read("!H")[0]
3554 obj.actor_key = reader.read("!H")[0]
3555 return obj
3556
3557 def __eq__(self, other):
3558 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -08003559 if self.xid != other.xid: return False
3560 if self.enabled != other.enabled: return False
3561 if self.port_no != other.port_no: return False
3562 if self.actor_sys_priority != other.actor_sys_priority: return False
3563 if self.actor_sys_mac != other.actor_sys_mac: return False
3564 if self.actor_port_priority != other.actor_port_priority: return False
3565 if self.actor_port_num != other.actor_port_num: return False
3566 if self.actor_key != other.actor_key: return False
3567 return True
3568
Rich Lane7b0f2012013-11-22 14:15:26 -08003569 def pretty_print(self, q):
3570 q.text("bsn_set_lacp_request {")
3571 with q.group():
3572 with q.indent(2):
3573 q.breakable()
3574 q.text("xid = ");
3575 if self.xid != None:
3576 q.text("%#x" % self.xid)
3577 else:
3578 q.text('None')
3579 q.text(","); q.breakable()
3580 q.text("enabled = ");
3581 q.text("%#x" % self.enabled)
3582 q.text(","); q.breakable()
3583 q.text("port_no = ");
3584 q.text(util.pretty_port(self.port_no))
3585 q.text(","); q.breakable()
3586 q.text("actor_sys_priority = ");
3587 q.text("%#x" % self.actor_sys_priority)
3588 q.text(","); q.breakable()
3589 q.text("actor_sys_mac = ");
3590 q.text(util.pretty_mac(self.actor_sys_mac))
3591 q.text(","); q.breakable()
3592 q.text("actor_port_priority = ");
3593 q.text("%#x" % self.actor_port_priority)
3594 q.text(","); q.breakable()
3595 q.text("actor_port_num = ");
3596 q.text("%#x" % self.actor_port_num)
3597 q.text(","); q.breakable()
3598 q.text("actor_key = ");
3599 q.text("%#x" % self.actor_key)
3600 q.breakable()
3601 q.text('}')
3602
Rich Lane7dcdf022013-12-11 14:45:27 -08003603bsn_header.subtypes[41] = bsn_set_lacp_request
3604
3605class bsn_set_mirroring(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07003606 version = 4
3607 type = 4
3608 experimenter = 6035143
Rich Lanec2ee4b82013-04-24 17:12:38 -07003609 subtype = 3
3610
3611 def __init__(self, xid=None, report_mirror_ports=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08003612 if xid != None:
3613 self.xid = xid
3614 else:
3615 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07003616 if report_mirror_ports != None:
3617 self.report_mirror_ports = report_mirror_ports
3618 else:
3619 self.report_mirror_ports = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08003620 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07003621
3622 def pack(self):
3623 packed = []
3624 packed.append(struct.pack("!B", self.version))
3625 packed.append(struct.pack("!B", self.type))
3626 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3627 packed.append(struct.pack("!L", self.xid))
3628 packed.append(struct.pack("!L", self.experimenter))
3629 packed.append(struct.pack("!L", self.subtype))
3630 packed.append(struct.pack("!B", self.report_mirror_ports))
3631 packed.append('\x00' * 3)
3632 length = sum([len(x) for x in packed])
3633 packed[2] = struct.pack("!H", length)
3634 return ''.join(packed)
3635
3636 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003637 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07003638 obj = bsn_set_mirroring()
Dan Talaycof6202252013-07-02 01:00:29 -07003639 _version = reader.read("!B")[0]
3640 assert(_version == 4)
3641 _type = reader.read("!B")[0]
3642 assert(_type == 4)
3643 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003644 orig_reader = reader
3645 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07003646 obj.xid = reader.read("!L")[0]
3647 _experimenter = reader.read("!L")[0]
3648 assert(_experimenter == 6035143)
3649 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07003650 assert(_subtype == 3)
Dan Talaycof6202252013-07-02 01:00:29 -07003651 obj.report_mirror_ports = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07003652 reader.skip(3)
3653 return obj
3654
3655 def __eq__(self, other):
3656 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07003657 if self.xid != other.xid: return False
3658 if self.report_mirror_ports != other.report_mirror_ports: return False
3659 return True
3660
Rich Lanec2ee4b82013-04-24 17:12:38 -07003661 def pretty_print(self, q):
3662 q.text("bsn_set_mirroring {")
3663 with q.group():
3664 with q.indent(2):
3665 q.breakable()
3666 q.text("xid = ");
3667 if self.xid != None:
3668 q.text("%#x" % self.xid)
3669 else:
3670 q.text('None')
3671 q.text(","); q.breakable()
3672 q.text("report_mirror_ports = ");
3673 q.text("%#x" % self.report_mirror_ports)
3674 q.breakable()
3675 q.text('}')
3676
Rich Lane7dcdf022013-12-11 14:45:27 -08003677bsn_header.subtypes[3] = bsn_set_mirroring
3678
3679class bsn_set_pktin_suppression_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07003680 version = 4
3681 type = 4
3682 experimenter = 6035143
3683 subtype = 25
3684
3685 def __init__(self, xid=None, status=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08003686 if xid != None:
3687 self.xid = xid
3688 else:
3689 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07003690 if status != None:
3691 self.status = status
3692 else:
3693 self.status = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08003694 return
Dan Talaycof6202252013-07-02 01:00:29 -07003695
3696 def pack(self):
3697 packed = []
3698 packed.append(struct.pack("!B", self.version))
3699 packed.append(struct.pack("!B", self.type))
3700 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3701 packed.append(struct.pack("!L", self.xid))
3702 packed.append(struct.pack("!L", self.experimenter))
3703 packed.append(struct.pack("!L", self.subtype))
3704 packed.append(struct.pack("!L", self.status))
3705 length = sum([len(x) for x in packed])
3706 packed[2] = struct.pack("!H", length)
3707 return ''.join(packed)
3708
3709 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003710 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07003711 obj = bsn_set_pktin_suppression_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07003712 _version = reader.read("!B")[0]
3713 assert(_version == 4)
3714 _type = reader.read("!B")[0]
3715 assert(_type == 4)
3716 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003717 orig_reader = reader
3718 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07003719 obj.xid = reader.read("!L")[0]
3720 _experimenter = reader.read("!L")[0]
3721 assert(_experimenter == 6035143)
3722 _subtype = reader.read("!L")[0]
3723 assert(_subtype == 25)
3724 obj.status = reader.read("!L")[0]
3725 return obj
3726
3727 def __eq__(self, other):
3728 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07003729 if self.xid != other.xid: return False
3730 if self.status != other.status: return False
3731 return True
3732
Dan Talaycof6202252013-07-02 01:00:29 -07003733 def pretty_print(self, q):
3734 q.text("bsn_set_pktin_suppression_reply {")
3735 with q.group():
3736 with q.indent(2):
3737 q.breakable()
3738 q.text("xid = ");
3739 if self.xid != None:
3740 q.text("%#x" % self.xid)
3741 else:
3742 q.text('None')
3743 q.text(","); q.breakable()
3744 q.text("status = ");
3745 q.text("%#x" % self.status)
3746 q.breakable()
3747 q.text('}')
3748
Rich Lane7dcdf022013-12-11 14:45:27 -08003749bsn_header.subtypes[25] = bsn_set_pktin_suppression_reply
3750
3751class bsn_set_pktin_suppression_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07003752 version = 4
3753 type = 4
3754 experimenter = 6035143
Rich Lanec2ee4b82013-04-24 17:12:38 -07003755 subtype = 11
3756
3757 def __init__(self, xid=None, enabled=None, idle_timeout=None, hard_timeout=None, priority=None, cookie=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08003758 if xid != None:
3759 self.xid = xid
3760 else:
3761 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07003762 if enabled != None:
3763 self.enabled = enabled
3764 else:
3765 self.enabled = 0
3766 if idle_timeout != None:
3767 self.idle_timeout = idle_timeout
3768 else:
3769 self.idle_timeout = 0
3770 if hard_timeout != None:
3771 self.hard_timeout = hard_timeout
3772 else:
3773 self.hard_timeout = 0
3774 if priority != None:
3775 self.priority = priority
3776 else:
3777 self.priority = 0
3778 if cookie != None:
3779 self.cookie = cookie
3780 else:
3781 self.cookie = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08003782 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07003783
3784 def pack(self):
3785 packed = []
3786 packed.append(struct.pack("!B", self.version))
3787 packed.append(struct.pack("!B", self.type))
3788 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3789 packed.append(struct.pack("!L", self.xid))
3790 packed.append(struct.pack("!L", self.experimenter))
3791 packed.append(struct.pack("!L", self.subtype))
3792 packed.append(struct.pack("!B", self.enabled))
3793 packed.append('\x00' * 1)
3794 packed.append(struct.pack("!H", self.idle_timeout))
3795 packed.append(struct.pack("!H", self.hard_timeout))
3796 packed.append(struct.pack("!H", self.priority))
3797 packed.append(struct.pack("!Q", self.cookie))
3798 length = sum([len(x) for x in packed])
3799 packed[2] = struct.pack("!H", length)
3800 return ''.join(packed)
3801
3802 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003803 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07003804 obj = bsn_set_pktin_suppression_request()
Dan Talaycof6202252013-07-02 01:00:29 -07003805 _version = reader.read("!B")[0]
3806 assert(_version == 4)
3807 _type = reader.read("!B")[0]
3808 assert(_type == 4)
3809 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003810 orig_reader = reader
3811 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07003812 obj.xid = reader.read("!L")[0]
3813 _experimenter = reader.read("!L")[0]
3814 assert(_experimenter == 6035143)
3815 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07003816 assert(_subtype == 11)
Dan Talaycof6202252013-07-02 01:00:29 -07003817 obj.enabled = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07003818 reader.skip(1)
Dan Talaycof6202252013-07-02 01:00:29 -07003819 obj.idle_timeout = reader.read("!H")[0]
3820 obj.hard_timeout = reader.read("!H")[0]
3821 obj.priority = reader.read("!H")[0]
3822 obj.cookie = reader.read("!Q")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07003823 return obj
3824
3825 def __eq__(self, other):
3826 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07003827 if self.xid != other.xid: return False
3828 if self.enabled != other.enabled: return False
3829 if self.idle_timeout != other.idle_timeout: return False
3830 if self.hard_timeout != other.hard_timeout: return False
3831 if self.priority != other.priority: return False
3832 if self.cookie != other.cookie: return False
3833 return True
3834
Rich Lanec2ee4b82013-04-24 17:12:38 -07003835 def pretty_print(self, q):
Dan Talaycof6202252013-07-02 01:00:29 -07003836 q.text("bsn_set_pktin_suppression_request {")
Rich Lanec2ee4b82013-04-24 17:12:38 -07003837 with q.group():
3838 with q.indent(2):
3839 q.breakable()
3840 q.text("xid = ");
3841 if self.xid != None:
3842 q.text("%#x" % self.xid)
3843 else:
3844 q.text('None')
3845 q.text(","); q.breakable()
3846 q.text("enabled = ");
3847 q.text("%#x" % self.enabled)
3848 q.text(","); q.breakable()
3849 q.text("idle_timeout = ");
3850 q.text("%#x" % self.idle_timeout)
3851 q.text(","); q.breakable()
3852 q.text("hard_timeout = ");
3853 q.text("%#x" % self.hard_timeout)
3854 q.text(","); q.breakable()
3855 q.text("priority = ");
3856 q.text("%#x" % self.priority)
3857 q.text(","); q.breakable()
3858 q.text("cookie = ");
3859 q.text("%#x" % self.cookie)
3860 q.breakable()
3861 q.text('}')
3862
Rich Lane7dcdf022013-12-11 14:45:27 -08003863bsn_header.subtypes[11] = bsn_set_pktin_suppression_request
3864
3865class bsn_set_switch_pipeline_reply(bsn_header):
3866 version = 4
3867 type = 4
3868 experimenter = 6035143
3869 subtype = 54
3870
3871 def __init__(self, xid=None, status=None):
3872 if xid != None:
3873 self.xid = xid
3874 else:
3875 self.xid = None
3876 if status != None:
3877 self.status = status
3878 else:
3879 self.status = 0
3880 return
3881
3882 def pack(self):
3883 packed = []
3884 packed.append(struct.pack("!B", self.version))
3885 packed.append(struct.pack("!B", self.type))
3886 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3887 packed.append(struct.pack("!L", self.xid))
3888 packed.append(struct.pack("!L", self.experimenter))
3889 packed.append(struct.pack("!L", self.subtype))
3890 packed.append(struct.pack("!L", self.status))
3891 length = sum([len(x) for x in packed])
3892 packed[2] = struct.pack("!H", length)
3893 return ''.join(packed)
3894
3895 @staticmethod
3896 def unpack(reader):
3897 obj = bsn_set_switch_pipeline_reply()
3898 _version = reader.read("!B")[0]
3899 assert(_version == 4)
3900 _type = reader.read("!B")[0]
3901 assert(_type == 4)
3902 _length = reader.read("!H")[0]
3903 orig_reader = reader
3904 reader = orig_reader.slice(_length - (2 + 2))
3905 obj.xid = reader.read("!L")[0]
3906 _experimenter = reader.read("!L")[0]
3907 assert(_experimenter == 6035143)
3908 _subtype = reader.read("!L")[0]
3909 assert(_subtype == 54)
3910 obj.status = reader.read("!L")[0]
3911 return obj
3912
3913 def __eq__(self, other):
3914 if type(self) != type(other): return False
3915 if self.xid != other.xid: return False
3916 if self.status != other.status: return False
3917 return True
3918
3919 def pretty_print(self, q):
3920 q.text("bsn_set_switch_pipeline_reply {")
3921 with q.group():
3922 with q.indent(2):
3923 q.breakable()
3924 q.text("xid = ");
3925 if self.xid != None:
3926 q.text("%#x" % self.xid)
3927 else:
3928 q.text('None')
3929 q.text(","); q.breakable()
3930 q.text("status = ");
3931 q.text("%#x" % self.status)
3932 q.breakable()
3933 q.text('}')
3934
3935bsn_header.subtypes[54] = bsn_set_switch_pipeline_reply
3936
3937class bsn_set_switch_pipeline_request(bsn_header):
3938 version = 4
3939 type = 4
3940 experimenter = 6035143
3941 subtype = 53
3942
3943 def __init__(self, xid=None, pipeline=None):
3944 if xid != None:
3945 self.xid = xid
3946 else:
3947 self.xid = None
3948 if pipeline != None:
3949 self.pipeline = pipeline
3950 else:
3951 self.pipeline = ""
3952 return
3953
3954 def pack(self):
3955 packed = []
3956 packed.append(struct.pack("!B", self.version))
3957 packed.append(struct.pack("!B", self.type))
3958 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3959 packed.append(struct.pack("!L", self.xid))
3960 packed.append(struct.pack("!L", self.experimenter))
3961 packed.append(struct.pack("!L", self.subtype))
3962 packed.append(struct.pack("!256s", self.pipeline))
3963 length = sum([len(x) for x in packed])
3964 packed[2] = struct.pack("!H", length)
3965 return ''.join(packed)
3966
3967 @staticmethod
3968 def unpack(reader):
3969 obj = bsn_set_switch_pipeline_request()
3970 _version = reader.read("!B")[0]
3971 assert(_version == 4)
3972 _type = reader.read("!B")[0]
3973 assert(_type == 4)
3974 _length = reader.read("!H")[0]
3975 orig_reader = reader
3976 reader = orig_reader.slice(_length - (2 + 2))
3977 obj.xid = reader.read("!L")[0]
3978 _experimenter = reader.read("!L")[0]
3979 assert(_experimenter == 6035143)
3980 _subtype = reader.read("!L")[0]
3981 assert(_subtype == 53)
3982 obj.pipeline = reader.read("!256s")[0].rstrip("\x00")
3983 return obj
3984
3985 def __eq__(self, other):
3986 if type(self) != type(other): return False
3987 if self.xid != other.xid: return False
3988 if self.pipeline != other.pipeline: return False
3989 return True
3990
3991 def pretty_print(self, q):
3992 q.text("bsn_set_switch_pipeline_request {")
3993 with q.group():
3994 with q.indent(2):
3995 q.breakable()
3996 q.text("xid = ");
3997 if self.xid != None:
3998 q.text("%#x" % self.xid)
3999 else:
4000 q.text('None')
4001 q.text(","); q.breakable()
4002 q.text("pipeline = ");
4003 q.pp(self.pipeline)
4004 q.breakable()
4005 q.text('}')
4006
4007bsn_header.subtypes[53] = bsn_set_switch_pipeline_request
4008
4009class bsn_switch_pipeline_stats_reply(bsn_stats_reply):
4010 version = 4
4011 type = 19
4012 stats_type = 65535
4013 experimenter = 6035143
4014 subtype = 6
4015
4016 def __init__(self, xid=None, flags=None, entries=None):
4017 if xid != None:
4018 self.xid = xid
4019 else:
4020 self.xid = None
4021 if flags != None:
4022 self.flags = flags
4023 else:
4024 self.flags = 0
4025 if entries != None:
4026 self.entries = entries
4027 else:
4028 self.entries = []
4029 return
4030
4031 def pack(self):
4032 packed = []
4033 packed.append(struct.pack("!B", self.version))
4034 packed.append(struct.pack("!B", self.type))
4035 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4036 packed.append(struct.pack("!L", self.xid))
4037 packed.append(struct.pack("!H", self.stats_type))
4038 packed.append(struct.pack("!H", self.flags))
4039 packed.append('\x00' * 4)
4040 packed.append(struct.pack("!L", self.experimenter))
4041 packed.append(struct.pack("!L", self.subtype))
4042 packed.append(loxi.generic_util.pack_list(self.entries))
4043 length = sum([len(x) for x in packed])
4044 packed[2] = struct.pack("!H", length)
4045 return ''.join(packed)
4046
4047 @staticmethod
4048 def unpack(reader):
4049 obj = bsn_switch_pipeline_stats_reply()
4050 _version = reader.read("!B")[0]
4051 assert(_version == 4)
4052 _type = reader.read("!B")[0]
4053 assert(_type == 19)
4054 _length = reader.read("!H")[0]
4055 orig_reader = reader
4056 reader = orig_reader.slice(_length - (2 + 2))
4057 obj.xid = reader.read("!L")[0]
4058 _stats_type = reader.read("!H")[0]
4059 assert(_stats_type == 65535)
4060 obj.flags = reader.read("!H")[0]
4061 reader.skip(4)
4062 _experimenter = reader.read("!L")[0]
4063 assert(_experimenter == 6035143)
4064 _subtype = reader.read("!L")[0]
4065 assert(_subtype == 6)
4066 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_switch_pipeline_stats_entry.unpack)
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 if self.entries != other.entries: return False
4074 return True
4075
4076 def pretty_print(self, q):
4077 q.text("bsn_switch_pipeline_stats_reply {")
4078 with q.group():
4079 with q.indent(2):
4080 q.breakable()
4081 q.text("xid = ");
4082 if self.xid != None:
4083 q.text("%#x" % self.xid)
4084 else:
4085 q.text('None')
4086 q.text(","); q.breakable()
4087 q.text("flags = ");
4088 q.text("%#x" % self.flags)
4089 q.text(","); q.breakable()
4090 q.text("entries = ");
4091 q.pp(self.entries)
4092 q.breakable()
4093 q.text('}')
4094
4095bsn_stats_reply.subtypes[6] = bsn_switch_pipeline_stats_reply
4096
4097class bsn_switch_pipeline_stats_request(bsn_stats_request):
4098 version = 4
4099 type = 18
4100 stats_type = 65535
4101 experimenter = 6035143
4102 subtype = 6
4103
4104 def __init__(self, xid=None, flags=None):
4105 if xid != None:
4106 self.xid = xid
4107 else:
4108 self.xid = None
4109 if flags != None:
4110 self.flags = flags
4111 else:
4112 self.flags = 0
4113 return
4114
4115 def pack(self):
4116 packed = []
4117 packed.append(struct.pack("!B", self.version))
4118 packed.append(struct.pack("!B", self.type))
4119 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4120 packed.append(struct.pack("!L", self.xid))
4121 packed.append(struct.pack("!H", self.stats_type))
4122 packed.append(struct.pack("!H", self.flags))
4123 packed.append('\x00' * 4)
4124 packed.append(struct.pack("!L", self.experimenter))
4125 packed.append(struct.pack("!L", self.subtype))
4126 length = sum([len(x) for x in packed])
4127 packed[2] = struct.pack("!H", length)
4128 return ''.join(packed)
4129
4130 @staticmethod
4131 def unpack(reader):
4132 obj = bsn_switch_pipeline_stats_request()
4133 _version = reader.read("!B")[0]
4134 assert(_version == 4)
4135 _type = reader.read("!B")[0]
4136 assert(_type == 18)
4137 _length = reader.read("!H")[0]
4138 orig_reader = reader
4139 reader = orig_reader.slice(_length - (2 + 2))
4140 obj.xid = reader.read("!L")[0]
4141 _stats_type = reader.read("!H")[0]
4142 assert(_stats_type == 65535)
4143 obj.flags = reader.read("!H")[0]
4144 reader.skip(4)
4145 _experimenter = reader.read("!L")[0]
4146 assert(_experimenter == 6035143)
4147 _subtype = reader.read("!L")[0]
4148 assert(_subtype == 6)
4149 return obj
4150
4151 def __eq__(self, other):
4152 if type(self) != type(other): return False
4153 if self.xid != other.xid: return False
4154 if self.flags != other.flags: return False
4155 return True
4156
4157 def pretty_print(self, q):
4158 q.text("bsn_switch_pipeline_stats_request {")
4159 with q.group():
4160 with q.indent(2):
4161 q.breakable()
4162 q.text("xid = ");
4163 if self.xid != None:
4164 q.text("%#x" % self.xid)
4165 else:
4166 q.text('None')
4167 q.text(","); q.breakable()
4168 q.text("flags = ");
4169 q.text("%#x" % self.flags)
4170 q.breakable()
4171 q.text('}')
4172
4173bsn_stats_request.subtypes[6] = bsn_switch_pipeline_stats_request
4174
4175class bsn_time_reply(bsn_header):
Rich Lane7b0f2012013-11-22 14:15:26 -08004176 version = 4
4177 type = 4
4178 experimenter = 6035143
4179 subtype = 45
4180
4181 def __init__(self, xid=None, time_ms=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08004182 if xid != None:
4183 self.xid = xid
4184 else:
4185 self.xid = None
Rich Lane7b0f2012013-11-22 14:15:26 -08004186 if time_ms != None:
4187 self.time_ms = time_ms
4188 else:
4189 self.time_ms = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08004190 return
Rich Lane7b0f2012013-11-22 14:15:26 -08004191
4192 def pack(self):
4193 packed = []
4194 packed.append(struct.pack("!B", self.version))
4195 packed.append(struct.pack("!B", self.type))
4196 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4197 packed.append(struct.pack("!L", self.xid))
4198 packed.append(struct.pack("!L", self.experimenter))
4199 packed.append(struct.pack("!L", self.subtype))
4200 packed.append(struct.pack("!Q", self.time_ms))
4201 length = sum([len(x) for x in packed])
4202 packed[2] = struct.pack("!H", length)
4203 return ''.join(packed)
4204
4205 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004206 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -08004207 obj = bsn_time_reply()
Rich Lane7b0f2012013-11-22 14:15:26 -08004208 _version = reader.read("!B")[0]
4209 assert(_version == 4)
4210 _type = reader.read("!B")[0]
4211 assert(_type == 4)
4212 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004213 orig_reader = reader
4214 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane7b0f2012013-11-22 14:15:26 -08004215 obj.xid = reader.read("!L")[0]
4216 _experimenter = reader.read("!L")[0]
4217 assert(_experimenter == 6035143)
4218 _subtype = reader.read("!L")[0]
4219 assert(_subtype == 45)
4220 obj.time_ms = reader.read("!Q")[0]
4221 return obj
4222
4223 def __eq__(self, other):
4224 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -08004225 if self.xid != other.xid: return False
4226 if self.time_ms != other.time_ms: return False
4227 return True
4228
Rich Lane7b0f2012013-11-22 14:15:26 -08004229 def pretty_print(self, q):
4230 q.text("bsn_time_reply {")
4231 with q.group():
4232 with q.indent(2):
4233 q.breakable()
4234 q.text("xid = ");
4235 if self.xid != None:
4236 q.text("%#x" % self.xid)
4237 else:
4238 q.text('None')
4239 q.text(","); q.breakable()
4240 q.text("time_ms = ");
4241 q.text("%#x" % self.time_ms)
4242 q.breakable()
4243 q.text('}')
4244
Rich Lane7dcdf022013-12-11 14:45:27 -08004245bsn_header.subtypes[45] = bsn_time_reply
4246
4247class bsn_time_request(bsn_header):
Rich Lane7b0f2012013-11-22 14:15:26 -08004248 version = 4
4249 type = 4
4250 experimenter = 6035143
4251 subtype = 44
4252
4253 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08004254 if xid != None:
4255 self.xid = xid
4256 else:
4257 self.xid = None
4258 return
Rich Lane7b0f2012013-11-22 14:15:26 -08004259
4260 def pack(self):
4261 packed = []
4262 packed.append(struct.pack("!B", self.version))
4263 packed.append(struct.pack("!B", self.type))
4264 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4265 packed.append(struct.pack("!L", self.xid))
4266 packed.append(struct.pack("!L", self.experimenter))
4267 packed.append(struct.pack("!L", self.subtype))
4268 length = sum([len(x) for x in packed])
4269 packed[2] = struct.pack("!H", length)
4270 return ''.join(packed)
4271
4272 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004273 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -08004274 obj = bsn_time_request()
Rich Lane7b0f2012013-11-22 14:15:26 -08004275 _version = reader.read("!B")[0]
4276 assert(_version == 4)
4277 _type = reader.read("!B")[0]
4278 assert(_type == 4)
4279 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004280 orig_reader = reader
4281 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane7b0f2012013-11-22 14:15:26 -08004282 obj.xid = reader.read("!L")[0]
4283 _experimenter = reader.read("!L")[0]
4284 assert(_experimenter == 6035143)
4285 _subtype = reader.read("!L")[0]
4286 assert(_subtype == 44)
4287 return obj
4288
4289 def __eq__(self, other):
4290 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -08004291 if self.xid != other.xid: return False
4292 return True
4293
Rich Lane7b0f2012013-11-22 14:15:26 -08004294 def pretty_print(self, q):
4295 q.text("bsn_time_request {")
4296 with q.group():
4297 with q.indent(2):
4298 q.breakable()
4299 q.text("xid = ");
4300 if self.xid != None:
4301 q.text("%#x" % self.xid)
4302 else:
4303 q.text('None')
4304 q.breakable()
4305 q.text('}')
4306
Rich Lane7dcdf022013-12-11 14:45:27 -08004307bsn_header.subtypes[44] = bsn_time_request
4308
4309class bsn_virtual_port_create_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07004310 version = 4
4311 type = 4
4312 experimenter = 6035143
4313 subtype = 16
4314
4315 def __init__(self, xid=None, status=None, vport_no=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08004316 if xid != None:
4317 self.xid = xid
4318 else:
4319 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07004320 if status != None:
4321 self.status = status
4322 else:
4323 self.status = 0
4324 if vport_no != None:
4325 self.vport_no = vport_no
4326 else:
4327 self.vport_no = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08004328 return
Dan Talaycof6202252013-07-02 01:00:29 -07004329
4330 def pack(self):
4331 packed = []
4332 packed.append(struct.pack("!B", self.version))
4333 packed.append(struct.pack("!B", self.type))
4334 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4335 packed.append(struct.pack("!L", self.xid))
4336 packed.append(struct.pack("!L", self.experimenter))
4337 packed.append(struct.pack("!L", self.subtype))
4338 packed.append(struct.pack("!L", self.status))
4339 packed.append(struct.pack("!L", self.vport_no))
4340 length = sum([len(x) for x in packed])
4341 packed[2] = struct.pack("!H", length)
4342 return ''.join(packed)
4343
4344 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004345 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07004346 obj = bsn_virtual_port_create_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07004347 _version = reader.read("!B")[0]
4348 assert(_version == 4)
4349 _type = reader.read("!B")[0]
4350 assert(_type == 4)
4351 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004352 orig_reader = reader
4353 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07004354 obj.xid = reader.read("!L")[0]
4355 _experimenter = reader.read("!L")[0]
4356 assert(_experimenter == 6035143)
4357 _subtype = reader.read("!L")[0]
4358 assert(_subtype == 16)
4359 obj.status = reader.read("!L")[0]
4360 obj.vport_no = reader.read("!L")[0]
4361 return obj
4362
4363 def __eq__(self, other):
4364 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07004365 if self.xid != other.xid: return False
4366 if self.status != other.status: return False
4367 if self.vport_no != other.vport_no: return False
4368 return True
4369
Dan Talaycof6202252013-07-02 01:00:29 -07004370 def pretty_print(self, q):
4371 q.text("bsn_virtual_port_create_reply {")
4372 with q.group():
4373 with q.indent(2):
4374 q.breakable()
4375 q.text("xid = ");
4376 if self.xid != None:
4377 q.text("%#x" % self.xid)
4378 else:
4379 q.text('None')
4380 q.text(","); q.breakable()
4381 q.text("status = ");
4382 q.text("%#x" % self.status)
4383 q.text(","); q.breakable()
4384 q.text("vport_no = ");
4385 q.text("%#x" % self.vport_no)
4386 q.breakable()
4387 q.text('}')
4388
Rich Lane7dcdf022013-12-11 14:45:27 -08004389bsn_header.subtypes[16] = bsn_virtual_port_create_reply
4390
4391class bsn_virtual_port_create_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07004392 version = 4
4393 type = 4
4394 experimenter = 6035143
4395 subtype = 15
4396
4397 def __init__(self, xid=None, vport=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08004398 if xid != None:
4399 self.xid = xid
4400 else:
4401 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07004402 if vport != None:
4403 self.vport = vport
4404 else:
4405 self.vport = common.bsn_vport_q_in_q()
Rich Lane7dcdf022013-12-11 14:45:27 -08004406 return
Dan Talaycof6202252013-07-02 01:00:29 -07004407
4408 def pack(self):
4409 packed = []
4410 packed.append(struct.pack("!B", self.version))
4411 packed.append(struct.pack("!B", self.type))
4412 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4413 packed.append(struct.pack("!L", self.xid))
4414 packed.append(struct.pack("!L", self.experimenter))
4415 packed.append(struct.pack("!L", self.subtype))
4416 packed.append(self.vport.pack())
4417 length = sum([len(x) for x in packed])
4418 packed[2] = struct.pack("!H", length)
4419 return ''.join(packed)
4420
4421 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004422 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07004423 obj = bsn_virtual_port_create_request()
Dan Talaycof6202252013-07-02 01:00:29 -07004424 _version = reader.read("!B")[0]
4425 assert(_version == 4)
4426 _type = reader.read("!B")[0]
4427 assert(_type == 4)
4428 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004429 orig_reader = reader
4430 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07004431 obj.xid = reader.read("!L")[0]
4432 _experimenter = reader.read("!L")[0]
4433 assert(_experimenter == 6035143)
4434 _subtype = reader.read("!L")[0]
4435 assert(_subtype == 15)
4436 obj.vport = common.bsn_vport_q_in_q.unpack(reader)
4437 return obj
4438
4439 def __eq__(self, other):
4440 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07004441 if self.xid != other.xid: return False
4442 if self.vport != other.vport: return False
4443 return True
4444
Dan Talaycof6202252013-07-02 01:00:29 -07004445 def pretty_print(self, q):
4446 q.text("bsn_virtual_port_create_request {")
4447 with q.group():
4448 with q.indent(2):
4449 q.breakable()
4450 q.text("xid = ");
4451 if self.xid != None:
4452 q.text("%#x" % self.xid)
4453 else:
4454 q.text('None')
4455 q.text(","); q.breakable()
4456 q.text("vport = ");
4457 q.pp(self.vport)
4458 q.breakable()
4459 q.text('}')
4460
Rich Lane7dcdf022013-12-11 14:45:27 -08004461bsn_header.subtypes[15] = bsn_virtual_port_create_request
4462
4463class bsn_virtual_port_remove_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07004464 version = 4
4465 type = 4
4466 experimenter = 6035143
4467 subtype = 26
4468
4469 def __init__(self, xid=None, status=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08004470 if xid != None:
4471 self.xid = xid
4472 else:
4473 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07004474 if status != None:
4475 self.status = status
4476 else:
4477 self.status = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08004478 return
Dan Talaycof6202252013-07-02 01:00:29 -07004479
4480 def pack(self):
4481 packed = []
4482 packed.append(struct.pack("!B", self.version))
4483 packed.append(struct.pack("!B", self.type))
4484 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4485 packed.append(struct.pack("!L", self.xid))
4486 packed.append(struct.pack("!L", self.experimenter))
4487 packed.append(struct.pack("!L", self.subtype))
4488 packed.append(struct.pack("!L", self.status))
4489 length = sum([len(x) for x in packed])
4490 packed[2] = struct.pack("!H", length)
4491 return ''.join(packed)
4492
4493 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004494 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07004495 obj = bsn_virtual_port_remove_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07004496 _version = reader.read("!B")[0]
4497 assert(_version == 4)
4498 _type = reader.read("!B")[0]
4499 assert(_type == 4)
4500 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004501 orig_reader = reader
4502 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07004503 obj.xid = reader.read("!L")[0]
4504 _experimenter = reader.read("!L")[0]
4505 assert(_experimenter == 6035143)
4506 _subtype = reader.read("!L")[0]
4507 assert(_subtype == 26)
4508 obj.status = reader.read("!L")[0]
4509 return obj
4510
4511 def __eq__(self, other):
4512 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07004513 if self.xid != other.xid: return False
4514 if self.status != other.status: return False
4515 return True
4516
Dan Talaycof6202252013-07-02 01:00:29 -07004517 def pretty_print(self, q):
4518 q.text("bsn_virtual_port_remove_reply {")
4519 with q.group():
4520 with q.indent(2):
4521 q.breakable()
4522 q.text("xid = ");
4523 if self.xid != None:
4524 q.text("%#x" % self.xid)
4525 else:
4526 q.text('None')
4527 q.text(","); q.breakable()
4528 q.text("status = ");
4529 q.text("%#x" % self.status)
4530 q.breakable()
4531 q.text('}')
4532
Rich Lane7dcdf022013-12-11 14:45:27 -08004533bsn_header.subtypes[26] = bsn_virtual_port_remove_reply
4534
4535class bsn_virtual_port_remove_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07004536 version = 4
4537 type = 4
4538 experimenter = 6035143
4539 subtype = 17
4540
4541 def __init__(self, xid=None, vport_no=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08004542 if xid != None:
4543 self.xid = xid
4544 else:
4545 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07004546 if vport_no != None:
4547 self.vport_no = vport_no
4548 else:
4549 self.vport_no = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08004550 return
Dan Talaycof6202252013-07-02 01:00:29 -07004551
4552 def pack(self):
4553 packed = []
4554 packed.append(struct.pack("!B", self.version))
4555 packed.append(struct.pack("!B", self.type))
4556 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4557 packed.append(struct.pack("!L", self.xid))
4558 packed.append(struct.pack("!L", self.experimenter))
4559 packed.append(struct.pack("!L", self.subtype))
4560 packed.append(struct.pack("!L", self.vport_no))
4561 length = sum([len(x) for x in packed])
4562 packed[2] = struct.pack("!H", length)
4563 return ''.join(packed)
4564
4565 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004566 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07004567 obj = bsn_virtual_port_remove_request()
Dan Talaycof6202252013-07-02 01:00:29 -07004568 _version = reader.read("!B")[0]
4569 assert(_version == 4)
4570 _type = reader.read("!B")[0]
4571 assert(_type == 4)
4572 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004573 orig_reader = reader
4574 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07004575 obj.xid = reader.read("!L")[0]
4576 _experimenter = reader.read("!L")[0]
4577 assert(_experimenter == 6035143)
4578 _subtype = reader.read("!L")[0]
4579 assert(_subtype == 17)
4580 obj.vport_no = reader.read("!L")[0]
4581 return obj
4582
4583 def __eq__(self, other):
4584 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07004585 if self.xid != other.xid: return False
4586 if self.vport_no != other.vport_no: return False
4587 return True
4588
Dan Talaycof6202252013-07-02 01:00:29 -07004589 def pretty_print(self, q):
4590 q.text("bsn_virtual_port_remove_request {")
4591 with q.group():
4592 with q.indent(2):
4593 q.breakable()
4594 q.text("xid = ");
4595 if self.xid != None:
4596 q.text("%#x" % self.xid)
4597 else:
4598 q.text('None')
4599 q.text(","); q.breakable()
4600 q.text("vport_no = ");
4601 q.text("%#x" % self.vport_no)
4602 q.breakable()
4603 q.text('}')
4604
Rich Lane7dcdf022013-12-11 14:45:27 -08004605bsn_header.subtypes[17] = bsn_virtual_port_remove_request
4606
4607class bsn_vlan_counter_stats_reply(bsn_stats_reply):
4608 version = 4
4609 type = 19
4610 stats_type = 65535
4611 experimenter = 6035143
4612 subtype = 9
4613
4614 def __init__(self, xid=None, flags=None, entries=None):
4615 if xid != None:
4616 self.xid = xid
4617 else:
4618 self.xid = None
4619 if flags != None:
4620 self.flags = flags
4621 else:
4622 self.flags = 0
4623 if entries != None:
4624 self.entries = entries
4625 else:
4626 self.entries = []
4627 return
4628
4629 def pack(self):
4630 packed = []
4631 packed.append(struct.pack("!B", self.version))
4632 packed.append(struct.pack("!B", self.type))
4633 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4634 packed.append(struct.pack("!L", self.xid))
4635 packed.append(struct.pack("!H", self.stats_type))
4636 packed.append(struct.pack("!H", self.flags))
4637 packed.append('\x00' * 4)
4638 packed.append(struct.pack("!L", self.experimenter))
4639 packed.append(struct.pack("!L", self.subtype))
4640 packed.append(loxi.generic_util.pack_list(self.entries))
4641 length = sum([len(x) for x in packed])
4642 packed[2] = struct.pack("!H", length)
4643 return ''.join(packed)
4644
4645 @staticmethod
4646 def unpack(reader):
4647 obj = bsn_vlan_counter_stats_reply()
4648 _version = reader.read("!B")[0]
4649 assert(_version == 4)
4650 _type = reader.read("!B")[0]
4651 assert(_type == 19)
4652 _length = reader.read("!H")[0]
4653 orig_reader = reader
4654 reader = orig_reader.slice(_length - (2 + 2))
4655 obj.xid = reader.read("!L")[0]
4656 _stats_type = reader.read("!H")[0]
4657 assert(_stats_type == 65535)
4658 obj.flags = reader.read("!H")[0]
4659 reader.skip(4)
4660 _experimenter = reader.read("!L")[0]
4661 assert(_experimenter == 6035143)
4662 _subtype = reader.read("!L")[0]
4663 assert(_subtype == 9)
4664 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_vlan_counter_stats_entry.unpack)
4665 return obj
4666
4667 def __eq__(self, other):
4668 if type(self) != type(other): return False
4669 if self.xid != other.xid: return False
4670 if self.flags != other.flags: return False
4671 if self.entries != other.entries: return False
4672 return True
4673
4674 def pretty_print(self, q):
4675 q.text("bsn_vlan_counter_stats_reply {")
4676 with q.group():
4677 with q.indent(2):
4678 q.breakable()
4679 q.text("xid = ");
4680 if self.xid != None:
4681 q.text("%#x" % self.xid)
4682 else:
4683 q.text('None')
4684 q.text(","); q.breakable()
4685 q.text("flags = ");
4686 q.text("%#x" % self.flags)
4687 q.text(","); q.breakable()
4688 q.text("entries = ");
4689 q.pp(self.entries)
4690 q.breakable()
4691 q.text('}')
4692
4693bsn_stats_reply.subtypes[9] = bsn_vlan_counter_stats_reply
4694
4695class bsn_vlan_counter_stats_request(bsn_stats_request):
4696 version = 4
4697 type = 18
4698 stats_type = 65535
4699 experimenter = 6035143
4700 subtype = 9
4701
4702 def __init__(self, xid=None, flags=None, vlan_vid=None):
4703 if xid != None:
4704 self.xid = xid
4705 else:
4706 self.xid = None
4707 if flags != None:
4708 self.flags = flags
4709 else:
4710 self.flags = 0
4711 if vlan_vid != None:
4712 self.vlan_vid = vlan_vid
4713 else:
4714 self.vlan_vid = 0
4715 return
4716
4717 def pack(self):
4718 packed = []
4719 packed.append(struct.pack("!B", self.version))
4720 packed.append(struct.pack("!B", self.type))
4721 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4722 packed.append(struct.pack("!L", self.xid))
4723 packed.append(struct.pack("!H", self.stats_type))
4724 packed.append(struct.pack("!H", self.flags))
4725 packed.append('\x00' * 4)
4726 packed.append(struct.pack("!L", self.experimenter))
4727 packed.append(struct.pack("!L", self.subtype))
4728 packed.append(struct.pack("!H", self.vlan_vid))
4729 length = sum([len(x) for x in packed])
4730 packed[2] = struct.pack("!H", length)
4731 return ''.join(packed)
4732
4733 @staticmethod
4734 def unpack(reader):
4735 obj = bsn_vlan_counter_stats_request()
4736 _version = reader.read("!B")[0]
4737 assert(_version == 4)
4738 _type = reader.read("!B")[0]
4739 assert(_type == 18)
4740 _length = reader.read("!H")[0]
4741 orig_reader = reader
4742 reader = orig_reader.slice(_length - (2 + 2))
4743 obj.xid = reader.read("!L")[0]
4744 _stats_type = reader.read("!H")[0]
4745 assert(_stats_type == 65535)
4746 obj.flags = reader.read("!H")[0]
4747 reader.skip(4)
4748 _experimenter = reader.read("!L")[0]
4749 assert(_experimenter == 6035143)
4750 _subtype = reader.read("!L")[0]
4751 assert(_subtype == 9)
4752 obj.vlan_vid = reader.read("!H")[0]
4753 return obj
4754
4755 def __eq__(self, other):
4756 if type(self) != type(other): return False
4757 if self.xid != other.xid: return False
4758 if self.flags != other.flags: return False
4759 if self.vlan_vid != other.vlan_vid: return False
4760 return True
4761
4762 def pretty_print(self, q):
4763 q.text("bsn_vlan_counter_stats_request {")
4764 with q.group():
4765 with q.indent(2):
4766 q.breakable()
4767 q.text("xid = ");
4768 if self.xid != None:
4769 q.text("%#x" % self.xid)
4770 else:
4771 q.text('None')
4772 q.text(","); q.breakable()
4773 q.text("flags = ");
4774 q.text("%#x" % self.flags)
4775 q.text(","); q.breakable()
4776 q.text("vlan_vid = ");
4777 q.text("%#x" % self.vlan_vid)
4778 q.breakable()
4779 q.text('}')
4780
4781bsn_stats_request.subtypes[9] = bsn_vlan_counter_stats_request
4782
4783class desc_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -07004784 version = 4
4785 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -07004786 stats_type = 0
4787
4788 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 -08004789 if xid != None:
4790 self.xid = xid
4791 else:
4792 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07004793 if flags != None:
4794 self.flags = flags
4795 else:
4796 self.flags = 0
4797 if mfr_desc != None:
4798 self.mfr_desc = mfr_desc
4799 else:
4800 self.mfr_desc = ""
4801 if hw_desc != None:
4802 self.hw_desc = hw_desc
4803 else:
4804 self.hw_desc = ""
4805 if sw_desc != None:
4806 self.sw_desc = sw_desc
4807 else:
4808 self.sw_desc = ""
4809 if serial_num != None:
4810 self.serial_num = serial_num
4811 else:
4812 self.serial_num = ""
4813 if dp_desc != None:
4814 self.dp_desc = dp_desc
4815 else:
4816 self.dp_desc = ""
Rich Lane7dcdf022013-12-11 14:45:27 -08004817 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07004818
4819 def pack(self):
4820 packed = []
4821 packed.append(struct.pack("!B", self.version))
4822 packed.append(struct.pack("!B", self.type))
4823 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4824 packed.append(struct.pack("!L", self.xid))
4825 packed.append(struct.pack("!H", self.stats_type))
4826 packed.append(struct.pack("!H", self.flags))
4827 packed.append('\x00' * 4)
4828 packed.append(struct.pack("!256s", self.mfr_desc))
4829 packed.append(struct.pack("!256s", self.hw_desc))
4830 packed.append(struct.pack("!256s", self.sw_desc))
4831 packed.append(struct.pack("!32s", self.serial_num))
4832 packed.append(struct.pack("!256s", self.dp_desc))
4833 length = sum([len(x) for x in packed])
4834 packed[2] = struct.pack("!H", length)
4835 return ''.join(packed)
4836
4837 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004838 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07004839 obj = desc_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07004840 _version = reader.read("!B")[0]
4841 assert(_version == 4)
4842 _type = reader.read("!B")[0]
4843 assert(_type == 19)
4844 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004845 orig_reader = reader
4846 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07004847 obj.xid = reader.read("!L")[0]
4848 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07004849 assert(_stats_type == 0)
Dan Talaycof6202252013-07-02 01:00:29 -07004850 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07004851 reader.skip(4)
4852 obj.mfr_desc = reader.read("!256s")[0].rstrip("\x00")
4853 obj.hw_desc = reader.read("!256s")[0].rstrip("\x00")
4854 obj.sw_desc = reader.read("!256s")[0].rstrip("\x00")
4855 obj.serial_num = reader.read("!32s")[0].rstrip("\x00")
4856 obj.dp_desc = reader.read("!256s")[0].rstrip("\x00")
4857 return obj
4858
4859 def __eq__(self, other):
4860 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07004861 if self.xid != other.xid: return False
4862 if self.flags != other.flags: return False
4863 if self.mfr_desc != other.mfr_desc: return False
4864 if self.hw_desc != other.hw_desc: return False
4865 if self.sw_desc != other.sw_desc: return False
4866 if self.serial_num != other.serial_num: return False
4867 if self.dp_desc != other.dp_desc: return False
4868 return True
4869
Rich Lanec2ee4b82013-04-24 17:12:38 -07004870 def pretty_print(self, q):
4871 q.text("desc_stats_reply {")
4872 with q.group():
4873 with q.indent(2):
4874 q.breakable()
4875 q.text("xid = ");
4876 if self.xid != None:
4877 q.text("%#x" % self.xid)
4878 else:
4879 q.text('None')
4880 q.text(","); q.breakable()
4881 q.text("flags = ");
4882 q.text("%#x" % self.flags)
4883 q.text(","); q.breakable()
4884 q.text("mfr_desc = ");
4885 q.pp(self.mfr_desc)
4886 q.text(","); q.breakable()
4887 q.text("hw_desc = ");
4888 q.pp(self.hw_desc)
4889 q.text(","); q.breakable()
4890 q.text("sw_desc = ");
4891 q.pp(self.sw_desc)
4892 q.text(","); q.breakable()
4893 q.text("serial_num = ");
4894 q.pp(self.serial_num)
4895 q.text(","); q.breakable()
4896 q.text("dp_desc = ");
4897 q.pp(self.dp_desc)
4898 q.breakable()
4899 q.text('}')
4900
Rich Lane7dcdf022013-12-11 14:45:27 -08004901stats_reply.subtypes[0] = desc_stats_reply
4902
4903class desc_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -07004904 version = 4
4905 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -07004906 stats_type = 0
4907
4908 def __init__(self, xid=None, flags=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08004909 if xid != None:
4910 self.xid = xid
4911 else:
4912 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07004913 if flags != None:
4914 self.flags = flags
4915 else:
4916 self.flags = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08004917 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07004918
4919 def pack(self):
4920 packed = []
4921 packed.append(struct.pack("!B", self.version))
4922 packed.append(struct.pack("!B", self.type))
4923 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4924 packed.append(struct.pack("!L", self.xid))
4925 packed.append(struct.pack("!H", self.stats_type))
4926 packed.append(struct.pack("!H", self.flags))
4927 packed.append('\x00' * 4)
4928 length = sum([len(x) for x in packed])
4929 packed[2] = struct.pack("!H", length)
4930 return ''.join(packed)
4931
4932 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004933 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07004934 obj = desc_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -07004935 _version = reader.read("!B")[0]
4936 assert(_version == 4)
4937 _type = reader.read("!B")[0]
4938 assert(_type == 18)
4939 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004940 orig_reader = reader
4941 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07004942 obj.xid = reader.read("!L")[0]
4943 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07004944 assert(_stats_type == 0)
Dan Talaycof6202252013-07-02 01:00:29 -07004945 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07004946 reader.skip(4)
4947 return obj
4948
4949 def __eq__(self, other):
4950 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07004951 if self.xid != other.xid: return False
4952 if self.flags != other.flags: return False
4953 return True
4954
Rich Lanec2ee4b82013-04-24 17:12:38 -07004955 def pretty_print(self, q):
4956 q.text("desc_stats_request {")
4957 with q.group():
4958 with q.indent(2):
4959 q.breakable()
4960 q.text("xid = ");
4961 if self.xid != None:
4962 q.text("%#x" % self.xid)
4963 else:
4964 q.text('None')
4965 q.text(","); q.breakable()
4966 q.text("flags = ");
4967 q.text("%#x" % self.flags)
4968 q.breakable()
4969 q.text('}')
4970
Rich Lane7dcdf022013-12-11 14:45:27 -08004971stats_request.subtypes[0] = desc_stats_request
4972
4973class echo_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -07004974 version = 4
4975 type = 3
Rich Lanec2ee4b82013-04-24 17:12:38 -07004976
4977 def __init__(self, xid=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08004978 if xid != None:
4979 self.xid = xid
4980 else:
4981 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07004982 if data != None:
4983 self.data = data
4984 else:
Dan Talaycof6202252013-07-02 01:00:29 -07004985 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08004986 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07004987
4988 def pack(self):
4989 packed = []
4990 packed.append(struct.pack("!B", self.version))
4991 packed.append(struct.pack("!B", self.type))
4992 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4993 packed.append(struct.pack("!L", self.xid))
4994 packed.append(self.data)
4995 length = sum([len(x) for x in packed])
4996 packed[2] = struct.pack("!H", length)
4997 return ''.join(packed)
4998
4999 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005000 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07005001 obj = echo_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07005002 _version = reader.read("!B")[0]
5003 assert(_version == 4)
5004 _type = reader.read("!B")[0]
5005 assert(_type == 3)
5006 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005007 orig_reader = reader
5008 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07005009 obj.xid = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07005010 obj.data = str(reader.read_all())
5011 return obj
5012
5013 def __eq__(self, other):
5014 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07005015 if self.xid != other.xid: return False
5016 if self.data != other.data: return False
5017 return True
5018
Rich Lanec2ee4b82013-04-24 17:12:38 -07005019 def pretty_print(self, q):
5020 q.text("echo_reply {")
5021 with q.group():
5022 with q.indent(2):
5023 q.breakable()
5024 q.text("xid = ");
5025 if self.xid != None:
5026 q.text("%#x" % self.xid)
5027 else:
5028 q.text('None')
5029 q.text(","); q.breakable()
5030 q.text("data = ");
5031 q.pp(self.data)
5032 q.breakable()
5033 q.text('}')
5034
Rich Lane7dcdf022013-12-11 14:45:27 -08005035message.subtypes[3] = echo_reply
5036
5037class echo_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -07005038 version = 4
5039 type = 2
Rich Lanec2ee4b82013-04-24 17:12:38 -07005040
5041 def __init__(self, xid=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005042 if xid != None:
5043 self.xid = xid
5044 else:
5045 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07005046 if data != None:
5047 self.data = data
5048 else:
Dan Talaycof6202252013-07-02 01:00:29 -07005049 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08005050 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07005051
5052 def pack(self):
5053 packed = []
5054 packed.append(struct.pack("!B", self.version))
5055 packed.append(struct.pack("!B", self.type))
5056 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5057 packed.append(struct.pack("!L", self.xid))
5058 packed.append(self.data)
5059 length = sum([len(x) for x in packed])
5060 packed[2] = struct.pack("!H", length)
5061 return ''.join(packed)
5062
5063 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005064 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07005065 obj = echo_request()
Dan Talaycof6202252013-07-02 01:00:29 -07005066 _version = reader.read("!B")[0]
5067 assert(_version == 4)
5068 _type = reader.read("!B")[0]
5069 assert(_type == 2)
5070 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005071 orig_reader = reader
5072 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07005073 obj.xid = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07005074 obj.data = str(reader.read_all())
5075 return obj
5076
5077 def __eq__(self, other):
5078 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07005079 if self.xid != other.xid: return False
5080 if self.data != other.data: return False
5081 return True
5082
Rich Lanec2ee4b82013-04-24 17:12:38 -07005083 def pretty_print(self, q):
5084 q.text("echo_request {")
5085 with q.group():
5086 with q.indent(2):
5087 q.breakable()
5088 q.text("xid = ");
5089 if self.xid != None:
5090 q.text("%#x" % self.xid)
5091 else:
5092 q.text('None')
5093 q.text(","); q.breakable()
5094 q.text("data = ");
5095 q.pp(self.data)
5096 q.breakable()
5097 q.text('}')
5098
Rich Lane7dcdf022013-12-11 14:45:27 -08005099message.subtypes[2] = echo_request
5100
5101class experimenter_error_msg(error_msg):
Dan Talaycof6202252013-07-02 01:00:29 -07005102 version = 4
5103 type = 1
Rich Lane6f4978c2013-10-20 21:33:52 -07005104 err_type = 65535
Rich Lanec2ee4b82013-04-24 17:12:38 -07005105
Rich Lane6f4978c2013-10-20 21:33:52 -07005106 def __init__(self, xid=None, subtype=None, experimenter=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005107 if xid != None:
5108 self.xid = xid
5109 else:
5110 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07005111 if subtype != None:
5112 self.subtype = subtype
Rich Lanec2ee4b82013-04-24 17:12:38 -07005113 else:
Rich Lane6f4978c2013-10-20 21:33:52 -07005114 self.subtype = 0
5115 if experimenter != None:
5116 self.experimenter = experimenter
Rich Lanec2ee4b82013-04-24 17:12:38 -07005117 else:
Rich Lane6f4978c2013-10-20 21:33:52 -07005118 self.experimenter = 0
Rich Lanec2ee4b82013-04-24 17:12:38 -07005119 if data != None:
5120 self.data = data
5121 else:
Dan Talaycof6202252013-07-02 01:00:29 -07005122 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08005123 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07005124
5125 def pack(self):
5126 packed = []
5127 packed.append(struct.pack("!B", self.version))
5128 packed.append(struct.pack("!B", self.type))
5129 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5130 packed.append(struct.pack("!L", self.xid))
5131 packed.append(struct.pack("!H", self.err_type))
Rich Lane6f4978c2013-10-20 21:33:52 -07005132 packed.append(struct.pack("!H", self.subtype))
5133 packed.append(struct.pack("!L", self.experimenter))
Rich Lanec2ee4b82013-04-24 17:12:38 -07005134 packed.append(self.data)
5135 length = sum([len(x) for x in packed])
5136 packed[2] = struct.pack("!H", length)
5137 return ''.join(packed)
5138
5139 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005140 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07005141 obj = experimenter_error_msg()
Dan Talaycof6202252013-07-02 01:00:29 -07005142 _version = reader.read("!B")[0]
5143 assert(_version == 4)
5144 _type = reader.read("!B")[0]
5145 assert(_type == 1)
5146 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005147 orig_reader = reader
5148 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07005149 obj.xid = reader.read("!L")[0]
Rich Lane6f4978c2013-10-20 21:33:52 -07005150 _err_type = reader.read("!H")[0]
5151 assert(_err_type == 65535)
5152 obj.subtype = reader.read("!H")[0]
5153 obj.experimenter = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07005154 obj.data = str(reader.read_all())
5155 return obj
5156
5157 def __eq__(self, other):
5158 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07005159 if self.xid != other.xid: return False
Rich Lane6f4978c2013-10-20 21:33:52 -07005160 if self.subtype != other.subtype: return False
5161 if self.experimenter != other.experimenter: return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07005162 if self.data != other.data: return False
5163 return True
5164
Rich Lanec2ee4b82013-04-24 17:12:38 -07005165 def pretty_print(self, q):
Rich Lane6f4978c2013-10-20 21:33:52 -07005166 q.text("experimenter_error_msg {")
Rich Lanec2ee4b82013-04-24 17:12:38 -07005167 with q.group():
5168 with q.indent(2):
5169 q.breakable()
5170 q.text("xid = ");
5171 if self.xid != None:
5172 q.text("%#x" % self.xid)
5173 else:
5174 q.text('None')
5175 q.text(","); q.breakable()
Rich Lane6f4978c2013-10-20 21:33:52 -07005176 q.text("subtype = ");
5177 q.text("%#x" % self.subtype)
Rich Lanec2ee4b82013-04-24 17:12:38 -07005178 q.text(","); q.breakable()
Rich Lane6f4978c2013-10-20 21:33:52 -07005179 q.text("experimenter = ");
5180 q.text("%#x" % self.experimenter)
Rich Lanec2ee4b82013-04-24 17:12:38 -07005181 q.text(","); q.breakable()
5182 q.text("data = ");
5183 q.pp(self.data)
5184 q.breakable()
5185 q.text('}')
5186
Rich Lane7dcdf022013-12-11 14:45:27 -08005187error_msg.subtypes[65535] = experimenter_error_msg
5188
5189class features_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -07005190 version = 4
5191 type = 6
Rich Lanec2ee4b82013-04-24 17:12:38 -07005192
5193 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 -08005194 if xid != None:
5195 self.xid = xid
5196 else:
5197 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07005198 if datapath_id != None:
5199 self.datapath_id = datapath_id
5200 else:
5201 self.datapath_id = 0
5202 if n_buffers != None:
5203 self.n_buffers = n_buffers
5204 else:
5205 self.n_buffers = 0
5206 if n_tables != None:
5207 self.n_tables = n_tables
5208 else:
5209 self.n_tables = 0
5210 if auxiliary_id != None:
5211 self.auxiliary_id = auxiliary_id
5212 else:
5213 self.auxiliary_id = 0
5214 if capabilities != None:
5215 self.capabilities = capabilities
5216 else:
5217 self.capabilities = 0
5218 if reserved != None:
5219 self.reserved = reserved
5220 else:
5221 self.reserved = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08005222 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07005223
5224 def pack(self):
5225 packed = []
5226 packed.append(struct.pack("!B", self.version))
5227 packed.append(struct.pack("!B", self.type))
5228 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5229 packed.append(struct.pack("!L", self.xid))
5230 packed.append(struct.pack("!Q", self.datapath_id))
5231 packed.append(struct.pack("!L", self.n_buffers))
5232 packed.append(struct.pack("!B", self.n_tables))
5233 packed.append(struct.pack("!B", self.auxiliary_id))
5234 packed.append('\x00' * 2)
5235 packed.append(struct.pack("!L", self.capabilities))
5236 packed.append(struct.pack("!L", self.reserved))
5237 length = sum([len(x) for x in packed])
5238 packed[2] = struct.pack("!H", length)
5239 return ''.join(packed)
5240
5241 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005242 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07005243 obj = features_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07005244 _version = reader.read("!B")[0]
5245 assert(_version == 4)
5246 _type = reader.read("!B")[0]
5247 assert(_type == 6)
5248 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005249 orig_reader = reader
5250 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07005251 obj.xid = reader.read("!L")[0]
5252 obj.datapath_id = reader.read("!Q")[0]
5253 obj.n_buffers = reader.read("!L")[0]
5254 obj.n_tables = reader.read("!B")[0]
5255 obj.auxiliary_id = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07005256 reader.skip(2)
Dan Talaycof6202252013-07-02 01:00:29 -07005257 obj.capabilities = reader.read("!L")[0]
5258 obj.reserved = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07005259 return obj
5260
5261 def __eq__(self, other):
5262 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07005263 if self.xid != other.xid: return False
5264 if self.datapath_id != other.datapath_id: return False
5265 if self.n_buffers != other.n_buffers: return False
5266 if self.n_tables != other.n_tables: return False
5267 if self.auxiliary_id != other.auxiliary_id: return False
5268 if self.capabilities != other.capabilities: return False
5269 if self.reserved != other.reserved: return False
5270 return True
5271
Rich Lanec2ee4b82013-04-24 17:12:38 -07005272 def pretty_print(self, q):
5273 q.text("features_reply {")
5274 with q.group():
5275 with q.indent(2):
5276 q.breakable()
5277 q.text("xid = ");
5278 if self.xid != None:
5279 q.text("%#x" % self.xid)
5280 else:
5281 q.text('None')
5282 q.text(","); q.breakable()
5283 q.text("datapath_id = ");
5284 q.text("%#x" % self.datapath_id)
5285 q.text(","); q.breakable()
5286 q.text("n_buffers = ");
5287 q.text("%#x" % self.n_buffers)
5288 q.text(","); q.breakable()
5289 q.text("n_tables = ");
5290 q.text("%#x" % self.n_tables)
5291 q.text(","); q.breakable()
5292 q.text("auxiliary_id = ");
5293 q.text("%#x" % self.auxiliary_id)
5294 q.text(","); q.breakable()
5295 q.text("capabilities = ");
5296 q.text("%#x" % self.capabilities)
5297 q.text(","); q.breakable()
5298 q.text("reserved = ");
5299 q.text("%#x" % self.reserved)
5300 q.breakable()
5301 q.text('}')
5302
Rich Lane7dcdf022013-12-11 14:45:27 -08005303message.subtypes[6] = features_reply
5304
5305class features_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -07005306 version = 4
5307 type = 5
Rich Lanec2ee4b82013-04-24 17:12:38 -07005308
5309 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005310 if xid != None:
5311 self.xid = xid
5312 else:
5313 self.xid = None
5314 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07005315
5316 def pack(self):
5317 packed = []
5318 packed.append(struct.pack("!B", self.version))
5319 packed.append(struct.pack("!B", self.type))
5320 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5321 packed.append(struct.pack("!L", self.xid))
5322 length = sum([len(x) for x in packed])
5323 packed[2] = struct.pack("!H", length)
5324 return ''.join(packed)
5325
5326 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005327 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07005328 obj = features_request()
Dan Talaycof6202252013-07-02 01:00:29 -07005329 _version = reader.read("!B")[0]
5330 assert(_version == 4)
5331 _type = reader.read("!B")[0]
5332 assert(_type == 5)
5333 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005334 orig_reader = reader
5335 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07005336 obj.xid = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07005337 return obj
5338
5339 def __eq__(self, other):
5340 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07005341 if self.xid != other.xid: return False
5342 return True
5343
Rich Lanec2ee4b82013-04-24 17:12:38 -07005344 def pretty_print(self, q):
5345 q.text("features_request {")
5346 with q.group():
5347 with q.indent(2):
5348 q.breakable()
5349 q.text("xid = ");
5350 if self.xid != None:
5351 q.text("%#x" % self.xid)
5352 else:
5353 q.text('None')
5354 q.breakable()
5355 q.text('}')
5356
Rich Lane7dcdf022013-12-11 14:45:27 -08005357message.subtypes[5] = features_request
5358
5359class flow_mod(message):
5360 subtypes = {}
5361
5362 @staticmethod
5363 def unpack(reader):
5364 subtype, = reader.peek('B', 25)
5365 try:
5366 subclass = flow_mod.subtypes[subtype]
5367 except KeyError:
5368 raise loxi.ProtocolError("unknown flow_mod message subtype %#x" % subtype)
5369 return subclass.unpack(reader)
5370
5371message.subtypes[14] = flow_mod
5372
5373class flow_add(flow_mod):
Dan Talaycof6202252013-07-02 01:00:29 -07005374 version = 4
5375 type = 14
5376 _command = 0
Rich Lanec2ee4b82013-04-24 17:12:38 -07005377
5378 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 -08005379 if xid != None:
5380 self.xid = xid
5381 else:
5382 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07005383 if cookie != None:
5384 self.cookie = cookie
5385 else:
5386 self.cookie = 0
5387 if cookie_mask != None:
5388 self.cookie_mask = cookie_mask
5389 else:
5390 self.cookie_mask = 0
5391 if table_id != None:
5392 self.table_id = table_id
5393 else:
5394 self.table_id = 0
5395 if idle_timeout != None:
5396 self.idle_timeout = idle_timeout
5397 else:
5398 self.idle_timeout = 0
5399 if hard_timeout != None:
5400 self.hard_timeout = hard_timeout
5401 else:
5402 self.hard_timeout = 0
5403 if priority != None:
5404 self.priority = priority
5405 else:
5406 self.priority = 0
5407 if buffer_id != None:
5408 self.buffer_id = buffer_id
5409 else:
5410 self.buffer_id = 0
5411 if out_port != None:
5412 self.out_port = out_port
5413 else:
5414 self.out_port = 0
5415 if out_group != None:
5416 self.out_group = out_group
5417 else:
5418 self.out_group = 0
5419 if flags != None:
5420 self.flags = flags
5421 else:
5422 self.flags = 0
5423 if match != None:
5424 self.match = match
5425 else:
5426 self.match = common.match()
5427 if instructions != None:
5428 self.instructions = instructions
5429 else:
5430 self.instructions = []
Rich Lane7dcdf022013-12-11 14:45:27 -08005431 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07005432
5433 def pack(self):
5434 packed = []
5435 packed.append(struct.pack("!B", self.version))
5436 packed.append(struct.pack("!B", self.type))
5437 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5438 packed.append(struct.pack("!L", self.xid))
5439 packed.append(struct.pack("!Q", self.cookie))
5440 packed.append(struct.pack("!Q", self.cookie_mask))
5441 packed.append(struct.pack("!B", self.table_id))
Dan Talaycof6202252013-07-02 01:00:29 -07005442 packed.append(util.pack_fm_cmd(self._command))
Rich Lanec2ee4b82013-04-24 17:12:38 -07005443 packed.append(struct.pack("!H", self.idle_timeout))
5444 packed.append(struct.pack("!H", self.hard_timeout))
5445 packed.append(struct.pack("!H", self.priority))
5446 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -07005447 packed.append(util.pack_port_no(self.out_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -07005448 packed.append(struct.pack("!L", self.out_group))
5449 packed.append(struct.pack("!H", self.flags))
5450 packed.append('\x00' * 2)
5451 packed.append(self.match.pack())
Rich Lane7dcdf022013-12-11 14:45:27 -08005452 packed.append(loxi.generic_util.pack_list(self.instructions))
Rich Lanec2ee4b82013-04-24 17:12:38 -07005453 length = sum([len(x) for x in packed])
5454 packed[2] = struct.pack("!H", length)
5455 return ''.join(packed)
5456
5457 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005458 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07005459 obj = flow_add()
Dan Talaycof6202252013-07-02 01:00:29 -07005460 _version = reader.read("!B")[0]
5461 assert(_version == 4)
5462 _type = reader.read("!B")[0]
5463 assert(_type == 14)
5464 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005465 orig_reader = reader
5466 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07005467 obj.xid = reader.read("!L")[0]
5468 obj.cookie = reader.read("!Q")[0]
5469 obj.cookie_mask = reader.read("!Q")[0]
5470 obj.table_id = reader.read("!B")[0]
5471 __command = util.unpack_fm_cmd(reader)
5472 assert(__command == 0)
5473 obj.idle_timeout = reader.read("!H")[0]
5474 obj.hard_timeout = reader.read("!H")[0]
5475 obj.priority = reader.read("!H")[0]
5476 obj.buffer_id = reader.read("!L")[0]
5477 obj.out_port = util.unpack_port_no(reader)
5478 obj.out_group = reader.read("!L")[0]
5479 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07005480 reader.skip(2)
5481 obj.match = common.match.unpack(reader)
Rich Lane7dcdf022013-12-11 14:45:27 -08005482 obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -07005483 return obj
5484
5485 def __eq__(self, other):
5486 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07005487 if self.xid != other.xid: return False
5488 if self.cookie != other.cookie: return False
5489 if self.cookie_mask != other.cookie_mask: return False
5490 if self.table_id != other.table_id: return False
5491 if self.idle_timeout != other.idle_timeout: return False
5492 if self.hard_timeout != other.hard_timeout: return False
5493 if self.priority != other.priority: return False
5494 if self.buffer_id != other.buffer_id: return False
5495 if self.out_port != other.out_port: return False
5496 if self.out_group != other.out_group: return False
5497 if self.flags != other.flags: return False
5498 if self.match != other.match: return False
5499 if self.instructions != other.instructions: return False
5500 return True
5501
Rich Lanec2ee4b82013-04-24 17:12:38 -07005502 def pretty_print(self, q):
5503 q.text("flow_add {")
5504 with q.group():
5505 with q.indent(2):
5506 q.breakable()
5507 q.text("xid = ");
5508 if self.xid != None:
5509 q.text("%#x" % self.xid)
5510 else:
5511 q.text('None')
5512 q.text(","); q.breakable()
5513 q.text("cookie = ");
5514 q.text("%#x" % self.cookie)
5515 q.text(","); q.breakable()
5516 q.text("cookie_mask = ");
5517 q.text("%#x" % self.cookie_mask)
5518 q.text(","); q.breakable()
5519 q.text("table_id = ");
5520 q.text("%#x" % self.table_id)
5521 q.text(","); q.breakable()
5522 q.text("idle_timeout = ");
5523 q.text("%#x" % self.idle_timeout)
5524 q.text(","); q.breakable()
5525 q.text("hard_timeout = ");
5526 q.text("%#x" % self.hard_timeout)
5527 q.text(","); q.breakable()
5528 q.text("priority = ");
5529 q.text("%#x" % self.priority)
5530 q.text(","); q.breakable()
5531 q.text("buffer_id = ");
5532 q.text("%#x" % self.buffer_id)
5533 q.text(","); q.breakable()
5534 q.text("out_port = ");
5535 q.text(util.pretty_port(self.out_port))
5536 q.text(","); q.breakable()
5537 q.text("out_group = ");
5538 q.text("%#x" % self.out_group)
5539 q.text(","); q.breakable()
5540 q.text("flags = ");
5541 q.text("%#x" % self.flags)
5542 q.text(","); q.breakable()
5543 q.text("match = ");
5544 q.pp(self.match)
5545 q.text(","); q.breakable()
5546 q.text("instructions = ");
5547 q.pp(self.instructions)
5548 q.breakable()
5549 q.text('}')
5550
Rich Lane7dcdf022013-12-11 14:45:27 -08005551flow_mod.subtypes[0] = flow_add
5552
5553class flow_delete(flow_mod):
Dan Talaycof6202252013-07-02 01:00:29 -07005554 version = 4
5555 type = 14
5556 _command = 3
Rich Lanec2ee4b82013-04-24 17:12:38 -07005557
5558 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 -08005559 if xid != None:
5560 self.xid = xid
5561 else:
5562 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07005563 if cookie != None:
5564 self.cookie = cookie
5565 else:
5566 self.cookie = 0
5567 if cookie_mask != None:
5568 self.cookie_mask = cookie_mask
5569 else:
5570 self.cookie_mask = 0
5571 if table_id != None:
5572 self.table_id = table_id
5573 else:
5574 self.table_id = 0
5575 if idle_timeout != None:
5576 self.idle_timeout = idle_timeout
5577 else:
5578 self.idle_timeout = 0
5579 if hard_timeout != None:
5580 self.hard_timeout = hard_timeout
5581 else:
5582 self.hard_timeout = 0
5583 if priority != None:
5584 self.priority = priority
5585 else:
5586 self.priority = 0
5587 if buffer_id != None:
5588 self.buffer_id = buffer_id
5589 else:
5590 self.buffer_id = 0
5591 if out_port != None:
5592 self.out_port = out_port
5593 else:
5594 self.out_port = 0
5595 if out_group != None:
5596 self.out_group = out_group
5597 else:
5598 self.out_group = 0
5599 if flags != None:
5600 self.flags = flags
5601 else:
5602 self.flags = 0
5603 if match != None:
5604 self.match = match
5605 else:
5606 self.match = common.match()
5607 if instructions != None:
5608 self.instructions = instructions
5609 else:
5610 self.instructions = []
Rich Lane7dcdf022013-12-11 14:45:27 -08005611 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07005612
5613 def pack(self):
5614 packed = []
5615 packed.append(struct.pack("!B", self.version))
5616 packed.append(struct.pack("!B", self.type))
5617 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5618 packed.append(struct.pack("!L", self.xid))
5619 packed.append(struct.pack("!Q", self.cookie))
5620 packed.append(struct.pack("!Q", self.cookie_mask))
5621 packed.append(struct.pack("!B", self.table_id))
Dan Talaycof6202252013-07-02 01:00:29 -07005622 packed.append(util.pack_fm_cmd(self._command))
Rich Lanec2ee4b82013-04-24 17:12:38 -07005623 packed.append(struct.pack("!H", self.idle_timeout))
5624 packed.append(struct.pack("!H", self.hard_timeout))
5625 packed.append(struct.pack("!H", self.priority))
5626 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -07005627 packed.append(util.pack_port_no(self.out_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -07005628 packed.append(struct.pack("!L", self.out_group))
5629 packed.append(struct.pack("!H", self.flags))
5630 packed.append('\x00' * 2)
5631 packed.append(self.match.pack())
Rich Lane7dcdf022013-12-11 14:45:27 -08005632 packed.append(loxi.generic_util.pack_list(self.instructions))
Rich Lanec2ee4b82013-04-24 17:12:38 -07005633 length = sum([len(x) for x in packed])
5634 packed[2] = struct.pack("!H", length)
5635 return ''.join(packed)
5636
5637 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005638 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07005639 obj = flow_delete()
Dan Talaycof6202252013-07-02 01:00:29 -07005640 _version = reader.read("!B")[0]
5641 assert(_version == 4)
5642 _type = reader.read("!B")[0]
5643 assert(_type == 14)
5644 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005645 orig_reader = reader
5646 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07005647 obj.xid = reader.read("!L")[0]
5648 obj.cookie = reader.read("!Q")[0]
5649 obj.cookie_mask = reader.read("!Q")[0]
5650 obj.table_id = reader.read("!B")[0]
5651 __command = util.unpack_fm_cmd(reader)
5652 assert(__command == 3)
5653 obj.idle_timeout = reader.read("!H")[0]
5654 obj.hard_timeout = reader.read("!H")[0]
5655 obj.priority = reader.read("!H")[0]
5656 obj.buffer_id = reader.read("!L")[0]
5657 obj.out_port = util.unpack_port_no(reader)
5658 obj.out_group = reader.read("!L")[0]
5659 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07005660 reader.skip(2)
5661 obj.match = common.match.unpack(reader)
Rich Lane7dcdf022013-12-11 14:45:27 -08005662 obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -07005663 return obj
5664
5665 def __eq__(self, other):
5666 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07005667 if self.xid != other.xid: return False
5668 if self.cookie != other.cookie: return False
5669 if self.cookie_mask != other.cookie_mask: return False
5670 if self.table_id != other.table_id: return False
5671 if self.idle_timeout != other.idle_timeout: return False
5672 if self.hard_timeout != other.hard_timeout: return False
5673 if self.priority != other.priority: return False
5674 if self.buffer_id != other.buffer_id: return False
5675 if self.out_port != other.out_port: return False
5676 if self.out_group != other.out_group: return False
5677 if self.flags != other.flags: return False
5678 if self.match != other.match: return False
5679 if self.instructions != other.instructions: return False
5680 return True
5681
Rich Lanec2ee4b82013-04-24 17:12:38 -07005682 def pretty_print(self, q):
5683 q.text("flow_delete {")
5684 with q.group():
5685 with q.indent(2):
5686 q.breakable()
5687 q.text("xid = ");
5688 if self.xid != None:
5689 q.text("%#x" % self.xid)
5690 else:
5691 q.text('None')
5692 q.text(","); q.breakable()
5693 q.text("cookie = ");
5694 q.text("%#x" % self.cookie)
5695 q.text(","); q.breakable()
5696 q.text("cookie_mask = ");
5697 q.text("%#x" % self.cookie_mask)
5698 q.text(","); q.breakable()
5699 q.text("table_id = ");
5700 q.text("%#x" % self.table_id)
5701 q.text(","); q.breakable()
5702 q.text("idle_timeout = ");
5703 q.text("%#x" % self.idle_timeout)
5704 q.text(","); q.breakable()
5705 q.text("hard_timeout = ");
5706 q.text("%#x" % self.hard_timeout)
5707 q.text(","); q.breakable()
5708 q.text("priority = ");
5709 q.text("%#x" % self.priority)
5710 q.text(","); q.breakable()
5711 q.text("buffer_id = ");
5712 q.text("%#x" % self.buffer_id)
5713 q.text(","); q.breakable()
5714 q.text("out_port = ");
5715 q.text(util.pretty_port(self.out_port))
5716 q.text(","); q.breakable()
5717 q.text("out_group = ");
5718 q.text("%#x" % self.out_group)
5719 q.text(","); q.breakable()
5720 q.text("flags = ");
5721 q.text("%#x" % self.flags)
5722 q.text(","); q.breakable()
5723 q.text("match = ");
5724 q.pp(self.match)
5725 q.text(","); q.breakable()
5726 q.text("instructions = ");
5727 q.pp(self.instructions)
5728 q.breakable()
5729 q.text('}')
5730
Rich Lane7dcdf022013-12-11 14:45:27 -08005731flow_mod.subtypes[3] = flow_delete
5732
5733class flow_delete_strict(flow_mod):
Dan Talaycof6202252013-07-02 01:00:29 -07005734 version = 4
5735 type = 14
5736 _command = 4
Rich Lanec2ee4b82013-04-24 17:12:38 -07005737
5738 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 -08005739 if xid != None:
5740 self.xid = xid
5741 else:
5742 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07005743 if cookie != None:
5744 self.cookie = cookie
5745 else:
5746 self.cookie = 0
5747 if cookie_mask != None:
5748 self.cookie_mask = cookie_mask
5749 else:
5750 self.cookie_mask = 0
5751 if table_id != None:
5752 self.table_id = table_id
5753 else:
5754 self.table_id = 0
5755 if idle_timeout != None:
5756 self.idle_timeout = idle_timeout
5757 else:
5758 self.idle_timeout = 0
5759 if hard_timeout != None:
5760 self.hard_timeout = hard_timeout
5761 else:
5762 self.hard_timeout = 0
5763 if priority != None:
5764 self.priority = priority
5765 else:
5766 self.priority = 0
5767 if buffer_id != None:
5768 self.buffer_id = buffer_id
5769 else:
5770 self.buffer_id = 0
5771 if out_port != None:
5772 self.out_port = out_port
5773 else:
5774 self.out_port = 0
5775 if out_group != None:
5776 self.out_group = out_group
5777 else:
5778 self.out_group = 0
5779 if flags != None:
5780 self.flags = flags
5781 else:
5782 self.flags = 0
5783 if match != None:
5784 self.match = match
5785 else:
5786 self.match = common.match()
5787 if instructions != None:
5788 self.instructions = instructions
5789 else:
5790 self.instructions = []
Rich Lane7dcdf022013-12-11 14:45:27 -08005791 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07005792
5793 def pack(self):
5794 packed = []
5795 packed.append(struct.pack("!B", self.version))
5796 packed.append(struct.pack("!B", self.type))
5797 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5798 packed.append(struct.pack("!L", self.xid))
5799 packed.append(struct.pack("!Q", self.cookie))
5800 packed.append(struct.pack("!Q", self.cookie_mask))
5801 packed.append(struct.pack("!B", self.table_id))
Dan Talaycof6202252013-07-02 01:00:29 -07005802 packed.append(util.pack_fm_cmd(self._command))
Rich Lanec2ee4b82013-04-24 17:12:38 -07005803 packed.append(struct.pack("!H", self.idle_timeout))
5804 packed.append(struct.pack("!H", self.hard_timeout))
5805 packed.append(struct.pack("!H", self.priority))
5806 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -07005807 packed.append(util.pack_port_no(self.out_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -07005808 packed.append(struct.pack("!L", self.out_group))
5809 packed.append(struct.pack("!H", self.flags))
5810 packed.append('\x00' * 2)
5811 packed.append(self.match.pack())
Rich Lane7dcdf022013-12-11 14:45:27 -08005812 packed.append(loxi.generic_util.pack_list(self.instructions))
Rich Lanec2ee4b82013-04-24 17:12:38 -07005813 length = sum([len(x) for x in packed])
5814 packed[2] = struct.pack("!H", length)
5815 return ''.join(packed)
5816
5817 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005818 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07005819 obj = flow_delete_strict()
Dan Talaycof6202252013-07-02 01:00:29 -07005820 _version = reader.read("!B")[0]
5821 assert(_version == 4)
5822 _type = reader.read("!B")[0]
5823 assert(_type == 14)
5824 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005825 orig_reader = reader
5826 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07005827 obj.xid = reader.read("!L")[0]
5828 obj.cookie = reader.read("!Q")[0]
5829 obj.cookie_mask = reader.read("!Q")[0]
5830 obj.table_id = reader.read("!B")[0]
5831 __command = util.unpack_fm_cmd(reader)
5832 assert(__command == 4)
5833 obj.idle_timeout = reader.read("!H")[0]
5834 obj.hard_timeout = reader.read("!H")[0]
5835 obj.priority = reader.read("!H")[0]
5836 obj.buffer_id = reader.read("!L")[0]
5837 obj.out_port = util.unpack_port_no(reader)
5838 obj.out_group = reader.read("!L")[0]
5839 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07005840 reader.skip(2)
5841 obj.match = common.match.unpack(reader)
Rich Lane7dcdf022013-12-11 14:45:27 -08005842 obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -07005843 return obj
5844
5845 def __eq__(self, other):
5846 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07005847 if self.xid != other.xid: return False
5848 if self.cookie != other.cookie: return False
5849 if self.cookie_mask != other.cookie_mask: return False
5850 if self.table_id != other.table_id: return False
5851 if self.idle_timeout != other.idle_timeout: return False
5852 if self.hard_timeout != other.hard_timeout: return False
5853 if self.priority != other.priority: return False
5854 if self.buffer_id != other.buffer_id: return False
5855 if self.out_port != other.out_port: return False
5856 if self.out_group != other.out_group: return False
5857 if self.flags != other.flags: return False
5858 if self.match != other.match: return False
5859 if self.instructions != other.instructions: return False
5860 return True
5861
Rich Lanec2ee4b82013-04-24 17:12:38 -07005862 def pretty_print(self, q):
5863 q.text("flow_delete_strict {")
5864 with q.group():
5865 with q.indent(2):
5866 q.breakable()
5867 q.text("xid = ");
5868 if self.xid != None:
5869 q.text("%#x" % self.xid)
5870 else:
5871 q.text('None')
5872 q.text(","); q.breakable()
5873 q.text("cookie = ");
5874 q.text("%#x" % self.cookie)
5875 q.text(","); q.breakable()
5876 q.text("cookie_mask = ");
5877 q.text("%#x" % self.cookie_mask)
5878 q.text(","); q.breakable()
5879 q.text("table_id = ");
5880 q.text("%#x" % self.table_id)
5881 q.text(","); q.breakable()
5882 q.text("idle_timeout = ");
5883 q.text("%#x" % self.idle_timeout)
5884 q.text(","); q.breakable()
5885 q.text("hard_timeout = ");
5886 q.text("%#x" % self.hard_timeout)
5887 q.text(","); q.breakable()
5888 q.text("priority = ");
5889 q.text("%#x" % self.priority)
5890 q.text(","); q.breakable()
5891 q.text("buffer_id = ");
5892 q.text("%#x" % self.buffer_id)
5893 q.text(","); q.breakable()
5894 q.text("out_port = ");
5895 q.text(util.pretty_port(self.out_port))
5896 q.text(","); q.breakable()
5897 q.text("out_group = ");
5898 q.text("%#x" % self.out_group)
5899 q.text(","); q.breakable()
5900 q.text("flags = ");
5901 q.text("%#x" % self.flags)
5902 q.text(","); q.breakable()
5903 q.text("match = ");
5904 q.pp(self.match)
5905 q.text(","); q.breakable()
5906 q.text("instructions = ");
5907 q.pp(self.instructions)
5908 q.breakable()
5909 q.text('}')
5910
Rich Lane7dcdf022013-12-11 14:45:27 -08005911flow_mod.subtypes[4] = flow_delete_strict
5912
5913class flow_mod_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -07005914 version = 4
5915 type = 1
5916 err_type = 5
5917
5918 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005919 if xid != None:
5920 self.xid = xid
5921 else:
5922 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07005923 if code != None:
5924 self.code = code
5925 else:
5926 self.code = 0
5927 if data != None:
5928 self.data = data
5929 else:
5930 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08005931 return
Rich Lane6f4978c2013-10-20 21:33:52 -07005932
5933 def pack(self):
5934 packed = []
5935 packed.append(struct.pack("!B", self.version))
5936 packed.append(struct.pack("!B", self.type))
5937 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5938 packed.append(struct.pack("!L", self.xid))
5939 packed.append(struct.pack("!H", self.err_type))
5940 packed.append(struct.pack("!H", self.code))
5941 packed.append(self.data)
5942 length = sum([len(x) for x in packed])
5943 packed[2] = struct.pack("!H", length)
5944 return ''.join(packed)
5945
5946 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005947 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07005948 obj = flow_mod_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -07005949 _version = reader.read("!B")[0]
5950 assert(_version == 4)
5951 _type = reader.read("!B")[0]
5952 assert(_type == 1)
5953 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005954 orig_reader = reader
5955 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07005956 obj.xid = reader.read("!L")[0]
5957 _err_type = reader.read("!H")[0]
5958 assert(_err_type == 5)
5959 obj.code = reader.read("!H")[0]
5960 obj.data = str(reader.read_all())
5961 return obj
5962
5963 def __eq__(self, other):
5964 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07005965 if self.xid != other.xid: return False
5966 if self.code != other.code: return False
5967 if self.data != other.data: return False
5968 return True
5969
Rich Lane6f4978c2013-10-20 21:33:52 -07005970 def pretty_print(self, q):
5971 q.text("flow_mod_failed_error_msg {")
5972 with q.group():
5973 with q.indent(2):
5974 q.breakable()
5975 q.text("xid = ");
5976 if self.xid != None:
5977 q.text("%#x" % self.xid)
5978 else:
5979 q.text('None')
5980 q.text(","); q.breakable()
5981 q.text("code = ");
5982 q.text("%#x" % self.code)
5983 q.text(","); q.breakable()
5984 q.text("data = ");
5985 q.pp(self.data)
5986 q.breakable()
5987 q.text('}')
5988
Rich Lane7dcdf022013-12-11 14:45:27 -08005989error_msg.subtypes[5] = flow_mod_failed_error_msg
5990
5991class flow_modify(flow_mod):
Dan Talaycof6202252013-07-02 01:00:29 -07005992 version = 4
5993 type = 14
5994 _command = 1
Rich Lanec2ee4b82013-04-24 17:12:38 -07005995
5996 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 -08005997 if xid != None:
5998 self.xid = xid
5999 else:
6000 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07006001 if cookie != None:
6002 self.cookie = cookie
6003 else:
6004 self.cookie = 0
6005 if cookie_mask != None:
6006 self.cookie_mask = cookie_mask
6007 else:
6008 self.cookie_mask = 0
6009 if table_id != None:
6010 self.table_id = table_id
6011 else:
6012 self.table_id = 0
6013 if idle_timeout != None:
6014 self.idle_timeout = idle_timeout
6015 else:
6016 self.idle_timeout = 0
6017 if hard_timeout != None:
6018 self.hard_timeout = hard_timeout
6019 else:
6020 self.hard_timeout = 0
6021 if priority != None:
6022 self.priority = priority
6023 else:
6024 self.priority = 0
6025 if buffer_id != None:
6026 self.buffer_id = buffer_id
6027 else:
6028 self.buffer_id = 0
6029 if out_port != None:
6030 self.out_port = out_port
6031 else:
6032 self.out_port = 0
6033 if out_group != None:
6034 self.out_group = out_group
6035 else:
6036 self.out_group = 0
6037 if flags != None:
6038 self.flags = flags
6039 else:
6040 self.flags = 0
6041 if match != None:
6042 self.match = match
6043 else:
6044 self.match = common.match()
6045 if instructions != None:
6046 self.instructions = instructions
6047 else:
6048 self.instructions = []
Rich Lane7dcdf022013-12-11 14:45:27 -08006049 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07006050
6051 def pack(self):
6052 packed = []
6053 packed.append(struct.pack("!B", self.version))
6054 packed.append(struct.pack("!B", self.type))
6055 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6056 packed.append(struct.pack("!L", self.xid))
6057 packed.append(struct.pack("!Q", self.cookie))
6058 packed.append(struct.pack("!Q", self.cookie_mask))
6059 packed.append(struct.pack("!B", self.table_id))
Dan Talaycof6202252013-07-02 01:00:29 -07006060 packed.append(util.pack_fm_cmd(self._command))
Rich Lanec2ee4b82013-04-24 17:12:38 -07006061 packed.append(struct.pack("!H", self.idle_timeout))
6062 packed.append(struct.pack("!H", self.hard_timeout))
6063 packed.append(struct.pack("!H", self.priority))
6064 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -07006065 packed.append(util.pack_port_no(self.out_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -07006066 packed.append(struct.pack("!L", self.out_group))
6067 packed.append(struct.pack("!H", self.flags))
6068 packed.append('\x00' * 2)
6069 packed.append(self.match.pack())
Rich Lane7dcdf022013-12-11 14:45:27 -08006070 packed.append(loxi.generic_util.pack_list(self.instructions))
Rich Lanec2ee4b82013-04-24 17:12:38 -07006071 length = sum([len(x) for x in packed])
6072 packed[2] = struct.pack("!H", length)
6073 return ''.join(packed)
6074
6075 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006076 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07006077 obj = flow_modify()
Dan Talaycof6202252013-07-02 01:00:29 -07006078 _version = reader.read("!B")[0]
6079 assert(_version == 4)
6080 _type = reader.read("!B")[0]
6081 assert(_type == 14)
6082 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006083 orig_reader = reader
6084 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07006085 obj.xid = reader.read("!L")[0]
6086 obj.cookie = reader.read("!Q")[0]
6087 obj.cookie_mask = reader.read("!Q")[0]
6088 obj.table_id = reader.read("!B")[0]
6089 __command = util.unpack_fm_cmd(reader)
6090 assert(__command == 1)
6091 obj.idle_timeout = reader.read("!H")[0]
6092 obj.hard_timeout = reader.read("!H")[0]
6093 obj.priority = reader.read("!H")[0]
6094 obj.buffer_id = reader.read("!L")[0]
6095 obj.out_port = util.unpack_port_no(reader)
6096 obj.out_group = reader.read("!L")[0]
6097 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07006098 reader.skip(2)
6099 obj.match = common.match.unpack(reader)
Rich Lane7dcdf022013-12-11 14:45:27 -08006100 obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -07006101 return obj
6102
6103 def __eq__(self, other):
6104 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07006105 if self.xid != other.xid: return False
6106 if self.cookie != other.cookie: return False
6107 if self.cookie_mask != other.cookie_mask: return False
6108 if self.table_id != other.table_id: return False
6109 if self.idle_timeout != other.idle_timeout: return False
6110 if self.hard_timeout != other.hard_timeout: return False
6111 if self.priority != other.priority: return False
6112 if self.buffer_id != other.buffer_id: return False
6113 if self.out_port != other.out_port: return False
6114 if self.out_group != other.out_group: return False
6115 if self.flags != other.flags: return False
6116 if self.match != other.match: return False
6117 if self.instructions != other.instructions: return False
6118 return True
6119
Rich Lanec2ee4b82013-04-24 17:12:38 -07006120 def pretty_print(self, q):
6121 q.text("flow_modify {")
6122 with q.group():
6123 with q.indent(2):
6124 q.breakable()
6125 q.text("xid = ");
6126 if self.xid != None:
6127 q.text("%#x" % self.xid)
6128 else:
6129 q.text('None')
6130 q.text(","); q.breakable()
6131 q.text("cookie = ");
6132 q.text("%#x" % self.cookie)
6133 q.text(","); q.breakable()
6134 q.text("cookie_mask = ");
6135 q.text("%#x" % self.cookie_mask)
6136 q.text(","); q.breakable()
6137 q.text("table_id = ");
6138 q.text("%#x" % self.table_id)
6139 q.text(","); q.breakable()
6140 q.text("idle_timeout = ");
6141 q.text("%#x" % self.idle_timeout)
6142 q.text(","); q.breakable()
6143 q.text("hard_timeout = ");
6144 q.text("%#x" % self.hard_timeout)
6145 q.text(","); q.breakable()
6146 q.text("priority = ");
6147 q.text("%#x" % self.priority)
6148 q.text(","); q.breakable()
6149 q.text("buffer_id = ");
6150 q.text("%#x" % self.buffer_id)
6151 q.text(","); q.breakable()
6152 q.text("out_port = ");
6153 q.text(util.pretty_port(self.out_port))
6154 q.text(","); q.breakable()
6155 q.text("out_group = ");
6156 q.text("%#x" % self.out_group)
6157 q.text(","); q.breakable()
6158 q.text("flags = ");
6159 q.text("%#x" % self.flags)
6160 q.text(","); q.breakable()
6161 q.text("match = ");
6162 q.pp(self.match)
6163 q.text(","); q.breakable()
6164 q.text("instructions = ");
6165 q.pp(self.instructions)
6166 q.breakable()
6167 q.text('}')
6168
Rich Lane7dcdf022013-12-11 14:45:27 -08006169flow_mod.subtypes[1] = flow_modify
6170
6171class flow_modify_strict(flow_mod):
Dan Talaycof6202252013-07-02 01:00:29 -07006172 version = 4
6173 type = 14
6174 _command = 2
Rich Lanec2ee4b82013-04-24 17:12:38 -07006175
6176 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 -08006177 if xid != None:
6178 self.xid = xid
6179 else:
6180 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07006181 if cookie != None:
6182 self.cookie = cookie
6183 else:
6184 self.cookie = 0
6185 if cookie_mask != None:
6186 self.cookie_mask = cookie_mask
6187 else:
6188 self.cookie_mask = 0
6189 if table_id != None:
6190 self.table_id = table_id
6191 else:
6192 self.table_id = 0
6193 if idle_timeout != None:
6194 self.idle_timeout = idle_timeout
6195 else:
6196 self.idle_timeout = 0
6197 if hard_timeout != None:
6198 self.hard_timeout = hard_timeout
6199 else:
6200 self.hard_timeout = 0
6201 if priority != None:
6202 self.priority = priority
6203 else:
6204 self.priority = 0
6205 if buffer_id != None:
6206 self.buffer_id = buffer_id
6207 else:
6208 self.buffer_id = 0
6209 if out_port != None:
6210 self.out_port = out_port
6211 else:
6212 self.out_port = 0
6213 if out_group != None:
6214 self.out_group = out_group
6215 else:
6216 self.out_group = 0
6217 if flags != None:
6218 self.flags = flags
6219 else:
6220 self.flags = 0
6221 if match != None:
6222 self.match = match
6223 else:
6224 self.match = common.match()
6225 if instructions != None:
6226 self.instructions = instructions
6227 else:
6228 self.instructions = []
Rich Lane7dcdf022013-12-11 14:45:27 -08006229 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07006230
6231 def pack(self):
6232 packed = []
6233 packed.append(struct.pack("!B", self.version))
6234 packed.append(struct.pack("!B", self.type))
6235 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6236 packed.append(struct.pack("!L", self.xid))
6237 packed.append(struct.pack("!Q", self.cookie))
6238 packed.append(struct.pack("!Q", self.cookie_mask))
6239 packed.append(struct.pack("!B", self.table_id))
Dan Talaycof6202252013-07-02 01:00:29 -07006240 packed.append(util.pack_fm_cmd(self._command))
Rich Lanec2ee4b82013-04-24 17:12:38 -07006241 packed.append(struct.pack("!H", self.idle_timeout))
6242 packed.append(struct.pack("!H", self.hard_timeout))
6243 packed.append(struct.pack("!H", self.priority))
6244 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -07006245 packed.append(util.pack_port_no(self.out_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -07006246 packed.append(struct.pack("!L", self.out_group))
6247 packed.append(struct.pack("!H", self.flags))
6248 packed.append('\x00' * 2)
6249 packed.append(self.match.pack())
Rich Lane7dcdf022013-12-11 14:45:27 -08006250 packed.append(loxi.generic_util.pack_list(self.instructions))
Rich Lanec2ee4b82013-04-24 17:12:38 -07006251 length = sum([len(x) for x in packed])
6252 packed[2] = struct.pack("!H", length)
6253 return ''.join(packed)
6254
6255 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006256 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07006257 obj = flow_modify_strict()
Dan Talaycof6202252013-07-02 01:00:29 -07006258 _version = reader.read("!B")[0]
6259 assert(_version == 4)
6260 _type = reader.read("!B")[0]
6261 assert(_type == 14)
6262 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006263 orig_reader = reader
6264 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07006265 obj.xid = reader.read("!L")[0]
6266 obj.cookie = reader.read("!Q")[0]
6267 obj.cookie_mask = reader.read("!Q")[0]
6268 obj.table_id = reader.read("!B")[0]
6269 __command = util.unpack_fm_cmd(reader)
6270 assert(__command == 2)
6271 obj.idle_timeout = reader.read("!H")[0]
6272 obj.hard_timeout = reader.read("!H")[0]
6273 obj.priority = reader.read("!H")[0]
6274 obj.buffer_id = reader.read("!L")[0]
6275 obj.out_port = util.unpack_port_no(reader)
6276 obj.out_group = reader.read("!L")[0]
6277 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07006278 reader.skip(2)
6279 obj.match = common.match.unpack(reader)
Rich Lane7dcdf022013-12-11 14:45:27 -08006280 obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -07006281 return obj
6282
6283 def __eq__(self, other):
6284 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07006285 if self.xid != other.xid: return False
6286 if self.cookie != other.cookie: return False
6287 if self.cookie_mask != other.cookie_mask: return False
6288 if self.table_id != other.table_id: return False
6289 if self.idle_timeout != other.idle_timeout: return False
6290 if self.hard_timeout != other.hard_timeout: return False
6291 if self.priority != other.priority: return False
6292 if self.buffer_id != other.buffer_id: return False
6293 if self.out_port != other.out_port: return False
6294 if self.out_group != other.out_group: return False
6295 if self.flags != other.flags: return False
6296 if self.match != other.match: return False
6297 if self.instructions != other.instructions: return False
6298 return True
6299
Rich Lanec2ee4b82013-04-24 17:12:38 -07006300 def pretty_print(self, q):
6301 q.text("flow_modify_strict {")
6302 with q.group():
6303 with q.indent(2):
6304 q.breakable()
6305 q.text("xid = ");
6306 if self.xid != None:
6307 q.text("%#x" % self.xid)
6308 else:
6309 q.text('None')
6310 q.text(","); q.breakable()
6311 q.text("cookie = ");
6312 q.text("%#x" % self.cookie)
6313 q.text(","); q.breakable()
6314 q.text("cookie_mask = ");
6315 q.text("%#x" % self.cookie_mask)
6316 q.text(","); q.breakable()
6317 q.text("table_id = ");
6318 q.text("%#x" % self.table_id)
6319 q.text(","); q.breakable()
6320 q.text("idle_timeout = ");
6321 q.text("%#x" % self.idle_timeout)
6322 q.text(","); q.breakable()
6323 q.text("hard_timeout = ");
6324 q.text("%#x" % self.hard_timeout)
6325 q.text(","); q.breakable()
6326 q.text("priority = ");
6327 q.text("%#x" % self.priority)
6328 q.text(","); q.breakable()
6329 q.text("buffer_id = ");
6330 q.text("%#x" % self.buffer_id)
6331 q.text(","); q.breakable()
6332 q.text("out_port = ");
6333 q.text(util.pretty_port(self.out_port))
6334 q.text(","); q.breakable()
6335 q.text("out_group = ");
6336 q.text("%#x" % self.out_group)
6337 q.text(","); q.breakable()
6338 q.text("flags = ");
6339 q.text("%#x" % self.flags)
6340 q.text(","); q.breakable()
6341 q.text("match = ");
6342 q.pp(self.match)
6343 q.text(","); q.breakable()
6344 q.text("instructions = ");
6345 q.pp(self.instructions)
6346 q.breakable()
6347 q.text('}')
6348
Rich Lane7dcdf022013-12-11 14:45:27 -08006349flow_mod.subtypes[2] = flow_modify_strict
6350
6351class flow_removed(message):
Dan Talaycof6202252013-07-02 01:00:29 -07006352 version = 4
6353 type = 11
Rich Lanec2ee4b82013-04-24 17:12:38 -07006354
6355 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 -08006356 if xid != None:
6357 self.xid = xid
6358 else:
6359 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07006360 if cookie != None:
6361 self.cookie = cookie
6362 else:
6363 self.cookie = 0
6364 if priority != None:
6365 self.priority = priority
6366 else:
6367 self.priority = 0
6368 if reason != None:
6369 self.reason = reason
6370 else:
6371 self.reason = 0
6372 if table_id != None:
6373 self.table_id = table_id
6374 else:
6375 self.table_id = 0
6376 if duration_sec != None:
6377 self.duration_sec = duration_sec
6378 else:
6379 self.duration_sec = 0
6380 if duration_nsec != None:
6381 self.duration_nsec = duration_nsec
6382 else:
6383 self.duration_nsec = 0
6384 if idle_timeout != None:
6385 self.idle_timeout = idle_timeout
6386 else:
6387 self.idle_timeout = 0
6388 if hard_timeout != None:
6389 self.hard_timeout = hard_timeout
6390 else:
6391 self.hard_timeout = 0
6392 if packet_count != None:
6393 self.packet_count = packet_count
6394 else:
6395 self.packet_count = 0
6396 if byte_count != None:
6397 self.byte_count = byte_count
6398 else:
6399 self.byte_count = 0
6400 if match != None:
6401 self.match = match
6402 else:
6403 self.match = common.match()
Rich Lane7dcdf022013-12-11 14:45:27 -08006404 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07006405
6406 def pack(self):
6407 packed = []
6408 packed.append(struct.pack("!B", self.version))
6409 packed.append(struct.pack("!B", self.type))
6410 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6411 packed.append(struct.pack("!L", self.xid))
6412 packed.append(struct.pack("!Q", self.cookie))
6413 packed.append(struct.pack("!H", self.priority))
6414 packed.append(struct.pack("!B", self.reason))
6415 packed.append(struct.pack("!B", self.table_id))
6416 packed.append(struct.pack("!L", self.duration_sec))
6417 packed.append(struct.pack("!L", self.duration_nsec))
6418 packed.append(struct.pack("!H", self.idle_timeout))
6419 packed.append(struct.pack("!H", self.hard_timeout))
6420 packed.append(struct.pack("!Q", self.packet_count))
6421 packed.append(struct.pack("!Q", self.byte_count))
6422 packed.append(self.match.pack())
6423 length = sum([len(x) for x in packed])
6424 packed[2] = struct.pack("!H", length)
6425 return ''.join(packed)
6426
6427 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006428 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07006429 obj = flow_removed()
Dan Talaycof6202252013-07-02 01:00:29 -07006430 _version = reader.read("!B")[0]
6431 assert(_version == 4)
6432 _type = reader.read("!B")[0]
6433 assert(_type == 11)
6434 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006435 orig_reader = reader
6436 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07006437 obj.xid = reader.read("!L")[0]
6438 obj.cookie = reader.read("!Q")[0]
6439 obj.priority = reader.read("!H")[0]
6440 obj.reason = reader.read("!B")[0]
6441 obj.table_id = reader.read("!B")[0]
6442 obj.duration_sec = reader.read("!L")[0]
6443 obj.duration_nsec = reader.read("!L")[0]
6444 obj.idle_timeout = reader.read("!H")[0]
6445 obj.hard_timeout = reader.read("!H")[0]
6446 obj.packet_count = reader.read("!Q")[0]
6447 obj.byte_count = reader.read("!Q")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07006448 obj.match = common.match.unpack(reader)
6449 return obj
6450
6451 def __eq__(self, other):
6452 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07006453 if self.xid != other.xid: return False
6454 if self.cookie != other.cookie: return False
6455 if self.priority != other.priority: return False
6456 if self.reason != other.reason: return False
6457 if self.table_id != other.table_id: return False
6458 if self.duration_sec != other.duration_sec: return False
6459 if self.duration_nsec != other.duration_nsec: return False
6460 if self.idle_timeout != other.idle_timeout: return False
6461 if self.hard_timeout != other.hard_timeout: return False
6462 if self.packet_count != other.packet_count: return False
6463 if self.byte_count != other.byte_count: return False
6464 if self.match != other.match: return False
6465 return True
6466
Rich Lanec2ee4b82013-04-24 17:12:38 -07006467 def pretty_print(self, q):
6468 q.text("flow_removed {")
6469 with q.group():
6470 with q.indent(2):
6471 q.breakable()
6472 q.text("xid = ");
6473 if self.xid != None:
6474 q.text("%#x" % self.xid)
6475 else:
6476 q.text('None')
6477 q.text(","); q.breakable()
6478 q.text("cookie = ");
6479 q.text("%#x" % self.cookie)
6480 q.text(","); q.breakable()
6481 q.text("priority = ");
6482 q.text("%#x" % self.priority)
6483 q.text(","); q.breakable()
6484 q.text("reason = ");
6485 q.text("%#x" % self.reason)
6486 q.text(","); q.breakable()
6487 q.text("table_id = ");
6488 q.text("%#x" % self.table_id)
6489 q.text(","); q.breakable()
6490 q.text("duration_sec = ");
6491 q.text("%#x" % self.duration_sec)
6492 q.text(","); q.breakable()
6493 q.text("duration_nsec = ");
6494 q.text("%#x" % self.duration_nsec)
6495 q.text(","); q.breakable()
6496 q.text("idle_timeout = ");
6497 q.text("%#x" % self.idle_timeout)
6498 q.text(","); q.breakable()
6499 q.text("hard_timeout = ");
6500 q.text("%#x" % self.hard_timeout)
6501 q.text(","); q.breakable()
6502 q.text("packet_count = ");
6503 q.text("%#x" % self.packet_count)
6504 q.text(","); q.breakable()
6505 q.text("byte_count = ");
6506 q.text("%#x" % self.byte_count)
6507 q.text(","); q.breakable()
6508 q.text("match = ");
6509 q.pp(self.match)
6510 q.breakable()
6511 q.text('}')
6512
Rich Lane7dcdf022013-12-11 14:45:27 -08006513message.subtypes[11] = flow_removed
6514
6515class flow_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -07006516 version = 4
6517 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -07006518 stats_type = 1
6519
6520 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006521 if xid != None:
6522 self.xid = xid
6523 else:
6524 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07006525 if flags != None:
6526 self.flags = flags
6527 else:
6528 self.flags = 0
6529 if entries != None:
6530 self.entries = entries
6531 else:
6532 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -08006533 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07006534
6535 def pack(self):
6536 packed = []
6537 packed.append(struct.pack("!B", self.version))
6538 packed.append(struct.pack("!B", self.type))
6539 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6540 packed.append(struct.pack("!L", self.xid))
6541 packed.append(struct.pack("!H", self.stats_type))
6542 packed.append(struct.pack("!H", self.flags))
6543 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -08006544 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -07006545 length = sum([len(x) for x in packed])
6546 packed[2] = struct.pack("!H", length)
6547 return ''.join(packed)
6548
6549 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006550 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07006551 obj = flow_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07006552 _version = reader.read("!B")[0]
6553 assert(_version == 4)
6554 _type = reader.read("!B")[0]
6555 assert(_type == 19)
6556 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006557 orig_reader = reader
6558 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07006559 obj.xid = reader.read("!L")[0]
6560 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07006561 assert(_stats_type == 1)
Dan Talaycof6202252013-07-02 01:00:29 -07006562 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07006563 reader.skip(4)
Rich Lane7dcdf022013-12-11 14:45:27 -08006564 obj.entries = loxi.generic_util.unpack_list(reader, common.flow_stats_entry.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -07006565 return obj
6566
6567 def __eq__(self, other):
6568 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07006569 if self.xid != other.xid: return False
6570 if self.flags != other.flags: return False
6571 if self.entries != other.entries: return False
6572 return True
6573
Rich Lanec2ee4b82013-04-24 17:12:38 -07006574 def pretty_print(self, q):
6575 q.text("flow_stats_reply {")
6576 with q.group():
6577 with q.indent(2):
6578 q.breakable()
6579 q.text("xid = ");
6580 if self.xid != None:
6581 q.text("%#x" % self.xid)
6582 else:
6583 q.text('None')
6584 q.text(","); q.breakable()
6585 q.text("flags = ");
6586 q.text("%#x" % self.flags)
6587 q.text(","); q.breakable()
6588 q.text("entries = ");
6589 q.pp(self.entries)
6590 q.breakable()
6591 q.text('}')
6592
Rich Lane7dcdf022013-12-11 14:45:27 -08006593stats_reply.subtypes[1] = flow_stats_reply
6594
6595class flow_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -07006596 version = 4
6597 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -07006598 stats_type = 1
6599
6600 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 -08006601 if xid != None:
6602 self.xid = xid
6603 else:
6604 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07006605 if flags != None:
6606 self.flags = flags
6607 else:
6608 self.flags = 0
6609 if table_id != None:
6610 self.table_id = table_id
6611 else:
6612 self.table_id = 0
6613 if out_port != None:
6614 self.out_port = out_port
6615 else:
6616 self.out_port = 0
6617 if out_group != None:
6618 self.out_group = out_group
6619 else:
6620 self.out_group = 0
6621 if cookie != None:
6622 self.cookie = cookie
6623 else:
6624 self.cookie = 0
6625 if cookie_mask != None:
6626 self.cookie_mask = cookie_mask
6627 else:
6628 self.cookie_mask = 0
6629 if match != None:
6630 self.match = match
6631 else:
6632 self.match = common.match()
Rich Lane7dcdf022013-12-11 14:45:27 -08006633 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07006634
6635 def pack(self):
6636 packed = []
6637 packed.append(struct.pack("!B", self.version))
6638 packed.append(struct.pack("!B", self.type))
6639 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6640 packed.append(struct.pack("!L", self.xid))
6641 packed.append(struct.pack("!H", self.stats_type))
6642 packed.append(struct.pack("!H", self.flags))
6643 packed.append('\x00' * 4)
6644 packed.append(struct.pack("!B", self.table_id))
6645 packed.append('\x00' * 3)
Dan Talaycof6202252013-07-02 01:00:29 -07006646 packed.append(util.pack_port_no(self.out_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -07006647 packed.append(struct.pack("!L", self.out_group))
6648 packed.append('\x00' * 4)
6649 packed.append(struct.pack("!Q", self.cookie))
6650 packed.append(struct.pack("!Q", self.cookie_mask))
6651 packed.append(self.match.pack())
6652 length = sum([len(x) for x in packed])
6653 packed[2] = struct.pack("!H", length)
6654 return ''.join(packed)
6655
6656 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006657 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07006658 obj = flow_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -07006659 _version = reader.read("!B")[0]
6660 assert(_version == 4)
6661 _type = reader.read("!B")[0]
6662 assert(_type == 18)
6663 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006664 orig_reader = reader
6665 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07006666 obj.xid = reader.read("!L")[0]
6667 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07006668 assert(_stats_type == 1)
Dan Talaycof6202252013-07-02 01:00:29 -07006669 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07006670 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -07006671 obj.table_id = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07006672 reader.skip(3)
Dan Talaycof6202252013-07-02 01:00:29 -07006673 obj.out_port = util.unpack_port_no(reader)
6674 obj.out_group = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07006675 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -07006676 obj.cookie = reader.read("!Q")[0]
6677 obj.cookie_mask = reader.read("!Q")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07006678 obj.match = common.match.unpack(reader)
6679 return obj
6680
6681 def __eq__(self, other):
6682 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07006683 if self.xid != other.xid: return False
6684 if self.flags != other.flags: return False
6685 if self.table_id != other.table_id: return False
6686 if self.out_port != other.out_port: return False
6687 if self.out_group != other.out_group: return False
6688 if self.cookie != other.cookie: return False
6689 if self.cookie_mask != other.cookie_mask: return False
6690 if self.match != other.match: return False
6691 return True
6692
Rich Lanec2ee4b82013-04-24 17:12:38 -07006693 def pretty_print(self, q):
6694 q.text("flow_stats_request {")
6695 with q.group():
6696 with q.indent(2):
6697 q.breakable()
6698 q.text("xid = ");
6699 if self.xid != None:
6700 q.text("%#x" % self.xid)
6701 else:
6702 q.text('None')
6703 q.text(","); q.breakable()
6704 q.text("flags = ");
6705 q.text("%#x" % self.flags)
6706 q.text(","); q.breakable()
6707 q.text("table_id = ");
6708 q.text("%#x" % self.table_id)
6709 q.text(","); q.breakable()
6710 q.text("out_port = ");
6711 q.text(util.pretty_port(self.out_port))
6712 q.text(","); q.breakable()
6713 q.text("out_group = ");
6714 q.text("%#x" % self.out_group)
6715 q.text(","); q.breakable()
6716 q.text("cookie = ");
6717 q.text("%#x" % self.cookie)
6718 q.text(","); q.breakable()
6719 q.text("cookie_mask = ");
6720 q.text("%#x" % self.cookie_mask)
6721 q.text(","); q.breakable()
6722 q.text("match = ");
6723 q.pp(self.match)
6724 q.breakable()
6725 q.text('}')
6726
Rich Lane7dcdf022013-12-11 14:45:27 -08006727stats_request.subtypes[1] = flow_stats_request
6728
6729class get_config_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -07006730 version = 4
6731 type = 8
Rich Lanec2ee4b82013-04-24 17:12:38 -07006732
6733 def __init__(self, xid=None, flags=None, miss_send_len=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006734 if xid != None:
6735 self.xid = xid
6736 else:
6737 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07006738 if flags != None:
6739 self.flags = flags
6740 else:
6741 self.flags = 0
6742 if miss_send_len != None:
6743 self.miss_send_len = miss_send_len
6744 else:
6745 self.miss_send_len = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08006746 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07006747
6748 def pack(self):
6749 packed = []
6750 packed.append(struct.pack("!B", self.version))
6751 packed.append(struct.pack("!B", self.type))
6752 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6753 packed.append(struct.pack("!L", self.xid))
6754 packed.append(struct.pack("!H", self.flags))
6755 packed.append(struct.pack("!H", self.miss_send_len))
6756 length = sum([len(x) for x in packed])
6757 packed[2] = struct.pack("!H", length)
6758 return ''.join(packed)
6759
6760 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006761 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07006762 obj = get_config_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07006763 _version = reader.read("!B")[0]
6764 assert(_version == 4)
6765 _type = reader.read("!B")[0]
6766 assert(_type == 8)
6767 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006768 orig_reader = reader
6769 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07006770 obj.xid = reader.read("!L")[0]
6771 obj.flags = reader.read("!H")[0]
6772 obj.miss_send_len = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07006773 return obj
6774
6775 def __eq__(self, other):
6776 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07006777 if self.xid != other.xid: return False
6778 if self.flags != other.flags: return False
6779 if self.miss_send_len != other.miss_send_len: return False
6780 return True
6781
Rich Lanec2ee4b82013-04-24 17:12:38 -07006782 def pretty_print(self, q):
6783 q.text("get_config_reply {")
6784 with q.group():
6785 with q.indent(2):
6786 q.breakable()
6787 q.text("xid = ");
6788 if self.xid != None:
6789 q.text("%#x" % self.xid)
6790 else:
6791 q.text('None')
6792 q.text(","); q.breakable()
6793 q.text("flags = ");
6794 q.text("%#x" % self.flags)
6795 q.text(","); q.breakable()
6796 q.text("miss_send_len = ");
6797 q.text("%#x" % self.miss_send_len)
6798 q.breakable()
6799 q.text('}')
6800
Rich Lane7dcdf022013-12-11 14:45:27 -08006801message.subtypes[8] = get_config_reply
6802
6803class get_config_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -07006804 version = 4
6805 type = 7
Rich Lanec2ee4b82013-04-24 17:12:38 -07006806
6807 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006808 if xid != None:
6809 self.xid = xid
6810 else:
6811 self.xid = None
6812 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07006813
6814 def pack(self):
6815 packed = []
6816 packed.append(struct.pack("!B", self.version))
6817 packed.append(struct.pack("!B", self.type))
6818 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6819 packed.append(struct.pack("!L", self.xid))
6820 length = sum([len(x) for x in packed])
6821 packed[2] = struct.pack("!H", length)
6822 return ''.join(packed)
6823
6824 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006825 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07006826 obj = get_config_request()
Dan Talaycof6202252013-07-02 01:00:29 -07006827 _version = reader.read("!B")[0]
6828 assert(_version == 4)
6829 _type = reader.read("!B")[0]
6830 assert(_type == 7)
6831 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006832 orig_reader = reader
6833 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07006834 obj.xid = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07006835 return obj
6836
6837 def __eq__(self, other):
6838 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07006839 if self.xid != other.xid: return False
6840 return True
6841
Rich Lanec2ee4b82013-04-24 17:12:38 -07006842 def pretty_print(self, q):
6843 q.text("get_config_request {")
6844 with q.group():
6845 with q.indent(2):
6846 q.breakable()
6847 q.text("xid = ");
6848 if self.xid != None:
6849 q.text("%#x" % self.xid)
6850 else:
6851 q.text('None')
6852 q.breakable()
6853 q.text('}')
6854
Rich Lane7dcdf022013-12-11 14:45:27 -08006855message.subtypes[7] = get_config_request
6856
6857class group_mod(message):
6858 subtypes = {}
6859
6860 @staticmethod
6861 def unpack(reader):
6862 subtype, = reader.peek('!H', 8)
6863 try:
6864 subclass = group_mod.subtypes[subtype]
6865 except KeyError:
6866 raise loxi.ProtocolError("unknown group_mod message subtype %#x" % subtype)
6867 return subclass.unpack(reader)
6868
6869message.subtypes[15] = group_mod
6870
6871class group_add(group_mod):
Rich Lane7b0f2012013-11-22 14:15:26 -08006872 version = 4
6873 type = 15
6874 command = 0
6875
6876 def __init__(self, xid=None, group_type=None, group_id=None, buckets=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006877 if xid != None:
6878 self.xid = xid
6879 else:
6880 self.xid = None
Rich Lane7b0f2012013-11-22 14:15:26 -08006881 if group_type != None:
6882 self.group_type = group_type
6883 else:
6884 self.group_type = 0
6885 if group_id != None:
6886 self.group_id = group_id
6887 else:
6888 self.group_id = 0
6889 if buckets != None:
6890 self.buckets = buckets
6891 else:
6892 self.buckets = []
Rich Lane7dcdf022013-12-11 14:45:27 -08006893 return
Rich Lane7b0f2012013-11-22 14:15:26 -08006894
6895 def pack(self):
6896 packed = []
6897 packed.append(struct.pack("!B", self.version))
6898 packed.append(struct.pack("!B", self.type))
6899 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6900 packed.append(struct.pack("!L", self.xid))
6901 packed.append(struct.pack("!H", self.command))
6902 packed.append(struct.pack("!B", self.group_type))
6903 packed.append('\x00' * 1)
6904 packed.append(struct.pack("!L", self.group_id))
Rich Lane7dcdf022013-12-11 14:45:27 -08006905 packed.append(loxi.generic_util.pack_list(self.buckets))
Rich Lane7b0f2012013-11-22 14:15:26 -08006906 length = sum([len(x) for x in packed])
6907 packed[2] = struct.pack("!H", length)
6908 return ''.join(packed)
6909
6910 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006911 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -08006912 obj = group_add()
Rich Lane7b0f2012013-11-22 14:15:26 -08006913 _version = reader.read("!B")[0]
6914 assert(_version == 4)
6915 _type = reader.read("!B")[0]
6916 assert(_type == 15)
6917 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006918 orig_reader = reader
6919 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane7b0f2012013-11-22 14:15:26 -08006920 obj.xid = reader.read("!L")[0]
6921 _command = reader.read("!H")[0]
6922 assert(_command == 0)
6923 obj.group_type = reader.read("!B")[0]
6924 reader.skip(1)
6925 obj.group_id = reader.read("!L")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006926 obj.buckets = loxi.generic_util.unpack_list(reader, common.bucket.unpack)
Rich Lane7b0f2012013-11-22 14:15:26 -08006927 return obj
6928
6929 def __eq__(self, other):
6930 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -08006931 if self.xid != other.xid: return False
6932 if self.group_type != other.group_type: return False
6933 if self.group_id != other.group_id: return False
6934 if self.buckets != other.buckets: return False
6935 return True
6936
Rich Lane7b0f2012013-11-22 14:15:26 -08006937 def pretty_print(self, q):
6938 q.text("group_add {")
6939 with q.group():
6940 with q.indent(2):
6941 q.breakable()
6942 q.text("xid = ");
6943 if self.xid != None:
6944 q.text("%#x" % self.xid)
6945 else:
6946 q.text('None')
6947 q.text(","); q.breakable()
6948 q.text("group_type = ");
6949 q.text("%#x" % self.group_type)
6950 q.text(","); q.breakable()
6951 q.text("group_id = ");
6952 q.text("%#x" % self.group_id)
6953 q.text(","); q.breakable()
6954 q.text("buckets = ");
6955 q.pp(self.buckets)
6956 q.breakable()
6957 q.text('}')
6958
Rich Lane7dcdf022013-12-11 14:45:27 -08006959group_mod.subtypes[0] = group_add
6960
6961class group_delete(group_mod):
Rich Lane7b0f2012013-11-22 14:15:26 -08006962 version = 4
6963 type = 15
6964 command = 2
6965
6966 def __init__(self, xid=None, group_type=None, group_id=None, buckets=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006967 if xid != None:
6968 self.xid = xid
6969 else:
6970 self.xid = None
Rich Lane7b0f2012013-11-22 14:15:26 -08006971 if group_type != None:
6972 self.group_type = group_type
6973 else:
6974 self.group_type = 0
6975 if group_id != None:
6976 self.group_id = group_id
6977 else:
6978 self.group_id = 0
6979 if buckets != None:
6980 self.buckets = buckets
6981 else:
6982 self.buckets = []
Rich Lane7dcdf022013-12-11 14:45:27 -08006983 return
Rich Lane7b0f2012013-11-22 14:15:26 -08006984
6985 def pack(self):
6986 packed = []
6987 packed.append(struct.pack("!B", self.version))
6988 packed.append(struct.pack("!B", self.type))
6989 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6990 packed.append(struct.pack("!L", self.xid))
6991 packed.append(struct.pack("!H", self.command))
6992 packed.append(struct.pack("!B", self.group_type))
6993 packed.append('\x00' * 1)
6994 packed.append(struct.pack("!L", self.group_id))
Rich Lane7dcdf022013-12-11 14:45:27 -08006995 packed.append(loxi.generic_util.pack_list(self.buckets))
Rich Lane7b0f2012013-11-22 14:15:26 -08006996 length = sum([len(x) for x in packed])
6997 packed[2] = struct.pack("!H", length)
6998 return ''.join(packed)
6999
7000 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007001 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -08007002 obj = group_delete()
Rich Lane7b0f2012013-11-22 14:15:26 -08007003 _version = reader.read("!B")[0]
7004 assert(_version == 4)
7005 _type = reader.read("!B")[0]
7006 assert(_type == 15)
7007 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007008 orig_reader = reader
7009 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane7b0f2012013-11-22 14:15:26 -08007010 obj.xid = reader.read("!L")[0]
7011 _command = reader.read("!H")[0]
7012 assert(_command == 2)
7013 obj.group_type = reader.read("!B")[0]
7014 reader.skip(1)
7015 obj.group_id = reader.read("!L")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007016 obj.buckets = loxi.generic_util.unpack_list(reader, common.bucket.unpack)
Rich Lane7b0f2012013-11-22 14:15:26 -08007017 return obj
7018
7019 def __eq__(self, other):
7020 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -08007021 if self.xid != other.xid: return False
7022 if self.group_type != other.group_type: return False
7023 if self.group_id != other.group_id: return False
7024 if self.buckets != other.buckets: return False
7025 return True
7026
Rich Lane7b0f2012013-11-22 14:15:26 -08007027 def pretty_print(self, q):
7028 q.text("group_delete {")
7029 with q.group():
7030 with q.indent(2):
7031 q.breakable()
7032 q.text("xid = ");
7033 if self.xid != None:
7034 q.text("%#x" % self.xid)
7035 else:
7036 q.text('None')
7037 q.text(","); q.breakable()
7038 q.text("group_type = ");
7039 q.text("%#x" % self.group_type)
7040 q.text(","); q.breakable()
7041 q.text("group_id = ");
7042 q.text("%#x" % self.group_id)
7043 q.text(","); q.breakable()
7044 q.text("buckets = ");
7045 q.pp(self.buckets)
7046 q.breakable()
7047 q.text('}')
7048
Rich Lane7dcdf022013-12-11 14:45:27 -08007049group_mod.subtypes[2] = group_delete
7050
7051class group_desc_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -07007052 version = 4
7053 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -07007054 stats_type = 7
7055
7056 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007057 if xid != None:
7058 self.xid = xid
7059 else:
7060 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07007061 if flags != None:
7062 self.flags = flags
7063 else:
7064 self.flags = 0
7065 if entries != None:
7066 self.entries = entries
7067 else:
7068 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -08007069 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07007070
7071 def pack(self):
7072 packed = []
7073 packed.append(struct.pack("!B", self.version))
7074 packed.append(struct.pack("!B", self.type))
7075 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7076 packed.append(struct.pack("!L", self.xid))
7077 packed.append(struct.pack("!H", self.stats_type))
7078 packed.append(struct.pack("!H", self.flags))
7079 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -08007080 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -07007081 length = sum([len(x) for x in packed])
7082 packed[2] = struct.pack("!H", length)
7083 return ''.join(packed)
7084
7085 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007086 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07007087 obj = group_desc_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07007088 _version = reader.read("!B")[0]
7089 assert(_version == 4)
7090 _type = reader.read("!B")[0]
7091 assert(_type == 19)
7092 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007093 orig_reader = reader
7094 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07007095 obj.xid = reader.read("!L")[0]
7096 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007097 assert(_stats_type == 7)
Dan Talaycof6202252013-07-02 01:00:29 -07007098 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007099 reader.skip(4)
Rich Lane7dcdf022013-12-11 14:45:27 -08007100 obj.entries = loxi.generic_util.unpack_list(reader, common.group_desc_stats_entry.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -07007101 return obj
7102
7103 def __eq__(self, other):
7104 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07007105 if self.xid != other.xid: return False
7106 if self.flags != other.flags: return False
7107 if self.entries != other.entries: return False
7108 return True
7109
Rich Lanec2ee4b82013-04-24 17:12:38 -07007110 def pretty_print(self, q):
7111 q.text("group_desc_stats_reply {")
7112 with q.group():
7113 with q.indent(2):
7114 q.breakable()
7115 q.text("xid = ");
7116 if self.xid != None:
7117 q.text("%#x" % self.xid)
7118 else:
7119 q.text('None')
7120 q.text(","); q.breakable()
7121 q.text("flags = ");
7122 q.text("%#x" % self.flags)
7123 q.text(","); q.breakable()
7124 q.text("entries = ");
7125 q.pp(self.entries)
7126 q.breakable()
7127 q.text('}')
7128
Rich Lane7dcdf022013-12-11 14:45:27 -08007129stats_reply.subtypes[7] = group_desc_stats_reply
7130
7131class group_desc_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -07007132 version = 4
7133 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -07007134 stats_type = 7
7135
7136 def __init__(self, xid=None, flags=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007137 if xid != None:
7138 self.xid = xid
7139 else:
7140 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07007141 if flags != None:
7142 self.flags = flags
7143 else:
7144 self.flags = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08007145 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07007146
7147 def pack(self):
7148 packed = []
7149 packed.append(struct.pack("!B", self.version))
7150 packed.append(struct.pack("!B", self.type))
7151 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7152 packed.append(struct.pack("!L", self.xid))
7153 packed.append(struct.pack("!H", self.stats_type))
7154 packed.append(struct.pack("!H", self.flags))
7155 packed.append('\x00' * 4)
7156 length = sum([len(x) for x in packed])
7157 packed[2] = struct.pack("!H", length)
7158 return ''.join(packed)
7159
7160 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007161 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07007162 obj = group_desc_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -07007163 _version = reader.read("!B")[0]
7164 assert(_version == 4)
7165 _type = reader.read("!B")[0]
7166 assert(_type == 18)
7167 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007168 orig_reader = reader
7169 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07007170 obj.xid = reader.read("!L")[0]
7171 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007172 assert(_stats_type == 7)
Dan Talaycof6202252013-07-02 01:00:29 -07007173 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007174 reader.skip(4)
7175 return obj
7176
7177 def __eq__(self, other):
7178 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07007179 if self.xid != other.xid: return False
7180 if self.flags != other.flags: return False
7181 return True
7182
Rich Lanec2ee4b82013-04-24 17:12:38 -07007183 def pretty_print(self, q):
7184 q.text("group_desc_stats_request {")
7185 with q.group():
7186 with q.indent(2):
7187 q.breakable()
7188 q.text("xid = ");
7189 if self.xid != None:
7190 q.text("%#x" % self.xid)
7191 else:
7192 q.text('None')
7193 q.text(","); q.breakable()
7194 q.text("flags = ");
7195 q.text("%#x" % self.flags)
7196 q.breakable()
7197 q.text('}')
7198
Rich Lane7dcdf022013-12-11 14:45:27 -08007199stats_request.subtypes[7] = group_desc_stats_request
7200
7201class group_features_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -07007202 version = 4
7203 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -07007204 stats_type = 8
7205
7206 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 -08007207 if xid != None:
7208 self.xid = xid
7209 else:
7210 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07007211 if flags != None:
7212 self.flags = flags
7213 else:
7214 self.flags = 0
7215 if types != None:
7216 self.types = types
7217 else:
7218 self.types = 0
7219 if capabilities != None:
7220 self.capabilities = capabilities
7221 else:
7222 self.capabilities = 0
7223 if max_groups_all != None:
7224 self.max_groups_all = max_groups_all
7225 else:
7226 self.max_groups_all = 0
7227 if max_groups_select != None:
7228 self.max_groups_select = max_groups_select
7229 else:
7230 self.max_groups_select = 0
7231 if max_groups_indirect != None:
7232 self.max_groups_indirect = max_groups_indirect
7233 else:
7234 self.max_groups_indirect = 0
7235 if max_groups_ff != None:
7236 self.max_groups_ff = max_groups_ff
7237 else:
7238 self.max_groups_ff = 0
7239 if actions_all != None:
7240 self.actions_all = actions_all
7241 else:
7242 self.actions_all = 0
7243 if actions_select != None:
7244 self.actions_select = actions_select
7245 else:
7246 self.actions_select = 0
7247 if actions_indirect != None:
7248 self.actions_indirect = actions_indirect
7249 else:
7250 self.actions_indirect = 0
7251 if actions_ff != None:
7252 self.actions_ff = actions_ff
7253 else:
7254 self.actions_ff = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08007255 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07007256
7257 def pack(self):
7258 packed = []
7259 packed.append(struct.pack("!B", self.version))
7260 packed.append(struct.pack("!B", self.type))
7261 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7262 packed.append(struct.pack("!L", self.xid))
7263 packed.append(struct.pack("!H", self.stats_type))
7264 packed.append(struct.pack("!H", self.flags))
7265 packed.append('\x00' * 4)
7266 packed.append(struct.pack("!L", self.types))
7267 packed.append(struct.pack("!L", self.capabilities))
7268 packed.append(struct.pack("!L", self.max_groups_all))
7269 packed.append(struct.pack("!L", self.max_groups_select))
7270 packed.append(struct.pack("!L", self.max_groups_indirect))
7271 packed.append(struct.pack("!L", self.max_groups_ff))
7272 packed.append(struct.pack("!L", self.actions_all))
7273 packed.append(struct.pack("!L", self.actions_select))
7274 packed.append(struct.pack("!L", self.actions_indirect))
7275 packed.append(struct.pack("!L", self.actions_ff))
7276 length = sum([len(x) for x in packed])
7277 packed[2] = struct.pack("!H", length)
7278 return ''.join(packed)
7279
7280 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007281 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07007282 obj = group_features_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07007283 _version = reader.read("!B")[0]
7284 assert(_version == 4)
7285 _type = reader.read("!B")[0]
7286 assert(_type == 19)
7287 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007288 orig_reader = reader
7289 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07007290 obj.xid = reader.read("!L")[0]
7291 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007292 assert(_stats_type == 8)
Dan Talaycof6202252013-07-02 01:00:29 -07007293 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007294 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -07007295 obj.types = reader.read("!L")[0]
7296 obj.capabilities = reader.read("!L")[0]
7297 obj.max_groups_all = reader.read("!L")[0]
7298 obj.max_groups_select = reader.read("!L")[0]
7299 obj.max_groups_indirect = reader.read("!L")[0]
7300 obj.max_groups_ff = reader.read("!L")[0]
7301 obj.actions_all = reader.read("!L")[0]
7302 obj.actions_select = reader.read("!L")[0]
7303 obj.actions_indirect = reader.read("!L")[0]
7304 obj.actions_ff = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007305 return obj
7306
7307 def __eq__(self, other):
7308 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07007309 if self.xid != other.xid: return False
7310 if self.flags != other.flags: return False
7311 if self.types != other.types: return False
7312 if self.capabilities != other.capabilities: return False
7313 if self.max_groups_all != other.max_groups_all: return False
7314 if self.max_groups_select != other.max_groups_select: return False
7315 if self.max_groups_indirect != other.max_groups_indirect: return False
7316 if self.max_groups_ff != other.max_groups_ff: return False
7317 if self.actions_all != other.actions_all: return False
7318 if self.actions_select != other.actions_select: return False
7319 if self.actions_indirect != other.actions_indirect: return False
7320 if self.actions_ff != other.actions_ff: return False
7321 return True
7322
Rich Lanec2ee4b82013-04-24 17:12:38 -07007323 def pretty_print(self, q):
7324 q.text("group_features_stats_reply {")
7325 with q.group():
7326 with q.indent(2):
7327 q.breakable()
7328 q.text("xid = ");
7329 if self.xid != None:
7330 q.text("%#x" % self.xid)
7331 else:
7332 q.text('None')
7333 q.text(","); q.breakable()
7334 q.text("flags = ");
7335 q.text("%#x" % self.flags)
7336 q.text(","); q.breakable()
7337 q.text("types = ");
7338 q.text("%#x" % self.types)
7339 q.text(","); q.breakable()
7340 q.text("capabilities = ");
7341 q.text("%#x" % self.capabilities)
7342 q.text(","); q.breakable()
7343 q.text("max_groups_all = ");
7344 q.text("%#x" % self.max_groups_all)
7345 q.text(","); q.breakable()
7346 q.text("max_groups_select = ");
7347 q.text("%#x" % self.max_groups_select)
7348 q.text(","); q.breakable()
7349 q.text("max_groups_indirect = ");
7350 q.text("%#x" % self.max_groups_indirect)
7351 q.text(","); q.breakable()
7352 q.text("max_groups_ff = ");
7353 q.text("%#x" % self.max_groups_ff)
7354 q.text(","); q.breakable()
7355 q.text("actions_all = ");
7356 q.text("%#x" % self.actions_all)
7357 q.text(","); q.breakable()
7358 q.text("actions_select = ");
7359 q.text("%#x" % self.actions_select)
7360 q.text(","); q.breakable()
7361 q.text("actions_indirect = ");
7362 q.text("%#x" % self.actions_indirect)
7363 q.text(","); q.breakable()
7364 q.text("actions_ff = ");
7365 q.text("%#x" % self.actions_ff)
7366 q.breakable()
7367 q.text('}')
7368
Rich Lane7dcdf022013-12-11 14:45:27 -08007369stats_reply.subtypes[8] = group_features_stats_reply
7370
7371class group_features_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -07007372 version = 4
7373 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -07007374 stats_type = 8
7375
7376 def __init__(self, xid=None, flags=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007377 if xid != None:
7378 self.xid = xid
7379 else:
7380 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07007381 if flags != None:
7382 self.flags = flags
7383 else:
7384 self.flags = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08007385 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07007386
7387 def pack(self):
7388 packed = []
7389 packed.append(struct.pack("!B", self.version))
7390 packed.append(struct.pack("!B", self.type))
7391 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7392 packed.append(struct.pack("!L", self.xid))
7393 packed.append(struct.pack("!H", self.stats_type))
7394 packed.append(struct.pack("!H", self.flags))
7395 packed.append('\x00' * 4)
7396 length = sum([len(x) for x in packed])
7397 packed[2] = struct.pack("!H", length)
7398 return ''.join(packed)
7399
7400 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007401 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07007402 obj = group_features_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -07007403 _version = reader.read("!B")[0]
7404 assert(_version == 4)
7405 _type = reader.read("!B")[0]
7406 assert(_type == 18)
7407 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007408 orig_reader = reader
7409 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07007410 obj.xid = reader.read("!L")[0]
7411 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007412 assert(_stats_type == 8)
Dan Talaycof6202252013-07-02 01:00:29 -07007413 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007414 reader.skip(4)
7415 return obj
7416
7417 def __eq__(self, other):
7418 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07007419 if self.xid != other.xid: return False
7420 if self.flags != other.flags: return False
7421 return True
7422
Rich Lanec2ee4b82013-04-24 17:12:38 -07007423 def pretty_print(self, q):
7424 q.text("group_features_stats_request {")
7425 with q.group():
7426 with q.indent(2):
7427 q.breakable()
7428 q.text("xid = ");
7429 if self.xid != None:
7430 q.text("%#x" % self.xid)
7431 else:
7432 q.text('None')
7433 q.text(","); q.breakable()
7434 q.text("flags = ");
7435 q.text("%#x" % self.flags)
7436 q.breakable()
7437 q.text('}')
7438
Rich Lane7dcdf022013-12-11 14:45:27 -08007439stats_request.subtypes[8] = group_features_stats_request
7440
7441class group_mod_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -07007442 version = 4
7443 type = 1
7444 err_type = 6
7445
7446 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007447 if xid != None:
7448 self.xid = xid
7449 else:
7450 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07007451 if code != None:
7452 self.code = code
7453 else:
7454 self.code = 0
7455 if data != None:
7456 self.data = data
7457 else:
7458 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08007459 return
Rich Lane6f4978c2013-10-20 21:33:52 -07007460
7461 def pack(self):
7462 packed = []
7463 packed.append(struct.pack("!B", self.version))
7464 packed.append(struct.pack("!B", self.type))
7465 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7466 packed.append(struct.pack("!L", self.xid))
7467 packed.append(struct.pack("!H", self.err_type))
7468 packed.append(struct.pack("!H", self.code))
7469 packed.append(self.data)
7470 length = sum([len(x) for x in packed])
7471 packed[2] = struct.pack("!H", length)
7472 return ''.join(packed)
7473
7474 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007475 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07007476 obj = group_mod_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -07007477 _version = reader.read("!B")[0]
7478 assert(_version == 4)
7479 _type = reader.read("!B")[0]
7480 assert(_type == 1)
7481 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007482 orig_reader = reader
7483 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07007484 obj.xid = reader.read("!L")[0]
7485 _err_type = reader.read("!H")[0]
7486 assert(_err_type == 6)
7487 obj.code = reader.read("!H")[0]
7488 obj.data = str(reader.read_all())
7489 return obj
7490
7491 def __eq__(self, other):
7492 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07007493 if self.xid != other.xid: return False
7494 if self.code != other.code: return False
7495 if self.data != other.data: return False
7496 return True
7497
Rich Lane6f4978c2013-10-20 21:33:52 -07007498 def pretty_print(self, q):
7499 q.text("group_mod_failed_error_msg {")
7500 with q.group():
7501 with q.indent(2):
7502 q.breakable()
7503 q.text("xid = ");
7504 if self.xid != None:
7505 q.text("%#x" % self.xid)
7506 else:
7507 q.text('None')
7508 q.text(","); q.breakable()
7509 q.text("code = ");
7510 q.text("%#x" % self.code)
7511 q.text(","); q.breakable()
7512 q.text("data = ");
7513 q.pp(self.data)
7514 q.breakable()
7515 q.text('}')
7516
Rich Lane7dcdf022013-12-11 14:45:27 -08007517error_msg.subtypes[6] = group_mod_failed_error_msg
7518
7519class group_modify(group_mod):
Rich Lane7b0f2012013-11-22 14:15:26 -08007520 version = 4
7521 type = 15
7522 command = 1
7523
7524 def __init__(self, xid=None, group_type=None, group_id=None, buckets=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007525 if xid != None:
7526 self.xid = xid
7527 else:
7528 self.xid = None
Rich Lane7b0f2012013-11-22 14:15:26 -08007529 if group_type != None:
7530 self.group_type = group_type
7531 else:
7532 self.group_type = 0
7533 if group_id != None:
7534 self.group_id = group_id
7535 else:
7536 self.group_id = 0
7537 if buckets != None:
7538 self.buckets = buckets
7539 else:
7540 self.buckets = []
Rich Lane7dcdf022013-12-11 14:45:27 -08007541 return
Rich Lane7b0f2012013-11-22 14:15:26 -08007542
7543 def pack(self):
7544 packed = []
7545 packed.append(struct.pack("!B", self.version))
7546 packed.append(struct.pack("!B", self.type))
7547 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7548 packed.append(struct.pack("!L", self.xid))
7549 packed.append(struct.pack("!H", self.command))
7550 packed.append(struct.pack("!B", self.group_type))
7551 packed.append('\x00' * 1)
7552 packed.append(struct.pack("!L", self.group_id))
Rich Lane7dcdf022013-12-11 14:45:27 -08007553 packed.append(loxi.generic_util.pack_list(self.buckets))
Rich Lane7b0f2012013-11-22 14:15:26 -08007554 length = sum([len(x) for x in packed])
7555 packed[2] = struct.pack("!H", length)
7556 return ''.join(packed)
7557
7558 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007559 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -08007560 obj = group_modify()
Rich Lane7b0f2012013-11-22 14:15:26 -08007561 _version = reader.read("!B")[0]
7562 assert(_version == 4)
7563 _type = reader.read("!B")[0]
7564 assert(_type == 15)
7565 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007566 orig_reader = reader
7567 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane7b0f2012013-11-22 14:15:26 -08007568 obj.xid = reader.read("!L")[0]
7569 _command = reader.read("!H")[0]
7570 assert(_command == 1)
7571 obj.group_type = reader.read("!B")[0]
7572 reader.skip(1)
7573 obj.group_id = reader.read("!L")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007574 obj.buckets = loxi.generic_util.unpack_list(reader, common.bucket.unpack)
Rich Lane7b0f2012013-11-22 14:15:26 -08007575 return obj
7576
7577 def __eq__(self, other):
7578 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -08007579 if self.xid != other.xid: return False
7580 if self.group_type != other.group_type: return False
7581 if self.group_id != other.group_id: return False
7582 if self.buckets != other.buckets: return False
7583 return True
7584
Rich Lane7b0f2012013-11-22 14:15:26 -08007585 def pretty_print(self, q):
7586 q.text("group_modify {")
7587 with q.group():
7588 with q.indent(2):
7589 q.breakable()
7590 q.text("xid = ");
7591 if self.xid != None:
7592 q.text("%#x" % self.xid)
7593 else:
7594 q.text('None')
7595 q.text(","); q.breakable()
7596 q.text("group_type = ");
7597 q.text("%#x" % self.group_type)
7598 q.text(","); q.breakable()
7599 q.text("group_id = ");
7600 q.text("%#x" % self.group_id)
7601 q.text(","); q.breakable()
7602 q.text("buckets = ");
7603 q.pp(self.buckets)
7604 q.breakable()
7605 q.text('}')
7606
Rich Lane7dcdf022013-12-11 14:45:27 -08007607group_mod.subtypes[1] = group_modify
7608
7609class group_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -07007610 version = 4
7611 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -07007612 stats_type = 6
7613
7614 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007615 if xid != None:
7616 self.xid = xid
7617 else:
7618 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07007619 if flags != None:
7620 self.flags = flags
7621 else:
7622 self.flags = 0
7623 if entries != None:
7624 self.entries = entries
7625 else:
7626 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -08007627 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07007628
7629 def pack(self):
7630 packed = []
7631 packed.append(struct.pack("!B", self.version))
7632 packed.append(struct.pack("!B", self.type))
7633 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7634 packed.append(struct.pack("!L", self.xid))
7635 packed.append(struct.pack("!H", self.stats_type))
7636 packed.append(struct.pack("!H", self.flags))
7637 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -08007638 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -07007639 length = sum([len(x) for x in packed])
7640 packed[2] = struct.pack("!H", length)
7641 return ''.join(packed)
7642
7643 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007644 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07007645 obj = group_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07007646 _version = reader.read("!B")[0]
7647 assert(_version == 4)
7648 _type = reader.read("!B")[0]
7649 assert(_type == 19)
7650 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007651 orig_reader = reader
7652 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07007653 obj.xid = reader.read("!L")[0]
7654 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007655 assert(_stats_type == 6)
Dan Talaycof6202252013-07-02 01:00:29 -07007656 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007657 reader.skip(4)
Rich Lane7dcdf022013-12-11 14:45:27 -08007658 obj.entries = loxi.generic_util.unpack_list(reader, common.group_stats_entry.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -07007659 return obj
7660
7661 def __eq__(self, other):
7662 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07007663 if self.xid != other.xid: return False
7664 if self.flags != other.flags: return False
7665 if self.entries != other.entries: return False
7666 return True
7667
Rich Lanec2ee4b82013-04-24 17:12:38 -07007668 def pretty_print(self, q):
7669 q.text("group_stats_reply {")
7670 with q.group():
7671 with q.indent(2):
7672 q.breakable()
7673 q.text("xid = ");
7674 if self.xid != None:
7675 q.text("%#x" % self.xid)
7676 else:
7677 q.text('None')
7678 q.text(","); q.breakable()
7679 q.text("flags = ");
7680 q.text("%#x" % self.flags)
7681 q.text(","); q.breakable()
7682 q.text("entries = ");
7683 q.pp(self.entries)
7684 q.breakable()
7685 q.text('}')
7686
Rich Lane7dcdf022013-12-11 14:45:27 -08007687stats_reply.subtypes[6] = group_stats_reply
7688
7689class group_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -07007690 version = 4
7691 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -07007692 stats_type = 6
7693
7694 def __init__(self, xid=None, flags=None, group_id=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007695 if xid != None:
7696 self.xid = xid
7697 else:
7698 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07007699 if flags != None:
7700 self.flags = flags
7701 else:
7702 self.flags = 0
7703 if group_id != None:
7704 self.group_id = group_id
7705 else:
7706 self.group_id = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08007707 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07007708
7709 def pack(self):
7710 packed = []
7711 packed.append(struct.pack("!B", self.version))
7712 packed.append(struct.pack("!B", self.type))
7713 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7714 packed.append(struct.pack("!L", self.xid))
7715 packed.append(struct.pack("!H", self.stats_type))
7716 packed.append(struct.pack("!H", self.flags))
7717 packed.append('\x00' * 4)
7718 packed.append(struct.pack("!L", self.group_id))
7719 packed.append('\x00' * 4)
7720 length = sum([len(x) for x in packed])
7721 packed[2] = struct.pack("!H", length)
7722 return ''.join(packed)
7723
7724 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007725 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07007726 obj = group_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -07007727 _version = reader.read("!B")[0]
7728 assert(_version == 4)
7729 _type = reader.read("!B")[0]
7730 assert(_type == 18)
7731 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007732 orig_reader = reader
7733 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07007734 obj.xid = reader.read("!L")[0]
7735 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007736 assert(_stats_type == 6)
Dan Talaycof6202252013-07-02 01:00:29 -07007737 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007738 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -07007739 obj.group_id = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007740 reader.skip(4)
7741 return obj
7742
7743 def __eq__(self, other):
7744 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07007745 if self.xid != other.xid: return False
7746 if self.flags != other.flags: return False
7747 if self.group_id != other.group_id: return False
7748 return True
7749
Rich Lanec2ee4b82013-04-24 17:12:38 -07007750 def pretty_print(self, q):
7751 q.text("group_stats_request {")
7752 with q.group():
7753 with q.indent(2):
7754 q.breakable()
7755 q.text("xid = ");
7756 if self.xid != None:
7757 q.text("%#x" % self.xid)
7758 else:
7759 q.text('None')
7760 q.text(","); q.breakable()
7761 q.text("flags = ");
7762 q.text("%#x" % self.flags)
7763 q.text(","); q.breakable()
7764 q.text("group_id = ");
7765 q.text("%#x" % self.group_id)
7766 q.breakable()
7767 q.text('}')
7768
Rich Lane7dcdf022013-12-11 14:45:27 -08007769stats_request.subtypes[6] = group_stats_request
7770
7771class hello(message):
Dan Talaycof6202252013-07-02 01:00:29 -07007772 version = 4
7773 type = 0
Rich Lanec2ee4b82013-04-24 17:12:38 -07007774
7775 def __init__(self, xid=None, elements=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007776 if xid != None:
7777 self.xid = xid
7778 else:
7779 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07007780 if elements != None:
7781 self.elements = elements
7782 else:
7783 self.elements = []
Rich Lane7dcdf022013-12-11 14:45:27 -08007784 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07007785
7786 def pack(self):
7787 packed = []
7788 packed.append(struct.pack("!B", self.version))
7789 packed.append(struct.pack("!B", self.type))
7790 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7791 packed.append(struct.pack("!L", self.xid))
Rich Lane7dcdf022013-12-11 14:45:27 -08007792 packed.append(loxi.generic_util.pack_list(self.elements))
Rich Lanec2ee4b82013-04-24 17:12:38 -07007793 length = sum([len(x) for x in packed])
7794 packed[2] = struct.pack("!H", length)
7795 return ''.join(packed)
7796
7797 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007798 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07007799 obj = hello()
Dan Talaycof6202252013-07-02 01:00:29 -07007800 _version = reader.read("!B")[0]
7801 assert(_version == 4)
7802 _type = reader.read("!B")[0]
7803 assert(_type == 0)
7804 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007805 orig_reader = reader
7806 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07007807 obj.xid = reader.read("!L")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007808 obj.elements = util.unpack_list_hello_elem(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -07007809 return obj
7810
7811 def __eq__(self, other):
7812 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07007813 if self.xid != other.xid: return False
7814 if self.elements != other.elements: return False
7815 return True
7816
Rich Lanec2ee4b82013-04-24 17:12:38 -07007817 def pretty_print(self, q):
7818 q.text("hello {")
7819 with q.group():
7820 with q.indent(2):
7821 q.breakable()
7822 q.text("xid = ");
7823 if self.xid != None:
7824 q.text("%#x" % self.xid)
7825 else:
7826 q.text('None')
7827 q.text(","); q.breakable()
7828 q.text("elements = ");
7829 q.pp(self.elements)
7830 q.breakable()
7831 q.text('}')
7832
Rich Lane7dcdf022013-12-11 14:45:27 -08007833message.subtypes[0] = hello
7834
7835class hello_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -07007836 version = 4
7837 type = 1
7838 err_type = 0
7839
7840 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007841 if xid != None:
7842 self.xid = xid
7843 else:
7844 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07007845 if code != None:
7846 self.code = code
7847 else:
7848 self.code = 0
7849 if data != None:
7850 self.data = data
7851 else:
7852 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08007853 return
Rich Lane6f4978c2013-10-20 21:33:52 -07007854
7855 def pack(self):
7856 packed = []
7857 packed.append(struct.pack("!B", self.version))
7858 packed.append(struct.pack("!B", self.type))
7859 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7860 packed.append(struct.pack("!L", self.xid))
7861 packed.append(struct.pack("!H", self.err_type))
7862 packed.append(struct.pack("!H", self.code))
7863 packed.append(self.data)
7864 length = sum([len(x) for x in packed])
7865 packed[2] = struct.pack("!H", length)
7866 return ''.join(packed)
7867
7868 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007869 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07007870 obj = hello_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -07007871 _version = reader.read("!B")[0]
7872 assert(_version == 4)
7873 _type = reader.read("!B")[0]
7874 assert(_type == 1)
7875 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007876 orig_reader = reader
7877 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07007878 obj.xid = reader.read("!L")[0]
7879 _err_type = reader.read("!H")[0]
7880 assert(_err_type == 0)
7881 obj.code = reader.read("!H")[0]
7882 obj.data = str(reader.read_all())
7883 return obj
7884
7885 def __eq__(self, other):
7886 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07007887 if self.xid != other.xid: return False
7888 if self.code != other.code: return False
7889 if self.data != other.data: return False
7890 return True
7891
Rich Lane6f4978c2013-10-20 21:33:52 -07007892 def pretty_print(self, q):
7893 q.text("hello_failed_error_msg {")
7894 with q.group():
7895 with q.indent(2):
7896 q.breakable()
7897 q.text("xid = ");
7898 if self.xid != None:
7899 q.text("%#x" % self.xid)
7900 else:
7901 q.text('None')
7902 q.text(","); q.breakable()
7903 q.text("code = ");
7904 q.text("%#x" % self.code)
7905 q.text(","); q.breakable()
7906 q.text("data = ");
7907 q.pp(self.data)
7908 q.breakable()
7909 q.text('}')
7910
Rich Lane7dcdf022013-12-11 14:45:27 -08007911error_msg.subtypes[0] = hello_failed_error_msg
7912
7913class meter_config_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -07007914 version = 4
7915 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -07007916 stats_type = 10
7917
7918 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007919 if xid != None:
7920 self.xid = xid
7921 else:
7922 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07007923 if flags != None:
7924 self.flags = flags
7925 else:
7926 self.flags = 0
7927 if entries != None:
7928 self.entries = entries
7929 else:
7930 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -08007931 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07007932
7933 def pack(self):
7934 packed = []
7935 packed.append(struct.pack("!B", self.version))
7936 packed.append(struct.pack("!B", self.type))
7937 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7938 packed.append(struct.pack("!L", self.xid))
7939 packed.append(struct.pack("!H", self.stats_type))
7940 packed.append(struct.pack("!H", self.flags))
7941 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -08007942 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -07007943 length = sum([len(x) for x in packed])
7944 packed[2] = struct.pack("!H", length)
7945 return ''.join(packed)
7946
7947 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007948 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07007949 obj = meter_config_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07007950 _version = reader.read("!B")[0]
7951 assert(_version == 4)
7952 _type = reader.read("!B")[0]
7953 assert(_type == 19)
7954 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007955 orig_reader = reader
7956 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07007957 obj.xid = reader.read("!L")[0]
7958 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007959 assert(_stats_type == 10)
Dan Talaycof6202252013-07-02 01:00:29 -07007960 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007961 reader.skip(4)
Rich Lane7dcdf022013-12-11 14:45:27 -08007962 obj.entries = loxi.generic_util.unpack_list(reader, meter_band.meter_band.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -07007963 return obj
7964
7965 def __eq__(self, other):
7966 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07007967 if self.xid != other.xid: return False
7968 if self.flags != other.flags: return False
7969 if self.entries != other.entries: return False
7970 return True
7971
Rich Lanec2ee4b82013-04-24 17:12:38 -07007972 def pretty_print(self, q):
7973 q.text("meter_config_stats_reply {")
7974 with q.group():
7975 with q.indent(2):
7976 q.breakable()
7977 q.text("xid = ");
7978 if self.xid != None:
7979 q.text("%#x" % self.xid)
7980 else:
7981 q.text('None')
7982 q.text(","); q.breakable()
7983 q.text("flags = ");
7984 q.text("%#x" % self.flags)
7985 q.text(","); q.breakable()
7986 q.text("entries = ");
7987 q.pp(self.entries)
7988 q.breakable()
7989 q.text('}')
7990
Rich Lane7dcdf022013-12-11 14:45:27 -08007991stats_reply.subtypes[10] = meter_config_stats_reply
7992
7993class meter_config_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -07007994 version = 4
7995 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -07007996 stats_type = 10
7997
7998 def __init__(self, xid=None, flags=None, meter_id=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007999 if xid != None:
8000 self.xid = xid
8001 else:
8002 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07008003 if flags != None:
8004 self.flags = flags
8005 else:
8006 self.flags = 0
8007 if meter_id != None:
8008 self.meter_id = meter_id
8009 else:
8010 self.meter_id = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08008011 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07008012
8013 def pack(self):
8014 packed = []
8015 packed.append(struct.pack("!B", self.version))
8016 packed.append(struct.pack("!B", self.type))
8017 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8018 packed.append(struct.pack("!L", self.xid))
8019 packed.append(struct.pack("!H", self.stats_type))
8020 packed.append(struct.pack("!H", self.flags))
8021 packed.append('\x00' * 4)
8022 packed.append(struct.pack("!L", self.meter_id))
8023 packed.append('\x00' * 4)
8024 length = sum([len(x) for x in packed])
8025 packed[2] = struct.pack("!H", length)
8026 return ''.join(packed)
8027
8028 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08008029 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07008030 obj = meter_config_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -07008031 _version = reader.read("!B")[0]
8032 assert(_version == 4)
8033 _type = reader.read("!B")[0]
8034 assert(_type == 18)
8035 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08008036 orig_reader = reader
8037 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07008038 obj.xid = reader.read("!L")[0]
8039 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07008040 assert(_stats_type == 10)
Dan Talaycof6202252013-07-02 01:00:29 -07008041 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07008042 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -07008043 obj.meter_id = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07008044 reader.skip(4)
8045 return obj
8046
8047 def __eq__(self, other):
8048 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07008049 if self.xid != other.xid: return False
8050 if self.flags != other.flags: return False
8051 if self.meter_id != other.meter_id: return False
8052 return True
8053
Rich Lanec2ee4b82013-04-24 17:12:38 -07008054 def pretty_print(self, q):
8055 q.text("meter_config_stats_request {")
8056 with q.group():
8057 with q.indent(2):
8058 q.breakable()
8059 q.text("xid = ");
8060 if self.xid != None:
8061 q.text("%#x" % self.xid)
8062 else:
8063 q.text('None')
8064 q.text(","); q.breakable()
8065 q.text("flags = ");
8066 q.text("%#x" % self.flags)
8067 q.text(","); q.breakable()
8068 q.text("meter_id = ");
8069 q.text("%#x" % self.meter_id)
8070 q.breakable()
8071 q.text('}')
8072
Rich Lane7dcdf022013-12-11 14:45:27 -08008073stats_request.subtypes[10] = meter_config_stats_request
8074
8075class meter_features_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -07008076 version = 4
8077 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -07008078 stats_type = 11
8079
8080 def __init__(self, xid=None, flags=None, features=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08008081 if xid != None:
8082 self.xid = xid
8083 else:
8084 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07008085 if flags != None:
8086 self.flags = flags
8087 else:
8088 self.flags = 0
8089 if features != None:
8090 self.features = features
8091 else:
8092 self.features = common.meter_features()
Rich Lane7dcdf022013-12-11 14:45:27 -08008093 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07008094
8095 def pack(self):
8096 packed = []
8097 packed.append(struct.pack("!B", self.version))
8098 packed.append(struct.pack("!B", self.type))
8099 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8100 packed.append(struct.pack("!L", self.xid))
8101 packed.append(struct.pack("!H", self.stats_type))
8102 packed.append(struct.pack("!H", self.flags))
8103 packed.append('\x00' * 4)
8104 packed.append(self.features.pack())
8105 length = sum([len(x) for x in packed])
8106 packed[2] = struct.pack("!H", length)
8107 return ''.join(packed)
8108
8109 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08008110 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07008111 obj = meter_features_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07008112 _version = reader.read("!B")[0]
8113 assert(_version == 4)
8114 _type = reader.read("!B")[0]
8115 assert(_type == 19)
8116 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08008117 orig_reader = reader
8118 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07008119 obj.xid = reader.read("!L")[0]
8120 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07008121 assert(_stats_type == 11)
Dan Talaycof6202252013-07-02 01:00:29 -07008122 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07008123 reader.skip(4)
8124 obj.features = common.meter_features.unpack(reader)
8125 return obj
8126
8127 def __eq__(self, other):
8128 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07008129 if self.xid != other.xid: return False
8130 if self.flags != other.flags: return False
8131 if self.features != other.features: return False
8132 return True
8133
Rich Lanec2ee4b82013-04-24 17:12:38 -07008134 def pretty_print(self, q):
8135 q.text("meter_features_stats_reply {")
8136 with q.group():
8137 with q.indent(2):
8138 q.breakable()
8139 q.text("xid = ");
8140 if self.xid != None:
8141 q.text("%#x" % self.xid)
8142 else:
8143 q.text('None')
8144 q.text(","); q.breakable()
8145 q.text("flags = ");
8146 q.text("%#x" % self.flags)
8147 q.text(","); q.breakable()
8148 q.text("features = ");
8149 q.pp(self.features)
8150 q.breakable()
8151 q.text('}')
8152
Rich Lane7dcdf022013-12-11 14:45:27 -08008153stats_reply.subtypes[11] = meter_features_stats_reply
8154
8155class meter_features_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -07008156 version = 4
8157 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -07008158 stats_type = 11
8159
8160 def __init__(self, xid=None, flags=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08008161 if xid != None:
8162 self.xid = xid
8163 else:
8164 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07008165 if flags != None:
8166 self.flags = flags
8167 else:
8168 self.flags = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08008169 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07008170
8171 def pack(self):
8172 packed = []
8173 packed.append(struct.pack("!B", self.version))
8174 packed.append(struct.pack("!B", self.type))
8175 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8176 packed.append(struct.pack("!L", self.xid))
8177 packed.append(struct.pack("!H", self.stats_type))
8178 packed.append(struct.pack("!H", self.flags))
8179 packed.append('\x00' * 4)
8180 length = sum([len(x) for x in packed])
8181 packed[2] = struct.pack("!H", length)
8182 return ''.join(packed)
8183
8184 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08008185 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07008186 obj = meter_features_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -07008187 _version = reader.read("!B")[0]
8188 assert(_version == 4)
8189 _type = reader.read("!B")[0]
8190 assert(_type == 18)
8191 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08008192 orig_reader = reader
8193 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07008194 obj.xid = reader.read("!L")[0]
8195 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07008196 assert(_stats_type == 11)
Dan Talaycof6202252013-07-02 01:00:29 -07008197 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07008198 reader.skip(4)
8199 return obj
8200
8201 def __eq__(self, other):
8202 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07008203 if self.xid != other.xid: return False
8204 if self.flags != other.flags: return False
8205 return True
8206
Rich Lanec2ee4b82013-04-24 17:12:38 -07008207 def pretty_print(self, q):
8208 q.text("meter_features_stats_request {")
8209 with q.group():
8210 with q.indent(2):
8211 q.breakable()
8212 q.text("xid = ");
8213 if self.xid != None:
8214 q.text("%#x" % self.xid)
8215 else:
8216 q.text('None')
8217 q.text(","); q.breakable()
8218 q.text("flags = ");
8219 q.text("%#x" % self.flags)
8220 q.breakable()
8221 q.text('}')
8222
Rich Lane7dcdf022013-12-11 14:45:27 -08008223stats_request.subtypes[11] = meter_features_stats_request
8224
8225class meter_mod(message):
Dan Talaycof6202252013-07-02 01:00:29 -07008226 version = 4
8227 type = 29
Rich Lanec2ee4b82013-04-24 17:12:38 -07008228
8229 def __init__(self, xid=None, command=None, flags=None, meter_id=None, meters=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08008230 if xid != None:
8231 self.xid = xid
8232 else:
8233 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07008234 if command != None:
8235 self.command = command
8236 else:
8237 self.command = 0
8238 if flags != None:
8239 self.flags = flags
8240 else:
8241 self.flags = 0
8242 if meter_id != None:
8243 self.meter_id = meter_id
8244 else:
8245 self.meter_id = 0
8246 if meters != None:
8247 self.meters = meters
8248 else:
8249 self.meters = []
Rich Lane7dcdf022013-12-11 14:45:27 -08008250 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07008251
8252 def pack(self):
8253 packed = []
8254 packed.append(struct.pack("!B", self.version))
8255 packed.append(struct.pack("!B", self.type))
8256 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8257 packed.append(struct.pack("!L", self.xid))
8258 packed.append(struct.pack("!H", self.command))
8259 packed.append(struct.pack("!H", self.flags))
8260 packed.append(struct.pack("!L", self.meter_id))
Rich Lane7dcdf022013-12-11 14:45:27 -08008261 packed.append(loxi.generic_util.pack_list(self.meters))
Rich Lanec2ee4b82013-04-24 17:12:38 -07008262 length = sum([len(x) for x in packed])
8263 packed[2] = struct.pack("!H", length)
8264 return ''.join(packed)
8265
8266 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08008267 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07008268 obj = meter_mod()
Dan Talaycof6202252013-07-02 01:00:29 -07008269 _version = reader.read("!B")[0]
8270 assert(_version == 4)
8271 _type = reader.read("!B")[0]
8272 assert(_type == 29)
8273 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08008274 orig_reader = reader
8275 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07008276 obj.xid = reader.read("!L")[0]
8277 obj.command = reader.read("!H")[0]
8278 obj.flags = reader.read("!H")[0]
8279 obj.meter_id = reader.read("!L")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08008280 obj.meters = loxi.generic_util.unpack_list(reader, meter_band.meter_band.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -07008281 return obj
8282
8283 def __eq__(self, other):
8284 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07008285 if self.xid != other.xid: return False
8286 if self.command != other.command: return False
8287 if self.flags != other.flags: return False
8288 if self.meter_id != other.meter_id: return False
8289 if self.meters != other.meters: return False
8290 return True
8291
Rich Lanec2ee4b82013-04-24 17:12:38 -07008292 def pretty_print(self, q):
8293 q.text("meter_mod {")
8294 with q.group():
8295 with q.indent(2):
8296 q.breakable()
8297 q.text("xid = ");
8298 if self.xid != None:
8299 q.text("%#x" % self.xid)
8300 else:
8301 q.text('None')
8302 q.text(","); q.breakable()
8303 q.text("command = ");
8304 q.text("%#x" % self.command)
8305 q.text(","); q.breakable()
8306 q.text("flags = ");
8307 q.text("%#x" % self.flags)
8308 q.text(","); q.breakable()
8309 q.text("meter_id = ");
8310 q.text("%#x" % self.meter_id)
8311 q.text(","); q.breakable()
8312 q.text("meters = ");
8313 q.pp(self.meters)
8314 q.breakable()
8315 q.text('}')
8316
Rich Lane7dcdf022013-12-11 14:45:27 -08008317message.subtypes[29] = meter_mod
8318
8319class meter_mod_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -07008320 version = 4
8321 type = 1
8322 err_type = 12
8323
8324 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08008325 if xid != None:
8326 self.xid = xid
8327 else:
8328 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07008329 if code != None:
8330 self.code = code
8331 else:
8332 self.code = 0
8333 if data != None:
8334 self.data = data
8335 else:
8336 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08008337 return
Rich Lane6f4978c2013-10-20 21:33:52 -07008338
8339 def pack(self):
8340 packed = []
8341 packed.append(struct.pack("!B", self.version))
8342 packed.append(struct.pack("!B", self.type))
8343 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8344 packed.append(struct.pack("!L", self.xid))
8345 packed.append(struct.pack("!H", self.err_type))
8346 packed.append(struct.pack("!H", self.code))
8347 packed.append(self.data)
8348 length = sum([len(x) for x in packed])
8349 packed[2] = struct.pack("!H", length)
8350 return ''.join(packed)
8351
8352 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08008353 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07008354 obj = meter_mod_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -07008355 _version = reader.read("!B")[0]
8356 assert(_version == 4)
8357 _type = reader.read("!B")[0]
8358 assert(_type == 1)
8359 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08008360 orig_reader = reader
8361 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07008362 obj.xid = reader.read("!L")[0]
8363 _err_type = reader.read("!H")[0]
8364 assert(_err_type == 12)
8365 obj.code = reader.read("!H")[0]
8366 obj.data = str(reader.read_all())
8367 return obj
8368
8369 def __eq__(self, other):
8370 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07008371 if self.xid != other.xid: return False
8372 if self.code != other.code: return False
8373 if self.data != other.data: return False
8374 return True
8375
Rich Lane6f4978c2013-10-20 21:33:52 -07008376 def pretty_print(self, q):
8377 q.text("meter_mod_failed_error_msg {")
8378 with q.group():
8379 with q.indent(2):
8380 q.breakable()
8381 q.text("xid = ");
8382 if self.xid != None:
8383 q.text("%#x" % self.xid)
8384 else:
8385 q.text('None')
8386 q.text(","); q.breakable()
8387 q.text("code = ");
8388 q.text("%#x" % self.code)
8389 q.text(","); q.breakable()
8390 q.text("data = ");
8391 q.pp(self.data)
8392 q.breakable()
8393 q.text('}')
8394
Rich Lane7dcdf022013-12-11 14:45:27 -08008395error_msg.subtypes[12] = meter_mod_failed_error_msg
8396
8397class meter_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -07008398 version = 4
8399 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -07008400 stats_type = 9
8401
8402 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08008403 if xid != None:
8404 self.xid = xid
8405 else:
8406 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07008407 if flags != None:
8408 self.flags = flags
8409 else:
8410 self.flags = 0
8411 if entries != None:
8412 self.entries = entries
8413 else:
8414 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -08008415 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07008416
8417 def pack(self):
8418 packed = []
8419 packed.append(struct.pack("!B", self.version))
8420 packed.append(struct.pack("!B", self.type))
8421 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8422 packed.append(struct.pack("!L", self.xid))
8423 packed.append(struct.pack("!H", self.stats_type))
8424 packed.append(struct.pack("!H", self.flags))
8425 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -08008426 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -07008427 length = sum([len(x) for x in packed])
8428 packed[2] = struct.pack("!H", length)
8429 return ''.join(packed)
8430
8431 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08008432 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07008433 obj = meter_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07008434 _version = reader.read("!B")[0]
8435 assert(_version == 4)
8436 _type = reader.read("!B")[0]
8437 assert(_type == 19)
8438 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08008439 orig_reader = reader
8440 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07008441 obj.xid = reader.read("!L")[0]
8442 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07008443 assert(_stats_type == 9)
Dan Talaycof6202252013-07-02 01:00:29 -07008444 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07008445 reader.skip(4)
Rich Lane7dcdf022013-12-11 14:45:27 -08008446 obj.entries = loxi.generic_util.unpack_list(reader, common.meter_stats.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -07008447 return obj
8448
8449 def __eq__(self, other):
8450 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07008451 if self.xid != other.xid: return False
8452 if self.flags != other.flags: return False
8453 if self.entries != other.entries: return False
8454 return True
8455
Rich Lanec2ee4b82013-04-24 17:12:38 -07008456 def pretty_print(self, q):
8457 q.text("meter_stats_reply {")
8458 with q.group():
8459 with q.indent(2):
8460 q.breakable()
8461 q.text("xid = ");
8462 if self.xid != None:
8463 q.text("%#x" % self.xid)
8464 else:
8465 q.text('None')
8466 q.text(","); q.breakable()
8467 q.text("flags = ");
8468 q.text("%#x" % self.flags)
8469 q.text(","); q.breakable()
8470 q.text("entries = ");
8471 q.pp(self.entries)
8472 q.breakable()
8473 q.text('}')
8474
Rich Lane7dcdf022013-12-11 14:45:27 -08008475stats_reply.subtypes[9] = meter_stats_reply
8476
8477class meter_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -07008478 version = 4
8479 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -07008480 stats_type = 9
8481
8482 def __init__(self, xid=None, flags=None, meter_id=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08008483 if xid != None:
8484 self.xid = xid
8485 else:
8486 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07008487 if flags != None:
8488 self.flags = flags
8489 else:
8490 self.flags = 0
8491 if meter_id != None:
8492 self.meter_id = meter_id
8493 else:
8494 self.meter_id = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08008495 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07008496
8497 def pack(self):
8498 packed = []
8499 packed.append(struct.pack("!B", self.version))
8500 packed.append(struct.pack("!B", self.type))
8501 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8502 packed.append(struct.pack("!L", self.xid))
8503 packed.append(struct.pack("!H", self.stats_type))
8504 packed.append(struct.pack("!H", self.flags))
8505 packed.append('\x00' * 4)
8506 packed.append(struct.pack("!L", self.meter_id))
8507 packed.append('\x00' * 4)
8508 length = sum([len(x) for x in packed])
8509 packed[2] = struct.pack("!H", length)
8510 return ''.join(packed)
8511
8512 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08008513 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07008514 obj = meter_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -07008515 _version = reader.read("!B")[0]
8516 assert(_version == 4)
8517 _type = reader.read("!B")[0]
8518 assert(_type == 18)
8519 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08008520 orig_reader = reader
8521 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07008522 obj.xid = reader.read("!L")[0]
8523 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07008524 assert(_stats_type == 9)
Dan Talaycof6202252013-07-02 01:00:29 -07008525 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07008526 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -07008527 obj.meter_id = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07008528 reader.skip(4)
8529 return obj
8530
8531 def __eq__(self, other):
8532 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07008533 if self.xid != other.xid: return False
8534 if self.flags != other.flags: return False
8535 if self.meter_id != other.meter_id: return False
8536 return True
8537
Rich Lanec2ee4b82013-04-24 17:12:38 -07008538 def pretty_print(self, q):
8539 q.text("meter_stats_request {")
8540 with q.group():
8541 with q.indent(2):
8542 q.breakable()
8543 q.text("xid = ");
8544 if self.xid != None:
8545 q.text("%#x" % self.xid)
8546 else:
8547 q.text('None')
8548 q.text(","); q.breakable()
8549 q.text("flags = ");
8550 q.text("%#x" % self.flags)
8551 q.text(","); q.breakable()
8552 q.text("meter_id = ");
8553 q.text("%#x" % self.meter_id)
8554 q.breakable()
8555 q.text('}')
8556
Rich Lane7dcdf022013-12-11 14:45:27 -08008557stats_request.subtypes[9] = meter_stats_request
8558
8559class nicira_header(experimenter):
8560 subtypes = {}
8561
8562 @staticmethod
8563 def unpack(reader):
8564 subtype, = reader.peek('!L', 12)
8565 try:
8566 subclass = nicira_header.subtypes[subtype]
8567 except KeyError:
8568 raise loxi.ProtocolError("unknown nicira_header experimenter message subtype %#x" % subtype)
8569 return subclass.unpack(reader)
8570
8571experimenter.subtypes[8992] = nicira_header
8572
8573class packet_in(message):
Dan Talaycof6202252013-07-02 01:00:29 -07008574 version = 4
8575 type = 10
Rich Lanec2ee4b82013-04-24 17:12:38 -07008576
8577 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 -08008578 if xid != None:
8579 self.xid = xid
8580 else:
8581 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07008582 if buffer_id != None:
8583 self.buffer_id = buffer_id
8584 else:
8585 self.buffer_id = 0
8586 if total_len != None:
8587 self.total_len = total_len
8588 else:
8589 self.total_len = 0
8590 if reason != None:
8591 self.reason = reason
8592 else:
8593 self.reason = 0
8594 if table_id != None:
8595 self.table_id = table_id
8596 else:
8597 self.table_id = 0
8598 if cookie != None:
8599 self.cookie = cookie
8600 else:
8601 self.cookie = 0
8602 if match != None:
8603 self.match = match
8604 else:
8605 self.match = common.match()
8606 if data != None:
8607 self.data = data
8608 else:
Dan Talaycof6202252013-07-02 01:00:29 -07008609 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08008610 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07008611
8612 def pack(self):
8613 packed = []
8614 packed.append(struct.pack("!B", self.version))
8615 packed.append(struct.pack("!B", self.type))
8616 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8617 packed.append(struct.pack("!L", self.xid))
8618 packed.append(struct.pack("!L", self.buffer_id))
8619 packed.append(struct.pack("!H", self.total_len))
8620 packed.append(struct.pack("!B", self.reason))
8621 packed.append(struct.pack("!B", self.table_id))
8622 packed.append(struct.pack("!Q", self.cookie))
8623 packed.append(self.match.pack())
8624 packed.append('\x00' * 2)
8625 packed.append(self.data)
8626 length = sum([len(x) for x in packed])
8627 packed[2] = struct.pack("!H", length)
8628 return ''.join(packed)
8629
8630 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08008631 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07008632 obj = packet_in()
Dan Talaycof6202252013-07-02 01:00:29 -07008633 _version = reader.read("!B")[0]
8634 assert(_version == 4)
8635 _type = reader.read("!B")[0]
8636 assert(_type == 10)
8637 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08008638 orig_reader = reader
8639 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07008640 obj.xid = reader.read("!L")[0]
8641 obj.buffer_id = reader.read("!L")[0]
8642 obj.total_len = reader.read("!H")[0]
8643 obj.reason = reader.read("!B")[0]
8644 obj.table_id = reader.read("!B")[0]
8645 obj.cookie = reader.read("!Q")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07008646 obj.match = common.match.unpack(reader)
8647 reader.skip(2)
8648 obj.data = str(reader.read_all())
8649 return obj
8650
8651 def __eq__(self, other):
8652 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07008653 if self.xid != other.xid: return False
8654 if self.buffer_id != other.buffer_id: return False
8655 if self.total_len != other.total_len: return False
8656 if self.reason != other.reason: return False
8657 if self.table_id != other.table_id: return False
8658 if self.cookie != other.cookie: return False
8659 if self.match != other.match: return False
8660 if self.data != other.data: return False
8661 return True
8662
Rich Lanec2ee4b82013-04-24 17:12:38 -07008663 def pretty_print(self, q):
8664 q.text("packet_in {")
8665 with q.group():
8666 with q.indent(2):
8667 q.breakable()
8668 q.text("xid = ");
8669 if self.xid != None:
8670 q.text("%#x" % self.xid)
8671 else:
8672 q.text('None')
8673 q.text(","); q.breakable()
8674 q.text("buffer_id = ");
8675 q.text("%#x" % self.buffer_id)
8676 q.text(","); q.breakable()
8677 q.text("total_len = ");
8678 q.text("%#x" % self.total_len)
8679 q.text(","); q.breakable()
8680 q.text("reason = ");
8681 q.text("%#x" % self.reason)
8682 q.text(","); q.breakable()
8683 q.text("table_id = ");
8684 q.text("%#x" % self.table_id)
8685 q.text(","); q.breakable()
8686 q.text("cookie = ");
8687 q.text("%#x" % self.cookie)
8688 q.text(","); q.breakable()
8689 q.text("match = ");
8690 q.pp(self.match)
8691 q.text(","); q.breakable()
8692 q.text("data = ");
8693 q.pp(self.data)
8694 q.breakable()
8695 q.text('}')
8696
Rich Lane7dcdf022013-12-11 14:45:27 -08008697message.subtypes[10] = packet_in
8698
8699class packet_out(message):
Dan Talaycof6202252013-07-02 01:00:29 -07008700 version = 4
8701 type = 13
Rich Lanec2ee4b82013-04-24 17:12:38 -07008702
8703 def __init__(self, xid=None, buffer_id=None, in_port=None, actions=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08008704 if xid != None:
8705 self.xid = xid
8706 else:
8707 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07008708 if buffer_id != None:
8709 self.buffer_id = buffer_id
8710 else:
8711 self.buffer_id = 0
8712 if in_port != None:
8713 self.in_port = in_port
8714 else:
8715 self.in_port = 0
8716 if actions != None:
8717 self.actions = actions
8718 else:
8719 self.actions = []
8720 if data != None:
8721 self.data = data
8722 else:
Dan Talaycof6202252013-07-02 01:00:29 -07008723 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08008724 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07008725
8726 def pack(self):
8727 packed = []
8728 packed.append(struct.pack("!B", self.version))
8729 packed.append(struct.pack("!B", self.type))
8730 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8731 packed.append(struct.pack("!L", self.xid))
8732 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -07008733 packed.append(util.pack_port_no(self.in_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -07008734 packed.append(struct.pack("!H", 0)) # placeholder for actions_len at index 6
8735 packed.append('\x00' * 6)
Rich Lane7dcdf022013-12-11 14:45:27 -08008736 packed.append(loxi.generic_util.pack_list(self.actions))
Rich Lanec2ee4b82013-04-24 17:12:38 -07008737 packed[6] = struct.pack("!H", len(packed[-1]))
8738 packed.append(self.data)
8739 length = sum([len(x) for x in packed])
8740 packed[2] = struct.pack("!H", length)
8741 return ''.join(packed)
8742
8743 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08008744 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07008745 obj = packet_out()
Dan Talaycof6202252013-07-02 01:00:29 -07008746 _version = reader.read("!B")[0]
8747 assert(_version == 4)
8748 _type = reader.read("!B")[0]
8749 assert(_type == 13)
8750 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08008751 orig_reader = reader
8752 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07008753 obj.xid = reader.read("!L")[0]
8754 obj.buffer_id = reader.read("!L")[0]
8755 obj.in_port = util.unpack_port_no(reader)
8756 _actions_len = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07008757 reader.skip(6)
Rich Lane7dcdf022013-12-11 14:45:27 -08008758 obj.actions = loxi.generic_util.unpack_list(reader.slice(_actions_len), action.action.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -07008759 obj.data = str(reader.read_all())
8760 return obj
8761
8762 def __eq__(self, other):
8763 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07008764 if self.xid != other.xid: return False
8765 if self.buffer_id != other.buffer_id: return False
8766 if self.in_port != other.in_port: return False
8767 if self.actions != other.actions: return False
8768 if self.data != other.data: return False
8769 return True
8770
Rich Lanec2ee4b82013-04-24 17:12:38 -07008771 def pretty_print(self, q):
8772 q.text("packet_out {")
8773 with q.group():
8774 with q.indent(2):
8775 q.breakable()
8776 q.text("xid = ");
8777 if self.xid != None:
8778 q.text("%#x" % self.xid)
8779 else:
8780 q.text('None')
8781 q.text(","); q.breakable()
8782 q.text("buffer_id = ");
8783 q.text("%#x" % self.buffer_id)
8784 q.text(","); q.breakable()
8785 q.text("in_port = ");
8786 q.text(util.pretty_port(self.in_port))
8787 q.text(","); q.breakable()
8788 q.text("actions = ");
8789 q.pp(self.actions)
8790 q.text(","); q.breakable()
8791 q.text("data = ");
8792 q.pp(self.data)
8793 q.breakable()
8794 q.text('}')
8795
Rich Lane7dcdf022013-12-11 14:45:27 -08008796message.subtypes[13] = packet_out
8797
8798class port_desc_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -07008799 version = 4
8800 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -07008801 stats_type = 13
8802
8803 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08008804 if xid != None:
8805 self.xid = xid
8806 else:
8807 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07008808 if flags != None:
8809 self.flags = flags
8810 else:
8811 self.flags = 0
8812 if entries != None:
8813 self.entries = entries
8814 else:
8815 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -08008816 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07008817
8818 def pack(self):
8819 packed = []
8820 packed.append(struct.pack("!B", self.version))
8821 packed.append(struct.pack("!B", self.type))
8822 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8823 packed.append(struct.pack("!L", self.xid))
8824 packed.append(struct.pack("!H", self.stats_type))
8825 packed.append(struct.pack("!H", self.flags))
8826 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -08008827 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -07008828 length = sum([len(x) for x in packed])
8829 packed[2] = struct.pack("!H", length)
8830 return ''.join(packed)
8831
8832 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08008833 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07008834 obj = port_desc_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07008835 _version = reader.read("!B")[0]
8836 assert(_version == 4)
8837 _type = reader.read("!B")[0]
8838 assert(_type == 19)
8839 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08008840 orig_reader = reader
8841 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07008842 obj.xid = reader.read("!L")[0]
8843 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07008844 assert(_stats_type == 13)
Dan Talaycof6202252013-07-02 01:00:29 -07008845 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07008846 reader.skip(4)
8847 obj.entries = loxi.generic_util.unpack_list(reader, common.port_desc.unpack)
8848 return obj
8849
8850 def __eq__(self, other):
8851 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07008852 if self.xid != other.xid: return False
8853 if self.flags != other.flags: return False
8854 if self.entries != other.entries: return False
8855 return True
8856
Rich Lanec2ee4b82013-04-24 17:12:38 -07008857 def pretty_print(self, q):
8858 q.text("port_desc_stats_reply {")
8859 with q.group():
8860 with q.indent(2):
8861 q.breakable()
8862 q.text("xid = ");
8863 if self.xid != None:
8864 q.text("%#x" % self.xid)
8865 else:
8866 q.text('None')
8867 q.text(","); q.breakable()
8868 q.text("flags = ");
8869 q.text("%#x" % self.flags)
8870 q.text(","); q.breakable()
8871 q.text("entries = ");
8872 q.pp(self.entries)
8873 q.breakable()
8874 q.text('}')
8875
Rich Lane7dcdf022013-12-11 14:45:27 -08008876stats_reply.subtypes[13] = port_desc_stats_reply
8877
8878class port_desc_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -07008879 version = 4
8880 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -07008881 stats_type = 13
8882
8883 def __init__(self, xid=None, flags=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08008884 if xid != None:
8885 self.xid = xid
8886 else:
8887 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07008888 if flags != None:
8889 self.flags = flags
8890 else:
8891 self.flags = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08008892 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07008893
8894 def pack(self):
8895 packed = []
8896 packed.append(struct.pack("!B", self.version))
8897 packed.append(struct.pack("!B", self.type))
8898 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8899 packed.append(struct.pack("!L", self.xid))
8900 packed.append(struct.pack("!H", self.stats_type))
8901 packed.append(struct.pack("!H", self.flags))
8902 packed.append('\x00' * 4)
8903 length = sum([len(x) for x in packed])
8904 packed[2] = struct.pack("!H", length)
8905 return ''.join(packed)
8906
8907 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08008908 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07008909 obj = port_desc_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -07008910 _version = reader.read("!B")[0]
8911 assert(_version == 4)
8912 _type = reader.read("!B")[0]
8913 assert(_type == 18)
8914 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08008915 orig_reader = reader
8916 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07008917 obj.xid = reader.read("!L")[0]
8918 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07008919 assert(_stats_type == 13)
Dan Talaycof6202252013-07-02 01:00:29 -07008920 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07008921 reader.skip(4)
8922 return obj
8923
8924 def __eq__(self, other):
8925 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07008926 if self.xid != other.xid: return False
8927 if self.flags != other.flags: return False
8928 return True
8929
Rich Lanec2ee4b82013-04-24 17:12:38 -07008930 def pretty_print(self, q):
8931 q.text("port_desc_stats_request {")
8932 with q.group():
8933 with q.indent(2):
8934 q.breakable()
8935 q.text("xid = ");
8936 if self.xid != None:
8937 q.text("%#x" % self.xid)
8938 else:
8939 q.text('None')
8940 q.text(","); q.breakable()
8941 q.text("flags = ");
8942 q.text("%#x" % self.flags)
8943 q.breakable()
8944 q.text('}')
8945
Rich Lane7dcdf022013-12-11 14:45:27 -08008946stats_request.subtypes[13] = port_desc_stats_request
8947
8948class port_mod(message):
Dan Talaycof6202252013-07-02 01:00:29 -07008949 version = 4
8950 type = 16
Rich Lanec2ee4b82013-04-24 17:12:38 -07008951
8952 def __init__(self, xid=None, port_no=None, hw_addr=None, config=None, mask=None, advertise=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08008953 if xid != None:
8954 self.xid = xid
8955 else:
8956 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07008957 if port_no != None:
8958 self.port_no = port_no
8959 else:
8960 self.port_no = 0
8961 if hw_addr != None:
8962 self.hw_addr = hw_addr
8963 else:
8964 self.hw_addr = [0,0,0,0,0,0]
8965 if config != None:
8966 self.config = config
8967 else:
8968 self.config = 0
8969 if mask != None:
8970 self.mask = mask
8971 else:
8972 self.mask = 0
8973 if advertise != None:
8974 self.advertise = advertise
8975 else:
8976 self.advertise = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08008977 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07008978
8979 def pack(self):
8980 packed = []
8981 packed.append(struct.pack("!B", self.version))
8982 packed.append(struct.pack("!B", self.type))
8983 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8984 packed.append(struct.pack("!L", self.xid))
Dan Talaycof6202252013-07-02 01:00:29 -07008985 packed.append(util.pack_port_no(self.port_no))
Rich Lanec2ee4b82013-04-24 17:12:38 -07008986 packed.append('\x00' * 4)
8987 packed.append(struct.pack("!6B", *self.hw_addr))
8988 packed.append('\x00' * 2)
8989 packed.append(struct.pack("!L", self.config))
8990 packed.append(struct.pack("!L", self.mask))
8991 packed.append(struct.pack("!L", self.advertise))
8992 packed.append('\x00' * 4)
8993 length = sum([len(x) for x in packed])
8994 packed[2] = struct.pack("!H", length)
8995 return ''.join(packed)
8996
8997 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08008998 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07008999 obj = port_mod()
Dan Talaycof6202252013-07-02 01:00:29 -07009000 _version = reader.read("!B")[0]
9001 assert(_version == 4)
9002 _type = reader.read("!B")[0]
9003 assert(_type == 16)
9004 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08009005 orig_reader = reader
9006 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07009007 obj.xid = reader.read("!L")[0]
9008 obj.port_no = util.unpack_port_no(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -07009009 reader.skip(4)
9010 obj.hw_addr = list(reader.read('!6B'))
9011 reader.skip(2)
Dan Talaycof6202252013-07-02 01:00:29 -07009012 obj.config = reader.read("!L")[0]
9013 obj.mask = reader.read("!L")[0]
9014 obj.advertise = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009015 reader.skip(4)
9016 return obj
9017
9018 def __eq__(self, other):
9019 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07009020 if self.xid != other.xid: return False
9021 if self.port_no != other.port_no: return False
9022 if self.hw_addr != other.hw_addr: return False
9023 if self.config != other.config: return False
9024 if self.mask != other.mask: return False
9025 if self.advertise != other.advertise: return False
9026 return True
9027
Rich Lanec2ee4b82013-04-24 17:12:38 -07009028 def pretty_print(self, q):
9029 q.text("port_mod {")
9030 with q.group():
9031 with q.indent(2):
9032 q.breakable()
9033 q.text("xid = ");
9034 if self.xid != None:
9035 q.text("%#x" % self.xid)
9036 else:
9037 q.text('None')
9038 q.text(","); q.breakable()
9039 q.text("port_no = ");
9040 q.text(util.pretty_port(self.port_no))
9041 q.text(","); q.breakable()
9042 q.text("hw_addr = ");
9043 q.text(util.pretty_mac(self.hw_addr))
9044 q.text(","); q.breakable()
9045 q.text("config = ");
9046 q.text("%#x" % self.config)
9047 q.text(","); q.breakable()
9048 q.text("mask = ");
9049 q.text("%#x" % self.mask)
9050 q.text(","); q.breakable()
9051 q.text("advertise = ");
9052 q.text("%#x" % self.advertise)
9053 q.breakable()
9054 q.text('}')
9055
Rich Lane7dcdf022013-12-11 14:45:27 -08009056message.subtypes[16] = port_mod
9057
9058class port_mod_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -07009059 version = 4
9060 type = 1
9061 err_type = 7
9062
9063 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08009064 if xid != None:
9065 self.xid = xid
9066 else:
9067 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07009068 if code != None:
9069 self.code = code
9070 else:
9071 self.code = 0
9072 if data != None:
9073 self.data = data
9074 else:
9075 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08009076 return
Rich Lane6f4978c2013-10-20 21:33:52 -07009077
9078 def pack(self):
9079 packed = []
9080 packed.append(struct.pack("!B", self.version))
9081 packed.append(struct.pack("!B", self.type))
9082 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9083 packed.append(struct.pack("!L", self.xid))
9084 packed.append(struct.pack("!H", self.err_type))
9085 packed.append(struct.pack("!H", self.code))
9086 packed.append(self.data)
9087 length = sum([len(x) for x in packed])
9088 packed[2] = struct.pack("!H", length)
9089 return ''.join(packed)
9090
9091 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08009092 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07009093 obj = port_mod_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -07009094 _version = reader.read("!B")[0]
9095 assert(_version == 4)
9096 _type = reader.read("!B")[0]
9097 assert(_type == 1)
9098 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08009099 orig_reader = reader
9100 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07009101 obj.xid = reader.read("!L")[0]
9102 _err_type = reader.read("!H")[0]
9103 assert(_err_type == 7)
9104 obj.code = reader.read("!H")[0]
9105 obj.data = str(reader.read_all())
9106 return obj
9107
9108 def __eq__(self, other):
9109 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07009110 if self.xid != other.xid: return False
9111 if self.code != other.code: return False
9112 if self.data != other.data: return False
9113 return True
9114
Rich Lane6f4978c2013-10-20 21:33:52 -07009115 def pretty_print(self, q):
9116 q.text("port_mod_failed_error_msg {")
9117 with q.group():
9118 with q.indent(2):
9119 q.breakable()
9120 q.text("xid = ");
9121 if self.xid != None:
9122 q.text("%#x" % self.xid)
9123 else:
9124 q.text('None')
9125 q.text(","); q.breakable()
9126 q.text("code = ");
9127 q.text("%#x" % self.code)
9128 q.text(","); q.breakable()
9129 q.text("data = ");
9130 q.pp(self.data)
9131 q.breakable()
9132 q.text('}')
9133
Rich Lane7dcdf022013-12-11 14:45:27 -08009134error_msg.subtypes[7] = port_mod_failed_error_msg
9135
9136class port_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -07009137 version = 4
9138 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -07009139 stats_type = 4
9140
9141 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08009142 if xid != None:
9143 self.xid = xid
9144 else:
9145 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07009146 if flags != None:
9147 self.flags = flags
9148 else:
9149 self.flags = 0
9150 if entries != None:
9151 self.entries = entries
9152 else:
9153 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -08009154 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07009155
9156 def pack(self):
9157 packed = []
9158 packed.append(struct.pack("!B", self.version))
9159 packed.append(struct.pack("!B", self.type))
9160 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9161 packed.append(struct.pack("!L", self.xid))
9162 packed.append(struct.pack("!H", self.stats_type))
9163 packed.append(struct.pack("!H", self.flags))
9164 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -08009165 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -07009166 length = sum([len(x) for x in packed])
9167 packed[2] = struct.pack("!H", length)
9168 return ''.join(packed)
9169
9170 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08009171 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07009172 obj = port_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07009173 _version = reader.read("!B")[0]
9174 assert(_version == 4)
9175 _type = reader.read("!B")[0]
9176 assert(_type == 19)
9177 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08009178 orig_reader = reader
9179 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07009180 obj.xid = reader.read("!L")[0]
9181 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009182 assert(_stats_type == 4)
Dan Talaycof6202252013-07-02 01:00:29 -07009183 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009184 reader.skip(4)
9185 obj.entries = loxi.generic_util.unpack_list(reader, common.port_stats_entry.unpack)
9186 return obj
9187
9188 def __eq__(self, other):
9189 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07009190 if self.xid != other.xid: return False
9191 if self.flags != other.flags: return False
9192 if self.entries != other.entries: return False
9193 return True
9194
Rich Lanec2ee4b82013-04-24 17:12:38 -07009195 def pretty_print(self, q):
9196 q.text("port_stats_reply {")
9197 with q.group():
9198 with q.indent(2):
9199 q.breakable()
9200 q.text("xid = ");
9201 if self.xid != None:
9202 q.text("%#x" % self.xid)
9203 else:
9204 q.text('None')
9205 q.text(","); q.breakable()
9206 q.text("flags = ");
9207 q.text("%#x" % self.flags)
9208 q.text(","); q.breakable()
9209 q.text("entries = ");
9210 q.pp(self.entries)
9211 q.breakable()
9212 q.text('}')
9213
Rich Lane7dcdf022013-12-11 14:45:27 -08009214stats_reply.subtypes[4] = port_stats_reply
9215
9216class port_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -07009217 version = 4
9218 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -07009219 stats_type = 4
9220
9221 def __init__(self, xid=None, flags=None, port_no=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08009222 if xid != None:
9223 self.xid = xid
9224 else:
9225 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07009226 if flags != None:
9227 self.flags = flags
9228 else:
9229 self.flags = 0
9230 if port_no != None:
9231 self.port_no = port_no
9232 else:
9233 self.port_no = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08009234 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07009235
9236 def pack(self):
9237 packed = []
9238 packed.append(struct.pack("!B", self.version))
9239 packed.append(struct.pack("!B", self.type))
9240 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9241 packed.append(struct.pack("!L", self.xid))
9242 packed.append(struct.pack("!H", self.stats_type))
9243 packed.append(struct.pack("!H", self.flags))
9244 packed.append('\x00' * 4)
Dan Talaycof6202252013-07-02 01:00:29 -07009245 packed.append(util.pack_port_no(self.port_no))
Rich Lanec2ee4b82013-04-24 17:12:38 -07009246 packed.append('\x00' * 4)
9247 length = sum([len(x) for x in packed])
9248 packed[2] = struct.pack("!H", length)
9249 return ''.join(packed)
9250
9251 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08009252 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07009253 obj = port_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -07009254 _version = reader.read("!B")[0]
9255 assert(_version == 4)
9256 _type = reader.read("!B")[0]
9257 assert(_type == 18)
9258 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08009259 orig_reader = reader
9260 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07009261 obj.xid = reader.read("!L")[0]
9262 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009263 assert(_stats_type == 4)
Dan Talaycof6202252013-07-02 01:00:29 -07009264 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009265 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -07009266 obj.port_no = util.unpack_port_no(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -07009267 reader.skip(4)
9268 return obj
9269
9270 def __eq__(self, other):
9271 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07009272 if self.xid != other.xid: return False
9273 if self.flags != other.flags: return False
9274 if self.port_no != other.port_no: return False
9275 return True
9276
Rich Lanec2ee4b82013-04-24 17:12:38 -07009277 def pretty_print(self, q):
9278 q.text("port_stats_request {")
9279 with q.group():
9280 with q.indent(2):
9281 q.breakable()
9282 q.text("xid = ");
9283 if self.xid != None:
9284 q.text("%#x" % self.xid)
9285 else:
9286 q.text('None')
9287 q.text(","); q.breakable()
9288 q.text("flags = ");
9289 q.text("%#x" % self.flags)
9290 q.text(","); q.breakable()
9291 q.text("port_no = ");
9292 q.text(util.pretty_port(self.port_no))
9293 q.breakable()
9294 q.text('}')
9295
Rich Lane7dcdf022013-12-11 14:45:27 -08009296stats_request.subtypes[4] = port_stats_request
9297
9298class port_status(message):
Dan Talaycof6202252013-07-02 01:00:29 -07009299 version = 4
9300 type = 12
Rich Lanec2ee4b82013-04-24 17:12:38 -07009301
9302 def __init__(self, xid=None, reason=None, desc=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08009303 if xid != None:
9304 self.xid = xid
9305 else:
9306 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07009307 if reason != None:
9308 self.reason = reason
9309 else:
9310 self.reason = 0
9311 if desc != None:
9312 self.desc = desc
9313 else:
9314 self.desc = common.port_desc()
Rich Lane7dcdf022013-12-11 14:45:27 -08009315 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07009316
9317 def pack(self):
9318 packed = []
9319 packed.append(struct.pack("!B", self.version))
9320 packed.append(struct.pack("!B", self.type))
9321 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9322 packed.append(struct.pack("!L", self.xid))
9323 packed.append(struct.pack("!B", self.reason))
9324 packed.append('\x00' * 7)
9325 packed.append(self.desc.pack())
9326 length = sum([len(x) for x in packed])
9327 packed[2] = struct.pack("!H", length)
9328 return ''.join(packed)
9329
9330 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08009331 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07009332 obj = port_status()
Dan Talaycof6202252013-07-02 01:00:29 -07009333 _version = reader.read("!B")[0]
9334 assert(_version == 4)
9335 _type = reader.read("!B")[0]
9336 assert(_type == 12)
9337 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08009338 orig_reader = reader
9339 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07009340 obj.xid = reader.read("!L")[0]
9341 obj.reason = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009342 reader.skip(7)
9343 obj.desc = common.port_desc.unpack(reader)
9344 return obj
9345
9346 def __eq__(self, other):
9347 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07009348 if self.xid != other.xid: return False
9349 if self.reason != other.reason: return False
9350 if self.desc != other.desc: return False
9351 return True
9352
Rich Lanec2ee4b82013-04-24 17:12:38 -07009353 def pretty_print(self, q):
9354 q.text("port_status {")
9355 with q.group():
9356 with q.indent(2):
9357 q.breakable()
9358 q.text("xid = ");
9359 if self.xid != None:
9360 q.text("%#x" % self.xid)
9361 else:
9362 q.text('None')
9363 q.text(","); q.breakable()
9364 q.text("reason = ");
9365 q.text("%#x" % self.reason)
9366 q.text(","); q.breakable()
9367 q.text("desc = ");
9368 q.pp(self.desc)
9369 q.breakable()
9370 q.text('}')
9371
Rich Lane7dcdf022013-12-11 14:45:27 -08009372message.subtypes[12] = port_status
9373
9374class queue_get_config_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -07009375 version = 4
9376 type = 23
Rich Lanec2ee4b82013-04-24 17:12:38 -07009377
9378 def __init__(self, xid=None, port=None, queues=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08009379 if xid != None:
9380 self.xid = xid
9381 else:
9382 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07009383 if port != None:
9384 self.port = port
9385 else:
9386 self.port = 0
9387 if queues != None:
9388 self.queues = queues
9389 else:
9390 self.queues = []
Rich Lane7dcdf022013-12-11 14:45:27 -08009391 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07009392
9393 def pack(self):
9394 packed = []
9395 packed.append(struct.pack("!B", self.version))
9396 packed.append(struct.pack("!B", self.type))
9397 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9398 packed.append(struct.pack("!L", self.xid))
Dan Talaycof6202252013-07-02 01:00:29 -07009399 packed.append(util.pack_port_no(self.port))
Rich Lanec2ee4b82013-04-24 17:12:38 -07009400 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -08009401 packed.append(loxi.generic_util.pack_list(self.queues))
Rich Lanec2ee4b82013-04-24 17:12:38 -07009402 length = sum([len(x) for x in packed])
9403 packed[2] = struct.pack("!H", length)
9404 return ''.join(packed)
9405
9406 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08009407 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07009408 obj = queue_get_config_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07009409 _version = reader.read("!B")[0]
9410 assert(_version == 4)
9411 _type = reader.read("!B")[0]
9412 assert(_type == 23)
9413 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08009414 orig_reader = reader
9415 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07009416 obj.xid = reader.read("!L")[0]
9417 obj.port = util.unpack_port_no(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -07009418 reader.skip(4)
Rich Lane7dcdf022013-12-11 14:45:27 -08009419 obj.queues = loxi.generic_util.unpack_list(reader, common.packet_queue.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -07009420 return obj
9421
9422 def __eq__(self, other):
9423 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07009424 if self.xid != other.xid: return False
9425 if self.port != other.port: return False
9426 if self.queues != other.queues: return False
9427 return True
9428
Rich Lanec2ee4b82013-04-24 17:12:38 -07009429 def pretty_print(self, q):
9430 q.text("queue_get_config_reply {")
9431 with q.group():
9432 with q.indent(2):
9433 q.breakable()
9434 q.text("xid = ");
9435 if self.xid != None:
9436 q.text("%#x" % self.xid)
9437 else:
9438 q.text('None')
9439 q.text(","); q.breakable()
9440 q.text("port = ");
9441 q.text(util.pretty_port(self.port))
9442 q.text(","); q.breakable()
9443 q.text("queues = ");
9444 q.pp(self.queues)
9445 q.breakable()
9446 q.text('}')
9447
Rich Lane7dcdf022013-12-11 14:45:27 -08009448message.subtypes[23] = queue_get_config_reply
9449
9450class queue_get_config_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -07009451 version = 4
9452 type = 22
Rich Lanec2ee4b82013-04-24 17:12:38 -07009453
9454 def __init__(self, xid=None, port=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08009455 if xid != None:
9456 self.xid = xid
9457 else:
9458 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07009459 if port != None:
9460 self.port = port
9461 else:
9462 self.port = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08009463 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07009464
9465 def pack(self):
9466 packed = []
9467 packed.append(struct.pack("!B", self.version))
9468 packed.append(struct.pack("!B", self.type))
9469 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9470 packed.append(struct.pack("!L", self.xid))
Dan Talaycof6202252013-07-02 01:00:29 -07009471 packed.append(util.pack_port_no(self.port))
Rich Lanec2ee4b82013-04-24 17:12:38 -07009472 packed.append('\x00' * 4)
9473 length = sum([len(x) for x in packed])
9474 packed[2] = struct.pack("!H", length)
9475 return ''.join(packed)
9476
9477 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08009478 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07009479 obj = queue_get_config_request()
Dan Talaycof6202252013-07-02 01:00:29 -07009480 _version = reader.read("!B")[0]
9481 assert(_version == 4)
9482 _type = reader.read("!B")[0]
9483 assert(_type == 22)
9484 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08009485 orig_reader = reader
9486 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07009487 obj.xid = reader.read("!L")[0]
9488 obj.port = util.unpack_port_no(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -07009489 reader.skip(4)
9490 return obj
9491
9492 def __eq__(self, other):
9493 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07009494 if self.xid != other.xid: return False
9495 if self.port != other.port: return False
9496 return True
9497
Rich Lanec2ee4b82013-04-24 17:12:38 -07009498 def pretty_print(self, q):
9499 q.text("queue_get_config_request {")
9500 with q.group():
9501 with q.indent(2):
9502 q.breakable()
9503 q.text("xid = ");
9504 if self.xid != None:
9505 q.text("%#x" % self.xid)
9506 else:
9507 q.text('None')
9508 q.text(","); q.breakable()
9509 q.text("port = ");
9510 q.text(util.pretty_port(self.port))
9511 q.breakable()
9512 q.text('}')
9513
Rich Lane7dcdf022013-12-11 14:45:27 -08009514message.subtypes[22] = queue_get_config_request
9515
9516class queue_op_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -07009517 version = 4
9518 type = 1
9519 err_type = 9
9520
9521 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08009522 if xid != None:
9523 self.xid = xid
9524 else:
9525 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07009526 if code != None:
9527 self.code = code
9528 else:
9529 self.code = 0
9530 if data != None:
9531 self.data = data
9532 else:
9533 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08009534 return
Rich Lane6f4978c2013-10-20 21:33:52 -07009535
9536 def pack(self):
9537 packed = []
9538 packed.append(struct.pack("!B", self.version))
9539 packed.append(struct.pack("!B", self.type))
9540 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9541 packed.append(struct.pack("!L", self.xid))
9542 packed.append(struct.pack("!H", self.err_type))
9543 packed.append(struct.pack("!H", self.code))
9544 packed.append(self.data)
9545 length = sum([len(x) for x in packed])
9546 packed[2] = struct.pack("!H", length)
9547 return ''.join(packed)
9548
9549 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08009550 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07009551 obj = queue_op_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -07009552 _version = reader.read("!B")[0]
9553 assert(_version == 4)
9554 _type = reader.read("!B")[0]
9555 assert(_type == 1)
9556 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08009557 orig_reader = reader
9558 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07009559 obj.xid = reader.read("!L")[0]
9560 _err_type = reader.read("!H")[0]
9561 assert(_err_type == 9)
9562 obj.code = reader.read("!H")[0]
9563 obj.data = str(reader.read_all())
9564 return obj
9565
9566 def __eq__(self, other):
9567 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07009568 if self.xid != other.xid: return False
9569 if self.code != other.code: return False
9570 if self.data != other.data: return False
9571 return True
9572
Rich Lane6f4978c2013-10-20 21:33:52 -07009573 def pretty_print(self, q):
9574 q.text("queue_op_failed_error_msg {")
9575 with q.group():
9576 with q.indent(2):
9577 q.breakable()
9578 q.text("xid = ");
9579 if self.xid != None:
9580 q.text("%#x" % self.xid)
9581 else:
9582 q.text('None')
9583 q.text(","); q.breakable()
9584 q.text("code = ");
9585 q.text("%#x" % self.code)
9586 q.text(","); q.breakable()
9587 q.text("data = ");
9588 q.pp(self.data)
9589 q.breakable()
9590 q.text('}')
9591
Rich Lane7dcdf022013-12-11 14:45:27 -08009592error_msg.subtypes[9] = queue_op_failed_error_msg
9593
9594class queue_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -07009595 version = 4
9596 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -07009597 stats_type = 5
9598
9599 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08009600 if xid != None:
9601 self.xid = xid
9602 else:
9603 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07009604 if flags != None:
9605 self.flags = flags
9606 else:
9607 self.flags = 0
9608 if entries != None:
9609 self.entries = entries
9610 else:
9611 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -08009612 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07009613
9614 def pack(self):
9615 packed = []
9616 packed.append(struct.pack("!B", self.version))
9617 packed.append(struct.pack("!B", self.type))
9618 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9619 packed.append(struct.pack("!L", self.xid))
9620 packed.append(struct.pack("!H", self.stats_type))
9621 packed.append(struct.pack("!H", self.flags))
9622 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -08009623 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -07009624 length = sum([len(x) for x in packed])
9625 packed[2] = struct.pack("!H", length)
9626 return ''.join(packed)
9627
9628 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08009629 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07009630 obj = queue_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07009631 _version = reader.read("!B")[0]
9632 assert(_version == 4)
9633 _type = reader.read("!B")[0]
9634 assert(_type == 19)
9635 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08009636 orig_reader = reader
9637 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07009638 obj.xid = reader.read("!L")[0]
9639 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009640 assert(_stats_type == 5)
Dan Talaycof6202252013-07-02 01:00:29 -07009641 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009642 reader.skip(4)
9643 obj.entries = loxi.generic_util.unpack_list(reader, common.queue_stats_entry.unpack)
9644 return obj
9645
9646 def __eq__(self, other):
9647 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07009648 if self.xid != other.xid: return False
9649 if self.flags != other.flags: return False
9650 if self.entries != other.entries: return False
9651 return True
9652
Rich Lanec2ee4b82013-04-24 17:12:38 -07009653 def pretty_print(self, q):
9654 q.text("queue_stats_reply {")
9655 with q.group():
9656 with q.indent(2):
9657 q.breakable()
9658 q.text("xid = ");
9659 if self.xid != None:
9660 q.text("%#x" % self.xid)
9661 else:
9662 q.text('None')
9663 q.text(","); q.breakable()
9664 q.text("flags = ");
9665 q.text("%#x" % self.flags)
9666 q.text(","); q.breakable()
9667 q.text("entries = ");
9668 q.pp(self.entries)
9669 q.breakable()
9670 q.text('}')
9671
Rich Lane7dcdf022013-12-11 14:45:27 -08009672stats_reply.subtypes[5] = queue_stats_reply
9673
9674class queue_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -07009675 version = 4
9676 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -07009677 stats_type = 5
9678
9679 def __init__(self, xid=None, flags=None, port_no=None, queue_id=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08009680 if xid != None:
9681 self.xid = xid
9682 else:
9683 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07009684 if flags != None:
9685 self.flags = flags
9686 else:
9687 self.flags = 0
9688 if port_no != None:
9689 self.port_no = port_no
9690 else:
9691 self.port_no = 0
9692 if queue_id != None:
9693 self.queue_id = queue_id
9694 else:
9695 self.queue_id = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08009696 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07009697
9698 def pack(self):
9699 packed = []
9700 packed.append(struct.pack("!B", self.version))
9701 packed.append(struct.pack("!B", self.type))
9702 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9703 packed.append(struct.pack("!L", self.xid))
9704 packed.append(struct.pack("!H", self.stats_type))
9705 packed.append(struct.pack("!H", self.flags))
9706 packed.append('\x00' * 4)
Dan Talaycof6202252013-07-02 01:00:29 -07009707 packed.append(util.pack_port_no(self.port_no))
Rich Lanec2ee4b82013-04-24 17:12:38 -07009708 packed.append(struct.pack("!L", self.queue_id))
9709 length = sum([len(x) for x in packed])
9710 packed[2] = struct.pack("!H", length)
9711 return ''.join(packed)
9712
9713 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08009714 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07009715 obj = queue_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -07009716 _version = reader.read("!B")[0]
9717 assert(_version == 4)
9718 _type = reader.read("!B")[0]
9719 assert(_type == 18)
9720 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08009721 orig_reader = reader
9722 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07009723 obj.xid = reader.read("!L")[0]
9724 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009725 assert(_stats_type == 5)
Dan Talaycof6202252013-07-02 01:00:29 -07009726 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009727 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -07009728 obj.port_no = util.unpack_port_no(reader)
9729 obj.queue_id = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009730 return obj
9731
9732 def __eq__(self, other):
9733 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07009734 if self.xid != other.xid: return False
9735 if self.flags != other.flags: return False
9736 if self.port_no != other.port_no: return False
9737 if self.queue_id != other.queue_id: return False
9738 return True
9739
Rich Lanec2ee4b82013-04-24 17:12:38 -07009740 def pretty_print(self, q):
9741 q.text("queue_stats_request {")
9742 with q.group():
9743 with q.indent(2):
9744 q.breakable()
9745 q.text("xid = ");
9746 if self.xid != None:
9747 q.text("%#x" % self.xid)
9748 else:
9749 q.text('None')
9750 q.text(","); q.breakable()
9751 q.text("flags = ");
9752 q.text("%#x" % self.flags)
9753 q.text(","); q.breakable()
9754 q.text("port_no = ");
9755 q.text(util.pretty_port(self.port_no))
9756 q.text(","); q.breakable()
9757 q.text("queue_id = ");
9758 q.text("%#x" % self.queue_id)
9759 q.breakable()
9760 q.text('}')
9761
Rich Lane7dcdf022013-12-11 14:45:27 -08009762stats_request.subtypes[5] = queue_stats_request
9763
9764class role_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -07009765 version = 4
9766 type = 25
Rich Lanec2ee4b82013-04-24 17:12:38 -07009767
Rich Laned9e3f7b2013-11-04 11:40:43 -08009768 def __init__(self, xid=None, role=None, generation_id=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08009769 if xid != None:
9770 self.xid = xid
9771 else:
9772 self.xid = None
Rich Laned9e3f7b2013-11-04 11:40:43 -08009773 if role != None:
9774 self.role = role
Rich Lanec2ee4b82013-04-24 17:12:38 -07009775 else:
Rich Laned9e3f7b2013-11-04 11:40:43 -08009776 self.role = 0
9777 if generation_id != None:
9778 self.generation_id = generation_id
9779 else:
9780 self.generation_id = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08009781 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07009782
9783 def pack(self):
9784 packed = []
9785 packed.append(struct.pack("!B", self.version))
9786 packed.append(struct.pack("!B", self.type))
9787 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9788 packed.append(struct.pack("!L", self.xid))
Rich Laned9e3f7b2013-11-04 11:40:43 -08009789 packed.append(struct.pack("!L", self.role))
9790 packed.append('\x00' * 4)
9791 packed.append(struct.pack("!Q", self.generation_id))
Rich Lanec2ee4b82013-04-24 17:12:38 -07009792 length = sum([len(x) for x in packed])
9793 packed[2] = struct.pack("!H", length)
9794 return ''.join(packed)
9795
9796 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08009797 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07009798 obj = role_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07009799 _version = reader.read("!B")[0]
9800 assert(_version == 4)
9801 _type = reader.read("!B")[0]
9802 assert(_type == 25)
9803 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08009804 orig_reader = reader
9805 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07009806 obj.xid = reader.read("!L")[0]
Rich Laned9e3f7b2013-11-04 11:40:43 -08009807 obj.role = reader.read("!L")[0]
9808 reader.skip(4)
9809 obj.generation_id = reader.read("!Q")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009810 return obj
9811
9812 def __eq__(self, other):
9813 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07009814 if self.xid != other.xid: return False
Rich Laned9e3f7b2013-11-04 11:40:43 -08009815 if self.role != other.role: return False
9816 if self.generation_id != other.generation_id: return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07009817 return True
9818
Rich Lanec2ee4b82013-04-24 17:12:38 -07009819 def pretty_print(self, q):
9820 q.text("role_reply {")
9821 with q.group():
9822 with q.indent(2):
9823 q.breakable()
9824 q.text("xid = ");
9825 if self.xid != None:
9826 q.text("%#x" % self.xid)
9827 else:
9828 q.text('None')
9829 q.text(","); q.breakable()
Rich Laned9e3f7b2013-11-04 11:40:43 -08009830 q.text("role = ");
9831 q.text("%#x" % self.role)
9832 q.text(","); q.breakable()
9833 q.text("generation_id = ");
9834 q.text("%#x" % self.generation_id)
Rich Lanec2ee4b82013-04-24 17:12:38 -07009835 q.breakable()
9836 q.text('}')
9837
Rich Lane7dcdf022013-12-11 14:45:27 -08009838message.subtypes[25] = role_reply
9839
9840class role_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -07009841 version = 4
9842 type = 24
Rich Lanec2ee4b82013-04-24 17:12:38 -07009843
9844 def __init__(self, xid=None, role=None, generation_id=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08009845 if xid != None:
9846 self.xid = xid
9847 else:
9848 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07009849 if role != None:
9850 self.role = role
9851 else:
9852 self.role = 0
9853 if generation_id != None:
9854 self.generation_id = generation_id
9855 else:
9856 self.generation_id = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08009857 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07009858
9859 def pack(self):
9860 packed = []
9861 packed.append(struct.pack("!B", self.version))
9862 packed.append(struct.pack("!B", self.type))
9863 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9864 packed.append(struct.pack("!L", self.xid))
9865 packed.append(struct.pack("!L", self.role))
9866 packed.append('\x00' * 4)
9867 packed.append(struct.pack("!Q", self.generation_id))
9868 length = sum([len(x) for x in packed])
9869 packed[2] = struct.pack("!H", length)
9870 return ''.join(packed)
9871
9872 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08009873 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07009874 obj = role_request()
Dan Talaycof6202252013-07-02 01:00:29 -07009875 _version = reader.read("!B")[0]
9876 assert(_version == 4)
9877 _type = reader.read("!B")[0]
9878 assert(_type == 24)
9879 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08009880 orig_reader = reader
9881 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07009882 obj.xid = reader.read("!L")[0]
9883 obj.role = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009884 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -07009885 obj.generation_id = reader.read("!Q")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009886 return obj
9887
9888 def __eq__(self, other):
9889 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07009890 if self.xid != other.xid: return False
9891 if self.role != other.role: return False
9892 if self.generation_id != other.generation_id: return False
9893 return True
9894
Rich Lanec2ee4b82013-04-24 17:12:38 -07009895 def pretty_print(self, q):
9896 q.text("role_request {")
9897 with q.group():
9898 with q.indent(2):
9899 q.breakable()
9900 q.text("xid = ");
9901 if self.xid != None:
9902 q.text("%#x" % self.xid)
9903 else:
9904 q.text('None')
9905 q.text(","); q.breakable()
9906 q.text("role = ");
9907 q.text("%#x" % self.role)
9908 q.text(","); q.breakable()
9909 q.text("generation_id = ");
9910 q.text("%#x" % self.generation_id)
9911 q.breakable()
9912 q.text('}')
9913
Rich Lane7dcdf022013-12-11 14:45:27 -08009914message.subtypes[24] = role_request
9915
9916class role_request_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -07009917 version = 4
9918 type = 1
9919 err_type = 11
9920
9921 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08009922 if xid != None:
9923 self.xid = xid
9924 else:
9925 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07009926 if code != None:
9927 self.code = code
9928 else:
9929 self.code = 0
9930 if data != None:
9931 self.data = data
9932 else:
9933 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08009934 return
Rich Lane6f4978c2013-10-20 21:33:52 -07009935
9936 def pack(self):
9937 packed = []
9938 packed.append(struct.pack("!B", self.version))
9939 packed.append(struct.pack("!B", self.type))
9940 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9941 packed.append(struct.pack("!L", self.xid))
9942 packed.append(struct.pack("!H", self.err_type))
9943 packed.append(struct.pack("!H", self.code))
9944 packed.append(self.data)
9945 length = sum([len(x) for x in packed])
9946 packed[2] = struct.pack("!H", length)
9947 return ''.join(packed)
9948
9949 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08009950 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07009951 obj = role_request_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -07009952 _version = reader.read("!B")[0]
9953 assert(_version == 4)
9954 _type = reader.read("!B")[0]
9955 assert(_type == 1)
9956 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08009957 orig_reader = reader
9958 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07009959 obj.xid = reader.read("!L")[0]
9960 _err_type = reader.read("!H")[0]
9961 assert(_err_type == 11)
9962 obj.code = reader.read("!H")[0]
9963 obj.data = str(reader.read_all())
9964 return obj
9965
9966 def __eq__(self, other):
9967 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07009968 if self.xid != other.xid: return False
9969 if self.code != other.code: return False
9970 if self.data != other.data: return False
9971 return True
9972
Rich Lane6f4978c2013-10-20 21:33:52 -07009973 def pretty_print(self, q):
9974 q.text("role_request_failed_error_msg {")
9975 with q.group():
9976 with q.indent(2):
9977 q.breakable()
9978 q.text("xid = ");
9979 if self.xid != None:
9980 q.text("%#x" % self.xid)
9981 else:
9982 q.text('None')
9983 q.text(","); q.breakable()
9984 q.text("code = ");
9985 q.text("%#x" % self.code)
9986 q.text(","); q.breakable()
9987 q.text("data = ");
9988 q.pp(self.data)
9989 q.breakable()
9990 q.text('}')
9991
Rich Lane7dcdf022013-12-11 14:45:27 -08009992error_msg.subtypes[11] = role_request_failed_error_msg
9993
9994class set_config(message):
Dan Talaycof6202252013-07-02 01:00:29 -07009995 version = 4
9996 type = 9
Rich Lanec2ee4b82013-04-24 17:12:38 -07009997
9998 def __init__(self, xid=None, flags=None, miss_send_len=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08009999 if xid != None:
10000 self.xid = xid
10001 else:
10002 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070010003 if flags != None:
10004 self.flags = flags
10005 else:
10006 self.flags = 0
10007 if miss_send_len != None:
10008 self.miss_send_len = miss_send_len
10009 else:
10010 self.miss_send_len = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080010011 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070010012
10013 def pack(self):
10014 packed = []
10015 packed.append(struct.pack("!B", self.version))
10016 packed.append(struct.pack("!B", self.type))
10017 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10018 packed.append(struct.pack("!L", self.xid))
10019 packed.append(struct.pack("!H", self.flags))
10020 packed.append(struct.pack("!H", self.miss_send_len))
10021 length = sum([len(x) for x in packed])
10022 packed[2] = struct.pack("!H", length)
10023 return ''.join(packed)
10024
10025 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080010026 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070010027 obj = set_config()
Dan Talaycof6202252013-07-02 01:00:29 -070010028 _version = reader.read("!B")[0]
10029 assert(_version == 4)
10030 _type = reader.read("!B")[0]
10031 assert(_type == 9)
10032 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080010033 orig_reader = reader
10034 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070010035 obj.xid = reader.read("!L")[0]
10036 obj.flags = reader.read("!H")[0]
10037 obj.miss_send_len = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010038 return obj
10039
10040 def __eq__(self, other):
10041 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070010042 if self.xid != other.xid: return False
10043 if self.flags != other.flags: return False
10044 if self.miss_send_len != other.miss_send_len: return False
10045 return True
10046
Rich Lanec2ee4b82013-04-24 17:12:38 -070010047 def pretty_print(self, q):
10048 q.text("set_config {")
10049 with q.group():
10050 with q.indent(2):
10051 q.breakable()
10052 q.text("xid = ");
10053 if self.xid != None:
10054 q.text("%#x" % self.xid)
10055 else:
10056 q.text('None')
10057 q.text(","); q.breakable()
10058 q.text("flags = ");
10059 q.text("%#x" % self.flags)
10060 q.text(","); q.breakable()
10061 q.text("miss_send_len = ");
10062 q.text("%#x" % self.miss_send_len)
10063 q.breakable()
10064 q.text('}')
10065
Rich Lane7dcdf022013-12-11 14:45:27 -080010066message.subtypes[9] = set_config
10067
10068class switch_config_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -070010069 version = 4
10070 type = 1
10071 err_type = 10
10072
10073 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080010074 if xid != None:
10075 self.xid = xid
10076 else:
10077 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -070010078 if code != None:
10079 self.code = code
10080 else:
10081 self.code = 0
10082 if data != None:
10083 self.data = data
10084 else:
10085 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080010086 return
Rich Lane6f4978c2013-10-20 21:33:52 -070010087
10088 def pack(self):
10089 packed = []
10090 packed.append(struct.pack("!B", self.version))
10091 packed.append(struct.pack("!B", self.type))
10092 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10093 packed.append(struct.pack("!L", self.xid))
10094 packed.append(struct.pack("!H", self.err_type))
10095 packed.append(struct.pack("!H", self.code))
10096 packed.append(self.data)
10097 length = sum([len(x) for x in packed])
10098 packed[2] = struct.pack("!H", length)
10099 return ''.join(packed)
10100
10101 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080010102 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -070010103 obj = switch_config_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -070010104 _version = reader.read("!B")[0]
10105 assert(_version == 4)
10106 _type = reader.read("!B")[0]
10107 assert(_type == 1)
10108 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080010109 orig_reader = reader
10110 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -070010111 obj.xid = reader.read("!L")[0]
10112 _err_type = reader.read("!H")[0]
10113 assert(_err_type == 10)
10114 obj.code = reader.read("!H")[0]
10115 obj.data = str(reader.read_all())
10116 return obj
10117
10118 def __eq__(self, other):
10119 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -070010120 if self.xid != other.xid: return False
10121 if self.code != other.code: return False
10122 if self.data != other.data: return False
10123 return True
10124
Rich Lane6f4978c2013-10-20 21:33:52 -070010125 def pretty_print(self, q):
10126 q.text("switch_config_failed_error_msg {")
10127 with q.group():
10128 with q.indent(2):
10129 q.breakable()
10130 q.text("xid = ");
10131 if self.xid != None:
10132 q.text("%#x" % self.xid)
10133 else:
10134 q.text('None')
10135 q.text(","); q.breakable()
10136 q.text("code = ");
10137 q.text("%#x" % self.code)
10138 q.text(","); q.breakable()
10139 q.text("data = ");
10140 q.pp(self.data)
10141 q.breakable()
10142 q.text('}')
10143
Rich Lane7dcdf022013-12-11 14:45:27 -080010144error_msg.subtypes[10] = switch_config_failed_error_msg
10145
10146class table_features_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -070010147 version = 4
10148 type = 1
10149 err_type = 13
10150
10151 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080010152 if xid != None:
10153 self.xid = xid
10154 else:
10155 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -070010156 if code != None:
10157 self.code = code
10158 else:
10159 self.code = 0
10160 if data != None:
10161 self.data = data
10162 else:
10163 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080010164 return
Rich Lane6f4978c2013-10-20 21:33:52 -070010165
10166 def pack(self):
10167 packed = []
10168 packed.append(struct.pack("!B", self.version))
10169 packed.append(struct.pack("!B", self.type))
10170 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10171 packed.append(struct.pack("!L", self.xid))
10172 packed.append(struct.pack("!H", self.err_type))
10173 packed.append(struct.pack("!H", self.code))
10174 packed.append(self.data)
10175 length = sum([len(x) for x in packed])
10176 packed[2] = struct.pack("!H", length)
10177 return ''.join(packed)
10178
10179 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080010180 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -070010181 obj = table_features_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -070010182 _version = reader.read("!B")[0]
10183 assert(_version == 4)
10184 _type = reader.read("!B")[0]
10185 assert(_type == 1)
10186 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080010187 orig_reader = reader
10188 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -070010189 obj.xid = reader.read("!L")[0]
10190 _err_type = reader.read("!H")[0]
10191 assert(_err_type == 13)
10192 obj.code = reader.read("!H")[0]
10193 obj.data = str(reader.read_all())
10194 return obj
10195
10196 def __eq__(self, other):
10197 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -070010198 if self.xid != other.xid: return False
10199 if self.code != other.code: return False
10200 if self.data != other.data: return False
10201 return True
10202
Rich Lane6f4978c2013-10-20 21:33:52 -070010203 def pretty_print(self, q):
10204 q.text("table_features_failed_error_msg {")
10205 with q.group():
10206 with q.indent(2):
10207 q.breakable()
10208 q.text("xid = ");
10209 if self.xid != None:
10210 q.text("%#x" % self.xid)
10211 else:
10212 q.text('None')
10213 q.text(","); q.breakable()
10214 q.text("code = ");
10215 q.text("%#x" % self.code)
10216 q.text(","); q.breakable()
10217 q.text("data = ");
10218 q.pp(self.data)
10219 q.breakable()
10220 q.text('}')
10221
Rich Lane7dcdf022013-12-11 14:45:27 -080010222error_msg.subtypes[13] = table_features_failed_error_msg
10223
10224class table_features_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070010225 version = 4
10226 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070010227 stats_type = 12
10228
10229 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080010230 if xid != None:
10231 self.xid = xid
10232 else:
10233 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070010234 if flags != None:
10235 self.flags = flags
10236 else:
10237 self.flags = 0
10238 if entries != None:
10239 self.entries = entries
10240 else:
10241 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -080010242 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070010243
10244 def pack(self):
10245 packed = []
10246 packed.append(struct.pack("!B", self.version))
10247 packed.append(struct.pack("!B", self.type))
10248 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10249 packed.append(struct.pack("!L", self.xid))
10250 packed.append(struct.pack("!H", self.stats_type))
10251 packed.append(struct.pack("!H", self.flags))
10252 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080010253 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -070010254 length = sum([len(x) for x in packed])
10255 packed[2] = struct.pack("!H", length)
10256 return ''.join(packed)
10257
10258 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080010259 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070010260 obj = table_features_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070010261 _version = reader.read("!B")[0]
10262 assert(_version == 4)
10263 _type = reader.read("!B")[0]
10264 assert(_type == 19)
10265 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080010266 orig_reader = reader
10267 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070010268 obj.xid = reader.read("!L")[0]
10269 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010270 assert(_stats_type == 12)
Dan Talaycof6202252013-07-02 01:00:29 -070010271 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010272 reader.skip(4)
Rich Lane7dcdf022013-12-11 14:45:27 -080010273 obj.entries = loxi.generic_util.unpack_list(reader, common.table_features.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070010274 return obj
10275
10276 def __eq__(self, other):
10277 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070010278 if self.xid != other.xid: return False
10279 if self.flags != other.flags: return False
10280 if self.entries != other.entries: return False
10281 return True
10282
Rich Lanec2ee4b82013-04-24 17:12:38 -070010283 def pretty_print(self, q):
10284 q.text("table_features_stats_reply {")
10285 with q.group():
10286 with q.indent(2):
10287 q.breakable()
10288 q.text("xid = ");
10289 if self.xid != None:
10290 q.text("%#x" % self.xid)
10291 else:
10292 q.text('None')
10293 q.text(","); q.breakable()
10294 q.text("flags = ");
10295 q.text("%#x" % self.flags)
10296 q.text(","); q.breakable()
10297 q.text("entries = ");
10298 q.pp(self.entries)
10299 q.breakable()
10300 q.text('}')
10301
Rich Lane7dcdf022013-12-11 14:45:27 -080010302stats_reply.subtypes[12] = table_features_stats_reply
10303
10304class table_features_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070010305 version = 4
10306 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070010307 stats_type = 12
10308
10309 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080010310 if xid != None:
10311 self.xid = xid
10312 else:
10313 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070010314 if flags != None:
10315 self.flags = flags
10316 else:
10317 self.flags = 0
10318 if entries != None:
10319 self.entries = entries
10320 else:
10321 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -080010322 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070010323
10324 def pack(self):
10325 packed = []
10326 packed.append(struct.pack("!B", self.version))
10327 packed.append(struct.pack("!B", self.type))
10328 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10329 packed.append(struct.pack("!L", self.xid))
10330 packed.append(struct.pack("!H", self.stats_type))
10331 packed.append(struct.pack("!H", self.flags))
10332 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080010333 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -070010334 length = sum([len(x) for x in packed])
10335 packed[2] = struct.pack("!H", length)
10336 return ''.join(packed)
10337
10338 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080010339 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070010340 obj = table_features_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070010341 _version = reader.read("!B")[0]
10342 assert(_version == 4)
10343 _type = reader.read("!B")[0]
10344 assert(_type == 18)
10345 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080010346 orig_reader = reader
10347 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070010348 obj.xid = reader.read("!L")[0]
10349 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010350 assert(_stats_type == 12)
Dan Talaycof6202252013-07-02 01:00:29 -070010351 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010352 reader.skip(4)
Rich Lane7dcdf022013-12-11 14:45:27 -080010353 obj.entries = loxi.generic_util.unpack_list(reader, common.table_features.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070010354 return obj
10355
10356 def __eq__(self, other):
10357 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070010358 if self.xid != other.xid: return False
10359 if self.flags != other.flags: return False
10360 if self.entries != other.entries: return False
10361 return True
10362
Rich Lanec2ee4b82013-04-24 17:12:38 -070010363 def pretty_print(self, q):
10364 q.text("table_features_stats_request {")
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("flags = ");
10375 q.text("%#x" % self.flags)
10376 q.text(","); q.breakable()
10377 q.text("entries = ");
10378 q.pp(self.entries)
10379 q.breakable()
10380 q.text('}')
10381
Rich Lane7dcdf022013-12-11 14:45:27 -080010382stats_request.subtypes[12] = table_features_stats_request
10383
10384class table_mod(message):
Dan Talaycof6202252013-07-02 01:00:29 -070010385 version = 4
10386 type = 17
Rich Lanec2ee4b82013-04-24 17:12:38 -070010387
10388 def __init__(self, xid=None, table_id=None, config=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080010389 if xid != None:
10390 self.xid = xid
10391 else:
10392 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070010393 if table_id != None:
10394 self.table_id = table_id
10395 else:
10396 self.table_id = 0
10397 if config != None:
10398 self.config = config
10399 else:
10400 self.config = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080010401 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070010402
10403 def pack(self):
10404 packed = []
10405 packed.append(struct.pack("!B", self.version))
10406 packed.append(struct.pack("!B", self.type))
10407 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10408 packed.append(struct.pack("!L", self.xid))
10409 packed.append(struct.pack("!B", self.table_id))
10410 packed.append('\x00' * 3)
10411 packed.append(struct.pack("!L", self.config))
10412 length = sum([len(x) for x in packed])
10413 packed[2] = struct.pack("!H", length)
10414 return ''.join(packed)
10415
10416 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080010417 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070010418 obj = table_mod()
Dan Talaycof6202252013-07-02 01:00:29 -070010419 _version = reader.read("!B")[0]
10420 assert(_version == 4)
10421 _type = reader.read("!B")[0]
10422 assert(_type == 17)
10423 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080010424 orig_reader = reader
10425 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070010426 obj.xid = reader.read("!L")[0]
10427 obj.table_id = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010428 reader.skip(3)
Dan Talaycof6202252013-07-02 01:00:29 -070010429 obj.config = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010430 return obj
10431
10432 def __eq__(self, other):
10433 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070010434 if self.xid != other.xid: return False
10435 if self.table_id != other.table_id: return False
10436 if self.config != other.config: return False
10437 return True
10438
Rich Lanec2ee4b82013-04-24 17:12:38 -070010439 def pretty_print(self, q):
10440 q.text("table_mod {")
10441 with q.group():
10442 with q.indent(2):
10443 q.breakable()
10444 q.text("xid = ");
10445 if self.xid != None:
10446 q.text("%#x" % self.xid)
10447 else:
10448 q.text('None')
10449 q.text(","); q.breakable()
10450 q.text("table_id = ");
10451 q.text("%#x" % self.table_id)
10452 q.text(","); q.breakable()
10453 q.text("config = ");
10454 q.text("%#x" % self.config)
10455 q.breakable()
10456 q.text('}')
10457
Rich Lane7dcdf022013-12-11 14:45:27 -080010458message.subtypes[17] = table_mod
10459
10460class table_mod_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -070010461 version = 4
10462 type = 1
10463 err_type = 8
10464
10465 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080010466 if xid != None:
10467 self.xid = xid
10468 else:
10469 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -070010470 if code != None:
10471 self.code = code
10472 else:
10473 self.code = 0
10474 if data != None:
10475 self.data = data
10476 else:
10477 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080010478 return
Rich Lane6f4978c2013-10-20 21:33:52 -070010479
10480 def pack(self):
10481 packed = []
10482 packed.append(struct.pack("!B", self.version))
10483 packed.append(struct.pack("!B", self.type))
10484 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10485 packed.append(struct.pack("!L", self.xid))
10486 packed.append(struct.pack("!H", self.err_type))
10487 packed.append(struct.pack("!H", self.code))
10488 packed.append(self.data)
10489 length = sum([len(x) for x in packed])
10490 packed[2] = struct.pack("!H", length)
10491 return ''.join(packed)
10492
10493 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080010494 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -070010495 obj = table_mod_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -070010496 _version = reader.read("!B")[0]
10497 assert(_version == 4)
10498 _type = reader.read("!B")[0]
10499 assert(_type == 1)
10500 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080010501 orig_reader = reader
10502 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -070010503 obj.xid = reader.read("!L")[0]
10504 _err_type = reader.read("!H")[0]
10505 assert(_err_type == 8)
10506 obj.code = reader.read("!H")[0]
10507 obj.data = str(reader.read_all())
10508 return obj
10509
10510 def __eq__(self, other):
10511 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -070010512 if self.xid != other.xid: return False
10513 if self.code != other.code: return False
10514 if self.data != other.data: return False
10515 return True
10516
Rich Lane6f4978c2013-10-20 21:33:52 -070010517 def pretty_print(self, q):
10518 q.text("table_mod_failed_error_msg {")
10519 with q.group():
10520 with q.indent(2):
10521 q.breakable()
10522 q.text("xid = ");
10523 if self.xid != None:
10524 q.text("%#x" % self.xid)
10525 else:
10526 q.text('None')
10527 q.text(","); q.breakable()
10528 q.text("code = ");
10529 q.text("%#x" % self.code)
10530 q.text(","); q.breakable()
10531 q.text("data = ");
10532 q.pp(self.data)
10533 q.breakable()
10534 q.text('}')
10535
Rich Lane7dcdf022013-12-11 14:45:27 -080010536error_msg.subtypes[8] = table_mod_failed_error_msg
10537
10538class table_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070010539 version = 4
10540 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070010541 stats_type = 3
10542
10543 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080010544 if xid != None:
10545 self.xid = xid
10546 else:
10547 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070010548 if flags != None:
10549 self.flags = flags
10550 else:
10551 self.flags = 0
10552 if entries != None:
10553 self.entries = entries
10554 else:
10555 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -080010556 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070010557
10558 def pack(self):
10559 packed = []
10560 packed.append(struct.pack("!B", self.version))
10561 packed.append(struct.pack("!B", self.type))
10562 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10563 packed.append(struct.pack("!L", self.xid))
10564 packed.append(struct.pack("!H", self.stats_type))
10565 packed.append(struct.pack("!H", self.flags))
10566 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080010567 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -070010568 length = sum([len(x) for x in packed])
10569 packed[2] = struct.pack("!H", length)
10570 return ''.join(packed)
10571
10572 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080010573 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070010574 obj = table_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070010575 _version = reader.read("!B")[0]
10576 assert(_version == 4)
10577 _type = reader.read("!B")[0]
10578 assert(_type == 19)
10579 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080010580 orig_reader = reader
10581 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070010582 obj.xid = reader.read("!L")[0]
10583 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010584 assert(_stats_type == 3)
Dan Talaycof6202252013-07-02 01:00:29 -070010585 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010586 reader.skip(4)
10587 obj.entries = loxi.generic_util.unpack_list(reader, common.table_stats_entry.unpack)
10588 return obj
10589
10590 def __eq__(self, other):
10591 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070010592 if self.xid != other.xid: return False
10593 if self.flags != other.flags: return False
10594 if self.entries != other.entries: return False
10595 return True
10596
Rich Lanec2ee4b82013-04-24 17:12:38 -070010597 def pretty_print(self, q):
10598 q.text("table_stats_reply {")
10599 with q.group():
10600 with q.indent(2):
10601 q.breakable()
10602 q.text("xid = ");
10603 if self.xid != None:
10604 q.text("%#x" % self.xid)
10605 else:
10606 q.text('None')
10607 q.text(","); q.breakable()
10608 q.text("flags = ");
10609 q.text("%#x" % self.flags)
10610 q.text(","); q.breakable()
10611 q.text("entries = ");
10612 q.pp(self.entries)
10613 q.breakable()
10614 q.text('}')
10615
Rich Lane7dcdf022013-12-11 14:45:27 -080010616stats_reply.subtypes[3] = table_stats_reply
10617
10618class table_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070010619 version = 4
10620 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070010621 stats_type = 3
10622
10623 def __init__(self, xid=None, flags=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080010624 if xid != None:
10625 self.xid = xid
10626 else:
10627 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070010628 if flags != None:
10629 self.flags = flags
10630 else:
10631 self.flags = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080010632 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070010633
10634 def pack(self):
10635 packed = []
10636 packed.append(struct.pack("!B", self.version))
10637 packed.append(struct.pack("!B", self.type))
10638 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10639 packed.append(struct.pack("!L", self.xid))
10640 packed.append(struct.pack("!H", self.stats_type))
10641 packed.append(struct.pack("!H", self.flags))
10642 packed.append('\x00' * 4)
10643 length = sum([len(x) for x in packed])
10644 packed[2] = struct.pack("!H", length)
10645 return ''.join(packed)
10646
10647 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080010648 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070010649 obj = table_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070010650 _version = reader.read("!B")[0]
10651 assert(_version == 4)
10652 _type = reader.read("!B")[0]
10653 assert(_type == 18)
10654 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080010655 orig_reader = reader
10656 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070010657 obj.xid = reader.read("!L")[0]
10658 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010659 assert(_stats_type == 3)
Dan Talaycof6202252013-07-02 01:00:29 -070010660 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010661 reader.skip(4)
10662 return obj
10663
10664 def __eq__(self, other):
10665 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070010666 if self.xid != other.xid: return False
10667 if self.flags != other.flags: return False
10668 return True
10669
Rich Lanec2ee4b82013-04-24 17:12:38 -070010670 def pretty_print(self, q):
10671 q.text("table_stats_request {")
10672 with q.group():
10673 with q.indent(2):
10674 q.breakable()
10675 q.text("xid = ");
10676 if self.xid != None:
10677 q.text("%#x" % self.xid)
10678 else:
10679 q.text('None')
10680 q.text(","); q.breakable()
10681 q.text("flags = ");
10682 q.text("%#x" % self.flags)
10683 q.breakable()
10684 q.text('}')
10685
Rich Lane7dcdf022013-12-11 14:45:27 -080010686stats_request.subtypes[3] = table_stats_request
10687
Rich Lanec2ee4b82013-04-24 17:12:38 -070010688
10689def parse_header(buf):
10690 if len(buf) < 8:
10691 raise loxi.ProtocolError("too short to be an OpenFlow message")
10692 return struct.unpack_from("!BBHL", buf)
10693
10694def parse_message(buf):
10695 msg_ver, msg_type, msg_len, msg_xid = parse_header(buf)
Rich Lanefe600f52013-07-09 13:22:32 -070010696 if msg_ver != const.OFP_VERSION and msg_type != const.OFPT_HELLO:
10697 raise loxi.ProtocolError("wrong OpenFlow version (expected %d, got %d)" % (const.OFP_VERSION, msg_ver))
Rich Lanec2ee4b82013-04-24 17:12:38 -070010698 if len(buf) != msg_len:
10699 raise loxi.ProtocolError("incorrect message size")
Rich Lane7dcdf022013-12-11 14:45:27 -080010700 return message.unpack(loxi.generic_util.OFReader(buf))