blob: 039891c76e0beb6fc91202a761ad9a94af4e42f8 [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
Rich Laneb658ddd2013-03-12 10:15:10 -070011import util
Rich Lanec2ee4b82013-04-24 17:12:38 -070012import loxi.generic_util
Rich Laneb658ddd2013-03-12 10:15:10 -070013
Rich Lanee2567702015-01-26 15:04:35 -080014import sys
15ofp = sys.modules['loxi.of10']
16
Rich Lane7dcdf022013-12-11 14:45:27 -080017class message(loxi.OFObject):
18 subtypes = {}
Rich Laneb658ddd2013-03-12 10:15:10 -070019
Rich Lane95f7fc92014-01-27 17:08:16 -080020 version = 1
21
22 def __init__(self, type=None, xid=None):
23 if type != None:
24 self.type = type
25 else:
26 self.type = 0
27 if xid != None:
28 self.xid = xid
29 else:
30 self.xid = None
31 return
32
33 def pack(self):
34 packed = []
35 packed.append(struct.pack("!B", self.version))
36 packed.append(struct.pack("!B", self.type))
37 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
38 packed.append(struct.pack("!L", self.xid))
39 length = sum([len(x) for x in packed])
40 packed[2] = struct.pack("!H", length)
41 return ''.join(packed)
42
Rich Lane7dcdf022013-12-11 14:45:27 -080043 @staticmethod
44 def unpack(reader):
45 subtype, = reader.peek('B', 1)
Rich Lane95f7fc92014-01-27 17:08:16 -080046 subclass = message.subtypes.get(subtype)
47 if subclass:
48 return subclass.unpack(reader)
49
50 obj = message()
51 _version = reader.read("!B")[0]
52 assert(_version == 1)
53 obj.type = reader.read("!B")[0]
54 _length = reader.read("!H")[0]
55 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080056 reader = orig_reader.slice(_length, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -080057 obj.xid = reader.read("!L")[0]
58 return obj
59
60 def __eq__(self, other):
61 if type(self) != type(other): return False
62 if self.type != other.type: return False
63 if self.xid != other.xid: return False
64 return True
65
66 def pretty_print(self, q):
67 q.text("message {")
68 with q.group():
69 with q.indent(2):
70 q.breakable()
71 q.text("xid = ");
72 if self.xid != None:
73 q.text("%#x" % self.xid)
74 else:
75 q.text('None')
76 q.breakable()
77 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -080078
79
80class stats_reply(message):
81 subtypes = {}
82
Rich Lane95f7fc92014-01-27 17:08:16 -080083 version = 1
84 type = 17
85
86 def __init__(self, xid=None, stats_type=None, flags=None):
87 if xid != None:
88 self.xid = xid
89 else:
90 self.xid = None
91 if stats_type != None:
92 self.stats_type = stats_type
93 else:
94 self.stats_type = 0
95 if flags != None:
96 self.flags = flags
97 else:
98 self.flags = 0
99 return
100
101 def pack(self):
102 packed = []
103 packed.append(struct.pack("!B", self.version))
104 packed.append(struct.pack("!B", self.type))
105 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
106 packed.append(struct.pack("!L", self.xid))
107 packed.append(struct.pack("!H", self.stats_type))
108 packed.append(struct.pack("!H", self.flags))
109 length = sum([len(x) for x in packed])
110 packed[2] = struct.pack("!H", length)
111 return ''.join(packed)
112
Rich Lane7dcdf022013-12-11 14:45:27 -0800113 @staticmethod
114 def unpack(reader):
115 subtype, = reader.peek('!H', 8)
Rich Lane95f7fc92014-01-27 17:08:16 -0800116 subclass = stats_reply.subtypes.get(subtype)
117 if subclass:
118 return subclass.unpack(reader)
119
120 obj = stats_reply()
121 _version = reader.read("!B")[0]
122 assert(_version == 1)
123 _type = reader.read("!B")[0]
124 assert(_type == 17)
125 _length = reader.read("!H")[0]
126 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800127 reader = orig_reader.slice(_length, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -0800128 obj.xid = reader.read("!L")[0]
129 obj.stats_type = reader.read("!H")[0]
130 obj.flags = reader.read("!H")[0]
131 return obj
132
133 def __eq__(self, other):
134 if type(self) != type(other): return False
135 if self.xid != other.xid: return False
136 if self.stats_type != other.stats_type: return False
137 if self.flags != other.flags: return False
138 return True
139
140 def pretty_print(self, q):
141 q.text("stats_reply {")
142 with q.group():
143 with q.indent(2):
144 q.breakable()
145 q.text("xid = ");
146 if self.xid != None:
147 q.text("%#x" % self.xid)
148 else:
149 q.text('None')
150 q.text(","); q.breakable()
151 q.text("flags = ");
152 q.text("%#x" % self.flags)
153 q.breakable()
154 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -0800155
156message.subtypes[17] = stats_reply
157
158class aggregate_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -0700159 version = 1
160 type = 17
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, packet_count=None, byte_count=None, flow_count=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 packet_count != None:
173 self.packet_count = packet_count
174 else:
175 self.packet_count = 0
176 if byte_count != None:
177 self.byte_count = byte_count
178 else:
179 self.byte_count = 0
180 if flow_count != None:
181 self.flow_count = flow_count
182 else:
183 self.flow_count = 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(struct.pack("!Q", self.packet_count))
195 packed.append(struct.pack("!Q", self.byte_count))
196 packed.append(struct.pack("!L", self.flow_count))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700197 packed.append('\x00' * 4)
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_reply()
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 == 17)
209 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800210 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800211 reader = orig_reader.slice(_length, 4)
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]
216 obj.packet_count = reader.read("!Q")[0]
217 obj.byte_count = reader.read("!Q")[0]
218 obj.flow_count = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700219 reader.skip(4)
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.packet_count != other.packet_count: return False
227 if self.byte_count != other.byte_count: return False
228 if self.flow_count != other.flow_count: return False
Rich Laneb658ddd2013-03-12 10:15:10 -0700229 return True
230
Rich Laneb658ddd2013-03-12 10:15:10 -0700231 def pretty_print(self, q):
232 q.text("aggregate_stats_reply {")
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("packet_count = ");
246 q.text("%#x" % self.packet_count)
247 q.text(","); q.breakable()
248 q.text("byte_count = ");
249 q.text("%#x" % self.byte_count)
250 q.text(","); q.breakable()
251 q.text("flow_count = ");
252 q.text("%#x" % self.flow_count)
Rich Laneb658ddd2013-03-12 10:15:10 -0700253 q.breakable()
254 q.text('}')
255
Rich Lane7dcdf022013-12-11 14:45:27 -0800256stats_reply.subtypes[2] = aggregate_stats_reply
257
258class stats_request(message):
259 subtypes = {}
260
Rich Lane95f7fc92014-01-27 17:08:16 -0800261 version = 1
262 type = 16
263
264 def __init__(self, xid=None, stats_type=None, flags=None):
265 if xid != None:
266 self.xid = xid
267 else:
268 self.xid = None
269 if stats_type != None:
270 self.stats_type = stats_type
271 else:
272 self.stats_type = 0
273 if flags != None:
274 self.flags = flags
275 else:
276 self.flags = 0
277 return
278
279 def pack(self):
280 packed = []
281 packed.append(struct.pack("!B", self.version))
282 packed.append(struct.pack("!B", self.type))
283 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
284 packed.append(struct.pack("!L", self.xid))
285 packed.append(struct.pack("!H", self.stats_type))
286 packed.append(struct.pack("!H", self.flags))
287 length = sum([len(x) for x in packed])
288 packed[2] = struct.pack("!H", length)
289 return ''.join(packed)
290
Rich Lane7dcdf022013-12-11 14:45:27 -0800291 @staticmethod
292 def unpack(reader):
293 subtype, = reader.peek('!H', 8)
Rich Lane95f7fc92014-01-27 17:08:16 -0800294 subclass = stats_request.subtypes.get(subtype)
295 if subclass:
296 return subclass.unpack(reader)
297
298 obj = stats_request()
299 _version = reader.read("!B")[0]
300 assert(_version == 1)
301 _type = reader.read("!B")[0]
302 assert(_type == 16)
303 _length = reader.read("!H")[0]
304 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800305 reader = orig_reader.slice(_length, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -0800306 obj.xid = reader.read("!L")[0]
307 obj.stats_type = reader.read("!H")[0]
308 obj.flags = reader.read("!H")[0]
309 return obj
310
311 def __eq__(self, other):
312 if type(self) != type(other): return False
313 if self.xid != other.xid: return False
314 if self.stats_type != other.stats_type: return False
315 if self.flags != other.flags: return False
316 return True
317
318 def pretty_print(self, q):
319 q.text("stats_request {")
320 with q.group():
321 with q.indent(2):
322 q.breakable()
323 q.text("xid = ");
324 if self.xid != None:
325 q.text("%#x" % self.xid)
326 else:
327 q.text('None')
328 q.text(","); q.breakable()
329 q.text("flags = ");
330 q.text("%#x" % self.flags)
331 q.breakable()
332 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -0800333
334message.subtypes[16] = stats_request
335
336class aggregate_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -0700337 version = 1
338 type = 16
339 stats_type = 2
Rich Laneb658ddd2013-03-12 10:15:10 -0700340
Rich Lanec2ee4b82013-04-24 17:12:38 -0700341 def __init__(self, xid=None, flags=None, match=None, table_id=None, out_port=None):
Rich Lane7dcdf022013-12-11 14:45:27 -0800342 if xid != None:
343 self.xid = xid
344 else:
345 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -0700346 if flags != None:
347 self.flags = flags
348 else:
349 self.flags = 0
350 if match != None:
351 self.match = match
352 else:
Rich Lanee2567702015-01-26 15:04:35 -0800353 self.match = ofp.match()
Rich Laneb658ddd2013-03-12 10:15:10 -0700354 if table_id != None:
355 self.table_id = table_id
356 else:
357 self.table_id = 0
Rich Laneb658ddd2013-03-12 10:15:10 -0700358 if out_port != None:
359 self.out_port = out_port
360 else:
361 self.out_port = 0
Rich Lane7dcdf022013-12-11 14:45:27 -0800362 return
Rich Laneb658ddd2013-03-12 10:15:10 -0700363
364 def pack(self):
365 packed = []
366 packed.append(struct.pack("!B", self.version))
367 packed.append(struct.pack("!B", self.type))
368 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
369 packed.append(struct.pack("!L", self.xid))
370 packed.append(struct.pack("!H", self.stats_type))
371 packed.append(struct.pack("!H", self.flags))
372 packed.append(self.match.pack())
373 packed.append(struct.pack("!B", self.table_id))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700374 packed.append('\x00' * 1)
Dan Talaycof6202252013-07-02 01:00:29 -0700375 packed.append(util.pack_port_no(self.out_port))
Rich Laneb658ddd2013-03-12 10:15:10 -0700376 length = sum([len(x) for x in packed])
377 packed[2] = struct.pack("!H", length)
378 return ''.join(packed)
379
380 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800381 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -0700382 obj = aggregate_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -0700383 _version = reader.read("!B")[0]
384 assert(_version == 1)
385 _type = reader.read("!B")[0]
386 assert(_type == 16)
387 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800388 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800389 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -0700390 obj.xid = reader.read("!L")[0]
391 _stats_type = reader.read("!H")[0]
392 assert(_stats_type == 2)
393 obj.flags = reader.read("!H")[0]
Rich Lanee2567702015-01-26 15:04:35 -0800394 obj.match = ofp.match.unpack(reader)
Dan Talaycof6202252013-07-02 01:00:29 -0700395 obj.table_id = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700396 reader.skip(1)
Dan Talaycof6202252013-07-02 01:00:29 -0700397 obj.out_port = util.unpack_port_no(reader)
Rich Laneb658ddd2013-03-12 10:15:10 -0700398 return obj
399
400 def __eq__(self, other):
401 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -0700402 if self.xid != other.xid: return False
403 if self.flags != other.flags: return False
404 if self.match != other.match: return False
405 if self.table_id != other.table_id: return False
Rich Laneb658ddd2013-03-12 10:15:10 -0700406 if self.out_port != other.out_port: return False
407 return True
408
Rich Laneb658ddd2013-03-12 10:15:10 -0700409 def pretty_print(self, q):
410 q.text("aggregate_stats_request {")
411 with q.group():
412 with q.indent(2):
413 q.breakable()
414 q.text("xid = ");
415 if self.xid != None:
416 q.text("%#x" % self.xid)
417 else:
418 q.text('None')
419 q.text(","); q.breakable()
420 q.text("flags = ");
421 q.text("%#x" % self.flags)
422 q.text(","); q.breakable()
423 q.text("match = ");
424 q.pp(self.match)
425 q.text(","); q.breakable()
426 q.text("table_id = ");
427 q.text("%#x" % self.table_id)
428 q.text(","); q.breakable()
Rich Laneb658ddd2013-03-12 10:15:10 -0700429 q.text("out_port = ");
430 q.text(util.pretty_port(self.out_port))
431 q.breakable()
432 q.text('}')
433
Rich Lane7dcdf022013-12-11 14:45:27 -0800434stats_request.subtypes[2] = aggregate_stats_request
435
436class error_msg(message):
437 subtypes = {}
438
Rich Lane95f7fc92014-01-27 17:08:16 -0800439 version = 1
440 type = 1
441
442 def __init__(self, xid=None, err_type=None):
443 if xid != None:
444 self.xid = xid
445 else:
446 self.xid = None
447 if err_type != None:
448 self.err_type = err_type
449 else:
450 self.err_type = 0
451 return
452
453 def pack(self):
454 packed = []
455 packed.append(struct.pack("!B", self.version))
456 packed.append(struct.pack("!B", self.type))
457 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
458 packed.append(struct.pack("!L", self.xid))
459 packed.append(struct.pack("!H", self.err_type))
460 length = sum([len(x) for x in packed])
461 packed[2] = struct.pack("!H", length)
462 return ''.join(packed)
463
Rich Lane7dcdf022013-12-11 14:45:27 -0800464 @staticmethod
465 def unpack(reader):
466 subtype, = reader.peek('!H', 8)
Rich Lane95f7fc92014-01-27 17:08:16 -0800467 subclass = error_msg.subtypes.get(subtype)
468 if subclass:
469 return subclass.unpack(reader)
470
471 obj = error_msg()
472 _version = reader.read("!B")[0]
473 assert(_version == 1)
474 _type = reader.read("!B")[0]
475 assert(_type == 1)
476 _length = reader.read("!H")[0]
477 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800478 reader = orig_reader.slice(_length, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -0800479 obj.xid = reader.read("!L")[0]
480 obj.err_type = reader.read("!H")[0]
481 return obj
482
483 def __eq__(self, other):
484 if type(self) != type(other): return False
485 if self.xid != other.xid: return False
486 if self.err_type != other.err_type: return False
487 return True
488
489 def pretty_print(self, q):
490 q.text("error_msg {")
491 with q.group():
492 with q.indent(2):
493 q.breakable()
494 q.text("xid = ");
495 if self.xid != None:
496 q.text("%#x" % self.xid)
497 else:
498 q.text('None')
499 q.breakable()
500 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -0800501
502message.subtypes[1] = error_msg
503
504class bad_action_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -0700505 version = 1
506 type = 1
507 err_type = 2
508
509 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -0800510 if xid != None:
511 self.xid = xid
512 else:
513 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -0700514 if code != None:
515 self.code = code
516 else:
517 self.code = 0
518 if data != None:
519 self.data = data
520 else:
521 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -0800522 return
Rich Lane6f4978c2013-10-20 21:33:52 -0700523
524 def pack(self):
525 packed = []
526 packed.append(struct.pack("!B", self.version))
527 packed.append(struct.pack("!B", self.type))
528 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
529 packed.append(struct.pack("!L", self.xid))
530 packed.append(struct.pack("!H", self.err_type))
531 packed.append(struct.pack("!H", self.code))
532 packed.append(self.data)
533 length = sum([len(x) for x in packed])
534 packed[2] = struct.pack("!H", length)
535 return ''.join(packed)
536
537 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800538 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -0700539 obj = bad_action_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -0700540 _version = reader.read("!B")[0]
541 assert(_version == 1)
542 _type = reader.read("!B")[0]
543 assert(_type == 1)
544 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800545 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800546 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -0700547 obj.xid = reader.read("!L")[0]
548 _err_type = reader.read("!H")[0]
549 assert(_err_type == 2)
550 obj.code = reader.read("!H")[0]
551 obj.data = str(reader.read_all())
552 return obj
553
554 def __eq__(self, other):
555 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -0700556 if self.xid != other.xid: return False
557 if self.code != other.code: return False
558 if self.data != other.data: return False
559 return True
560
Rich Lane6f4978c2013-10-20 21:33:52 -0700561 def pretty_print(self, q):
562 q.text("bad_action_error_msg {")
563 with q.group():
564 with q.indent(2):
565 q.breakable()
566 q.text("xid = ");
567 if self.xid != None:
568 q.text("%#x" % self.xid)
569 else:
570 q.text('None')
571 q.text(","); q.breakable()
572 q.text("code = ");
573 q.text("%#x" % self.code)
574 q.text(","); q.breakable()
575 q.text("data = ");
576 q.pp(self.data)
577 q.breakable()
578 q.text('}')
579
Rich Lane7dcdf022013-12-11 14:45:27 -0800580error_msg.subtypes[2] = bad_action_error_msg
581
582class bad_request_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -0700583 version = 1
584 type = 1
585 err_type = 1
586
587 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -0800588 if xid != None:
589 self.xid = xid
590 else:
591 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -0700592 if code != None:
593 self.code = code
594 else:
595 self.code = 0
596 if data != None:
597 self.data = data
598 else:
599 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -0800600 return
Rich Lane6f4978c2013-10-20 21:33:52 -0700601
602 def pack(self):
603 packed = []
604 packed.append(struct.pack("!B", self.version))
605 packed.append(struct.pack("!B", self.type))
606 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
607 packed.append(struct.pack("!L", self.xid))
608 packed.append(struct.pack("!H", self.err_type))
609 packed.append(struct.pack("!H", self.code))
610 packed.append(self.data)
611 length = sum([len(x) for x in packed])
612 packed[2] = struct.pack("!H", length)
613 return ''.join(packed)
614
615 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800616 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -0700617 obj = bad_request_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -0700618 _version = reader.read("!B")[0]
619 assert(_version == 1)
620 _type = reader.read("!B")[0]
621 assert(_type == 1)
622 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800623 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800624 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -0700625 obj.xid = reader.read("!L")[0]
626 _err_type = reader.read("!H")[0]
627 assert(_err_type == 1)
628 obj.code = reader.read("!H")[0]
629 obj.data = str(reader.read_all())
630 return obj
631
632 def __eq__(self, other):
633 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -0700634 if self.xid != other.xid: return False
635 if self.code != other.code: return False
636 if self.data != other.data: return False
637 return True
638
Rich Lane6f4978c2013-10-20 21:33:52 -0700639 def pretty_print(self, q):
640 q.text("bad_request_error_msg {")
641 with q.group():
642 with q.indent(2):
643 q.breakable()
644 q.text("xid = ");
645 if self.xid != None:
646 q.text("%#x" % self.xid)
647 else:
648 q.text('None')
649 q.text(","); q.breakable()
650 q.text("code = ");
651 q.text("%#x" % self.code)
652 q.text(","); q.breakable()
653 q.text("data = ");
654 q.pp(self.data)
655 q.breakable()
656 q.text('}')
657
Rich Lane7dcdf022013-12-11 14:45:27 -0800658error_msg.subtypes[1] = bad_request_error_msg
659
660class barrier_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -0700661 version = 1
662 type = 19
Rich Laneb658ddd2013-03-12 10:15:10 -0700663
664 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -0800665 if xid != None:
666 self.xid = xid
667 else:
668 self.xid = None
669 return
Rich Laneb658ddd2013-03-12 10:15:10 -0700670
671 def pack(self):
672 packed = []
673 packed.append(struct.pack("!B", self.version))
674 packed.append(struct.pack("!B", self.type))
675 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
676 packed.append(struct.pack("!L", self.xid))
677 length = sum([len(x) for x in packed])
678 packed[2] = struct.pack("!H", length)
679 return ''.join(packed)
680
681 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800682 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -0700683 obj = barrier_reply()
Dan Talaycof6202252013-07-02 01:00:29 -0700684 _version = reader.read("!B")[0]
685 assert(_version == 1)
686 _type = reader.read("!B")[0]
687 assert(_type == 19)
688 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800689 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800690 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -0700691 obj.xid = reader.read("!L")[0]
Rich Laneb658ddd2013-03-12 10:15:10 -0700692 return obj
693
694 def __eq__(self, other):
695 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -0700696 if self.xid != other.xid: return False
697 return True
698
Rich Laneb658ddd2013-03-12 10:15:10 -0700699 def pretty_print(self, q):
700 q.text("barrier_reply {")
701 with q.group():
702 with q.indent(2):
703 q.breakable()
704 q.text("xid = ");
705 if self.xid != None:
706 q.text("%#x" % self.xid)
707 else:
708 q.text('None')
709 q.breakable()
710 q.text('}')
711
Rich Lane7dcdf022013-12-11 14:45:27 -0800712message.subtypes[19] = barrier_reply
713
714class barrier_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -0700715 version = 1
716 type = 18
Rich Laneb658ddd2013-03-12 10:15:10 -0700717
718 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -0800719 if xid != None:
720 self.xid = xid
721 else:
722 self.xid = None
723 return
Rich Laneb658ddd2013-03-12 10:15:10 -0700724
725 def pack(self):
726 packed = []
727 packed.append(struct.pack("!B", self.version))
728 packed.append(struct.pack("!B", self.type))
729 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
730 packed.append(struct.pack("!L", self.xid))
731 length = sum([len(x) for x in packed])
732 packed[2] = struct.pack("!H", length)
733 return ''.join(packed)
734
735 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800736 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -0700737 obj = barrier_request()
Dan Talaycof6202252013-07-02 01:00:29 -0700738 _version = reader.read("!B")[0]
739 assert(_version == 1)
740 _type = reader.read("!B")[0]
741 assert(_type == 18)
742 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800743 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800744 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -0700745 obj.xid = reader.read("!L")[0]
Rich Laneb658ddd2013-03-12 10:15:10 -0700746 return obj
747
748 def __eq__(self, other):
749 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -0700750 if self.xid != other.xid: return False
751 return True
752
Rich Laneb658ddd2013-03-12 10:15:10 -0700753 def pretty_print(self, q):
754 q.text("barrier_request {")
755 with q.group():
756 with q.indent(2):
757 q.breakable()
758 q.text("xid = ");
759 if self.xid != None:
760 q.text("%#x" % self.xid)
761 else:
762 q.text('None')
763 q.breakable()
764 q.text('}')
765
Rich Lane7dcdf022013-12-11 14:45:27 -0800766message.subtypes[18] = barrier_request
767
768class experimenter(message):
769 subtypes = {}
770
Rich Lane95f7fc92014-01-27 17:08:16 -0800771 version = 1
772 type = 4
773
Harshmeet Singhc0378a92014-07-22 17:09:36 -0700774 def __init__(self, xid=None, experimenter=None, data=None):
Rich Lane95f7fc92014-01-27 17:08:16 -0800775 if xid != None:
776 self.xid = xid
777 else:
778 self.xid = None
779 if experimenter != None:
780 self.experimenter = experimenter
781 else:
782 self.experimenter = 0
Rich Lane95f7fc92014-01-27 17:08:16 -0800783 if data != None:
784 self.data = data
785 else:
786 self.data = ''
787 return
788
789 def pack(self):
790 packed = []
791 packed.append(struct.pack("!B", self.version))
792 packed.append(struct.pack("!B", self.type))
793 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
794 packed.append(struct.pack("!L", self.xid))
795 packed.append(struct.pack("!L", self.experimenter))
Rich Lane95f7fc92014-01-27 17:08:16 -0800796 packed.append(self.data)
797 length = sum([len(x) for x in packed])
798 packed[2] = struct.pack("!H", length)
799 return ''.join(packed)
800
Rich Lane7dcdf022013-12-11 14:45:27 -0800801 @staticmethod
802 def unpack(reader):
803 subtype, = reader.peek('!L', 8)
Rich Lane95f7fc92014-01-27 17:08:16 -0800804 subclass = experimenter.subtypes.get(subtype)
805 if subclass:
806 return subclass.unpack(reader)
807
808 obj = experimenter()
809 _version = reader.read("!B")[0]
810 assert(_version == 1)
811 _type = reader.read("!B")[0]
812 assert(_type == 4)
813 _length = reader.read("!H")[0]
814 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800815 reader = orig_reader.slice(_length, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -0800816 obj.xid = reader.read("!L")[0]
817 obj.experimenter = reader.read("!L")[0]
Rich Lane95f7fc92014-01-27 17:08:16 -0800818 obj.data = str(reader.read_all())
819 return obj
820
821 def __eq__(self, other):
822 if type(self) != type(other): return False
823 if self.xid != other.xid: return False
824 if self.experimenter != other.experimenter: return False
Rich Lane95f7fc92014-01-27 17:08:16 -0800825 if self.data != other.data: return False
826 return True
827
828 def pretty_print(self, q):
829 q.text("experimenter {")
830 with q.group():
831 with q.indent(2):
832 q.breakable()
833 q.text("xid = ");
834 if self.xid != None:
835 q.text("%#x" % self.xid)
836 else:
837 q.text('None')
838 q.text(","); q.breakable()
Rich Lane95f7fc92014-01-27 17:08:16 -0800839 q.text("data = ");
840 q.pp(self.data)
841 q.breakable()
842 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -0800843
844message.subtypes[4] = experimenter
845
846class bsn_header(experimenter):
847 subtypes = {}
848
Rich Lane95f7fc92014-01-27 17:08:16 -0800849 version = 1
850 type = 4
851 experimenter = 6035143
852
853 def __init__(self, xid=None, subtype=None):
854 if xid != None:
855 self.xid = xid
856 else:
857 self.xid = None
858 if subtype != None:
859 self.subtype = subtype
860 else:
861 self.subtype = 0
862 return
863
864 def pack(self):
865 packed = []
866 packed.append(struct.pack("!B", self.version))
867 packed.append(struct.pack("!B", self.type))
868 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
869 packed.append(struct.pack("!L", self.xid))
870 packed.append(struct.pack("!L", self.experimenter))
871 packed.append(struct.pack("!L", self.subtype))
872 length = sum([len(x) for x in packed])
873 packed[2] = struct.pack("!H", length)
874 return ''.join(packed)
875
Rich Lane7dcdf022013-12-11 14:45:27 -0800876 @staticmethod
877 def unpack(reader):
878 subtype, = reader.peek('!L', 12)
Rich Lane95f7fc92014-01-27 17:08:16 -0800879 subclass = bsn_header.subtypes.get(subtype)
880 if subclass:
881 return subclass.unpack(reader)
882
883 obj = bsn_header()
884 _version = reader.read("!B")[0]
885 assert(_version == 1)
886 _type = reader.read("!B")[0]
887 assert(_type == 4)
888 _length = reader.read("!H")[0]
889 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800890 reader = orig_reader.slice(_length, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -0800891 obj.xid = reader.read("!L")[0]
892 _experimenter = reader.read("!L")[0]
893 assert(_experimenter == 6035143)
894 obj.subtype = reader.read("!L")[0]
895 return obj
896
897 def __eq__(self, other):
898 if type(self) != type(other): return False
899 if self.xid != other.xid: return False
900 if self.subtype != other.subtype: return False
901 return True
902
903 def pretty_print(self, q):
904 q.text("bsn_header {")
905 with q.group():
906 with q.indent(2):
907 q.breakable()
908 q.text("xid = ");
909 if self.xid != None:
910 q.text("%#x" % self.xid)
911 else:
912 q.text('None')
913 q.breakable()
914 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -0800915
916experimenter.subtypes[6035143] = bsn_header
917
918class bsn_bw_clear_data_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -0700919 version = 1
920 type = 4
921 experimenter = 6035143
922 subtype = 22
923
924 def __init__(self, xid=None, status=None):
Rich Lane7dcdf022013-12-11 14:45:27 -0800925 if xid != None:
926 self.xid = xid
927 else:
928 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -0700929 if status != None:
930 self.status = status
931 else:
932 self.status = 0
Rich Lane7dcdf022013-12-11 14:45:27 -0800933 return
Dan Talaycof6202252013-07-02 01:00:29 -0700934
935 def pack(self):
936 packed = []
937 packed.append(struct.pack("!B", self.version))
938 packed.append(struct.pack("!B", self.type))
939 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
940 packed.append(struct.pack("!L", self.xid))
941 packed.append(struct.pack("!L", self.experimenter))
942 packed.append(struct.pack("!L", self.subtype))
943 packed.append(struct.pack("!L", self.status))
944 length = sum([len(x) for x in packed])
945 packed[2] = struct.pack("!H", length)
946 return ''.join(packed)
947
948 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800949 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -0700950 obj = bsn_bw_clear_data_reply()
Dan Talaycof6202252013-07-02 01:00:29 -0700951 _version = reader.read("!B")[0]
952 assert(_version == 1)
953 _type = reader.read("!B")[0]
954 assert(_type == 4)
955 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800956 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800957 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -0700958 obj.xid = reader.read("!L")[0]
959 _experimenter = reader.read("!L")[0]
960 assert(_experimenter == 6035143)
961 _subtype = reader.read("!L")[0]
962 assert(_subtype == 22)
963 obj.status = reader.read("!L")[0]
964 return obj
965
966 def __eq__(self, other):
967 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -0700968 if self.xid != other.xid: return False
969 if self.status != other.status: return False
970 return True
971
Dan Talaycof6202252013-07-02 01:00:29 -0700972 def pretty_print(self, q):
973 q.text("bsn_bw_clear_data_reply {")
974 with q.group():
975 with q.indent(2):
976 q.breakable()
977 q.text("xid = ");
978 if self.xid != None:
979 q.text("%#x" % self.xid)
980 else:
981 q.text('None')
982 q.text(","); q.breakable()
983 q.text("status = ");
984 q.text("%#x" % self.status)
985 q.breakable()
986 q.text('}')
987
Rich Lane7dcdf022013-12-11 14:45:27 -0800988bsn_header.subtypes[22] = bsn_bw_clear_data_reply
989
990class bsn_bw_clear_data_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -0700991 version = 1
992 type = 4
993 experimenter = 6035143
994 subtype = 21
995
996 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -0800997 if xid != None:
998 self.xid = xid
999 else:
1000 self.xid = None
1001 return
Dan Talaycof6202252013-07-02 01:00:29 -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))
1011 length = sum([len(x) for x in packed])
1012 packed[2] = struct.pack("!H", length)
1013 return ''.join(packed)
1014
1015 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001016 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07001017 obj = bsn_bw_clear_data_request()
Dan Talaycof6202252013-07-02 01:00:29 -07001018 _version = reader.read("!B")[0]
1019 assert(_version == 1)
1020 _type = reader.read("!B")[0]
1021 assert(_type == 4)
1022 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001023 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001024 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07001025 obj.xid = reader.read("!L")[0]
1026 _experimenter = reader.read("!L")[0]
1027 assert(_experimenter == 6035143)
1028 _subtype = reader.read("!L")[0]
1029 assert(_subtype == 21)
1030 return obj
1031
1032 def __eq__(self, other):
1033 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07001034 if self.xid != other.xid: return False
1035 return True
1036
Dan Talaycof6202252013-07-02 01:00:29 -07001037 def pretty_print(self, q):
1038 q.text("bsn_bw_clear_data_request {")
1039 with q.group():
1040 with q.indent(2):
1041 q.breakable()
1042 q.text("xid = ");
1043 if self.xid != None:
1044 q.text("%#x" % self.xid)
1045 else:
1046 q.text('None')
1047 q.breakable()
1048 q.text('}')
1049
Rich Lane7dcdf022013-12-11 14:45:27 -08001050bsn_header.subtypes[21] = bsn_bw_clear_data_request
1051
1052class bsn_bw_enable_get_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001053 version = 1
1054 type = 4
1055 experimenter = 6035143
1056 subtype = 20
1057
1058 def __init__(self, xid=None, enabled=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001059 if xid != None:
1060 self.xid = xid
1061 else:
1062 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07001063 if enabled != None:
1064 self.enabled = enabled
1065 else:
1066 self.enabled = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08001067 return
Dan Talaycof6202252013-07-02 01:00:29 -07001068
1069 def pack(self):
1070 packed = []
1071 packed.append(struct.pack("!B", self.version))
1072 packed.append(struct.pack("!B", self.type))
1073 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1074 packed.append(struct.pack("!L", self.xid))
1075 packed.append(struct.pack("!L", self.experimenter))
1076 packed.append(struct.pack("!L", self.subtype))
1077 packed.append(struct.pack("!L", self.enabled))
1078 length = sum([len(x) for x in packed])
1079 packed[2] = struct.pack("!H", length)
1080 return ''.join(packed)
1081
1082 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001083 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07001084 obj = bsn_bw_enable_get_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07001085 _version = reader.read("!B")[0]
1086 assert(_version == 1)
1087 _type = reader.read("!B")[0]
1088 assert(_type == 4)
1089 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001090 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001091 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07001092 obj.xid = reader.read("!L")[0]
1093 _experimenter = reader.read("!L")[0]
1094 assert(_experimenter == 6035143)
1095 _subtype = reader.read("!L")[0]
1096 assert(_subtype == 20)
1097 obj.enabled = reader.read("!L")[0]
1098 return obj
1099
1100 def __eq__(self, other):
1101 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07001102 if self.xid != other.xid: return False
1103 if self.enabled != other.enabled: return False
1104 return True
1105
Dan Talaycof6202252013-07-02 01:00:29 -07001106 def pretty_print(self, q):
1107 q.text("bsn_bw_enable_get_reply {")
1108 with q.group():
1109 with q.indent(2):
1110 q.breakable()
1111 q.text("xid = ");
1112 if self.xid != None:
1113 q.text("%#x" % self.xid)
1114 else:
1115 q.text('None')
1116 q.text(","); q.breakable()
1117 q.text("enabled = ");
1118 q.text("%#x" % self.enabled)
1119 q.breakable()
1120 q.text('}')
1121
Rich Lane7dcdf022013-12-11 14:45:27 -08001122bsn_header.subtypes[20] = bsn_bw_enable_get_reply
1123
1124class bsn_bw_enable_get_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001125 version = 1
1126 type = 4
1127 experimenter = 6035143
1128 subtype = 19
1129
1130 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001131 if xid != None:
1132 self.xid = xid
1133 else:
1134 self.xid = None
1135 return
Dan Talaycof6202252013-07-02 01:00:29 -07001136
1137 def pack(self):
1138 packed = []
1139 packed.append(struct.pack("!B", self.version))
1140 packed.append(struct.pack("!B", self.type))
1141 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1142 packed.append(struct.pack("!L", self.xid))
1143 packed.append(struct.pack("!L", self.experimenter))
1144 packed.append(struct.pack("!L", self.subtype))
1145 length = sum([len(x) for x in packed])
1146 packed[2] = struct.pack("!H", length)
1147 return ''.join(packed)
1148
1149 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001150 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07001151 obj = bsn_bw_enable_get_request()
Dan Talaycof6202252013-07-02 01:00:29 -07001152 _version = reader.read("!B")[0]
1153 assert(_version == 1)
1154 _type = reader.read("!B")[0]
1155 assert(_type == 4)
1156 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001157 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001158 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07001159 obj.xid = reader.read("!L")[0]
1160 _experimenter = reader.read("!L")[0]
1161 assert(_experimenter == 6035143)
1162 _subtype = reader.read("!L")[0]
1163 assert(_subtype == 19)
1164 return obj
1165
1166 def __eq__(self, other):
1167 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07001168 if self.xid != other.xid: return False
1169 return True
1170
Dan Talaycof6202252013-07-02 01:00:29 -07001171 def pretty_print(self, q):
1172 q.text("bsn_bw_enable_get_request {")
1173 with q.group():
1174 with q.indent(2):
1175 q.breakable()
1176 q.text("xid = ");
1177 if self.xid != None:
1178 q.text("%#x" % self.xid)
1179 else:
1180 q.text('None')
1181 q.breakable()
1182 q.text('}')
1183
Rich Lane7dcdf022013-12-11 14:45:27 -08001184bsn_header.subtypes[19] = bsn_bw_enable_get_request
1185
1186class bsn_bw_enable_set_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001187 version = 1
1188 type = 4
1189 experimenter = 6035143
1190 subtype = 23
1191
1192 def __init__(self, xid=None, enable=None, status=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001193 if xid != None:
1194 self.xid = xid
1195 else:
1196 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07001197 if enable != None:
1198 self.enable = enable
1199 else:
1200 self.enable = 0
1201 if status != None:
1202 self.status = status
1203 else:
1204 self.status = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08001205 return
Dan Talaycof6202252013-07-02 01:00:29 -07001206
1207 def pack(self):
1208 packed = []
1209 packed.append(struct.pack("!B", self.version))
1210 packed.append(struct.pack("!B", self.type))
1211 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1212 packed.append(struct.pack("!L", self.xid))
1213 packed.append(struct.pack("!L", self.experimenter))
1214 packed.append(struct.pack("!L", self.subtype))
1215 packed.append(struct.pack("!L", self.enable))
1216 packed.append(struct.pack("!L", self.status))
1217 length = sum([len(x) for x in packed])
1218 packed[2] = struct.pack("!H", length)
1219 return ''.join(packed)
1220
1221 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001222 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07001223 obj = bsn_bw_enable_set_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07001224 _version = reader.read("!B")[0]
1225 assert(_version == 1)
1226 _type = reader.read("!B")[0]
1227 assert(_type == 4)
1228 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001229 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001230 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07001231 obj.xid = reader.read("!L")[0]
1232 _experimenter = reader.read("!L")[0]
1233 assert(_experimenter == 6035143)
1234 _subtype = reader.read("!L")[0]
1235 assert(_subtype == 23)
1236 obj.enable = reader.read("!L")[0]
1237 obj.status = reader.read("!L")[0]
1238 return obj
1239
1240 def __eq__(self, other):
1241 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07001242 if self.xid != other.xid: return False
1243 if self.enable != other.enable: return False
1244 if self.status != other.status: return False
1245 return True
1246
Dan Talaycof6202252013-07-02 01:00:29 -07001247 def pretty_print(self, q):
1248 q.text("bsn_bw_enable_set_reply {")
1249 with q.group():
1250 with q.indent(2):
1251 q.breakable()
1252 q.text("xid = ");
1253 if self.xid != None:
1254 q.text("%#x" % self.xid)
1255 else:
1256 q.text('None')
1257 q.text(","); q.breakable()
1258 q.text("enable = ");
1259 q.text("%#x" % self.enable)
1260 q.text(","); q.breakable()
1261 q.text("status = ");
1262 q.text("%#x" % self.status)
1263 q.breakable()
1264 q.text('}')
1265
Rich Lane7dcdf022013-12-11 14:45:27 -08001266bsn_header.subtypes[23] = bsn_bw_enable_set_reply
1267
1268class bsn_bw_enable_set_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001269 version = 1
1270 type = 4
1271 experimenter = 6035143
1272 subtype = 18
1273
1274 def __init__(self, xid=None, enable=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001275 if xid != None:
1276 self.xid = xid
1277 else:
1278 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07001279 if enable != None:
1280 self.enable = enable
1281 else:
1282 self.enable = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08001283 return
Dan Talaycof6202252013-07-02 01:00:29 -07001284
1285 def pack(self):
1286 packed = []
1287 packed.append(struct.pack("!B", self.version))
1288 packed.append(struct.pack("!B", self.type))
1289 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1290 packed.append(struct.pack("!L", self.xid))
1291 packed.append(struct.pack("!L", self.experimenter))
1292 packed.append(struct.pack("!L", self.subtype))
1293 packed.append(struct.pack("!L", self.enable))
1294 length = sum([len(x) for x in packed])
1295 packed[2] = struct.pack("!H", length)
1296 return ''.join(packed)
1297
1298 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001299 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07001300 obj = bsn_bw_enable_set_request()
Dan Talaycof6202252013-07-02 01:00:29 -07001301 _version = reader.read("!B")[0]
1302 assert(_version == 1)
1303 _type = reader.read("!B")[0]
1304 assert(_type == 4)
1305 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001306 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001307 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07001308 obj.xid = reader.read("!L")[0]
1309 _experimenter = reader.read("!L")[0]
1310 assert(_experimenter == 6035143)
1311 _subtype = reader.read("!L")[0]
1312 assert(_subtype == 18)
1313 obj.enable = reader.read("!L")[0]
1314 return obj
1315
1316 def __eq__(self, other):
1317 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07001318 if self.xid != other.xid: return False
1319 if self.enable != other.enable: return False
1320 return True
1321
Dan Talaycof6202252013-07-02 01:00:29 -07001322 def pretty_print(self, q):
1323 q.text("bsn_bw_enable_set_request {")
1324 with q.group():
1325 with q.indent(2):
1326 q.breakable()
1327 q.text("xid = ");
1328 if self.xid != None:
1329 q.text("%#x" % self.xid)
1330 else:
1331 q.text('None')
1332 q.text(","); q.breakable()
1333 q.text("enable = ");
1334 q.text("%#x" % self.enable)
1335 q.breakable()
1336 q.text('}')
1337
Rich Lane7dcdf022013-12-11 14:45:27 -08001338bsn_header.subtypes[18] = bsn_bw_enable_set_request
1339
1340class bsn_get_interfaces_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001341 version = 1
1342 type = 4
1343 experimenter = 6035143
Rich Laneb658ddd2013-03-12 10:15:10 -07001344 subtype = 10
1345
1346 def __init__(self, xid=None, interfaces=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001347 if xid != None:
1348 self.xid = xid
1349 else:
1350 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07001351 if interfaces != None:
1352 self.interfaces = interfaces
1353 else:
1354 self.interfaces = []
Rich Lane7dcdf022013-12-11 14:45:27 -08001355 return
Rich Laneb658ddd2013-03-12 10:15:10 -07001356
1357 def pack(self):
1358 packed = []
1359 packed.append(struct.pack("!B", self.version))
1360 packed.append(struct.pack("!B", self.type))
1361 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1362 packed.append(struct.pack("!L", self.xid))
1363 packed.append(struct.pack("!L", self.experimenter))
1364 packed.append(struct.pack("!L", self.subtype))
Rich Lane7dcdf022013-12-11 14:45:27 -08001365 packed.append(loxi.generic_util.pack_list(self.interfaces))
Rich Laneb658ddd2013-03-12 10:15:10 -07001366 length = sum([len(x) for x in packed])
1367 packed[2] = struct.pack("!H", length)
1368 return ''.join(packed)
1369
1370 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001371 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07001372 obj = bsn_get_interfaces_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07001373 _version = reader.read("!B")[0]
1374 assert(_version == 1)
1375 _type = reader.read("!B")[0]
1376 assert(_type == 4)
1377 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001378 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001379 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07001380 obj.xid = reader.read("!L")[0]
1381 _experimenter = reader.read("!L")[0]
1382 assert(_experimenter == 6035143)
1383 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001384 assert(_subtype == 10)
Rich Lanee2567702015-01-26 15:04:35 -08001385 obj.interfaces = loxi.generic_util.unpack_list(reader, ofp.common.bsn_interface.unpack)
Rich Laneb658ddd2013-03-12 10:15:10 -07001386 return obj
1387
1388 def __eq__(self, other):
1389 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07001390 if self.xid != other.xid: return False
1391 if self.interfaces != other.interfaces: return False
1392 return True
1393
Rich Laneb658ddd2013-03-12 10:15:10 -07001394 def pretty_print(self, q):
1395 q.text("bsn_get_interfaces_reply {")
1396 with q.group():
1397 with q.indent(2):
1398 q.breakable()
1399 q.text("xid = ");
1400 if self.xid != None:
1401 q.text("%#x" % self.xid)
1402 else:
1403 q.text('None')
1404 q.text(","); q.breakable()
1405 q.text("interfaces = ");
1406 q.pp(self.interfaces)
1407 q.breakable()
1408 q.text('}')
1409
Rich Lane7dcdf022013-12-11 14:45:27 -08001410bsn_header.subtypes[10] = bsn_get_interfaces_reply
1411
1412class bsn_get_interfaces_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001413 version = 1
1414 type = 4
1415 experimenter = 6035143
Rich Laneb658ddd2013-03-12 10:15:10 -07001416 subtype = 9
1417
1418 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001419 if xid != None:
1420 self.xid = xid
1421 else:
1422 self.xid = None
1423 return
Rich Laneb658ddd2013-03-12 10:15:10 -07001424
1425 def pack(self):
1426 packed = []
1427 packed.append(struct.pack("!B", self.version))
1428 packed.append(struct.pack("!B", self.type))
1429 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1430 packed.append(struct.pack("!L", self.xid))
1431 packed.append(struct.pack("!L", self.experimenter))
1432 packed.append(struct.pack("!L", self.subtype))
1433 length = sum([len(x) for x in packed])
1434 packed[2] = struct.pack("!H", length)
1435 return ''.join(packed)
1436
1437 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001438 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07001439 obj = bsn_get_interfaces_request()
Dan Talaycof6202252013-07-02 01:00:29 -07001440 _version = reader.read("!B")[0]
1441 assert(_version == 1)
1442 _type = reader.read("!B")[0]
1443 assert(_type == 4)
1444 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001445 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001446 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07001447 obj.xid = reader.read("!L")[0]
1448 _experimenter = reader.read("!L")[0]
1449 assert(_experimenter == 6035143)
1450 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001451 assert(_subtype == 9)
Rich Laneb658ddd2013-03-12 10:15:10 -07001452 return obj
1453
1454 def __eq__(self, other):
1455 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07001456 if self.xid != other.xid: return False
1457 return True
1458
Rich Laneb658ddd2013-03-12 10:15:10 -07001459 def pretty_print(self, q):
1460 q.text("bsn_get_interfaces_request {")
1461 with q.group():
1462 with q.indent(2):
1463 q.breakable()
1464 q.text("xid = ");
1465 if self.xid != None:
1466 q.text("%#x" % self.xid)
1467 else:
1468 q.text('None')
1469 q.breakable()
1470 q.text('}')
1471
Rich Lane7dcdf022013-12-11 14:45:27 -08001472bsn_header.subtypes[9] = bsn_get_interfaces_request
1473
1474class bsn_get_ip_mask_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001475 version = 1
1476 type = 4
1477 experimenter = 6035143
Rich Laneb658ddd2013-03-12 10:15:10 -07001478 subtype = 2
1479
Rich Lanec2ee4b82013-04-24 17:12:38 -07001480 def __init__(self, xid=None, index=None, mask=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001481 if xid != None:
1482 self.xid = xid
1483 else:
1484 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07001485 if index != None:
1486 self.index = index
1487 else:
1488 self.index = 0
Rich Laneb658ddd2013-03-12 10:15:10 -07001489 if mask != None:
1490 self.mask = mask
1491 else:
1492 self.mask = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08001493 return
Rich Laneb658ddd2013-03-12 10:15:10 -07001494
1495 def pack(self):
1496 packed = []
1497 packed.append(struct.pack("!B", self.version))
1498 packed.append(struct.pack("!B", self.type))
1499 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1500 packed.append(struct.pack("!L", self.xid))
1501 packed.append(struct.pack("!L", self.experimenter))
1502 packed.append(struct.pack("!L", self.subtype))
1503 packed.append(struct.pack("!B", self.index))
Rich Lanec2ee4b82013-04-24 17:12:38 -07001504 packed.append('\x00' * 3)
Rich Laneb658ddd2013-03-12 10:15:10 -07001505 packed.append(struct.pack("!L", self.mask))
1506 length = sum([len(x) for x in packed])
1507 packed[2] = struct.pack("!H", length)
1508 return ''.join(packed)
1509
1510 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001511 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07001512 obj = bsn_get_ip_mask_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07001513 _version = reader.read("!B")[0]
1514 assert(_version == 1)
1515 _type = reader.read("!B")[0]
1516 assert(_type == 4)
1517 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001518 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001519 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07001520 obj.xid = reader.read("!L")[0]
1521 _experimenter = reader.read("!L")[0]
1522 assert(_experimenter == 6035143)
1523 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001524 assert(_subtype == 2)
Dan Talaycof6202252013-07-02 01:00:29 -07001525 obj.index = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001526 reader.skip(3)
Dan Talaycof6202252013-07-02 01:00:29 -07001527 obj.mask = reader.read("!L")[0]
Rich Laneb658ddd2013-03-12 10:15:10 -07001528 return obj
1529
1530 def __eq__(self, other):
1531 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07001532 if self.xid != other.xid: return False
1533 if self.index != other.index: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07001534 if self.mask != other.mask: return False
1535 return True
1536
Rich Laneb658ddd2013-03-12 10:15:10 -07001537 def pretty_print(self, q):
1538 q.text("bsn_get_ip_mask_reply {")
1539 with q.group():
1540 with q.indent(2):
1541 q.breakable()
1542 q.text("xid = ");
1543 if self.xid != None:
1544 q.text("%#x" % self.xid)
1545 else:
1546 q.text('None')
1547 q.text(","); q.breakable()
1548 q.text("index = ");
1549 q.text("%#x" % self.index)
1550 q.text(","); q.breakable()
Rich Laneb658ddd2013-03-12 10:15:10 -07001551 q.text("mask = ");
1552 q.text("%#x" % self.mask)
1553 q.breakable()
1554 q.text('}')
1555
Rich Lane7dcdf022013-12-11 14:45:27 -08001556bsn_header.subtypes[2] = bsn_get_ip_mask_reply
1557
1558class bsn_get_ip_mask_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001559 version = 1
1560 type = 4
1561 experimenter = 6035143
Rich Laneb658ddd2013-03-12 10:15:10 -07001562 subtype = 1
1563
Rich Lanec2ee4b82013-04-24 17:12:38 -07001564 def __init__(self, xid=None, index=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001565 if xid != None:
1566 self.xid = xid
1567 else:
1568 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07001569 if index != None:
1570 self.index = index
1571 else:
1572 self.index = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08001573 return
Rich Laneb658ddd2013-03-12 10:15:10 -07001574
1575 def pack(self):
1576 packed = []
1577 packed.append(struct.pack("!B", self.version))
1578 packed.append(struct.pack("!B", self.type))
1579 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1580 packed.append(struct.pack("!L", self.xid))
1581 packed.append(struct.pack("!L", self.experimenter))
1582 packed.append(struct.pack("!L", self.subtype))
1583 packed.append(struct.pack("!B", self.index))
Rich Lanec2ee4b82013-04-24 17:12:38 -07001584 packed.append('\x00' * 7)
Rich Laneb658ddd2013-03-12 10:15:10 -07001585 length = sum([len(x) for x in packed])
1586 packed[2] = struct.pack("!H", length)
1587 return ''.join(packed)
1588
1589 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001590 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07001591 obj = bsn_get_ip_mask_request()
Dan Talaycof6202252013-07-02 01:00:29 -07001592 _version = reader.read("!B")[0]
1593 assert(_version == 1)
1594 _type = reader.read("!B")[0]
1595 assert(_type == 4)
1596 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001597 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001598 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07001599 obj.xid = reader.read("!L")[0]
1600 _experimenter = reader.read("!L")[0]
1601 assert(_experimenter == 6035143)
1602 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001603 assert(_subtype == 1)
Dan Talaycof6202252013-07-02 01:00:29 -07001604 obj.index = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001605 reader.skip(7)
Rich Laneb658ddd2013-03-12 10:15:10 -07001606 return obj
1607
1608 def __eq__(self, other):
1609 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07001610 if self.xid != other.xid: return False
1611 if self.index != other.index: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07001612 return True
1613
Rich Laneb658ddd2013-03-12 10:15:10 -07001614 def pretty_print(self, q):
1615 q.text("bsn_get_ip_mask_request {")
1616 with q.group():
1617 with q.indent(2):
1618 q.breakable()
1619 q.text("xid = ");
1620 if self.xid != None:
1621 q.text("%#x" % self.xid)
1622 else:
1623 q.text('None')
1624 q.text(","); q.breakable()
1625 q.text("index = ");
1626 q.text("%#x" % self.index)
Rich Laneb658ddd2013-03-12 10:15:10 -07001627 q.breakable()
1628 q.text('}')
1629
Rich Lane7dcdf022013-12-11 14:45:27 -08001630bsn_header.subtypes[1] = bsn_get_ip_mask_request
1631
1632class bsn_get_l2_table_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001633 version = 1
1634 type = 4
1635 experimenter = 6035143
Rich Lane90c961c2013-05-14 09:26:50 -07001636 subtype = 14
1637
1638 def __init__(self, xid=None, l2_table_enable=None, l2_table_priority=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001639 if xid != None:
1640 self.xid = xid
1641 else:
1642 self.xid = None
Rich Lane90c961c2013-05-14 09:26:50 -07001643 if l2_table_enable != None:
1644 self.l2_table_enable = l2_table_enable
1645 else:
1646 self.l2_table_enable = 0
1647 if l2_table_priority != None:
1648 self.l2_table_priority = l2_table_priority
1649 else:
1650 self.l2_table_priority = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08001651 return
Rich Lane90c961c2013-05-14 09:26:50 -07001652
1653 def pack(self):
1654 packed = []
1655 packed.append(struct.pack("!B", self.version))
1656 packed.append(struct.pack("!B", self.type))
1657 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1658 packed.append(struct.pack("!L", self.xid))
1659 packed.append(struct.pack("!L", self.experimenter))
1660 packed.append(struct.pack("!L", self.subtype))
1661 packed.append(struct.pack("!B", self.l2_table_enable))
1662 packed.append('\x00' * 1)
1663 packed.append(struct.pack("!H", self.l2_table_priority))
1664 packed.append('\x00' * 4)
1665 length = sum([len(x) for x in packed])
1666 packed[2] = struct.pack("!H", length)
1667 return ''.join(packed)
1668
1669 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001670 def unpack(reader):
Rich Lane90c961c2013-05-14 09:26:50 -07001671 obj = bsn_get_l2_table_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07001672 _version = reader.read("!B")[0]
1673 assert(_version == 1)
1674 _type = reader.read("!B")[0]
1675 assert(_type == 4)
1676 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001677 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001678 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07001679 obj.xid = reader.read("!L")[0]
1680 _experimenter = reader.read("!L")[0]
1681 assert(_experimenter == 6035143)
1682 _subtype = reader.read("!L")[0]
Rich Lane90c961c2013-05-14 09:26:50 -07001683 assert(_subtype == 14)
Dan Talaycof6202252013-07-02 01:00:29 -07001684 obj.l2_table_enable = reader.read("!B")[0]
Rich Lane90c961c2013-05-14 09:26:50 -07001685 reader.skip(1)
Dan Talaycof6202252013-07-02 01:00:29 -07001686 obj.l2_table_priority = reader.read("!H")[0]
Rich Lane90c961c2013-05-14 09:26:50 -07001687 reader.skip(4)
1688 return obj
1689
1690 def __eq__(self, other):
1691 if type(self) != type(other): return False
Rich Lane90c961c2013-05-14 09:26:50 -07001692 if self.xid != other.xid: return False
1693 if self.l2_table_enable != other.l2_table_enable: return False
1694 if self.l2_table_priority != other.l2_table_priority: return False
1695 return True
1696
Rich Lane90c961c2013-05-14 09:26:50 -07001697 def pretty_print(self, q):
1698 q.text("bsn_get_l2_table_reply {")
1699 with q.group():
1700 with q.indent(2):
1701 q.breakable()
1702 q.text("xid = ");
1703 if self.xid != None:
1704 q.text("%#x" % self.xid)
1705 else:
1706 q.text('None')
1707 q.text(","); q.breakable()
1708 q.text("l2_table_enable = ");
1709 q.text("%#x" % self.l2_table_enable)
1710 q.text(","); q.breakable()
1711 q.text("l2_table_priority = ");
1712 q.text("%#x" % self.l2_table_priority)
1713 q.breakable()
1714 q.text('}')
1715
Rich Lane7dcdf022013-12-11 14:45:27 -08001716bsn_header.subtypes[14] = bsn_get_l2_table_reply
1717
1718class bsn_get_l2_table_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001719 version = 1
1720 type = 4
1721 experimenter = 6035143
Rich Lane90c961c2013-05-14 09:26:50 -07001722 subtype = 13
1723
1724 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001725 if xid != None:
1726 self.xid = xid
1727 else:
1728 self.xid = None
1729 return
Rich Lane90c961c2013-05-14 09:26:50 -07001730
1731 def pack(self):
1732 packed = []
1733 packed.append(struct.pack("!B", self.version))
1734 packed.append(struct.pack("!B", self.type))
1735 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1736 packed.append(struct.pack("!L", self.xid))
1737 packed.append(struct.pack("!L", self.experimenter))
1738 packed.append(struct.pack("!L", self.subtype))
1739 length = sum([len(x) for x in packed])
1740 packed[2] = struct.pack("!H", length)
1741 return ''.join(packed)
1742
1743 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001744 def unpack(reader):
Rich Lane90c961c2013-05-14 09:26:50 -07001745 obj = bsn_get_l2_table_request()
Dan Talaycof6202252013-07-02 01:00:29 -07001746 _version = reader.read("!B")[0]
1747 assert(_version == 1)
1748 _type = reader.read("!B")[0]
1749 assert(_type == 4)
1750 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001751 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001752 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07001753 obj.xid = reader.read("!L")[0]
1754 _experimenter = reader.read("!L")[0]
1755 assert(_experimenter == 6035143)
1756 _subtype = reader.read("!L")[0]
Rich Lane90c961c2013-05-14 09:26:50 -07001757 assert(_subtype == 13)
1758 return obj
1759
1760 def __eq__(self, other):
1761 if type(self) != type(other): return False
Rich Lane90c961c2013-05-14 09:26:50 -07001762 if self.xid != other.xid: return False
1763 return True
1764
Rich Lane90c961c2013-05-14 09:26:50 -07001765 def pretty_print(self, q):
1766 q.text("bsn_get_l2_table_request {")
1767 with q.group():
1768 with q.indent(2):
1769 q.breakable()
1770 q.text("xid = ");
1771 if self.xid != None:
1772 q.text("%#x" % self.xid)
1773 else:
1774 q.text('None')
1775 q.breakable()
1776 q.text('}')
1777
Rich Lane7dcdf022013-12-11 14:45:27 -08001778bsn_header.subtypes[13] = bsn_get_l2_table_request
1779
1780class bsn_get_mirroring_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001781 version = 1
1782 type = 4
1783 experimenter = 6035143
Rich Laneb658ddd2013-03-12 10:15:10 -07001784 subtype = 5
1785
Rich Lanec2ee4b82013-04-24 17:12:38 -07001786 def __init__(self, xid=None, report_mirror_ports=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001787 if xid != None:
1788 self.xid = xid
1789 else:
1790 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07001791 if report_mirror_ports != None:
1792 self.report_mirror_ports = report_mirror_ports
1793 else:
1794 self.report_mirror_ports = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08001795 return
Rich Laneb658ddd2013-03-12 10:15:10 -07001796
1797 def pack(self):
1798 packed = []
1799 packed.append(struct.pack("!B", self.version))
1800 packed.append(struct.pack("!B", self.type))
1801 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1802 packed.append(struct.pack("!L", self.xid))
1803 packed.append(struct.pack("!L", self.experimenter))
1804 packed.append(struct.pack("!L", self.subtype))
1805 packed.append(struct.pack("!B", self.report_mirror_ports))
Rich Lanec2ee4b82013-04-24 17:12:38 -07001806 packed.append('\x00' * 3)
Rich Laneb658ddd2013-03-12 10:15:10 -07001807 length = sum([len(x) for x in packed])
1808 packed[2] = struct.pack("!H", length)
1809 return ''.join(packed)
1810
1811 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001812 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07001813 obj = bsn_get_mirroring_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07001814 _version = reader.read("!B")[0]
1815 assert(_version == 1)
1816 _type = reader.read("!B")[0]
1817 assert(_type == 4)
1818 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001819 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001820 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07001821 obj.xid = reader.read("!L")[0]
1822 _experimenter = reader.read("!L")[0]
1823 assert(_experimenter == 6035143)
1824 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001825 assert(_subtype == 5)
Dan Talaycof6202252013-07-02 01:00:29 -07001826 obj.report_mirror_ports = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001827 reader.skip(3)
Rich Laneb658ddd2013-03-12 10:15:10 -07001828 return obj
1829
1830 def __eq__(self, other):
1831 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07001832 if self.xid != other.xid: return False
1833 if self.report_mirror_ports != other.report_mirror_ports: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07001834 return True
1835
Rich Laneb658ddd2013-03-12 10:15:10 -07001836 def pretty_print(self, q):
1837 q.text("bsn_get_mirroring_reply {")
1838 with q.group():
1839 with q.indent(2):
1840 q.breakable()
1841 q.text("xid = ");
1842 if self.xid != None:
1843 q.text("%#x" % self.xid)
1844 else:
1845 q.text('None')
1846 q.text(","); q.breakable()
1847 q.text("report_mirror_ports = ");
1848 q.text("%#x" % self.report_mirror_ports)
Rich Laneb658ddd2013-03-12 10:15:10 -07001849 q.breakable()
1850 q.text('}')
1851
Rich Lane7dcdf022013-12-11 14:45:27 -08001852bsn_header.subtypes[5] = bsn_get_mirroring_reply
1853
1854class bsn_get_mirroring_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001855 version = 1
1856 type = 4
1857 experimenter = 6035143
Rich Laneb658ddd2013-03-12 10:15:10 -07001858 subtype = 4
1859
Rich Lanec2ee4b82013-04-24 17:12:38 -07001860 def __init__(self, xid=None, report_mirror_ports=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001861 if xid != None:
1862 self.xid = xid
1863 else:
1864 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07001865 if report_mirror_ports != None:
1866 self.report_mirror_ports = report_mirror_ports
1867 else:
1868 self.report_mirror_ports = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08001869 return
Rich Laneb658ddd2013-03-12 10:15:10 -07001870
1871 def pack(self):
1872 packed = []
1873 packed.append(struct.pack("!B", self.version))
1874 packed.append(struct.pack("!B", self.type))
1875 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1876 packed.append(struct.pack("!L", self.xid))
1877 packed.append(struct.pack("!L", self.experimenter))
1878 packed.append(struct.pack("!L", self.subtype))
1879 packed.append(struct.pack("!B", self.report_mirror_ports))
Rich Lanec2ee4b82013-04-24 17:12:38 -07001880 packed.append('\x00' * 3)
Rich Laneb658ddd2013-03-12 10:15:10 -07001881 length = sum([len(x) for x in packed])
1882 packed[2] = struct.pack("!H", length)
1883 return ''.join(packed)
1884
1885 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001886 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07001887 obj = bsn_get_mirroring_request()
Dan Talaycof6202252013-07-02 01:00:29 -07001888 _version = reader.read("!B")[0]
1889 assert(_version == 1)
1890 _type = reader.read("!B")[0]
1891 assert(_type == 4)
1892 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001893 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001894 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07001895 obj.xid = reader.read("!L")[0]
1896 _experimenter = reader.read("!L")[0]
1897 assert(_experimenter == 6035143)
1898 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001899 assert(_subtype == 4)
Dan Talaycof6202252013-07-02 01:00:29 -07001900 obj.report_mirror_ports = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001901 reader.skip(3)
Rich Laneb658ddd2013-03-12 10:15:10 -07001902 return obj
1903
1904 def __eq__(self, other):
1905 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07001906 if self.xid != other.xid: return False
1907 if self.report_mirror_ports != other.report_mirror_ports: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07001908 return True
1909
Rich Laneb658ddd2013-03-12 10:15:10 -07001910 def pretty_print(self, q):
1911 q.text("bsn_get_mirroring_request {")
1912 with q.group():
1913 with q.indent(2):
1914 q.breakable()
1915 q.text("xid = ");
1916 if self.xid != None:
1917 q.text("%#x" % self.xid)
1918 else:
1919 q.text('None')
1920 q.text(","); q.breakable()
1921 q.text("report_mirror_ports = ");
1922 q.text("%#x" % self.report_mirror_ports)
Rich Laneb658ddd2013-03-12 10:15:10 -07001923 q.breakable()
1924 q.text('}')
1925
Rich Lane7dcdf022013-12-11 14:45:27 -08001926bsn_header.subtypes[4] = bsn_get_mirroring_request
1927
1928class bsn_hybrid_get_reply(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07001929 version = 1
1930 type = 4
1931 experimenter = 6035143
1932 subtype = 28
1933
1934 def __init__(self, xid=None, hybrid_enable=None, hybrid_version=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001935 if xid != None:
1936 self.xid = xid
1937 else:
1938 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07001939 if hybrid_enable != None:
1940 self.hybrid_enable = hybrid_enable
1941 else:
1942 self.hybrid_enable = 0
1943 if hybrid_version != None:
1944 self.hybrid_version = hybrid_version
1945 else:
1946 self.hybrid_version = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08001947 return
Rich Lane6f4978c2013-10-20 21:33:52 -07001948
1949 def pack(self):
1950 packed = []
1951 packed.append(struct.pack("!B", self.version))
1952 packed.append(struct.pack("!B", self.type))
1953 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1954 packed.append(struct.pack("!L", self.xid))
1955 packed.append(struct.pack("!L", self.experimenter))
1956 packed.append(struct.pack("!L", self.subtype))
1957 packed.append(struct.pack("!B", self.hybrid_enable))
1958 packed.append('\x00' * 1)
1959 packed.append(struct.pack("!H", self.hybrid_version))
1960 packed.append('\x00' * 4)
1961 length = sum([len(x) for x in packed])
1962 packed[2] = struct.pack("!H", length)
1963 return ''.join(packed)
1964
1965 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001966 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07001967 obj = bsn_hybrid_get_reply()
Rich Lane6f4978c2013-10-20 21:33:52 -07001968 _version = reader.read("!B")[0]
1969 assert(_version == 1)
1970 _type = reader.read("!B")[0]
1971 assert(_type == 4)
1972 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001973 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001974 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -07001975 obj.xid = reader.read("!L")[0]
1976 _experimenter = reader.read("!L")[0]
1977 assert(_experimenter == 6035143)
1978 _subtype = reader.read("!L")[0]
1979 assert(_subtype == 28)
1980 obj.hybrid_enable = reader.read("!B")[0]
1981 reader.skip(1)
1982 obj.hybrid_version = reader.read("!H")[0]
1983 reader.skip(4)
1984 return obj
1985
1986 def __eq__(self, other):
1987 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07001988 if self.xid != other.xid: return False
1989 if self.hybrid_enable != other.hybrid_enable: return False
1990 if self.hybrid_version != other.hybrid_version: return False
1991 return True
1992
Rich Lane6f4978c2013-10-20 21:33:52 -07001993 def pretty_print(self, q):
1994 q.text("bsn_hybrid_get_reply {")
1995 with q.group():
1996 with q.indent(2):
1997 q.breakable()
1998 q.text("xid = ");
1999 if self.xid != None:
2000 q.text("%#x" % self.xid)
2001 else:
2002 q.text('None')
2003 q.text(","); q.breakable()
2004 q.text("hybrid_enable = ");
2005 q.text("%#x" % self.hybrid_enable)
2006 q.text(","); q.breakable()
2007 q.text("hybrid_version = ");
2008 q.text("%#x" % self.hybrid_version)
2009 q.breakable()
2010 q.text('}')
2011
Rich Lane7dcdf022013-12-11 14:45:27 -08002012bsn_header.subtypes[28] = bsn_hybrid_get_reply
2013
2014class bsn_hybrid_get_request(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07002015 version = 1
2016 type = 4
2017 experimenter = 6035143
2018 subtype = 27
2019
2020 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002021 if xid != None:
2022 self.xid = xid
2023 else:
2024 self.xid = None
2025 return
Rich Lane6f4978c2013-10-20 21:33:52 -07002026
2027 def pack(self):
2028 packed = []
2029 packed.append(struct.pack("!B", self.version))
2030 packed.append(struct.pack("!B", self.type))
2031 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2032 packed.append(struct.pack("!L", self.xid))
2033 packed.append(struct.pack("!L", self.experimenter))
2034 packed.append(struct.pack("!L", self.subtype))
2035 length = sum([len(x) for x in packed])
2036 packed[2] = struct.pack("!H", length)
2037 return ''.join(packed)
2038
2039 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002040 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07002041 obj = bsn_hybrid_get_request()
Rich Lane6f4978c2013-10-20 21:33:52 -07002042 _version = reader.read("!B")[0]
2043 assert(_version == 1)
2044 _type = reader.read("!B")[0]
2045 assert(_type == 4)
2046 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002047 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002048 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -07002049 obj.xid = reader.read("!L")[0]
2050 _experimenter = reader.read("!L")[0]
2051 assert(_experimenter == 6035143)
2052 _subtype = reader.read("!L")[0]
2053 assert(_subtype == 27)
2054 return obj
2055
2056 def __eq__(self, other):
2057 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07002058 if self.xid != other.xid: return False
2059 return True
2060
Rich Lane6f4978c2013-10-20 21:33:52 -07002061 def pretty_print(self, q):
2062 q.text("bsn_hybrid_get_request {")
2063 with q.group():
2064 with q.indent(2):
2065 q.breakable()
2066 q.text("xid = ");
2067 if self.xid != None:
2068 q.text("%#x" % self.xid)
2069 else:
2070 q.text('None')
2071 q.breakable()
2072 q.text('}')
2073
Rich Lane7dcdf022013-12-11 14:45:27 -08002074bsn_header.subtypes[27] = bsn_hybrid_get_request
2075
2076class bsn_pdu_rx_reply(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07002077 version = 1
2078 type = 4
2079 experimenter = 6035143
2080 subtype = 34
2081
Rich Lane7b0f2012013-11-22 14:15:26 -08002082 def __init__(self, xid=None, status=None, port_no=None, slot_num=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002083 if xid != None:
2084 self.xid = xid
2085 else:
2086 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07002087 if status != None:
2088 self.status = status
2089 else:
2090 self.status = 0
Rich Lane7b0f2012013-11-22 14:15:26 -08002091 if port_no != None:
2092 self.port_no = port_no
2093 else:
2094 self.port_no = 0
2095 if slot_num != None:
2096 self.slot_num = slot_num
2097 else:
2098 self.slot_num = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08002099 return
Rich Lane6f4978c2013-10-20 21:33:52 -07002100
2101 def pack(self):
2102 packed = []
2103 packed.append(struct.pack("!B", self.version))
2104 packed.append(struct.pack("!B", self.type))
2105 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2106 packed.append(struct.pack("!L", self.xid))
2107 packed.append(struct.pack("!L", self.experimenter))
2108 packed.append(struct.pack("!L", self.subtype))
2109 packed.append(struct.pack("!L", self.status))
Rich Lane7b0f2012013-11-22 14:15:26 -08002110 packed.append(util.pack_port_no(self.port_no))
2111 packed.append(struct.pack("!B", self.slot_num))
Rich Lane6f4978c2013-10-20 21:33:52 -07002112 length = sum([len(x) for x in packed])
2113 packed[2] = struct.pack("!H", length)
2114 return ''.join(packed)
2115
2116 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002117 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07002118 obj = bsn_pdu_rx_reply()
Rich Lane6f4978c2013-10-20 21:33:52 -07002119 _version = reader.read("!B")[0]
2120 assert(_version == 1)
2121 _type = reader.read("!B")[0]
2122 assert(_type == 4)
2123 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002124 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002125 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -07002126 obj.xid = reader.read("!L")[0]
2127 _experimenter = reader.read("!L")[0]
2128 assert(_experimenter == 6035143)
2129 _subtype = reader.read("!L")[0]
2130 assert(_subtype == 34)
2131 obj.status = reader.read("!L")[0]
Rich Lane7b0f2012013-11-22 14:15:26 -08002132 obj.port_no = util.unpack_port_no(reader)
2133 obj.slot_num = reader.read("!B")[0]
Rich Lane6f4978c2013-10-20 21:33:52 -07002134 return obj
2135
2136 def __eq__(self, other):
2137 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07002138 if self.xid != other.xid: return False
2139 if self.status != other.status: return False
Rich Lane7b0f2012013-11-22 14:15:26 -08002140 if self.port_no != other.port_no: return False
2141 if self.slot_num != other.slot_num: return False
Rich Lane6f4978c2013-10-20 21:33:52 -07002142 return True
2143
Rich Lane6f4978c2013-10-20 21:33:52 -07002144 def pretty_print(self, q):
2145 q.text("bsn_pdu_rx_reply {")
2146 with q.group():
2147 with q.indent(2):
2148 q.breakable()
2149 q.text("xid = ");
2150 if self.xid != None:
2151 q.text("%#x" % self.xid)
2152 else:
2153 q.text('None')
2154 q.text(","); q.breakable()
2155 q.text("status = ");
2156 q.text("%#x" % self.status)
Rich Lane7b0f2012013-11-22 14:15:26 -08002157 q.text(","); q.breakable()
2158 q.text("port_no = ");
2159 q.text(util.pretty_port(self.port_no))
2160 q.text(","); q.breakable()
2161 q.text("slot_num = ");
2162 q.text("%#x" % self.slot_num)
Rich Lane6f4978c2013-10-20 21:33:52 -07002163 q.breakable()
2164 q.text('}')
2165
Rich Lane7dcdf022013-12-11 14:45:27 -08002166bsn_header.subtypes[34] = bsn_pdu_rx_reply
2167
2168class bsn_pdu_rx_request(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07002169 version = 1
2170 type = 4
2171 experimenter = 6035143
2172 subtype = 33
2173
2174 def __init__(self, xid=None, timeout_ms=None, port_no=None, slot_num=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002175 if xid != None:
2176 self.xid = xid
2177 else:
2178 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07002179 if timeout_ms != None:
2180 self.timeout_ms = timeout_ms
2181 else:
2182 self.timeout_ms = 0
2183 if port_no != None:
2184 self.port_no = port_no
2185 else:
2186 self.port_no = 0
2187 if slot_num != None:
2188 self.slot_num = slot_num
2189 else:
2190 self.slot_num = 0
2191 if data != None:
2192 self.data = data
2193 else:
2194 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08002195 return
Rich Lane6f4978c2013-10-20 21:33:52 -07002196
2197 def pack(self):
2198 packed = []
2199 packed.append(struct.pack("!B", self.version))
2200 packed.append(struct.pack("!B", self.type))
2201 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2202 packed.append(struct.pack("!L", self.xid))
2203 packed.append(struct.pack("!L", self.experimenter))
2204 packed.append(struct.pack("!L", self.subtype))
2205 packed.append(struct.pack("!L", self.timeout_ms))
2206 packed.append(util.pack_port_no(self.port_no))
2207 packed.append(struct.pack("!B", self.slot_num))
2208 packed.append('\x00' * 3)
2209 packed.append(self.data)
2210 length = sum([len(x) for x in packed])
2211 packed[2] = struct.pack("!H", length)
2212 return ''.join(packed)
2213
2214 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002215 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07002216 obj = bsn_pdu_rx_request()
Rich Lane6f4978c2013-10-20 21:33:52 -07002217 _version = reader.read("!B")[0]
2218 assert(_version == 1)
2219 _type = reader.read("!B")[0]
2220 assert(_type == 4)
2221 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002222 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002223 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -07002224 obj.xid = reader.read("!L")[0]
2225 _experimenter = reader.read("!L")[0]
2226 assert(_experimenter == 6035143)
2227 _subtype = reader.read("!L")[0]
2228 assert(_subtype == 33)
2229 obj.timeout_ms = reader.read("!L")[0]
2230 obj.port_no = util.unpack_port_no(reader)
2231 obj.slot_num = reader.read("!B")[0]
2232 reader.skip(3)
2233 obj.data = str(reader.read_all())
2234 return obj
2235
2236 def __eq__(self, other):
2237 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07002238 if self.xid != other.xid: return False
2239 if self.timeout_ms != other.timeout_ms: return False
2240 if self.port_no != other.port_no: return False
2241 if self.slot_num != other.slot_num: return False
2242 if self.data != other.data: return False
2243 return True
2244
Rich Lane6f4978c2013-10-20 21:33:52 -07002245 def pretty_print(self, q):
2246 q.text("bsn_pdu_rx_request {")
2247 with q.group():
2248 with q.indent(2):
2249 q.breakable()
2250 q.text("xid = ");
2251 if self.xid != None:
2252 q.text("%#x" % self.xid)
2253 else:
2254 q.text('None')
2255 q.text(","); q.breakable()
2256 q.text("timeout_ms = ");
2257 q.text("%#x" % self.timeout_ms)
2258 q.text(","); q.breakable()
2259 q.text("port_no = ");
2260 q.text(util.pretty_port(self.port_no))
2261 q.text(","); q.breakable()
2262 q.text("slot_num = ");
2263 q.text("%#x" % self.slot_num)
2264 q.text(","); q.breakable()
2265 q.text("data = ");
2266 q.pp(self.data)
2267 q.breakable()
2268 q.text('}')
2269
Rich Lane7dcdf022013-12-11 14:45:27 -08002270bsn_header.subtypes[33] = bsn_pdu_rx_request
2271
2272class bsn_pdu_rx_timeout(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07002273 version = 1
2274 type = 4
2275 experimenter = 6035143
2276 subtype = 35
2277
2278 def __init__(self, xid=None, port_no=None, slot_num=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002279 if xid != None:
2280 self.xid = xid
2281 else:
2282 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07002283 if port_no != None:
2284 self.port_no = port_no
2285 else:
2286 self.port_no = 0
2287 if slot_num != None:
2288 self.slot_num = slot_num
2289 else:
2290 self.slot_num = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08002291 return
Rich Lane6f4978c2013-10-20 21:33:52 -07002292
2293 def pack(self):
2294 packed = []
2295 packed.append(struct.pack("!B", self.version))
2296 packed.append(struct.pack("!B", self.type))
2297 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2298 packed.append(struct.pack("!L", self.xid))
2299 packed.append(struct.pack("!L", self.experimenter))
2300 packed.append(struct.pack("!L", self.subtype))
2301 packed.append(util.pack_port_no(self.port_no))
2302 packed.append(struct.pack("!B", self.slot_num))
2303 length = sum([len(x) for x in packed])
2304 packed[2] = struct.pack("!H", length)
2305 return ''.join(packed)
2306
2307 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002308 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07002309 obj = bsn_pdu_rx_timeout()
Rich Lane6f4978c2013-10-20 21:33:52 -07002310 _version = reader.read("!B")[0]
2311 assert(_version == 1)
2312 _type = reader.read("!B")[0]
2313 assert(_type == 4)
2314 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002315 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002316 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -07002317 obj.xid = reader.read("!L")[0]
2318 _experimenter = reader.read("!L")[0]
2319 assert(_experimenter == 6035143)
2320 _subtype = reader.read("!L")[0]
2321 assert(_subtype == 35)
2322 obj.port_no = util.unpack_port_no(reader)
2323 obj.slot_num = reader.read("!B")[0]
2324 return obj
2325
2326 def __eq__(self, other):
2327 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07002328 if self.xid != other.xid: return False
2329 if self.port_no != other.port_no: return False
2330 if self.slot_num != other.slot_num: return False
2331 return True
2332
Rich Lane6f4978c2013-10-20 21:33:52 -07002333 def pretty_print(self, q):
2334 q.text("bsn_pdu_rx_timeout {")
2335 with q.group():
2336 with q.indent(2):
2337 q.breakable()
2338 q.text("xid = ");
2339 if self.xid != None:
2340 q.text("%#x" % self.xid)
2341 else:
2342 q.text('None')
2343 q.text(","); q.breakable()
2344 q.text("port_no = ");
2345 q.text(util.pretty_port(self.port_no))
2346 q.text(","); q.breakable()
2347 q.text("slot_num = ");
2348 q.text("%#x" % self.slot_num)
2349 q.breakable()
2350 q.text('}')
2351
Rich Lane7dcdf022013-12-11 14:45:27 -08002352bsn_header.subtypes[35] = bsn_pdu_rx_timeout
2353
2354class bsn_pdu_tx_reply(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07002355 version = 1
2356 type = 4
2357 experimenter = 6035143
2358 subtype = 32
2359
Rich Lane7b0f2012013-11-22 14:15:26 -08002360 def __init__(self, xid=None, status=None, port_no=None, slot_num=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002361 if xid != None:
2362 self.xid = xid
2363 else:
2364 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07002365 if status != None:
2366 self.status = status
2367 else:
2368 self.status = 0
Rich Lane7b0f2012013-11-22 14:15:26 -08002369 if port_no != None:
2370 self.port_no = port_no
2371 else:
2372 self.port_no = 0
2373 if slot_num != None:
2374 self.slot_num = slot_num
2375 else:
2376 self.slot_num = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08002377 return
Rich Lane6f4978c2013-10-20 21:33:52 -07002378
2379 def pack(self):
2380 packed = []
2381 packed.append(struct.pack("!B", self.version))
2382 packed.append(struct.pack("!B", self.type))
2383 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2384 packed.append(struct.pack("!L", self.xid))
2385 packed.append(struct.pack("!L", self.experimenter))
2386 packed.append(struct.pack("!L", self.subtype))
2387 packed.append(struct.pack("!L", self.status))
Rich Lane7b0f2012013-11-22 14:15:26 -08002388 packed.append(util.pack_port_no(self.port_no))
2389 packed.append(struct.pack("!B", self.slot_num))
Rich Lane6f4978c2013-10-20 21:33:52 -07002390 length = sum([len(x) for x in packed])
2391 packed[2] = struct.pack("!H", length)
2392 return ''.join(packed)
2393
2394 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002395 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07002396 obj = bsn_pdu_tx_reply()
Rich Lane6f4978c2013-10-20 21:33:52 -07002397 _version = reader.read("!B")[0]
2398 assert(_version == 1)
2399 _type = reader.read("!B")[0]
2400 assert(_type == 4)
2401 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002402 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002403 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -07002404 obj.xid = reader.read("!L")[0]
2405 _experimenter = reader.read("!L")[0]
2406 assert(_experimenter == 6035143)
2407 _subtype = reader.read("!L")[0]
2408 assert(_subtype == 32)
2409 obj.status = reader.read("!L")[0]
Rich Lane7b0f2012013-11-22 14:15:26 -08002410 obj.port_no = util.unpack_port_no(reader)
2411 obj.slot_num = reader.read("!B")[0]
Rich Lane6f4978c2013-10-20 21:33:52 -07002412 return obj
2413
2414 def __eq__(self, other):
2415 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07002416 if self.xid != other.xid: return False
2417 if self.status != other.status: return False
Rich Lane7b0f2012013-11-22 14:15:26 -08002418 if self.port_no != other.port_no: return False
2419 if self.slot_num != other.slot_num: return False
Rich Lane6f4978c2013-10-20 21:33:52 -07002420 return True
2421
Rich Lane6f4978c2013-10-20 21:33:52 -07002422 def pretty_print(self, q):
2423 q.text("bsn_pdu_tx_reply {")
2424 with q.group():
2425 with q.indent(2):
2426 q.breakable()
2427 q.text("xid = ");
2428 if self.xid != None:
2429 q.text("%#x" % self.xid)
2430 else:
2431 q.text('None')
2432 q.text(","); q.breakable()
2433 q.text("status = ");
2434 q.text("%#x" % self.status)
Rich Lane7b0f2012013-11-22 14:15:26 -08002435 q.text(","); q.breakable()
2436 q.text("port_no = ");
2437 q.text(util.pretty_port(self.port_no))
2438 q.text(","); q.breakable()
2439 q.text("slot_num = ");
2440 q.text("%#x" % self.slot_num)
Rich Lane6f4978c2013-10-20 21:33:52 -07002441 q.breakable()
2442 q.text('}')
2443
Rich Lane7dcdf022013-12-11 14:45:27 -08002444bsn_header.subtypes[32] = bsn_pdu_tx_reply
2445
2446class bsn_pdu_tx_request(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07002447 version = 1
2448 type = 4
2449 experimenter = 6035143
2450 subtype = 31
2451
2452 def __init__(self, xid=None, tx_interval_ms=None, port_no=None, slot_num=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002453 if xid != None:
2454 self.xid = xid
2455 else:
2456 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07002457 if tx_interval_ms != None:
2458 self.tx_interval_ms = tx_interval_ms
2459 else:
2460 self.tx_interval_ms = 0
2461 if port_no != None:
2462 self.port_no = port_no
2463 else:
2464 self.port_no = 0
2465 if slot_num != None:
2466 self.slot_num = slot_num
2467 else:
2468 self.slot_num = 0
2469 if data != None:
2470 self.data = data
2471 else:
2472 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08002473 return
Rich Lane6f4978c2013-10-20 21:33:52 -07002474
2475 def pack(self):
2476 packed = []
2477 packed.append(struct.pack("!B", self.version))
2478 packed.append(struct.pack("!B", self.type))
2479 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2480 packed.append(struct.pack("!L", self.xid))
2481 packed.append(struct.pack("!L", self.experimenter))
2482 packed.append(struct.pack("!L", self.subtype))
2483 packed.append(struct.pack("!L", self.tx_interval_ms))
2484 packed.append(util.pack_port_no(self.port_no))
2485 packed.append(struct.pack("!B", self.slot_num))
2486 packed.append('\x00' * 3)
2487 packed.append(self.data)
2488 length = sum([len(x) for x in packed])
2489 packed[2] = struct.pack("!H", length)
2490 return ''.join(packed)
2491
2492 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002493 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07002494 obj = bsn_pdu_tx_request()
Rich Lane6f4978c2013-10-20 21:33:52 -07002495 _version = reader.read("!B")[0]
2496 assert(_version == 1)
2497 _type = reader.read("!B")[0]
2498 assert(_type == 4)
2499 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002500 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002501 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -07002502 obj.xid = reader.read("!L")[0]
2503 _experimenter = reader.read("!L")[0]
2504 assert(_experimenter == 6035143)
2505 _subtype = reader.read("!L")[0]
2506 assert(_subtype == 31)
2507 obj.tx_interval_ms = reader.read("!L")[0]
2508 obj.port_no = util.unpack_port_no(reader)
2509 obj.slot_num = reader.read("!B")[0]
2510 reader.skip(3)
2511 obj.data = str(reader.read_all())
2512 return obj
2513
2514 def __eq__(self, other):
2515 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07002516 if self.xid != other.xid: return False
2517 if self.tx_interval_ms != other.tx_interval_ms: return False
2518 if self.port_no != other.port_no: return False
2519 if self.slot_num != other.slot_num: return False
2520 if self.data != other.data: return False
2521 return True
2522
Rich Lane6f4978c2013-10-20 21:33:52 -07002523 def pretty_print(self, q):
2524 q.text("bsn_pdu_tx_request {")
2525 with q.group():
2526 with q.indent(2):
2527 q.breakable()
2528 q.text("xid = ");
2529 if self.xid != None:
2530 q.text("%#x" % self.xid)
2531 else:
2532 q.text('None')
2533 q.text(","); q.breakable()
2534 q.text("tx_interval_ms = ");
2535 q.text("%#x" % self.tx_interval_ms)
2536 q.text(","); q.breakable()
2537 q.text("port_no = ");
2538 q.text(util.pretty_port(self.port_no))
2539 q.text(","); q.breakable()
2540 q.text("slot_num = ");
2541 q.text("%#x" % self.slot_num)
2542 q.text(","); q.breakable()
2543 q.text("data = ");
2544 q.pp(self.data)
2545 q.breakable()
2546 q.text('}')
2547
Rich Lane7dcdf022013-12-11 14:45:27 -08002548bsn_header.subtypes[31] = bsn_pdu_tx_request
2549
2550class bsn_set_ip_mask(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07002551 version = 1
2552 type = 4
2553 experimenter = 6035143
Rich Laneb658ddd2013-03-12 10:15:10 -07002554 subtype = 0
2555
Rich Lanec2ee4b82013-04-24 17:12:38 -07002556 def __init__(self, xid=None, index=None, mask=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002557 if xid != None:
2558 self.xid = xid
2559 else:
2560 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07002561 if index != None:
2562 self.index = index
2563 else:
2564 self.index = 0
Rich Laneb658ddd2013-03-12 10:15:10 -07002565 if mask != None:
2566 self.mask = mask
2567 else:
2568 self.mask = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08002569 return
Rich Laneb658ddd2013-03-12 10:15:10 -07002570
2571 def pack(self):
2572 packed = []
2573 packed.append(struct.pack("!B", self.version))
2574 packed.append(struct.pack("!B", self.type))
2575 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2576 packed.append(struct.pack("!L", self.xid))
2577 packed.append(struct.pack("!L", self.experimenter))
2578 packed.append(struct.pack("!L", self.subtype))
2579 packed.append(struct.pack("!B", self.index))
Rich Lanec2ee4b82013-04-24 17:12:38 -07002580 packed.append('\x00' * 3)
Rich Laneb658ddd2013-03-12 10:15:10 -07002581 packed.append(struct.pack("!L", self.mask))
2582 length = sum([len(x) for x in packed])
2583 packed[2] = struct.pack("!H", length)
2584 return ''.join(packed)
2585
2586 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002587 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07002588 obj = bsn_set_ip_mask()
Dan Talaycof6202252013-07-02 01:00:29 -07002589 _version = reader.read("!B")[0]
2590 assert(_version == 1)
2591 _type = reader.read("!B")[0]
2592 assert(_type == 4)
2593 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002594 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002595 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07002596 obj.xid = reader.read("!L")[0]
2597 _experimenter = reader.read("!L")[0]
2598 assert(_experimenter == 6035143)
2599 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07002600 assert(_subtype == 0)
Dan Talaycof6202252013-07-02 01:00:29 -07002601 obj.index = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07002602 reader.skip(3)
Dan Talaycof6202252013-07-02 01:00:29 -07002603 obj.mask = reader.read("!L")[0]
Rich Laneb658ddd2013-03-12 10:15:10 -07002604 return obj
2605
2606 def __eq__(self, other):
2607 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07002608 if self.xid != other.xid: return False
2609 if self.index != other.index: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07002610 if self.mask != other.mask: return False
2611 return True
2612
Rich Laneb658ddd2013-03-12 10:15:10 -07002613 def pretty_print(self, q):
2614 q.text("bsn_set_ip_mask {")
2615 with q.group():
2616 with q.indent(2):
2617 q.breakable()
2618 q.text("xid = ");
2619 if self.xid != None:
2620 q.text("%#x" % self.xid)
2621 else:
2622 q.text('None')
2623 q.text(","); q.breakable()
2624 q.text("index = ");
2625 q.text("%#x" % self.index)
2626 q.text(","); q.breakable()
Rich Laneb658ddd2013-03-12 10:15:10 -07002627 q.text("mask = ");
2628 q.text("%#x" % self.mask)
2629 q.breakable()
2630 q.text('}')
2631
Rich Lane7dcdf022013-12-11 14:45:27 -08002632bsn_header.subtypes[0] = bsn_set_ip_mask
2633
2634class bsn_set_l2_table_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07002635 version = 1
2636 type = 4
2637 experimenter = 6035143
2638 subtype = 24
2639
2640 def __init__(self, xid=None, l2_table_enable=None, l2_table_priority=None, status=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002641 if xid != None:
2642 self.xid = xid
2643 else:
2644 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07002645 if l2_table_enable != None:
2646 self.l2_table_enable = l2_table_enable
2647 else:
2648 self.l2_table_enable = 0
2649 if l2_table_priority != None:
2650 self.l2_table_priority = l2_table_priority
2651 else:
2652 self.l2_table_priority = 0
2653 if status != None:
2654 self.status = status
2655 else:
2656 self.status = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08002657 return
Dan Talaycof6202252013-07-02 01:00:29 -07002658
2659 def pack(self):
2660 packed = []
2661 packed.append(struct.pack("!B", self.version))
2662 packed.append(struct.pack("!B", self.type))
2663 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2664 packed.append(struct.pack("!L", self.xid))
2665 packed.append(struct.pack("!L", self.experimenter))
2666 packed.append(struct.pack("!L", self.subtype))
2667 packed.append(struct.pack("!B", self.l2_table_enable))
2668 packed.append('\x00' * 1)
2669 packed.append(struct.pack("!H", self.l2_table_priority))
2670 packed.append(struct.pack("!L", self.status))
2671 length = sum([len(x) for x in packed])
2672 packed[2] = struct.pack("!H", length)
2673 return ''.join(packed)
2674
2675 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002676 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07002677 obj = bsn_set_l2_table_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07002678 _version = reader.read("!B")[0]
2679 assert(_version == 1)
2680 _type = reader.read("!B")[0]
2681 assert(_type == 4)
2682 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002683 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002684 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07002685 obj.xid = reader.read("!L")[0]
2686 _experimenter = reader.read("!L")[0]
2687 assert(_experimenter == 6035143)
2688 _subtype = reader.read("!L")[0]
2689 assert(_subtype == 24)
2690 obj.l2_table_enable = reader.read("!B")[0]
2691 reader.skip(1)
2692 obj.l2_table_priority = reader.read("!H")[0]
2693 obj.status = reader.read("!L")[0]
2694 return obj
2695
2696 def __eq__(self, other):
2697 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07002698 if self.xid != other.xid: return False
2699 if self.l2_table_enable != other.l2_table_enable: return False
2700 if self.l2_table_priority != other.l2_table_priority: return False
2701 if self.status != other.status: return False
2702 return True
2703
Dan Talaycof6202252013-07-02 01:00:29 -07002704 def pretty_print(self, q):
2705 q.text("bsn_set_l2_table_reply {")
2706 with q.group():
2707 with q.indent(2):
2708 q.breakable()
2709 q.text("xid = ");
2710 if self.xid != None:
2711 q.text("%#x" % self.xid)
2712 else:
2713 q.text('None')
2714 q.text(","); q.breakable()
2715 q.text("l2_table_enable = ");
2716 q.text("%#x" % self.l2_table_enable)
2717 q.text(","); q.breakable()
2718 q.text("l2_table_priority = ");
2719 q.text("%#x" % self.l2_table_priority)
2720 q.text(","); q.breakable()
2721 q.text("status = ");
2722 q.text("%#x" % self.status)
2723 q.breakable()
2724 q.text('}')
2725
Rich Lane7dcdf022013-12-11 14:45:27 -08002726bsn_header.subtypes[24] = bsn_set_l2_table_reply
2727
2728class bsn_set_l2_table_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07002729 version = 1
2730 type = 4
2731 experimenter = 6035143
Rich Lane90c961c2013-05-14 09:26:50 -07002732 subtype = 12
2733
2734 def __init__(self, xid=None, l2_table_enable=None, l2_table_priority=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002735 if xid != None:
2736 self.xid = xid
2737 else:
2738 self.xid = None
Rich Lane90c961c2013-05-14 09:26:50 -07002739 if l2_table_enable != None:
2740 self.l2_table_enable = l2_table_enable
2741 else:
2742 self.l2_table_enable = 0
2743 if l2_table_priority != None:
2744 self.l2_table_priority = l2_table_priority
2745 else:
2746 self.l2_table_priority = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08002747 return
Rich Lane90c961c2013-05-14 09:26:50 -07002748
2749 def pack(self):
2750 packed = []
2751 packed.append(struct.pack("!B", self.version))
2752 packed.append(struct.pack("!B", self.type))
2753 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2754 packed.append(struct.pack("!L", self.xid))
2755 packed.append(struct.pack("!L", self.experimenter))
2756 packed.append(struct.pack("!L", self.subtype))
2757 packed.append(struct.pack("!B", self.l2_table_enable))
2758 packed.append('\x00' * 1)
2759 packed.append(struct.pack("!H", self.l2_table_priority))
2760 packed.append('\x00' * 4)
2761 length = sum([len(x) for x in packed])
2762 packed[2] = struct.pack("!H", length)
2763 return ''.join(packed)
2764
2765 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002766 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07002767 obj = bsn_set_l2_table_request()
Dan Talaycof6202252013-07-02 01:00:29 -07002768 _version = reader.read("!B")[0]
2769 assert(_version == 1)
2770 _type = reader.read("!B")[0]
2771 assert(_type == 4)
2772 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002773 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002774 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07002775 obj.xid = reader.read("!L")[0]
2776 _experimenter = reader.read("!L")[0]
2777 assert(_experimenter == 6035143)
2778 _subtype = reader.read("!L")[0]
Rich Lane90c961c2013-05-14 09:26:50 -07002779 assert(_subtype == 12)
Dan Talaycof6202252013-07-02 01:00:29 -07002780 obj.l2_table_enable = reader.read("!B")[0]
Rich Lane90c961c2013-05-14 09:26:50 -07002781 reader.skip(1)
Dan Talaycof6202252013-07-02 01:00:29 -07002782 obj.l2_table_priority = reader.read("!H")[0]
Rich Lane90c961c2013-05-14 09:26:50 -07002783 reader.skip(4)
2784 return obj
2785
2786 def __eq__(self, other):
2787 if type(self) != type(other): return False
Rich Lane90c961c2013-05-14 09:26:50 -07002788 if self.xid != other.xid: return False
2789 if self.l2_table_enable != other.l2_table_enable: return False
2790 if self.l2_table_priority != other.l2_table_priority: return False
2791 return True
2792
Rich Lane90c961c2013-05-14 09:26:50 -07002793 def pretty_print(self, q):
Dan Talaycof6202252013-07-02 01:00:29 -07002794 q.text("bsn_set_l2_table_request {")
Rich Lane90c961c2013-05-14 09:26:50 -07002795 with q.group():
2796 with q.indent(2):
2797 q.breakable()
2798 q.text("xid = ");
2799 if self.xid != None:
2800 q.text("%#x" % self.xid)
2801 else:
2802 q.text('None')
2803 q.text(","); q.breakable()
2804 q.text("l2_table_enable = ");
2805 q.text("%#x" % self.l2_table_enable)
2806 q.text(","); q.breakable()
2807 q.text("l2_table_priority = ");
2808 q.text("%#x" % self.l2_table_priority)
2809 q.breakable()
2810 q.text('}')
2811
Rich Lane7dcdf022013-12-11 14:45:27 -08002812bsn_header.subtypes[12] = bsn_set_l2_table_request
2813
2814class bsn_set_mirroring(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07002815 version = 1
2816 type = 4
2817 experimenter = 6035143
Rich Laneb658ddd2013-03-12 10:15:10 -07002818 subtype = 3
2819
Rich Lanec2ee4b82013-04-24 17:12:38 -07002820 def __init__(self, xid=None, report_mirror_ports=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002821 if xid != None:
2822 self.xid = xid
2823 else:
2824 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07002825 if report_mirror_ports != None:
2826 self.report_mirror_ports = report_mirror_ports
2827 else:
2828 self.report_mirror_ports = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08002829 return
Rich Laneb658ddd2013-03-12 10:15:10 -07002830
2831 def pack(self):
2832 packed = []
2833 packed.append(struct.pack("!B", self.version))
2834 packed.append(struct.pack("!B", self.type))
2835 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2836 packed.append(struct.pack("!L", self.xid))
2837 packed.append(struct.pack("!L", self.experimenter))
2838 packed.append(struct.pack("!L", self.subtype))
2839 packed.append(struct.pack("!B", self.report_mirror_ports))
Rich Lanec2ee4b82013-04-24 17:12:38 -07002840 packed.append('\x00' * 3)
Rich Laneb658ddd2013-03-12 10:15:10 -07002841 length = sum([len(x) for x in packed])
2842 packed[2] = struct.pack("!H", length)
2843 return ''.join(packed)
2844
2845 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002846 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07002847 obj = bsn_set_mirroring()
Dan Talaycof6202252013-07-02 01:00:29 -07002848 _version = reader.read("!B")[0]
2849 assert(_version == 1)
2850 _type = reader.read("!B")[0]
2851 assert(_type == 4)
2852 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002853 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002854 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07002855 obj.xid = reader.read("!L")[0]
2856 _experimenter = reader.read("!L")[0]
2857 assert(_experimenter == 6035143)
2858 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07002859 assert(_subtype == 3)
Dan Talaycof6202252013-07-02 01:00:29 -07002860 obj.report_mirror_ports = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07002861 reader.skip(3)
Rich Laneb658ddd2013-03-12 10:15:10 -07002862 return obj
2863
2864 def __eq__(self, other):
2865 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07002866 if self.xid != other.xid: return False
2867 if self.report_mirror_ports != other.report_mirror_ports: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07002868 return True
2869
Rich Laneb658ddd2013-03-12 10:15:10 -07002870 def pretty_print(self, q):
2871 q.text("bsn_set_mirroring {")
2872 with q.group():
2873 with q.indent(2):
2874 q.breakable()
2875 q.text("xid = ");
2876 if self.xid != None:
2877 q.text("%#x" % self.xid)
2878 else:
2879 q.text('None')
2880 q.text(","); q.breakable()
2881 q.text("report_mirror_ports = ");
2882 q.text("%#x" % self.report_mirror_ports)
Rich Lanec2ee4b82013-04-24 17:12:38 -07002883 q.breakable()
2884 q.text('}')
2885
Rich Lane7dcdf022013-12-11 14:45:27 -08002886bsn_header.subtypes[3] = bsn_set_mirroring
2887
2888class bsn_set_pktin_suppression_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07002889 version = 1
2890 type = 4
2891 experimenter = 6035143
2892 subtype = 25
2893
2894 def __init__(self, xid=None, status=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002895 if xid != None:
2896 self.xid = xid
2897 else:
2898 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07002899 if status != None:
2900 self.status = status
2901 else:
2902 self.status = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08002903 return
Dan Talaycof6202252013-07-02 01:00:29 -07002904
2905 def pack(self):
2906 packed = []
2907 packed.append(struct.pack("!B", self.version))
2908 packed.append(struct.pack("!B", self.type))
2909 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2910 packed.append(struct.pack("!L", self.xid))
2911 packed.append(struct.pack("!L", self.experimenter))
2912 packed.append(struct.pack("!L", self.subtype))
2913 packed.append(struct.pack("!L", self.status))
2914 length = sum([len(x) for x in packed])
2915 packed[2] = struct.pack("!H", length)
2916 return ''.join(packed)
2917
2918 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002919 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07002920 obj = bsn_set_pktin_suppression_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07002921 _version = reader.read("!B")[0]
2922 assert(_version == 1)
2923 _type = reader.read("!B")[0]
2924 assert(_type == 4)
2925 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002926 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002927 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07002928 obj.xid = reader.read("!L")[0]
2929 _experimenter = reader.read("!L")[0]
2930 assert(_experimenter == 6035143)
2931 _subtype = reader.read("!L")[0]
2932 assert(_subtype == 25)
2933 obj.status = reader.read("!L")[0]
2934 return obj
2935
2936 def __eq__(self, other):
2937 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07002938 if self.xid != other.xid: return False
2939 if self.status != other.status: return False
2940 return True
2941
Dan Talaycof6202252013-07-02 01:00:29 -07002942 def pretty_print(self, q):
2943 q.text("bsn_set_pktin_suppression_reply {")
2944 with q.group():
2945 with q.indent(2):
2946 q.breakable()
2947 q.text("xid = ");
2948 if self.xid != None:
2949 q.text("%#x" % self.xid)
2950 else:
2951 q.text('None')
2952 q.text(","); q.breakable()
2953 q.text("status = ");
2954 q.text("%#x" % self.status)
2955 q.breakable()
2956 q.text('}')
2957
Rich Lane7dcdf022013-12-11 14:45:27 -08002958bsn_header.subtypes[25] = bsn_set_pktin_suppression_reply
2959
2960class bsn_set_pktin_suppression_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07002961 version = 1
2962 type = 4
2963 experimenter = 6035143
Rich Lanec2ee4b82013-04-24 17:12:38 -07002964 subtype = 11
2965
2966 def __init__(self, xid=None, enabled=None, idle_timeout=None, hard_timeout=None, priority=None, cookie=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002967 if xid != None:
2968 self.xid = xid
2969 else:
2970 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07002971 if enabled != None:
2972 self.enabled = enabled
2973 else:
2974 self.enabled = 0
2975 if idle_timeout != None:
2976 self.idle_timeout = idle_timeout
2977 else:
2978 self.idle_timeout = 0
2979 if hard_timeout != None:
2980 self.hard_timeout = hard_timeout
2981 else:
2982 self.hard_timeout = 0
2983 if priority != None:
2984 self.priority = priority
2985 else:
2986 self.priority = 0
2987 if cookie != None:
2988 self.cookie = cookie
2989 else:
2990 self.cookie = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08002991 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07002992
2993 def pack(self):
2994 packed = []
2995 packed.append(struct.pack("!B", self.version))
2996 packed.append(struct.pack("!B", self.type))
2997 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2998 packed.append(struct.pack("!L", self.xid))
2999 packed.append(struct.pack("!L", self.experimenter))
3000 packed.append(struct.pack("!L", self.subtype))
3001 packed.append(struct.pack("!B", self.enabled))
3002 packed.append('\x00' * 1)
3003 packed.append(struct.pack("!H", self.idle_timeout))
3004 packed.append(struct.pack("!H", self.hard_timeout))
3005 packed.append(struct.pack("!H", self.priority))
3006 packed.append(struct.pack("!Q", self.cookie))
3007 length = sum([len(x) for x in packed])
3008 packed[2] = struct.pack("!H", length)
3009 return ''.join(packed)
3010
3011 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003012 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07003013 obj = bsn_set_pktin_suppression_request()
Dan Talaycof6202252013-07-02 01:00:29 -07003014 _version = reader.read("!B")[0]
3015 assert(_version == 1)
3016 _type = reader.read("!B")[0]
3017 assert(_type == 4)
3018 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003019 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003020 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07003021 obj.xid = reader.read("!L")[0]
3022 _experimenter = reader.read("!L")[0]
3023 assert(_experimenter == 6035143)
3024 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07003025 assert(_subtype == 11)
Dan Talaycof6202252013-07-02 01:00:29 -07003026 obj.enabled = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07003027 reader.skip(1)
Dan Talaycof6202252013-07-02 01:00:29 -07003028 obj.idle_timeout = reader.read("!H")[0]
3029 obj.hard_timeout = reader.read("!H")[0]
3030 obj.priority = reader.read("!H")[0]
3031 obj.cookie = reader.read("!Q")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07003032 return obj
3033
3034 def __eq__(self, other):
3035 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07003036 if self.xid != other.xid: return False
3037 if self.enabled != other.enabled: return False
3038 if self.idle_timeout != other.idle_timeout: return False
3039 if self.hard_timeout != other.hard_timeout: return False
3040 if self.priority != other.priority: return False
3041 if self.cookie != other.cookie: return False
3042 return True
3043
Rich Lanec2ee4b82013-04-24 17:12:38 -07003044 def pretty_print(self, q):
Dan Talaycof6202252013-07-02 01:00:29 -07003045 q.text("bsn_set_pktin_suppression_request {")
Rich Lanec2ee4b82013-04-24 17:12:38 -07003046 with q.group():
3047 with q.indent(2):
3048 q.breakable()
3049 q.text("xid = ");
3050 if self.xid != None:
3051 q.text("%#x" % self.xid)
3052 else:
3053 q.text('None')
Rich Laneb658ddd2013-03-12 10:15:10 -07003054 q.text(","); q.breakable()
Rich Lanec2ee4b82013-04-24 17:12:38 -07003055 q.text("enabled = ");
3056 q.text("%#x" % self.enabled)
3057 q.text(","); q.breakable()
3058 q.text("idle_timeout = ");
3059 q.text("%#x" % self.idle_timeout)
3060 q.text(","); q.breakable()
3061 q.text("hard_timeout = ");
3062 q.text("%#x" % self.hard_timeout)
3063 q.text(","); q.breakable()
3064 q.text("priority = ");
3065 q.text("%#x" % self.priority)
3066 q.text(","); q.breakable()
3067 q.text("cookie = ");
3068 q.text("%#x" % self.cookie)
Rich Laneb658ddd2013-03-12 10:15:10 -07003069 q.breakable()
3070 q.text('}')
3071
Rich Lane7dcdf022013-12-11 14:45:27 -08003072bsn_header.subtypes[11] = bsn_set_pktin_suppression_request
3073
3074class bsn_shell_command(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07003075 version = 1
3076 type = 4
3077 experimenter = 6035143
Rich Laneb658ddd2013-03-12 10:15:10 -07003078 subtype = 6
3079
3080 def __init__(self, xid=None, service=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08003081 if xid != None:
3082 self.xid = xid
3083 else:
3084 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07003085 if service != None:
3086 self.service = service
3087 else:
3088 self.service = 0
3089 if data != None:
3090 self.data = data
3091 else:
Dan Talaycof6202252013-07-02 01:00:29 -07003092 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08003093 return
Rich Laneb658ddd2013-03-12 10:15:10 -07003094
3095 def pack(self):
3096 packed = []
3097 packed.append(struct.pack("!B", self.version))
3098 packed.append(struct.pack("!B", self.type))
3099 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3100 packed.append(struct.pack("!L", self.xid))
3101 packed.append(struct.pack("!L", self.experimenter))
3102 packed.append(struct.pack("!L", self.subtype))
3103 packed.append(struct.pack("!L", self.service))
3104 packed.append(self.data)
3105 length = sum([len(x) for x in packed])
3106 packed[2] = struct.pack("!H", length)
3107 return ''.join(packed)
3108
3109 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003110 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07003111 obj = bsn_shell_command()
Dan Talaycof6202252013-07-02 01:00:29 -07003112 _version = reader.read("!B")[0]
3113 assert(_version == 1)
3114 _type = reader.read("!B")[0]
3115 assert(_type == 4)
3116 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003117 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003118 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07003119 obj.xid = reader.read("!L")[0]
3120 _experimenter = reader.read("!L")[0]
3121 assert(_experimenter == 6035143)
3122 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07003123 assert(_subtype == 6)
Dan Talaycof6202252013-07-02 01:00:29 -07003124 obj.service = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07003125 obj.data = str(reader.read_all())
Rich Laneb658ddd2013-03-12 10:15:10 -07003126 return obj
3127
3128 def __eq__(self, other):
3129 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07003130 if self.xid != other.xid: return False
3131 if self.service != other.service: return False
3132 if self.data != other.data: return False
3133 return True
3134
Rich Laneb658ddd2013-03-12 10:15:10 -07003135 def pretty_print(self, q):
3136 q.text("bsn_shell_command {")
3137 with q.group():
3138 with q.indent(2):
3139 q.breakable()
3140 q.text("xid = ");
3141 if self.xid != None:
3142 q.text("%#x" % self.xid)
3143 else:
3144 q.text('None')
3145 q.text(","); q.breakable()
3146 q.text("service = ");
3147 q.text("%#x" % self.service)
3148 q.text(","); q.breakable()
3149 q.text("data = ");
3150 q.pp(self.data)
3151 q.breakable()
3152 q.text('}')
3153
Rich Lane7dcdf022013-12-11 14:45:27 -08003154bsn_header.subtypes[6] = bsn_shell_command
3155
3156class bsn_shell_output(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07003157 version = 1
3158 type = 4
3159 experimenter = 6035143
Rich Laneb658ddd2013-03-12 10:15:10 -07003160 subtype = 7
3161
3162 def __init__(self, xid=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08003163 if xid != None:
3164 self.xid = xid
3165 else:
3166 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07003167 if data != None:
3168 self.data = data
3169 else:
Dan Talaycof6202252013-07-02 01:00:29 -07003170 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08003171 return
Rich Laneb658ddd2013-03-12 10:15:10 -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(self.data)
3182 length = sum([len(x) for x in packed])
3183 packed[2] = struct.pack("!H", length)
3184 return ''.join(packed)
3185
3186 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003187 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07003188 obj = bsn_shell_output()
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
Rich Lanecb18dbd2014-12-18 10:02:29 -08003195 reader = orig_reader.slice(_length, 4)
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]
Rich Lanec2ee4b82013-04-24 17:12:38 -07003200 assert(_subtype == 7)
3201 obj.data = str(reader.read_all())
Rich Laneb658ddd2013-03-12 10:15:10 -07003202 return obj
3203
3204 def __eq__(self, other):
3205 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07003206 if self.xid != other.xid: return False
3207 if self.data != other.data: return False
3208 return True
3209
Rich Laneb658ddd2013-03-12 10:15:10 -07003210 def pretty_print(self, q):
3211 q.text("bsn_shell_output {")
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("data = ");
3222 q.pp(self.data)
3223 q.breakable()
3224 q.text('}')
3225
Rich Lane7dcdf022013-12-11 14:45:27 -08003226bsn_header.subtypes[7] = bsn_shell_output
3227
3228class bsn_shell_status(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07003229 version = 1
3230 type = 4
3231 experimenter = 6035143
Rich Laneb658ddd2013-03-12 10:15:10 -07003232 subtype = 8
3233
3234 def __init__(self, xid=None, status=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08003235 if xid != None:
3236 self.xid = xid
3237 else:
3238 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07003239 if status != None:
3240 self.status = status
3241 else:
3242 self.status = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08003243 return
Rich Laneb658ddd2013-03-12 10:15:10 -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.status))
3254 length = sum([len(x) for x in packed])
3255 packed[2] = struct.pack("!H", length)
3256 return ''.join(packed)
3257
3258 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003259 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07003260 obj = bsn_shell_status()
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
Rich Lanecb18dbd2014-12-18 10:02:29 -08003267 reader = orig_reader.slice(_length, 4)
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]
Rich Lanec2ee4b82013-04-24 17:12:38 -07003272 assert(_subtype == 8)
Dan Talaycof6202252013-07-02 01:00:29 -07003273 obj.status = reader.read("!L")[0]
Rich Laneb658ddd2013-03-12 10:15:10 -07003274 return obj
3275
3276 def __eq__(self, other):
3277 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07003278 if self.xid != other.xid: return False
3279 if self.status != other.status: return False
3280 return True
3281
Rich Laneb658ddd2013-03-12 10:15:10 -07003282 def pretty_print(self, q):
3283 q.text("bsn_shell_status {")
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("status = ");
3294 q.text("%#x" % self.status)
3295 q.breakable()
3296 q.text('}')
3297
Rich Lane7dcdf022013-12-11 14:45:27 -08003298bsn_header.subtypes[8] = bsn_shell_status
3299
3300class experimenter_stats_reply(stats_reply):
3301 subtypes = {}
3302
Rich Lane95f7fc92014-01-27 17:08:16 -08003303 version = 1
3304 type = 17
3305 stats_type = 65535
3306
3307 def __init__(self, xid=None, flags=None, experimenter=None, data=None):
3308 if xid != None:
3309 self.xid = xid
3310 else:
3311 self.xid = None
3312 if flags != None:
3313 self.flags = flags
3314 else:
3315 self.flags = 0
3316 if experimenter != None:
3317 self.experimenter = experimenter
3318 else:
3319 self.experimenter = 0
3320 if data != None:
3321 self.data = data
3322 else:
3323 self.data = ''
3324 return
3325
3326 def pack(self):
3327 packed = []
3328 packed.append(struct.pack("!B", self.version))
3329 packed.append(struct.pack("!B", self.type))
3330 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3331 packed.append(struct.pack("!L", self.xid))
3332 packed.append(struct.pack("!H", self.stats_type))
3333 packed.append(struct.pack("!H", self.flags))
3334 packed.append(struct.pack("!L", self.experimenter))
3335 packed.append(self.data)
3336 length = sum([len(x) for x in packed])
3337 packed[2] = struct.pack("!H", length)
3338 return ''.join(packed)
3339
Rich Lane7dcdf022013-12-11 14:45:27 -08003340 @staticmethod
3341 def unpack(reader):
3342 subtype, = reader.peek('!L', 12)
Rich Lane95f7fc92014-01-27 17:08:16 -08003343 subclass = experimenter_stats_reply.subtypes.get(subtype)
3344 if subclass:
3345 return subclass.unpack(reader)
3346
3347 obj = experimenter_stats_reply()
3348 _version = reader.read("!B")[0]
3349 assert(_version == 1)
3350 _type = reader.read("!B")[0]
3351 assert(_type == 17)
3352 _length = reader.read("!H")[0]
3353 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003354 reader = orig_reader.slice(_length, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -08003355 obj.xid = reader.read("!L")[0]
3356 _stats_type = reader.read("!H")[0]
3357 assert(_stats_type == 65535)
3358 obj.flags = reader.read("!H")[0]
3359 obj.experimenter = reader.read("!L")[0]
3360 obj.data = str(reader.read_all())
3361 return obj
3362
3363 def __eq__(self, other):
3364 if type(self) != type(other): return False
3365 if self.xid != other.xid: return False
3366 if self.flags != other.flags: return False
3367 if self.experimenter != other.experimenter: return False
3368 if self.data != other.data: return False
3369 return True
3370
3371 def pretty_print(self, q):
3372 q.text("experimenter_stats_reply {")
3373 with q.group():
3374 with q.indent(2):
3375 q.breakable()
3376 q.text("xid = ");
3377 if self.xid != None:
3378 q.text("%#x" % self.xid)
3379 else:
3380 q.text('None')
3381 q.text(","); q.breakable()
3382 q.text("flags = ");
3383 q.text("%#x" % self.flags)
3384 q.text(","); q.breakable()
3385 q.text("data = ");
3386 q.pp(self.data)
3387 q.breakable()
3388 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -08003389
3390stats_reply.subtypes[65535] = experimenter_stats_reply
3391
3392class bsn_stats_reply(experimenter_stats_reply):
3393 subtypes = {}
3394
Rich Lane95f7fc92014-01-27 17:08:16 -08003395 version = 1
3396 type = 19
3397 stats_type = 65535
3398 experimenter = 6035143
3399
3400 def __init__(self, xid=None, flags=None, subtype=None):
3401 if xid != None:
3402 self.xid = xid
3403 else:
3404 self.xid = None
3405 if flags != None:
3406 self.flags = flags
3407 else:
3408 self.flags = 0
3409 if subtype != None:
3410 self.subtype = subtype
3411 else:
3412 self.subtype = 0
3413 return
3414
3415 def pack(self):
3416 packed = []
3417 packed.append(struct.pack("!B", self.version))
3418 packed.append(struct.pack("!B", self.type))
3419 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3420 packed.append(struct.pack("!L", self.xid))
3421 packed.append(struct.pack("!H", self.stats_type))
3422 packed.append(struct.pack("!H", self.flags))
3423 packed.append('\x00' * 4)
3424 packed.append(struct.pack("!L", self.experimenter))
3425 packed.append(struct.pack("!L", self.subtype))
3426 length = sum([len(x) for x in packed])
3427 packed[2] = struct.pack("!H", length)
3428 return ''.join(packed)
3429
Rich Lane7dcdf022013-12-11 14:45:27 -08003430 @staticmethod
3431 def unpack(reader):
3432 subtype, = reader.peek('!L', 20)
Rich Lane95f7fc92014-01-27 17:08:16 -08003433 subclass = bsn_stats_reply.subtypes.get(subtype)
3434 if subclass:
3435 return subclass.unpack(reader)
3436
3437 obj = bsn_stats_reply()
3438 _version = reader.read("!B")[0]
3439 assert(_version == 1)
3440 _type = reader.read("!B")[0]
3441 assert(_type == 19)
3442 _length = reader.read("!H")[0]
3443 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003444 reader = orig_reader.slice(_length, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -08003445 obj.xid = reader.read("!L")[0]
3446 _stats_type = reader.read("!H")[0]
3447 assert(_stats_type == 65535)
3448 obj.flags = reader.read("!H")[0]
3449 reader.skip(4)
3450 _experimenter = reader.read("!L")[0]
3451 assert(_experimenter == 6035143)
3452 obj.subtype = reader.read("!L")[0]
3453 return obj
3454
3455 def __eq__(self, other):
3456 if type(self) != type(other): return False
3457 if self.xid != other.xid: return False
3458 if self.flags != other.flags: return False
3459 if self.subtype != other.subtype: return False
3460 return True
3461
3462 def pretty_print(self, q):
3463 q.text("bsn_stats_reply {")
3464 with q.group():
3465 with q.indent(2):
3466 q.breakable()
3467 q.text("xid = ");
3468 if self.xid != None:
3469 q.text("%#x" % self.xid)
3470 else:
3471 q.text('None')
3472 q.text(","); q.breakable()
3473 q.text("flags = ");
3474 q.text("%#x" % self.flags)
3475 q.breakable()
3476 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -08003477
3478experimenter_stats_reply.subtypes[6035143] = bsn_stats_reply
3479
3480class experimenter_stats_request(stats_request):
3481 subtypes = {}
3482
Rich Lane95f7fc92014-01-27 17:08:16 -08003483 version = 1
3484 type = 16
3485 stats_type = 65535
3486
3487 def __init__(self, xid=None, flags=None, experimenter=None, data=None):
3488 if xid != None:
3489 self.xid = xid
3490 else:
3491 self.xid = None
3492 if flags != None:
3493 self.flags = flags
3494 else:
3495 self.flags = 0
3496 if experimenter != None:
3497 self.experimenter = experimenter
3498 else:
3499 self.experimenter = 0
3500 if data != None:
3501 self.data = data
3502 else:
3503 self.data = ''
3504 return
3505
3506 def pack(self):
3507 packed = []
3508 packed.append(struct.pack("!B", self.version))
3509 packed.append(struct.pack("!B", self.type))
3510 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3511 packed.append(struct.pack("!L", self.xid))
3512 packed.append(struct.pack("!H", self.stats_type))
3513 packed.append(struct.pack("!H", self.flags))
3514 packed.append(struct.pack("!L", self.experimenter))
3515 packed.append(self.data)
3516 length = sum([len(x) for x in packed])
3517 packed[2] = struct.pack("!H", length)
3518 return ''.join(packed)
3519
Rich Lane7dcdf022013-12-11 14:45:27 -08003520 @staticmethod
3521 def unpack(reader):
3522 subtype, = reader.peek('!L', 12)
Rich Lane95f7fc92014-01-27 17:08:16 -08003523 subclass = experimenter_stats_request.subtypes.get(subtype)
3524 if subclass:
3525 return subclass.unpack(reader)
3526
3527 obj = experimenter_stats_request()
3528 _version = reader.read("!B")[0]
3529 assert(_version == 1)
3530 _type = reader.read("!B")[0]
3531 assert(_type == 16)
3532 _length = reader.read("!H")[0]
3533 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003534 reader = orig_reader.slice(_length, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -08003535 obj.xid = reader.read("!L")[0]
3536 _stats_type = reader.read("!H")[0]
3537 assert(_stats_type == 65535)
3538 obj.flags = reader.read("!H")[0]
3539 obj.experimenter = reader.read("!L")[0]
3540 obj.data = str(reader.read_all())
3541 return obj
3542
3543 def __eq__(self, other):
3544 if type(self) != type(other): return False
3545 if self.xid != other.xid: return False
3546 if self.flags != other.flags: return False
3547 if self.experimenter != other.experimenter: return False
3548 if self.data != other.data: return False
3549 return True
3550
3551 def pretty_print(self, q):
3552 q.text("experimenter_stats_request {")
3553 with q.group():
3554 with q.indent(2):
3555 q.breakable()
3556 q.text("xid = ");
3557 if self.xid != None:
3558 q.text("%#x" % self.xid)
3559 else:
3560 q.text('None')
3561 q.text(","); q.breakable()
3562 q.text("flags = ");
3563 q.text("%#x" % self.flags)
3564 q.text(","); q.breakable()
3565 q.text("data = ");
3566 q.pp(self.data)
3567 q.breakable()
3568 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -08003569
3570stats_request.subtypes[65535] = experimenter_stats_request
3571
3572class bsn_stats_request(experimenter_stats_request):
3573 subtypes = {}
3574
Rich Lane95f7fc92014-01-27 17:08:16 -08003575 version = 1
3576 type = 18
3577 stats_type = 65535
3578 experimenter = 6035143
3579
3580 def __init__(self, xid=None, flags=None, subtype=None):
3581 if xid != None:
3582 self.xid = xid
3583 else:
3584 self.xid = None
3585 if flags != None:
3586 self.flags = flags
3587 else:
3588 self.flags = 0
3589 if subtype != None:
3590 self.subtype = subtype
3591 else:
3592 self.subtype = 0
3593 return
3594
3595 def pack(self):
3596 packed = []
3597 packed.append(struct.pack("!B", self.version))
3598 packed.append(struct.pack("!B", self.type))
3599 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3600 packed.append(struct.pack("!L", self.xid))
3601 packed.append(struct.pack("!H", self.stats_type))
3602 packed.append(struct.pack("!H", self.flags))
3603 packed.append('\x00' * 4)
3604 packed.append(struct.pack("!L", self.experimenter))
3605 packed.append(struct.pack("!L", self.subtype))
3606 length = sum([len(x) for x in packed])
3607 packed[2] = struct.pack("!H", length)
3608 return ''.join(packed)
3609
Rich Lane7dcdf022013-12-11 14:45:27 -08003610 @staticmethod
3611 def unpack(reader):
3612 subtype, = reader.peek('!L', 20)
Rich Lane95f7fc92014-01-27 17:08:16 -08003613 subclass = bsn_stats_request.subtypes.get(subtype)
3614 if subclass:
3615 return subclass.unpack(reader)
3616
3617 obj = bsn_stats_request()
3618 _version = reader.read("!B")[0]
3619 assert(_version == 1)
3620 _type = reader.read("!B")[0]
3621 assert(_type == 18)
3622 _length = reader.read("!H")[0]
3623 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003624 reader = orig_reader.slice(_length, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -08003625 obj.xid = reader.read("!L")[0]
3626 _stats_type = reader.read("!H")[0]
3627 assert(_stats_type == 65535)
3628 obj.flags = reader.read("!H")[0]
3629 reader.skip(4)
3630 _experimenter = reader.read("!L")[0]
3631 assert(_experimenter == 6035143)
3632 obj.subtype = reader.read("!L")[0]
3633 return obj
3634
3635 def __eq__(self, other):
3636 if type(self) != type(other): return False
3637 if self.xid != other.xid: return False
3638 if self.flags != other.flags: return False
3639 if self.subtype != other.subtype: return False
3640 return True
3641
3642 def pretty_print(self, q):
3643 q.text("bsn_stats_request {")
3644 with q.group():
3645 with q.indent(2):
3646 q.breakable()
3647 q.text("xid = ");
3648 if self.xid != None:
3649 q.text("%#x" % self.xid)
3650 else:
3651 q.text('None')
3652 q.text(","); q.breakable()
3653 q.text("flags = ");
3654 q.text("%#x" % self.flags)
3655 q.breakable()
3656 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -08003657
3658experimenter_stats_request.subtypes[6035143] = bsn_stats_request
3659
3660class bsn_virtual_port_create_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07003661 version = 1
3662 type = 4
3663 experimenter = 6035143
3664 subtype = 16
3665
3666 def __init__(self, xid=None, status=None, vport_no=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08003667 if xid != None:
3668 self.xid = xid
3669 else:
3670 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07003671 if status != None:
3672 self.status = status
3673 else:
3674 self.status = 0
3675 if vport_no != None:
3676 self.vport_no = vport_no
3677 else:
3678 self.vport_no = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08003679 return
Dan Talaycof6202252013-07-02 01:00:29 -07003680
3681 def pack(self):
3682 packed = []
3683 packed.append(struct.pack("!B", self.version))
3684 packed.append(struct.pack("!B", self.type))
3685 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3686 packed.append(struct.pack("!L", self.xid))
3687 packed.append(struct.pack("!L", self.experimenter))
3688 packed.append(struct.pack("!L", self.subtype))
3689 packed.append(struct.pack("!L", self.status))
3690 packed.append(struct.pack("!L", self.vport_no))
3691 length = sum([len(x) for x in packed])
3692 packed[2] = struct.pack("!H", length)
3693 return ''.join(packed)
3694
3695 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003696 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07003697 obj = bsn_virtual_port_create_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07003698 _version = reader.read("!B")[0]
3699 assert(_version == 1)
3700 _type = reader.read("!B")[0]
3701 assert(_type == 4)
3702 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003703 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003704 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07003705 obj.xid = reader.read("!L")[0]
3706 _experimenter = reader.read("!L")[0]
3707 assert(_experimenter == 6035143)
3708 _subtype = reader.read("!L")[0]
3709 assert(_subtype == 16)
3710 obj.status = reader.read("!L")[0]
3711 obj.vport_no = reader.read("!L")[0]
3712 return obj
3713
3714 def __eq__(self, other):
3715 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07003716 if self.xid != other.xid: return False
3717 if self.status != other.status: return False
3718 if self.vport_no != other.vport_no: return False
3719 return True
3720
Dan Talaycof6202252013-07-02 01:00:29 -07003721 def pretty_print(self, q):
3722 q.text("bsn_virtual_port_create_reply {")
3723 with q.group():
3724 with q.indent(2):
3725 q.breakable()
3726 q.text("xid = ");
3727 if self.xid != None:
3728 q.text("%#x" % self.xid)
3729 else:
3730 q.text('None')
3731 q.text(","); q.breakable()
3732 q.text("status = ");
3733 q.text("%#x" % self.status)
3734 q.text(","); q.breakable()
3735 q.text("vport_no = ");
3736 q.text("%#x" % self.vport_no)
3737 q.breakable()
3738 q.text('}')
3739
Rich Lane7dcdf022013-12-11 14:45:27 -08003740bsn_header.subtypes[16] = bsn_virtual_port_create_reply
3741
3742class bsn_virtual_port_create_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07003743 version = 1
3744 type = 4
3745 experimenter = 6035143
3746 subtype = 15
3747
3748 def __init__(self, xid=None, vport=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08003749 if xid != None:
3750 self.xid = xid
3751 else:
3752 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07003753 if vport != None:
3754 self.vport = vport
3755 else:
Rich Lanee2567702015-01-26 15:04:35 -08003756 self.vport = ofp.bsn_vport()
Rich Lane7dcdf022013-12-11 14:45:27 -08003757 return
Dan Talaycof6202252013-07-02 01:00:29 -07003758
3759 def pack(self):
3760 packed = []
3761 packed.append(struct.pack("!B", self.version))
3762 packed.append(struct.pack("!B", self.type))
3763 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3764 packed.append(struct.pack("!L", self.xid))
3765 packed.append(struct.pack("!L", self.experimenter))
3766 packed.append(struct.pack("!L", self.subtype))
3767 packed.append(self.vport.pack())
3768 length = sum([len(x) for x in packed])
3769 packed[2] = struct.pack("!H", length)
3770 return ''.join(packed)
3771
3772 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003773 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07003774 obj = bsn_virtual_port_create_request()
Dan Talaycof6202252013-07-02 01:00:29 -07003775 _version = reader.read("!B")[0]
3776 assert(_version == 1)
3777 _type = reader.read("!B")[0]
3778 assert(_type == 4)
3779 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003780 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003781 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07003782 obj.xid = reader.read("!L")[0]
3783 _experimenter = reader.read("!L")[0]
3784 assert(_experimenter == 6035143)
3785 _subtype = reader.read("!L")[0]
3786 assert(_subtype == 15)
Rich Lanee2567702015-01-26 15:04:35 -08003787 obj.vport = ofp.bsn_vport.unpack(reader)
Dan Talaycof6202252013-07-02 01:00:29 -07003788 return obj
3789
3790 def __eq__(self, other):
3791 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07003792 if self.xid != other.xid: return False
3793 if self.vport != other.vport: return False
3794 return True
3795
Dan Talaycof6202252013-07-02 01:00:29 -07003796 def pretty_print(self, q):
3797 q.text("bsn_virtual_port_create_request {")
3798 with q.group():
3799 with q.indent(2):
3800 q.breakable()
3801 q.text("xid = ");
3802 if self.xid != None:
3803 q.text("%#x" % self.xid)
3804 else:
3805 q.text('None')
3806 q.text(","); q.breakable()
3807 q.text("vport = ");
3808 q.pp(self.vport)
3809 q.breakable()
3810 q.text('}')
3811
Rich Lane7dcdf022013-12-11 14:45:27 -08003812bsn_header.subtypes[15] = bsn_virtual_port_create_request
3813
3814class bsn_virtual_port_remove_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07003815 version = 1
3816 type = 4
3817 experimenter = 6035143
3818 subtype = 26
3819
3820 def __init__(self, xid=None, status=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08003821 if xid != None:
3822 self.xid = xid
3823 else:
3824 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07003825 if status != None:
3826 self.status = status
3827 else:
3828 self.status = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08003829 return
Dan Talaycof6202252013-07-02 01:00:29 -07003830
3831 def pack(self):
3832 packed = []
3833 packed.append(struct.pack("!B", self.version))
3834 packed.append(struct.pack("!B", self.type))
3835 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3836 packed.append(struct.pack("!L", self.xid))
3837 packed.append(struct.pack("!L", self.experimenter))
3838 packed.append(struct.pack("!L", self.subtype))
3839 packed.append(struct.pack("!L", self.status))
3840 length = sum([len(x) for x in packed])
3841 packed[2] = struct.pack("!H", length)
3842 return ''.join(packed)
3843
3844 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003845 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07003846 obj = bsn_virtual_port_remove_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07003847 _version = reader.read("!B")[0]
3848 assert(_version == 1)
3849 _type = reader.read("!B")[0]
3850 assert(_type == 4)
3851 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003852 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003853 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07003854 obj.xid = reader.read("!L")[0]
3855 _experimenter = reader.read("!L")[0]
3856 assert(_experimenter == 6035143)
3857 _subtype = reader.read("!L")[0]
3858 assert(_subtype == 26)
3859 obj.status = reader.read("!L")[0]
3860 return obj
3861
3862 def __eq__(self, other):
3863 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07003864 if self.xid != other.xid: return False
3865 if self.status != other.status: return False
3866 return True
3867
Dan Talaycof6202252013-07-02 01:00:29 -07003868 def pretty_print(self, q):
3869 q.text("bsn_virtual_port_remove_reply {")
3870 with q.group():
3871 with q.indent(2):
3872 q.breakable()
3873 q.text("xid = ");
3874 if self.xid != None:
3875 q.text("%#x" % self.xid)
3876 else:
3877 q.text('None')
3878 q.text(","); q.breakable()
3879 q.text("status = ");
3880 q.text("%#x" % self.status)
3881 q.breakable()
3882 q.text('}')
3883
Rich Lane7dcdf022013-12-11 14:45:27 -08003884bsn_header.subtypes[26] = bsn_virtual_port_remove_reply
3885
3886class bsn_virtual_port_remove_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07003887 version = 1
3888 type = 4
3889 experimenter = 6035143
3890 subtype = 17
3891
3892 def __init__(self, xid=None, vport_no=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08003893 if xid != None:
3894 self.xid = xid
3895 else:
3896 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07003897 if vport_no != None:
3898 self.vport_no = vport_no
3899 else:
3900 self.vport_no = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08003901 return
Dan Talaycof6202252013-07-02 01:00:29 -07003902
3903 def pack(self):
3904 packed = []
3905 packed.append(struct.pack("!B", self.version))
3906 packed.append(struct.pack("!B", self.type))
3907 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3908 packed.append(struct.pack("!L", self.xid))
3909 packed.append(struct.pack("!L", self.experimenter))
3910 packed.append(struct.pack("!L", self.subtype))
3911 packed.append(struct.pack("!L", self.vport_no))
3912 length = sum([len(x) for x in packed])
3913 packed[2] = struct.pack("!H", length)
3914 return ''.join(packed)
3915
3916 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003917 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07003918 obj = bsn_virtual_port_remove_request()
Dan Talaycof6202252013-07-02 01:00:29 -07003919 _version = reader.read("!B")[0]
3920 assert(_version == 1)
3921 _type = reader.read("!B")[0]
3922 assert(_type == 4)
3923 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003924 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003925 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07003926 obj.xid = reader.read("!L")[0]
3927 _experimenter = reader.read("!L")[0]
3928 assert(_experimenter == 6035143)
3929 _subtype = reader.read("!L")[0]
3930 assert(_subtype == 17)
3931 obj.vport_no = reader.read("!L")[0]
3932 return obj
3933
3934 def __eq__(self, other):
3935 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07003936 if self.xid != other.xid: return False
3937 if self.vport_no != other.vport_no: return False
3938 return True
3939
Dan Talaycof6202252013-07-02 01:00:29 -07003940 def pretty_print(self, q):
3941 q.text("bsn_virtual_port_remove_request {")
3942 with q.group():
3943 with q.indent(2):
3944 q.breakable()
3945 q.text("xid = ");
3946 if self.xid != None:
3947 q.text("%#x" % self.xid)
3948 else:
3949 q.text('None')
3950 q.text(","); q.breakable()
3951 q.text("vport_no = ");
3952 q.text("%#x" % self.vport_no)
3953 q.breakable()
3954 q.text('}')
3955
Rich Lane7dcdf022013-12-11 14:45:27 -08003956bsn_header.subtypes[17] = bsn_virtual_port_remove_request
3957
3958class desc_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -07003959 version = 1
3960 type = 17
3961 stats_type = 0
Rich Laneb658ddd2013-03-12 10:15:10 -07003962
3963 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 -08003964 if xid != None:
3965 self.xid = xid
3966 else:
3967 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07003968 if flags != None:
3969 self.flags = flags
3970 else:
3971 self.flags = 0
3972 if mfr_desc != None:
3973 self.mfr_desc = mfr_desc
3974 else:
3975 self.mfr_desc = ""
3976 if hw_desc != None:
3977 self.hw_desc = hw_desc
3978 else:
3979 self.hw_desc = ""
3980 if sw_desc != None:
3981 self.sw_desc = sw_desc
3982 else:
3983 self.sw_desc = ""
3984 if serial_num != None:
3985 self.serial_num = serial_num
3986 else:
3987 self.serial_num = ""
3988 if dp_desc != None:
3989 self.dp_desc = dp_desc
3990 else:
3991 self.dp_desc = ""
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(struct.pack("!H", self.stats_type))
4001 packed.append(struct.pack("!H", self.flags))
4002 packed.append(struct.pack("!256s", self.mfr_desc))
4003 packed.append(struct.pack("!256s", self.hw_desc))
4004 packed.append(struct.pack("!256s", self.sw_desc))
4005 packed.append(struct.pack("!32s", self.serial_num))
4006 packed.append(struct.pack("!256s", self.dp_desc))
4007 length = sum([len(x) for x in packed])
4008 packed[2] = struct.pack("!H", length)
4009 return ''.join(packed)
4010
4011 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004012 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07004013 obj = desc_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07004014 _version = reader.read("!B")[0]
4015 assert(_version == 1)
4016 _type = reader.read("!B")[0]
4017 assert(_type == 17)
4018 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004019 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08004020 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07004021 obj.xid = reader.read("!L")[0]
4022 _stats_type = reader.read("!H")[0]
4023 assert(_stats_type == 0)
4024 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07004025 obj.mfr_desc = reader.read("!256s")[0].rstrip("\x00")
4026 obj.hw_desc = reader.read("!256s")[0].rstrip("\x00")
4027 obj.sw_desc = reader.read("!256s")[0].rstrip("\x00")
4028 obj.serial_num = reader.read("!32s")[0].rstrip("\x00")
4029 obj.dp_desc = reader.read("!256s")[0].rstrip("\x00")
Rich Laneb658ddd2013-03-12 10:15:10 -07004030 return obj
4031
4032 def __eq__(self, other):
4033 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07004034 if self.xid != other.xid: return False
4035 if self.flags != other.flags: return False
4036 if self.mfr_desc != other.mfr_desc: return False
4037 if self.hw_desc != other.hw_desc: return False
4038 if self.sw_desc != other.sw_desc: return False
4039 if self.serial_num != other.serial_num: return False
4040 if self.dp_desc != other.dp_desc: return False
4041 return True
4042
Rich Laneb658ddd2013-03-12 10:15:10 -07004043 def pretty_print(self, q):
4044 q.text("desc_stats_reply {")
4045 with q.group():
4046 with q.indent(2):
4047 q.breakable()
4048 q.text("xid = ");
4049 if self.xid != None:
4050 q.text("%#x" % self.xid)
4051 else:
4052 q.text('None')
4053 q.text(","); q.breakable()
4054 q.text("flags = ");
4055 q.text("%#x" % self.flags)
4056 q.text(","); q.breakable()
4057 q.text("mfr_desc = ");
4058 q.pp(self.mfr_desc)
4059 q.text(","); q.breakable()
4060 q.text("hw_desc = ");
4061 q.pp(self.hw_desc)
4062 q.text(","); q.breakable()
4063 q.text("sw_desc = ");
4064 q.pp(self.sw_desc)
4065 q.text(","); q.breakable()
4066 q.text("serial_num = ");
4067 q.pp(self.serial_num)
4068 q.text(","); q.breakable()
4069 q.text("dp_desc = ");
4070 q.pp(self.dp_desc)
4071 q.breakable()
4072 q.text('}')
4073
Rich Lane7dcdf022013-12-11 14:45:27 -08004074stats_reply.subtypes[0] = desc_stats_reply
4075
4076class desc_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -07004077 version = 1
4078 type = 16
4079 stats_type = 0
Rich Laneb658ddd2013-03-12 10:15:10 -07004080
4081 def __init__(self, xid=None, flags=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08004082 if xid != None:
4083 self.xid = xid
4084 else:
4085 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07004086 if flags != None:
4087 self.flags = flags
4088 else:
4089 self.flags = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08004090 return
Rich Laneb658ddd2013-03-12 10:15:10 -07004091
4092 def pack(self):
4093 packed = []
4094 packed.append(struct.pack("!B", self.version))
4095 packed.append(struct.pack("!B", self.type))
4096 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4097 packed.append(struct.pack("!L", self.xid))
4098 packed.append(struct.pack("!H", self.stats_type))
4099 packed.append(struct.pack("!H", self.flags))
4100 length = sum([len(x) for x in packed])
4101 packed[2] = struct.pack("!H", length)
4102 return ''.join(packed)
4103
4104 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004105 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07004106 obj = desc_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -07004107 _version = reader.read("!B")[0]
4108 assert(_version == 1)
4109 _type = reader.read("!B")[0]
4110 assert(_type == 16)
4111 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004112 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08004113 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07004114 obj.xid = reader.read("!L")[0]
4115 _stats_type = reader.read("!H")[0]
4116 assert(_stats_type == 0)
4117 obj.flags = reader.read("!H")[0]
Rich Laneb658ddd2013-03-12 10:15:10 -07004118 return obj
4119
4120 def __eq__(self, other):
4121 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07004122 if self.xid != other.xid: return False
4123 if self.flags != other.flags: return False
4124 return True
4125
Rich Laneb658ddd2013-03-12 10:15:10 -07004126 def pretty_print(self, q):
4127 q.text("desc_stats_request {")
4128 with q.group():
4129 with q.indent(2):
4130 q.breakable()
4131 q.text("xid = ");
4132 if self.xid != None:
4133 q.text("%#x" % self.xid)
4134 else:
4135 q.text('None')
4136 q.text(","); q.breakable()
4137 q.text("flags = ");
4138 q.text("%#x" % self.flags)
4139 q.breakable()
4140 q.text('}')
4141
Rich Lane7dcdf022013-12-11 14:45:27 -08004142stats_request.subtypes[0] = desc_stats_request
4143
4144class echo_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -07004145 version = 1
4146 type = 3
Rich Laneb658ddd2013-03-12 10:15:10 -07004147
4148 def __init__(self, xid=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08004149 if xid != None:
4150 self.xid = xid
4151 else:
4152 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07004153 if data != None:
4154 self.data = data
4155 else:
Dan Talaycof6202252013-07-02 01:00:29 -07004156 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08004157 return
Rich Laneb658ddd2013-03-12 10:15:10 -07004158
4159 def pack(self):
4160 packed = []
4161 packed.append(struct.pack("!B", self.version))
4162 packed.append(struct.pack("!B", self.type))
4163 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4164 packed.append(struct.pack("!L", self.xid))
4165 packed.append(self.data)
4166 length = sum([len(x) for x in packed])
4167 packed[2] = struct.pack("!H", length)
4168 return ''.join(packed)
4169
4170 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004171 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07004172 obj = echo_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07004173 _version = reader.read("!B")[0]
4174 assert(_version == 1)
4175 _type = reader.read("!B")[0]
4176 assert(_type == 3)
4177 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004178 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08004179 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07004180 obj.xid = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07004181 obj.data = str(reader.read_all())
Rich Laneb658ddd2013-03-12 10:15:10 -07004182 return obj
4183
4184 def __eq__(self, other):
4185 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07004186 if self.xid != other.xid: return False
4187 if self.data != other.data: return False
4188 return True
4189
Rich Laneb658ddd2013-03-12 10:15:10 -07004190 def pretty_print(self, q):
4191 q.text("echo_reply {")
4192 with q.group():
4193 with q.indent(2):
4194 q.breakable()
4195 q.text("xid = ");
4196 if self.xid != None:
4197 q.text("%#x" % self.xid)
4198 else:
4199 q.text('None')
4200 q.text(","); q.breakable()
4201 q.text("data = ");
4202 q.pp(self.data)
4203 q.breakable()
4204 q.text('}')
4205
Rich Lane7dcdf022013-12-11 14:45:27 -08004206message.subtypes[3] = echo_reply
4207
4208class echo_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -07004209 version = 1
4210 type = 2
Rich Laneb658ddd2013-03-12 10:15:10 -07004211
4212 def __init__(self, xid=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08004213 if xid != None:
4214 self.xid = xid
4215 else:
4216 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07004217 if data != None:
4218 self.data = data
4219 else:
Dan Talaycof6202252013-07-02 01:00:29 -07004220 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08004221 return
Rich Laneb658ddd2013-03-12 10:15:10 -07004222
4223 def pack(self):
4224 packed = []
4225 packed.append(struct.pack("!B", self.version))
4226 packed.append(struct.pack("!B", self.type))
4227 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4228 packed.append(struct.pack("!L", self.xid))
4229 packed.append(self.data)
4230 length = sum([len(x) for x in packed])
4231 packed[2] = struct.pack("!H", length)
4232 return ''.join(packed)
4233
4234 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004235 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07004236 obj = echo_request()
Dan Talaycof6202252013-07-02 01:00:29 -07004237 _version = reader.read("!B")[0]
4238 assert(_version == 1)
4239 _type = reader.read("!B")[0]
4240 assert(_type == 2)
4241 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004242 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08004243 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07004244 obj.xid = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07004245 obj.data = str(reader.read_all())
Rich Laneb658ddd2013-03-12 10:15:10 -07004246 return obj
4247
4248 def __eq__(self, other):
4249 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07004250 if self.xid != other.xid: return False
4251 if self.data != other.data: return False
4252 return True
4253
Rich Laneb658ddd2013-03-12 10:15:10 -07004254 def pretty_print(self, q):
4255 q.text("echo_request {")
4256 with q.group():
4257 with q.indent(2):
4258 q.breakable()
4259 q.text("xid = ");
4260 if self.xid != None:
4261 q.text("%#x" % self.xid)
4262 else:
4263 q.text('None')
4264 q.text(","); q.breakable()
4265 q.text("data = ");
4266 q.pp(self.data)
4267 q.breakable()
4268 q.text('}')
4269
Rich Lane7dcdf022013-12-11 14:45:27 -08004270message.subtypes[2] = echo_request
4271
4272class features_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -07004273 version = 1
4274 type = 6
Rich Laneb658ddd2013-03-12 10:15:10 -07004275
Rich Lanec2ee4b82013-04-24 17:12:38 -07004276 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 -08004277 if xid != None:
4278 self.xid = xid
4279 else:
4280 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07004281 if datapath_id != None:
4282 self.datapath_id = datapath_id
4283 else:
4284 self.datapath_id = 0
4285 if n_buffers != None:
4286 self.n_buffers = n_buffers
4287 else:
4288 self.n_buffers = 0
4289 if n_tables != None:
4290 self.n_tables = n_tables
4291 else:
4292 self.n_tables = 0
Rich Laneb658ddd2013-03-12 10:15:10 -07004293 if capabilities != None:
4294 self.capabilities = capabilities
4295 else:
4296 self.capabilities = 0
4297 if actions != None:
4298 self.actions = actions
4299 else:
4300 self.actions = 0
4301 if ports != None:
4302 self.ports = ports
4303 else:
4304 self.ports = []
Rich Lane7dcdf022013-12-11 14:45:27 -08004305 return
Rich Laneb658ddd2013-03-12 10:15:10 -07004306
4307 def pack(self):
4308 packed = []
4309 packed.append(struct.pack("!B", self.version))
4310 packed.append(struct.pack("!B", self.type))
4311 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4312 packed.append(struct.pack("!L", self.xid))
4313 packed.append(struct.pack("!Q", self.datapath_id))
4314 packed.append(struct.pack("!L", self.n_buffers))
4315 packed.append(struct.pack("!B", self.n_tables))
Rich Lanec2ee4b82013-04-24 17:12:38 -07004316 packed.append('\x00' * 3)
Rich Laneb658ddd2013-03-12 10:15:10 -07004317 packed.append(struct.pack("!L", self.capabilities))
4318 packed.append(struct.pack("!L", self.actions))
Rich Lane7dcdf022013-12-11 14:45:27 -08004319 packed.append(loxi.generic_util.pack_list(self.ports))
Rich Laneb658ddd2013-03-12 10:15:10 -07004320 length = sum([len(x) for x in packed])
4321 packed[2] = struct.pack("!H", length)
4322 return ''.join(packed)
4323
4324 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004325 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07004326 obj = features_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07004327 _version = reader.read("!B")[0]
4328 assert(_version == 1)
4329 _type = reader.read("!B")[0]
4330 assert(_type == 6)
4331 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004332 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08004333 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07004334 obj.xid = reader.read("!L")[0]
4335 obj.datapath_id = reader.read("!Q")[0]
4336 obj.n_buffers = reader.read("!L")[0]
4337 obj.n_tables = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07004338 reader.skip(3)
Dan Talaycof6202252013-07-02 01:00:29 -07004339 obj.capabilities = reader.read("!L")[0]
4340 obj.actions = reader.read("!L")[0]
Rich Lanee2567702015-01-26 15:04:35 -08004341 obj.ports = loxi.generic_util.unpack_list(reader, ofp.common.port_desc.unpack)
Rich Laneb658ddd2013-03-12 10:15:10 -07004342 return obj
4343
4344 def __eq__(self, other):
4345 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07004346 if self.xid != other.xid: return False
4347 if self.datapath_id != other.datapath_id: return False
4348 if self.n_buffers != other.n_buffers: return False
4349 if self.n_tables != other.n_tables: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07004350 if self.capabilities != other.capabilities: return False
4351 if self.actions != other.actions: return False
4352 if self.ports != other.ports: return False
4353 return True
4354
Rich Laneb658ddd2013-03-12 10:15:10 -07004355 def pretty_print(self, q):
4356 q.text("features_reply {")
4357 with q.group():
4358 with q.indent(2):
4359 q.breakable()
4360 q.text("xid = ");
4361 if self.xid != None:
4362 q.text("%#x" % self.xid)
4363 else:
4364 q.text('None')
4365 q.text(","); q.breakable()
4366 q.text("datapath_id = ");
4367 q.text("%#x" % self.datapath_id)
4368 q.text(","); q.breakable()
4369 q.text("n_buffers = ");
4370 q.text("%#x" % self.n_buffers)
4371 q.text(","); q.breakable()
4372 q.text("n_tables = ");
4373 q.text("%#x" % self.n_tables)
4374 q.text(","); q.breakable()
Rich Laneb658ddd2013-03-12 10:15:10 -07004375 q.text("capabilities = ");
4376 q.text("%#x" % self.capabilities)
4377 q.text(","); q.breakable()
4378 q.text("actions = ");
4379 q.text("%#x" % self.actions)
4380 q.text(","); q.breakable()
4381 q.text("ports = ");
4382 q.pp(self.ports)
4383 q.breakable()
4384 q.text('}')
4385
Rich Lane7dcdf022013-12-11 14:45:27 -08004386message.subtypes[6] = features_reply
4387
4388class features_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -07004389 version = 1
4390 type = 5
Rich Laneb658ddd2013-03-12 10:15:10 -07004391
4392 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08004393 if xid != None:
4394 self.xid = xid
4395 else:
4396 self.xid = None
4397 return
Rich Laneb658ddd2013-03-12 10:15:10 -07004398
4399 def pack(self):
4400 packed = []
4401 packed.append(struct.pack("!B", self.version))
4402 packed.append(struct.pack("!B", self.type))
4403 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4404 packed.append(struct.pack("!L", self.xid))
4405 length = sum([len(x) for x in packed])
4406 packed[2] = struct.pack("!H", length)
4407 return ''.join(packed)
4408
4409 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004410 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07004411 obj = features_request()
Dan Talaycof6202252013-07-02 01:00:29 -07004412 _version = reader.read("!B")[0]
4413 assert(_version == 1)
4414 _type = reader.read("!B")[0]
4415 assert(_type == 5)
4416 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004417 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08004418 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07004419 obj.xid = reader.read("!L")[0]
Rich Laneb658ddd2013-03-12 10:15:10 -07004420 return obj
4421
4422 def __eq__(self, other):
4423 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07004424 if self.xid != other.xid: return False
4425 return True
4426
Rich Laneb658ddd2013-03-12 10:15:10 -07004427 def pretty_print(self, q):
4428 q.text("features_request {")
4429 with q.group():
4430 with q.indent(2):
4431 q.breakable()
4432 q.text("xid = ");
4433 if self.xid != None:
4434 q.text("%#x" % self.xid)
4435 else:
4436 q.text('None')
4437 q.breakable()
4438 q.text('}')
4439
Rich Lane7dcdf022013-12-11 14:45:27 -08004440message.subtypes[5] = features_request
4441
4442class flow_mod(message):
4443 subtypes = {}
4444
Rich Lane95f7fc92014-01-27 17:08:16 -08004445 version = 1
4446 type = 14
4447
4448 def __init__(self, xid=None, match=None, cookie=None, _command=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, flags=None, actions=None):
4449 if xid != None:
4450 self.xid = xid
4451 else:
4452 self.xid = None
4453 if match != None:
4454 self.match = match
4455 else:
Rich Lanee2567702015-01-26 15:04:35 -08004456 self.match = ofp.match()
Rich Lane95f7fc92014-01-27 17:08:16 -08004457 if cookie != None:
4458 self.cookie = cookie
4459 else:
4460 self.cookie = 0
4461 if _command != None:
4462 self._command = _command
4463 else:
4464 self._command = 0
4465 if idle_timeout != None:
4466 self.idle_timeout = idle_timeout
4467 else:
4468 self.idle_timeout = 0
4469 if hard_timeout != None:
4470 self.hard_timeout = hard_timeout
4471 else:
4472 self.hard_timeout = 0
4473 if priority != None:
4474 self.priority = priority
4475 else:
4476 self.priority = 0
4477 if buffer_id != None:
4478 self.buffer_id = buffer_id
4479 else:
4480 self.buffer_id = 0
4481 if out_port != None:
4482 self.out_port = out_port
4483 else:
4484 self.out_port = 0
4485 if flags != None:
4486 self.flags = flags
4487 else:
4488 self.flags = 0
4489 if actions != None:
4490 self.actions = actions
4491 else:
4492 self.actions = []
4493 return
4494
4495 def pack(self):
4496 packed = []
4497 packed.append(struct.pack("!B", self.version))
4498 packed.append(struct.pack("!B", self.type))
4499 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4500 packed.append(struct.pack("!L", self.xid))
4501 packed.append(self.match.pack())
4502 packed.append(struct.pack("!Q", self.cookie))
4503 packed.append(util.pack_fm_cmd(self._command))
4504 packed.append(struct.pack("!H", self.idle_timeout))
4505 packed.append(struct.pack("!H", self.hard_timeout))
4506 packed.append(struct.pack("!H", self.priority))
4507 packed.append(struct.pack("!L", self.buffer_id))
4508 packed.append(util.pack_port_no(self.out_port))
4509 packed.append(struct.pack("!H", self.flags))
4510 packed.append(loxi.generic_util.pack_list(self.actions))
4511 length = sum([len(x) for x in packed])
4512 packed[2] = struct.pack("!H", length)
4513 return ''.join(packed)
4514
Rich Lane7dcdf022013-12-11 14:45:27 -08004515 @staticmethod
4516 def unpack(reader):
4517 subtype, = reader.peek('!H', 56)
Rich Lane95f7fc92014-01-27 17:08:16 -08004518 subclass = flow_mod.subtypes.get(subtype)
4519 if subclass:
4520 return subclass.unpack(reader)
4521
4522 obj = flow_mod()
4523 _version = reader.read("!B")[0]
4524 assert(_version == 1)
4525 _type = reader.read("!B")[0]
4526 assert(_type == 14)
4527 _length = reader.read("!H")[0]
4528 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08004529 reader = orig_reader.slice(_length, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -08004530 obj.xid = reader.read("!L")[0]
Rich Lanee2567702015-01-26 15:04:35 -08004531 obj.match = ofp.match.unpack(reader)
Rich Lane95f7fc92014-01-27 17:08:16 -08004532 obj.cookie = reader.read("!Q")[0]
4533 obj._command = util.unpack_fm_cmd(reader)
4534 obj.idle_timeout = reader.read("!H")[0]
4535 obj.hard_timeout = reader.read("!H")[0]
4536 obj.priority = reader.read("!H")[0]
4537 obj.buffer_id = reader.read("!L")[0]
4538 obj.out_port = util.unpack_port_no(reader)
4539 obj.flags = reader.read("!H")[0]
Rich Lanee2567702015-01-26 15:04:35 -08004540 obj.actions = loxi.generic_util.unpack_list(reader, ofp.action.action.unpack)
Rich Lane95f7fc92014-01-27 17:08:16 -08004541 return obj
4542
4543 def __eq__(self, other):
4544 if type(self) != type(other): return False
4545 if self.xid != other.xid: return False
4546 if self.match != other.match: return False
4547 if self.cookie != other.cookie: return False
4548 if self._command != other._command: return False
4549 if self.idle_timeout != other.idle_timeout: return False
4550 if self.hard_timeout != other.hard_timeout: return False
4551 if self.priority != other.priority: return False
4552 if self.buffer_id != other.buffer_id: return False
4553 if self.out_port != other.out_port: return False
4554 if self.flags != other.flags: return False
4555 if self.actions != other.actions: return False
4556 return True
4557
4558 def pretty_print(self, q):
4559 q.text("flow_mod {")
4560 with q.group():
4561 with q.indent(2):
4562 q.breakable()
4563 q.text("xid = ");
4564 if self.xid != None:
4565 q.text("%#x" % self.xid)
4566 else:
4567 q.text('None')
4568 q.text(","); q.breakable()
4569 q.text("match = ");
4570 q.pp(self.match)
4571 q.text(","); q.breakable()
4572 q.text("cookie = ");
4573 q.text("%#x" % self.cookie)
4574 q.text(","); q.breakable()
4575 q.text("idle_timeout = ");
4576 q.text("%#x" % self.idle_timeout)
4577 q.text(","); q.breakable()
4578 q.text("hard_timeout = ");
4579 q.text("%#x" % self.hard_timeout)
4580 q.text(","); q.breakable()
4581 q.text("priority = ");
4582 q.text("%#x" % self.priority)
4583 q.text(","); q.breakable()
4584 q.text("buffer_id = ");
4585 q.text("%#x" % self.buffer_id)
4586 q.text(","); q.breakable()
4587 q.text("out_port = ");
4588 q.text(util.pretty_port(self.out_port))
4589 q.text(","); q.breakable()
4590 q.text("flags = ");
4591 q.text("%#x" % self.flags)
4592 q.text(","); q.breakable()
4593 q.text("actions = ");
4594 q.pp(self.actions)
4595 q.breakable()
4596 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -08004597
4598message.subtypes[14] = flow_mod
4599
4600class flow_add(flow_mod):
Dan Talaycof6202252013-07-02 01:00:29 -07004601 version = 1
4602 type = 14
4603 _command = 0
Rich Laneb658ddd2013-03-12 10:15:10 -07004604
4605 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 -08004606 if xid != None:
4607 self.xid = xid
4608 else:
4609 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07004610 if match != None:
4611 self.match = match
4612 else:
Rich Lanee2567702015-01-26 15:04:35 -08004613 self.match = ofp.match()
Rich Laneb658ddd2013-03-12 10:15:10 -07004614 if cookie != None:
4615 self.cookie = cookie
4616 else:
4617 self.cookie = 0
4618 if idle_timeout != None:
4619 self.idle_timeout = idle_timeout
4620 else:
4621 self.idle_timeout = 0
4622 if hard_timeout != None:
4623 self.hard_timeout = hard_timeout
4624 else:
4625 self.hard_timeout = 0
4626 if priority != None:
4627 self.priority = priority
4628 else:
4629 self.priority = 0
4630 if buffer_id != None:
4631 self.buffer_id = buffer_id
4632 else:
4633 self.buffer_id = 0
4634 if out_port != None:
4635 self.out_port = out_port
4636 else:
4637 self.out_port = 0
4638 if flags != None:
4639 self.flags = flags
4640 else:
4641 self.flags = 0
4642 if actions != None:
4643 self.actions = actions
4644 else:
4645 self.actions = []
Rich Lane7dcdf022013-12-11 14:45:27 -08004646 return
Rich Laneb658ddd2013-03-12 10:15:10 -07004647
4648 def pack(self):
4649 packed = []
4650 packed.append(struct.pack("!B", self.version))
4651 packed.append(struct.pack("!B", self.type))
4652 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4653 packed.append(struct.pack("!L", self.xid))
4654 packed.append(self.match.pack())
4655 packed.append(struct.pack("!Q", self.cookie))
Dan Talaycof6202252013-07-02 01:00:29 -07004656 packed.append(util.pack_fm_cmd(self._command))
Rich Laneb658ddd2013-03-12 10:15:10 -07004657 packed.append(struct.pack("!H", self.idle_timeout))
4658 packed.append(struct.pack("!H", self.hard_timeout))
4659 packed.append(struct.pack("!H", self.priority))
4660 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -07004661 packed.append(util.pack_port_no(self.out_port))
Rich Laneb658ddd2013-03-12 10:15:10 -07004662 packed.append(struct.pack("!H", self.flags))
Rich Lane7dcdf022013-12-11 14:45:27 -08004663 packed.append(loxi.generic_util.pack_list(self.actions))
Rich Laneb658ddd2013-03-12 10:15:10 -07004664 length = sum([len(x) for x in packed])
4665 packed[2] = struct.pack("!H", length)
4666 return ''.join(packed)
4667
4668 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004669 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07004670 obj = flow_add()
Dan Talaycof6202252013-07-02 01:00:29 -07004671 _version = reader.read("!B")[0]
4672 assert(_version == 1)
4673 _type = reader.read("!B")[0]
4674 assert(_type == 14)
4675 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004676 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08004677 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07004678 obj.xid = reader.read("!L")[0]
Rich Lanee2567702015-01-26 15:04:35 -08004679 obj.match = ofp.match.unpack(reader)
Dan Talaycof6202252013-07-02 01:00:29 -07004680 obj.cookie = reader.read("!Q")[0]
4681 __command = util.unpack_fm_cmd(reader)
4682 assert(__command == 0)
4683 obj.idle_timeout = reader.read("!H")[0]
4684 obj.hard_timeout = reader.read("!H")[0]
4685 obj.priority = reader.read("!H")[0]
4686 obj.buffer_id = reader.read("!L")[0]
4687 obj.out_port = util.unpack_port_no(reader)
4688 obj.flags = reader.read("!H")[0]
Rich Lanee2567702015-01-26 15:04:35 -08004689 obj.actions = loxi.generic_util.unpack_list(reader, ofp.action.action.unpack)
Rich Laneb658ddd2013-03-12 10:15:10 -07004690 return obj
4691
4692 def __eq__(self, other):
4693 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07004694 if self.xid != other.xid: return False
4695 if self.match != other.match: return False
4696 if self.cookie != other.cookie: return False
4697 if self.idle_timeout != other.idle_timeout: return False
4698 if self.hard_timeout != other.hard_timeout: return False
4699 if self.priority != other.priority: return False
4700 if self.buffer_id != other.buffer_id: return False
4701 if self.out_port != other.out_port: return False
4702 if self.flags != other.flags: return False
4703 if self.actions != other.actions: return False
4704 return True
4705
Rich Laneb658ddd2013-03-12 10:15:10 -07004706 def pretty_print(self, q):
4707 q.text("flow_add {")
4708 with q.group():
4709 with q.indent(2):
4710 q.breakable()
4711 q.text("xid = ");
4712 if self.xid != None:
4713 q.text("%#x" % self.xid)
4714 else:
4715 q.text('None')
4716 q.text(","); q.breakable()
4717 q.text("match = ");
4718 q.pp(self.match)
4719 q.text(","); q.breakable()
4720 q.text("cookie = ");
4721 q.text("%#x" % self.cookie)
4722 q.text(","); q.breakable()
4723 q.text("idle_timeout = ");
4724 q.text("%#x" % self.idle_timeout)
4725 q.text(","); q.breakable()
4726 q.text("hard_timeout = ");
4727 q.text("%#x" % self.hard_timeout)
4728 q.text(","); q.breakable()
4729 q.text("priority = ");
4730 q.text("%#x" % self.priority)
4731 q.text(","); q.breakable()
4732 q.text("buffer_id = ");
4733 q.text("%#x" % self.buffer_id)
4734 q.text(","); q.breakable()
4735 q.text("out_port = ");
4736 q.text(util.pretty_port(self.out_port))
4737 q.text(","); q.breakable()
4738 q.text("flags = ");
4739 q.text("%#x" % self.flags)
4740 q.text(","); q.breakable()
4741 q.text("actions = ");
4742 q.pp(self.actions)
4743 q.breakable()
4744 q.text('}')
4745
Rich Lane7dcdf022013-12-11 14:45:27 -08004746flow_mod.subtypes[0] = flow_add
4747
4748class flow_delete(flow_mod):
Dan Talaycof6202252013-07-02 01:00:29 -07004749 version = 1
4750 type = 14
4751 _command = 3
Rich Laneb658ddd2013-03-12 10:15:10 -07004752
4753 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 -08004754 if xid != None:
4755 self.xid = xid
4756 else:
4757 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07004758 if match != None:
4759 self.match = match
4760 else:
Rich Lanee2567702015-01-26 15:04:35 -08004761 self.match = ofp.match()
Rich Laneb658ddd2013-03-12 10:15:10 -07004762 if cookie != None:
4763 self.cookie = cookie
4764 else:
4765 self.cookie = 0
4766 if idle_timeout != None:
4767 self.idle_timeout = idle_timeout
4768 else:
4769 self.idle_timeout = 0
4770 if hard_timeout != None:
4771 self.hard_timeout = hard_timeout
4772 else:
4773 self.hard_timeout = 0
4774 if priority != None:
4775 self.priority = priority
4776 else:
4777 self.priority = 0
4778 if buffer_id != None:
4779 self.buffer_id = buffer_id
4780 else:
4781 self.buffer_id = 0
4782 if out_port != None:
4783 self.out_port = out_port
4784 else:
4785 self.out_port = 0
4786 if flags != None:
4787 self.flags = flags
4788 else:
4789 self.flags = 0
4790 if actions != None:
4791 self.actions = actions
4792 else:
4793 self.actions = []
Rich Lane7dcdf022013-12-11 14:45:27 -08004794 return
Rich Laneb658ddd2013-03-12 10:15:10 -07004795
4796 def pack(self):
4797 packed = []
4798 packed.append(struct.pack("!B", self.version))
4799 packed.append(struct.pack("!B", self.type))
4800 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4801 packed.append(struct.pack("!L", self.xid))
4802 packed.append(self.match.pack())
4803 packed.append(struct.pack("!Q", self.cookie))
Dan Talaycof6202252013-07-02 01:00:29 -07004804 packed.append(util.pack_fm_cmd(self._command))
Rich Laneb658ddd2013-03-12 10:15:10 -07004805 packed.append(struct.pack("!H", self.idle_timeout))
4806 packed.append(struct.pack("!H", self.hard_timeout))
4807 packed.append(struct.pack("!H", self.priority))
4808 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -07004809 packed.append(util.pack_port_no(self.out_port))
Rich Laneb658ddd2013-03-12 10:15:10 -07004810 packed.append(struct.pack("!H", self.flags))
Rich Lane7dcdf022013-12-11 14:45:27 -08004811 packed.append(loxi.generic_util.pack_list(self.actions))
Rich Laneb658ddd2013-03-12 10:15:10 -07004812 length = sum([len(x) for x in packed])
4813 packed[2] = struct.pack("!H", length)
4814 return ''.join(packed)
4815
4816 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004817 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07004818 obj = flow_delete()
Dan Talaycof6202252013-07-02 01:00:29 -07004819 _version = reader.read("!B")[0]
4820 assert(_version == 1)
4821 _type = reader.read("!B")[0]
4822 assert(_type == 14)
4823 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004824 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08004825 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07004826 obj.xid = reader.read("!L")[0]
Rich Lanee2567702015-01-26 15:04:35 -08004827 obj.match = ofp.match.unpack(reader)
Dan Talaycof6202252013-07-02 01:00:29 -07004828 obj.cookie = reader.read("!Q")[0]
4829 __command = util.unpack_fm_cmd(reader)
4830 assert(__command == 3)
4831 obj.idle_timeout = reader.read("!H")[0]
4832 obj.hard_timeout = reader.read("!H")[0]
4833 obj.priority = reader.read("!H")[0]
4834 obj.buffer_id = reader.read("!L")[0]
4835 obj.out_port = util.unpack_port_no(reader)
4836 obj.flags = reader.read("!H")[0]
Rich Lanee2567702015-01-26 15:04:35 -08004837 obj.actions = loxi.generic_util.unpack_list(reader, ofp.action.action.unpack)
Rich Laneb658ddd2013-03-12 10:15:10 -07004838 return obj
4839
4840 def __eq__(self, other):
4841 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07004842 if self.xid != other.xid: return False
4843 if self.match != other.match: return False
4844 if self.cookie != other.cookie: return False
4845 if self.idle_timeout != other.idle_timeout: return False
4846 if self.hard_timeout != other.hard_timeout: return False
4847 if self.priority != other.priority: return False
4848 if self.buffer_id != other.buffer_id: return False
4849 if self.out_port != other.out_port: return False
4850 if self.flags != other.flags: return False
4851 if self.actions != other.actions: return False
4852 return True
4853
Rich Laneb658ddd2013-03-12 10:15:10 -07004854 def pretty_print(self, q):
4855 q.text("flow_delete {")
4856 with q.group():
4857 with q.indent(2):
4858 q.breakable()
4859 q.text("xid = ");
4860 if self.xid != None:
4861 q.text("%#x" % self.xid)
4862 else:
4863 q.text('None')
4864 q.text(","); q.breakable()
4865 q.text("match = ");
4866 q.pp(self.match)
4867 q.text(","); q.breakable()
4868 q.text("cookie = ");
4869 q.text("%#x" % self.cookie)
4870 q.text(","); q.breakable()
4871 q.text("idle_timeout = ");
4872 q.text("%#x" % self.idle_timeout)
4873 q.text(","); q.breakable()
4874 q.text("hard_timeout = ");
4875 q.text("%#x" % self.hard_timeout)
4876 q.text(","); q.breakable()
4877 q.text("priority = ");
4878 q.text("%#x" % self.priority)
4879 q.text(","); q.breakable()
4880 q.text("buffer_id = ");
4881 q.text("%#x" % self.buffer_id)
4882 q.text(","); q.breakable()
4883 q.text("out_port = ");
4884 q.text(util.pretty_port(self.out_port))
4885 q.text(","); q.breakable()
4886 q.text("flags = ");
4887 q.text("%#x" % self.flags)
4888 q.text(","); q.breakable()
4889 q.text("actions = ");
4890 q.pp(self.actions)
4891 q.breakable()
4892 q.text('}')
4893
Rich Lane7dcdf022013-12-11 14:45:27 -08004894flow_mod.subtypes[3] = flow_delete
4895
4896class flow_delete_strict(flow_mod):
Dan Talaycof6202252013-07-02 01:00:29 -07004897 version = 1
4898 type = 14
4899 _command = 4
Rich Laneb658ddd2013-03-12 10:15:10 -07004900
4901 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 -08004902 if xid != None:
4903 self.xid = xid
4904 else:
4905 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07004906 if match != None:
4907 self.match = match
4908 else:
Rich Lanee2567702015-01-26 15:04:35 -08004909 self.match = ofp.match()
Rich Laneb658ddd2013-03-12 10:15:10 -07004910 if cookie != None:
4911 self.cookie = cookie
4912 else:
4913 self.cookie = 0
4914 if idle_timeout != None:
4915 self.idle_timeout = idle_timeout
4916 else:
4917 self.idle_timeout = 0
4918 if hard_timeout != None:
4919 self.hard_timeout = hard_timeout
4920 else:
4921 self.hard_timeout = 0
4922 if priority != None:
4923 self.priority = priority
4924 else:
4925 self.priority = 0
4926 if buffer_id != None:
4927 self.buffer_id = buffer_id
4928 else:
4929 self.buffer_id = 0
4930 if out_port != None:
4931 self.out_port = out_port
4932 else:
4933 self.out_port = 0
4934 if flags != None:
4935 self.flags = flags
4936 else:
4937 self.flags = 0
4938 if actions != None:
4939 self.actions = actions
4940 else:
4941 self.actions = []
Rich Lane7dcdf022013-12-11 14:45:27 -08004942 return
Rich Laneb658ddd2013-03-12 10:15:10 -07004943
4944 def pack(self):
4945 packed = []
4946 packed.append(struct.pack("!B", self.version))
4947 packed.append(struct.pack("!B", self.type))
4948 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4949 packed.append(struct.pack("!L", self.xid))
4950 packed.append(self.match.pack())
4951 packed.append(struct.pack("!Q", self.cookie))
Dan Talaycof6202252013-07-02 01:00:29 -07004952 packed.append(util.pack_fm_cmd(self._command))
Rich Laneb658ddd2013-03-12 10:15:10 -07004953 packed.append(struct.pack("!H", self.idle_timeout))
4954 packed.append(struct.pack("!H", self.hard_timeout))
4955 packed.append(struct.pack("!H", self.priority))
4956 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -07004957 packed.append(util.pack_port_no(self.out_port))
Rich Laneb658ddd2013-03-12 10:15:10 -07004958 packed.append(struct.pack("!H", self.flags))
Rich Lane7dcdf022013-12-11 14:45:27 -08004959 packed.append(loxi.generic_util.pack_list(self.actions))
Rich Laneb658ddd2013-03-12 10:15:10 -07004960 length = sum([len(x) for x in packed])
4961 packed[2] = struct.pack("!H", length)
4962 return ''.join(packed)
4963
4964 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004965 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07004966 obj = flow_delete_strict()
Dan Talaycof6202252013-07-02 01:00:29 -07004967 _version = reader.read("!B")[0]
4968 assert(_version == 1)
4969 _type = reader.read("!B")[0]
4970 assert(_type == 14)
4971 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004972 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08004973 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07004974 obj.xid = reader.read("!L")[0]
Rich Lanee2567702015-01-26 15:04:35 -08004975 obj.match = ofp.match.unpack(reader)
Dan Talaycof6202252013-07-02 01:00:29 -07004976 obj.cookie = reader.read("!Q")[0]
4977 __command = util.unpack_fm_cmd(reader)
4978 assert(__command == 4)
4979 obj.idle_timeout = reader.read("!H")[0]
4980 obj.hard_timeout = reader.read("!H")[0]
4981 obj.priority = reader.read("!H")[0]
4982 obj.buffer_id = reader.read("!L")[0]
4983 obj.out_port = util.unpack_port_no(reader)
4984 obj.flags = reader.read("!H")[0]
Rich Lanee2567702015-01-26 15:04:35 -08004985 obj.actions = loxi.generic_util.unpack_list(reader, ofp.action.action.unpack)
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.match != other.match: return False
4992 if self.cookie != other.cookie: return False
4993 if self.idle_timeout != other.idle_timeout: return False
4994 if self.hard_timeout != other.hard_timeout: return False
4995 if self.priority != other.priority: return False
4996 if self.buffer_id != other.buffer_id: return False
4997 if self.out_port != other.out_port: return False
4998 if self.flags != other.flags: return False
4999 if self.actions != other.actions: return False
5000 return True
5001
Rich Laneb658ddd2013-03-12 10:15:10 -07005002 def pretty_print(self, q):
5003 q.text("flow_delete_strict {")
5004 with q.group():
5005 with q.indent(2):
5006 q.breakable()
5007 q.text("xid = ");
5008 if self.xid != None:
5009 q.text("%#x" % self.xid)
5010 else:
5011 q.text('None')
5012 q.text(","); q.breakable()
5013 q.text("match = ");
5014 q.pp(self.match)
5015 q.text(","); q.breakable()
5016 q.text("cookie = ");
5017 q.text("%#x" % self.cookie)
5018 q.text(","); q.breakable()
5019 q.text("idle_timeout = ");
5020 q.text("%#x" % self.idle_timeout)
5021 q.text(","); q.breakable()
5022 q.text("hard_timeout = ");
5023 q.text("%#x" % self.hard_timeout)
5024 q.text(","); q.breakable()
5025 q.text("priority = ");
5026 q.text("%#x" % self.priority)
5027 q.text(","); q.breakable()
5028 q.text("buffer_id = ");
5029 q.text("%#x" % self.buffer_id)
5030 q.text(","); q.breakable()
5031 q.text("out_port = ");
5032 q.text(util.pretty_port(self.out_port))
5033 q.text(","); q.breakable()
5034 q.text("flags = ");
5035 q.text("%#x" % self.flags)
5036 q.text(","); q.breakable()
5037 q.text("actions = ");
5038 q.pp(self.actions)
5039 q.breakable()
5040 q.text('}')
5041
Rich Lane7dcdf022013-12-11 14:45:27 -08005042flow_mod.subtypes[4] = flow_delete_strict
5043
5044class flow_mod_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -07005045 version = 1
5046 type = 1
5047 err_type = 3
5048
5049 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005050 if xid != None:
5051 self.xid = xid
5052 else:
5053 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07005054 if code != None:
5055 self.code = code
5056 else:
5057 self.code = 0
5058 if data != None:
5059 self.data = data
5060 else:
5061 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08005062 return
Rich Lane6f4978c2013-10-20 21:33:52 -07005063
5064 def pack(self):
5065 packed = []
5066 packed.append(struct.pack("!B", self.version))
5067 packed.append(struct.pack("!B", self.type))
5068 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5069 packed.append(struct.pack("!L", self.xid))
5070 packed.append(struct.pack("!H", self.err_type))
5071 packed.append(struct.pack("!H", self.code))
5072 packed.append(self.data)
5073 length = sum([len(x) for x in packed])
5074 packed[2] = struct.pack("!H", length)
5075 return ''.join(packed)
5076
5077 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005078 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07005079 obj = flow_mod_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -07005080 _version = reader.read("!B")[0]
5081 assert(_version == 1)
5082 _type = reader.read("!B")[0]
5083 assert(_type == 1)
5084 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005085 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08005086 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -07005087 obj.xid = reader.read("!L")[0]
5088 _err_type = reader.read("!H")[0]
5089 assert(_err_type == 3)
5090 obj.code = reader.read("!H")[0]
5091 obj.data = str(reader.read_all())
5092 return obj
5093
5094 def __eq__(self, other):
5095 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07005096 if self.xid != other.xid: return False
5097 if self.code != other.code: return False
5098 if self.data != other.data: return False
5099 return True
5100
Rich Lane6f4978c2013-10-20 21:33:52 -07005101 def pretty_print(self, q):
5102 q.text("flow_mod_failed_error_msg {")
5103 with q.group():
5104 with q.indent(2):
5105 q.breakable()
5106 q.text("xid = ");
5107 if self.xid != None:
5108 q.text("%#x" % self.xid)
5109 else:
5110 q.text('None')
5111 q.text(","); q.breakable()
5112 q.text("code = ");
5113 q.text("%#x" % self.code)
5114 q.text(","); q.breakable()
5115 q.text("data = ");
5116 q.pp(self.data)
5117 q.breakable()
5118 q.text('}')
5119
Rich Lane7dcdf022013-12-11 14:45:27 -08005120error_msg.subtypes[3] = flow_mod_failed_error_msg
5121
5122class flow_modify(flow_mod):
Dan Talaycof6202252013-07-02 01:00:29 -07005123 version = 1
5124 type = 14
5125 _command = 1
Rich Laneb658ddd2013-03-12 10:15:10 -07005126
5127 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 -08005128 if xid != None:
5129 self.xid = xid
5130 else:
5131 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07005132 if match != None:
5133 self.match = match
5134 else:
Rich Lanee2567702015-01-26 15:04:35 -08005135 self.match = ofp.match()
Rich Laneb658ddd2013-03-12 10:15:10 -07005136 if cookie != None:
5137 self.cookie = cookie
5138 else:
5139 self.cookie = 0
5140 if idle_timeout != None:
5141 self.idle_timeout = idle_timeout
5142 else:
5143 self.idle_timeout = 0
5144 if hard_timeout != None:
5145 self.hard_timeout = hard_timeout
5146 else:
5147 self.hard_timeout = 0
5148 if priority != None:
5149 self.priority = priority
5150 else:
5151 self.priority = 0
5152 if buffer_id != None:
5153 self.buffer_id = buffer_id
5154 else:
5155 self.buffer_id = 0
5156 if out_port != None:
5157 self.out_port = out_port
5158 else:
5159 self.out_port = 0
5160 if flags != None:
5161 self.flags = flags
5162 else:
5163 self.flags = 0
5164 if actions != None:
5165 self.actions = actions
5166 else:
5167 self.actions = []
Rich Lane7dcdf022013-12-11 14:45:27 -08005168 return
Rich Laneb658ddd2013-03-12 10:15:10 -07005169
5170 def pack(self):
5171 packed = []
5172 packed.append(struct.pack("!B", self.version))
5173 packed.append(struct.pack("!B", self.type))
5174 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5175 packed.append(struct.pack("!L", self.xid))
5176 packed.append(self.match.pack())
5177 packed.append(struct.pack("!Q", self.cookie))
Dan Talaycof6202252013-07-02 01:00:29 -07005178 packed.append(util.pack_fm_cmd(self._command))
Rich Laneb658ddd2013-03-12 10:15:10 -07005179 packed.append(struct.pack("!H", self.idle_timeout))
5180 packed.append(struct.pack("!H", self.hard_timeout))
5181 packed.append(struct.pack("!H", self.priority))
5182 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -07005183 packed.append(util.pack_port_no(self.out_port))
Rich Laneb658ddd2013-03-12 10:15:10 -07005184 packed.append(struct.pack("!H", self.flags))
Rich Lane7dcdf022013-12-11 14:45:27 -08005185 packed.append(loxi.generic_util.pack_list(self.actions))
Rich Laneb658ddd2013-03-12 10:15:10 -07005186 length = sum([len(x) for x in packed])
5187 packed[2] = struct.pack("!H", length)
5188 return ''.join(packed)
5189
5190 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005191 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07005192 obj = flow_modify()
Dan Talaycof6202252013-07-02 01:00:29 -07005193 _version = reader.read("!B")[0]
5194 assert(_version == 1)
5195 _type = reader.read("!B")[0]
5196 assert(_type == 14)
5197 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005198 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08005199 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07005200 obj.xid = reader.read("!L")[0]
Rich Lanee2567702015-01-26 15:04:35 -08005201 obj.match = ofp.match.unpack(reader)
Dan Talaycof6202252013-07-02 01:00:29 -07005202 obj.cookie = reader.read("!Q")[0]
5203 __command = util.unpack_fm_cmd(reader)
5204 assert(__command == 1)
5205 obj.idle_timeout = reader.read("!H")[0]
5206 obj.hard_timeout = reader.read("!H")[0]
5207 obj.priority = reader.read("!H")[0]
5208 obj.buffer_id = reader.read("!L")[0]
5209 obj.out_port = util.unpack_port_no(reader)
5210 obj.flags = reader.read("!H")[0]
Rich Lanee2567702015-01-26 15:04:35 -08005211 obj.actions = loxi.generic_util.unpack_list(reader, ofp.action.action.unpack)
Rich Laneb658ddd2013-03-12 10:15:10 -07005212 return obj
5213
5214 def __eq__(self, other):
5215 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07005216 if self.xid != other.xid: return False
5217 if self.match != other.match: return False
5218 if self.cookie != other.cookie: return False
5219 if self.idle_timeout != other.idle_timeout: return False
5220 if self.hard_timeout != other.hard_timeout: return False
5221 if self.priority != other.priority: return False
5222 if self.buffer_id != other.buffer_id: return False
5223 if self.out_port != other.out_port: return False
5224 if self.flags != other.flags: return False
5225 if self.actions != other.actions: return False
5226 return True
5227
Rich Laneb658ddd2013-03-12 10:15:10 -07005228 def pretty_print(self, q):
5229 q.text("flow_modify {")
5230 with q.group():
5231 with q.indent(2):
5232 q.breakable()
5233 q.text("xid = ");
5234 if self.xid != None:
5235 q.text("%#x" % self.xid)
5236 else:
5237 q.text('None')
5238 q.text(","); q.breakable()
5239 q.text("match = ");
5240 q.pp(self.match)
5241 q.text(","); q.breakable()
5242 q.text("cookie = ");
5243 q.text("%#x" % self.cookie)
5244 q.text(","); q.breakable()
5245 q.text("idle_timeout = ");
5246 q.text("%#x" % self.idle_timeout)
5247 q.text(","); q.breakable()
5248 q.text("hard_timeout = ");
5249 q.text("%#x" % self.hard_timeout)
5250 q.text(","); q.breakable()
5251 q.text("priority = ");
5252 q.text("%#x" % self.priority)
5253 q.text(","); q.breakable()
5254 q.text("buffer_id = ");
5255 q.text("%#x" % self.buffer_id)
5256 q.text(","); q.breakable()
5257 q.text("out_port = ");
5258 q.text(util.pretty_port(self.out_port))
5259 q.text(","); q.breakable()
5260 q.text("flags = ");
5261 q.text("%#x" % self.flags)
5262 q.text(","); q.breakable()
5263 q.text("actions = ");
5264 q.pp(self.actions)
5265 q.breakable()
5266 q.text('}')
5267
Rich Lane7dcdf022013-12-11 14:45:27 -08005268flow_mod.subtypes[1] = flow_modify
5269
5270class flow_modify_strict(flow_mod):
Dan Talaycof6202252013-07-02 01:00:29 -07005271 version = 1
5272 type = 14
5273 _command = 2
Rich Laneb658ddd2013-03-12 10:15:10 -07005274
5275 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 -08005276 if xid != None:
5277 self.xid = xid
5278 else:
5279 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07005280 if match != None:
5281 self.match = match
5282 else:
Rich Lanee2567702015-01-26 15:04:35 -08005283 self.match = ofp.match()
Rich Laneb658ddd2013-03-12 10:15:10 -07005284 if cookie != None:
5285 self.cookie = cookie
5286 else:
5287 self.cookie = 0
5288 if idle_timeout != None:
5289 self.idle_timeout = idle_timeout
5290 else:
5291 self.idle_timeout = 0
5292 if hard_timeout != None:
5293 self.hard_timeout = hard_timeout
5294 else:
5295 self.hard_timeout = 0
5296 if priority != None:
5297 self.priority = priority
5298 else:
5299 self.priority = 0
5300 if buffer_id != None:
5301 self.buffer_id = buffer_id
5302 else:
5303 self.buffer_id = 0
5304 if out_port != None:
5305 self.out_port = out_port
5306 else:
5307 self.out_port = 0
5308 if flags != None:
5309 self.flags = flags
5310 else:
5311 self.flags = 0
5312 if actions != None:
5313 self.actions = actions
5314 else:
5315 self.actions = []
Rich Lane7dcdf022013-12-11 14:45:27 -08005316 return
Rich Laneb658ddd2013-03-12 10:15:10 -07005317
5318 def pack(self):
5319 packed = []
5320 packed.append(struct.pack("!B", self.version))
5321 packed.append(struct.pack("!B", self.type))
5322 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5323 packed.append(struct.pack("!L", self.xid))
5324 packed.append(self.match.pack())
5325 packed.append(struct.pack("!Q", self.cookie))
Dan Talaycof6202252013-07-02 01:00:29 -07005326 packed.append(util.pack_fm_cmd(self._command))
Rich Laneb658ddd2013-03-12 10:15:10 -07005327 packed.append(struct.pack("!H", self.idle_timeout))
5328 packed.append(struct.pack("!H", self.hard_timeout))
5329 packed.append(struct.pack("!H", self.priority))
5330 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -07005331 packed.append(util.pack_port_no(self.out_port))
Rich Laneb658ddd2013-03-12 10:15:10 -07005332 packed.append(struct.pack("!H", self.flags))
Rich Lane7dcdf022013-12-11 14:45:27 -08005333 packed.append(loxi.generic_util.pack_list(self.actions))
Rich Laneb658ddd2013-03-12 10:15:10 -07005334 length = sum([len(x) for x in packed])
5335 packed[2] = struct.pack("!H", length)
5336 return ''.join(packed)
5337
5338 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005339 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07005340 obj = flow_modify_strict()
Dan Talaycof6202252013-07-02 01:00:29 -07005341 _version = reader.read("!B")[0]
5342 assert(_version == 1)
5343 _type = reader.read("!B")[0]
5344 assert(_type == 14)
5345 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005346 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08005347 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07005348 obj.xid = reader.read("!L")[0]
Rich Lanee2567702015-01-26 15:04:35 -08005349 obj.match = ofp.match.unpack(reader)
Dan Talaycof6202252013-07-02 01:00:29 -07005350 obj.cookie = reader.read("!Q")[0]
5351 __command = util.unpack_fm_cmd(reader)
5352 assert(__command == 2)
5353 obj.idle_timeout = reader.read("!H")[0]
5354 obj.hard_timeout = reader.read("!H")[0]
5355 obj.priority = reader.read("!H")[0]
5356 obj.buffer_id = reader.read("!L")[0]
5357 obj.out_port = util.unpack_port_no(reader)
5358 obj.flags = reader.read("!H")[0]
Rich Lanee2567702015-01-26 15:04:35 -08005359 obj.actions = loxi.generic_util.unpack_list(reader, ofp.action.action.unpack)
Rich Laneb658ddd2013-03-12 10:15:10 -07005360 return obj
5361
5362 def __eq__(self, other):
5363 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07005364 if self.xid != other.xid: return False
5365 if self.match != other.match: return False
5366 if self.cookie != other.cookie: return False
5367 if self.idle_timeout != other.idle_timeout: return False
5368 if self.hard_timeout != other.hard_timeout: return False
5369 if self.priority != other.priority: return False
5370 if self.buffer_id != other.buffer_id: return False
5371 if self.out_port != other.out_port: return False
5372 if self.flags != other.flags: return False
5373 if self.actions != other.actions: return False
5374 return True
5375
Rich Laneb658ddd2013-03-12 10:15:10 -07005376 def pretty_print(self, q):
5377 q.text("flow_modify_strict {")
5378 with q.group():
5379 with q.indent(2):
5380 q.breakable()
5381 q.text("xid = ");
5382 if self.xid != None:
5383 q.text("%#x" % self.xid)
5384 else:
5385 q.text('None')
5386 q.text(","); q.breakable()
5387 q.text("match = ");
5388 q.pp(self.match)
5389 q.text(","); q.breakable()
5390 q.text("cookie = ");
5391 q.text("%#x" % self.cookie)
5392 q.text(","); q.breakable()
5393 q.text("idle_timeout = ");
5394 q.text("%#x" % self.idle_timeout)
5395 q.text(","); q.breakable()
5396 q.text("hard_timeout = ");
5397 q.text("%#x" % self.hard_timeout)
5398 q.text(","); q.breakable()
5399 q.text("priority = ");
5400 q.text("%#x" % self.priority)
5401 q.text(","); q.breakable()
5402 q.text("buffer_id = ");
5403 q.text("%#x" % self.buffer_id)
5404 q.text(","); q.breakable()
5405 q.text("out_port = ");
5406 q.text(util.pretty_port(self.out_port))
5407 q.text(","); q.breakable()
5408 q.text("flags = ");
5409 q.text("%#x" % self.flags)
5410 q.text(","); q.breakable()
5411 q.text("actions = ");
5412 q.pp(self.actions)
5413 q.breakable()
5414 q.text('}')
5415
Rich Lane7dcdf022013-12-11 14:45:27 -08005416flow_mod.subtypes[2] = flow_modify_strict
5417
5418class flow_removed(message):
Dan Talaycof6202252013-07-02 01:00:29 -07005419 version = 1
5420 type = 11
Rich Laneb658ddd2013-03-12 10:15:10 -07005421
Rich Lanec2ee4b82013-04-24 17:12:38 -07005422 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 -08005423 if xid != None:
5424 self.xid = xid
5425 else:
5426 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07005427 if match != None:
5428 self.match = match
5429 else:
Rich Lanee2567702015-01-26 15:04:35 -08005430 self.match = ofp.match()
Rich Laneb658ddd2013-03-12 10:15:10 -07005431 if cookie != None:
5432 self.cookie = cookie
5433 else:
5434 self.cookie = 0
5435 if priority != None:
5436 self.priority = priority
5437 else:
5438 self.priority = 0
5439 if reason != None:
5440 self.reason = reason
5441 else:
5442 self.reason = 0
Rich Laneb658ddd2013-03-12 10:15:10 -07005443 if duration_sec != None:
5444 self.duration_sec = duration_sec
5445 else:
5446 self.duration_sec = 0
5447 if duration_nsec != None:
5448 self.duration_nsec = duration_nsec
5449 else:
5450 self.duration_nsec = 0
5451 if idle_timeout != None:
5452 self.idle_timeout = idle_timeout
5453 else:
5454 self.idle_timeout = 0
Rich Laneb658ddd2013-03-12 10:15:10 -07005455 if packet_count != None:
5456 self.packet_count = packet_count
5457 else:
5458 self.packet_count = 0
5459 if byte_count != None:
5460 self.byte_count = byte_count
5461 else:
5462 self.byte_count = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08005463 return
Rich Laneb658ddd2013-03-12 10:15:10 -07005464
5465 def pack(self):
5466 packed = []
5467 packed.append(struct.pack("!B", self.version))
5468 packed.append(struct.pack("!B", self.type))
5469 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5470 packed.append(struct.pack("!L", self.xid))
5471 packed.append(self.match.pack())
5472 packed.append(struct.pack("!Q", self.cookie))
5473 packed.append(struct.pack("!H", self.priority))
5474 packed.append(struct.pack("!B", self.reason))
Rich Lanec2ee4b82013-04-24 17:12:38 -07005475 packed.append('\x00' * 1)
Rich Laneb658ddd2013-03-12 10:15:10 -07005476 packed.append(struct.pack("!L", self.duration_sec))
5477 packed.append(struct.pack("!L", self.duration_nsec))
5478 packed.append(struct.pack("!H", self.idle_timeout))
Rich Lanec2ee4b82013-04-24 17:12:38 -07005479 packed.append('\x00' * 2)
Rich Laneb658ddd2013-03-12 10:15:10 -07005480 packed.append(struct.pack("!Q", self.packet_count))
5481 packed.append(struct.pack("!Q", self.byte_count))
5482 length = sum([len(x) for x in packed])
5483 packed[2] = struct.pack("!H", length)
5484 return ''.join(packed)
5485
5486 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005487 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07005488 obj = flow_removed()
Dan Talaycof6202252013-07-02 01:00:29 -07005489 _version = reader.read("!B")[0]
5490 assert(_version == 1)
5491 _type = reader.read("!B")[0]
5492 assert(_type == 11)
5493 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005494 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08005495 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07005496 obj.xid = reader.read("!L")[0]
Rich Lanee2567702015-01-26 15:04:35 -08005497 obj.match = ofp.match.unpack(reader)
Dan Talaycof6202252013-07-02 01:00:29 -07005498 obj.cookie = reader.read("!Q")[0]
5499 obj.priority = reader.read("!H")[0]
5500 obj.reason = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07005501 reader.skip(1)
Dan Talaycof6202252013-07-02 01:00:29 -07005502 obj.duration_sec = reader.read("!L")[0]
5503 obj.duration_nsec = reader.read("!L")[0]
5504 obj.idle_timeout = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07005505 reader.skip(2)
Dan Talaycof6202252013-07-02 01:00:29 -07005506 obj.packet_count = reader.read("!Q")[0]
5507 obj.byte_count = reader.read("!Q")[0]
Rich Laneb658ddd2013-03-12 10:15:10 -07005508 return obj
5509
5510 def __eq__(self, other):
5511 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07005512 if self.xid != other.xid: return False
5513 if self.match != other.match: return False
5514 if self.cookie != other.cookie: return False
5515 if self.priority != other.priority: return False
5516 if self.reason != other.reason: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07005517 if self.duration_sec != other.duration_sec: return False
5518 if self.duration_nsec != other.duration_nsec: return False
5519 if self.idle_timeout != other.idle_timeout: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07005520 if self.packet_count != other.packet_count: return False
5521 if self.byte_count != other.byte_count: return False
5522 return True
5523
Rich Laneb658ddd2013-03-12 10:15:10 -07005524 def pretty_print(self, q):
5525 q.text("flow_removed {")
5526 with q.group():
5527 with q.indent(2):
5528 q.breakable()
5529 q.text("xid = ");
5530 if self.xid != None:
5531 q.text("%#x" % self.xid)
5532 else:
5533 q.text('None')
5534 q.text(","); q.breakable()
5535 q.text("match = ");
5536 q.pp(self.match)
5537 q.text(","); q.breakable()
5538 q.text("cookie = ");
5539 q.text("%#x" % self.cookie)
5540 q.text(","); q.breakable()
5541 q.text("priority = ");
5542 q.text("%#x" % self.priority)
5543 q.text(","); q.breakable()
5544 q.text("reason = ");
5545 q.text("%#x" % self.reason)
5546 q.text(","); q.breakable()
Rich Laneb658ddd2013-03-12 10:15:10 -07005547 q.text("duration_sec = ");
5548 q.text("%#x" % self.duration_sec)
5549 q.text(","); q.breakable()
5550 q.text("duration_nsec = ");
5551 q.text("%#x" % self.duration_nsec)
5552 q.text(","); q.breakable()
5553 q.text("idle_timeout = ");
5554 q.text("%#x" % self.idle_timeout)
5555 q.text(","); q.breakable()
Rich Laneb658ddd2013-03-12 10:15:10 -07005556 q.text("packet_count = ");
5557 q.text("%#x" % self.packet_count)
5558 q.text(","); q.breakable()
5559 q.text("byte_count = ");
5560 q.text("%#x" % self.byte_count)
5561 q.breakable()
5562 q.text('}')
5563
Rich Lane7dcdf022013-12-11 14:45:27 -08005564message.subtypes[11] = flow_removed
5565
5566class flow_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -07005567 version = 1
5568 type = 17
5569 stats_type = 1
Rich Laneb658ddd2013-03-12 10:15:10 -07005570
5571 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005572 if xid != None:
5573 self.xid = xid
5574 else:
5575 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07005576 if flags != None:
5577 self.flags = flags
5578 else:
5579 self.flags = 0
5580 if entries != None:
5581 self.entries = entries
5582 else:
5583 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -08005584 return
Rich Laneb658ddd2013-03-12 10:15:10 -07005585
5586 def pack(self):
5587 packed = []
5588 packed.append(struct.pack("!B", self.version))
5589 packed.append(struct.pack("!B", self.type))
5590 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5591 packed.append(struct.pack("!L", self.xid))
5592 packed.append(struct.pack("!H", self.stats_type))
5593 packed.append(struct.pack("!H", self.flags))
Rich Lane7dcdf022013-12-11 14:45:27 -08005594 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Laneb658ddd2013-03-12 10:15:10 -07005595 length = sum([len(x) for x in packed])
5596 packed[2] = struct.pack("!H", length)
5597 return ''.join(packed)
5598
5599 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005600 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07005601 obj = flow_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07005602 _version = reader.read("!B")[0]
5603 assert(_version == 1)
5604 _type = reader.read("!B")[0]
5605 assert(_type == 17)
5606 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005607 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08005608 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07005609 obj.xid = reader.read("!L")[0]
5610 _stats_type = reader.read("!H")[0]
5611 assert(_stats_type == 1)
5612 obj.flags = reader.read("!H")[0]
Rich Lanee2567702015-01-26 15:04:35 -08005613 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.flow_stats_entry.unpack)
Rich Laneb658ddd2013-03-12 10:15:10 -07005614 return obj
5615
5616 def __eq__(self, other):
5617 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07005618 if self.xid != other.xid: return False
5619 if self.flags != other.flags: return False
5620 if self.entries != other.entries: return False
5621 return True
5622
Rich Laneb658ddd2013-03-12 10:15:10 -07005623 def pretty_print(self, q):
5624 q.text("flow_stats_reply {")
5625 with q.group():
5626 with q.indent(2):
5627 q.breakable()
5628 q.text("xid = ");
5629 if self.xid != None:
5630 q.text("%#x" % self.xid)
5631 else:
5632 q.text('None')
5633 q.text(","); q.breakable()
5634 q.text("flags = ");
5635 q.text("%#x" % self.flags)
5636 q.text(","); q.breakable()
5637 q.text("entries = ");
5638 q.pp(self.entries)
5639 q.breakable()
5640 q.text('}')
5641
Rich Lane7dcdf022013-12-11 14:45:27 -08005642stats_reply.subtypes[1] = flow_stats_reply
5643
5644class flow_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -07005645 version = 1
5646 type = 16
5647 stats_type = 1
Rich Laneb658ddd2013-03-12 10:15:10 -07005648
Rich Lanec2ee4b82013-04-24 17:12:38 -07005649 def __init__(self, xid=None, flags=None, match=None, table_id=None, out_port=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005650 if xid != None:
5651 self.xid = xid
5652 else:
5653 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07005654 if flags != None:
5655 self.flags = flags
5656 else:
5657 self.flags = 0
5658 if match != None:
5659 self.match = match
5660 else:
Rich Lanee2567702015-01-26 15:04:35 -08005661 self.match = ofp.match()
Rich Laneb658ddd2013-03-12 10:15:10 -07005662 if table_id != None:
5663 self.table_id = table_id
5664 else:
5665 self.table_id = 0
Rich Laneb658ddd2013-03-12 10:15:10 -07005666 if out_port != None:
5667 self.out_port = out_port
5668 else:
5669 self.out_port = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08005670 return
Rich Laneb658ddd2013-03-12 10:15:10 -07005671
5672 def pack(self):
5673 packed = []
5674 packed.append(struct.pack("!B", self.version))
5675 packed.append(struct.pack("!B", self.type))
5676 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5677 packed.append(struct.pack("!L", self.xid))
5678 packed.append(struct.pack("!H", self.stats_type))
5679 packed.append(struct.pack("!H", self.flags))
5680 packed.append(self.match.pack())
5681 packed.append(struct.pack("!B", self.table_id))
Rich Lanec2ee4b82013-04-24 17:12:38 -07005682 packed.append('\x00' * 1)
Dan Talaycof6202252013-07-02 01:00:29 -07005683 packed.append(util.pack_port_no(self.out_port))
Rich Laneb658ddd2013-03-12 10:15:10 -07005684 length = sum([len(x) for x in packed])
5685 packed[2] = struct.pack("!H", length)
5686 return ''.join(packed)
5687
5688 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005689 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07005690 obj = flow_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -07005691 _version = reader.read("!B")[0]
5692 assert(_version == 1)
5693 _type = reader.read("!B")[0]
5694 assert(_type == 16)
5695 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005696 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08005697 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07005698 obj.xid = reader.read("!L")[0]
5699 _stats_type = reader.read("!H")[0]
5700 assert(_stats_type == 1)
5701 obj.flags = reader.read("!H")[0]
Rich Lanee2567702015-01-26 15:04:35 -08005702 obj.match = ofp.match.unpack(reader)
Dan Talaycof6202252013-07-02 01:00:29 -07005703 obj.table_id = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07005704 reader.skip(1)
Dan Talaycof6202252013-07-02 01:00:29 -07005705 obj.out_port = util.unpack_port_no(reader)
Rich Laneb658ddd2013-03-12 10:15:10 -07005706 return obj
5707
5708 def __eq__(self, other):
5709 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07005710 if self.xid != other.xid: return False
5711 if self.flags != other.flags: return False
5712 if self.match != other.match: return False
5713 if self.table_id != other.table_id: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07005714 if self.out_port != other.out_port: return False
5715 return True
5716
Rich Laneb658ddd2013-03-12 10:15:10 -07005717 def pretty_print(self, q):
5718 q.text("flow_stats_request {")
5719 with q.group():
5720 with q.indent(2):
5721 q.breakable()
5722 q.text("xid = ");
5723 if self.xid != None:
5724 q.text("%#x" % self.xid)
5725 else:
5726 q.text('None')
5727 q.text(","); q.breakable()
5728 q.text("flags = ");
5729 q.text("%#x" % self.flags)
5730 q.text(","); q.breakable()
5731 q.text("match = ");
5732 q.pp(self.match)
5733 q.text(","); q.breakable()
5734 q.text("table_id = ");
5735 q.text("%#x" % self.table_id)
5736 q.text(","); q.breakable()
Rich Laneb658ddd2013-03-12 10:15:10 -07005737 q.text("out_port = ");
5738 q.text(util.pretty_port(self.out_port))
5739 q.breakable()
5740 q.text('}')
5741
Rich Lane7dcdf022013-12-11 14:45:27 -08005742stats_request.subtypes[1] = flow_stats_request
5743
5744class get_config_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -07005745 version = 1
5746 type = 8
Rich Laneb658ddd2013-03-12 10:15:10 -07005747
5748 def __init__(self, xid=None, flags=None, miss_send_len=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005749 if xid != None:
5750 self.xid = xid
5751 else:
5752 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07005753 if flags != None:
5754 self.flags = flags
5755 else:
5756 self.flags = 0
5757 if miss_send_len != None:
5758 self.miss_send_len = miss_send_len
5759 else:
5760 self.miss_send_len = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08005761 return
Rich Laneb658ddd2013-03-12 10:15:10 -07005762
5763 def pack(self):
5764 packed = []
5765 packed.append(struct.pack("!B", self.version))
5766 packed.append(struct.pack("!B", self.type))
5767 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5768 packed.append(struct.pack("!L", self.xid))
5769 packed.append(struct.pack("!H", self.flags))
5770 packed.append(struct.pack("!H", self.miss_send_len))
5771 length = sum([len(x) for x in packed])
5772 packed[2] = struct.pack("!H", length)
5773 return ''.join(packed)
5774
5775 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005776 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07005777 obj = get_config_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07005778 _version = reader.read("!B")[0]
5779 assert(_version == 1)
5780 _type = reader.read("!B")[0]
5781 assert(_type == 8)
5782 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005783 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08005784 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07005785 obj.xid = reader.read("!L")[0]
5786 obj.flags = reader.read("!H")[0]
5787 obj.miss_send_len = reader.read("!H")[0]
Rich Laneb658ddd2013-03-12 10:15:10 -07005788 return obj
5789
5790 def __eq__(self, other):
5791 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07005792 if self.xid != other.xid: return False
5793 if self.flags != other.flags: return False
5794 if self.miss_send_len != other.miss_send_len: return False
5795 return True
5796
Rich Laneb658ddd2013-03-12 10:15:10 -07005797 def pretty_print(self, q):
5798 q.text("get_config_reply {")
5799 with q.group():
5800 with q.indent(2):
5801 q.breakable()
5802 q.text("xid = ");
5803 if self.xid != None:
5804 q.text("%#x" % self.xid)
5805 else:
5806 q.text('None')
5807 q.text(","); q.breakable()
5808 q.text("flags = ");
5809 q.text("%#x" % self.flags)
5810 q.text(","); q.breakable()
5811 q.text("miss_send_len = ");
5812 q.text("%#x" % self.miss_send_len)
5813 q.breakable()
5814 q.text('}')
5815
Rich Lane7dcdf022013-12-11 14:45:27 -08005816message.subtypes[8] = get_config_reply
5817
5818class get_config_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -07005819 version = 1
5820 type = 7
Rich Laneb658ddd2013-03-12 10:15:10 -07005821
5822 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005823 if xid != None:
5824 self.xid = xid
5825 else:
5826 self.xid = None
5827 return
Rich Laneb658ddd2013-03-12 10:15:10 -07005828
5829 def pack(self):
5830 packed = []
5831 packed.append(struct.pack("!B", self.version))
5832 packed.append(struct.pack("!B", self.type))
5833 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5834 packed.append(struct.pack("!L", self.xid))
5835 length = sum([len(x) for x in packed])
5836 packed[2] = struct.pack("!H", length)
5837 return ''.join(packed)
5838
5839 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005840 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07005841 obj = get_config_request()
Dan Talaycof6202252013-07-02 01:00:29 -07005842 _version = reader.read("!B")[0]
5843 assert(_version == 1)
5844 _type = reader.read("!B")[0]
5845 assert(_type == 7)
5846 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005847 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08005848 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07005849 obj.xid = reader.read("!L")[0]
Rich Laneb658ddd2013-03-12 10:15:10 -07005850 return obj
5851
5852 def __eq__(self, other):
5853 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07005854 if self.xid != other.xid: return False
5855 return True
5856
Rich Laneb658ddd2013-03-12 10:15:10 -07005857 def pretty_print(self, q):
5858 q.text("get_config_request {")
5859 with q.group():
5860 with q.indent(2):
5861 q.breakable()
5862 q.text("xid = ");
5863 if self.xid != None:
5864 q.text("%#x" % self.xid)
5865 else:
5866 q.text('None')
5867 q.breakable()
5868 q.text('}')
5869
Rich Lane7dcdf022013-12-11 14:45:27 -08005870message.subtypes[7] = get_config_request
5871
5872class hello(message):
Dan Talaycof6202252013-07-02 01:00:29 -07005873 version = 1
5874 type = 0
Rich Laneb658ddd2013-03-12 10:15:10 -07005875
5876 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005877 if xid != None:
5878 self.xid = xid
5879 else:
5880 self.xid = None
5881 return
Rich Laneb658ddd2013-03-12 10:15:10 -07005882
5883 def pack(self):
5884 packed = []
5885 packed.append(struct.pack("!B", self.version))
5886 packed.append(struct.pack("!B", self.type))
5887 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5888 packed.append(struct.pack("!L", self.xid))
5889 length = sum([len(x) for x in packed])
5890 packed[2] = struct.pack("!H", length)
5891 return ''.join(packed)
5892
5893 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005894 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07005895 obj = hello()
Dan Talaycof6202252013-07-02 01:00:29 -07005896 _version = reader.read("!B")[0]
5897 assert(_version == 1)
5898 _type = reader.read("!B")[0]
5899 assert(_type == 0)
5900 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005901 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08005902 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07005903 obj.xid = reader.read("!L")[0]
Rich Laneb658ddd2013-03-12 10:15:10 -07005904 return obj
5905
5906 def __eq__(self, other):
5907 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07005908 if self.xid != other.xid: return False
5909 return True
5910
Rich Laneb658ddd2013-03-12 10:15:10 -07005911 def pretty_print(self, q):
5912 q.text("hello {")
5913 with q.group():
5914 with q.indent(2):
5915 q.breakable()
5916 q.text("xid = ");
5917 if self.xid != None:
5918 q.text("%#x" % self.xid)
5919 else:
5920 q.text('None')
5921 q.breakable()
5922 q.text('}')
5923
Rich Lane7dcdf022013-12-11 14:45:27 -08005924message.subtypes[0] = hello
5925
5926class hello_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -07005927 version = 1
5928 type = 1
5929 err_type = 0
5930
5931 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005932 if xid != None:
5933 self.xid = xid
5934 else:
5935 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07005936 if code != None:
5937 self.code = code
5938 else:
5939 self.code = 0
5940 if data != None:
5941 self.data = data
5942 else:
5943 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08005944 return
Rich Lane6f4978c2013-10-20 21:33:52 -07005945
5946 def pack(self):
5947 packed = []
5948 packed.append(struct.pack("!B", self.version))
5949 packed.append(struct.pack("!B", self.type))
5950 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5951 packed.append(struct.pack("!L", self.xid))
5952 packed.append(struct.pack("!H", self.err_type))
5953 packed.append(struct.pack("!H", self.code))
5954 packed.append(self.data)
5955 length = sum([len(x) for x in packed])
5956 packed[2] = struct.pack("!H", length)
5957 return ''.join(packed)
5958
5959 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005960 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07005961 obj = hello_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -07005962 _version = reader.read("!B")[0]
5963 assert(_version == 1)
5964 _type = reader.read("!B")[0]
5965 assert(_type == 1)
5966 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005967 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08005968 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -07005969 obj.xid = reader.read("!L")[0]
5970 _err_type = reader.read("!H")[0]
5971 assert(_err_type == 0)
5972 obj.code = reader.read("!H")[0]
5973 obj.data = str(reader.read_all())
5974 return obj
5975
5976 def __eq__(self, other):
5977 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07005978 if self.xid != other.xid: return False
5979 if self.code != other.code: return False
5980 if self.data != other.data: return False
5981 return True
5982
Rich Lane6f4978c2013-10-20 21:33:52 -07005983 def pretty_print(self, q):
5984 q.text("hello_failed_error_msg {")
5985 with q.group():
5986 with q.indent(2):
5987 q.breakable()
5988 q.text("xid = ");
5989 if self.xid != None:
5990 q.text("%#x" % self.xid)
5991 else:
5992 q.text('None')
5993 q.text(","); q.breakable()
5994 q.text("code = ");
5995 q.text("%#x" % self.code)
5996 q.text(","); q.breakable()
5997 q.text("data = ");
5998 q.pp(self.data)
5999 q.breakable()
6000 q.text('}')
6001
Rich Lane7dcdf022013-12-11 14:45:27 -08006002error_msg.subtypes[0] = hello_failed_error_msg
6003
6004class nicira_header(experimenter):
6005 subtypes = {}
6006
Rich Lane95f7fc92014-01-27 17:08:16 -08006007 version = 1
6008 type = 4
6009 experimenter = 8992
6010
6011 def __init__(self, xid=None, subtype=None):
6012 if xid != None:
6013 self.xid = xid
6014 else:
6015 self.xid = None
6016 if subtype != None:
6017 self.subtype = subtype
6018 else:
6019 self.subtype = 0
6020 return
6021
6022 def pack(self):
6023 packed = []
6024 packed.append(struct.pack("!B", self.version))
6025 packed.append(struct.pack("!B", self.type))
6026 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6027 packed.append(struct.pack("!L", self.xid))
6028 packed.append(struct.pack("!L", self.experimenter))
6029 packed.append(struct.pack("!L", self.subtype))
6030 length = sum([len(x) for x in packed])
6031 packed[2] = struct.pack("!H", length)
6032 return ''.join(packed)
6033
Rich Lane7dcdf022013-12-11 14:45:27 -08006034 @staticmethod
6035 def unpack(reader):
6036 subtype, = reader.peek('!L', 12)
Rich Lane95f7fc92014-01-27 17:08:16 -08006037 subclass = nicira_header.subtypes.get(subtype)
6038 if subclass:
6039 return subclass.unpack(reader)
6040
6041 obj = nicira_header()
6042 _version = reader.read("!B")[0]
6043 assert(_version == 1)
6044 _type = reader.read("!B")[0]
6045 assert(_type == 4)
6046 _length = reader.read("!H")[0]
6047 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006048 reader = orig_reader.slice(_length, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -08006049 obj.xid = reader.read("!L")[0]
6050 _experimenter = reader.read("!L")[0]
6051 assert(_experimenter == 8992)
6052 obj.subtype = reader.read("!L")[0]
6053 return obj
6054
6055 def __eq__(self, other):
6056 if type(self) != type(other): return False
6057 if self.xid != other.xid: return False
6058 if self.subtype != other.subtype: return False
6059 return True
6060
6061 def pretty_print(self, q):
6062 q.text("nicira_header {")
6063 with q.group():
6064 with q.indent(2):
6065 q.breakable()
6066 q.text("xid = ");
6067 if self.xid != None:
6068 q.text("%#x" % self.xid)
6069 else:
6070 q.text('None')
6071 q.breakable()
6072 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -08006073
6074experimenter.subtypes[8992] = nicira_header
6075
6076class nicira_controller_role_reply(nicira_header):
Dan Talaycof6202252013-07-02 01:00:29 -07006077 version = 1
6078 type = 4
6079 experimenter = 8992
Rich Laneb658ddd2013-03-12 10:15:10 -07006080 subtype = 11
6081
6082 def __init__(self, xid=None, role=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006083 if xid != None:
6084 self.xid = xid
6085 else:
6086 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07006087 if role != None:
6088 self.role = role
6089 else:
6090 self.role = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08006091 return
Rich Laneb658ddd2013-03-12 10:15:10 -07006092
6093 def pack(self):
6094 packed = []
6095 packed.append(struct.pack("!B", self.version))
6096 packed.append(struct.pack("!B", self.type))
6097 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6098 packed.append(struct.pack("!L", self.xid))
6099 packed.append(struct.pack("!L", self.experimenter))
6100 packed.append(struct.pack("!L", self.subtype))
6101 packed.append(struct.pack("!L", self.role))
6102 length = sum([len(x) for x in packed])
6103 packed[2] = struct.pack("!H", length)
6104 return ''.join(packed)
6105
6106 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006107 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07006108 obj = nicira_controller_role_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07006109 _version = reader.read("!B")[0]
6110 assert(_version == 1)
6111 _type = reader.read("!B")[0]
6112 assert(_type == 4)
6113 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006114 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006115 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07006116 obj.xid = reader.read("!L")[0]
6117 _experimenter = reader.read("!L")[0]
6118 assert(_experimenter == 8992)
6119 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07006120 assert(_subtype == 11)
Dan Talaycof6202252013-07-02 01:00:29 -07006121 obj.role = reader.read("!L")[0]
Rich Laneb658ddd2013-03-12 10:15:10 -07006122 return obj
6123
6124 def __eq__(self, other):
6125 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07006126 if self.xid != other.xid: return False
6127 if self.role != other.role: return False
6128 return True
6129
Rich Laneb658ddd2013-03-12 10:15:10 -07006130 def pretty_print(self, q):
6131 q.text("nicira_controller_role_reply {")
6132 with q.group():
6133 with q.indent(2):
6134 q.breakable()
6135 q.text("xid = ");
6136 if self.xid != None:
6137 q.text("%#x" % self.xid)
6138 else:
6139 q.text('None')
6140 q.text(","); q.breakable()
6141 q.text("role = ");
6142 q.text("%#x" % self.role)
6143 q.breakable()
6144 q.text('}')
6145
Rich Lane7dcdf022013-12-11 14:45:27 -08006146nicira_header.subtypes[11] = nicira_controller_role_reply
6147
6148class nicira_controller_role_request(nicira_header):
Dan Talaycof6202252013-07-02 01:00:29 -07006149 version = 1
6150 type = 4
6151 experimenter = 8992
Rich Laneb658ddd2013-03-12 10:15:10 -07006152 subtype = 10
6153
6154 def __init__(self, xid=None, role=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006155 if xid != None:
6156 self.xid = xid
6157 else:
6158 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07006159 if role != None:
6160 self.role = role
6161 else:
6162 self.role = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08006163 return
Rich Laneb658ddd2013-03-12 10:15:10 -07006164
6165 def pack(self):
6166 packed = []
6167 packed.append(struct.pack("!B", self.version))
6168 packed.append(struct.pack("!B", self.type))
6169 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6170 packed.append(struct.pack("!L", self.xid))
6171 packed.append(struct.pack("!L", self.experimenter))
6172 packed.append(struct.pack("!L", self.subtype))
6173 packed.append(struct.pack("!L", self.role))
6174 length = sum([len(x) for x in packed])
6175 packed[2] = struct.pack("!H", length)
6176 return ''.join(packed)
6177
6178 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006179 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07006180 obj = nicira_controller_role_request()
Dan Talaycof6202252013-07-02 01:00:29 -07006181 _version = reader.read("!B")[0]
6182 assert(_version == 1)
6183 _type = reader.read("!B")[0]
6184 assert(_type == 4)
6185 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006186 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006187 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07006188 obj.xid = reader.read("!L")[0]
6189 _experimenter = reader.read("!L")[0]
6190 assert(_experimenter == 8992)
6191 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07006192 assert(_subtype == 10)
Dan Talaycof6202252013-07-02 01:00:29 -07006193 obj.role = reader.read("!L")[0]
Rich Laneb658ddd2013-03-12 10:15:10 -07006194 return obj
6195
6196 def __eq__(self, other):
6197 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07006198 if self.xid != other.xid: return False
6199 if self.role != other.role: return False
6200 return True
6201
Rich Laneb658ddd2013-03-12 10:15:10 -07006202 def pretty_print(self, q):
6203 q.text("nicira_controller_role_request {")
6204 with q.group():
6205 with q.indent(2):
6206 q.breakable()
6207 q.text("xid = ");
6208 if self.xid != None:
6209 q.text("%#x" % self.xid)
6210 else:
6211 q.text('None')
6212 q.text(","); q.breakable()
6213 q.text("role = ");
6214 q.text("%#x" % self.role)
6215 q.breakable()
6216 q.text('}')
6217
Rich Lane7dcdf022013-12-11 14:45:27 -08006218nicira_header.subtypes[10] = nicira_controller_role_request
6219
6220class packet_in(message):
Dan Talaycof6202252013-07-02 01:00:29 -07006221 version = 1
6222 type = 10
Rich Laneb658ddd2013-03-12 10:15:10 -07006223
Rich Lanec2ee4b82013-04-24 17:12:38 -07006224 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 -08006225 if xid != None:
6226 self.xid = xid
6227 else:
6228 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07006229 if buffer_id != None:
6230 self.buffer_id = buffer_id
6231 else:
6232 self.buffer_id = 0
6233 if total_len != None:
6234 self.total_len = total_len
6235 else:
6236 self.total_len = 0
6237 if in_port != None:
6238 self.in_port = in_port
6239 else:
6240 self.in_port = 0
6241 if reason != None:
6242 self.reason = reason
6243 else:
6244 self.reason = 0
Rich Laneb658ddd2013-03-12 10:15:10 -07006245 if data != None:
6246 self.data = data
6247 else:
Dan Talaycof6202252013-07-02 01:00:29 -07006248 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08006249 return
Rich Laneb658ddd2013-03-12 10:15:10 -07006250
6251 def pack(self):
6252 packed = []
6253 packed.append(struct.pack("!B", self.version))
6254 packed.append(struct.pack("!B", self.type))
6255 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6256 packed.append(struct.pack("!L", self.xid))
6257 packed.append(struct.pack("!L", self.buffer_id))
6258 packed.append(struct.pack("!H", self.total_len))
Dan Talaycof6202252013-07-02 01:00:29 -07006259 packed.append(util.pack_port_no(self.in_port))
Rich Laneb658ddd2013-03-12 10:15:10 -07006260 packed.append(struct.pack("!B", self.reason))
Rich Lanec2ee4b82013-04-24 17:12:38 -07006261 packed.append('\x00' * 1)
Rich Laneb658ddd2013-03-12 10:15:10 -07006262 packed.append(self.data)
6263 length = sum([len(x) for x in packed])
6264 packed[2] = struct.pack("!H", length)
6265 return ''.join(packed)
6266
6267 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006268 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07006269 obj = packet_in()
Dan Talaycof6202252013-07-02 01:00:29 -07006270 _version = reader.read("!B")[0]
6271 assert(_version == 1)
6272 _type = reader.read("!B")[0]
6273 assert(_type == 10)
6274 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006275 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006276 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07006277 obj.xid = reader.read("!L")[0]
6278 obj.buffer_id = reader.read("!L")[0]
6279 obj.total_len = reader.read("!H")[0]
6280 obj.in_port = util.unpack_port_no(reader)
6281 obj.reason = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07006282 reader.skip(1)
6283 obj.data = str(reader.read_all())
Rich Laneb658ddd2013-03-12 10:15:10 -07006284 return obj
6285
6286 def __eq__(self, other):
6287 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07006288 if self.xid != other.xid: return False
6289 if self.buffer_id != other.buffer_id: return False
6290 if self.total_len != other.total_len: return False
6291 if self.in_port != other.in_port: return False
6292 if self.reason != other.reason: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07006293 if self.data != other.data: return False
6294 return True
6295
Rich Laneb658ddd2013-03-12 10:15:10 -07006296 def pretty_print(self, q):
6297 q.text("packet_in {")
6298 with q.group():
6299 with q.indent(2):
6300 q.breakable()
6301 q.text("xid = ");
6302 if self.xid != None:
6303 q.text("%#x" % self.xid)
6304 else:
6305 q.text('None')
6306 q.text(","); q.breakable()
6307 q.text("buffer_id = ");
6308 q.text("%#x" % self.buffer_id)
6309 q.text(","); q.breakable()
6310 q.text("total_len = ");
6311 q.text("%#x" % self.total_len)
6312 q.text(","); q.breakable()
6313 q.text("in_port = ");
6314 q.text(util.pretty_port(self.in_port))
6315 q.text(","); q.breakable()
6316 q.text("reason = ");
6317 q.text("%#x" % self.reason)
6318 q.text(","); q.breakable()
Rich Laneb658ddd2013-03-12 10:15:10 -07006319 q.text("data = ");
6320 q.pp(self.data)
6321 q.breakable()
6322 q.text('}')
6323
Rich Lane7dcdf022013-12-11 14:45:27 -08006324message.subtypes[10] = packet_in
6325
6326class packet_out(message):
Dan Talaycof6202252013-07-02 01:00:29 -07006327 version = 1
6328 type = 13
Rich Laneb658ddd2013-03-12 10:15:10 -07006329
6330 def __init__(self, xid=None, buffer_id=None, in_port=None, actions=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006331 if xid != None:
6332 self.xid = xid
6333 else:
6334 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07006335 if buffer_id != None:
6336 self.buffer_id = buffer_id
6337 else:
Rich Laneff637c92013-04-04 13:57:09 -07006338 self.buffer_id = 0
Rich Laneb658ddd2013-03-12 10:15:10 -07006339 if in_port != None:
6340 self.in_port = in_port
6341 else:
6342 self.in_port = 0
6343 if actions != None:
6344 self.actions = actions
6345 else:
6346 self.actions = []
6347 if data != None:
6348 self.data = data
6349 else:
Dan Talaycof6202252013-07-02 01:00:29 -07006350 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08006351 return
Rich Laneb658ddd2013-03-12 10:15:10 -07006352
6353 def pack(self):
6354 packed = []
6355 packed.append(struct.pack("!B", self.version))
6356 packed.append(struct.pack("!B", self.type))
Rich Lanec2ee4b82013-04-24 17:12:38 -07006357 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
Rich Laneb658ddd2013-03-12 10:15:10 -07006358 packed.append(struct.pack("!L", self.xid))
6359 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -07006360 packed.append(util.pack_port_no(self.in_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -07006361 packed.append(struct.pack("!H", 0)) # placeholder for actions_len at index 6
Rich Lane7dcdf022013-12-11 14:45:27 -08006362 packed.append(loxi.generic_util.pack_list(self.actions))
Rich Lanec2ee4b82013-04-24 17:12:38 -07006363 packed[6] = struct.pack("!H", len(packed[-1]))
Rich Laneb658ddd2013-03-12 10:15:10 -07006364 packed.append(self.data)
6365 length = sum([len(x) for x in packed])
6366 packed[2] = struct.pack("!H", length)
6367 return ''.join(packed)
6368
6369 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006370 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07006371 obj = packet_out()
Dan Talaycof6202252013-07-02 01:00:29 -07006372 _version = reader.read("!B")[0]
6373 assert(_version == 1)
6374 _type = reader.read("!B")[0]
6375 assert(_type == 13)
6376 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006377 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006378 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07006379 obj.xid = reader.read("!L")[0]
6380 obj.buffer_id = reader.read("!L")[0]
6381 obj.in_port = util.unpack_port_no(reader)
6382 _actions_len = reader.read("!H")[0]
Rich Lanee2567702015-01-26 15:04:35 -08006383 obj.actions = loxi.generic_util.unpack_list(reader.slice(_actions_len), ofp.action.action.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -07006384 obj.data = str(reader.read_all())
Rich Laneb658ddd2013-03-12 10:15:10 -07006385 return obj
6386
6387 def __eq__(self, other):
6388 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07006389 if self.xid != other.xid: return False
6390 if self.buffer_id != other.buffer_id: return False
6391 if self.in_port != other.in_port: return False
6392 if self.actions != other.actions: return False
6393 if self.data != other.data: return False
6394 return True
6395
Rich Laneb658ddd2013-03-12 10:15:10 -07006396 def pretty_print(self, q):
6397 q.text("packet_out {")
6398 with q.group():
6399 with q.indent(2):
6400 q.breakable()
6401 q.text("xid = ");
6402 if self.xid != None:
6403 q.text("%#x" % self.xid)
6404 else:
6405 q.text('None')
6406 q.text(","); q.breakable()
6407 q.text("buffer_id = ");
6408 q.text("%#x" % self.buffer_id)
6409 q.text(","); q.breakable()
6410 q.text("in_port = ");
6411 q.text(util.pretty_port(self.in_port))
6412 q.text(","); q.breakable()
6413 q.text("actions = ");
6414 q.pp(self.actions)
6415 q.text(","); q.breakable()
6416 q.text("data = ");
6417 q.pp(self.data)
6418 q.breakable()
6419 q.text('}')
6420
Rich Lane7dcdf022013-12-11 14:45:27 -08006421message.subtypes[13] = packet_out
6422
6423class port_mod(message):
Dan Talaycof6202252013-07-02 01:00:29 -07006424 version = 1
6425 type = 15
Rich Laneb658ddd2013-03-12 10:15:10 -07006426
Rich Lanec2ee4b82013-04-24 17:12:38 -07006427 def __init__(self, xid=None, port_no=None, hw_addr=None, config=None, mask=None, advertise=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006428 if xid != None:
6429 self.xid = xid
6430 else:
6431 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07006432 if port_no != None:
6433 self.port_no = port_no
6434 else:
6435 self.port_no = 0
6436 if hw_addr != None:
6437 self.hw_addr = hw_addr
6438 else:
6439 self.hw_addr = [0,0,0,0,0,0]
6440 if config != None:
6441 self.config = config
6442 else:
6443 self.config = 0
6444 if mask != None:
6445 self.mask = mask
6446 else:
6447 self.mask = 0
6448 if advertise != None:
6449 self.advertise = advertise
6450 else:
6451 self.advertise = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08006452 return
Rich Laneb658ddd2013-03-12 10:15:10 -07006453
6454 def pack(self):
6455 packed = []
6456 packed.append(struct.pack("!B", self.version))
6457 packed.append(struct.pack("!B", self.type))
6458 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6459 packed.append(struct.pack("!L", self.xid))
Dan Talaycof6202252013-07-02 01:00:29 -07006460 packed.append(util.pack_port_no(self.port_no))
Rich Laneb658ddd2013-03-12 10:15:10 -07006461 packed.append(struct.pack("!6B", *self.hw_addr))
6462 packed.append(struct.pack("!L", self.config))
6463 packed.append(struct.pack("!L", self.mask))
6464 packed.append(struct.pack("!L", self.advertise))
Rich Lanec2ee4b82013-04-24 17:12:38 -07006465 packed.append('\x00' * 4)
Rich Laneb658ddd2013-03-12 10:15:10 -07006466 length = sum([len(x) for x in packed])
6467 packed[2] = struct.pack("!H", length)
6468 return ''.join(packed)
6469
6470 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006471 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07006472 obj = port_mod()
Dan Talaycof6202252013-07-02 01:00:29 -07006473 _version = reader.read("!B")[0]
6474 assert(_version == 1)
6475 _type = reader.read("!B")[0]
6476 assert(_type == 15)
6477 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006478 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006479 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07006480 obj.xid = reader.read("!L")[0]
6481 obj.port_no = util.unpack_port_no(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -07006482 obj.hw_addr = list(reader.read('!6B'))
Dan Talaycof6202252013-07-02 01:00:29 -07006483 obj.config = reader.read("!L")[0]
6484 obj.mask = reader.read("!L")[0]
6485 obj.advertise = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07006486 reader.skip(4)
Rich Laneb658ddd2013-03-12 10:15:10 -07006487 return obj
6488
6489 def __eq__(self, other):
6490 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07006491 if self.xid != other.xid: return False
6492 if self.port_no != other.port_no: return False
6493 if self.hw_addr != other.hw_addr: return False
6494 if self.config != other.config: return False
6495 if self.mask != other.mask: return False
6496 if self.advertise != other.advertise: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07006497 return True
6498
Rich Laneb658ddd2013-03-12 10:15:10 -07006499 def pretty_print(self, q):
6500 q.text("port_mod {")
6501 with q.group():
6502 with q.indent(2):
6503 q.breakable()
6504 q.text("xid = ");
6505 if self.xid != None:
6506 q.text("%#x" % self.xid)
6507 else:
6508 q.text('None')
6509 q.text(","); q.breakable()
6510 q.text("port_no = ");
6511 q.text(util.pretty_port(self.port_no))
6512 q.text(","); q.breakable()
6513 q.text("hw_addr = ");
6514 q.text(util.pretty_mac(self.hw_addr))
6515 q.text(","); q.breakable()
6516 q.text("config = ");
6517 q.text("%#x" % self.config)
6518 q.text(","); q.breakable()
6519 q.text("mask = ");
6520 q.text("%#x" % self.mask)
6521 q.text(","); q.breakable()
6522 q.text("advertise = ");
6523 q.text("%#x" % self.advertise)
Rich Laneb658ddd2013-03-12 10:15:10 -07006524 q.breakable()
6525 q.text('}')
6526
Rich Lane7dcdf022013-12-11 14:45:27 -08006527message.subtypes[15] = port_mod
6528
6529class port_mod_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -07006530 version = 1
6531 type = 1
6532 err_type = 4
6533
6534 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006535 if xid != None:
6536 self.xid = xid
6537 else:
6538 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07006539 if code != None:
6540 self.code = code
6541 else:
6542 self.code = 0
6543 if data != None:
6544 self.data = data
6545 else:
6546 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08006547 return
Rich Lane6f4978c2013-10-20 21:33:52 -07006548
6549 def pack(self):
6550 packed = []
6551 packed.append(struct.pack("!B", self.version))
6552 packed.append(struct.pack("!B", self.type))
6553 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6554 packed.append(struct.pack("!L", self.xid))
6555 packed.append(struct.pack("!H", self.err_type))
6556 packed.append(struct.pack("!H", self.code))
6557 packed.append(self.data)
6558 length = sum([len(x) for x in packed])
6559 packed[2] = struct.pack("!H", length)
6560 return ''.join(packed)
6561
6562 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006563 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07006564 obj = port_mod_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -07006565 _version = reader.read("!B")[0]
6566 assert(_version == 1)
6567 _type = reader.read("!B")[0]
6568 assert(_type == 1)
6569 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006570 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006571 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -07006572 obj.xid = reader.read("!L")[0]
6573 _err_type = reader.read("!H")[0]
6574 assert(_err_type == 4)
6575 obj.code = reader.read("!H")[0]
6576 obj.data = str(reader.read_all())
6577 return obj
6578
6579 def __eq__(self, other):
6580 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07006581 if self.xid != other.xid: return False
6582 if self.code != other.code: return False
6583 if self.data != other.data: return False
6584 return True
6585
Rich Lane6f4978c2013-10-20 21:33:52 -07006586 def pretty_print(self, q):
6587 q.text("port_mod_failed_error_msg {")
6588 with q.group():
6589 with q.indent(2):
6590 q.breakable()
6591 q.text("xid = ");
6592 if self.xid != None:
6593 q.text("%#x" % self.xid)
6594 else:
6595 q.text('None')
6596 q.text(","); q.breakable()
6597 q.text("code = ");
6598 q.text("%#x" % self.code)
6599 q.text(","); q.breakable()
6600 q.text("data = ");
6601 q.pp(self.data)
6602 q.breakable()
6603 q.text('}')
6604
Rich Lane7dcdf022013-12-11 14:45:27 -08006605error_msg.subtypes[4] = port_mod_failed_error_msg
6606
6607class port_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -07006608 version = 1
6609 type = 17
6610 stats_type = 4
Rich Laneb658ddd2013-03-12 10:15:10 -07006611
6612 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006613 if xid != None:
6614 self.xid = xid
6615 else:
6616 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07006617 if flags != None:
6618 self.flags = flags
6619 else:
6620 self.flags = 0
6621 if entries != None:
6622 self.entries = entries
6623 else:
6624 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -08006625 return
Rich Laneb658ddd2013-03-12 10:15:10 -07006626
6627 def pack(self):
6628 packed = []
6629 packed.append(struct.pack("!B", self.version))
6630 packed.append(struct.pack("!B", self.type))
6631 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6632 packed.append(struct.pack("!L", self.xid))
6633 packed.append(struct.pack("!H", self.stats_type))
6634 packed.append(struct.pack("!H", self.flags))
Rich Lane7dcdf022013-12-11 14:45:27 -08006635 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Laneb658ddd2013-03-12 10:15:10 -07006636 length = sum([len(x) for x in packed])
6637 packed[2] = struct.pack("!H", length)
6638 return ''.join(packed)
6639
6640 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006641 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07006642 obj = port_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07006643 _version = reader.read("!B")[0]
6644 assert(_version == 1)
6645 _type = reader.read("!B")[0]
6646 assert(_type == 17)
6647 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006648 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006649 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07006650 obj.xid = reader.read("!L")[0]
6651 _stats_type = reader.read("!H")[0]
6652 assert(_stats_type == 4)
6653 obj.flags = reader.read("!H")[0]
Rich Lanee2567702015-01-26 15:04:35 -08006654 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.port_stats_entry.unpack)
Rich Laneb658ddd2013-03-12 10:15:10 -07006655 return obj
6656
6657 def __eq__(self, other):
6658 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07006659 if self.xid != other.xid: return False
6660 if self.flags != other.flags: return False
6661 if self.entries != other.entries: return False
6662 return True
6663
Rich Laneb658ddd2013-03-12 10:15:10 -07006664 def pretty_print(self, q):
6665 q.text("port_stats_reply {")
6666 with q.group():
6667 with q.indent(2):
6668 q.breakable()
6669 q.text("xid = ");
6670 if self.xid != None:
6671 q.text("%#x" % self.xid)
6672 else:
6673 q.text('None')
6674 q.text(","); q.breakable()
6675 q.text("flags = ");
6676 q.text("%#x" % self.flags)
6677 q.text(","); q.breakable()
6678 q.text("entries = ");
6679 q.pp(self.entries)
6680 q.breakable()
6681 q.text('}')
6682
Rich Lane7dcdf022013-12-11 14:45:27 -08006683stats_reply.subtypes[4] = port_stats_reply
6684
6685class port_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -07006686 version = 1
6687 type = 16
6688 stats_type = 4
Rich Laneb658ddd2013-03-12 10:15:10 -07006689
Rich Lanec2ee4b82013-04-24 17:12:38 -07006690 def __init__(self, xid=None, flags=None, port_no=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006691 if xid != None:
6692 self.xid = xid
6693 else:
6694 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07006695 if flags != None:
6696 self.flags = flags
6697 else:
6698 self.flags = 0
6699 if port_no != None:
6700 self.port_no = port_no
6701 else:
6702 self.port_no = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08006703 return
Rich Laneb658ddd2013-03-12 10:15:10 -07006704
6705 def pack(self):
6706 packed = []
6707 packed.append(struct.pack("!B", self.version))
6708 packed.append(struct.pack("!B", self.type))
6709 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6710 packed.append(struct.pack("!L", self.xid))
6711 packed.append(struct.pack("!H", self.stats_type))
6712 packed.append(struct.pack("!H", self.flags))
Dan Talaycof6202252013-07-02 01:00:29 -07006713 packed.append(util.pack_port_no(self.port_no))
Rich Lanec2ee4b82013-04-24 17:12:38 -07006714 packed.append('\x00' * 6)
Rich Laneb658ddd2013-03-12 10:15:10 -07006715 length = sum([len(x) for x in packed])
6716 packed[2] = struct.pack("!H", length)
6717 return ''.join(packed)
6718
6719 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006720 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07006721 obj = port_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -07006722 _version = reader.read("!B")[0]
6723 assert(_version == 1)
6724 _type = reader.read("!B")[0]
6725 assert(_type == 16)
6726 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006727 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006728 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07006729 obj.xid = reader.read("!L")[0]
6730 _stats_type = reader.read("!H")[0]
6731 assert(_stats_type == 4)
6732 obj.flags = reader.read("!H")[0]
6733 obj.port_no = util.unpack_port_no(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -07006734 reader.skip(6)
Rich Laneb658ddd2013-03-12 10:15:10 -07006735 return obj
6736
6737 def __eq__(self, other):
6738 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07006739 if self.xid != other.xid: return False
6740 if self.flags != other.flags: return False
6741 if self.port_no != other.port_no: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07006742 return True
6743
Rich Laneb658ddd2013-03-12 10:15:10 -07006744 def pretty_print(self, q):
6745 q.text("port_stats_request {")
6746 with q.group():
6747 with q.indent(2):
6748 q.breakable()
6749 q.text("xid = ");
6750 if self.xid != None:
6751 q.text("%#x" % self.xid)
6752 else:
6753 q.text('None')
6754 q.text(","); q.breakable()
6755 q.text("flags = ");
6756 q.text("%#x" % self.flags)
6757 q.text(","); q.breakable()
6758 q.text("port_no = ");
6759 q.text(util.pretty_port(self.port_no))
Rich Laneb658ddd2013-03-12 10:15:10 -07006760 q.breakable()
6761 q.text('}')
6762
Rich Lane7dcdf022013-12-11 14:45:27 -08006763stats_request.subtypes[4] = port_stats_request
6764
6765class port_status(message):
Dan Talaycof6202252013-07-02 01:00:29 -07006766 version = 1
6767 type = 12
Rich Laneb658ddd2013-03-12 10:15:10 -07006768
Rich Lanec2ee4b82013-04-24 17:12:38 -07006769 def __init__(self, xid=None, reason=None, desc=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006770 if xid != None:
6771 self.xid = xid
6772 else:
6773 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07006774 if reason != None:
6775 self.reason = reason
6776 else:
6777 self.reason = 0
Rich Laneb658ddd2013-03-12 10:15:10 -07006778 if desc != None:
6779 self.desc = desc
6780 else:
Rich Lanee2567702015-01-26 15:04:35 -08006781 self.desc = ofp.port_desc()
Rich Lane7dcdf022013-12-11 14:45:27 -08006782 return
Rich Laneb658ddd2013-03-12 10:15:10 -07006783
6784 def pack(self):
6785 packed = []
6786 packed.append(struct.pack("!B", self.version))
6787 packed.append(struct.pack("!B", self.type))
6788 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6789 packed.append(struct.pack("!L", self.xid))
6790 packed.append(struct.pack("!B", self.reason))
Rich Lanec2ee4b82013-04-24 17:12:38 -07006791 packed.append('\x00' * 7)
Rich Laneb658ddd2013-03-12 10:15:10 -07006792 packed.append(self.desc.pack())
6793 length = sum([len(x) for x in packed])
6794 packed[2] = struct.pack("!H", length)
6795 return ''.join(packed)
6796
6797 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006798 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07006799 obj = port_status()
Dan Talaycof6202252013-07-02 01:00:29 -07006800 _version = reader.read("!B")[0]
6801 assert(_version == 1)
6802 _type = reader.read("!B")[0]
6803 assert(_type == 12)
6804 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006805 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006806 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07006807 obj.xid = reader.read("!L")[0]
6808 obj.reason = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07006809 reader.skip(7)
Rich Lanee2567702015-01-26 15:04:35 -08006810 obj.desc = ofp.port_desc.unpack(reader)
Rich Laneb658ddd2013-03-12 10:15:10 -07006811 return obj
6812
6813 def __eq__(self, other):
6814 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07006815 if self.xid != other.xid: return False
6816 if self.reason != other.reason: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07006817 if self.desc != other.desc: return False
6818 return True
6819
Rich Laneb658ddd2013-03-12 10:15:10 -07006820 def pretty_print(self, q):
6821 q.text("port_status {")
6822 with q.group():
6823 with q.indent(2):
6824 q.breakable()
6825 q.text("xid = ");
6826 if self.xid != None:
6827 q.text("%#x" % self.xid)
6828 else:
6829 q.text('None')
6830 q.text(","); q.breakable()
6831 q.text("reason = ");
6832 q.text("%#x" % self.reason)
6833 q.text(","); q.breakable()
Rich Laneb658ddd2013-03-12 10:15:10 -07006834 q.text("desc = ");
6835 q.pp(self.desc)
6836 q.breakable()
6837 q.text('}')
6838
Rich Lane7dcdf022013-12-11 14:45:27 -08006839message.subtypes[12] = port_status
6840
6841class queue_get_config_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -07006842 version = 1
6843 type = 21
Rich Laneb658ddd2013-03-12 10:15:10 -07006844
Rich Lanec2ee4b82013-04-24 17:12:38 -07006845 def __init__(self, xid=None, port=None, queues=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006846 if xid != None:
6847 self.xid = xid
6848 else:
6849 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07006850 if port != None:
6851 self.port = port
6852 else:
6853 self.port = 0
Rich Laneb658ddd2013-03-12 10:15:10 -07006854 if queues != None:
6855 self.queues = queues
6856 else:
6857 self.queues = []
Rich Lane7dcdf022013-12-11 14:45:27 -08006858 return
Rich Laneb658ddd2013-03-12 10:15:10 -07006859
6860 def pack(self):
6861 packed = []
6862 packed.append(struct.pack("!B", self.version))
6863 packed.append(struct.pack("!B", self.type))
6864 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6865 packed.append(struct.pack("!L", self.xid))
Dan Talaycof6202252013-07-02 01:00:29 -07006866 packed.append(util.pack_port_no(self.port))
Rich Lanec2ee4b82013-04-24 17:12:38 -07006867 packed.append('\x00' * 6)
Rich Lane7dcdf022013-12-11 14:45:27 -08006868 packed.append(loxi.generic_util.pack_list(self.queues))
Rich Laneb658ddd2013-03-12 10:15:10 -07006869 length = sum([len(x) for x in packed])
6870 packed[2] = struct.pack("!H", length)
6871 return ''.join(packed)
6872
6873 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006874 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07006875 obj = queue_get_config_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07006876 _version = reader.read("!B")[0]
6877 assert(_version == 1)
6878 _type = reader.read("!B")[0]
6879 assert(_type == 21)
6880 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006881 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006882 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07006883 obj.xid = reader.read("!L")[0]
6884 obj.port = util.unpack_port_no(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -07006885 reader.skip(6)
Rich Lanee2567702015-01-26 15:04:35 -08006886 obj.queues = loxi.generic_util.unpack_list(reader, ofp.common.packet_queue.unpack)
Rich Laneb658ddd2013-03-12 10:15:10 -07006887 return obj
6888
6889 def __eq__(self, other):
6890 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07006891 if self.xid != other.xid: return False
6892 if self.port != other.port: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07006893 if self.queues != other.queues: return False
6894 return True
6895
Rich Laneb658ddd2013-03-12 10:15:10 -07006896 def pretty_print(self, q):
6897 q.text("queue_get_config_reply {")
6898 with q.group():
6899 with q.indent(2):
6900 q.breakable()
6901 q.text("xid = ");
6902 if self.xid != None:
6903 q.text("%#x" % self.xid)
6904 else:
6905 q.text('None')
6906 q.text(","); q.breakable()
6907 q.text("port = ");
6908 q.text(util.pretty_port(self.port))
6909 q.text(","); q.breakable()
Rich Laneb658ddd2013-03-12 10:15:10 -07006910 q.text("queues = ");
6911 q.pp(self.queues)
6912 q.breakable()
6913 q.text('}')
6914
Rich Lane7dcdf022013-12-11 14:45:27 -08006915message.subtypes[21] = queue_get_config_reply
6916
6917class queue_get_config_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -07006918 version = 1
6919 type = 20
Rich Laneb658ddd2013-03-12 10:15:10 -07006920
Rich Lanec2ee4b82013-04-24 17:12:38 -07006921 def __init__(self, xid=None, port=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006922 if xid != None:
6923 self.xid = xid
6924 else:
6925 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07006926 if port != None:
6927 self.port = port
6928 else:
6929 self.port = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08006930 return
Rich Laneb658ddd2013-03-12 10:15:10 -07006931
6932 def pack(self):
6933 packed = []
6934 packed.append(struct.pack("!B", self.version))
6935 packed.append(struct.pack("!B", self.type))
6936 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6937 packed.append(struct.pack("!L", self.xid))
Dan Talaycof6202252013-07-02 01:00:29 -07006938 packed.append(util.pack_port_no(self.port))
Rich Lanec2ee4b82013-04-24 17:12:38 -07006939 packed.append('\x00' * 2)
Rich Laneb658ddd2013-03-12 10:15:10 -07006940 length = sum([len(x) for x in packed])
6941 packed[2] = struct.pack("!H", length)
6942 return ''.join(packed)
6943
6944 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006945 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07006946 obj = queue_get_config_request()
Dan Talaycof6202252013-07-02 01:00:29 -07006947 _version = reader.read("!B")[0]
6948 assert(_version == 1)
6949 _type = reader.read("!B")[0]
6950 assert(_type == 20)
6951 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006952 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006953 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07006954 obj.xid = reader.read("!L")[0]
6955 obj.port = util.unpack_port_no(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -07006956 reader.skip(2)
Rich Laneb658ddd2013-03-12 10:15:10 -07006957 return obj
6958
6959 def __eq__(self, other):
6960 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07006961 if self.xid != other.xid: return False
6962 if self.port != other.port: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07006963 return True
6964
Rich Laneb658ddd2013-03-12 10:15:10 -07006965 def pretty_print(self, q):
6966 q.text("queue_get_config_request {")
6967 with q.group():
6968 with q.indent(2):
6969 q.breakable()
6970 q.text("xid = ");
6971 if self.xid != None:
6972 q.text("%#x" % self.xid)
6973 else:
6974 q.text('None')
6975 q.text(","); q.breakable()
6976 q.text("port = ");
6977 q.text(util.pretty_port(self.port))
Rich Laneb658ddd2013-03-12 10:15:10 -07006978 q.breakable()
6979 q.text('}')
6980
Rich Lane7dcdf022013-12-11 14:45:27 -08006981message.subtypes[20] = queue_get_config_request
6982
6983class queue_op_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -07006984 version = 1
6985 type = 1
6986 err_type = 5
6987
6988 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006989 if xid != None:
6990 self.xid = xid
6991 else:
6992 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07006993 if code != None:
6994 self.code = code
6995 else:
6996 self.code = 0
6997 if data != None:
6998 self.data = data
6999 else:
7000 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08007001 return
Rich Lane6f4978c2013-10-20 21:33:52 -07007002
7003 def pack(self):
7004 packed = []
7005 packed.append(struct.pack("!B", self.version))
7006 packed.append(struct.pack("!B", self.type))
7007 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7008 packed.append(struct.pack("!L", self.xid))
7009 packed.append(struct.pack("!H", self.err_type))
7010 packed.append(struct.pack("!H", self.code))
7011 packed.append(self.data)
7012 length = sum([len(x) for x in packed])
7013 packed[2] = struct.pack("!H", length)
7014 return ''.join(packed)
7015
7016 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007017 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07007018 obj = queue_op_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -07007019 _version = reader.read("!B")[0]
7020 assert(_version == 1)
7021 _type = reader.read("!B")[0]
7022 assert(_type == 1)
7023 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007024 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007025 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -07007026 obj.xid = reader.read("!L")[0]
7027 _err_type = reader.read("!H")[0]
7028 assert(_err_type == 5)
7029 obj.code = reader.read("!H")[0]
7030 obj.data = str(reader.read_all())
7031 return obj
7032
7033 def __eq__(self, other):
7034 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07007035 if self.xid != other.xid: return False
7036 if self.code != other.code: return False
7037 if self.data != other.data: return False
7038 return True
7039
Rich Lane6f4978c2013-10-20 21:33:52 -07007040 def pretty_print(self, q):
7041 q.text("queue_op_failed_error_msg {")
7042 with q.group():
7043 with q.indent(2):
7044 q.breakable()
7045 q.text("xid = ");
7046 if self.xid != None:
7047 q.text("%#x" % self.xid)
7048 else:
7049 q.text('None')
7050 q.text(","); q.breakable()
7051 q.text("code = ");
7052 q.text("%#x" % self.code)
7053 q.text(","); q.breakable()
7054 q.text("data = ");
7055 q.pp(self.data)
7056 q.breakable()
7057 q.text('}')
7058
Rich Lane7dcdf022013-12-11 14:45:27 -08007059error_msg.subtypes[5] = queue_op_failed_error_msg
7060
7061class queue_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -07007062 version = 1
7063 type = 17
7064 stats_type = 5
Rich Laneb658ddd2013-03-12 10:15:10 -07007065
7066 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007067 if xid != None:
7068 self.xid = xid
7069 else:
7070 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07007071 if flags != None:
7072 self.flags = flags
7073 else:
7074 self.flags = 0
7075 if entries != None:
7076 self.entries = entries
7077 else:
7078 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -08007079 return
Rich Laneb658ddd2013-03-12 10:15:10 -07007080
7081 def pack(self):
7082 packed = []
7083 packed.append(struct.pack("!B", self.version))
7084 packed.append(struct.pack("!B", self.type))
7085 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7086 packed.append(struct.pack("!L", self.xid))
7087 packed.append(struct.pack("!H", self.stats_type))
7088 packed.append(struct.pack("!H", self.flags))
Rich Lane7dcdf022013-12-11 14:45:27 -08007089 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Laneb658ddd2013-03-12 10:15:10 -07007090 length = sum([len(x) for x in packed])
7091 packed[2] = struct.pack("!H", length)
7092 return ''.join(packed)
7093
7094 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007095 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07007096 obj = queue_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07007097 _version = reader.read("!B")[0]
7098 assert(_version == 1)
7099 _type = reader.read("!B")[0]
7100 assert(_type == 17)
7101 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007102 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007103 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07007104 obj.xid = reader.read("!L")[0]
7105 _stats_type = reader.read("!H")[0]
7106 assert(_stats_type == 5)
7107 obj.flags = reader.read("!H")[0]
Rich Lanee2567702015-01-26 15:04:35 -08007108 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.queue_stats_entry.unpack)
Rich Laneb658ddd2013-03-12 10:15:10 -07007109 return obj
7110
7111 def __eq__(self, other):
7112 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07007113 if self.xid != other.xid: return False
7114 if self.flags != other.flags: return False
7115 if self.entries != other.entries: return False
7116 return True
7117
Rich Laneb658ddd2013-03-12 10:15:10 -07007118 def pretty_print(self, q):
7119 q.text("queue_stats_reply {")
7120 with q.group():
7121 with q.indent(2):
7122 q.breakable()
7123 q.text("xid = ");
7124 if self.xid != None:
7125 q.text("%#x" % self.xid)
7126 else:
7127 q.text('None')
7128 q.text(","); q.breakable()
7129 q.text("flags = ");
7130 q.text("%#x" % self.flags)
7131 q.text(","); q.breakable()
7132 q.text("entries = ");
7133 q.pp(self.entries)
7134 q.breakable()
7135 q.text('}')
7136
Rich Lane7dcdf022013-12-11 14:45:27 -08007137stats_reply.subtypes[5] = queue_stats_reply
7138
7139class queue_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -07007140 version = 1
7141 type = 16
7142 stats_type = 5
Rich Laneb658ddd2013-03-12 10:15:10 -07007143
Rich Lanec2ee4b82013-04-24 17:12:38 -07007144 def __init__(self, xid=None, flags=None, port_no=None, queue_id=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007145 if xid != None:
7146 self.xid = xid
7147 else:
7148 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07007149 if flags != None:
7150 self.flags = flags
7151 else:
7152 self.flags = 0
7153 if port_no != None:
7154 self.port_no = port_no
7155 else:
7156 self.port_no = 0
Rich Laneb658ddd2013-03-12 10:15:10 -07007157 if queue_id != None:
7158 self.queue_id = queue_id
7159 else:
7160 self.queue_id = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08007161 return
Rich Laneb658ddd2013-03-12 10:15:10 -07007162
7163 def pack(self):
7164 packed = []
7165 packed.append(struct.pack("!B", self.version))
7166 packed.append(struct.pack("!B", self.type))
7167 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7168 packed.append(struct.pack("!L", self.xid))
7169 packed.append(struct.pack("!H", self.stats_type))
7170 packed.append(struct.pack("!H", self.flags))
Dan Talaycof6202252013-07-02 01:00:29 -07007171 packed.append(util.pack_port_no(self.port_no))
Rich Lanec2ee4b82013-04-24 17:12:38 -07007172 packed.append('\x00' * 2)
Rich Laneb658ddd2013-03-12 10:15:10 -07007173 packed.append(struct.pack("!L", self.queue_id))
7174 length = sum([len(x) for x in packed])
7175 packed[2] = struct.pack("!H", length)
7176 return ''.join(packed)
7177
7178 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007179 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07007180 obj = queue_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -07007181 _version = reader.read("!B")[0]
7182 assert(_version == 1)
7183 _type = reader.read("!B")[0]
7184 assert(_type == 16)
7185 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007186 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007187 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07007188 obj.xid = reader.read("!L")[0]
7189 _stats_type = reader.read("!H")[0]
7190 assert(_stats_type == 5)
7191 obj.flags = reader.read("!H")[0]
7192 obj.port_no = util.unpack_port_no(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -07007193 reader.skip(2)
Dan Talaycof6202252013-07-02 01:00:29 -07007194 obj.queue_id = reader.read("!L")[0]
Rich Laneb658ddd2013-03-12 10:15:10 -07007195 return obj
7196
7197 def __eq__(self, other):
7198 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07007199 if self.xid != other.xid: return False
7200 if self.flags != other.flags: return False
7201 if self.port_no != other.port_no: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07007202 if self.queue_id != other.queue_id: return False
7203 return True
7204
Rich Laneb658ddd2013-03-12 10:15:10 -07007205 def pretty_print(self, q):
7206 q.text("queue_stats_request {")
7207 with q.group():
7208 with q.indent(2):
7209 q.breakable()
7210 q.text("xid = ");
7211 if self.xid != None:
7212 q.text("%#x" % self.xid)
7213 else:
7214 q.text('None')
7215 q.text(","); q.breakable()
7216 q.text("flags = ");
7217 q.text("%#x" % self.flags)
7218 q.text(","); q.breakable()
7219 q.text("port_no = ");
7220 q.text(util.pretty_port(self.port_no))
7221 q.text(","); q.breakable()
Rich Laneb658ddd2013-03-12 10:15:10 -07007222 q.text("queue_id = ");
7223 q.text("%#x" % self.queue_id)
7224 q.breakable()
7225 q.text('}')
7226
Rich Lane7dcdf022013-12-11 14:45:27 -08007227stats_request.subtypes[5] = queue_stats_request
7228
7229class set_config(message):
Dan Talaycof6202252013-07-02 01:00:29 -07007230 version = 1
7231 type = 9
Rich Laneb658ddd2013-03-12 10:15:10 -07007232
7233 def __init__(self, xid=None, flags=None, miss_send_len=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007234 if xid != None:
7235 self.xid = xid
7236 else:
7237 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07007238 if flags != None:
7239 self.flags = flags
7240 else:
7241 self.flags = 0
7242 if miss_send_len != None:
7243 self.miss_send_len = miss_send_len
7244 else:
7245 self.miss_send_len = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08007246 return
Rich Laneb658ddd2013-03-12 10:15:10 -07007247
7248 def pack(self):
7249 packed = []
7250 packed.append(struct.pack("!B", self.version))
7251 packed.append(struct.pack("!B", self.type))
7252 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7253 packed.append(struct.pack("!L", self.xid))
7254 packed.append(struct.pack("!H", self.flags))
7255 packed.append(struct.pack("!H", self.miss_send_len))
7256 length = sum([len(x) for x in packed])
7257 packed[2] = struct.pack("!H", length)
7258 return ''.join(packed)
7259
7260 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007261 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07007262 obj = set_config()
Dan Talaycof6202252013-07-02 01:00:29 -07007263 _version = reader.read("!B")[0]
7264 assert(_version == 1)
7265 _type = reader.read("!B")[0]
7266 assert(_type == 9)
7267 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007268 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007269 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07007270 obj.xid = reader.read("!L")[0]
7271 obj.flags = reader.read("!H")[0]
7272 obj.miss_send_len = reader.read("!H")[0]
Rich Laneb658ddd2013-03-12 10:15:10 -07007273 return obj
7274
7275 def __eq__(self, other):
7276 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07007277 if self.xid != other.xid: return False
7278 if self.flags != other.flags: return False
7279 if self.miss_send_len != other.miss_send_len: return False
7280 return True
7281
Rich Laneb658ddd2013-03-12 10:15:10 -07007282 def pretty_print(self, q):
7283 q.text("set_config {")
7284 with q.group():
7285 with q.indent(2):
7286 q.breakable()
7287 q.text("xid = ");
7288 if self.xid != None:
7289 q.text("%#x" % self.xid)
7290 else:
7291 q.text('None')
7292 q.text(","); q.breakable()
7293 q.text("flags = ");
7294 q.text("%#x" % self.flags)
7295 q.text(","); q.breakable()
7296 q.text("miss_send_len = ");
7297 q.text("%#x" % self.miss_send_len)
7298 q.breakable()
7299 q.text('}')
7300
Rich Lane7dcdf022013-12-11 14:45:27 -08007301message.subtypes[9] = set_config
7302
7303class table_mod(message):
Dan Talaycof6202252013-07-02 01:00:29 -07007304 version = 1
Rich Laneb658ddd2013-03-12 10:15:10 -07007305 type = 22
7306
Rich Lanec2ee4b82013-04-24 17:12:38 -07007307 def __init__(self, xid=None, table_id=None, config=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007308 if xid != None:
7309 self.xid = xid
7310 else:
7311 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07007312 if table_id != None:
7313 self.table_id = table_id
7314 else:
7315 self.table_id = 0
Rich Laneb658ddd2013-03-12 10:15:10 -07007316 if config != None:
7317 self.config = config
7318 else:
7319 self.config = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08007320 return
Rich Laneb658ddd2013-03-12 10:15:10 -07007321
7322 def pack(self):
7323 packed = []
7324 packed.append(struct.pack("!B", self.version))
7325 packed.append(struct.pack("!B", self.type))
7326 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7327 packed.append(struct.pack("!L", self.xid))
7328 packed.append(struct.pack("!B", self.table_id))
Rich Lanec2ee4b82013-04-24 17:12:38 -07007329 packed.append('\x00' * 3)
Rich Laneb658ddd2013-03-12 10:15:10 -07007330 packed.append(struct.pack("!L", self.config))
7331 length = sum([len(x) for x in packed])
7332 packed[2] = struct.pack("!H", length)
7333 return ''.join(packed)
7334
7335 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007336 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07007337 obj = table_mod()
Dan Talaycof6202252013-07-02 01:00:29 -07007338 _version = reader.read("!B")[0]
7339 assert(_version == 1)
7340 _type = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007341 assert(_type == 22)
Dan Talaycof6202252013-07-02 01:00:29 -07007342 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007343 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007344 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07007345 obj.xid = reader.read("!L")[0]
7346 obj.table_id = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007347 reader.skip(3)
Dan Talaycof6202252013-07-02 01:00:29 -07007348 obj.config = reader.read("!L")[0]
Rich Laneb658ddd2013-03-12 10:15:10 -07007349 return obj
7350
7351 def __eq__(self, other):
7352 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07007353 if self.xid != other.xid: return False
7354 if self.table_id != other.table_id: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07007355 if self.config != other.config: return False
7356 return True
7357
Rich Laneb658ddd2013-03-12 10:15:10 -07007358 def pretty_print(self, q):
7359 q.text("table_mod {")
7360 with q.group():
7361 with q.indent(2):
7362 q.breakable()
7363 q.text("xid = ");
7364 if self.xid != None:
7365 q.text("%#x" % self.xid)
7366 else:
7367 q.text('None')
7368 q.text(","); q.breakable()
7369 q.text("table_id = ");
7370 q.text("%#x" % self.table_id)
7371 q.text(","); q.breakable()
Rich Laneb658ddd2013-03-12 10:15:10 -07007372 q.text("config = ");
7373 q.text("%#x" % self.config)
7374 q.breakable()
7375 q.text('}')
7376
Rich Lane7dcdf022013-12-11 14:45:27 -08007377message.subtypes[22] = table_mod
7378
7379class table_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -07007380 version = 1
7381 type = 17
7382 stats_type = 3
Rich Laneb658ddd2013-03-12 10:15:10 -07007383
7384 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007385 if xid != None:
7386 self.xid = xid
7387 else:
7388 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07007389 if flags != None:
7390 self.flags = flags
7391 else:
7392 self.flags = 0
7393 if entries != None:
7394 self.entries = entries
7395 else:
7396 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -08007397 return
Rich Laneb658ddd2013-03-12 10:15:10 -07007398
7399 def pack(self):
7400 packed = []
7401 packed.append(struct.pack("!B", self.version))
7402 packed.append(struct.pack("!B", self.type))
7403 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7404 packed.append(struct.pack("!L", self.xid))
7405 packed.append(struct.pack("!H", self.stats_type))
7406 packed.append(struct.pack("!H", self.flags))
Rich Lane7dcdf022013-12-11 14:45:27 -08007407 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Laneb658ddd2013-03-12 10:15:10 -07007408 length = sum([len(x) for x in packed])
7409 packed[2] = struct.pack("!H", length)
7410 return ''.join(packed)
7411
7412 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007413 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07007414 obj = table_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07007415 _version = reader.read("!B")[0]
7416 assert(_version == 1)
7417 _type = reader.read("!B")[0]
7418 assert(_type == 17)
7419 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007420 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007421 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07007422 obj.xid = reader.read("!L")[0]
7423 _stats_type = reader.read("!H")[0]
7424 assert(_stats_type == 3)
7425 obj.flags = reader.read("!H")[0]
Rich Lanee2567702015-01-26 15:04:35 -08007426 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.table_stats_entry.unpack)
Rich Laneb658ddd2013-03-12 10:15:10 -07007427 return obj
7428
7429 def __eq__(self, other):
7430 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07007431 if self.xid != other.xid: return False
7432 if self.flags != other.flags: return False
7433 if self.entries != other.entries: return False
7434 return True
7435
Rich Laneb658ddd2013-03-12 10:15:10 -07007436 def pretty_print(self, q):
7437 q.text("table_stats_reply {")
7438 with q.group():
7439 with q.indent(2):
7440 q.breakable()
7441 q.text("xid = ");
7442 if self.xid != None:
7443 q.text("%#x" % self.xid)
7444 else:
7445 q.text('None')
7446 q.text(","); q.breakable()
7447 q.text("flags = ");
7448 q.text("%#x" % self.flags)
7449 q.text(","); q.breakable()
7450 q.text("entries = ");
7451 q.pp(self.entries)
7452 q.breakable()
7453 q.text('}')
7454
Rich Lane7dcdf022013-12-11 14:45:27 -08007455stats_reply.subtypes[3] = table_stats_reply
7456
7457class table_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -07007458 version = 1
7459 type = 16
7460 stats_type = 3
Rich Laneb658ddd2013-03-12 10:15:10 -07007461
7462 def __init__(self, xid=None, flags=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007463 if xid != None:
7464 self.xid = xid
7465 else:
7466 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07007467 if flags != None:
7468 self.flags = flags
7469 else:
7470 self.flags = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08007471 return
Rich Laneb658ddd2013-03-12 10:15:10 -07007472
7473 def pack(self):
7474 packed = []
7475 packed.append(struct.pack("!B", self.version))
7476 packed.append(struct.pack("!B", self.type))
7477 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7478 packed.append(struct.pack("!L", self.xid))
7479 packed.append(struct.pack("!H", self.stats_type))
7480 packed.append(struct.pack("!H", self.flags))
7481 length = sum([len(x) for x in packed])
7482 packed[2] = struct.pack("!H", length)
7483 return ''.join(packed)
7484
7485 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007486 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07007487 obj = table_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -07007488 _version = reader.read("!B")[0]
7489 assert(_version == 1)
7490 _type = reader.read("!B")[0]
7491 assert(_type == 16)
7492 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007493 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007494 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07007495 obj.xid = reader.read("!L")[0]
7496 _stats_type = reader.read("!H")[0]
7497 assert(_stats_type == 3)
7498 obj.flags = reader.read("!H")[0]
Rich Laneb658ddd2013-03-12 10:15:10 -07007499 return obj
7500
7501 def __eq__(self, other):
7502 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07007503 if self.xid != other.xid: return False
7504 if self.flags != other.flags: return False
7505 return True
7506
Rich Laneb658ddd2013-03-12 10:15:10 -07007507 def pretty_print(self, q):
7508 q.text("table_stats_request {")
7509 with q.group():
7510 with q.indent(2):
7511 q.breakable()
7512 q.text("xid = ");
7513 if self.xid != None:
7514 q.text("%#x" % self.xid)
7515 else:
7516 q.text('None')
7517 q.text(","); q.breakable()
7518 q.text("flags = ");
7519 q.text("%#x" % self.flags)
7520 q.breakable()
7521 q.text('}')
7522
Rich Lane7dcdf022013-12-11 14:45:27 -08007523stats_request.subtypes[3] = table_stats_request
7524
Rich Laneb658ddd2013-03-12 10:15:10 -07007525
7526def parse_header(buf):
7527 if len(buf) < 8:
7528 raise loxi.ProtocolError("too short to be an OpenFlow message")
7529 return struct.unpack_from("!BBHL", buf)
7530
7531def parse_message(buf):
7532 msg_ver, msg_type, msg_len, msg_xid = parse_header(buf)
Rich Lanee2567702015-01-26 15:04:35 -08007533 if msg_ver != ofp.OFP_VERSION and msg_type != ofp.OFPT_HELLO:
7534 raise loxi.ProtocolError("wrong OpenFlow version (expected %d, got %d)" % (ofp.OFP_VERSION, msg_ver))
Rich Laneb658ddd2013-03-12 10:15:10 -07007535 if len(buf) != msg_len:
7536 raise loxi.ProtocolError("incorrect message size")
Rich Lane7dcdf022013-12-11 14:45:27 -08007537 return message.unpack(loxi.generic_util.OFReader(buf))