blob: bbf774a4198412bc5592e3b44ce2fd8dbb708a55 [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 Laneb658ddd2013-03-12 10:15:10 -07005
Rich Lane7dcdf022013-12-11 14:45:27 -08006# Automatically generated by LOXI from template module.py
Rich Laneb658ddd2013-03-12 10:15:10 -07007# Do not modify
8
9import struct
10import loxi
11import const
12import common
Rich Lane7dcdf022013-12-11 14:45:27 -080013import action
Rich Laneb658ddd2013-03-12 10:15:10 -070014import util
Rich Lanec2ee4b82013-04-24 17:12:38 -070015import loxi.generic_util
Rich Laneb658ddd2013-03-12 10:15:10 -070016
Rich Lane7dcdf022013-12-11 14:45:27 -080017class message(loxi.OFObject):
18 subtypes = {}
Rich Laneb658ddd2013-03-12 10:15:10 -070019
Rich Lane7dcdf022013-12-11 14:45:27 -080020 @staticmethod
21 def unpack(reader):
22 subtype, = reader.peek('B', 1)
23 try:
24 subclass = message.subtypes[subtype]
25 except KeyError:
26 raise loxi.ProtocolError("unknown message subtype %#x" % subtype)
27 return subclass.unpack(reader)
28
29
30class stats_reply(message):
31 subtypes = {}
32
33 @staticmethod
34 def unpack(reader):
35 subtype, = reader.peek('!H', 8)
36 try:
37 subclass = stats_reply.subtypes[subtype]
38 except KeyError:
39 raise loxi.ProtocolError("unknown stats_reply message subtype %#x" % subtype)
40 return subclass.unpack(reader)
41
42message.subtypes[17] = stats_reply
43
44class aggregate_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070045 version = 1
46 type = 17
47 stats_type = 2
Rich Laneb658ddd2013-03-12 10:15:10 -070048
Rich Lanec2ee4b82013-04-24 17:12:38 -070049 def __init__(self, xid=None, flags=None, packet_count=None, byte_count=None, flow_count=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080050 if xid != None:
51 self.xid = xid
52 else:
53 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -070054 if flags != None:
55 self.flags = flags
56 else:
57 self.flags = 0
58 if packet_count != None:
59 self.packet_count = packet_count
60 else:
61 self.packet_count = 0
62 if byte_count != None:
63 self.byte_count = byte_count
64 else:
65 self.byte_count = 0
66 if flow_count != None:
67 self.flow_count = flow_count
68 else:
69 self.flow_count = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080070 return
Rich Laneb658ddd2013-03-12 10:15:10 -070071
72 def pack(self):
73 packed = []
74 packed.append(struct.pack("!B", self.version))
75 packed.append(struct.pack("!B", self.type))
76 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
77 packed.append(struct.pack("!L", self.xid))
78 packed.append(struct.pack("!H", self.stats_type))
79 packed.append(struct.pack("!H", self.flags))
80 packed.append(struct.pack("!Q", self.packet_count))
81 packed.append(struct.pack("!Q", self.byte_count))
82 packed.append(struct.pack("!L", self.flow_count))
Rich Lanec2ee4b82013-04-24 17:12:38 -070083 packed.append('\x00' * 4)
Rich Laneb658ddd2013-03-12 10:15:10 -070084 length = sum([len(x) for x in packed])
85 packed[2] = struct.pack("!H", length)
86 return ''.join(packed)
87
88 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080089 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -070090 obj = aggregate_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070091 _version = reader.read("!B")[0]
92 assert(_version == 1)
93 _type = reader.read("!B")[0]
94 assert(_type == 17)
95 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080096 orig_reader = reader
97 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -070098 obj.xid = reader.read("!L")[0]
99 _stats_type = reader.read("!H")[0]
100 assert(_stats_type == 2)
101 obj.flags = reader.read("!H")[0]
102 obj.packet_count = reader.read("!Q")[0]
103 obj.byte_count = reader.read("!Q")[0]
104 obj.flow_count = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700105 reader.skip(4)
Rich Laneb658ddd2013-03-12 10:15:10 -0700106 return obj
107
108 def __eq__(self, other):
109 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -0700110 if self.xid != other.xid: return False
111 if self.flags != other.flags: return False
112 if self.packet_count != other.packet_count: return False
113 if self.byte_count != other.byte_count: return False
114 if self.flow_count != other.flow_count: return False
Rich Laneb658ddd2013-03-12 10:15:10 -0700115 return True
116
Rich Laneb658ddd2013-03-12 10:15:10 -0700117 def pretty_print(self, q):
118 q.text("aggregate_stats_reply {")
119 with q.group():
120 with q.indent(2):
121 q.breakable()
122 q.text("xid = ");
123 if self.xid != None:
124 q.text("%#x" % self.xid)
125 else:
126 q.text('None')
127 q.text(","); q.breakable()
128 q.text("flags = ");
129 q.text("%#x" % self.flags)
130 q.text(","); q.breakable()
131 q.text("packet_count = ");
132 q.text("%#x" % self.packet_count)
133 q.text(","); q.breakable()
134 q.text("byte_count = ");
135 q.text("%#x" % self.byte_count)
136 q.text(","); q.breakable()
137 q.text("flow_count = ");
138 q.text("%#x" % self.flow_count)
Rich Laneb658ddd2013-03-12 10:15:10 -0700139 q.breakable()
140 q.text('}')
141
Rich Lane7dcdf022013-12-11 14:45:27 -0800142stats_reply.subtypes[2] = aggregate_stats_reply
143
144class stats_request(message):
145 subtypes = {}
146
147 @staticmethod
148 def unpack(reader):
149 subtype, = reader.peek('!H', 8)
150 try:
151 subclass = stats_request.subtypes[subtype]
152 except KeyError:
153 raise loxi.ProtocolError("unknown stats_request message subtype %#x" % subtype)
154 return subclass.unpack(reader)
155
156message.subtypes[16] = stats_request
157
158class aggregate_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -0700159 version = 1
160 type = 16
161 stats_type = 2
Rich Laneb658ddd2013-03-12 10:15:10 -0700162
Rich Lanec2ee4b82013-04-24 17:12:38 -0700163 def __init__(self, xid=None, flags=None, match=None, table_id=None, out_port=None):
Rich Lane7dcdf022013-12-11 14:45:27 -0800164 if xid != None:
165 self.xid = xid
166 else:
167 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -0700168 if flags != None:
169 self.flags = flags
170 else:
171 self.flags = 0
172 if match != None:
173 self.match = match
174 else:
175 self.match = common.match()
176 if table_id != None:
177 self.table_id = table_id
178 else:
179 self.table_id = 0
Rich Laneb658ddd2013-03-12 10:15:10 -0700180 if out_port != None:
181 self.out_port = out_port
182 else:
183 self.out_port = 0
Rich Lane7dcdf022013-12-11 14:45:27 -0800184 return
Rich Laneb658ddd2013-03-12 10:15:10 -0700185
186 def pack(self):
187 packed = []
188 packed.append(struct.pack("!B", self.version))
189 packed.append(struct.pack("!B", self.type))
190 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
191 packed.append(struct.pack("!L", self.xid))
192 packed.append(struct.pack("!H", self.stats_type))
193 packed.append(struct.pack("!H", self.flags))
194 packed.append(self.match.pack())
195 packed.append(struct.pack("!B", self.table_id))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700196 packed.append('\x00' * 1)
Dan Talaycof6202252013-07-02 01:00:29 -0700197 packed.append(util.pack_port_no(self.out_port))
Rich Laneb658ddd2013-03-12 10:15:10 -0700198 length = sum([len(x) for x in packed])
199 packed[2] = struct.pack("!H", length)
200 return ''.join(packed)
201
202 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800203 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -0700204 obj = aggregate_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -0700205 _version = reader.read("!B")[0]
206 assert(_version == 1)
207 _type = reader.read("!B")[0]
208 assert(_type == 16)
209 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800210 orig_reader = reader
211 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700212 obj.xid = reader.read("!L")[0]
213 _stats_type = reader.read("!H")[0]
214 assert(_stats_type == 2)
215 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700216 obj.match = common.match.unpack(reader)
Dan Talaycof6202252013-07-02 01:00:29 -0700217 obj.table_id = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700218 reader.skip(1)
Dan Talaycof6202252013-07-02 01:00:29 -0700219 obj.out_port = util.unpack_port_no(reader)
Rich Laneb658ddd2013-03-12 10:15:10 -0700220 return obj
221
222 def __eq__(self, other):
223 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -0700224 if self.xid != other.xid: return False
225 if self.flags != other.flags: return False
226 if self.match != other.match: return False
227 if self.table_id != other.table_id: return False
Rich Laneb658ddd2013-03-12 10:15:10 -0700228 if self.out_port != other.out_port: return False
229 return True
230
Rich Laneb658ddd2013-03-12 10:15:10 -0700231 def pretty_print(self, q):
232 q.text("aggregate_stats_request {")
233 with q.group():
234 with q.indent(2):
235 q.breakable()
236 q.text("xid = ");
237 if self.xid != None:
238 q.text("%#x" % self.xid)
239 else:
240 q.text('None')
241 q.text(","); q.breakable()
242 q.text("flags = ");
243 q.text("%#x" % self.flags)
244 q.text(","); q.breakable()
245 q.text("match = ");
246 q.pp(self.match)
247 q.text(","); q.breakable()
248 q.text("table_id = ");
249 q.text("%#x" % self.table_id)
250 q.text(","); q.breakable()
Rich Laneb658ddd2013-03-12 10:15:10 -0700251 q.text("out_port = ");
252 q.text(util.pretty_port(self.out_port))
253 q.breakable()
254 q.text('}')
255
Rich Lane7dcdf022013-12-11 14:45:27 -0800256stats_request.subtypes[2] = aggregate_stats_request
257
258class error_msg(message):
259 subtypes = {}
260
261 @staticmethod
262 def unpack(reader):
263 subtype, = reader.peek('!H', 8)
264 try:
265 subclass = error_msg.subtypes[subtype]
266 except KeyError:
267 raise loxi.ProtocolError("unknown error_msg message subtype %#x" % subtype)
268 return subclass.unpack(reader)
269
270message.subtypes[1] = error_msg
271
272class bad_action_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -0700273 version = 1
274 type = 1
275 err_type = 2
276
277 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -0800278 if xid != None:
279 self.xid = xid
280 else:
281 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -0700282 if code != None:
283 self.code = code
284 else:
285 self.code = 0
286 if data != None:
287 self.data = data
288 else:
289 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -0800290 return
Rich Lane6f4978c2013-10-20 21:33:52 -0700291
292 def pack(self):
293 packed = []
294 packed.append(struct.pack("!B", self.version))
295 packed.append(struct.pack("!B", self.type))
296 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
297 packed.append(struct.pack("!L", self.xid))
298 packed.append(struct.pack("!H", self.err_type))
299 packed.append(struct.pack("!H", self.code))
300 packed.append(self.data)
301 length = sum([len(x) for x in packed])
302 packed[2] = struct.pack("!H", length)
303 return ''.join(packed)
304
305 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800306 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -0700307 obj = bad_action_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -0700308 _version = reader.read("!B")[0]
309 assert(_version == 1)
310 _type = reader.read("!B")[0]
311 assert(_type == 1)
312 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800313 orig_reader = reader
314 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -0700315 obj.xid = reader.read("!L")[0]
316 _err_type = reader.read("!H")[0]
317 assert(_err_type == 2)
318 obj.code = reader.read("!H")[0]
319 obj.data = str(reader.read_all())
320 return obj
321
322 def __eq__(self, other):
323 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -0700324 if self.xid != other.xid: return False
325 if self.code != other.code: return False
326 if self.data != other.data: return False
327 return True
328
Rich Lane6f4978c2013-10-20 21:33:52 -0700329 def pretty_print(self, q):
330 q.text("bad_action_error_msg {")
331 with q.group():
332 with q.indent(2):
333 q.breakable()
334 q.text("xid = ");
335 if self.xid != None:
336 q.text("%#x" % self.xid)
337 else:
338 q.text('None')
339 q.text(","); q.breakable()
340 q.text("code = ");
341 q.text("%#x" % self.code)
342 q.text(","); q.breakable()
343 q.text("data = ");
344 q.pp(self.data)
345 q.breakable()
346 q.text('}')
347
Rich Lane7dcdf022013-12-11 14:45:27 -0800348error_msg.subtypes[2] = bad_action_error_msg
349
350class bad_request_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -0700351 version = 1
352 type = 1
353 err_type = 1
354
355 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -0800356 if xid != None:
357 self.xid = xid
358 else:
359 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -0700360 if code != None:
361 self.code = code
362 else:
363 self.code = 0
364 if data != None:
365 self.data = data
366 else:
367 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -0800368 return
Rich Lane6f4978c2013-10-20 21:33:52 -0700369
370 def pack(self):
371 packed = []
372 packed.append(struct.pack("!B", self.version))
373 packed.append(struct.pack("!B", self.type))
374 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
375 packed.append(struct.pack("!L", self.xid))
376 packed.append(struct.pack("!H", self.err_type))
377 packed.append(struct.pack("!H", self.code))
378 packed.append(self.data)
379 length = sum([len(x) for x in packed])
380 packed[2] = struct.pack("!H", length)
381 return ''.join(packed)
382
383 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800384 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -0700385 obj = bad_request_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -0700386 _version = reader.read("!B")[0]
387 assert(_version == 1)
388 _type = reader.read("!B")[0]
389 assert(_type == 1)
390 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800391 orig_reader = reader
392 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -0700393 obj.xid = reader.read("!L")[0]
394 _err_type = reader.read("!H")[0]
395 assert(_err_type == 1)
396 obj.code = reader.read("!H")[0]
397 obj.data = str(reader.read_all())
398 return obj
399
400 def __eq__(self, other):
401 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -0700402 if self.xid != other.xid: return False
403 if self.code != other.code: return False
404 if self.data != other.data: return False
405 return True
406
Rich Lane6f4978c2013-10-20 21:33:52 -0700407 def pretty_print(self, q):
408 q.text("bad_request_error_msg {")
409 with q.group():
410 with q.indent(2):
411 q.breakable()
412 q.text("xid = ");
413 if self.xid != None:
414 q.text("%#x" % self.xid)
415 else:
416 q.text('None')
417 q.text(","); q.breakable()
418 q.text("code = ");
419 q.text("%#x" % self.code)
420 q.text(","); q.breakable()
421 q.text("data = ");
422 q.pp(self.data)
423 q.breakable()
424 q.text('}')
425
Rich Lane7dcdf022013-12-11 14:45:27 -0800426error_msg.subtypes[1] = bad_request_error_msg
427
428class barrier_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -0700429 version = 1
430 type = 19
Rich Laneb658ddd2013-03-12 10:15:10 -0700431
432 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -0800433 if xid != None:
434 self.xid = xid
435 else:
436 self.xid = None
437 return
Rich Laneb658ddd2013-03-12 10:15:10 -0700438
439 def pack(self):
440 packed = []
441 packed.append(struct.pack("!B", self.version))
442 packed.append(struct.pack("!B", self.type))
443 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
444 packed.append(struct.pack("!L", self.xid))
445 length = sum([len(x) for x in packed])
446 packed[2] = struct.pack("!H", length)
447 return ''.join(packed)
448
449 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800450 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -0700451 obj = barrier_reply()
Dan Talaycof6202252013-07-02 01:00:29 -0700452 _version = reader.read("!B")[0]
453 assert(_version == 1)
454 _type = reader.read("!B")[0]
455 assert(_type == 19)
456 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800457 orig_reader = reader
458 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700459 obj.xid = reader.read("!L")[0]
Rich Laneb658ddd2013-03-12 10:15:10 -0700460 return obj
461
462 def __eq__(self, other):
463 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -0700464 if self.xid != other.xid: return False
465 return True
466
Rich Laneb658ddd2013-03-12 10:15:10 -0700467 def pretty_print(self, q):
468 q.text("barrier_reply {")
469 with q.group():
470 with q.indent(2):
471 q.breakable()
472 q.text("xid = ");
473 if self.xid != None:
474 q.text("%#x" % self.xid)
475 else:
476 q.text('None')
477 q.breakable()
478 q.text('}')
479
Rich Lane7dcdf022013-12-11 14:45:27 -0800480message.subtypes[19] = barrier_reply
481
482class barrier_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -0700483 version = 1
484 type = 18
Rich Laneb658ddd2013-03-12 10:15:10 -0700485
486 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -0800487 if xid != None:
488 self.xid = xid
489 else:
490 self.xid = None
491 return
Rich Laneb658ddd2013-03-12 10:15:10 -0700492
493 def pack(self):
494 packed = []
495 packed.append(struct.pack("!B", self.version))
496 packed.append(struct.pack("!B", self.type))
497 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
498 packed.append(struct.pack("!L", self.xid))
499 length = sum([len(x) for x in packed])
500 packed[2] = struct.pack("!H", length)
501 return ''.join(packed)
502
503 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800504 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -0700505 obj = barrier_request()
Dan Talaycof6202252013-07-02 01:00:29 -0700506 _version = reader.read("!B")[0]
507 assert(_version == 1)
508 _type = reader.read("!B")[0]
509 assert(_type == 18)
510 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800511 orig_reader = reader
512 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700513 obj.xid = reader.read("!L")[0]
Rich Laneb658ddd2013-03-12 10:15:10 -0700514 return obj
515
516 def __eq__(self, other):
517 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -0700518 if self.xid != other.xid: return False
519 return True
520
Rich Laneb658ddd2013-03-12 10:15:10 -0700521 def pretty_print(self, q):
522 q.text("barrier_request {")
523 with q.group():
524 with q.indent(2):
525 q.breakable()
526 q.text("xid = ");
527 if self.xid != None:
528 q.text("%#x" % self.xid)
529 else:
530 q.text('None')
531 q.breakable()
532 q.text('}')
533
Rich Lane7dcdf022013-12-11 14:45:27 -0800534message.subtypes[18] = barrier_request
535
536class experimenter(message):
537 subtypes = {}
538
539 @staticmethod
540 def unpack(reader):
541 subtype, = reader.peek('!L', 8)
542 try:
543 subclass = experimenter.subtypes[subtype]
544 except KeyError:
545 raise loxi.ProtocolError("unknown experimenter message subtype %#x" % subtype)
546 return subclass.unpack(reader)
547
548message.subtypes[4] = experimenter
549
550class bsn_header(experimenter):
551 subtypes = {}
552
553 @staticmethod
554 def unpack(reader):
555 subtype, = reader.peek('!L', 12)
556 try:
557 subclass = bsn_header.subtypes[subtype]
558 except KeyError:
559 raise loxi.ProtocolError("unknown bsn_header experimenter message subtype %#x" % subtype)
560 return subclass.unpack(reader)
561
562experimenter.subtypes[6035143] = bsn_header
563
564class bsn_bw_clear_data_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -0700565 version = 1
566 type = 4
567 experimenter = 6035143
568 subtype = 22
569
570 def __init__(self, xid=None, status=None):
Rich Lane7dcdf022013-12-11 14:45:27 -0800571 if xid != None:
572 self.xid = xid
573 else:
574 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -0700575 if status != None:
576 self.status = status
577 else:
578 self.status = 0
Rich Lane7dcdf022013-12-11 14:45:27 -0800579 return
Dan Talaycof6202252013-07-02 01:00:29 -0700580
581 def pack(self):
582 packed = []
583 packed.append(struct.pack("!B", self.version))
584 packed.append(struct.pack("!B", self.type))
585 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
586 packed.append(struct.pack("!L", self.xid))
587 packed.append(struct.pack("!L", self.experimenter))
588 packed.append(struct.pack("!L", self.subtype))
589 packed.append(struct.pack("!L", self.status))
590 length = sum([len(x) for x in packed])
591 packed[2] = struct.pack("!H", length)
592 return ''.join(packed)
593
594 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800595 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -0700596 obj = bsn_bw_clear_data_reply()
Dan Talaycof6202252013-07-02 01:00:29 -0700597 _version = reader.read("!B")[0]
598 assert(_version == 1)
599 _type = reader.read("!B")[0]
600 assert(_type == 4)
601 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800602 orig_reader = reader
603 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700604 obj.xid = reader.read("!L")[0]
605 _experimenter = reader.read("!L")[0]
606 assert(_experimenter == 6035143)
607 _subtype = reader.read("!L")[0]
608 assert(_subtype == 22)
609 obj.status = reader.read("!L")[0]
610 return obj
611
612 def __eq__(self, other):
613 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -0700614 if self.xid != other.xid: return False
615 if self.status != other.status: return False
616 return True
617
Dan Talaycof6202252013-07-02 01:00:29 -0700618 def pretty_print(self, q):
619 q.text("bsn_bw_clear_data_reply {")
620 with q.group():
621 with q.indent(2):
622 q.breakable()
623 q.text("xid = ");
624 if self.xid != None:
625 q.text("%#x" % self.xid)
626 else:
627 q.text('None')
628 q.text(","); q.breakable()
629 q.text("status = ");
630 q.text("%#x" % self.status)
631 q.breakable()
632 q.text('}')
633
Rich Lane7dcdf022013-12-11 14:45:27 -0800634bsn_header.subtypes[22] = bsn_bw_clear_data_reply
635
636class bsn_bw_clear_data_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -0700637 version = 1
638 type = 4
639 experimenter = 6035143
640 subtype = 21
641
642 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -0800643 if xid != None:
644 self.xid = xid
645 else:
646 self.xid = None
647 return
Dan Talaycof6202252013-07-02 01:00:29 -0700648
649 def pack(self):
650 packed = []
651 packed.append(struct.pack("!B", self.version))
652 packed.append(struct.pack("!B", self.type))
653 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
654 packed.append(struct.pack("!L", self.xid))
655 packed.append(struct.pack("!L", self.experimenter))
656 packed.append(struct.pack("!L", self.subtype))
657 length = sum([len(x) for x in packed])
658 packed[2] = struct.pack("!H", length)
659 return ''.join(packed)
660
661 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800662 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -0700663 obj = bsn_bw_clear_data_request()
Dan Talaycof6202252013-07-02 01:00:29 -0700664 _version = reader.read("!B")[0]
665 assert(_version == 1)
666 _type = reader.read("!B")[0]
667 assert(_type == 4)
668 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800669 orig_reader = reader
670 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700671 obj.xid = reader.read("!L")[0]
672 _experimenter = reader.read("!L")[0]
673 assert(_experimenter == 6035143)
674 _subtype = reader.read("!L")[0]
675 assert(_subtype == 21)
676 return obj
677
678 def __eq__(self, other):
679 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -0700680 if self.xid != other.xid: return False
681 return True
682
Dan Talaycof6202252013-07-02 01:00:29 -0700683 def pretty_print(self, q):
684 q.text("bsn_bw_clear_data_request {")
685 with q.group():
686 with q.indent(2):
687 q.breakable()
688 q.text("xid = ");
689 if self.xid != None:
690 q.text("%#x" % self.xid)
691 else:
692 q.text('None')
693 q.breakable()
694 q.text('}')
695
Rich Lane7dcdf022013-12-11 14:45:27 -0800696bsn_header.subtypes[21] = bsn_bw_clear_data_request
697
698class bsn_bw_enable_get_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -0700699 version = 1
700 type = 4
701 experimenter = 6035143
702 subtype = 20
703
704 def __init__(self, xid=None, enabled=None):
Rich Lane7dcdf022013-12-11 14:45:27 -0800705 if xid != None:
706 self.xid = xid
707 else:
708 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -0700709 if enabled != None:
710 self.enabled = enabled
711 else:
712 self.enabled = 0
Rich Lane7dcdf022013-12-11 14:45:27 -0800713 return
Dan Talaycof6202252013-07-02 01:00:29 -0700714
715 def pack(self):
716 packed = []
717 packed.append(struct.pack("!B", self.version))
718 packed.append(struct.pack("!B", self.type))
719 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
720 packed.append(struct.pack("!L", self.xid))
721 packed.append(struct.pack("!L", self.experimenter))
722 packed.append(struct.pack("!L", self.subtype))
723 packed.append(struct.pack("!L", self.enabled))
724 length = sum([len(x) for x in packed])
725 packed[2] = struct.pack("!H", length)
726 return ''.join(packed)
727
728 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800729 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -0700730 obj = bsn_bw_enable_get_reply()
Dan Talaycof6202252013-07-02 01:00:29 -0700731 _version = reader.read("!B")[0]
732 assert(_version == 1)
733 _type = reader.read("!B")[0]
734 assert(_type == 4)
735 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800736 orig_reader = reader
737 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700738 obj.xid = reader.read("!L")[0]
739 _experimenter = reader.read("!L")[0]
740 assert(_experimenter == 6035143)
741 _subtype = reader.read("!L")[0]
742 assert(_subtype == 20)
743 obj.enabled = reader.read("!L")[0]
744 return obj
745
746 def __eq__(self, other):
747 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -0700748 if self.xid != other.xid: return False
749 if self.enabled != other.enabled: return False
750 return True
751
Dan Talaycof6202252013-07-02 01:00:29 -0700752 def pretty_print(self, q):
753 q.text("bsn_bw_enable_get_reply {")
754 with q.group():
755 with q.indent(2):
756 q.breakable()
757 q.text("xid = ");
758 if self.xid != None:
759 q.text("%#x" % self.xid)
760 else:
761 q.text('None')
762 q.text(","); q.breakable()
763 q.text("enabled = ");
764 q.text("%#x" % self.enabled)
765 q.breakable()
766 q.text('}')
767
Rich Lane7dcdf022013-12-11 14:45:27 -0800768bsn_header.subtypes[20] = bsn_bw_enable_get_reply
769
770class bsn_bw_enable_get_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -0700771 version = 1
772 type = 4
773 experimenter = 6035143
774 subtype = 19
775
776 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -0800777 if xid != None:
778 self.xid = xid
779 else:
780 self.xid = None
781 return
Dan Talaycof6202252013-07-02 01:00:29 -0700782
783 def pack(self):
784 packed = []
785 packed.append(struct.pack("!B", self.version))
786 packed.append(struct.pack("!B", self.type))
787 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
788 packed.append(struct.pack("!L", self.xid))
789 packed.append(struct.pack("!L", self.experimenter))
790 packed.append(struct.pack("!L", self.subtype))
791 length = sum([len(x) for x in packed])
792 packed[2] = struct.pack("!H", length)
793 return ''.join(packed)
794
795 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800796 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -0700797 obj = bsn_bw_enable_get_request()
Dan Talaycof6202252013-07-02 01:00:29 -0700798 _version = reader.read("!B")[0]
799 assert(_version == 1)
800 _type = reader.read("!B")[0]
801 assert(_type == 4)
802 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800803 orig_reader = reader
804 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700805 obj.xid = reader.read("!L")[0]
806 _experimenter = reader.read("!L")[0]
807 assert(_experimenter == 6035143)
808 _subtype = reader.read("!L")[0]
809 assert(_subtype == 19)
810 return obj
811
812 def __eq__(self, other):
813 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -0700814 if self.xid != other.xid: return False
815 return True
816
Dan Talaycof6202252013-07-02 01:00:29 -0700817 def pretty_print(self, q):
818 q.text("bsn_bw_enable_get_request {")
819 with q.group():
820 with q.indent(2):
821 q.breakable()
822 q.text("xid = ");
823 if self.xid != None:
824 q.text("%#x" % self.xid)
825 else:
826 q.text('None')
827 q.breakable()
828 q.text('}')
829
Rich Lane7dcdf022013-12-11 14:45:27 -0800830bsn_header.subtypes[19] = bsn_bw_enable_get_request
831
832class bsn_bw_enable_set_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -0700833 version = 1
834 type = 4
835 experimenter = 6035143
836 subtype = 23
837
838 def __init__(self, xid=None, enable=None, status=None):
Rich Lane7dcdf022013-12-11 14:45:27 -0800839 if xid != None:
840 self.xid = xid
841 else:
842 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -0700843 if enable != None:
844 self.enable = enable
845 else:
846 self.enable = 0
847 if status != None:
848 self.status = status
849 else:
850 self.status = 0
Rich Lane7dcdf022013-12-11 14:45:27 -0800851 return
Dan Talaycof6202252013-07-02 01:00:29 -0700852
853 def pack(self):
854 packed = []
855 packed.append(struct.pack("!B", self.version))
856 packed.append(struct.pack("!B", self.type))
857 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
858 packed.append(struct.pack("!L", self.xid))
859 packed.append(struct.pack("!L", self.experimenter))
860 packed.append(struct.pack("!L", self.subtype))
861 packed.append(struct.pack("!L", self.enable))
862 packed.append(struct.pack("!L", self.status))
863 length = sum([len(x) for x in packed])
864 packed[2] = struct.pack("!H", length)
865 return ''.join(packed)
866
867 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800868 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -0700869 obj = bsn_bw_enable_set_reply()
Dan Talaycof6202252013-07-02 01:00:29 -0700870 _version = reader.read("!B")[0]
871 assert(_version == 1)
872 _type = reader.read("!B")[0]
873 assert(_type == 4)
874 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800875 orig_reader = reader
876 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700877 obj.xid = reader.read("!L")[0]
878 _experimenter = reader.read("!L")[0]
879 assert(_experimenter == 6035143)
880 _subtype = reader.read("!L")[0]
881 assert(_subtype == 23)
882 obj.enable = reader.read("!L")[0]
883 obj.status = reader.read("!L")[0]
884 return obj
885
886 def __eq__(self, other):
887 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -0700888 if self.xid != other.xid: return False
889 if self.enable != other.enable: return False
890 if self.status != other.status: return False
891 return True
892
Dan Talaycof6202252013-07-02 01:00:29 -0700893 def pretty_print(self, q):
894 q.text("bsn_bw_enable_set_reply {")
895 with q.group():
896 with q.indent(2):
897 q.breakable()
898 q.text("xid = ");
899 if self.xid != None:
900 q.text("%#x" % self.xid)
901 else:
902 q.text('None')
903 q.text(","); q.breakable()
904 q.text("enable = ");
905 q.text("%#x" % self.enable)
906 q.text(","); q.breakable()
907 q.text("status = ");
908 q.text("%#x" % self.status)
909 q.breakable()
910 q.text('}')
911
Rich Lane7dcdf022013-12-11 14:45:27 -0800912bsn_header.subtypes[23] = bsn_bw_enable_set_reply
913
914class bsn_bw_enable_set_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -0700915 version = 1
916 type = 4
917 experimenter = 6035143
918 subtype = 18
919
920 def __init__(self, xid=None, enable=None):
Rich Lane7dcdf022013-12-11 14:45:27 -0800921 if xid != None:
922 self.xid = xid
923 else:
924 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -0700925 if enable != None:
926 self.enable = enable
927 else:
928 self.enable = 0
Rich Lane7dcdf022013-12-11 14:45:27 -0800929 return
Dan Talaycof6202252013-07-02 01:00:29 -0700930
931 def pack(self):
932 packed = []
933 packed.append(struct.pack("!B", self.version))
934 packed.append(struct.pack("!B", self.type))
935 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
936 packed.append(struct.pack("!L", self.xid))
937 packed.append(struct.pack("!L", self.experimenter))
938 packed.append(struct.pack("!L", self.subtype))
939 packed.append(struct.pack("!L", self.enable))
940 length = sum([len(x) for x in packed])
941 packed[2] = struct.pack("!H", length)
942 return ''.join(packed)
943
944 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800945 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -0700946 obj = bsn_bw_enable_set_request()
Dan Talaycof6202252013-07-02 01:00:29 -0700947 _version = reader.read("!B")[0]
948 assert(_version == 1)
949 _type = reader.read("!B")[0]
950 assert(_type == 4)
951 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800952 orig_reader = reader
953 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700954 obj.xid = reader.read("!L")[0]
955 _experimenter = reader.read("!L")[0]
956 assert(_experimenter == 6035143)
957 _subtype = reader.read("!L")[0]
958 assert(_subtype == 18)
959 obj.enable = reader.read("!L")[0]
960 return obj
961
962 def __eq__(self, other):
963 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -0700964 if self.xid != other.xid: return False
965 if self.enable != other.enable: return False
966 return True
967
Dan Talaycof6202252013-07-02 01:00:29 -0700968 def pretty_print(self, q):
969 q.text("bsn_bw_enable_set_request {")
970 with q.group():
971 with q.indent(2):
972 q.breakable()
973 q.text("xid = ");
974 if self.xid != None:
975 q.text("%#x" % self.xid)
976 else:
977 q.text('None')
978 q.text(","); q.breakable()
979 q.text("enable = ");
980 q.text("%#x" % self.enable)
981 q.breakable()
982 q.text('}')
983
Rich Lane7dcdf022013-12-11 14:45:27 -0800984bsn_header.subtypes[18] = bsn_bw_enable_set_request
985
986class bsn_get_interfaces_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -0700987 version = 1
988 type = 4
989 experimenter = 6035143
Rich Laneb658ddd2013-03-12 10:15:10 -0700990 subtype = 10
991
992 def __init__(self, xid=None, interfaces=None):
Rich Lane7dcdf022013-12-11 14:45:27 -0800993 if xid != None:
994 self.xid = xid
995 else:
996 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -0700997 if interfaces != None:
998 self.interfaces = interfaces
999 else:
1000 self.interfaces = []
Rich Lane7dcdf022013-12-11 14:45:27 -08001001 return
Rich Laneb658ddd2013-03-12 10:15:10 -07001002
1003 def pack(self):
1004 packed = []
1005 packed.append(struct.pack("!B", self.version))
1006 packed.append(struct.pack("!B", self.type))
1007 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1008 packed.append(struct.pack("!L", self.xid))
1009 packed.append(struct.pack("!L", self.experimenter))
1010 packed.append(struct.pack("!L", self.subtype))
Rich Lane7dcdf022013-12-11 14:45:27 -08001011 packed.append(loxi.generic_util.pack_list(self.interfaces))
Rich Laneb658ddd2013-03-12 10:15:10 -07001012 length = sum([len(x) for x in packed])
1013 packed[2] = struct.pack("!H", length)
1014 return ''.join(packed)
1015
1016 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001017 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07001018 obj = bsn_get_interfaces_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07001019 _version = reader.read("!B")[0]
1020 assert(_version == 1)
1021 _type = reader.read("!B")[0]
1022 assert(_type == 4)
1023 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001024 orig_reader = reader
1025 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001026 obj.xid = reader.read("!L")[0]
1027 _experimenter = reader.read("!L")[0]
1028 assert(_experimenter == 6035143)
1029 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001030 assert(_subtype == 10)
1031 obj.interfaces = loxi.generic_util.unpack_list(reader, common.bsn_interface.unpack)
Rich Laneb658ddd2013-03-12 10:15:10 -07001032 return obj
1033
1034 def __eq__(self, other):
1035 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07001036 if self.xid != other.xid: return False
1037 if self.interfaces != other.interfaces: return False
1038 return True
1039
Rich Laneb658ddd2013-03-12 10:15:10 -07001040 def pretty_print(self, q):
1041 q.text("bsn_get_interfaces_reply {")
1042 with q.group():
1043 with q.indent(2):
1044 q.breakable()
1045 q.text("xid = ");
1046 if self.xid != None:
1047 q.text("%#x" % self.xid)
1048 else:
1049 q.text('None')
1050 q.text(","); q.breakable()
1051 q.text("interfaces = ");
1052 q.pp(self.interfaces)
1053 q.breakable()
1054 q.text('}')
1055
Rich Lane7dcdf022013-12-11 14:45:27 -08001056bsn_header.subtypes[10] = bsn_get_interfaces_reply
1057
1058class bsn_get_interfaces_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001059 version = 1
1060 type = 4
1061 experimenter = 6035143
Rich Laneb658ddd2013-03-12 10:15:10 -07001062 subtype = 9
1063
1064 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001065 if xid != None:
1066 self.xid = xid
1067 else:
1068 self.xid = None
1069 return
Rich Laneb658ddd2013-03-12 10:15:10 -07001070
1071 def pack(self):
1072 packed = []
1073 packed.append(struct.pack("!B", self.version))
1074 packed.append(struct.pack("!B", self.type))
1075 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1076 packed.append(struct.pack("!L", self.xid))
1077 packed.append(struct.pack("!L", self.experimenter))
1078 packed.append(struct.pack("!L", self.subtype))
1079 length = sum([len(x) for x in packed])
1080 packed[2] = struct.pack("!H", length)
1081 return ''.join(packed)
1082
1083 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001084 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07001085 obj = bsn_get_interfaces_request()
Dan Talaycof6202252013-07-02 01:00:29 -07001086 _version = reader.read("!B")[0]
1087 assert(_version == 1)
1088 _type = reader.read("!B")[0]
1089 assert(_type == 4)
1090 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001091 orig_reader = reader
1092 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001093 obj.xid = reader.read("!L")[0]
1094 _experimenter = reader.read("!L")[0]
1095 assert(_experimenter == 6035143)
1096 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001097 assert(_subtype == 9)
Rich Laneb658ddd2013-03-12 10:15:10 -07001098 return obj
1099
1100 def __eq__(self, other):
1101 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07001102 if self.xid != other.xid: return False
1103 return True
1104
Rich Laneb658ddd2013-03-12 10:15:10 -07001105 def pretty_print(self, q):
1106 q.text("bsn_get_interfaces_request {")
1107 with q.group():
1108 with q.indent(2):
1109 q.breakable()
1110 q.text("xid = ");
1111 if self.xid != None:
1112 q.text("%#x" % self.xid)
1113 else:
1114 q.text('None')
1115 q.breakable()
1116 q.text('}')
1117
Rich Lane7dcdf022013-12-11 14:45:27 -08001118bsn_header.subtypes[9] = bsn_get_interfaces_request
1119
1120class bsn_get_ip_mask_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001121 version = 1
1122 type = 4
1123 experimenter = 6035143
Rich Laneb658ddd2013-03-12 10:15:10 -07001124 subtype = 2
1125
Rich Lanec2ee4b82013-04-24 17:12:38 -07001126 def __init__(self, xid=None, index=None, mask=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001127 if xid != None:
1128 self.xid = xid
1129 else:
1130 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07001131 if index != None:
1132 self.index = index
1133 else:
1134 self.index = 0
Rich Laneb658ddd2013-03-12 10:15:10 -07001135 if mask != None:
1136 self.mask = mask
1137 else:
1138 self.mask = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08001139 return
Rich Laneb658ddd2013-03-12 10:15:10 -07001140
1141 def pack(self):
1142 packed = []
1143 packed.append(struct.pack("!B", self.version))
1144 packed.append(struct.pack("!B", self.type))
1145 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1146 packed.append(struct.pack("!L", self.xid))
1147 packed.append(struct.pack("!L", self.experimenter))
1148 packed.append(struct.pack("!L", self.subtype))
1149 packed.append(struct.pack("!B", self.index))
Rich Lanec2ee4b82013-04-24 17:12:38 -07001150 packed.append('\x00' * 3)
Rich Laneb658ddd2013-03-12 10:15:10 -07001151 packed.append(struct.pack("!L", self.mask))
1152 length = sum([len(x) for x in packed])
1153 packed[2] = struct.pack("!H", length)
1154 return ''.join(packed)
1155
1156 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001157 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07001158 obj = bsn_get_ip_mask_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07001159 _version = reader.read("!B")[0]
1160 assert(_version == 1)
1161 _type = reader.read("!B")[0]
1162 assert(_type == 4)
1163 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001164 orig_reader = reader
1165 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001166 obj.xid = reader.read("!L")[0]
1167 _experimenter = reader.read("!L")[0]
1168 assert(_experimenter == 6035143)
1169 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001170 assert(_subtype == 2)
Dan Talaycof6202252013-07-02 01:00:29 -07001171 obj.index = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001172 reader.skip(3)
Dan Talaycof6202252013-07-02 01:00:29 -07001173 obj.mask = reader.read("!L")[0]
Rich Laneb658ddd2013-03-12 10:15:10 -07001174 return obj
1175
1176 def __eq__(self, other):
1177 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07001178 if self.xid != other.xid: return False
1179 if self.index != other.index: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07001180 if self.mask != other.mask: return False
1181 return True
1182
Rich Laneb658ddd2013-03-12 10:15:10 -07001183 def pretty_print(self, q):
1184 q.text("bsn_get_ip_mask_reply {")
1185 with q.group():
1186 with q.indent(2):
1187 q.breakable()
1188 q.text("xid = ");
1189 if self.xid != None:
1190 q.text("%#x" % self.xid)
1191 else:
1192 q.text('None')
1193 q.text(","); q.breakable()
1194 q.text("index = ");
1195 q.text("%#x" % self.index)
1196 q.text(","); q.breakable()
Rich Laneb658ddd2013-03-12 10:15:10 -07001197 q.text("mask = ");
1198 q.text("%#x" % self.mask)
1199 q.breakable()
1200 q.text('}')
1201
Rich Lane7dcdf022013-12-11 14:45:27 -08001202bsn_header.subtypes[2] = bsn_get_ip_mask_reply
1203
1204class bsn_get_ip_mask_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001205 version = 1
1206 type = 4
1207 experimenter = 6035143
Rich Laneb658ddd2013-03-12 10:15:10 -07001208 subtype = 1
1209
Rich Lanec2ee4b82013-04-24 17:12:38 -07001210 def __init__(self, xid=None, index=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001211 if xid != None:
1212 self.xid = xid
1213 else:
1214 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07001215 if index != None:
1216 self.index = index
1217 else:
1218 self.index = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08001219 return
Rich Laneb658ddd2013-03-12 10:15:10 -07001220
1221 def pack(self):
1222 packed = []
1223 packed.append(struct.pack("!B", self.version))
1224 packed.append(struct.pack("!B", self.type))
1225 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1226 packed.append(struct.pack("!L", self.xid))
1227 packed.append(struct.pack("!L", self.experimenter))
1228 packed.append(struct.pack("!L", self.subtype))
1229 packed.append(struct.pack("!B", self.index))
Rich Lanec2ee4b82013-04-24 17:12:38 -07001230 packed.append('\x00' * 7)
Rich Laneb658ddd2013-03-12 10:15:10 -07001231 length = sum([len(x) for x in packed])
1232 packed[2] = struct.pack("!H", length)
1233 return ''.join(packed)
1234
1235 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001236 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07001237 obj = bsn_get_ip_mask_request()
Dan Talaycof6202252013-07-02 01:00:29 -07001238 _version = reader.read("!B")[0]
1239 assert(_version == 1)
1240 _type = reader.read("!B")[0]
1241 assert(_type == 4)
1242 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001243 orig_reader = reader
1244 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001245 obj.xid = reader.read("!L")[0]
1246 _experimenter = reader.read("!L")[0]
1247 assert(_experimenter == 6035143)
1248 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001249 assert(_subtype == 1)
Dan Talaycof6202252013-07-02 01:00:29 -07001250 obj.index = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001251 reader.skip(7)
Rich Laneb658ddd2013-03-12 10:15:10 -07001252 return obj
1253
1254 def __eq__(self, other):
1255 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07001256 if self.xid != other.xid: return False
1257 if self.index != other.index: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07001258 return True
1259
Rich Laneb658ddd2013-03-12 10:15:10 -07001260 def pretty_print(self, q):
1261 q.text("bsn_get_ip_mask_request {")
1262 with q.group():
1263 with q.indent(2):
1264 q.breakable()
1265 q.text("xid = ");
1266 if self.xid != None:
1267 q.text("%#x" % self.xid)
1268 else:
1269 q.text('None')
1270 q.text(","); q.breakable()
1271 q.text("index = ");
1272 q.text("%#x" % self.index)
Rich Laneb658ddd2013-03-12 10:15:10 -07001273 q.breakable()
1274 q.text('}')
1275
Rich Lane7dcdf022013-12-11 14:45:27 -08001276bsn_header.subtypes[1] = bsn_get_ip_mask_request
1277
1278class bsn_get_l2_table_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001279 version = 1
1280 type = 4
1281 experimenter = 6035143
Rich Lane90c961c2013-05-14 09:26:50 -07001282 subtype = 14
1283
1284 def __init__(self, xid=None, l2_table_enable=None, l2_table_priority=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001285 if xid != None:
1286 self.xid = xid
1287 else:
1288 self.xid = None
Rich Lane90c961c2013-05-14 09:26:50 -07001289 if l2_table_enable != None:
1290 self.l2_table_enable = l2_table_enable
1291 else:
1292 self.l2_table_enable = 0
1293 if l2_table_priority != None:
1294 self.l2_table_priority = l2_table_priority
1295 else:
1296 self.l2_table_priority = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08001297 return
Rich Lane90c961c2013-05-14 09:26:50 -07001298
1299 def pack(self):
1300 packed = []
1301 packed.append(struct.pack("!B", self.version))
1302 packed.append(struct.pack("!B", self.type))
1303 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1304 packed.append(struct.pack("!L", self.xid))
1305 packed.append(struct.pack("!L", self.experimenter))
1306 packed.append(struct.pack("!L", self.subtype))
1307 packed.append(struct.pack("!B", self.l2_table_enable))
1308 packed.append('\x00' * 1)
1309 packed.append(struct.pack("!H", self.l2_table_priority))
1310 packed.append('\x00' * 4)
1311 length = sum([len(x) for x in packed])
1312 packed[2] = struct.pack("!H", length)
1313 return ''.join(packed)
1314
1315 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001316 def unpack(reader):
Rich Lane90c961c2013-05-14 09:26:50 -07001317 obj = bsn_get_l2_table_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07001318 _version = reader.read("!B")[0]
1319 assert(_version == 1)
1320 _type = reader.read("!B")[0]
1321 assert(_type == 4)
1322 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001323 orig_reader = reader
1324 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001325 obj.xid = reader.read("!L")[0]
1326 _experimenter = reader.read("!L")[0]
1327 assert(_experimenter == 6035143)
1328 _subtype = reader.read("!L")[0]
Rich Lane90c961c2013-05-14 09:26:50 -07001329 assert(_subtype == 14)
Dan Talaycof6202252013-07-02 01:00:29 -07001330 obj.l2_table_enable = reader.read("!B")[0]
Rich Lane90c961c2013-05-14 09:26:50 -07001331 reader.skip(1)
Dan Talaycof6202252013-07-02 01:00:29 -07001332 obj.l2_table_priority = reader.read("!H")[0]
Rich Lane90c961c2013-05-14 09:26:50 -07001333 reader.skip(4)
1334 return obj
1335
1336 def __eq__(self, other):
1337 if type(self) != type(other): return False
Rich Lane90c961c2013-05-14 09:26:50 -07001338 if self.xid != other.xid: return False
1339 if self.l2_table_enable != other.l2_table_enable: return False
1340 if self.l2_table_priority != other.l2_table_priority: return False
1341 return True
1342
Rich Lane90c961c2013-05-14 09:26:50 -07001343 def pretty_print(self, q):
1344 q.text("bsn_get_l2_table_reply {")
1345 with q.group():
1346 with q.indent(2):
1347 q.breakable()
1348 q.text("xid = ");
1349 if self.xid != None:
1350 q.text("%#x" % self.xid)
1351 else:
1352 q.text('None')
1353 q.text(","); q.breakable()
1354 q.text("l2_table_enable = ");
1355 q.text("%#x" % self.l2_table_enable)
1356 q.text(","); q.breakable()
1357 q.text("l2_table_priority = ");
1358 q.text("%#x" % self.l2_table_priority)
1359 q.breakable()
1360 q.text('}')
1361
Rich Lane7dcdf022013-12-11 14:45:27 -08001362bsn_header.subtypes[14] = bsn_get_l2_table_reply
1363
1364class bsn_get_l2_table_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001365 version = 1
1366 type = 4
1367 experimenter = 6035143
Rich Lane90c961c2013-05-14 09:26:50 -07001368 subtype = 13
1369
1370 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001371 if xid != None:
1372 self.xid = xid
1373 else:
1374 self.xid = None
1375 return
Rich Lane90c961c2013-05-14 09:26:50 -07001376
1377 def pack(self):
1378 packed = []
1379 packed.append(struct.pack("!B", self.version))
1380 packed.append(struct.pack("!B", self.type))
1381 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1382 packed.append(struct.pack("!L", self.xid))
1383 packed.append(struct.pack("!L", self.experimenter))
1384 packed.append(struct.pack("!L", self.subtype))
1385 length = sum([len(x) for x in packed])
1386 packed[2] = struct.pack("!H", length)
1387 return ''.join(packed)
1388
1389 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001390 def unpack(reader):
Rich Lane90c961c2013-05-14 09:26:50 -07001391 obj = bsn_get_l2_table_request()
Dan Talaycof6202252013-07-02 01:00:29 -07001392 _version = reader.read("!B")[0]
1393 assert(_version == 1)
1394 _type = reader.read("!B")[0]
1395 assert(_type == 4)
1396 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001397 orig_reader = reader
1398 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001399 obj.xid = reader.read("!L")[0]
1400 _experimenter = reader.read("!L")[0]
1401 assert(_experimenter == 6035143)
1402 _subtype = reader.read("!L")[0]
Rich Lane90c961c2013-05-14 09:26:50 -07001403 assert(_subtype == 13)
1404 return obj
1405
1406 def __eq__(self, other):
1407 if type(self) != type(other): return False
Rich Lane90c961c2013-05-14 09:26:50 -07001408 if self.xid != other.xid: return False
1409 return True
1410
Rich Lane90c961c2013-05-14 09:26:50 -07001411 def pretty_print(self, q):
1412 q.text("bsn_get_l2_table_request {")
1413 with q.group():
1414 with q.indent(2):
1415 q.breakable()
1416 q.text("xid = ");
1417 if self.xid != None:
1418 q.text("%#x" % self.xid)
1419 else:
1420 q.text('None')
1421 q.breakable()
1422 q.text('}')
1423
Rich Lane7dcdf022013-12-11 14:45:27 -08001424bsn_header.subtypes[13] = bsn_get_l2_table_request
1425
1426class bsn_get_mirroring_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001427 version = 1
1428 type = 4
1429 experimenter = 6035143
Rich Laneb658ddd2013-03-12 10:15:10 -07001430 subtype = 5
1431
Rich Lanec2ee4b82013-04-24 17:12:38 -07001432 def __init__(self, xid=None, report_mirror_ports=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001433 if xid != None:
1434 self.xid = xid
1435 else:
1436 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07001437 if report_mirror_ports != None:
1438 self.report_mirror_ports = report_mirror_ports
1439 else:
1440 self.report_mirror_ports = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08001441 return
Rich Laneb658ddd2013-03-12 10:15:10 -07001442
1443 def pack(self):
1444 packed = []
1445 packed.append(struct.pack("!B", self.version))
1446 packed.append(struct.pack("!B", self.type))
1447 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1448 packed.append(struct.pack("!L", self.xid))
1449 packed.append(struct.pack("!L", self.experimenter))
1450 packed.append(struct.pack("!L", self.subtype))
1451 packed.append(struct.pack("!B", self.report_mirror_ports))
Rich Lanec2ee4b82013-04-24 17:12:38 -07001452 packed.append('\x00' * 3)
Rich Laneb658ddd2013-03-12 10:15:10 -07001453 length = sum([len(x) for x in packed])
1454 packed[2] = struct.pack("!H", length)
1455 return ''.join(packed)
1456
1457 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001458 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07001459 obj = bsn_get_mirroring_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07001460 _version = reader.read("!B")[0]
1461 assert(_version == 1)
1462 _type = reader.read("!B")[0]
1463 assert(_type == 4)
1464 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001465 orig_reader = reader
1466 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001467 obj.xid = reader.read("!L")[0]
1468 _experimenter = reader.read("!L")[0]
1469 assert(_experimenter == 6035143)
1470 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001471 assert(_subtype == 5)
Dan Talaycof6202252013-07-02 01:00:29 -07001472 obj.report_mirror_ports = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001473 reader.skip(3)
Rich Laneb658ddd2013-03-12 10:15:10 -07001474 return obj
1475
1476 def __eq__(self, other):
1477 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07001478 if self.xid != other.xid: return False
1479 if self.report_mirror_ports != other.report_mirror_ports: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07001480 return True
1481
Rich Laneb658ddd2013-03-12 10:15:10 -07001482 def pretty_print(self, q):
1483 q.text("bsn_get_mirroring_reply {")
1484 with q.group():
1485 with q.indent(2):
1486 q.breakable()
1487 q.text("xid = ");
1488 if self.xid != None:
1489 q.text("%#x" % self.xid)
1490 else:
1491 q.text('None')
1492 q.text(","); q.breakable()
1493 q.text("report_mirror_ports = ");
1494 q.text("%#x" % self.report_mirror_ports)
Rich Laneb658ddd2013-03-12 10:15:10 -07001495 q.breakable()
1496 q.text('}')
1497
Rich Lane7dcdf022013-12-11 14:45:27 -08001498bsn_header.subtypes[5] = bsn_get_mirroring_reply
1499
1500class bsn_get_mirroring_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001501 version = 1
1502 type = 4
1503 experimenter = 6035143
Rich Laneb658ddd2013-03-12 10:15:10 -07001504 subtype = 4
1505
Rich Lanec2ee4b82013-04-24 17:12:38 -07001506 def __init__(self, xid=None, report_mirror_ports=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001507 if xid != None:
1508 self.xid = xid
1509 else:
1510 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07001511 if report_mirror_ports != None:
1512 self.report_mirror_ports = report_mirror_ports
1513 else:
1514 self.report_mirror_ports = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08001515 return
Rich Laneb658ddd2013-03-12 10:15:10 -07001516
1517 def pack(self):
1518 packed = []
1519 packed.append(struct.pack("!B", self.version))
1520 packed.append(struct.pack("!B", self.type))
1521 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1522 packed.append(struct.pack("!L", self.xid))
1523 packed.append(struct.pack("!L", self.experimenter))
1524 packed.append(struct.pack("!L", self.subtype))
1525 packed.append(struct.pack("!B", self.report_mirror_ports))
Rich Lanec2ee4b82013-04-24 17:12:38 -07001526 packed.append('\x00' * 3)
Rich Laneb658ddd2013-03-12 10:15:10 -07001527 length = sum([len(x) for x in packed])
1528 packed[2] = struct.pack("!H", length)
1529 return ''.join(packed)
1530
1531 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001532 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07001533 obj = bsn_get_mirroring_request()
Dan Talaycof6202252013-07-02 01:00:29 -07001534 _version = reader.read("!B")[0]
1535 assert(_version == 1)
1536 _type = reader.read("!B")[0]
1537 assert(_type == 4)
1538 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001539 orig_reader = reader
1540 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001541 obj.xid = reader.read("!L")[0]
1542 _experimenter = reader.read("!L")[0]
1543 assert(_experimenter == 6035143)
1544 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001545 assert(_subtype == 4)
Dan Talaycof6202252013-07-02 01:00:29 -07001546 obj.report_mirror_ports = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001547 reader.skip(3)
Rich Laneb658ddd2013-03-12 10:15:10 -07001548 return obj
1549
1550 def __eq__(self, other):
1551 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07001552 if self.xid != other.xid: return False
1553 if self.report_mirror_ports != other.report_mirror_ports: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07001554 return True
1555
Rich Laneb658ddd2013-03-12 10:15:10 -07001556 def pretty_print(self, q):
1557 q.text("bsn_get_mirroring_request {")
1558 with q.group():
1559 with q.indent(2):
1560 q.breakable()
1561 q.text("xid = ");
1562 if self.xid != None:
1563 q.text("%#x" % self.xid)
1564 else:
1565 q.text('None')
1566 q.text(","); q.breakable()
1567 q.text("report_mirror_ports = ");
1568 q.text("%#x" % self.report_mirror_ports)
Rich Laneb658ddd2013-03-12 10:15:10 -07001569 q.breakable()
1570 q.text('}')
1571
Rich Lane7dcdf022013-12-11 14:45:27 -08001572bsn_header.subtypes[4] = bsn_get_mirroring_request
1573
1574class bsn_hybrid_get_reply(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07001575 version = 1
1576 type = 4
1577 experimenter = 6035143
1578 subtype = 28
1579
1580 def __init__(self, xid=None, hybrid_enable=None, hybrid_version=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001581 if xid != None:
1582 self.xid = xid
1583 else:
1584 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07001585 if hybrid_enable != None:
1586 self.hybrid_enable = hybrid_enable
1587 else:
1588 self.hybrid_enable = 0
1589 if hybrid_version != None:
1590 self.hybrid_version = hybrid_version
1591 else:
1592 self.hybrid_version = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08001593 return
Rich Lane6f4978c2013-10-20 21:33:52 -07001594
1595 def pack(self):
1596 packed = []
1597 packed.append(struct.pack("!B", self.version))
1598 packed.append(struct.pack("!B", self.type))
1599 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1600 packed.append(struct.pack("!L", self.xid))
1601 packed.append(struct.pack("!L", self.experimenter))
1602 packed.append(struct.pack("!L", self.subtype))
1603 packed.append(struct.pack("!B", self.hybrid_enable))
1604 packed.append('\x00' * 1)
1605 packed.append(struct.pack("!H", self.hybrid_version))
1606 packed.append('\x00' * 4)
1607 length = sum([len(x) for x in packed])
1608 packed[2] = struct.pack("!H", length)
1609 return ''.join(packed)
1610
1611 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001612 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07001613 obj = bsn_hybrid_get_reply()
Rich Lane6f4978c2013-10-20 21:33:52 -07001614 _version = reader.read("!B")[0]
1615 assert(_version == 1)
1616 _type = reader.read("!B")[0]
1617 assert(_type == 4)
1618 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001619 orig_reader = reader
1620 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07001621 obj.xid = reader.read("!L")[0]
1622 _experimenter = reader.read("!L")[0]
1623 assert(_experimenter == 6035143)
1624 _subtype = reader.read("!L")[0]
1625 assert(_subtype == 28)
1626 obj.hybrid_enable = reader.read("!B")[0]
1627 reader.skip(1)
1628 obj.hybrid_version = reader.read("!H")[0]
1629 reader.skip(4)
1630 return obj
1631
1632 def __eq__(self, other):
1633 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07001634 if self.xid != other.xid: return False
1635 if self.hybrid_enable != other.hybrid_enable: return False
1636 if self.hybrid_version != other.hybrid_version: return False
1637 return True
1638
Rich Lane6f4978c2013-10-20 21:33:52 -07001639 def pretty_print(self, q):
1640 q.text("bsn_hybrid_get_reply {")
1641 with q.group():
1642 with q.indent(2):
1643 q.breakable()
1644 q.text("xid = ");
1645 if self.xid != None:
1646 q.text("%#x" % self.xid)
1647 else:
1648 q.text('None')
1649 q.text(","); q.breakable()
1650 q.text("hybrid_enable = ");
1651 q.text("%#x" % self.hybrid_enable)
1652 q.text(","); q.breakable()
1653 q.text("hybrid_version = ");
1654 q.text("%#x" % self.hybrid_version)
1655 q.breakable()
1656 q.text('}')
1657
Rich Lane7dcdf022013-12-11 14:45:27 -08001658bsn_header.subtypes[28] = bsn_hybrid_get_reply
1659
1660class bsn_hybrid_get_request(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07001661 version = 1
1662 type = 4
1663 experimenter = 6035143
1664 subtype = 27
1665
1666 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001667 if xid != None:
1668 self.xid = xid
1669 else:
1670 self.xid = None
1671 return
Rich Lane6f4978c2013-10-20 21:33:52 -07001672
1673 def pack(self):
1674 packed = []
1675 packed.append(struct.pack("!B", self.version))
1676 packed.append(struct.pack("!B", self.type))
1677 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1678 packed.append(struct.pack("!L", self.xid))
1679 packed.append(struct.pack("!L", self.experimenter))
1680 packed.append(struct.pack("!L", self.subtype))
1681 length = sum([len(x) for x in packed])
1682 packed[2] = struct.pack("!H", length)
1683 return ''.join(packed)
1684
1685 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001686 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07001687 obj = bsn_hybrid_get_request()
Rich Lane6f4978c2013-10-20 21:33:52 -07001688 _version = reader.read("!B")[0]
1689 assert(_version == 1)
1690 _type = reader.read("!B")[0]
1691 assert(_type == 4)
1692 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001693 orig_reader = reader
1694 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07001695 obj.xid = reader.read("!L")[0]
1696 _experimenter = reader.read("!L")[0]
1697 assert(_experimenter == 6035143)
1698 _subtype = reader.read("!L")[0]
1699 assert(_subtype == 27)
1700 return obj
1701
1702 def __eq__(self, other):
1703 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07001704 if self.xid != other.xid: return False
1705 return True
1706
Rich Lane6f4978c2013-10-20 21:33:52 -07001707 def pretty_print(self, q):
1708 q.text("bsn_hybrid_get_request {")
1709 with q.group():
1710 with q.indent(2):
1711 q.breakable()
1712 q.text("xid = ");
1713 if self.xid != None:
1714 q.text("%#x" % self.xid)
1715 else:
1716 q.text('None')
1717 q.breakable()
1718 q.text('}')
1719
Rich Lane7dcdf022013-12-11 14:45:27 -08001720bsn_header.subtypes[27] = bsn_hybrid_get_request
1721
1722class bsn_pdu_rx_reply(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07001723 version = 1
1724 type = 4
1725 experimenter = 6035143
1726 subtype = 34
1727
Rich Lane7b0f2012013-11-22 14:15:26 -08001728 def __init__(self, xid=None, status=None, port_no=None, slot_num=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001729 if xid != None:
1730 self.xid = xid
1731 else:
1732 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07001733 if status != None:
1734 self.status = status
1735 else:
1736 self.status = 0
Rich Lane7b0f2012013-11-22 14:15:26 -08001737 if port_no != None:
1738 self.port_no = port_no
1739 else:
1740 self.port_no = 0
1741 if slot_num != None:
1742 self.slot_num = slot_num
1743 else:
1744 self.slot_num = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08001745 return
Rich Lane6f4978c2013-10-20 21:33:52 -07001746
1747 def pack(self):
1748 packed = []
1749 packed.append(struct.pack("!B", self.version))
1750 packed.append(struct.pack("!B", self.type))
1751 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1752 packed.append(struct.pack("!L", self.xid))
1753 packed.append(struct.pack("!L", self.experimenter))
1754 packed.append(struct.pack("!L", self.subtype))
1755 packed.append(struct.pack("!L", self.status))
Rich Lane7b0f2012013-11-22 14:15:26 -08001756 packed.append(util.pack_port_no(self.port_no))
1757 packed.append(struct.pack("!B", self.slot_num))
Rich Lane6f4978c2013-10-20 21:33:52 -07001758 length = sum([len(x) for x in packed])
1759 packed[2] = struct.pack("!H", length)
1760 return ''.join(packed)
1761
1762 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001763 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07001764 obj = bsn_pdu_rx_reply()
Rich Lane6f4978c2013-10-20 21:33:52 -07001765 _version = reader.read("!B")[0]
1766 assert(_version == 1)
1767 _type = reader.read("!B")[0]
1768 assert(_type == 4)
1769 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001770 orig_reader = reader
1771 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07001772 obj.xid = reader.read("!L")[0]
1773 _experimenter = reader.read("!L")[0]
1774 assert(_experimenter == 6035143)
1775 _subtype = reader.read("!L")[0]
1776 assert(_subtype == 34)
1777 obj.status = reader.read("!L")[0]
Rich Lane7b0f2012013-11-22 14:15:26 -08001778 obj.port_no = util.unpack_port_no(reader)
1779 obj.slot_num = reader.read("!B")[0]
Rich Lane6f4978c2013-10-20 21:33:52 -07001780 return obj
1781
1782 def __eq__(self, other):
1783 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07001784 if self.xid != other.xid: return False
1785 if self.status != other.status: return False
Rich Lane7b0f2012013-11-22 14:15:26 -08001786 if self.port_no != other.port_no: return False
1787 if self.slot_num != other.slot_num: return False
Rich Lane6f4978c2013-10-20 21:33:52 -07001788 return True
1789
Rich Lane6f4978c2013-10-20 21:33:52 -07001790 def pretty_print(self, q):
1791 q.text("bsn_pdu_rx_reply {")
1792 with q.group():
1793 with q.indent(2):
1794 q.breakable()
1795 q.text("xid = ");
1796 if self.xid != None:
1797 q.text("%#x" % self.xid)
1798 else:
1799 q.text('None')
1800 q.text(","); q.breakable()
1801 q.text("status = ");
1802 q.text("%#x" % self.status)
Rich Lane7b0f2012013-11-22 14:15:26 -08001803 q.text(","); q.breakable()
1804 q.text("port_no = ");
1805 q.text(util.pretty_port(self.port_no))
1806 q.text(","); q.breakable()
1807 q.text("slot_num = ");
1808 q.text("%#x" % self.slot_num)
Rich Lane6f4978c2013-10-20 21:33:52 -07001809 q.breakable()
1810 q.text('}')
1811
Rich Lane7dcdf022013-12-11 14:45:27 -08001812bsn_header.subtypes[34] = bsn_pdu_rx_reply
1813
1814class bsn_pdu_rx_request(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07001815 version = 1
1816 type = 4
1817 experimenter = 6035143
1818 subtype = 33
1819
1820 def __init__(self, xid=None, timeout_ms=None, port_no=None, slot_num=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001821 if xid != None:
1822 self.xid = xid
1823 else:
1824 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07001825 if timeout_ms != None:
1826 self.timeout_ms = timeout_ms
1827 else:
1828 self.timeout_ms = 0
1829 if port_no != None:
1830 self.port_no = port_no
1831 else:
1832 self.port_no = 0
1833 if slot_num != None:
1834 self.slot_num = slot_num
1835 else:
1836 self.slot_num = 0
1837 if data != None:
1838 self.data = data
1839 else:
1840 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08001841 return
Rich Lane6f4978c2013-10-20 21:33:52 -07001842
1843 def pack(self):
1844 packed = []
1845 packed.append(struct.pack("!B", self.version))
1846 packed.append(struct.pack("!B", self.type))
1847 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1848 packed.append(struct.pack("!L", self.xid))
1849 packed.append(struct.pack("!L", self.experimenter))
1850 packed.append(struct.pack("!L", self.subtype))
1851 packed.append(struct.pack("!L", self.timeout_ms))
1852 packed.append(util.pack_port_no(self.port_no))
1853 packed.append(struct.pack("!B", self.slot_num))
1854 packed.append('\x00' * 3)
1855 packed.append(self.data)
1856 length = sum([len(x) for x in packed])
1857 packed[2] = struct.pack("!H", length)
1858 return ''.join(packed)
1859
1860 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001861 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07001862 obj = bsn_pdu_rx_request()
Rich Lane6f4978c2013-10-20 21:33:52 -07001863 _version = reader.read("!B")[0]
1864 assert(_version == 1)
1865 _type = reader.read("!B")[0]
1866 assert(_type == 4)
1867 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001868 orig_reader = reader
1869 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07001870 obj.xid = reader.read("!L")[0]
1871 _experimenter = reader.read("!L")[0]
1872 assert(_experimenter == 6035143)
1873 _subtype = reader.read("!L")[0]
1874 assert(_subtype == 33)
1875 obj.timeout_ms = reader.read("!L")[0]
1876 obj.port_no = util.unpack_port_no(reader)
1877 obj.slot_num = reader.read("!B")[0]
1878 reader.skip(3)
1879 obj.data = str(reader.read_all())
1880 return obj
1881
1882 def __eq__(self, other):
1883 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07001884 if self.xid != other.xid: return False
1885 if self.timeout_ms != other.timeout_ms: return False
1886 if self.port_no != other.port_no: return False
1887 if self.slot_num != other.slot_num: return False
1888 if self.data != other.data: return False
1889 return True
1890
Rich Lane6f4978c2013-10-20 21:33:52 -07001891 def pretty_print(self, q):
1892 q.text("bsn_pdu_rx_request {")
1893 with q.group():
1894 with q.indent(2):
1895 q.breakable()
1896 q.text("xid = ");
1897 if self.xid != None:
1898 q.text("%#x" % self.xid)
1899 else:
1900 q.text('None')
1901 q.text(","); q.breakable()
1902 q.text("timeout_ms = ");
1903 q.text("%#x" % self.timeout_ms)
1904 q.text(","); q.breakable()
1905 q.text("port_no = ");
1906 q.text(util.pretty_port(self.port_no))
1907 q.text(","); q.breakable()
1908 q.text("slot_num = ");
1909 q.text("%#x" % self.slot_num)
1910 q.text(","); q.breakable()
1911 q.text("data = ");
1912 q.pp(self.data)
1913 q.breakable()
1914 q.text('}')
1915
Rich Lane7dcdf022013-12-11 14:45:27 -08001916bsn_header.subtypes[33] = bsn_pdu_rx_request
1917
1918class bsn_pdu_rx_timeout(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07001919 version = 1
1920 type = 4
1921 experimenter = 6035143
1922 subtype = 35
1923
1924 def __init__(self, xid=None, port_no=None, slot_num=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001925 if xid != None:
1926 self.xid = xid
1927 else:
1928 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07001929 if port_no != None:
1930 self.port_no = port_no
1931 else:
1932 self.port_no = 0
1933 if slot_num != None:
1934 self.slot_num = slot_num
1935 else:
1936 self.slot_num = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08001937 return
Rich Lane6f4978c2013-10-20 21:33:52 -07001938
1939 def pack(self):
1940 packed = []
1941 packed.append(struct.pack("!B", self.version))
1942 packed.append(struct.pack("!B", self.type))
1943 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1944 packed.append(struct.pack("!L", self.xid))
1945 packed.append(struct.pack("!L", self.experimenter))
1946 packed.append(struct.pack("!L", self.subtype))
1947 packed.append(util.pack_port_no(self.port_no))
1948 packed.append(struct.pack("!B", self.slot_num))
1949 length = sum([len(x) for x in packed])
1950 packed[2] = struct.pack("!H", length)
1951 return ''.join(packed)
1952
1953 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001954 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07001955 obj = bsn_pdu_rx_timeout()
Rich Lane6f4978c2013-10-20 21:33:52 -07001956 _version = reader.read("!B")[0]
1957 assert(_version == 1)
1958 _type = reader.read("!B")[0]
1959 assert(_type == 4)
1960 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001961 orig_reader = reader
1962 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07001963 obj.xid = reader.read("!L")[0]
1964 _experimenter = reader.read("!L")[0]
1965 assert(_experimenter == 6035143)
1966 _subtype = reader.read("!L")[0]
1967 assert(_subtype == 35)
1968 obj.port_no = util.unpack_port_no(reader)
1969 obj.slot_num = reader.read("!B")[0]
1970 return obj
1971
1972 def __eq__(self, other):
1973 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07001974 if self.xid != other.xid: return False
1975 if self.port_no != other.port_no: return False
1976 if self.slot_num != other.slot_num: return False
1977 return True
1978
Rich Lane6f4978c2013-10-20 21:33:52 -07001979 def pretty_print(self, q):
1980 q.text("bsn_pdu_rx_timeout {")
1981 with q.group():
1982 with q.indent(2):
1983 q.breakable()
1984 q.text("xid = ");
1985 if self.xid != None:
1986 q.text("%#x" % self.xid)
1987 else:
1988 q.text('None')
1989 q.text(","); q.breakable()
1990 q.text("port_no = ");
1991 q.text(util.pretty_port(self.port_no))
1992 q.text(","); q.breakable()
1993 q.text("slot_num = ");
1994 q.text("%#x" % self.slot_num)
1995 q.breakable()
1996 q.text('}')
1997
Rich Lane7dcdf022013-12-11 14:45:27 -08001998bsn_header.subtypes[35] = bsn_pdu_rx_timeout
1999
2000class bsn_pdu_tx_reply(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07002001 version = 1
2002 type = 4
2003 experimenter = 6035143
2004 subtype = 32
2005
Rich Lane7b0f2012013-11-22 14:15:26 -08002006 def __init__(self, xid=None, status=None, port_no=None, slot_num=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002007 if xid != None:
2008 self.xid = xid
2009 else:
2010 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07002011 if status != None:
2012 self.status = status
2013 else:
2014 self.status = 0
Rich Lane7b0f2012013-11-22 14:15:26 -08002015 if port_no != None:
2016 self.port_no = port_no
2017 else:
2018 self.port_no = 0
2019 if slot_num != None:
2020 self.slot_num = slot_num
2021 else:
2022 self.slot_num = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08002023 return
Rich Lane6f4978c2013-10-20 21:33:52 -07002024
2025 def pack(self):
2026 packed = []
2027 packed.append(struct.pack("!B", self.version))
2028 packed.append(struct.pack("!B", self.type))
2029 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2030 packed.append(struct.pack("!L", self.xid))
2031 packed.append(struct.pack("!L", self.experimenter))
2032 packed.append(struct.pack("!L", self.subtype))
2033 packed.append(struct.pack("!L", self.status))
Rich Lane7b0f2012013-11-22 14:15:26 -08002034 packed.append(util.pack_port_no(self.port_no))
2035 packed.append(struct.pack("!B", self.slot_num))
Rich Lane6f4978c2013-10-20 21:33:52 -07002036 length = sum([len(x) for x in packed])
2037 packed[2] = struct.pack("!H", length)
2038 return ''.join(packed)
2039
2040 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002041 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07002042 obj = bsn_pdu_tx_reply()
Rich Lane6f4978c2013-10-20 21:33:52 -07002043 _version = reader.read("!B")[0]
2044 assert(_version == 1)
2045 _type = reader.read("!B")[0]
2046 assert(_type == 4)
2047 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002048 orig_reader = reader
2049 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07002050 obj.xid = reader.read("!L")[0]
2051 _experimenter = reader.read("!L")[0]
2052 assert(_experimenter == 6035143)
2053 _subtype = reader.read("!L")[0]
2054 assert(_subtype == 32)
2055 obj.status = reader.read("!L")[0]
Rich Lane7b0f2012013-11-22 14:15:26 -08002056 obj.port_no = util.unpack_port_no(reader)
2057 obj.slot_num = reader.read("!B")[0]
Rich Lane6f4978c2013-10-20 21:33:52 -07002058 return obj
2059
2060 def __eq__(self, other):
2061 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07002062 if self.xid != other.xid: return False
2063 if self.status != other.status: return False
Rich Lane7b0f2012013-11-22 14:15:26 -08002064 if self.port_no != other.port_no: return False
2065 if self.slot_num != other.slot_num: return False
Rich Lane6f4978c2013-10-20 21:33:52 -07002066 return True
2067
Rich Lane6f4978c2013-10-20 21:33:52 -07002068 def pretty_print(self, q):
2069 q.text("bsn_pdu_tx_reply {")
2070 with q.group():
2071 with q.indent(2):
2072 q.breakable()
2073 q.text("xid = ");
2074 if self.xid != None:
2075 q.text("%#x" % self.xid)
2076 else:
2077 q.text('None')
2078 q.text(","); q.breakable()
2079 q.text("status = ");
2080 q.text("%#x" % self.status)
Rich Lane7b0f2012013-11-22 14:15:26 -08002081 q.text(","); q.breakable()
2082 q.text("port_no = ");
2083 q.text(util.pretty_port(self.port_no))
2084 q.text(","); q.breakable()
2085 q.text("slot_num = ");
2086 q.text("%#x" % self.slot_num)
Rich Lane6f4978c2013-10-20 21:33:52 -07002087 q.breakable()
2088 q.text('}')
2089
Rich Lane7dcdf022013-12-11 14:45:27 -08002090bsn_header.subtypes[32] = bsn_pdu_tx_reply
2091
2092class bsn_pdu_tx_request(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07002093 version = 1
2094 type = 4
2095 experimenter = 6035143
2096 subtype = 31
2097
2098 def __init__(self, xid=None, tx_interval_ms=None, port_no=None, slot_num=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002099 if xid != None:
2100 self.xid = xid
2101 else:
2102 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07002103 if tx_interval_ms != None:
2104 self.tx_interval_ms = tx_interval_ms
2105 else:
2106 self.tx_interval_ms = 0
2107 if port_no != None:
2108 self.port_no = port_no
2109 else:
2110 self.port_no = 0
2111 if slot_num != None:
2112 self.slot_num = slot_num
2113 else:
2114 self.slot_num = 0
2115 if data != None:
2116 self.data = data
2117 else:
2118 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08002119 return
Rich Lane6f4978c2013-10-20 21:33:52 -07002120
2121 def pack(self):
2122 packed = []
2123 packed.append(struct.pack("!B", self.version))
2124 packed.append(struct.pack("!B", self.type))
2125 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2126 packed.append(struct.pack("!L", self.xid))
2127 packed.append(struct.pack("!L", self.experimenter))
2128 packed.append(struct.pack("!L", self.subtype))
2129 packed.append(struct.pack("!L", self.tx_interval_ms))
2130 packed.append(util.pack_port_no(self.port_no))
2131 packed.append(struct.pack("!B", self.slot_num))
2132 packed.append('\x00' * 3)
2133 packed.append(self.data)
2134 length = sum([len(x) for x in packed])
2135 packed[2] = struct.pack("!H", length)
2136 return ''.join(packed)
2137
2138 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002139 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07002140 obj = bsn_pdu_tx_request()
Rich Lane6f4978c2013-10-20 21:33:52 -07002141 _version = reader.read("!B")[0]
2142 assert(_version == 1)
2143 _type = reader.read("!B")[0]
2144 assert(_type == 4)
2145 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002146 orig_reader = reader
2147 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07002148 obj.xid = reader.read("!L")[0]
2149 _experimenter = reader.read("!L")[0]
2150 assert(_experimenter == 6035143)
2151 _subtype = reader.read("!L")[0]
2152 assert(_subtype == 31)
2153 obj.tx_interval_ms = reader.read("!L")[0]
2154 obj.port_no = util.unpack_port_no(reader)
2155 obj.slot_num = reader.read("!B")[0]
2156 reader.skip(3)
2157 obj.data = str(reader.read_all())
2158 return obj
2159
2160 def __eq__(self, other):
2161 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07002162 if self.xid != other.xid: return False
2163 if self.tx_interval_ms != other.tx_interval_ms: return False
2164 if self.port_no != other.port_no: return False
2165 if self.slot_num != other.slot_num: return False
2166 if self.data != other.data: return False
2167 return True
2168
Rich Lane6f4978c2013-10-20 21:33:52 -07002169 def pretty_print(self, q):
2170 q.text("bsn_pdu_tx_request {")
2171 with q.group():
2172 with q.indent(2):
2173 q.breakable()
2174 q.text("xid = ");
2175 if self.xid != None:
2176 q.text("%#x" % self.xid)
2177 else:
2178 q.text('None')
2179 q.text(","); q.breakable()
2180 q.text("tx_interval_ms = ");
2181 q.text("%#x" % self.tx_interval_ms)
2182 q.text(","); q.breakable()
2183 q.text("port_no = ");
2184 q.text(util.pretty_port(self.port_no))
2185 q.text(","); q.breakable()
2186 q.text("slot_num = ");
2187 q.text("%#x" % self.slot_num)
2188 q.text(","); q.breakable()
2189 q.text("data = ");
2190 q.pp(self.data)
2191 q.breakable()
2192 q.text('}')
2193
Rich Lane7dcdf022013-12-11 14:45:27 -08002194bsn_header.subtypes[31] = bsn_pdu_tx_request
2195
2196class bsn_set_ip_mask(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07002197 version = 1
2198 type = 4
2199 experimenter = 6035143
Rich Laneb658ddd2013-03-12 10:15:10 -07002200 subtype = 0
2201
Rich Lanec2ee4b82013-04-24 17:12:38 -07002202 def __init__(self, xid=None, index=None, mask=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002203 if xid != None:
2204 self.xid = xid
2205 else:
2206 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07002207 if index != None:
2208 self.index = index
2209 else:
2210 self.index = 0
Rich Laneb658ddd2013-03-12 10:15:10 -07002211 if mask != None:
2212 self.mask = mask
2213 else:
2214 self.mask = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08002215 return
Rich Laneb658ddd2013-03-12 10:15:10 -07002216
2217 def pack(self):
2218 packed = []
2219 packed.append(struct.pack("!B", self.version))
2220 packed.append(struct.pack("!B", self.type))
2221 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2222 packed.append(struct.pack("!L", self.xid))
2223 packed.append(struct.pack("!L", self.experimenter))
2224 packed.append(struct.pack("!L", self.subtype))
2225 packed.append(struct.pack("!B", self.index))
Rich Lanec2ee4b82013-04-24 17:12:38 -07002226 packed.append('\x00' * 3)
Rich Laneb658ddd2013-03-12 10:15:10 -07002227 packed.append(struct.pack("!L", self.mask))
2228 length = sum([len(x) for x in packed])
2229 packed[2] = struct.pack("!H", length)
2230 return ''.join(packed)
2231
2232 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002233 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07002234 obj = bsn_set_ip_mask()
Dan Talaycof6202252013-07-02 01:00:29 -07002235 _version = reader.read("!B")[0]
2236 assert(_version == 1)
2237 _type = reader.read("!B")[0]
2238 assert(_type == 4)
2239 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002240 orig_reader = reader
2241 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07002242 obj.xid = reader.read("!L")[0]
2243 _experimenter = reader.read("!L")[0]
2244 assert(_experimenter == 6035143)
2245 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07002246 assert(_subtype == 0)
Dan Talaycof6202252013-07-02 01:00:29 -07002247 obj.index = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07002248 reader.skip(3)
Dan Talaycof6202252013-07-02 01:00:29 -07002249 obj.mask = reader.read("!L")[0]
Rich Laneb658ddd2013-03-12 10:15:10 -07002250 return obj
2251
2252 def __eq__(self, other):
2253 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07002254 if self.xid != other.xid: return False
2255 if self.index != other.index: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07002256 if self.mask != other.mask: return False
2257 return True
2258
Rich Laneb658ddd2013-03-12 10:15:10 -07002259 def pretty_print(self, q):
2260 q.text("bsn_set_ip_mask {")
2261 with q.group():
2262 with q.indent(2):
2263 q.breakable()
2264 q.text("xid = ");
2265 if self.xid != None:
2266 q.text("%#x" % self.xid)
2267 else:
2268 q.text('None')
2269 q.text(","); q.breakable()
2270 q.text("index = ");
2271 q.text("%#x" % self.index)
2272 q.text(","); q.breakable()
Rich Laneb658ddd2013-03-12 10:15:10 -07002273 q.text("mask = ");
2274 q.text("%#x" % self.mask)
2275 q.breakable()
2276 q.text('}')
2277
Rich Lane7dcdf022013-12-11 14:45:27 -08002278bsn_header.subtypes[0] = bsn_set_ip_mask
2279
2280class bsn_set_l2_table_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07002281 version = 1
2282 type = 4
2283 experimenter = 6035143
2284 subtype = 24
2285
2286 def __init__(self, xid=None, l2_table_enable=None, l2_table_priority=None, status=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002287 if xid != None:
2288 self.xid = xid
2289 else:
2290 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07002291 if l2_table_enable != None:
2292 self.l2_table_enable = l2_table_enable
2293 else:
2294 self.l2_table_enable = 0
2295 if l2_table_priority != None:
2296 self.l2_table_priority = l2_table_priority
2297 else:
2298 self.l2_table_priority = 0
2299 if status != None:
2300 self.status = status
2301 else:
2302 self.status = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08002303 return
Dan Talaycof6202252013-07-02 01:00:29 -07002304
2305 def pack(self):
2306 packed = []
2307 packed.append(struct.pack("!B", self.version))
2308 packed.append(struct.pack("!B", self.type))
2309 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2310 packed.append(struct.pack("!L", self.xid))
2311 packed.append(struct.pack("!L", self.experimenter))
2312 packed.append(struct.pack("!L", self.subtype))
2313 packed.append(struct.pack("!B", self.l2_table_enable))
2314 packed.append('\x00' * 1)
2315 packed.append(struct.pack("!H", self.l2_table_priority))
2316 packed.append(struct.pack("!L", self.status))
2317 length = sum([len(x) for x in packed])
2318 packed[2] = struct.pack("!H", length)
2319 return ''.join(packed)
2320
2321 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002322 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07002323 obj = bsn_set_l2_table_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07002324 _version = reader.read("!B")[0]
2325 assert(_version == 1)
2326 _type = reader.read("!B")[0]
2327 assert(_type == 4)
2328 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002329 orig_reader = reader
2330 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07002331 obj.xid = reader.read("!L")[0]
2332 _experimenter = reader.read("!L")[0]
2333 assert(_experimenter == 6035143)
2334 _subtype = reader.read("!L")[0]
2335 assert(_subtype == 24)
2336 obj.l2_table_enable = reader.read("!B")[0]
2337 reader.skip(1)
2338 obj.l2_table_priority = reader.read("!H")[0]
2339 obj.status = reader.read("!L")[0]
2340 return obj
2341
2342 def __eq__(self, other):
2343 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07002344 if self.xid != other.xid: return False
2345 if self.l2_table_enable != other.l2_table_enable: return False
2346 if self.l2_table_priority != other.l2_table_priority: return False
2347 if self.status != other.status: return False
2348 return True
2349
Dan Talaycof6202252013-07-02 01:00:29 -07002350 def pretty_print(self, q):
2351 q.text("bsn_set_l2_table_reply {")
2352 with q.group():
2353 with q.indent(2):
2354 q.breakable()
2355 q.text("xid = ");
2356 if self.xid != None:
2357 q.text("%#x" % self.xid)
2358 else:
2359 q.text('None')
2360 q.text(","); q.breakable()
2361 q.text("l2_table_enable = ");
2362 q.text("%#x" % self.l2_table_enable)
2363 q.text(","); q.breakable()
2364 q.text("l2_table_priority = ");
2365 q.text("%#x" % self.l2_table_priority)
2366 q.text(","); q.breakable()
2367 q.text("status = ");
2368 q.text("%#x" % self.status)
2369 q.breakable()
2370 q.text('}')
2371
Rich Lane7dcdf022013-12-11 14:45:27 -08002372bsn_header.subtypes[24] = bsn_set_l2_table_reply
2373
2374class bsn_set_l2_table_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07002375 version = 1
2376 type = 4
2377 experimenter = 6035143
Rich Lane90c961c2013-05-14 09:26:50 -07002378 subtype = 12
2379
2380 def __init__(self, xid=None, l2_table_enable=None, l2_table_priority=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002381 if xid != None:
2382 self.xid = xid
2383 else:
2384 self.xid = None
Rich Lane90c961c2013-05-14 09:26:50 -07002385 if l2_table_enable != None:
2386 self.l2_table_enable = l2_table_enable
2387 else:
2388 self.l2_table_enable = 0
2389 if l2_table_priority != None:
2390 self.l2_table_priority = l2_table_priority
2391 else:
2392 self.l2_table_priority = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08002393 return
Rich Lane90c961c2013-05-14 09:26:50 -07002394
2395 def pack(self):
2396 packed = []
2397 packed.append(struct.pack("!B", self.version))
2398 packed.append(struct.pack("!B", self.type))
2399 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2400 packed.append(struct.pack("!L", self.xid))
2401 packed.append(struct.pack("!L", self.experimenter))
2402 packed.append(struct.pack("!L", self.subtype))
2403 packed.append(struct.pack("!B", self.l2_table_enable))
2404 packed.append('\x00' * 1)
2405 packed.append(struct.pack("!H", self.l2_table_priority))
2406 packed.append('\x00' * 4)
2407 length = sum([len(x) for x in packed])
2408 packed[2] = struct.pack("!H", length)
2409 return ''.join(packed)
2410
2411 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002412 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07002413 obj = bsn_set_l2_table_request()
Dan Talaycof6202252013-07-02 01:00:29 -07002414 _version = reader.read("!B")[0]
2415 assert(_version == 1)
2416 _type = reader.read("!B")[0]
2417 assert(_type == 4)
2418 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002419 orig_reader = reader
2420 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07002421 obj.xid = reader.read("!L")[0]
2422 _experimenter = reader.read("!L")[0]
2423 assert(_experimenter == 6035143)
2424 _subtype = reader.read("!L")[0]
Rich Lane90c961c2013-05-14 09:26:50 -07002425 assert(_subtype == 12)
Dan Talaycof6202252013-07-02 01:00:29 -07002426 obj.l2_table_enable = reader.read("!B")[0]
Rich Lane90c961c2013-05-14 09:26:50 -07002427 reader.skip(1)
Dan Talaycof6202252013-07-02 01:00:29 -07002428 obj.l2_table_priority = reader.read("!H")[0]
Rich Lane90c961c2013-05-14 09:26:50 -07002429 reader.skip(4)
2430 return obj
2431
2432 def __eq__(self, other):
2433 if type(self) != type(other): return False
Rich Lane90c961c2013-05-14 09:26:50 -07002434 if self.xid != other.xid: return False
2435 if self.l2_table_enable != other.l2_table_enable: return False
2436 if self.l2_table_priority != other.l2_table_priority: return False
2437 return True
2438
Rich Lane90c961c2013-05-14 09:26:50 -07002439 def pretty_print(self, q):
Dan Talaycof6202252013-07-02 01:00:29 -07002440 q.text("bsn_set_l2_table_request {")
Rich Lane90c961c2013-05-14 09:26:50 -07002441 with q.group():
2442 with q.indent(2):
2443 q.breakable()
2444 q.text("xid = ");
2445 if self.xid != None:
2446 q.text("%#x" % self.xid)
2447 else:
2448 q.text('None')
2449 q.text(","); q.breakable()
2450 q.text("l2_table_enable = ");
2451 q.text("%#x" % self.l2_table_enable)
2452 q.text(","); q.breakable()
2453 q.text("l2_table_priority = ");
2454 q.text("%#x" % self.l2_table_priority)
2455 q.breakable()
2456 q.text('}')
2457
Rich Lane7dcdf022013-12-11 14:45:27 -08002458bsn_header.subtypes[12] = bsn_set_l2_table_request
2459
2460class bsn_set_mirroring(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07002461 version = 1
2462 type = 4
2463 experimenter = 6035143
Rich Laneb658ddd2013-03-12 10:15:10 -07002464 subtype = 3
2465
Rich Lanec2ee4b82013-04-24 17:12:38 -07002466 def __init__(self, xid=None, report_mirror_ports=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002467 if xid != None:
2468 self.xid = xid
2469 else:
2470 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07002471 if report_mirror_ports != None:
2472 self.report_mirror_ports = report_mirror_ports
2473 else:
2474 self.report_mirror_ports = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08002475 return
Rich Laneb658ddd2013-03-12 10:15:10 -07002476
2477 def pack(self):
2478 packed = []
2479 packed.append(struct.pack("!B", self.version))
2480 packed.append(struct.pack("!B", self.type))
2481 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2482 packed.append(struct.pack("!L", self.xid))
2483 packed.append(struct.pack("!L", self.experimenter))
2484 packed.append(struct.pack("!L", self.subtype))
2485 packed.append(struct.pack("!B", self.report_mirror_ports))
Rich Lanec2ee4b82013-04-24 17:12:38 -07002486 packed.append('\x00' * 3)
Rich Laneb658ddd2013-03-12 10:15:10 -07002487 length = sum([len(x) for x in packed])
2488 packed[2] = struct.pack("!H", length)
2489 return ''.join(packed)
2490
2491 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002492 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07002493 obj = bsn_set_mirroring()
Dan Talaycof6202252013-07-02 01:00:29 -07002494 _version = reader.read("!B")[0]
2495 assert(_version == 1)
2496 _type = reader.read("!B")[0]
2497 assert(_type == 4)
2498 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002499 orig_reader = reader
2500 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07002501 obj.xid = reader.read("!L")[0]
2502 _experimenter = reader.read("!L")[0]
2503 assert(_experimenter == 6035143)
2504 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07002505 assert(_subtype == 3)
Dan Talaycof6202252013-07-02 01:00:29 -07002506 obj.report_mirror_ports = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07002507 reader.skip(3)
Rich Laneb658ddd2013-03-12 10:15:10 -07002508 return obj
2509
2510 def __eq__(self, other):
2511 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07002512 if self.xid != other.xid: return False
2513 if self.report_mirror_ports != other.report_mirror_ports: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07002514 return True
2515
Rich Laneb658ddd2013-03-12 10:15:10 -07002516 def pretty_print(self, q):
2517 q.text("bsn_set_mirroring {")
2518 with q.group():
2519 with q.indent(2):
2520 q.breakable()
2521 q.text("xid = ");
2522 if self.xid != None:
2523 q.text("%#x" % self.xid)
2524 else:
2525 q.text('None')
2526 q.text(","); q.breakable()
2527 q.text("report_mirror_ports = ");
2528 q.text("%#x" % self.report_mirror_ports)
Rich Lanec2ee4b82013-04-24 17:12:38 -07002529 q.breakable()
2530 q.text('}')
2531
Rich Lane7dcdf022013-12-11 14:45:27 -08002532bsn_header.subtypes[3] = bsn_set_mirroring
2533
2534class bsn_set_pktin_suppression_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07002535 version = 1
2536 type = 4
2537 experimenter = 6035143
2538 subtype = 25
2539
2540 def __init__(self, xid=None, status=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002541 if xid != None:
2542 self.xid = xid
2543 else:
2544 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07002545 if status != None:
2546 self.status = status
2547 else:
2548 self.status = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08002549 return
Dan Talaycof6202252013-07-02 01:00:29 -07002550
2551 def pack(self):
2552 packed = []
2553 packed.append(struct.pack("!B", self.version))
2554 packed.append(struct.pack("!B", self.type))
2555 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2556 packed.append(struct.pack("!L", self.xid))
2557 packed.append(struct.pack("!L", self.experimenter))
2558 packed.append(struct.pack("!L", self.subtype))
2559 packed.append(struct.pack("!L", self.status))
2560 length = sum([len(x) for x in packed])
2561 packed[2] = struct.pack("!H", length)
2562 return ''.join(packed)
2563
2564 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002565 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07002566 obj = bsn_set_pktin_suppression_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07002567 _version = reader.read("!B")[0]
2568 assert(_version == 1)
2569 _type = reader.read("!B")[0]
2570 assert(_type == 4)
2571 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002572 orig_reader = reader
2573 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07002574 obj.xid = reader.read("!L")[0]
2575 _experimenter = reader.read("!L")[0]
2576 assert(_experimenter == 6035143)
2577 _subtype = reader.read("!L")[0]
2578 assert(_subtype == 25)
2579 obj.status = reader.read("!L")[0]
2580 return obj
2581
2582 def __eq__(self, other):
2583 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07002584 if self.xid != other.xid: return False
2585 if self.status != other.status: return False
2586 return True
2587
Dan Talaycof6202252013-07-02 01:00:29 -07002588 def pretty_print(self, q):
2589 q.text("bsn_set_pktin_suppression_reply {")
2590 with q.group():
2591 with q.indent(2):
2592 q.breakable()
2593 q.text("xid = ");
2594 if self.xid != None:
2595 q.text("%#x" % self.xid)
2596 else:
2597 q.text('None')
2598 q.text(","); q.breakable()
2599 q.text("status = ");
2600 q.text("%#x" % self.status)
2601 q.breakable()
2602 q.text('}')
2603
Rich Lane7dcdf022013-12-11 14:45:27 -08002604bsn_header.subtypes[25] = bsn_set_pktin_suppression_reply
2605
2606class bsn_set_pktin_suppression_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07002607 version = 1
2608 type = 4
2609 experimenter = 6035143
Rich Lanec2ee4b82013-04-24 17:12:38 -07002610 subtype = 11
2611
2612 def __init__(self, xid=None, enabled=None, idle_timeout=None, hard_timeout=None, priority=None, cookie=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002613 if xid != None:
2614 self.xid = xid
2615 else:
2616 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07002617 if enabled != None:
2618 self.enabled = enabled
2619 else:
2620 self.enabled = 0
2621 if idle_timeout != None:
2622 self.idle_timeout = idle_timeout
2623 else:
2624 self.idle_timeout = 0
2625 if hard_timeout != None:
2626 self.hard_timeout = hard_timeout
2627 else:
2628 self.hard_timeout = 0
2629 if priority != None:
2630 self.priority = priority
2631 else:
2632 self.priority = 0
2633 if cookie != None:
2634 self.cookie = cookie
2635 else:
2636 self.cookie = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08002637 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07002638
2639 def pack(self):
2640 packed = []
2641 packed.append(struct.pack("!B", self.version))
2642 packed.append(struct.pack("!B", self.type))
2643 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2644 packed.append(struct.pack("!L", self.xid))
2645 packed.append(struct.pack("!L", self.experimenter))
2646 packed.append(struct.pack("!L", self.subtype))
2647 packed.append(struct.pack("!B", self.enabled))
2648 packed.append('\x00' * 1)
2649 packed.append(struct.pack("!H", self.idle_timeout))
2650 packed.append(struct.pack("!H", self.hard_timeout))
2651 packed.append(struct.pack("!H", self.priority))
2652 packed.append(struct.pack("!Q", self.cookie))
2653 length = sum([len(x) for x in packed])
2654 packed[2] = struct.pack("!H", length)
2655 return ''.join(packed)
2656
2657 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002658 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07002659 obj = bsn_set_pktin_suppression_request()
Dan Talaycof6202252013-07-02 01:00:29 -07002660 _version = reader.read("!B")[0]
2661 assert(_version == 1)
2662 _type = reader.read("!B")[0]
2663 assert(_type == 4)
2664 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002665 orig_reader = reader
2666 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07002667 obj.xid = reader.read("!L")[0]
2668 _experimenter = reader.read("!L")[0]
2669 assert(_experimenter == 6035143)
2670 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07002671 assert(_subtype == 11)
Dan Talaycof6202252013-07-02 01:00:29 -07002672 obj.enabled = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07002673 reader.skip(1)
Dan Talaycof6202252013-07-02 01:00:29 -07002674 obj.idle_timeout = reader.read("!H")[0]
2675 obj.hard_timeout = reader.read("!H")[0]
2676 obj.priority = reader.read("!H")[0]
2677 obj.cookie = reader.read("!Q")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07002678 return obj
2679
2680 def __eq__(self, other):
2681 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07002682 if self.xid != other.xid: return False
2683 if self.enabled != other.enabled: return False
2684 if self.idle_timeout != other.idle_timeout: return False
2685 if self.hard_timeout != other.hard_timeout: return False
2686 if self.priority != other.priority: return False
2687 if self.cookie != other.cookie: return False
2688 return True
2689
Rich Lanec2ee4b82013-04-24 17:12:38 -07002690 def pretty_print(self, q):
Dan Talaycof6202252013-07-02 01:00:29 -07002691 q.text("bsn_set_pktin_suppression_request {")
Rich Lanec2ee4b82013-04-24 17:12:38 -07002692 with q.group():
2693 with q.indent(2):
2694 q.breakable()
2695 q.text("xid = ");
2696 if self.xid != None:
2697 q.text("%#x" % self.xid)
2698 else:
2699 q.text('None')
Rich Laneb658ddd2013-03-12 10:15:10 -07002700 q.text(","); q.breakable()
Rich Lanec2ee4b82013-04-24 17:12:38 -07002701 q.text("enabled = ");
2702 q.text("%#x" % self.enabled)
2703 q.text(","); q.breakable()
2704 q.text("idle_timeout = ");
2705 q.text("%#x" % self.idle_timeout)
2706 q.text(","); q.breakable()
2707 q.text("hard_timeout = ");
2708 q.text("%#x" % self.hard_timeout)
2709 q.text(","); q.breakable()
2710 q.text("priority = ");
2711 q.text("%#x" % self.priority)
2712 q.text(","); q.breakable()
2713 q.text("cookie = ");
2714 q.text("%#x" % self.cookie)
Rich Laneb658ddd2013-03-12 10:15:10 -07002715 q.breakable()
2716 q.text('}')
2717
Rich Lane7dcdf022013-12-11 14:45:27 -08002718bsn_header.subtypes[11] = bsn_set_pktin_suppression_request
2719
2720class bsn_shell_command(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07002721 version = 1
2722 type = 4
2723 experimenter = 6035143
Rich Laneb658ddd2013-03-12 10:15:10 -07002724 subtype = 6
2725
2726 def __init__(self, xid=None, service=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002727 if xid != None:
2728 self.xid = xid
2729 else:
2730 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07002731 if service != None:
2732 self.service = service
2733 else:
2734 self.service = 0
2735 if data != None:
2736 self.data = data
2737 else:
Dan Talaycof6202252013-07-02 01:00:29 -07002738 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08002739 return
Rich Laneb658ddd2013-03-12 10:15:10 -07002740
2741 def pack(self):
2742 packed = []
2743 packed.append(struct.pack("!B", self.version))
2744 packed.append(struct.pack("!B", self.type))
2745 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2746 packed.append(struct.pack("!L", self.xid))
2747 packed.append(struct.pack("!L", self.experimenter))
2748 packed.append(struct.pack("!L", self.subtype))
2749 packed.append(struct.pack("!L", self.service))
2750 packed.append(self.data)
2751 length = sum([len(x) for x in packed])
2752 packed[2] = struct.pack("!H", length)
2753 return ''.join(packed)
2754
2755 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002756 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07002757 obj = bsn_shell_command()
Dan Talaycof6202252013-07-02 01:00:29 -07002758 _version = reader.read("!B")[0]
2759 assert(_version == 1)
2760 _type = reader.read("!B")[0]
2761 assert(_type == 4)
2762 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002763 orig_reader = reader
2764 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07002765 obj.xid = reader.read("!L")[0]
2766 _experimenter = reader.read("!L")[0]
2767 assert(_experimenter == 6035143)
2768 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07002769 assert(_subtype == 6)
Dan Talaycof6202252013-07-02 01:00:29 -07002770 obj.service = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07002771 obj.data = str(reader.read_all())
Rich Laneb658ddd2013-03-12 10:15:10 -07002772 return obj
2773
2774 def __eq__(self, other):
2775 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07002776 if self.xid != other.xid: return False
2777 if self.service != other.service: return False
2778 if self.data != other.data: return False
2779 return True
2780
Rich Laneb658ddd2013-03-12 10:15:10 -07002781 def pretty_print(self, q):
2782 q.text("bsn_shell_command {")
2783 with q.group():
2784 with q.indent(2):
2785 q.breakable()
2786 q.text("xid = ");
2787 if self.xid != None:
2788 q.text("%#x" % self.xid)
2789 else:
2790 q.text('None')
2791 q.text(","); q.breakable()
2792 q.text("service = ");
2793 q.text("%#x" % self.service)
2794 q.text(","); q.breakable()
2795 q.text("data = ");
2796 q.pp(self.data)
2797 q.breakable()
2798 q.text('}')
2799
Rich Lane7dcdf022013-12-11 14:45:27 -08002800bsn_header.subtypes[6] = bsn_shell_command
2801
2802class bsn_shell_output(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07002803 version = 1
2804 type = 4
2805 experimenter = 6035143
Rich Laneb658ddd2013-03-12 10:15:10 -07002806 subtype = 7
2807
2808 def __init__(self, xid=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002809 if xid != None:
2810 self.xid = xid
2811 else:
2812 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07002813 if data != None:
2814 self.data = data
2815 else:
Dan Talaycof6202252013-07-02 01:00:29 -07002816 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08002817 return
Rich Laneb658ddd2013-03-12 10:15:10 -07002818
2819 def pack(self):
2820 packed = []
2821 packed.append(struct.pack("!B", self.version))
2822 packed.append(struct.pack("!B", self.type))
2823 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2824 packed.append(struct.pack("!L", self.xid))
2825 packed.append(struct.pack("!L", self.experimenter))
2826 packed.append(struct.pack("!L", self.subtype))
2827 packed.append(self.data)
2828 length = sum([len(x) for x in packed])
2829 packed[2] = struct.pack("!H", length)
2830 return ''.join(packed)
2831
2832 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002833 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07002834 obj = bsn_shell_output()
Dan Talaycof6202252013-07-02 01:00:29 -07002835 _version = reader.read("!B")[0]
2836 assert(_version == 1)
2837 _type = reader.read("!B")[0]
2838 assert(_type == 4)
2839 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002840 orig_reader = reader
2841 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07002842 obj.xid = reader.read("!L")[0]
2843 _experimenter = reader.read("!L")[0]
2844 assert(_experimenter == 6035143)
2845 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07002846 assert(_subtype == 7)
2847 obj.data = str(reader.read_all())
Rich Laneb658ddd2013-03-12 10:15:10 -07002848 return obj
2849
2850 def __eq__(self, other):
2851 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07002852 if self.xid != other.xid: return False
2853 if self.data != other.data: return False
2854 return True
2855
Rich Laneb658ddd2013-03-12 10:15:10 -07002856 def pretty_print(self, q):
2857 q.text("bsn_shell_output {")
2858 with q.group():
2859 with q.indent(2):
2860 q.breakable()
2861 q.text("xid = ");
2862 if self.xid != None:
2863 q.text("%#x" % self.xid)
2864 else:
2865 q.text('None')
2866 q.text(","); q.breakable()
2867 q.text("data = ");
2868 q.pp(self.data)
2869 q.breakable()
2870 q.text('}')
2871
Rich Lane7dcdf022013-12-11 14:45:27 -08002872bsn_header.subtypes[7] = bsn_shell_output
2873
2874class bsn_shell_status(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07002875 version = 1
2876 type = 4
2877 experimenter = 6035143
Rich Laneb658ddd2013-03-12 10:15:10 -07002878 subtype = 8
2879
2880 def __init__(self, xid=None, status=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002881 if xid != None:
2882 self.xid = xid
2883 else:
2884 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07002885 if status != None:
2886 self.status = status
2887 else:
2888 self.status = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08002889 return
Rich Laneb658ddd2013-03-12 10:15:10 -07002890
2891 def pack(self):
2892 packed = []
2893 packed.append(struct.pack("!B", self.version))
2894 packed.append(struct.pack("!B", self.type))
2895 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2896 packed.append(struct.pack("!L", self.xid))
2897 packed.append(struct.pack("!L", self.experimenter))
2898 packed.append(struct.pack("!L", self.subtype))
2899 packed.append(struct.pack("!L", self.status))
2900 length = sum([len(x) for x in packed])
2901 packed[2] = struct.pack("!H", length)
2902 return ''.join(packed)
2903
2904 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002905 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07002906 obj = bsn_shell_status()
Dan Talaycof6202252013-07-02 01:00:29 -07002907 _version = reader.read("!B")[0]
2908 assert(_version == 1)
2909 _type = reader.read("!B")[0]
2910 assert(_type == 4)
2911 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002912 orig_reader = reader
2913 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07002914 obj.xid = reader.read("!L")[0]
2915 _experimenter = reader.read("!L")[0]
2916 assert(_experimenter == 6035143)
2917 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07002918 assert(_subtype == 8)
Dan Talaycof6202252013-07-02 01:00:29 -07002919 obj.status = reader.read("!L")[0]
Rich Laneb658ddd2013-03-12 10:15:10 -07002920 return obj
2921
2922 def __eq__(self, other):
2923 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07002924 if self.xid != other.xid: return False
2925 if self.status != other.status: return False
2926 return True
2927
Rich Laneb658ddd2013-03-12 10:15:10 -07002928 def pretty_print(self, q):
2929 q.text("bsn_shell_status {")
2930 with q.group():
2931 with q.indent(2):
2932 q.breakable()
2933 q.text("xid = ");
2934 if self.xid != None:
2935 q.text("%#x" % self.xid)
2936 else:
2937 q.text('None')
2938 q.text(","); q.breakable()
2939 q.text("status = ");
2940 q.text("%#x" % self.status)
2941 q.breakable()
2942 q.text('}')
2943
Rich Lane7dcdf022013-12-11 14:45:27 -08002944bsn_header.subtypes[8] = bsn_shell_status
2945
2946class experimenter_stats_reply(stats_reply):
2947 subtypes = {}
2948
2949 @staticmethod
2950 def unpack(reader):
2951 subtype, = reader.peek('!L', 12)
2952 try:
2953 subclass = experimenter_stats_reply.subtypes[subtype]
2954 except KeyError:
2955 raise loxi.ProtocolError("unknown experimenter_stats_reply stats_reply message subtype %#x" % subtype)
2956 return subclass.unpack(reader)
2957
2958stats_reply.subtypes[65535] = experimenter_stats_reply
2959
2960class bsn_stats_reply(experimenter_stats_reply):
2961 subtypes = {}
2962
2963 @staticmethod
2964 def unpack(reader):
2965 subtype, = reader.peek('!L', 20)
2966 try:
2967 subclass = bsn_stats_reply.subtypes[subtype]
2968 except KeyError:
2969 raise loxi.ProtocolError("unknown bsn_stats_reply experimenter_stats_reply stats_reply message subtype %#x" % subtype)
2970 return subclass.unpack(reader)
2971
2972experimenter_stats_reply.subtypes[6035143] = bsn_stats_reply
2973
2974class experimenter_stats_request(stats_request):
2975 subtypes = {}
2976
2977 @staticmethod
2978 def unpack(reader):
2979 subtype, = reader.peek('!L', 12)
2980 try:
2981 subclass = experimenter_stats_request.subtypes[subtype]
2982 except KeyError:
2983 raise loxi.ProtocolError("unknown experimenter_stats_request stats_request message subtype %#x" % subtype)
2984 return subclass.unpack(reader)
2985
2986stats_request.subtypes[65535] = experimenter_stats_request
2987
2988class bsn_stats_request(experimenter_stats_request):
2989 subtypes = {}
2990
2991 @staticmethod
2992 def unpack(reader):
2993 subtype, = reader.peek('!L', 20)
2994 try:
2995 subclass = bsn_stats_request.subtypes[subtype]
2996 except KeyError:
2997 raise loxi.ProtocolError("unknown bsn_stats_request experimenter_stats_request stats_request message subtype %#x" % subtype)
2998 return subclass.unpack(reader)
2999
3000experimenter_stats_request.subtypes[6035143] = bsn_stats_request
3001
3002class bsn_virtual_port_create_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07003003 version = 1
3004 type = 4
3005 experimenter = 6035143
3006 subtype = 16
3007
3008 def __init__(self, xid=None, status=None, vport_no=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08003009 if xid != None:
3010 self.xid = xid
3011 else:
3012 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07003013 if status != None:
3014 self.status = status
3015 else:
3016 self.status = 0
3017 if vport_no != None:
3018 self.vport_no = vport_no
3019 else:
3020 self.vport_no = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08003021 return
Dan Talaycof6202252013-07-02 01:00:29 -07003022
3023 def pack(self):
3024 packed = []
3025 packed.append(struct.pack("!B", self.version))
3026 packed.append(struct.pack("!B", self.type))
3027 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3028 packed.append(struct.pack("!L", self.xid))
3029 packed.append(struct.pack("!L", self.experimenter))
3030 packed.append(struct.pack("!L", self.subtype))
3031 packed.append(struct.pack("!L", self.status))
3032 packed.append(struct.pack("!L", self.vport_no))
3033 length = sum([len(x) for x in packed])
3034 packed[2] = struct.pack("!H", length)
3035 return ''.join(packed)
3036
3037 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003038 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07003039 obj = bsn_virtual_port_create_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07003040 _version = reader.read("!B")[0]
3041 assert(_version == 1)
3042 _type = reader.read("!B")[0]
3043 assert(_type == 4)
3044 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003045 orig_reader = reader
3046 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07003047 obj.xid = reader.read("!L")[0]
3048 _experimenter = reader.read("!L")[0]
3049 assert(_experimenter == 6035143)
3050 _subtype = reader.read("!L")[0]
3051 assert(_subtype == 16)
3052 obj.status = reader.read("!L")[0]
3053 obj.vport_no = reader.read("!L")[0]
3054 return obj
3055
3056 def __eq__(self, other):
3057 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07003058 if self.xid != other.xid: return False
3059 if self.status != other.status: return False
3060 if self.vport_no != other.vport_no: return False
3061 return True
3062
Dan Talaycof6202252013-07-02 01:00:29 -07003063 def pretty_print(self, q):
3064 q.text("bsn_virtual_port_create_reply {")
3065 with q.group():
3066 with q.indent(2):
3067 q.breakable()
3068 q.text("xid = ");
3069 if self.xid != None:
3070 q.text("%#x" % self.xid)
3071 else:
3072 q.text('None')
3073 q.text(","); q.breakable()
3074 q.text("status = ");
3075 q.text("%#x" % self.status)
3076 q.text(","); q.breakable()
3077 q.text("vport_no = ");
3078 q.text("%#x" % self.vport_no)
3079 q.breakable()
3080 q.text('}')
3081
Rich Lane7dcdf022013-12-11 14:45:27 -08003082bsn_header.subtypes[16] = bsn_virtual_port_create_reply
3083
3084class bsn_virtual_port_create_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07003085 version = 1
3086 type = 4
3087 experimenter = 6035143
3088 subtype = 15
3089
3090 def __init__(self, xid=None, vport=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08003091 if xid != None:
3092 self.xid = xid
3093 else:
3094 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07003095 if vport != None:
3096 self.vport = vport
3097 else:
3098 self.vport = common.bsn_vport_q_in_q()
Rich Lane7dcdf022013-12-11 14:45:27 -08003099 return
Dan Talaycof6202252013-07-02 01:00:29 -07003100
3101 def pack(self):
3102 packed = []
3103 packed.append(struct.pack("!B", self.version))
3104 packed.append(struct.pack("!B", self.type))
3105 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3106 packed.append(struct.pack("!L", self.xid))
3107 packed.append(struct.pack("!L", self.experimenter))
3108 packed.append(struct.pack("!L", self.subtype))
3109 packed.append(self.vport.pack())
3110 length = sum([len(x) for x in packed])
3111 packed[2] = struct.pack("!H", length)
3112 return ''.join(packed)
3113
3114 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003115 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07003116 obj = bsn_virtual_port_create_request()
Dan Talaycof6202252013-07-02 01:00:29 -07003117 _version = reader.read("!B")[0]
3118 assert(_version == 1)
3119 _type = reader.read("!B")[0]
3120 assert(_type == 4)
3121 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003122 orig_reader = reader
3123 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07003124 obj.xid = reader.read("!L")[0]
3125 _experimenter = reader.read("!L")[0]
3126 assert(_experimenter == 6035143)
3127 _subtype = reader.read("!L")[0]
3128 assert(_subtype == 15)
3129 obj.vport = common.bsn_vport_q_in_q.unpack(reader)
3130 return obj
3131
3132 def __eq__(self, other):
3133 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07003134 if self.xid != other.xid: return False
3135 if self.vport != other.vport: return False
3136 return True
3137
Dan Talaycof6202252013-07-02 01:00:29 -07003138 def pretty_print(self, q):
3139 q.text("bsn_virtual_port_create_request {")
3140 with q.group():
3141 with q.indent(2):
3142 q.breakable()
3143 q.text("xid = ");
3144 if self.xid != None:
3145 q.text("%#x" % self.xid)
3146 else:
3147 q.text('None')
3148 q.text(","); q.breakable()
3149 q.text("vport = ");
3150 q.pp(self.vport)
3151 q.breakable()
3152 q.text('}')
3153
Rich Lane7dcdf022013-12-11 14:45:27 -08003154bsn_header.subtypes[15] = bsn_virtual_port_create_request
3155
3156class bsn_virtual_port_remove_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07003157 version = 1
3158 type = 4
3159 experimenter = 6035143
3160 subtype = 26
3161
3162 def __init__(self, xid=None, status=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08003163 if xid != None:
3164 self.xid = xid
3165 else:
3166 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07003167 if status != None:
3168 self.status = status
3169 else:
3170 self.status = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08003171 return
Dan Talaycof6202252013-07-02 01:00:29 -07003172
3173 def pack(self):
3174 packed = []
3175 packed.append(struct.pack("!B", self.version))
3176 packed.append(struct.pack("!B", self.type))
3177 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3178 packed.append(struct.pack("!L", self.xid))
3179 packed.append(struct.pack("!L", self.experimenter))
3180 packed.append(struct.pack("!L", self.subtype))
3181 packed.append(struct.pack("!L", self.status))
3182 length = sum([len(x) for x in packed])
3183 packed[2] = struct.pack("!H", length)
3184 return ''.join(packed)
3185
3186 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003187 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07003188 obj = bsn_virtual_port_remove_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07003189 _version = reader.read("!B")[0]
3190 assert(_version == 1)
3191 _type = reader.read("!B")[0]
3192 assert(_type == 4)
3193 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003194 orig_reader = reader
3195 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07003196 obj.xid = reader.read("!L")[0]
3197 _experimenter = reader.read("!L")[0]
3198 assert(_experimenter == 6035143)
3199 _subtype = reader.read("!L")[0]
3200 assert(_subtype == 26)
3201 obj.status = reader.read("!L")[0]
3202 return obj
3203
3204 def __eq__(self, other):
3205 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07003206 if self.xid != other.xid: return False
3207 if self.status != other.status: return False
3208 return True
3209
Dan Talaycof6202252013-07-02 01:00:29 -07003210 def pretty_print(self, q):
3211 q.text("bsn_virtual_port_remove_reply {")
3212 with q.group():
3213 with q.indent(2):
3214 q.breakable()
3215 q.text("xid = ");
3216 if self.xid != None:
3217 q.text("%#x" % self.xid)
3218 else:
3219 q.text('None')
3220 q.text(","); q.breakable()
3221 q.text("status = ");
3222 q.text("%#x" % self.status)
3223 q.breakable()
3224 q.text('}')
3225
Rich Lane7dcdf022013-12-11 14:45:27 -08003226bsn_header.subtypes[26] = bsn_virtual_port_remove_reply
3227
3228class bsn_virtual_port_remove_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07003229 version = 1
3230 type = 4
3231 experimenter = 6035143
3232 subtype = 17
3233
3234 def __init__(self, xid=None, vport_no=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08003235 if xid != None:
3236 self.xid = xid
3237 else:
3238 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07003239 if vport_no != None:
3240 self.vport_no = vport_no
3241 else:
3242 self.vport_no = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08003243 return
Dan Talaycof6202252013-07-02 01:00:29 -07003244
3245 def pack(self):
3246 packed = []
3247 packed.append(struct.pack("!B", self.version))
3248 packed.append(struct.pack("!B", self.type))
3249 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3250 packed.append(struct.pack("!L", self.xid))
3251 packed.append(struct.pack("!L", self.experimenter))
3252 packed.append(struct.pack("!L", self.subtype))
3253 packed.append(struct.pack("!L", self.vport_no))
3254 length = sum([len(x) for x in packed])
3255 packed[2] = struct.pack("!H", length)
3256 return ''.join(packed)
3257
3258 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003259 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07003260 obj = bsn_virtual_port_remove_request()
Dan Talaycof6202252013-07-02 01:00:29 -07003261 _version = reader.read("!B")[0]
3262 assert(_version == 1)
3263 _type = reader.read("!B")[0]
3264 assert(_type == 4)
3265 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003266 orig_reader = reader
3267 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07003268 obj.xid = reader.read("!L")[0]
3269 _experimenter = reader.read("!L")[0]
3270 assert(_experimenter == 6035143)
3271 _subtype = reader.read("!L")[0]
3272 assert(_subtype == 17)
3273 obj.vport_no = reader.read("!L")[0]
3274 return obj
3275
3276 def __eq__(self, other):
3277 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07003278 if self.xid != other.xid: return False
3279 if self.vport_no != other.vport_no: return False
3280 return True
3281
Dan Talaycof6202252013-07-02 01:00:29 -07003282 def pretty_print(self, q):
3283 q.text("bsn_virtual_port_remove_request {")
3284 with q.group():
3285 with q.indent(2):
3286 q.breakable()
3287 q.text("xid = ");
3288 if self.xid != None:
3289 q.text("%#x" % self.xid)
3290 else:
3291 q.text('None')
3292 q.text(","); q.breakable()
3293 q.text("vport_no = ");
3294 q.text("%#x" % self.vport_no)
3295 q.breakable()
3296 q.text('}')
3297
Rich Lane7dcdf022013-12-11 14:45:27 -08003298bsn_header.subtypes[17] = bsn_virtual_port_remove_request
3299
3300class desc_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -07003301 version = 1
3302 type = 17
3303 stats_type = 0
Rich Laneb658ddd2013-03-12 10:15:10 -07003304
3305 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 -08003306 if xid != None:
3307 self.xid = xid
3308 else:
3309 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07003310 if flags != None:
3311 self.flags = flags
3312 else:
3313 self.flags = 0
3314 if mfr_desc != None:
3315 self.mfr_desc = mfr_desc
3316 else:
3317 self.mfr_desc = ""
3318 if hw_desc != None:
3319 self.hw_desc = hw_desc
3320 else:
3321 self.hw_desc = ""
3322 if sw_desc != None:
3323 self.sw_desc = sw_desc
3324 else:
3325 self.sw_desc = ""
3326 if serial_num != None:
3327 self.serial_num = serial_num
3328 else:
3329 self.serial_num = ""
3330 if dp_desc != None:
3331 self.dp_desc = dp_desc
3332 else:
3333 self.dp_desc = ""
Rich Lane7dcdf022013-12-11 14:45:27 -08003334 return
Rich Laneb658ddd2013-03-12 10:15:10 -07003335
3336 def pack(self):
3337 packed = []
3338 packed.append(struct.pack("!B", self.version))
3339 packed.append(struct.pack("!B", self.type))
3340 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3341 packed.append(struct.pack("!L", self.xid))
3342 packed.append(struct.pack("!H", self.stats_type))
3343 packed.append(struct.pack("!H", self.flags))
3344 packed.append(struct.pack("!256s", self.mfr_desc))
3345 packed.append(struct.pack("!256s", self.hw_desc))
3346 packed.append(struct.pack("!256s", self.sw_desc))
3347 packed.append(struct.pack("!32s", self.serial_num))
3348 packed.append(struct.pack("!256s", self.dp_desc))
3349 length = sum([len(x) for x in packed])
3350 packed[2] = struct.pack("!H", length)
3351 return ''.join(packed)
3352
3353 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003354 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07003355 obj = desc_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07003356 _version = reader.read("!B")[0]
3357 assert(_version == 1)
3358 _type = reader.read("!B")[0]
3359 assert(_type == 17)
3360 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003361 orig_reader = reader
3362 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07003363 obj.xid = reader.read("!L")[0]
3364 _stats_type = reader.read("!H")[0]
3365 assert(_stats_type == 0)
3366 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07003367 obj.mfr_desc = reader.read("!256s")[0].rstrip("\x00")
3368 obj.hw_desc = reader.read("!256s")[0].rstrip("\x00")
3369 obj.sw_desc = reader.read("!256s")[0].rstrip("\x00")
3370 obj.serial_num = reader.read("!32s")[0].rstrip("\x00")
3371 obj.dp_desc = reader.read("!256s")[0].rstrip("\x00")
Rich Laneb658ddd2013-03-12 10:15:10 -07003372 return obj
3373
3374 def __eq__(self, other):
3375 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07003376 if self.xid != other.xid: return False
3377 if self.flags != other.flags: return False
3378 if self.mfr_desc != other.mfr_desc: return False
3379 if self.hw_desc != other.hw_desc: return False
3380 if self.sw_desc != other.sw_desc: return False
3381 if self.serial_num != other.serial_num: return False
3382 if self.dp_desc != other.dp_desc: return False
3383 return True
3384
Rich Laneb658ddd2013-03-12 10:15:10 -07003385 def pretty_print(self, q):
3386 q.text("desc_stats_reply {")
3387 with q.group():
3388 with q.indent(2):
3389 q.breakable()
3390 q.text("xid = ");
3391 if self.xid != None:
3392 q.text("%#x" % self.xid)
3393 else:
3394 q.text('None')
3395 q.text(","); q.breakable()
3396 q.text("flags = ");
3397 q.text("%#x" % self.flags)
3398 q.text(","); q.breakable()
3399 q.text("mfr_desc = ");
3400 q.pp(self.mfr_desc)
3401 q.text(","); q.breakable()
3402 q.text("hw_desc = ");
3403 q.pp(self.hw_desc)
3404 q.text(","); q.breakable()
3405 q.text("sw_desc = ");
3406 q.pp(self.sw_desc)
3407 q.text(","); q.breakable()
3408 q.text("serial_num = ");
3409 q.pp(self.serial_num)
3410 q.text(","); q.breakable()
3411 q.text("dp_desc = ");
3412 q.pp(self.dp_desc)
3413 q.breakable()
3414 q.text('}')
3415
Rich Lane7dcdf022013-12-11 14:45:27 -08003416stats_reply.subtypes[0] = desc_stats_reply
3417
3418class desc_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -07003419 version = 1
3420 type = 16
3421 stats_type = 0
Rich Laneb658ddd2013-03-12 10:15:10 -07003422
3423 def __init__(self, xid=None, flags=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08003424 if xid != None:
3425 self.xid = xid
3426 else:
3427 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07003428 if flags != None:
3429 self.flags = flags
3430 else:
3431 self.flags = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08003432 return
Rich Laneb658ddd2013-03-12 10:15:10 -07003433
3434 def pack(self):
3435 packed = []
3436 packed.append(struct.pack("!B", self.version))
3437 packed.append(struct.pack("!B", self.type))
3438 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3439 packed.append(struct.pack("!L", self.xid))
3440 packed.append(struct.pack("!H", self.stats_type))
3441 packed.append(struct.pack("!H", self.flags))
3442 length = sum([len(x) for x in packed])
3443 packed[2] = struct.pack("!H", length)
3444 return ''.join(packed)
3445
3446 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003447 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07003448 obj = desc_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -07003449 _version = reader.read("!B")[0]
3450 assert(_version == 1)
3451 _type = reader.read("!B")[0]
3452 assert(_type == 16)
3453 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003454 orig_reader = reader
3455 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07003456 obj.xid = reader.read("!L")[0]
3457 _stats_type = reader.read("!H")[0]
3458 assert(_stats_type == 0)
3459 obj.flags = reader.read("!H")[0]
Rich Laneb658ddd2013-03-12 10:15:10 -07003460 return obj
3461
3462 def __eq__(self, other):
3463 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07003464 if self.xid != other.xid: return False
3465 if self.flags != other.flags: return False
3466 return True
3467
Rich Laneb658ddd2013-03-12 10:15:10 -07003468 def pretty_print(self, q):
3469 q.text("desc_stats_request {")
3470 with q.group():
3471 with q.indent(2):
3472 q.breakable()
3473 q.text("xid = ");
3474 if self.xid != None:
3475 q.text("%#x" % self.xid)
3476 else:
3477 q.text('None')
3478 q.text(","); q.breakable()
3479 q.text("flags = ");
3480 q.text("%#x" % self.flags)
3481 q.breakable()
3482 q.text('}')
3483
Rich Lane7dcdf022013-12-11 14:45:27 -08003484stats_request.subtypes[0] = desc_stats_request
3485
3486class echo_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -07003487 version = 1
3488 type = 3
Rich Laneb658ddd2013-03-12 10:15:10 -07003489
3490 def __init__(self, xid=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08003491 if xid != None:
3492 self.xid = xid
3493 else:
3494 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07003495 if data != None:
3496 self.data = data
3497 else:
Dan Talaycof6202252013-07-02 01:00:29 -07003498 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08003499 return
Rich Laneb658ddd2013-03-12 10:15:10 -07003500
3501 def pack(self):
3502 packed = []
3503 packed.append(struct.pack("!B", self.version))
3504 packed.append(struct.pack("!B", self.type))
3505 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3506 packed.append(struct.pack("!L", self.xid))
3507 packed.append(self.data)
3508 length = sum([len(x) for x in packed])
3509 packed[2] = struct.pack("!H", length)
3510 return ''.join(packed)
3511
3512 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003513 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07003514 obj = echo_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07003515 _version = reader.read("!B")[0]
3516 assert(_version == 1)
3517 _type = reader.read("!B")[0]
3518 assert(_type == 3)
3519 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003520 orig_reader = reader
3521 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07003522 obj.xid = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07003523 obj.data = str(reader.read_all())
Rich Laneb658ddd2013-03-12 10:15:10 -07003524 return obj
3525
3526 def __eq__(self, other):
3527 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07003528 if self.xid != other.xid: return False
3529 if self.data != other.data: return False
3530 return True
3531
Rich Laneb658ddd2013-03-12 10:15:10 -07003532 def pretty_print(self, q):
3533 q.text("echo_reply {")
3534 with q.group():
3535 with q.indent(2):
3536 q.breakable()
3537 q.text("xid = ");
3538 if self.xid != None:
3539 q.text("%#x" % self.xid)
3540 else:
3541 q.text('None')
3542 q.text(","); q.breakable()
3543 q.text("data = ");
3544 q.pp(self.data)
3545 q.breakable()
3546 q.text('}')
3547
Rich Lane7dcdf022013-12-11 14:45:27 -08003548message.subtypes[3] = echo_reply
3549
3550class echo_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -07003551 version = 1
3552 type = 2
Rich Laneb658ddd2013-03-12 10:15:10 -07003553
3554 def __init__(self, xid=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08003555 if xid != None:
3556 self.xid = xid
3557 else:
3558 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07003559 if data != None:
3560 self.data = data
3561 else:
Dan Talaycof6202252013-07-02 01:00:29 -07003562 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08003563 return
Rich Laneb658ddd2013-03-12 10:15:10 -07003564
3565 def pack(self):
3566 packed = []
3567 packed.append(struct.pack("!B", self.version))
3568 packed.append(struct.pack("!B", self.type))
3569 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3570 packed.append(struct.pack("!L", self.xid))
3571 packed.append(self.data)
3572 length = sum([len(x) for x in packed])
3573 packed[2] = struct.pack("!H", length)
3574 return ''.join(packed)
3575
3576 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003577 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07003578 obj = echo_request()
Dan Talaycof6202252013-07-02 01:00:29 -07003579 _version = reader.read("!B")[0]
3580 assert(_version == 1)
3581 _type = reader.read("!B")[0]
3582 assert(_type == 2)
3583 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003584 orig_reader = reader
3585 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07003586 obj.xid = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07003587 obj.data = str(reader.read_all())
Rich Laneb658ddd2013-03-12 10:15:10 -07003588 return obj
3589
3590 def __eq__(self, other):
3591 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07003592 if self.xid != other.xid: return False
3593 if self.data != other.data: return False
3594 return True
3595
Rich Laneb658ddd2013-03-12 10:15:10 -07003596 def pretty_print(self, q):
3597 q.text("echo_request {")
3598 with q.group():
3599 with q.indent(2):
3600 q.breakable()
3601 q.text("xid = ");
3602 if self.xid != None:
3603 q.text("%#x" % self.xid)
3604 else:
3605 q.text('None')
3606 q.text(","); q.breakable()
3607 q.text("data = ");
3608 q.pp(self.data)
3609 q.breakable()
3610 q.text('}')
3611
Rich Lane7dcdf022013-12-11 14:45:27 -08003612message.subtypes[2] = echo_request
3613
3614class features_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -07003615 version = 1
3616 type = 6
Rich Laneb658ddd2013-03-12 10:15:10 -07003617
Rich Lanec2ee4b82013-04-24 17:12:38 -07003618 def __init__(self, xid=None, datapath_id=None, n_buffers=None, n_tables=None, capabilities=None, actions=None, ports=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08003619 if xid != None:
3620 self.xid = xid
3621 else:
3622 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07003623 if datapath_id != None:
3624 self.datapath_id = datapath_id
3625 else:
3626 self.datapath_id = 0
3627 if n_buffers != None:
3628 self.n_buffers = n_buffers
3629 else:
3630 self.n_buffers = 0
3631 if n_tables != None:
3632 self.n_tables = n_tables
3633 else:
3634 self.n_tables = 0
Rich Laneb658ddd2013-03-12 10:15:10 -07003635 if capabilities != None:
3636 self.capabilities = capabilities
3637 else:
3638 self.capabilities = 0
3639 if actions != None:
3640 self.actions = actions
3641 else:
3642 self.actions = 0
3643 if ports != None:
3644 self.ports = ports
3645 else:
3646 self.ports = []
Rich Lane7dcdf022013-12-11 14:45:27 -08003647 return
Rich Laneb658ddd2013-03-12 10:15:10 -07003648
3649 def pack(self):
3650 packed = []
3651 packed.append(struct.pack("!B", self.version))
3652 packed.append(struct.pack("!B", self.type))
3653 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3654 packed.append(struct.pack("!L", self.xid))
3655 packed.append(struct.pack("!Q", self.datapath_id))
3656 packed.append(struct.pack("!L", self.n_buffers))
3657 packed.append(struct.pack("!B", self.n_tables))
Rich Lanec2ee4b82013-04-24 17:12:38 -07003658 packed.append('\x00' * 3)
Rich Laneb658ddd2013-03-12 10:15:10 -07003659 packed.append(struct.pack("!L", self.capabilities))
3660 packed.append(struct.pack("!L", self.actions))
Rich Lane7dcdf022013-12-11 14:45:27 -08003661 packed.append(loxi.generic_util.pack_list(self.ports))
Rich Laneb658ddd2013-03-12 10:15:10 -07003662 length = sum([len(x) for x in packed])
3663 packed[2] = struct.pack("!H", length)
3664 return ''.join(packed)
3665
3666 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003667 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07003668 obj = features_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07003669 _version = reader.read("!B")[0]
3670 assert(_version == 1)
3671 _type = reader.read("!B")[0]
3672 assert(_type == 6)
3673 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003674 orig_reader = reader
3675 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07003676 obj.xid = reader.read("!L")[0]
3677 obj.datapath_id = reader.read("!Q")[0]
3678 obj.n_buffers = reader.read("!L")[0]
3679 obj.n_tables = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07003680 reader.skip(3)
Dan Talaycof6202252013-07-02 01:00:29 -07003681 obj.capabilities = reader.read("!L")[0]
3682 obj.actions = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07003683 obj.ports = loxi.generic_util.unpack_list(reader, common.port_desc.unpack)
Rich Laneb658ddd2013-03-12 10:15:10 -07003684 return obj
3685
3686 def __eq__(self, other):
3687 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07003688 if self.xid != other.xid: return False
3689 if self.datapath_id != other.datapath_id: return False
3690 if self.n_buffers != other.n_buffers: return False
3691 if self.n_tables != other.n_tables: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07003692 if self.capabilities != other.capabilities: return False
3693 if self.actions != other.actions: return False
3694 if self.ports != other.ports: return False
3695 return True
3696
Rich Laneb658ddd2013-03-12 10:15:10 -07003697 def pretty_print(self, q):
3698 q.text("features_reply {")
3699 with q.group():
3700 with q.indent(2):
3701 q.breakable()
3702 q.text("xid = ");
3703 if self.xid != None:
3704 q.text("%#x" % self.xid)
3705 else:
3706 q.text('None')
3707 q.text(","); q.breakable()
3708 q.text("datapath_id = ");
3709 q.text("%#x" % self.datapath_id)
3710 q.text(","); q.breakable()
3711 q.text("n_buffers = ");
3712 q.text("%#x" % self.n_buffers)
3713 q.text(","); q.breakable()
3714 q.text("n_tables = ");
3715 q.text("%#x" % self.n_tables)
3716 q.text(","); q.breakable()
Rich Laneb658ddd2013-03-12 10:15:10 -07003717 q.text("capabilities = ");
3718 q.text("%#x" % self.capabilities)
3719 q.text(","); q.breakable()
3720 q.text("actions = ");
3721 q.text("%#x" % self.actions)
3722 q.text(","); q.breakable()
3723 q.text("ports = ");
3724 q.pp(self.ports)
3725 q.breakable()
3726 q.text('}')
3727
Rich Lane7dcdf022013-12-11 14:45:27 -08003728message.subtypes[6] = features_reply
3729
3730class features_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -07003731 version = 1
3732 type = 5
Rich Laneb658ddd2013-03-12 10:15:10 -07003733
3734 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08003735 if xid != None:
3736 self.xid = xid
3737 else:
3738 self.xid = None
3739 return
Rich Laneb658ddd2013-03-12 10:15:10 -07003740
3741 def pack(self):
3742 packed = []
3743 packed.append(struct.pack("!B", self.version))
3744 packed.append(struct.pack("!B", self.type))
3745 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3746 packed.append(struct.pack("!L", self.xid))
3747 length = sum([len(x) for x in packed])
3748 packed[2] = struct.pack("!H", length)
3749 return ''.join(packed)
3750
3751 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003752 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07003753 obj = features_request()
Dan Talaycof6202252013-07-02 01:00:29 -07003754 _version = reader.read("!B")[0]
3755 assert(_version == 1)
3756 _type = reader.read("!B")[0]
3757 assert(_type == 5)
3758 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003759 orig_reader = reader
3760 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07003761 obj.xid = reader.read("!L")[0]
Rich Laneb658ddd2013-03-12 10:15:10 -07003762 return obj
3763
3764 def __eq__(self, other):
3765 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07003766 if self.xid != other.xid: return False
3767 return True
3768
Rich Laneb658ddd2013-03-12 10:15:10 -07003769 def pretty_print(self, q):
3770 q.text("features_request {")
3771 with q.group():
3772 with q.indent(2):
3773 q.breakable()
3774 q.text("xid = ");
3775 if self.xid != None:
3776 q.text("%#x" % self.xid)
3777 else:
3778 q.text('None')
3779 q.breakable()
3780 q.text('}')
3781
Rich Lane7dcdf022013-12-11 14:45:27 -08003782message.subtypes[5] = features_request
3783
3784class flow_mod(message):
3785 subtypes = {}
3786
3787 @staticmethod
3788 def unpack(reader):
3789 subtype, = reader.peek('!H', 56)
3790 try:
3791 subclass = flow_mod.subtypes[subtype]
3792 except KeyError:
3793 raise loxi.ProtocolError("unknown flow_mod message subtype %#x" % subtype)
3794 return subclass.unpack(reader)
3795
3796message.subtypes[14] = flow_mod
3797
3798class flow_add(flow_mod):
Dan Talaycof6202252013-07-02 01:00:29 -07003799 version = 1
3800 type = 14
3801 _command = 0
Rich Laneb658ddd2013-03-12 10:15:10 -07003802
3803 def __init__(self, xid=None, match=None, cookie=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, flags=None, actions=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08003804 if xid != None:
3805 self.xid = xid
3806 else:
3807 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07003808 if match != None:
3809 self.match = match
3810 else:
3811 self.match = common.match()
3812 if cookie != None:
3813 self.cookie = cookie
3814 else:
3815 self.cookie = 0
3816 if idle_timeout != None:
3817 self.idle_timeout = idle_timeout
3818 else:
3819 self.idle_timeout = 0
3820 if hard_timeout != None:
3821 self.hard_timeout = hard_timeout
3822 else:
3823 self.hard_timeout = 0
3824 if priority != None:
3825 self.priority = priority
3826 else:
3827 self.priority = 0
3828 if buffer_id != None:
3829 self.buffer_id = buffer_id
3830 else:
3831 self.buffer_id = 0
3832 if out_port != None:
3833 self.out_port = out_port
3834 else:
3835 self.out_port = 0
3836 if flags != None:
3837 self.flags = flags
3838 else:
3839 self.flags = 0
3840 if actions != None:
3841 self.actions = actions
3842 else:
3843 self.actions = []
Rich Lane7dcdf022013-12-11 14:45:27 -08003844 return
Rich Laneb658ddd2013-03-12 10:15:10 -07003845
3846 def pack(self):
3847 packed = []
3848 packed.append(struct.pack("!B", self.version))
3849 packed.append(struct.pack("!B", self.type))
3850 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3851 packed.append(struct.pack("!L", self.xid))
3852 packed.append(self.match.pack())
3853 packed.append(struct.pack("!Q", self.cookie))
Dan Talaycof6202252013-07-02 01:00:29 -07003854 packed.append(util.pack_fm_cmd(self._command))
Rich Laneb658ddd2013-03-12 10:15:10 -07003855 packed.append(struct.pack("!H", self.idle_timeout))
3856 packed.append(struct.pack("!H", self.hard_timeout))
3857 packed.append(struct.pack("!H", self.priority))
3858 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -07003859 packed.append(util.pack_port_no(self.out_port))
Rich Laneb658ddd2013-03-12 10:15:10 -07003860 packed.append(struct.pack("!H", self.flags))
Rich Lane7dcdf022013-12-11 14:45:27 -08003861 packed.append(loxi.generic_util.pack_list(self.actions))
Rich Laneb658ddd2013-03-12 10:15:10 -07003862 length = sum([len(x) for x in packed])
3863 packed[2] = struct.pack("!H", length)
3864 return ''.join(packed)
3865
3866 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003867 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07003868 obj = flow_add()
Dan Talaycof6202252013-07-02 01:00:29 -07003869 _version = reader.read("!B")[0]
3870 assert(_version == 1)
3871 _type = reader.read("!B")[0]
3872 assert(_type == 14)
3873 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003874 orig_reader = reader
3875 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07003876 obj.xid = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07003877 obj.match = common.match.unpack(reader)
Dan Talaycof6202252013-07-02 01:00:29 -07003878 obj.cookie = reader.read("!Q")[0]
3879 __command = util.unpack_fm_cmd(reader)
3880 assert(__command == 0)
3881 obj.idle_timeout = reader.read("!H")[0]
3882 obj.hard_timeout = reader.read("!H")[0]
3883 obj.priority = reader.read("!H")[0]
3884 obj.buffer_id = reader.read("!L")[0]
3885 obj.out_port = util.unpack_port_no(reader)
3886 obj.flags = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003887 obj.actions = loxi.generic_util.unpack_list(reader, action.action.unpack)
Rich Laneb658ddd2013-03-12 10:15:10 -07003888 return obj
3889
3890 def __eq__(self, other):
3891 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07003892 if self.xid != other.xid: return False
3893 if self.match != other.match: return False
3894 if self.cookie != other.cookie: return False
3895 if self.idle_timeout != other.idle_timeout: return False
3896 if self.hard_timeout != other.hard_timeout: return False
3897 if self.priority != other.priority: return False
3898 if self.buffer_id != other.buffer_id: return False
3899 if self.out_port != other.out_port: return False
3900 if self.flags != other.flags: return False
3901 if self.actions != other.actions: return False
3902 return True
3903
Rich Laneb658ddd2013-03-12 10:15:10 -07003904 def pretty_print(self, q):
3905 q.text("flow_add {")
3906 with q.group():
3907 with q.indent(2):
3908 q.breakable()
3909 q.text("xid = ");
3910 if self.xid != None:
3911 q.text("%#x" % self.xid)
3912 else:
3913 q.text('None')
3914 q.text(","); q.breakable()
3915 q.text("match = ");
3916 q.pp(self.match)
3917 q.text(","); q.breakable()
3918 q.text("cookie = ");
3919 q.text("%#x" % self.cookie)
3920 q.text(","); q.breakable()
3921 q.text("idle_timeout = ");
3922 q.text("%#x" % self.idle_timeout)
3923 q.text(","); q.breakable()
3924 q.text("hard_timeout = ");
3925 q.text("%#x" % self.hard_timeout)
3926 q.text(","); q.breakable()
3927 q.text("priority = ");
3928 q.text("%#x" % self.priority)
3929 q.text(","); q.breakable()
3930 q.text("buffer_id = ");
3931 q.text("%#x" % self.buffer_id)
3932 q.text(","); q.breakable()
3933 q.text("out_port = ");
3934 q.text(util.pretty_port(self.out_port))
3935 q.text(","); q.breakable()
3936 q.text("flags = ");
3937 q.text("%#x" % self.flags)
3938 q.text(","); q.breakable()
3939 q.text("actions = ");
3940 q.pp(self.actions)
3941 q.breakable()
3942 q.text('}')
3943
Rich Lane7dcdf022013-12-11 14:45:27 -08003944flow_mod.subtypes[0] = flow_add
3945
3946class flow_delete(flow_mod):
Dan Talaycof6202252013-07-02 01:00:29 -07003947 version = 1
3948 type = 14
3949 _command = 3
Rich Laneb658ddd2013-03-12 10:15:10 -07003950
3951 def __init__(self, xid=None, match=None, cookie=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, flags=None, actions=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08003952 if xid != None:
3953 self.xid = xid
3954 else:
3955 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07003956 if match != None:
3957 self.match = match
3958 else:
3959 self.match = common.match()
3960 if cookie != None:
3961 self.cookie = cookie
3962 else:
3963 self.cookie = 0
3964 if idle_timeout != None:
3965 self.idle_timeout = idle_timeout
3966 else:
3967 self.idle_timeout = 0
3968 if hard_timeout != None:
3969 self.hard_timeout = hard_timeout
3970 else:
3971 self.hard_timeout = 0
3972 if priority != None:
3973 self.priority = priority
3974 else:
3975 self.priority = 0
3976 if buffer_id != None:
3977 self.buffer_id = buffer_id
3978 else:
3979 self.buffer_id = 0
3980 if out_port != None:
3981 self.out_port = out_port
3982 else:
3983 self.out_port = 0
3984 if flags != None:
3985 self.flags = flags
3986 else:
3987 self.flags = 0
3988 if actions != None:
3989 self.actions = actions
3990 else:
3991 self.actions = []
Rich Lane7dcdf022013-12-11 14:45:27 -08003992 return
Rich Laneb658ddd2013-03-12 10:15:10 -07003993
3994 def pack(self):
3995 packed = []
3996 packed.append(struct.pack("!B", self.version))
3997 packed.append(struct.pack("!B", self.type))
3998 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3999 packed.append(struct.pack("!L", self.xid))
4000 packed.append(self.match.pack())
4001 packed.append(struct.pack("!Q", self.cookie))
Dan Talaycof6202252013-07-02 01:00:29 -07004002 packed.append(util.pack_fm_cmd(self._command))
Rich Laneb658ddd2013-03-12 10:15:10 -07004003 packed.append(struct.pack("!H", self.idle_timeout))
4004 packed.append(struct.pack("!H", self.hard_timeout))
4005 packed.append(struct.pack("!H", self.priority))
4006 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -07004007 packed.append(util.pack_port_no(self.out_port))
Rich Laneb658ddd2013-03-12 10:15:10 -07004008 packed.append(struct.pack("!H", self.flags))
Rich Lane7dcdf022013-12-11 14:45:27 -08004009 packed.append(loxi.generic_util.pack_list(self.actions))
Rich Laneb658ddd2013-03-12 10:15:10 -07004010 length = sum([len(x) for x in packed])
4011 packed[2] = struct.pack("!H", length)
4012 return ''.join(packed)
4013
4014 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004015 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07004016 obj = flow_delete()
Dan Talaycof6202252013-07-02 01:00:29 -07004017 _version = reader.read("!B")[0]
4018 assert(_version == 1)
4019 _type = reader.read("!B")[0]
4020 assert(_type == 14)
4021 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004022 orig_reader = reader
4023 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07004024 obj.xid = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07004025 obj.match = common.match.unpack(reader)
Dan Talaycof6202252013-07-02 01:00:29 -07004026 obj.cookie = reader.read("!Q")[0]
4027 __command = util.unpack_fm_cmd(reader)
4028 assert(__command == 3)
4029 obj.idle_timeout = reader.read("!H")[0]
4030 obj.hard_timeout = reader.read("!H")[0]
4031 obj.priority = reader.read("!H")[0]
4032 obj.buffer_id = reader.read("!L")[0]
4033 obj.out_port = util.unpack_port_no(reader)
4034 obj.flags = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004035 obj.actions = loxi.generic_util.unpack_list(reader, action.action.unpack)
Rich Laneb658ddd2013-03-12 10:15:10 -07004036 return obj
4037
4038 def __eq__(self, other):
4039 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07004040 if self.xid != other.xid: return False
4041 if self.match != other.match: return False
4042 if self.cookie != other.cookie: return False
4043 if self.idle_timeout != other.idle_timeout: return False
4044 if self.hard_timeout != other.hard_timeout: return False
4045 if self.priority != other.priority: return False
4046 if self.buffer_id != other.buffer_id: return False
4047 if self.out_port != other.out_port: return False
4048 if self.flags != other.flags: return False
4049 if self.actions != other.actions: return False
4050 return True
4051
Rich Laneb658ddd2013-03-12 10:15:10 -07004052 def pretty_print(self, q):
4053 q.text("flow_delete {")
4054 with q.group():
4055 with q.indent(2):
4056 q.breakable()
4057 q.text("xid = ");
4058 if self.xid != None:
4059 q.text("%#x" % self.xid)
4060 else:
4061 q.text('None')
4062 q.text(","); q.breakable()
4063 q.text("match = ");
4064 q.pp(self.match)
4065 q.text(","); q.breakable()
4066 q.text("cookie = ");
4067 q.text("%#x" % self.cookie)
4068 q.text(","); q.breakable()
4069 q.text("idle_timeout = ");
4070 q.text("%#x" % self.idle_timeout)
4071 q.text(","); q.breakable()
4072 q.text("hard_timeout = ");
4073 q.text("%#x" % self.hard_timeout)
4074 q.text(","); q.breakable()
4075 q.text("priority = ");
4076 q.text("%#x" % self.priority)
4077 q.text(","); q.breakable()
4078 q.text("buffer_id = ");
4079 q.text("%#x" % self.buffer_id)
4080 q.text(","); q.breakable()
4081 q.text("out_port = ");
4082 q.text(util.pretty_port(self.out_port))
4083 q.text(","); q.breakable()
4084 q.text("flags = ");
4085 q.text("%#x" % self.flags)
4086 q.text(","); q.breakable()
4087 q.text("actions = ");
4088 q.pp(self.actions)
4089 q.breakable()
4090 q.text('}')
4091
Rich Lane7dcdf022013-12-11 14:45:27 -08004092flow_mod.subtypes[3] = flow_delete
4093
4094class flow_delete_strict(flow_mod):
Dan Talaycof6202252013-07-02 01:00:29 -07004095 version = 1
4096 type = 14
4097 _command = 4
Rich Laneb658ddd2013-03-12 10:15:10 -07004098
4099 def __init__(self, xid=None, match=None, cookie=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, flags=None, actions=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08004100 if xid != None:
4101 self.xid = xid
4102 else:
4103 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07004104 if match != None:
4105 self.match = match
4106 else:
4107 self.match = common.match()
4108 if cookie != None:
4109 self.cookie = cookie
4110 else:
4111 self.cookie = 0
4112 if idle_timeout != None:
4113 self.idle_timeout = idle_timeout
4114 else:
4115 self.idle_timeout = 0
4116 if hard_timeout != None:
4117 self.hard_timeout = hard_timeout
4118 else:
4119 self.hard_timeout = 0
4120 if priority != None:
4121 self.priority = priority
4122 else:
4123 self.priority = 0
4124 if buffer_id != None:
4125 self.buffer_id = buffer_id
4126 else:
4127 self.buffer_id = 0
4128 if out_port != None:
4129 self.out_port = out_port
4130 else:
4131 self.out_port = 0
4132 if flags != None:
4133 self.flags = flags
4134 else:
4135 self.flags = 0
4136 if actions != None:
4137 self.actions = actions
4138 else:
4139 self.actions = []
Rich Lane7dcdf022013-12-11 14:45:27 -08004140 return
Rich Laneb658ddd2013-03-12 10:15:10 -07004141
4142 def pack(self):
4143 packed = []
4144 packed.append(struct.pack("!B", self.version))
4145 packed.append(struct.pack("!B", self.type))
4146 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4147 packed.append(struct.pack("!L", self.xid))
4148 packed.append(self.match.pack())
4149 packed.append(struct.pack("!Q", self.cookie))
Dan Talaycof6202252013-07-02 01:00:29 -07004150 packed.append(util.pack_fm_cmd(self._command))
Rich Laneb658ddd2013-03-12 10:15:10 -07004151 packed.append(struct.pack("!H", self.idle_timeout))
4152 packed.append(struct.pack("!H", self.hard_timeout))
4153 packed.append(struct.pack("!H", self.priority))
4154 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -07004155 packed.append(util.pack_port_no(self.out_port))
Rich Laneb658ddd2013-03-12 10:15:10 -07004156 packed.append(struct.pack("!H", self.flags))
Rich Lane7dcdf022013-12-11 14:45:27 -08004157 packed.append(loxi.generic_util.pack_list(self.actions))
Rich Laneb658ddd2013-03-12 10:15:10 -07004158 length = sum([len(x) for x in packed])
4159 packed[2] = struct.pack("!H", length)
4160 return ''.join(packed)
4161
4162 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004163 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07004164 obj = flow_delete_strict()
Dan Talaycof6202252013-07-02 01:00:29 -07004165 _version = reader.read("!B")[0]
4166 assert(_version == 1)
4167 _type = reader.read("!B")[0]
4168 assert(_type == 14)
4169 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004170 orig_reader = reader
4171 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07004172 obj.xid = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07004173 obj.match = common.match.unpack(reader)
Dan Talaycof6202252013-07-02 01:00:29 -07004174 obj.cookie = reader.read("!Q")[0]
4175 __command = util.unpack_fm_cmd(reader)
4176 assert(__command == 4)
4177 obj.idle_timeout = reader.read("!H")[0]
4178 obj.hard_timeout = reader.read("!H")[0]
4179 obj.priority = reader.read("!H")[0]
4180 obj.buffer_id = reader.read("!L")[0]
4181 obj.out_port = util.unpack_port_no(reader)
4182 obj.flags = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004183 obj.actions = loxi.generic_util.unpack_list(reader, action.action.unpack)
Rich Laneb658ddd2013-03-12 10:15:10 -07004184 return obj
4185
4186 def __eq__(self, other):
4187 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07004188 if self.xid != other.xid: return False
4189 if self.match != other.match: return False
4190 if self.cookie != other.cookie: return False
4191 if self.idle_timeout != other.idle_timeout: return False
4192 if self.hard_timeout != other.hard_timeout: return False
4193 if self.priority != other.priority: return False
4194 if self.buffer_id != other.buffer_id: return False
4195 if self.out_port != other.out_port: return False
4196 if self.flags != other.flags: return False
4197 if self.actions != other.actions: return False
4198 return True
4199
Rich Laneb658ddd2013-03-12 10:15:10 -07004200 def pretty_print(self, q):
4201 q.text("flow_delete_strict {")
4202 with q.group():
4203 with q.indent(2):
4204 q.breakable()
4205 q.text("xid = ");
4206 if self.xid != None:
4207 q.text("%#x" % self.xid)
4208 else:
4209 q.text('None')
4210 q.text(","); q.breakable()
4211 q.text("match = ");
4212 q.pp(self.match)
4213 q.text(","); q.breakable()
4214 q.text("cookie = ");
4215 q.text("%#x" % self.cookie)
4216 q.text(","); q.breakable()
4217 q.text("idle_timeout = ");
4218 q.text("%#x" % self.idle_timeout)
4219 q.text(","); q.breakable()
4220 q.text("hard_timeout = ");
4221 q.text("%#x" % self.hard_timeout)
4222 q.text(","); q.breakable()
4223 q.text("priority = ");
4224 q.text("%#x" % self.priority)
4225 q.text(","); q.breakable()
4226 q.text("buffer_id = ");
4227 q.text("%#x" % self.buffer_id)
4228 q.text(","); q.breakable()
4229 q.text("out_port = ");
4230 q.text(util.pretty_port(self.out_port))
4231 q.text(","); q.breakable()
4232 q.text("flags = ");
4233 q.text("%#x" % self.flags)
4234 q.text(","); q.breakable()
4235 q.text("actions = ");
4236 q.pp(self.actions)
4237 q.breakable()
4238 q.text('}')
4239
Rich Lane7dcdf022013-12-11 14:45:27 -08004240flow_mod.subtypes[4] = flow_delete_strict
4241
4242class flow_mod_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -07004243 version = 1
4244 type = 1
4245 err_type = 3
4246
4247 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08004248 if xid != None:
4249 self.xid = xid
4250 else:
4251 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07004252 if code != None:
4253 self.code = code
4254 else:
4255 self.code = 0
4256 if data != None:
4257 self.data = data
4258 else:
4259 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08004260 return
Rich Lane6f4978c2013-10-20 21:33:52 -07004261
4262 def pack(self):
4263 packed = []
4264 packed.append(struct.pack("!B", self.version))
4265 packed.append(struct.pack("!B", self.type))
4266 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4267 packed.append(struct.pack("!L", self.xid))
4268 packed.append(struct.pack("!H", self.err_type))
4269 packed.append(struct.pack("!H", self.code))
4270 packed.append(self.data)
4271 length = sum([len(x) for x in packed])
4272 packed[2] = struct.pack("!H", length)
4273 return ''.join(packed)
4274
4275 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004276 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07004277 obj = flow_mod_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -07004278 _version = reader.read("!B")[0]
4279 assert(_version == 1)
4280 _type = reader.read("!B")[0]
4281 assert(_type == 1)
4282 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004283 orig_reader = reader
4284 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07004285 obj.xid = reader.read("!L")[0]
4286 _err_type = reader.read("!H")[0]
4287 assert(_err_type == 3)
4288 obj.code = reader.read("!H")[0]
4289 obj.data = str(reader.read_all())
4290 return obj
4291
4292 def __eq__(self, other):
4293 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07004294 if self.xid != other.xid: return False
4295 if self.code != other.code: return False
4296 if self.data != other.data: return False
4297 return True
4298
Rich Lane6f4978c2013-10-20 21:33:52 -07004299 def pretty_print(self, q):
4300 q.text("flow_mod_failed_error_msg {")
4301 with q.group():
4302 with q.indent(2):
4303 q.breakable()
4304 q.text("xid = ");
4305 if self.xid != None:
4306 q.text("%#x" % self.xid)
4307 else:
4308 q.text('None')
4309 q.text(","); q.breakable()
4310 q.text("code = ");
4311 q.text("%#x" % self.code)
4312 q.text(","); q.breakable()
4313 q.text("data = ");
4314 q.pp(self.data)
4315 q.breakable()
4316 q.text('}')
4317
Rich Lane7dcdf022013-12-11 14:45:27 -08004318error_msg.subtypes[3] = flow_mod_failed_error_msg
4319
4320class flow_modify(flow_mod):
Dan Talaycof6202252013-07-02 01:00:29 -07004321 version = 1
4322 type = 14
4323 _command = 1
Rich Laneb658ddd2013-03-12 10:15:10 -07004324
4325 def __init__(self, xid=None, match=None, cookie=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, flags=None, actions=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08004326 if xid != None:
4327 self.xid = xid
4328 else:
4329 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07004330 if match != None:
4331 self.match = match
4332 else:
4333 self.match = common.match()
4334 if cookie != None:
4335 self.cookie = cookie
4336 else:
4337 self.cookie = 0
4338 if idle_timeout != None:
4339 self.idle_timeout = idle_timeout
4340 else:
4341 self.idle_timeout = 0
4342 if hard_timeout != None:
4343 self.hard_timeout = hard_timeout
4344 else:
4345 self.hard_timeout = 0
4346 if priority != None:
4347 self.priority = priority
4348 else:
4349 self.priority = 0
4350 if buffer_id != None:
4351 self.buffer_id = buffer_id
4352 else:
4353 self.buffer_id = 0
4354 if out_port != None:
4355 self.out_port = out_port
4356 else:
4357 self.out_port = 0
4358 if flags != None:
4359 self.flags = flags
4360 else:
4361 self.flags = 0
4362 if actions != None:
4363 self.actions = actions
4364 else:
4365 self.actions = []
Rich Lane7dcdf022013-12-11 14:45:27 -08004366 return
Rich Laneb658ddd2013-03-12 10:15:10 -07004367
4368 def pack(self):
4369 packed = []
4370 packed.append(struct.pack("!B", self.version))
4371 packed.append(struct.pack("!B", self.type))
4372 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4373 packed.append(struct.pack("!L", self.xid))
4374 packed.append(self.match.pack())
4375 packed.append(struct.pack("!Q", self.cookie))
Dan Talaycof6202252013-07-02 01:00:29 -07004376 packed.append(util.pack_fm_cmd(self._command))
Rich Laneb658ddd2013-03-12 10:15:10 -07004377 packed.append(struct.pack("!H", self.idle_timeout))
4378 packed.append(struct.pack("!H", self.hard_timeout))
4379 packed.append(struct.pack("!H", self.priority))
4380 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -07004381 packed.append(util.pack_port_no(self.out_port))
Rich Laneb658ddd2013-03-12 10:15:10 -07004382 packed.append(struct.pack("!H", self.flags))
Rich Lane7dcdf022013-12-11 14:45:27 -08004383 packed.append(loxi.generic_util.pack_list(self.actions))
Rich Laneb658ddd2013-03-12 10:15:10 -07004384 length = sum([len(x) for x in packed])
4385 packed[2] = struct.pack("!H", length)
4386 return ''.join(packed)
4387
4388 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004389 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07004390 obj = flow_modify()
Dan Talaycof6202252013-07-02 01:00:29 -07004391 _version = reader.read("!B")[0]
4392 assert(_version == 1)
4393 _type = reader.read("!B")[0]
4394 assert(_type == 14)
4395 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004396 orig_reader = reader
4397 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07004398 obj.xid = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07004399 obj.match = common.match.unpack(reader)
Dan Talaycof6202252013-07-02 01:00:29 -07004400 obj.cookie = reader.read("!Q")[0]
4401 __command = util.unpack_fm_cmd(reader)
4402 assert(__command == 1)
4403 obj.idle_timeout = reader.read("!H")[0]
4404 obj.hard_timeout = reader.read("!H")[0]
4405 obj.priority = reader.read("!H")[0]
4406 obj.buffer_id = reader.read("!L")[0]
4407 obj.out_port = util.unpack_port_no(reader)
4408 obj.flags = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004409 obj.actions = loxi.generic_util.unpack_list(reader, action.action.unpack)
Rich Laneb658ddd2013-03-12 10:15:10 -07004410 return obj
4411
4412 def __eq__(self, other):
4413 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07004414 if self.xid != other.xid: return False
4415 if self.match != other.match: return False
4416 if self.cookie != other.cookie: return False
4417 if self.idle_timeout != other.idle_timeout: return False
4418 if self.hard_timeout != other.hard_timeout: return False
4419 if self.priority != other.priority: return False
4420 if self.buffer_id != other.buffer_id: return False
4421 if self.out_port != other.out_port: return False
4422 if self.flags != other.flags: return False
4423 if self.actions != other.actions: return False
4424 return True
4425
Rich Laneb658ddd2013-03-12 10:15:10 -07004426 def pretty_print(self, q):
4427 q.text("flow_modify {")
4428 with q.group():
4429 with q.indent(2):
4430 q.breakable()
4431 q.text("xid = ");
4432 if self.xid != None:
4433 q.text("%#x" % self.xid)
4434 else:
4435 q.text('None')
4436 q.text(","); q.breakable()
4437 q.text("match = ");
4438 q.pp(self.match)
4439 q.text(","); q.breakable()
4440 q.text("cookie = ");
4441 q.text("%#x" % self.cookie)
4442 q.text(","); q.breakable()
4443 q.text("idle_timeout = ");
4444 q.text("%#x" % self.idle_timeout)
4445 q.text(","); q.breakable()
4446 q.text("hard_timeout = ");
4447 q.text("%#x" % self.hard_timeout)
4448 q.text(","); q.breakable()
4449 q.text("priority = ");
4450 q.text("%#x" % self.priority)
4451 q.text(","); q.breakable()
4452 q.text("buffer_id = ");
4453 q.text("%#x" % self.buffer_id)
4454 q.text(","); q.breakable()
4455 q.text("out_port = ");
4456 q.text(util.pretty_port(self.out_port))
4457 q.text(","); q.breakable()
4458 q.text("flags = ");
4459 q.text("%#x" % self.flags)
4460 q.text(","); q.breakable()
4461 q.text("actions = ");
4462 q.pp(self.actions)
4463 q.breakable()
4464 q.text('}')
4465
Rich Lane7dcdf022013-12-11 14:45:27 -08004466flow_mod.subtypes[1] = flow_modify
4467
4468class flow_modify_strict(flow_mod):
Dan Talaycof6202252013-07-02 01:00:29 -07004469 version = 1
4470 type = 14
4471 _command = 2
Rich Laneb658ddd2013-03-12 10:15:10 -07004472
4473 def __init__(self, xid=None, match=None, cookie=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, flags=None, actions=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08004474 if xid != None:
4475 self.xid = xid
4476 else:
4477 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07004478 if match != None:
4479 self.match = match
4480 else:
4481 self.match = common.match()
4482 if cookie != None:
4483 self.cookie = cookie
4484 else:
4485 self.cookie = 0
4486 if idle_timeout != None:
4487 self.idle_timeout = idle_timeout
4488 else:
4489 self.idle_timeout = 0
4490 if hard_timeout != None:
4491 self.hard_timeout = hard_timeout
4492 else:
4493 self.hard_timeout = 0
4494 if priority != None:
4495 self.priority = priority
4496 else:
4497 self.priority = 0
4498 if buffer_id != None:
4499 self.buffer_id = buffer_id
4500 else:
4501 self.buffer_id = 0
4502 if out_port != None:
4503 self.out_port = out_port
4504 else:
4505 self.out_port = 0
4506 if flags != None:
4507 self.flags = flags
4508 else:
4509 self.flags = 0
4510 if actions != None:
4511 self.actions = actions
4512 else:
4513 self.actions = []
Rich Lane7dcdf022013-12-11 14:45:27 -08004514 return
Rich Laneb658ddd2013-03-12 10:15:10 -07004515
4516 def pack(self):
4517 packed = []
4518 packed.append(struct.pack("!B", self.version))
4519 packed.append(struct.pack("!B", self.type))
4520 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4521 packed.append(struct.pack("!L", self.xid))
4522 packed.append(self.match.pack())
4523 packed.append(struct.pack("!Q", self.cookie))
Dan Talaycof6202252013-07-02 01:00:29 -07004524 packed.append(util.pack_fm_cmd(self._command))
Rich Laneb658ddd2013-03-12 10:15:10 -07004525 packed.append(struct.pack("!H", self.idle_timeout))
4526 packed.append(struct.pack("!H", self.hard_timeout))
4527 packed.append(struct.pack("!H", self.priority))
4528 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -07004529 packed.append(util.pack_port_no(self.out_port))
Rich Laneb658ddd2013-03-12 10:15:10 -07004530 packed.append(struct.pack("!H", self.flags))
Rich Lane7dcdf022013-12-11 14:45:27 -08004531 packed.append(loxi.generic_util.pack_list(self.actions))
Rich Laneb658ddd2013-03-12 10:15:10 -07004532 length = sum([len(x) for x in packed])
4533 packed[2] = struct.pack("!H", length)
4534 return ''.join(packed)
4535
4536 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004537 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07004538 obj = flow_modify_strict()
Dan Talaycof6202252013-07-02 01:00:29 -07004539 _version = reader.read("!B")[0]
4540 assert(_version == 1)
4541 _type = reader.read("!B")[0]
4542 assert(_type == 14)
4543 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004544 orig_reader = reader
4545 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07004546 obj.xid = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07004547 obj.match = common.match.unpack(reader)
Dan Talaycof6202252013-07-02 01:00:29 -07004548 obj.cookie = reader.read("!Q")[0]
4549 __command = util.unpack_fm_cmd(reader)
4550 assert(__command == 2)
4551 obj.idle_timeout = reader.read("!H")[0]
4552 obj.hard_timeout = reader.read("!H")[0]
4553 obj.priority = reader.read("!H")[0]
4554 obj.buffer_id = reader.read("!L")[0]
4555 obj.out_port = util.unpack_port_no(reader)
4556 obj.flags = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004557 obj.actions = loxi.generic_util.unpack_list(reader, action.action.unpack)
Rich Laneb658ddd2013-03-12 10:15:10 -07004558 return obj
4559
4560 def __eq__(self, other):
4561 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07004562 if self.xid != other.xid: return False
4563 if self.match != other.match: return False
4564 if self.cookie != other.cookie: return False
4565 if self.idle_timeout != other.idle_timeout: return False
4566 if self.hard_timeout != other.hard_timeout: return False
4567 if self.priority != other.priority: return False
4568 if self.buffer_id != other.buffer_id: return False
4569 if self.out_port != other.out_port: return False
4570 if self.flags != other.flags: return False
4571 if self.actions != other.actions: return False
4572 return True
4573
Rich Laneb658ddd2013-03-12 10:15:10 -07004574 def pretty_print(self, q):
4575 q.text("flow_modify_strict {")
4576 with q.group():
4577 with q.indent(2):
4578 q.breakable()
4579 q.text("xid = ");
4580 if self.xid != None:
4581 q.text("%#x" % self.xid)
4582 else:
4583 q.text('None')
4584 q.text(","); q.breakable()
4585 q.text("match = ");
4586 q.pp(self.match)
4587 q.text(","); q.breakable()
4588 q.text("cookie = ");
4589 q.text("%#x" % self.cookie)
4590 q.text(","); q.breakable()
4591 q.text("idle_timeout = ");
4592 q.text("%#x" % self.idle_timeout)
4593 q.text(","); q.breakable()
4594 q.text("hard_timeout = ");
4595 q.text("%#x" % self.hard_timeout)
4596 q.text(","); q.breakable()
4597 q.text("priority = ");
4598 q.text("%#x" % self.priority)
4599 q.text(","); q.breakable()
4600 q.text("buffer_id = ");
4601 q.text("%#x" % self.buffer_id)
4602 q.text(","); q.breakable()
4603 q.text("out_port = ");
4604 q.text(util.pretty_port(self.out_port))
4605 q.text(","); q.breakable()
4606 q.text("flags = ");
4607 q.text("%#x" % self.flags)
4608 q.text(","); q.breakable()
4609 q.text("actions = ");
4610 q.pp(self.actions)
4611 q.breakable()
4612 q.text('}')
4613
Rich Lane7dcdf022013-12-11 14:45:27 -08004614flow_mod.subtypes[2] = flow_modify_strict
4615
4616class flow_removed(message):
Dan Talaycof6202252013-07-02 01:00:29 -07004617 version = 1
4618 type = 11
Rich Laneb658ddd2013-03-12 10:15:10 -07004619
Rich Lanec2ee4b82013-04-24 17:12:38 -07004620 def __init__(self, xid=None, match=None, cookie=None, priority=None, reason=None, duration_sec=None, duration_nsec=None, idle_timeout=None, packet_count=None, byte_count=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08004621 if xid != None:
4622 self.xid = xid
4623 else:
4624 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07004625 if match != None:
4626 self.match = match
4627 else:
4628 self.match = common.match()
4629 if cookie != None:
4630 self.cookie = cookie
4631 else:
4632 self.cookie = 0
4633 if priority != None:
4634 self.priority = priority
4635 else:
4636 self.priority = 0
4637 if reason != None:
4638 self.reason = reason
4639 else:
4640 self.reason = 0
Rich Laneb658ddd2013-03-12 10:15:10 -07004641 if duration_sec != None:
4642 self.duration_sec = duration_sec
4643 else:
4644 self.duration_sec = 0
4645 if duration_nsec != None:
4646 self.duration_nsec = duration_nsec
4647 else:
4648 self.duration_nsec = 0
4649 if idle_timeout != None:
4650 self.idle_timeout = idle_timeout
4651 else:
4652 self.idle_timeout = 0
Rich Laneb658ddd2013-03-12 10:15:10 -07004653 if packet_count != None:
4654 self.packet_count = packet_count
4655 else:
4656 self.packet_count = 0
4657 if byte_count != None:
4658 self.byte_count = byte_count
4659 else:
4660 self.byte_count = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08004661 return
Rich Laneb658ddd2013-03-12 10:15:10 -07004662
4663 def pack(self):
4664 packed = []
4665 packed.append(struct.pack("!B", self.version))
4666 packed.append(struct.pack("!B", self.type))
4667 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4668 packed.append(struct.pack("!L", self.xid))
4669 packed.append(self.match.pack())
4670 packed.append(struct.pack("!Q", self.cookie))
4671 packed.append(struct.pack("!H", self.priority))
4672 packed.append(struct.pack("!B", self.reason))
Rich Lanec2ee4b82013-04-24 17:12:38 -07004673 packed.append('\x00' * 1)
Rich Laneb658ddd2013-03-12 10:15:10 -07004674 packed.append(struct.pack("!L", self.duration_sec))
4675 packed.append(struct.pack("!L", self.duration_nsec))
4676 packed.append(struct.pack("!H", self.idle_timeout))
Rich Lanec2ee4b82013-04-24 17:12:38 -07004677 packed.append('\x00' * 2)
Rich Laneb658ddd2013-03-12 10:15:10 -07004678 packed.append(struct.pack("!Q", self.packet_count))
4679 packed.append(struct.pack("!Q", self.byte_count))
4680 length = sum([len(x) for x in packed])
4681 packed[2] = struct.pack("!H", length)
4682 return ''.join(packed)
4683
4684 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004685 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07004686 obj = flow_removed()
Dan Talaycof6202252013-07-02 01:00:29 -07004687 _version = reader.read("!B")[0]
4688 assert(_version == 1)
4689 _type = reader.read("!B")[0]
4690 assert(_type == 11)
4691 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004692 orig_reader = reader
4693 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07004694 obj.xid = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07004695 obj.match = common.match.unpack(reader)
Dan Talaycof6202252013-07-02 01:00:29 -07004696 obj.cookie = reader.read("!Q")[0]
4697 obj.priority = reader.read("!H")[0]
4698 obj.reason = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07004699 reader.skip(1)
Dan Talaycof6202252013-07-02 01:00:29 -07004700 obj.duration_sec = reader.read("!L")[0]
4701 obj.duration_nsec = reader.read("!L")[0]
4702 obj.idle_timeout = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07004703 reader.skip(2)
Dan Talaycof6202252013-07-02 01:00:29 -07004704 obj.packet_count = reader.read("!Q")[0]
4705 obj.byte_count = reader.read("!Q")[0]
Rich Laneb658ddd2013-03-12 10:15:10 -07004706 return obj
4707
4708 def __eq__(self, other):
4709 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07004710 if self.xid != other.xid: return False
4711 if self.match != other.match: return False
4712 if self.cookie != other.cookie: return False
4713 if self.priority != other.priority: return False
4714 if self.reason != other.reason: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07004715 if self.duration_sec != other.duration_sec: return False
4716 if self.duration_nsec != other.duration_nsec: return False
4717 if self.idle_timeout != other.idle_timeout: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07004718 if self.packet_count != other.packet_count: return False
4719 if self.byte_count != other.byte_count: return False
4720 return True
4721
Rich Laneb658ddd2013-03-12 10:15:10 -07004722 def pretty_print(self, q):
4723 q.text("flow_removed {")
4724 with q.group():
4725 with q.indent(2):
4726 q.breakable()
4727 q.text("xid = ");
4728 if self.xid != None:
4729 q.text("%#x" % self.xid)
4730 else:
4731 q.text('None')
4732 q.text(","); q.breakable()
4733 q.text("match = ");
4734 q.pp(self.match)
4735 q.text(","); q.breakable()
4736 q.text("cookie = ");
4737 q.text("%#x" % self.cookie)
4738 q.text(","); q.breakable()
4739 q.text("priority = ");
4740 q.text("%#x" % self.priority)
4741 q.text(","); q.breakable()
4742 q.text("reason = ");
4743 q.text("%#x" % self.reason)
4744 q.text(","); q.breakable()
Rich Laneb658ddd2013-03-12 10:15:10 -07004745 q.text("duration_sec = ");
4746 q.text("%#x" % self.duration_sec)
4747 q.text(","); q.breakable()
4748 q.text("duration_nsec = ");
4749 q.text("%#x" % self.duration_nsec)
4750 q.text(","); q.breakable()
4751 q.text("idle_timeout = ");
4752 q.text("%#x" % self.idle_timeout)
4753 q.text(","); q.breakable()
Rich Laneb658ddd2013-03-12 10:15:10 -07004754 q.text("packet_count = ");
4755 q.text("%#x" % self.packet_count)
4756 q.text(","); q.breakable()
4757 q.text("byte_count = ");
4758 q.text("%#x" % self.byte_count)
4759 q.breakable()
4760 q.text('}')
4761
Rich Lane7dcdf022013-12-11 14:45:27 -08004762message.subtypes[11] = flow_removed
4763
4764class flow_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -07004765 version = 1
4766 type = 17
4767 stats_type = 1
Rich Laneb658ddd2013-03-12 10:15:10 -07004768
4769 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08004770 if xid != None:
4771 self.xid = xid
4772 else:
4773 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07004774 if flags != None:
4775 self.flags = flags
4776 else:
4777 self.flags = 0
4778 if entries != None:
4779 self.entries = entries
4780 else:
4781 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -08004782 return
Rich Laneb658ddd2013-03-12 10:15:10 -07004783
4784 def pack(self):
4785 packed = []
4786 packed.append(struct.pack("!B", self.version))
4787 packed.append(struct.pack("!B", self.type))
4788 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4789 packed.append(struct.pack("!L", self.xid))
4790 packed.append(struct.pack("!H", self.stats_type))
4791 packed.append(struct.pack("!H", self.flags))
Rich Lane7dcdf022013-12-11 14:45:27 -08004792 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Laneb658ddd2013-03-12 10:15:10 -07004793 length = sum([len(x) for x in packed])
4794 packed[2] = struct.pack("!H", length)
4795 return ''.join(packed)
4796
4797 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004798 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07004799 obj = flow_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07004800 _version = reader.read("!B")[0]
4801 assert(_version == 1)
4802 _type = reader.read("!B")[0]
4803 assert(_type == 17)
4804 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004805 orig_reader = reader
4806 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07004807 obj.xid = reader.read("!L")[0]
4808 _stats_type = reader.read("!H")[0]
4809 assert(_stats_type == 1)
4810 obj.flags = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004811 obj.entries = loxi.generic_util.unpack_list(reader, common.flow_stats_entry.unpack)
Rich Laneb658ddd2013-03-12 10:15:10 -07004812 return obj
4813
4814 def __eq__(self, other):
4815 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07004816 if self.xid != other.xid: return False
4817 if self.flags != other.flags: return False
4818 if self.entries != other.entries: return False
4819 return True
4820
Rich Laneb658ddd2013-03-12 10:15:10 -07004821 def pretty_print(self, q):
4822 q.text("flow_stats_reply {")
4823 with q.group():
4824 with q.indent(2):
4825 q.breakable()
4826 q.text("xid = ");
4827 if self.xid != None:
4828 q.text("%#x" % self.xid)
4829 else:
4830 q.text('None')
4831 q.text(","); q.breakable()
4832 q.text("flags = ");
4833 q.text("%#x" % self.flags)
4834 q.text(","); q.breakable()
4835 q.text("entries = ");
4836 q.pp(self.entries)
4837 q.breakable()
4838 q.text('}')
4839
Rich Lane7dcdf022013-12-11 14:45:27 -08004840stats_reply.subtypes[1] = flow_stats_reply
4841
4842class flow_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -07004843 version = 1
4844 type = 16
4845 stats_type = 1
Rich Laneb658ddd2013-03-12 10:15:10 -07004846
Rich Lanec2ee4b82013-04-24 17:12:38 -07004847 def __init__(self, xid=None, flags=None, match=None, table_id=None, out_port=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08004848 if xid != None:
4849 self.xid = xid
4850 else:
4851 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07004852 if flags != None:
4853 self.flags = flags
4854 else:
4855 self.flags = 0
4856 if match != None:
4857 self.match = match
4858 else:
4859 self.match = common.match()
4860 if table_id != None:
4861 self.table_id = table_id
4862 else:
4863 self.table_id = 0
Rich Laneb658ddd2013-03-12 10:15:10 -07004864 if out_port != None:
4865 self.out_port = out_port
4866 else:
4867 self.out_port = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08004868 return
Rich Laneb658ddd2013-03-12 10:15:10 -07004869
4870 def pack(self):
4871 packed = []
4872 packed.append(struct.pack("!B", self.version))
4873 packed.append(struct.pack("!B", self.type))
4874 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4875 packed.append(struct.pack("!L", self.xid))
4876 packed.append(struct.pack("!H", self.stats_type))
4877 packed.append(struct.pack("!H", self.flags))
4878 packed.append(self.match.pack())
4879 packed.append(struct.pack("!B", self.table_id))
Rich Lanec2ee4b82013-04-24 17:12:38 -07004880 packed.append('\x00' * 1)
Dan Talaycof6202252013-07-02 01:00:29 -07004881 packed.append(util.pack_port_no(self.out_port))
Rich Laneb658ddd2013-03-12 10:15:10 -07004882 length = sum([len(x) for x in packed])
4883 packed[2] = struct.pack("!H", length)
4884 return ''.join(packed)
4885
4886 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004887 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07004888 obj = flow_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -07004889 _version = reader.read("!B")[0]
4890 assert(_version == 1)
4891 _type = reader.read("!B")[0]
4892 assert(_type == 16)
4893 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004894 orig_reader = reader
4895 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07004896 obj.xid = reader.read("!L")[0]
4897 _stats_type = reader.read("!H")[0]
4898 assert(_stats_type == 1)
4899 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07004900 obj.match = common.match.unpack(reader)
Dan Talaycof6202252013-07-02 01:00:29 -07004901 obj.table_id = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07004902 reader.skip(1)
Dan Talaycof6202252013-07-02 01:00:29 -07004903 obj.out_port = util.unpack_port_no(reader)
Rich Laneb658ddd2013-03-12 10:15:10 -07004904 return obj
4905
4906 def __eq__(self, other):
4907 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07004908 if self.xid != other.xid: return False
4909 if self.flags != other.flags: return False
4910 if self.match != other.match: return False
4911 if self.table_id != other.table_id: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07004912 if self.out_port != other.out_port: return False
4913 return True
4914
Rich Laneb658ddd2013-03-12 10:15:10 -07004915 def pretty_print(self, q):
4916 q.text("flow_stats_request {")
4917 with q.group():
4918 with q.indent(2):
4919 q.breakable()
4920 q.text("xid = ");
4921 if self.xid != None:
4922 q.text("%#x" % self.xid)
4923 else:
4924 q.text('None')
4925 q.text(","); q.breakable()
4926 q.text("flags = ");
4927 q.text("%#x" % self.flags)
4928 q.text(","); q.breakable()
4929 q.text("match = ");
4930 q.pp(self.match)
4931 q.text(","); q.breakable()
4932 q.text("table_id = ");
4933 q.text("%#x" % self.table_id)
4934 q.text(","); q.breakable()
Rich Laneb658ddd2013-03-12 10:15:10 -07004935 q.text("out_port = ");
4936 q.text(util.pretty_port(self.out_port))
4937 q.breakable()
4938 q.text('}')
4939
Rich Lane7dcdf022013-12-11 14:45:27 -08004940stats_request.subtypes[1] = flow_stats_request
4941
4942class get_config_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -07004943 version = 1
4944 type = 8
Rich Laneb658ddd2013-03-12 10:15:10 -07004945
4946 def __init__(self, xid=None, flags=None, miss_send_len=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08004947 if xid != None:
4948 self.xid = xid
4949 else:
4950 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07004951 if flags != None:
4952 self.flags = flags
4953 else:
4954 self.flags = 0
4955 if miss_send_len != None:
4956 self.miss_send_len = miss_send_len
4957 else:
4958 self.miss_send_len = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08004959 return
Rich Laneb658ddd2013-03-12 10:15:10 -07004960
4961 def pack(self):
4962 packed = []
4963 packed.append(struct.pack("!B", self.version))
4964 packed.append(struct.pack("!B", self.type))
4965 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4966 packed.append(struct.pack("!L", self.xid))
4967 packed.append(struct.pack("!H", self.flags))
4968 packed.append(struct.pack("!H", self.miss_send_len))
4969 length = sum([len(x) for x in packed])
4970 packed[2] = struct.pack("!H", length)
4971 return ''.join(packed)
4972
4973 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004974 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07004975 obj = get_config_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07004976 _version = reader.read("!B")[0]
4977 assert(_version == 1)
4978 _type = reader.read("!B")[0]
4979 assert(_type == 8)
4980 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004981 orig_reader = reader
4982 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07004983 obj.xid = reader.read("!L")[0]
4984 obj.flags = reader.read("!H")[0]
4985 obj.miss_send_len = reader.read("!H")[0]
Rich Laneb658ddd2013-03-12 10:15:10 -07004986 return obj
4987
4988 def __eq__(self, other):
4989 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07004990 if self.xid != other.xid: return False
4991 if self.flags != other.flags: return False
4992 if self.miss_send_len != other.miss_send_len: return False
4993 return True
4994
Rich Laneb658ddd2013-03-12 10:15:10 -07004995 def pretty_print(self, q):
4996 q.text("get_config_reply {")
4997 with q.group():
4998 with q.indent(2):
4999 q.breakable()
5000 q.text("xid = ");
5001 if self.xid != None:
5002 q.text("%#x" % self.xid)
5003 else:
5004 q.text('None')
5005 q.text(","); q.breakable()
5006 q.text("flags = ");
5007 q.text("%#x" % self.flags)
5008 q.text(","); q.breakable()
5009 q.text("miss_send_len = ");
5010 q.text("%#x" % self.miss_send_len)
5011 q.breakable()
5012 q.text('}')
5013
Rich Lane7dcdf022013-12-11 14:45:27 -08005014message.subtypes[8] = get_config_reply
5015
5016class get_config_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -07005017 version = 1
5018 type = 7
Rich Laneb658ddd2013-03-12 10:15:10 -07005019
5020 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005021 if xid != None:
5022 self.xid = xid
5023 else:
5024 self.xid = None
5025 return
Rich Laneb658ddd2013-03-12 10:15:10 -07005026
5027 def pack(self):
5028 packed = []
5029 packed.append(struct.pack("!B", self.version))
5030 packed.append(struct.pack("!B", self.type))
5031 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5032 packed.append(struct.pack("!L", self.xid))
5033 length = sum([len(x) for x in packed])
5034 packed[2] = struct.pack("!H", length)
5035 return ''.join(packed)
5036
5037 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005038 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07005039 obj = get_config_request()
Dan Talaycof6202252013-07-02 01:00:29 -07005040 _version = reader.read("!B")[0]
5041 assert(_version == 1)
5042 _type = reader.read("!B")[0]
5043 assert(_type == 7)
5044 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005045 orig_reader = reader
5046 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07005047 obj.xid = reader.read("!L")[0]
Rich Laneb658ddd2013-03-12 10:15:10 -07005048 return obj
5049
5050 def __eq__(self, other):
5051 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07005052 if self.xid != other.xid: return False
5053 return True
5054
Rich Laneb658ddd2013-03-12 10:15:10 -07005055 def pretty_print(self, q):
5056 q.text("get_config_request {")
5057 with q.group():
5058 with q.indent(2):
5059 q.breakable()
5060 q.text("xid = ");
5061 if self.xid != None:
5062 q.text("%#x" % self.xid)
5063 else:
5064 q.text('None')
5065 q.breakable()
5066 q.text('}')
5067
Rich Lane7dcdf022013-12-11 14:45:27 -08005068message.subtypes[7] = get_config_request
5069
5070class hello(message):
Dan Talaycof6202252013-07-02 01:00:29 -07005071 version = 1
5072 type = 0
Rich Laneb658ddd2013-03-12 10:15:10 -07005073
5074 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005075 if xid != None:
5076 self.xid = xid
5077 else:
5078 self.xid = None
5079 return
Rich Laneb658ddd2013-03-12 10:15:10 -07005080
5081 def pack(self):
5082 packed = []
5083 packed.append(struct.pack("!B", self.version))
5084 packed.append(struct.pack("!B", self.type))
5085 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5086 packed.append(struct.pack("!L", self.xid))
5087 length = sum([len(x) for x in packed])
5088 packed[2] = struct.pack("!H", length)
5089 return ''.join(packed)
5090
5091 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005092 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07005093 obj = hello()
Dan Talaycof6202252013-07-02 01:00:29 -07005094 _version = reader.read("!B")[0]
5095 assert(_version == 1)
5096 _type = reader.read("!B")[0]
5097 assert(_type == 0)
5098 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005099 orig_reader = reader
5100 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07005101 obj.xid = reader.read("!L")[0]
Rich Laneb658ddd2013-03-12 10:15:10 -07005102 return obj
5103
5104 def __eq__(self, other):
5105 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07005106 if self.xid != other.xid: return False
5107 return True
5108
Rich Laneb658ddd2013-03-12 10:15:10 -07005109 def pretty_print(self, q):
5110 q.text("hello {")
5111 with q.group():
5112 with q.indent(2):
5113 q.breakable()
5114 q.text("xid = ");
5115 if self.xid != None:
5116 q.text("%#x" % self.xid)
5117 else:
5118 q.text('None')
5119 q.breakable()
5120 q.text('}')
5121
Rich Lane7dcdf022013-12-11 14:45:27 -08005122message.subtypes[0] = hello
5123
5124class hello_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -07005125 version = 1
5126 type = 1
5127 err_type = 0
5128
5129 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005130 if xid != None:
5131 self.xid = xid
5132 else:
5133 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07005134 if code != None:
5135 self.code = code
5136 else:
5137 self.code = 0
5138 if data != None:
5139 self.data = data
5140 else:
5141 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08005142 return
Rich Lane6f4978c2013-10-20 21:33:52 -07005143
5144 def pack(self):
5145 packed = []
5146 packed.append(struct.pack("!B", self.version))
5147 packed.append(struct.pack("!B", self.type))
5148 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5149 packed.append(struct.pack("!L", self.xid))
5150 packed.append(struct.pack("!H", self.err_type))
5151 packed.append(struct.pack("!H", self.code))
5152 packed.append(self.data)
5153 length = sum([len(x) for x in packed])
5154 packed[2] = struct.pack("!H", length)
5155 return ''.join(packed)
5156
5157 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005158 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07005159 obj = hello_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -07005160 _version = reader.read("!B")[0]
5161 assert(_version == 1)
5162 _type = reader.read("!B")[0]
5163 assert(_type == 1)
5164 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005165 orig_reader = reader
5166 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07005167 obj.xid = reader.read("!L")[0]
5168 _err_type = reader.read("!H")[0]
5169 assert(_err_type == 0)
5170 obj.code = reader.read("!H")[0]
5171 obj.data = str(reader.read_all())
5172 return obj
5173
5174 def __eq__(self, other):
5175 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07005176 if self.xid != other.xid: return False
5177 if self.code != other.code: return False
5178 if self.data != other.data: return False
5179 return True
5180
Rich Lane6f4978c2013-10-20 21:33:52 -07005181 def pretty_print(self, q):
5182 q.text("hello_failed_error_msg {")
5183 with q.group():
5184 with q.indent(2):
5185 q.breakable()
5186 q.text("xid = ");
5187 if self.xid != None:
5188 q.text("%#x" % self.xid)
5189 else:
5190 q.text('None')
5191 q.text(","); q.breakable()
5192 q.text("code = ");
5193 q.text("%#x" % self.code)
5194 q.text(","); q.breakable()
5195 q.text("data = ");
5196 q.pp(self.data)
5197 q.breakable()
5198 q.text('}')
5199
Rich Lane7dcdf022013-12-11 14:45:27 -08005200error_msg.subtypes[0] = hello_failed_error_msg
5201
5202class nicira_header(experimenter):
5203 subtypes = {}
5204
5205 @staticmethod
5206 def unpack(reader):
5207 subtype, = reader.peek('!L', 12)
5208 try:
5209 subclass = nicira_header.subtypes[subtype]
5210 except KeyError:
5211 raise loxi.ProtocolError("unknown nicira_header experimenter message subtype %#x" % subtype)
5212 return subclass.unpack(reader)
5213
5214experimenter.subtypes[8992] = nicira_header
5215
5216class nicira_controller_role_reply(nicira_header):
Dan Talaycof6202252013-07-02 01:00:29 -07005217 version = 1
5218 type = 4
5219 experimenter = 8992
Rich Laneb658ddd2013-03-12 10:15:10 -07005220 subtype = 11
5221
5222 def __init__(self, xid=None, role=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005223 if xid != None:
5224 self.xid = xid
5225 else:
5226 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07005227 if role != None:
5228 self.role = role
5229 else:
5230 self.role = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08005231 return
Rich Laneb658ddd2013-03-12 10:15:10 -07005232
5233 def pack(self):
5234 packed = []
5235 packed.append(struct.pack("!B", self.version))
5236 packed.append(struct.pack("!B", self.type))
5237 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5238 packed.append(struct.pack("!L", self.xid))
5239 packed.append(struct.pack("!L", self.experimenter))
5240 packed.append(struct.pack("!L", self.subtype))
5241 packed.append(struct.pack("!L", self.role))
5242 length = sum([len(x) for x in packed])
5243 packed[2] = struct.pack("!H", length)
5244 return ''.join(packed)
5245
5246 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005247 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07005248 obj = nicira_controller_role_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07005249 _version = reader.read("!B")[0]
5250 assert(_version == 1)
5251 _type = reader.read("!B")[0]
5252 assert(_type == 4)
5253 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005254 orig_reader = reader
5255 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07005256 obj.xid = reader.read("!L")[0]
5257 _experimenter = reader.read("!L")[0]
5258 assert(_experimenter == 8992)
5259 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07005260 assert(_subtype == 11)
Dan Talaycof6202252013-07-02 01:00:29 -07005261 obj.role = reader.read("!L")[0]
Rich Laneb658ddd2013-03-12 10:15:10 -07005262 return obj
5263
5264 def __eq__(self, other):
5265 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07005266 if self.xid != other.xid: return False
5267 if self.role != other.role: return False
5268 return True
5269
Rich Laneb658ddd2013-03-12 10:15:10 -07005270 def pretty_print(self, q):
5271 q.text("nicira_controller_role_reply {")
5272 with q.group():
5273 with q.indent(2):
5274 q.breakable()
5275 q.text("xid = ");
5276 if self.xid != None:
5277 q.text("%#x" % self.xid)
5278 else:
5279 q.text('None')
5280 q.text(","); q.breakable()
5281 q.text("role = ");
5282 q.text("%#x" % self.role)
5283 q.breakable()
5284 q.text('}')
5285
Rich Lane7dcdf022013-12-11 14:45:27 -08005286nicira_header.subtypes[11] = nicira_controller_role_reply
5287
5288class nicira_controller_role_request(nicira_header):
Dan Talaycof6202252013-07-02 01:00:29 -07005289 version = 1
5290 type = 4
5291 experimenter = 8992
Rich Laneb658ddd2013-03-12 10:15:10 -07005292 subtype = 10
5293
5294 def __init__(self, xid=None, role=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005295 if xid != None:
5296 self.xid = xid
5297 else:
5298 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07005299 if role != None:
5300 self.role = role
5301 else:
5302 self.role = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08005303 return
Rich Laneb658ddd2013-03-12 10:15:10 -07005304
5305 def pack(self):
5306 packed = []
5307 packed.append(struct.pack("!B", self.version))
5308 packed.append(struct.pack("!B", self.type))
5309 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5310 packed.append(struct.pack("!L", self.xid))
5311 packed.append(struct.pack("!L", self.experimenter))
5312 packed.append(struct.pack("!L", self.subtype))
5313 packed.append(struct.pack("!L", self.role))
5314 length = sum([len(x) for x in packed])
5315 packed[2] = struct.pack("!H", length)
5316 return ''.join(packed)
5317
5318 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005319 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07005320 obj = nicira_controller_role_request()
Dan Talaycof6202252013-07-02 01:00:29 -07005321 _version = reader.read("!B")[0]
5322 assert(_version == 1)
5323 _type = reader.read("!B")[0]
5324 assert(_type == 4)
5325 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005326 orig_reader = reader
5327 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07005328 obj.xid = reader.read("!L")[0]
5329 _experimenter = reader.read("!L")[0]
5330 assert(_experimenter == 8992)
5331 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07005332 assert(_subtype == 10)
Dan Talaycof6202252013-07-02 01:00:29 -07005333 obj.role = reader.read("!L")[0]
Rich Laneb658ddd2013-03-12 10:15:10 -07005334 return obj
5335
5336 def __eq__(self, other):
5337 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07005338 if self.xid != other.xid: return False
5339 if self.role != other.role: return False
5340 return True
5341
Rich Laneb658ddd2013-03-12 10:15:10 -07005342 def pretty_print(self, q):
5343 q.text("nicira_controller_role_request {")
5344 with q.group():
5345 with q.indent(2):
5346 q.breakable()
5347 q.text("xid = ");
5348 if self.xid != None:
5349 q.text("%#x" % self.xid)
5350 else:
5351 q.text('None')
5352 q.text(","); q.breakable()
5353 q.text("role = ");
5354 q.text("%#x" % self.role)
5355 q.breakable()
5356 q.text('}')
5357
Rich Lane7dcdf022013-12-11 14:45:27 -08005358nicira_header.subtypes[10] = nicira_controller_role_request
5359
5360class packet_in(message):
Dan Talaycof6202252013-07-02 01:00:29 -07005361 version = 1
5362 type = 10
Rich Laneb658ddd2013-03-12 10:15:10 -07005363
Rich Lanec2ee4b82013-04-24 17:12:38 -07005364 def __init__(self, xid=None, buffer_id=None, total_len=None, in_port=None, reason=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005365 if xid != None:
5366 self.xid = xid
5367 else:
5368 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07005369 if buffer_id != None:
5370 self.buffer_id = buffer_id
5371 else:
5372 self.buffer_id = 0
5373 if total_len != None:
5374 self.total_len = total_len
5375 else:
5376 self.total_len = 0
5377 if in_port != None:
5378 self.in_port = in_port
5379 else:
5380 self.in_port = 0
5381 if reason != None:
5382 self.reason = reason
5383 else:
5384 self.reason = 0
Rich Laneb658ddd2013-03-12 10:15:10 -07005385 if data != None:
5386 self.data = data
5387 else:
Dan Talaycof6202252013-07-02 01:00:29 -07005388 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08005389 return
Rich Laneb658ddd2013-03-12 10:15:10 -07005390
5391 def pack(self):
5392 packed = []
5393 packed.append(struct.pack("!B", self.version))
5394 packed.append(struct.pack("!B", self.type))
5395 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5396 packed.append(struct.pack("!L", self.xid))
5397 packed.append(struct.pack("!L", self.buffer_id))
5398 packed.append(struct.pack("!H", self.total_len))
Dan Talaycof6202252013-07-02 01:00:29 -07005399 packed.append(util.pack_port_no(self.in_port))
Rich Laneb658ddd2013-03-12 10:15:10 -07005400 packed.append(struct.pack("!B", self.reason))
Rich Lanec2ee4b82013-04-24 17:12:38 -07005401 packed.append('\x00' * 1)
Rich Laneb658ddd2013-03-12 10:15:10 -07005402 packed.append(self.data)
5403 length = sum([len(x) for x in packed])
5404 packed[2] = struct.pack("!H", length)
5405 return ''.join(packed)
5406
5407 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005408 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07005409 obj = packet_in()
Dan Talaycof6202252013-07-02 01:00:29 -07005410 _version = reader.read("!B")[0]
5411 assert(_version == 1)
5412 _type = reader.read("!B")[0]
5413 assert(_type == 10)
5414 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005415 orig_reader = reader
5416 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07005417 obj.xid = reader.read("!L")[0]
5418 obj.buffer_id = reader.read("!L")[0]
5419 obj.total_len = reader.read("!H")[0]
5420 obj.in_port = util.unpack_port_no(reader)
5421 obj.reason = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07005422 reader.skip(1)
5423 obj.data = str(reader.read_all())
Rich Laneb658ddd2013-03-12 10:15:10 -07005424 return obj
5425
5426 def __eq__(self, other):
5427 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07005428 if self.xid != other.xid: return False
5429 if self.buffer_id != other.buffer_id: return False
5430 if self.total_len != other.total_len: return False
5431 if self.in_port != other.in_port: return False
5432 if self.reason != other.reason: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07005433 if self.data != other.data: return False
5434 return True
5435
Rich Laneb658ddd2013-03-12 10:15:10 -07005436 def pretty_print(self, q):
5437 q.text("packet_in {")
5438 with q.group():
5439 with q.indent(2):
5440 q.breakable()
5441 q.text("xid = ");
5442 if self.xid != None:
5443 q.text("%#x" % self.xid)
5444 else:
5445 q.text('None')
5446 q.text(","); q.breakable()
5447 q.text("buffer_id = ");
5448 q.text("%#x" % self.buffer_id)
5449 q.text(","); q.breakable()
5450 q.text("total_len = ");
5451 q.text("%#x" % self.total_len)
5452 q.text(","); q.breakable()
5453 q.text("in_port = ");
5454 q.text(util.pretty_port(self.in_port))
5455 q.text(","); q.breakable()
5456 q.text("reason = ");
5457 q.text("%#x" % self.reason)
5458 q.text(","); q.breakable()
Rich Laneb658ddd2013-03-12 10:15:10 -07005459 q.text("data = ");
5460 q.pp(self.data)
5461 q.breakable()
5462 q.text('}')
5463
Rich Lane7dcdf022013-12-11 14:45:27 -08005464message.subtypes[10] = packet_in
5465
5466class packet_out(message):
Dan Talaycof6202252013-07-02 01:00:29 -07005467 version = 1
5468 type = 13
Rich Laneb658ddd2013-03-12 10:15:10 -07005469
5470 def __init__(self, xid=None, buffer_id=None, in_port=None, actions=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005471 if xid != None:
5472 self.xid = xid
5473 else:
5474 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07005475 if buffer_id != None:
5476 self.buffer_id = buffer_id
5477 else:
Rich Laneff637c92013-04-04 13:57:09 -07005478 self.buffer_id = 0
Rich Laneb658ddd2013-03-12 10:15:10 -07005479 if in_port != None:
5480 self.in_port = in_port
5481 else:
5482 self.in_port = 0
5483 if actions != None:
5484 self.actions = actions
5485 else:
5486 self.actions = []
5487 if data != None:
5488 self.data = data
5489 else:
Dan Talaycof6202252013-07-02 01:00:29 -07005490 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08005491 return
Rich Laneb658ddd2013-03-12 10:15:10 -07005492
5493 def pack(self):
5494 packed = []
5495 packed.append(struct.pack("!B", self.version))
5496 packed.append(struct.pack("!B", self.type))
Rich Lanec2ee4b82013-04-24 17:12:38 -07005497 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
Rich Laneb658ddd2013-03-12 10:15:10 -07005498 packed.append(struct.pack("!L", self.xid))
5499 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -07005500 packed.append(util.pack_port_no(self.in_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -07005501 packed.append(struct.pack("!H", 0)) # placeholder for actions_len at index 6
Rich Lane7dcdf022013-12-11 14:45:27 -08005502 packed.append(loxi.generic_util.pack_list(self.actions))
Rich Lanec2ee4b82013-04-24 17:12:38 -07005503 packed[6] = struct.pack("!H", len(packed[-1]))
Rich Laneb658ddd2013-03-12 10:15:10 -07005504 packed.append(self.data)
5505 length = sum([len(x) for x in packed])
5506 packed[2] = struct.pack("!H", length)
5507 return ''.join(packed)
5508
5509 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005510 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07005511 obj = packet_out()
Dan Talaycof6202252013-07-02 01:00:29 -07005512 _version = reader.read("!B")[0]
5513 assert(_version == 1)
5514 _type = reader.read("!B")[0]
5515 assert(_type == 13)
5516 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005517 orig_reader = reader
5518 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07005519 obj.xid = reader.read("!L")[0]
5520 obj.buffer_id = reader.read("!L")[0]
5521 obj.in_port = util.unpack_port_no(reader)
5522 _actions_len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005523 obj.actions = loxi.generic_util.unpack_list(reader.slice(_actions_len), action.action.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -07005524 obj.data = str(reader.read_all())
Rich Laneb658ddd2013-03-12 10:15:10 -07005525 return obj
5526
5527 def __eq__(self, other):
5528 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07005529 if self.xid != other.xid: return False
5530 if self.buffer_id != other.buffer_id: return False
5531 if self.in_port != other.in_port: return False
5532 if self.actions != other.actions: return False
5533 if self.data != other.data: return False
5534 return True
5535
Rich Laneb658ddd2013-03-12 10:15:10 -07005536 def pretty_print(self, q):
5537 q.text("packet_out {")
5538 with q.group():
5539 with q.indent(2):
5540 q.breakable()
5541 q.text("xid = ");
5542 if self.xid != None:
5543 q.text("%#x" % self.xid)
5544 else:
5545 q.text('None')
5546 q.text(","); q.breakable()
5547 q.text("buffer_id = ");
5548 q.text("%#x" % self.buffer_id)
5549 q.text(","); q.breakable()
5550 q.text("in_port = ");
5551 q.text(util.pretty_port(self.in_port))
5552 q.text(","); q.breakable()
5553 q.text("actions = ");
5554 q.pp(self.actions)
5555 q.text(","); q.breakable()
5556 q.text("data = ");
5557 q.pp(self.data)
5558 q.breakable()
5559 q.text('}')
5560
Rich Lane7dcdf022013-12-11 14:45:27 -08005561message.subtypes[13] = packet_out
5562
5563class port_mod(message):
Dan Talaycof6202252013-07-02 01:00:29 -07005564 version = 1
5565 type = 15
Rich Laneb658ddd2013-03-12 10:15:10 -07005566
Rich Lanec2ee4b82013-04-24 17:12:38 -07005567 def __init__(self, xid=None, port_no=None, hw_addr=None, config=None, mask=None, advertise=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005568 if xid != None:
5569 self.xid = xid
5570 else:
5571 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07005572 if port_no != None:
5573 self.port_no = port_no
5574 else:
5575 self.port_no = 0
5576 if hw_addr != None:
5577 self.hw_addr = hw_addr
5578 else:
5579 self.hw_addr = [0,0,0,0,0,0]
5580 if config != None:
5581 self.config = config
5582 else:
5583 self.config = 0
5584 if mask != None:
5585 self.mask = mask
5586 else:
5587 self.mask = 0
5588 if advertise != None:
5589 self.advertise = advertise
5590 else:
5591 self.advertise = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08005592 return
Rich Laneb658ddd2013-03-12 10:15:10 -07005593
5594 def pack(self):
5595 packed = []
5596 packed.append(struct.pack("!B", self.version))
5597 packed.append(struct.pack("!B", self.type))
5598 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5599 packed.append(struct.pack("!L", self.xid))
Dan Talaycof6202252013-07-02 01:00:29 -07005600 packed.append(util.pack_port_no(self.port_no))
Rich Laneb658ddd2013-03-12 10:15:10 -07005601 packed.append(struct.pack("!6B", *self.hw_addr))
5602 packed.append(struct.pack("!L", self.config))
5603 packed.append(struct.pack("!L", self.mask))
5604 packed.append(struct.pack("!L", self.advertise))
Rich Lanec2ee4b82013-04-24 17:12:38 -07005605 packed.append('\x00' * 4)
Rich Laneb658ddd2013-03-12 10:15:10 -07005606 length = sum([len(x) for x in packed])
5607 packed[2] = struct.pack("!H", length)
5608 return ''.join(packed)
5609
5610 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005611 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07005612 obj = port_mod()
Dan Talaycof6202252013-07-02 01:00:29 -07005613 _version = reader.read("!B")[0]
5614 assert(_version == 1)
5615 _type = reader.read("!B")[0]
5616 assert(_type == 15)
5617 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005618 orig_reader = reader
5619 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07005620 obj.xid = reader.read("!L")[0]
5621 obj.port_no = util.unpack_port_no(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -07005622 obj.hw_addr = list(reader.read('!6B'))
Dan Talaycof6202252013-07-02 01:00:29 -07005623 obj.config = reader.read("!L")[0]
5624 obj.mask = reader.read("!L")[0]
5625 obj.advertise = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07005626 reader.skip(4)
Rich Laneb658ddd2013-03-12 10:15:10 -07005627 return obj
5628
5629 def __eq__(self, other):
5630 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07005631 if self.xid != other.xid: return False
5632 if self.port_no != other.port_no: return False
5633 if self.hw_addr != other.hw_addr: return False
5634 if self.config != other.config: return False
5635 if self.mask != other.mask: return False
5636 if self.advertise != other.advertise: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07005637 return True
5638
Rich Laneb658ddd2013-03-12 10:15:10 -07005639 def pretty_print(self, q):
5640 q.text("port_mod {")
5641 with q.group():
5642 with q.indent(2):
5643 q.breakable()
5644 q.text("xid = ");
5645 if self.xid != None:
5646 q.text("%#x" % self.xid)
5647 else:
5648 q.text('None')
5649 q.text(","); q.breakable()
5650 q.text("port_no = ");
5651 q.text(util.pretty_port(self.port_no))
5652 q.text(","); q.breakable()
5653 q.text("hw_addr = ");
5654 q.text(util.pretty_mac(self.hw_addr))
5655 q.text(","); q.breakable()
5656 q.text("config = ");
5657 q.text("%#x" % self.config)
5658 q.text(","); q.breakable()
5659 q.text("mask = ");
5660 q.text("%#x" % self.mask)
5661 q.text(","); q.breakable()
5662 q.text("advertise = ");
5663 q.text("%#x" % self.advertise)
Rich Laneb658ddd2013-03-12 10:15:10 -07005664 q.breakable()
5665 q.text('}')
5666
Rich Lane7dcdf022013-12-11 14:45:27 -08005667message.subtypes[15] = port_mod
5668
5669class port_mod_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -07005670 version = 1
5671 type = 1
5672 err_type = 4
5673
5674 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005675 if xid != None:
5676 self.xid = xid
5677 else:
5678 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07005679 if code != None:
5680 self.code = code
5681 else:
5682 self.code = 0
5683 if data != None:
5684 self.data = data
5685 else:
5686 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08005687 return
Rich Lane6f4978c2013-10-20 21:33:52 -07005688
5689 def pack(self):
5690 packed = []
5691 packed.append(struct.pack("!B", self.version))
5692 packed.append(struct.pack("!B", self.type))
5693 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5694 packed.append(struct.pack("!L", self.xid))
5695 packed.append(struct.pack("!H", self.err_type))
5696 packed.append(struct.pack("!H", self.code))
5697 packed.append(self.data)
5698 length = sum([len(x) for x in packed])
5699 packed[2] = struct.pack("!H", length)
5700 return ''.join(packed)
5701
5702 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005703 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07005704 obj = port_mod_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -07005705 _version = reader.read("!B")[0]
5706 assert(_version == 1)
5707 _type = reader.read("!B")[0]
5708 assert(_type == 1)
5709 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005710 orig_reader = reader
5711 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07005712 obj.xid = reader.read("!L")[0]
5713 _err_type = reader.read("!H")[0]
5714 assert(_err_type == 4)
5715 obj.code = reader.read("!H")[0]
5716 obj.data = str(reader.read_all())
5717 return obj
5718
5719 def __eq__(self, other):
5720 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07005721 if self.xid != other.xid: return False
5722 if self.code != other.code: return False
5723 if self.data != other.data: return False
5724 return True
5725
Rich Lane6f4978c2013-10-20 21:33:52 -07005726 def pretty_print(self, q):
5727 q.text("port_mod_failed_error_msg {")
5728 with q.group():
5729 with q.indent(2):
5730 q.breakable()
5731 q.text("xid = ");
5732 if self.xid != None:
5733 q.text("%#x" % self.xid)
5734 else:
5735 q.text('None')
5736 q.text(","); q.breakable()
5737 q.text("code = ");
5738 q.text("%#x" % self.code)
5739 q.text(","); q.breakable()
5740 q.text("data = ");
5741 q.pp(self.data)
5742 q.breakable()
5743 q.text('}')
5744
Rich Lane7dcdf022013-12-11 14:45:27 -08005745error_msg.subtypes[4] = port_mod_failed_error_msg
5746
5747class port_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -07005748 version = 1
5749 type = 17
5750 stats_type = 4
Rich Laneb658ddd2013-03-12 10:15:10 -07005751
5752 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005753 if xid != None:
5754 self.xid = xid
5755 else:
5756 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07005757 if flags != None:
5758 self.flags = flags
5759 else:
5760 self.flags = 0
5761 if entries != None:
5762 self.entries = entries
5763 else:
5764 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -08005765 return
Rich Laneb658ddd2013-03-12 10:15:10 -07005766
5767 def pack(self):
5768 packed = []
5769 packed.append(struct.pack("!B", self.version))
5770 packed.append(struct.pack("!B", self.type))
5771 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5772 packed.append(struct.pack("!L", self.xid))
5773 packed.append(struct.pack("!H", self.stats_type))
5774 packed.append(struct.pack("!H", self.flags))
Rich Lane7dcdf022013-12-11 14:45:27 -08005775 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Laneb658ddd2013-03-12 10:15:10 -07005776 length = sum([len(x) for x in packed])
5777 packed[2] = struct.pack("!H", length)
5778 return ''.join(packed)
5779
5780 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005781 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07005782 obj = port_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07005783 _version = reader.read("!B")[0]
5784 assert(_version == 1)
5785 _type = reader.read("!B")[0]
5786 assert(_type == 17)
5787 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005788 orig_reader = reader
5789 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07005790 obj.xid = reader.read("!L")[0]
5791 _stats_type = reader.read("!H")[0]
5792 assert(_stats_type == 4)
5793 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07005794 obj.entries = loxi.generic_util.unpack_list(reader, common.port_stats_entry.unpack)
Rich Laneb658ddd2013-03-12 10:15:10 -07005795 return obj
5796
5797 def __eq__(self, other):
5798 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07005799 if self.xid != other.xid: return False
5800 if self.flags != other.flags: return False
5801 if self.entries != other.entries: return False
5802 return True
5803
Rich Laneb658ddd2013-03-12 10:15:10 -07005804 def pretty_print(self, q):
5805 q.text("port_stats_reply {")
5806 with q.group():
5807 with q.indent(2):
5808 q.breakable()
5809 q.text("xid = ");
5810 if self.xid != None:
5811 q.text("%#x" % self.xid)
5812 else:
5813 q.text('None')
5814 q.text(","); q.breakable()
5815 q.text("flags = ");
5816 q.text("%#x" % self.flags)
5817 q.text(","); q.breakable()
5818 q.text("entries = ");
5819 q.pp(self.entries)
5820 q.breakable()
5821 q.text('}')
5822
Rich Lane7dcdf022013-12-11 14:45:27 -08005823stats_reply.subtypes[4] = port_stats_reply
5824
5825class port_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -07005826 version = 1
5827 type = 16
5828 stats_type = 4
Rich Laneb658ddd2013-03-12 10:15:10 -07005829
Rich Lanec2ee4b82013-04-24 17:12:38 -07005830 def __init__(self, xid=None, flags=None, port_no=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005831 if xid != None:
5832 self.xid = xid
5833 else:
5834 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07005835 if flags != None:
5836 self.flags = flags
5837 else:
5838 self.flags = 0
5839 if port_no != None:
5840 self.port_no = port_no
5841 else:
5842 self.port_no = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08005843 return
Rich Laneb658ddd2013-03-12 10:15:10 -07005844
5845 def pack(self):
5846 packed = []
5847 packed.append(struct.pack("!B", self.version))
5848 packed.append(struct.pack("!B", self.type))
5849 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5850 packed.append(struct.pack("!L", self.xid))
5851 packed.append(struct.pack("!H", self.stats_type))
5852 packed.append(struct.pack("!H", self.flags))
Dan Talaycof6202252013-07-02 01:00:29 -07005853 packed.append(util.pack_port_no(self.port_no))
Rich Lanec2ee4b82013-04-24 17:12:38 -07005854 packed.append('\x00' * 6)
Rich Laneb658ddd2013-03-12 10:15:10 -07005855 length = sum([len(x) for x in packed])
5856 packed[2] = struct.pack("!H", length)
5857 return ''.join(packed)
5858
5859 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005860 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07005861 obj = port_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -07005862 _version = reader.read("!B")[0]
5863 assert(_version == 1)
5864 _type = reader.read("!B")[0]
5865 assert(_type == 16)
5866 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005867 orig_reader = reader
5868 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07005869 obj.xid = reader.read("!L")[0]
5870 _stats_type = reader.read("!H")[0]
5871 assert(_stats_type == 4)
5872 obj.flags = reader.read("!H")[0]
5873 obj.port_no = util.unpack_port_no(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -07005874 reader.skip(6)
Rich Laneb658ddd2013-03-12 10:15:10 -07005875 return obj
5876
5877 def __eq__(self, other):
5878 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07005879 if self.xid != other.xid: return False
5880 if self.flags != other.flags: return False
5881 if self.port_no != other.port_no: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07005882 return True
5883
Rich Laneb658ddd2013-03-12 10:15:10 -07005884 def pretty_print(self, q):
5885 q.text("port_stats_request {")
5886 with q.group():
5887 with q.indent(2):
5888 q.breakable()
5889 q.text("xid = ");
5890 if self.xid != None:
5891 q.text("%#x" % self.xid)
5892 else:
5893 q.text('None')
5894 q.text(","); q.breakable()
5895 q.text("flags = ");
5896 q.text("%#x" % self.flags)
5897 q.text(","); q.breakable()
5898 q.text("port_no = ");
5899 q.text(util.pretty_port(self.port_no))
Rich Laneb658ddd2013-03-12 10:15:10 -07005900 q.breakable()
5901 q.text('}')
5902
Rich Lane7dcdf022013-12-11 14:45:27 -08005903stats_request.subtypes[4] = port_stats_request
5904
5905class port_status(message):
Dan Talaycof6202252013-07-02 01:00:29 -07005906 version = 1
5907 type = 12
Rich Laneb658ddd2013-03-12 10:15:10 -07005908
Rich Lanec2ee4b82013-04-24 17:12:38 -07005909 def __init__(self, xid=None, reason=None, desc=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005910 if xid != None:
5911 self.xid = xid
5912 else:
5913 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07005914 if reason != None:
5915 self.reason = reason
5916 else:
5917 self.reason = 0
Rich Laneb658ddd2013-03-12 10:15:10 -07005918 if desc != None:
5919 self.desc = desc
5920 else:
5921 self.desc = common.port_desc()
Rich Lane7dcdf022013-12-11 14:45:27 -08005922 return
Rich Laneb658ddd2013-03-12 10:15:10 -07005923
5924 def pack(self):
5925 packed = []
5926 packed.append(struct.pack("!B", self.version))
5927 packed.append(struct.pack("!B", self.type))
5928 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5929 packed.append(struct.pack("!L", self.xid))
5930 packed.append(struct.pack("!B", self.reason))
Rich Lanec2ee4b82013-04-24 17:12:38 -07005931 packed.append('\x00' * 7)
Rich Laneb658ddd2013-03-12 10:15:10 -07005932 packed.append(self.desc.pack())
5933 length = sum([len(x) for x in packed])
5934 packed[2] = struct.pack("!H", length)
5935 return ''.join(packed)
5936
5937 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005938 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07005939 obj = port_status()
Dan Talaycof6202252013-07-02 01:00:29 -07005940 _version = reader.read("!B")[0]
5941 assert(_version == 1)
5942 _type = reader.read("!B")[0]
5943 assert(_type == 12)
5944 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005945 orig_reader = reader
5946 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07005947 obj.xid = reader.read("!L")[0]
5948 obj.reason = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07005949 reader.skip(7)
5950 obj.desc = common.port_desc.unpack(reader)
Rich Laneb658ddd2013-03-12 10:15:10 -07005951 return obj
5952
5953 def __eq__(self, other):
5954 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07005955 if self.xid != other.xid: return False
5956 if self.reason != other.reason: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07005957 if self.desc != other.desc: return False
5958 return True
5959
Rich Laneb658ddd2013-03-12 10:15:10 -07005960 def pretty_print(self, q):
5961 q.text("port_status {")
5962 with q.group():
5963 with q.indent(2):
5964 q.breakable()
5965 q.text("xid = ");
5966 if self.xid != None:
5967 q.text("%#x" % self.xid)
5968 else:
5969 q.text('None')
5970 q.text(","); q.breakable()
5971 q.text("reason = ");
5972 q.text("%#x" % self.reason)
5973 q.text(","); q.breakable()
Rich Laneb658ddd2013-03-12 10:15:10 -07005974 q.text("desc = ");
5975 q.pp(self.desc)
5976 q.breakable()
5977 q.text('}')
5978
Rich Lane7dcdf022013-12-11 14:45:27 -08005979message.subtypes[12] = port_status
5980
5981class queue_get_config_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -07005982 version = 1
5983 type = 21
Rich Laneb658ddd2013-03-12 10:15:10 -07005984
Rich Lanec2ee4b82013-04-24 17:12:38 -07005985 def __init__(self, xid=None, port=None, queues=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005986 if xid != None:
5987 self.xid = xid
5988 else:
5989 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07005990 if port != None:
5991 self.port = port
5992 else:
5993 self.port = 0
Rich Laneb658ddd2013-03-12 10:15:10 -07005994 if queues != None:
5995 self.queues = queues
5996 else:
5997 self.queues = []
Rich Lane7dcdf022013-12-11 14:45:27 -08005998 return
Rich Laneb658ddd2013-03-12 10:15:10 -07005999
6000 def pack(self):
6001 packed = []
6002 packed.append(struct.pack("!B", self.version))
6003 packed.append(struct.pack("!B", self.type))
6004 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6005 packed.append(struct.pack("!L", self.xid))
Dan Talaycof6202252013-07-02 01:00:29 -07006006 packed.append(util.pack_port_no(self.port))
Rich Lanec2ee4b82013-04-24 17:12:38 -07006007 packed.append('\x00' * 6)
Rich Lane7dcdf022013-12-11 14:45:27 -08006008 packed.append(loxi.generic_util.pack_list(self.queues))
Rich Laneb658ddd2013-03-12 10:15:10 -07006009 length = sum([len(x) for x in packed])
6010 packed[2] = struct.pack("!H", length)
6011 return ''.join(packed)
6012
6013 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006014 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07006015 obj = queue_get_config_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07006016 _version = reader.read("!B")[0]
6017 assert(_version == 1)
6018 _type = reader.read("!B")[0]
6019 assert(_type == 21)
6020 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006021 orig_reader = reader
6022 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07006023 obj.xid = reader.read("!L")[0]
6024 obj.port = util.unpack_port_no(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -07006025 reader.skip(6)
Rich Lane7dcdf022013-12-11 14:45:27 -08006026 obj.queues = loxi.generic_util.unpack_list(reader, common.packet_queue.unpack)
Rich Laneb658ddd2013-03-12 10:15:10 -07006027 return obj
6028
6029 def __eq__(self, other):
6030 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07006031 if self.xid != other.xid: return False
6032 if self.port != other.port: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07006033 if self.queues != other.queues: return False
6034 return True
6035
Rich Laneb658ddd2013-03-12 10:15:10 -07006036 def pretty_print(self, q):
6037 q.text("queue_get_config_reply {")
6038 with q.group():
6039 with q.indent(2):
6040 q.breakable()
6041 q.text("xid = ");
6042 if self.xid != None:
6043 q.text("%#x" % self.xid)
6044 else:
6045 q.text('None')
6046 q.text(","); q.breakable()
6047 q.text("port = ");
6048 q.text(util.pretty_port(self.port))
6049 q.text(","); q.breakable()
Rich Laneb658ddd2013-03-12 10:15:10 -07006050 q.text("queues = ");
6051 q.pp(self.queues)
6052 q.breakable()
6053 q.text('}')
6054
Rich Lane7dcdf022013-12-11 14:45:27 -08006055message.subtypes[21] = queue_get_config_reply
6056
6057class queue_get_config_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -07006058 version = 1
6059 type = 20
Rich Laneb658ddd2013-03-12 10:15:10 -07006060
Rich Lanec2ee4b82013-04-24 17:12:38 -07006061 def __init__(self, xid=None, port=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006062 if xid != None:
6063 self.xid = xid
6064 else:
6065 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07006066 if port != None:
6067 self.port = port
6068 else:
6069 self.port = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08006070 return
Rich Laneb658ddd2013-03-12 10:15:10 -07006071
6072 def pack(self):
6073 packed = []
6074 packed.append(struct.pack("!B", self.version))
6075 packed.append(struct.pack("!B", self.type))
6076 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6077 packed.append(struct.pack("!L", self.xid))
Dan Talaycof6202252013-07-02 01:00:29 -07006078 packed.append(util.pack_port_no(self.port))
Rich Lanec2ee4b82013-04-24 17:12:38 -07006079 packed.append('\x00' * 2)
Rich Laneb658ddd2013-03-12 10:15:10 -07006080 length = sum([len(x) for x in packed])
6081 packed[2] = struct.pack("!H", length)
6082 return ''.join(packed)
6083
6084 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006085 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07006086 obj = queue_get_config_request()
Dan Talaycof6202252013-07-02 01:00:29 -07006087 _version = reader.read("!B")[0]
6088 assert(_version == 1)
6089 _type = reader.read("!B")[0]
6090 assert(_type == 20)
6091 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006092 orig_reader = reader
6093 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07006094 obj.xid = reader.read("!L")[0]
6095 obj.port = util.unpack_port_no(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -07006096 reader.skip(2)
Rich Laneb658ddd2013-03-12 10:15:10 -07006097 return obj
6098
6099 def __eq__(self, other):
6100 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07006101 if self.xid != other.xid: return False
6102 if self.port != other.port: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07006103 return True
6104
Rich Laneb658ddd2013-03-12 10:15:10 -07006105 def pretty_print(self, q):
6106 q.text("queue_get_config_request {")
6107 with q.group():
6108 with q.indent(2):
6109 q.breakable()
6110 q.text("xid = ");
6111 if self.xid != None:
6112 q.text("%#x" % self.xid)
6113 else:
6114 q.text('None')
6115 q.text(","); q.breakable()
6116 q.text("port = ");
6117 q.text(util.pretty_port(self.port))
Rich Laneb658ddd2013-03-12 10:15:10 -07006118 q.breakable()
6119 q.text('}')
6120
Rich Lane7dcdf022013-12-11 14:45:27 -08006121message.subtypes[20] = queue_get_config_request
6122
6123class queue_op_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -07006124 version = 1
6125 type = 1
6126 err_type = 5
6127
6128 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006129 if xid != None:
6130 self.xid = xid
6131 else:
6132 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07006133 if code != None:
6134 self.code = code
6135 else:
6136 self.code = 0
6137 if data != None:
6138 self.data = data
6139 else:
6140 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08006141 return
Rich Lane6f4978c2013-10-20 21:33:52 -07006142
6143 def pack(self):
6144 packed = []
6145 packed.append(struct.pack("!B", self.version))
6146 packed.append(struct.pack("!B", self.type))
6147 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6148 packed.append(struct.pack("!L", self.xid))
6149 packed.append(struct.pack("!H", self.err_type))
6150 packed.append(struct.pack("!H", self.code))
6151 packed.append(self.data)
6152 length = sum([len(x) for x in packed])
6153 packed[2] = struct.pack("!H", length)
6154 return ''.join(packed)
6155
6156 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006157 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07006158 obj = queue_op_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -07006159 _version = reader.read("!B")[0]
6160 assert(_version == 1)
6161 _type = reader.read("!B")[0]
6162 assert(_type == 1)
6163 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006164 orig_reader = reader
6165 reader = orig_reader.slice(_length - (2 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07006166 obj.xid = reader.read("!L")[0]
6167 _err_type = reader.read("!H")[0]
6168 assert(_err_type == 5)
6169 obj.code = reader.read("!H")[0]
6170 obj.data = str(reader.read_all())
6171 return obj
6172
6173 def __eq__(self, other):
6174 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07006175 if self.xid != other.xid: return False
6176 if self.code != other.code: return False
6177 if self.data != other.data: return False
6178 return True
6179
Rich Lane6f4978c2013-10-20 21:33:52 -07006180 def pretty_print(self, q):
6181 q.text("queue_op_failed_error_msg {")
6182 with q.group():
6183 with q.indent(2):
6184 q.breakable()
6185 q.text("xid = ");
6186 if self.xid != None:
6187 q.text("%#x" % self.xid)
6188 else:
6189 q.text('None')
6190 q.text(","); q.breakable()
6191 q.text("code = ");
6192 q.text("%#x" % self.code)
6193 q.text(","); q.breakable()
6194 q.text("data = ");
6195 q.pp(self.data)
6196 q.breakable()
6197 q.text('}')
6198
Rich Lane7dcdf022013-12-11 14:45:27 -08006199error_msg.subtypes[5] = queue_op_failed_error_msg
6200
6201class queue_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -07006202 version = 1
6203 type = 17
6204 stats_type = 5
Rich Laneb658ddd2013-03-12 10:15:10 -07006205
6206 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006207 if xid != None:
6208 self.xid = xid
6209 else:
6210 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07006211 if flags != None:
6212 self.flags = flags
6213 else:
6214 self.flags = 0
6215 if entries != None:
6216 self.entries = entries
6217 else:
6218 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -08006219 return
Rich Laneb658ddd2013-03-12 10:15:10 -07006220
6221 def pack(self):
6222 packed = []
6223 packed.append(struct.pack("!B", self.version))
6224 packed.append(struct.pack("!B", self.type))
6225 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6226 packed.append(struct.pack("!L", self.xid))
6227 packed.append(struct.pack("!H", self.stats_type))
6228 packed.append(struct.pack("!H", self.flags))
Rich Lane7dcdf022013-12-11 14:45:27 -08006229 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Laneb658ddd2013-03-12 10:15:10 -07006230 length = sum([len(x) for x in packed])
6231 packed[2] = struct.pack("!H", length)
6232 return ''.join(packed)
6233
6234 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006235 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07006236 obj = queue_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07006237 _version = reader.read("!B")[0]
6238 assert(_version == 1)
6239 _type = reader.read("!B")[0]
6240 assert(_type == 17)
6241 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006242 orig_reader = reader
6243 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07006244 obj.xid = reader.read("!L")[0]
6245 _stats_type = reader.read("!H")[0]
6246 assert(_stats_type == 5)
6247 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07006248 obj.entries = loxi.generic_util.unpack_list(reader, common.queue_stats_entry.unpack)
Rich Laneb658ddd2013-03-12 10:15:10 -07006249 return obj
6250
6251 def __eq__(self, other):
6252 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07006253 if self.xid != other.xid: return False
6254 if self.flags != other.flags: return False
6255 if self.entries != other.entries: return False
6256 return True
6257
Rich Laneb658ddd2013-03-12 10:15:10 -07006258 def pretty_print(self, q):
6259 q.text("queue_stats_reply {")
6260 with q.group():
6261 with q.indent(2):
6262 q.breakable()
6263 q.text("xid = ");
6264 if self.xid != None:
6265 q.text("%#x" % self.xid)
6266 else:
6267 q.text('None')
6268 q.text(","); q.breakable()
6269 q.text("flags = ");
6270 q.text("%#x" % self.flags)
6271 q.text(","); q.breakable()
6272 q.text("entries = ");
6273 q.pp(self.entries)
6274 q.breakable()
6275 q.text('}')
6276
Rich Lane7dcdf022013-12-11 14:45:27 -08006277stats_reply.subtypes[5] = queue_stats_reply
6278
6279class queue_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -07006280 version = 1
6281 type = 16
6282 stats_type = 5
Rich Laneb658ddd2013-03-12 10:15:10 -07006283
Rich Lanec2ee4b82013-04-24 17:12:38 -07006284 def __init__(self, xid=None, flags=None, port_no=None, queue_id=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006285 if xid != None:
6286 self.xid = xid
6287 else:
6288 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07006289 if flags != None:
6290 self.flags = flags
6291 else:
6292 self.flags = 0
6293 if port_no != None:
6294 self.port_no = port_no
6295 else:
6296 self.port_no = 0
Rich Laneb658ddd2013-03-12 10:15:10 -07006297 if queue_id != None:
6298 self.queue_id = queue_id
6299 else:
6300 self.queue_id = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08006301 return
Rich Laneb658ddd2013-03-12 10:15:10 -07006302
6303 def pack(self):
6304 packed = []
6305 packed.append(struct.pack("!B", self.version))
6306 packed.append(struct.pack("!B", self.type))
6307 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6308 packed.append(struct.pack("!L", self.xid))
6309 packed.append(struct.pack("!H", self.stats_type))
6310 packed.append(struct.pack("!H", self.flags))
Dan Talaycof6202252013-07-02 01:00:29 -07006311 packed.append(util.pack_port_no(self.port_no))
Rich Lanec2ee4b82013-04-24 17:12:38 -07006312 packed.append('\x00' * 2)
Rich Laneb658ddd2013-03-12 10:15:10 -07006313 packed.append(struct.pack("!L", self.queue_id))
6314 length = sum([len(x) for x in packed])
6315 packed[2] = struct.pack("!H", length)
6316 return ''.join(packed)
6317
6318 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006319 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07006320 obj = queue_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -07006321 _version = reader.read("!B")[0]
6322 assert(_version == 1)
6323 _type = reader.read("!B")[0]
6324 assert(_type == 16)
6325 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006326 orig_reader = reader
6327 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07006328 obj.xid = reader.read("!L")[0]
6329 _stats_type = reader.read("!H")[0]
6330 assert(_stats_type == 5)
6331 obj.flags = reader.read("!H")[0]
6332 obj.port_no = util.unpack_port_no(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -07006333 reader.skip(2)
Dan Talaycof6202252013-07-02 01:00:29 -07006334 obj.queue_id = reader.read("!L")[0]
Rich Laneb658ddd2013-03-12 10:15:10 -07006335 return obj
6336
6337 def __eq__(self, other):
6338 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07006339 if self.xid != other.xid: return False
6340 if self.flags != other.flags: return False
6341 if self.port_no != other.port_no: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07006342 if self.queue_id != other.queue_id: return False
6343 return True
6344
Rich Laneb658ddd2013-03-12 10:15:10 -07006345 def pretty_print(self, q):
6346 q.text("queue_stats_request {")
6347 with q.group():
6348 with q.indent(2):
6349 q.breakable()
6350 q.text("xid = ");
6351 if self.xid != None:
6352 q.text("%#x" % self.xid)
6353 else:
6354 q.text('None')
6355 q.text(","); q.breakable()
6356 q.text("flags = ");
6357 q.text("%#x" % self.flags)
6358 q.text(","); q.breakable()
6359 q.text("port_no = ");
6360 q.text(util.pretty_port(self.port_no))
6361 q.text(","); q.breakable()
Rich Laneb658ddd2013-03-12 10:15:10 -07006362 q.text("queue_id = ");
6363 q.text("%#x" % self.queue_id)
6364 q.breakable()
6365 q.text('}')
6366
Rich Lane7dcdf022013-12-11 14:45:27 -08006367stats_request.subtypes[5] = queue_stats_request
6368
6369class set_config(message):
Dan Talaycof6202252013-07-02 01:00:29 -07006370 version = 1
6371 type = 9
Rich Laneb658ddd2013-03-12 10:15:10 -07006372
6373 def __init__(self, xid=None, flags=None, miss_send_len=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006374 if xid != None:
6375 self.xid = xid
6376 else:
6377 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07006378 if flags != None:
6379 self.flags = flags
6380 else:
6381 self.flags = 0
6382 if miss_send_len != None:
6383 self.miss_send_len = miss_send_len
6384 else:
6385 self.miss_send_len = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08006386 return
Rich Laneb658ddd2013-03-12 10:15:10 -07006387
6388 def pack(self):
6389 packed = []
6390 packed.append(struct.pack("!B", self.version))
6391 packed.append(struct.pack("!B", self.type))
6392 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6393 packed.append(struct.pack("!L", self.xid))
6394 packed.append(struct.pack("!H", self.flags))
6395 packed.append(struct.pack("!H", self.miss_send_len))
6396 length = sum([len(x) for x in packed])
6397 packed[2] = struct.pack("!H", length)
6398 return ''.join(packed)
6399
6400 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006401 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07006402 obj = set_config()
Dan Talaycof6202252013-07-02 01:00:29 -07006403 _version = reader.read("!B")[0]
6404 assert(_version == 1)
6405 _type = reader.read("!B")[0]
6406 assert(_type == 9)
6407 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006408 orig_reader = reader
6409 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07006410 obj.xid = reader.read("!L")[0]
6411 obj.flags = reader.read("!H")[0]
6412 obj.miss_send_len = reader.read("!H")[0]
Rich Laneb658ddd2013-03-12 10:15:10 -07006413 return obj
6414
6415 def __eq__(self, other):
6416 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07006417 if self.xid != other.xid: return False
6418 if self.flags != other.flags: return False
6419 if self.miss_send_len != other.miss_send_len: return False
6420 return True
6421
Rich Laneb658ddd2013-03-12 10:15:10 -07006422 def pretty_print(self, q):
6423 q.text("set_config {")
6424 with q.group():
6425 with q.indent(2):
6426 q.breakable()
6427 q.text("xid = ");
6428 if self.xid != None:
6429 q.text("%#x" % self.xid)
6430 else:
6431 q.text('None')
6432 q.text(","); q.breakable()
6433 q.text("flags = ");
6434 q.text("%#x" % self.flags)
6435 q.text(","); q.breakable()
6436 q.text("miss_send_len = ");
6437 q.text("%#x" % self.miss_send_len)
6438 q.breakable()
6439 q.text('}')
6440
Rich Lane7dcdf022013-12-11 14:45:27 -08006441message.subtypes[9] = set_config
6442
6443class table_mod(message):
Dan Talaycof6202252013-07-02 01:00:29 -07006444 version = 1
Rich Laneb658ddd2013-03-12 10:15:10 -07006445 type = 22
6446
Rich Lanec2ee4b82013-04-24 17:12:38 -07006447 def __init__(self, xid=None, table_id=None, config=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006448 if xid != None:
6449 self.xid = xid
6450 else:
6451 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07006452 if table_id != None:
6453 self.table_id = table_id
6454 else:
6455 self.table_id = 0
Rich Laneb658ddd2013-03-12 10:15:10 -07006456 if config != None:
6457 self.config = config
6458 else:
6459 self.config = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08006460 return
Rich Laneb658ddd2013-03-12 10:15:10 -07006461
6462 def pack(self):
6463 packed = []
6464 packed.append(struct.pack("!B", self.version))
6465 packed.append(struct.pack("!B", self.type))
6466 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6467 packed.append(struct.pack("!L", self.xid))
6468 packed.append(struct.pack("!B", self.table_id))
Rich Lanec2ee4b82013-04-24 17:12:38 -07006469 packed.append('\x00' * 3)
Rich Laneb658ddd2013-03-12 10:15:10 -07006470 packed.append(struct.pack("!L", self.config))
6471 length = sum([len(x) for x in packed])
6472 packed[2] = struct.pack("!H", length)
6473 return ''.join(packed)
6474
6475 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006476 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07006477 obj = table_mod()
Dan Talaycof6202252013-07-02 01:00:29 -07006478 _version = reader.read("!B")[0]
6479 assert(_version == 1)
6480 _type = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07006481 assert(_type == 22)
Dan Talaycof6202252013-07-02 01:00:29 -07006482 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006483 orig_reader = reader
6484 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07006485 obj.xid = reader.read("!L")[0]
6486 obj.table_id = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07006487 reader.skip(3)
Dan Talaycof6202252013-07-02 01:00:29 -07006488 obj.config = reader.read("!L")[0]
Rich Laneb658ddd2013-03-12 10:15:10 -07006489 return obj
6490
6491 def __eq__(self, other):
6492 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07006493 if self.xid != other.xid: return False
6494 if self.table_id != other.table_id: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07006495 if self.config != other.config: return False
6496 return True
6497
Rich Laneb658ddd2013-03-12 10:15:10 -07006498 def pretty_print(self, q):
6499 q.text("table_mod {")
6500 with q.group():
6501 with q.indent(2):
6502 q.breakable()
6503 q.text("xid = ");
6504 if self.xid != None:
6505 q.text("%#x" % self.xid)
6506 else:
6507 q.text('None')
6508 q.text(","); q.breakable()
6509 q.text("table_id = ");
6510 q.text("%#x" % self.table_id)
6511 q.text(","); q.breakable()
Rich Laneb658ddd2013-03-12 10:15:10 -07006512 q.text("config = ");
6513 q.text("%#x" % self.config)
6514 q.breakable()
6515 q.text('}')
6516
Rich Lane7dcdf022013-12-11 14:45:27 -08006517message.subtypes[22] = table_mod
6518
6519class table_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -07006520 version = 1
6521 type = 17
6522 stats_type = 3
Rich Laneb658ddd2013-03-12 10:15:10 -07006523
6524 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006525 if xid != None:
6526 self.xid = xid
6527 else:
6528 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07006529 if flags != None:
6530 self.flags = flags
6531 else:
6532 self.flags = 0
6533 if entries != None:
6534 self.entries = entries
6535 else:
6536 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -08006537 return
Rich Laneb658ddd2013-03-12 10:15:10 -07006538
6539 def pack(self):
6540 packed = []
6541 packed.append(struct.pack("!B", self.version))
6542 packed.append(struct.pack("!B", self.type))
6543 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6544 packed.append(struct.pack("!L", self.xid))
6545 packed.append(struct.pack("!H", self.stats_type))
6546 packed.append(struct.pack("!H", self.flags))
Rich Lane7dcdf022013-12-11 14:45:27 -08006547 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Laneb658ddd2013-03-12 10:15:10 -07006548 length = sum([len(x) for x in packed])
6549 packed[2] = struct.pack("!H", length)
6550 return ''.join(packed)
6551
6552 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006553 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07006554 obj = table_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07006555 _version = reader.read("!B")[0]
6556 assert(_version == 1)
6557 _type = reader.read("!B")[0]
6558 assert(_type == 17)
6559 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006560 orig_reader = reader
6561 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07006562 obj.xid = reader.read("!L")[0]
6563 _stats_type = reader.read("!H")[0]
6564 assert(_stats_type == 3)
6565 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07006566 obj.entries = loxi.generic_util.unpack_list(reader, common.table_stats_entry.unpack)
Rich Laneb658ddd2013-03-12 10:15:10 -07006567 return obj
6568
6569 def __eq__(self, other):
6570 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07006571 if self.xid != other.xid: return False
6572 if self.flags != other.flags: return False
6573 if self.entries != other.entries: return False
6574 return True
6575
Rich Laneb658ddd2013-03-12 10:15:10 -07006576 def pretty_print(self, q):
6577 q.text("table_stats_reply {")
6578 with q.group():
6579 with q.indent(2):
6580 q.breakable()
6581 q.text("xid = ");
6582 if self.xid != None:
6583 q.text("%#x" % self.xid)
6584 else:
6585 q.text('None')
6586 q.text(","); q.breakable()
6587 q.text("flags = ");
6588 q.text("%#x" % self.flags)
6589 q.text(","); q.breakable()
6590 q.text("entries = ");
6591 q.pp(self.entries)
6592 q.breakable()
6593 q.text('}')
6594
Rich Lane7dcdf022013-12-11 14:45:27 -08006595stats_reply.subtypes[3] = table_stats_reply
6596
6597class table_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -07006598 version = 1
6599 type = 16
6600 stats_type = 3
Rich Laneb658ddd2013-03-12 10:15:10 -07006601
6602 def __init__(self, xid=None, flags=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006603 if xid != None:
6604 self.xid = xid
6605 else:
6606 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07006607 if flags != None:
6608 self.flags = flags
6609 else:
6610 self.flags = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08006611 return
Rich Laneb658ddd2013-03-12 10:15:10 -07006612
6613 def pack(self):
6614 packed = []
6615 packed.append(struct.pack("!B", self.version))
6616 packed.append(struct.pack("!B", self.type))
6617 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6618 packed.append(struct.pack("!L", self.xid))
6619 packed.append(struct.pack("!H", self.stats_type))
6620 packed.append(struct.pack("!H", self.flags))
6621 length = sum([len(x) for x in packed])
6622 packed[2] = struct.pack("!H", length)
6623 return ''.join(packed)
6624
6625 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006626 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07006627 obj = table_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -07006628 _version = reader.read("!B")[0]
6629 assert(_version == 1)
6630 _type = reader.read("!B")[0]
6631 assert(_type == 16)
6632 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006633 orig_reader = reader
6634 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07006635 obj.xid = reader.read("!L")[0]
6636 _stats_type = reader.read("!H")[0]
6637 assert(_stats_type == 3)
6638 obj.flags = reader.read("!H")[0]
Rich Laneb658ddd2013-03-12 10:15:10 -07006639 return obj
6640
6641 def __eq__(self, other):
6642 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07006643 if self.xid != other.xid: return False
6644 if self.flags != other.flags: return False
6645 return True
6646
Rich Laneb658ddd2013-03-12 10:15:10 -07006647 def pretty_print(self, q):
6648 q.text("table_stats_request {")
6649 with q.group():
6650 with q.indent(2):
6651 q.breakable()
6652 q.text("xid = ");
6653 if self.xid != None:
6654 q.text("%#x" % self.xid)
6655 else:
6656 q.text('None')
6657 q.text(","); q.breakable()
6658 q.text("flags = ");
6659 q.text("%#x" % self.flags)
6660 q.breakable()
6661 q.text('}')
6662
Rich Lane7dcdf022013-12-11 14:45:27 -08006663stats_request.subtypes[3] = table_stats_request
6664
Rich Laneb658ddd2013-03-12 10:15:10 -07006665
6666def parse_header(buf):
6667 if len(buf) < 8:
6668 raise loxi.ProtocolError("too short to be an OpenFlow message")
6669 return struct.unpack_from("!BBHL", buf)
6670
6671def parse_message(buf):
6672 msg_ver, msg_type, msg_len, msg_xid = parse_header(buf)
Rich Lanefe600f52013-07-09 13:22:32 -07006673 if msg_ver != const.OFP_VERSION and msg_type != const.OFPT_HELLO:
6674 raise loxi.ProtocolError("wrong OpenFlow version (expected %d, got %d)" % (const.OFP_VERSION, msg_ver))
Rich Laneb658ddd2013-03-12 10:15:10 -07006675 if len(buf) != msg_len:
6676 raise loxi.ProtocolError("incorrect message size")
Rich Lane7dcdf022013-12-11 14:45:27 -08006677 return message.unpack(loxi.generic_util.OFReader(buf))