blob: 269d5a22a0c83f4fa8d2124a141841f43d0fe491 [file] [log] [blame]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001# Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
2# Copyright (c) 2011, 2012 Open Networking Foundation
3# Copyright (c) 2012, 2013 Big Switch Networks, Inc.
Dan Talaycof6202252013-07-02 01:00:29 -07004# See the file LICENSE.pyloxi which should have been included in the source distribution
Rich Lanec2ee4b82013-04-24 17:12:38 -07005
Rich Lane7dcdf022013-12-11 14:45:27 -08006# Automatically generated by LOXI from template module.py
Rich Lanec2ee4b82013-04-24 17:12:38 -07007# Do not modify
8
9import struct
10import loxi
Rich Lanec2ee4b82013-04-24 17:12:38 -070011import util
12import loxi.generic_util
13
Rich Lanee2567702015-01-26 15:04:35 -080014import sys
15ofp = sys.modules['loxi.of13']
16
Rich Lane7dcdf022013-12-11 14:45:27 -080017class message(loxi.OFObject):
18 subtypes = {}
Rich Lanec2ee4b82013-04-24 17:12:38 -070019
Rich Lane95f7fc92014-01-27 17:08:16 -080020 version = 4
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 == 4)
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 = 4
84 type = 19
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 packed.append('\x00' * 4)
110 length = sum([len(x) for x in packed])
111 packed[2] = struct.pack("!H", length)
112 return ''.join(packed)
113
Rich Lane7dcdf022013-12-11 14:45:27 -0800114 @staticmethod
115 def unpack(reader):
116 subtype, = reader.peek('!H', 8)
Rich Lane95f7fc92014-01-27 17:08:16 -0800117 subclass = stats_reply.subtypes.get(subtype)
118 if subclass:
119 return subclass.unpack(reader)
120
121 obj = stats_reply()
122 _version = reader.read("!B")[0]
123 assert(_version == 4)
124 _type = reader.read("!B")[0]
125 assert(_type == 19)
126 _length = reader.read("!H")[0]
127 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800128 reader = orig_reader.slice(_length, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -0800129 obj.xid = reader.read("!L")[0]
130 obj.stats_type = reader.read("!H")[0]
131 obj.flags = reader.read("!H")[0]
132 reader.skip(4)
133 return obj
134
135 def __eq__(self, other):
136 if type(self) != type(other): return False
137 if self.xid != other.xid: return False
138 if self.stats_type != other.stats_type: return False
139 if self.flags != other.flags: return False
140 return True
141
142 def pretty_print(self, q):
143 q.text("stats_reply {")
144 with q.group():
145 with q.indent(2):
146 q.breakable()
147 q.text("xid = ");
148 if self.xid != None:
149 q.text("%#x" % self.xid)
150 else:
151 q.text('None')
152 q.text(","); q.breakable()
153 q.text("flags = ");
154 q.text("%#x" % self.flags)
155 q.breakable()
156 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -0800157
158message.subtypes[19] = stats_reply
159
160class aggregate_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -0700161 version = 4
162 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -0700163 stats_type = 2
164
165 def __init__(self, xid=None, flags=None, packet_count=None, byte_count=None, flow_count=None):
Rich Lane7dcdf022013-12-11 14:45:27 -0800166 if xid != None:
167 self.xid = xid
168 else:
169 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -0700170 if flags != None:
171 self.flags = flags
172 else:
173 self.flags = 0
174 if packet_count != None:
175 self.packet_count = packet_count
176 else:
177 self.packet_count = 0
178 if byte_count != None:
179 self.byte_count = byte_count
180 else:
181 self.byte_count = 0
182 if flow_count != None:
183 self.flow_count = flow_count
184 else:
185 self.flow_count = 0
Rich Lane7dcdf022013-12-11 14:45:27 -0800186 return
Rich Lanec2ee4b82013-04-24 17:12:38 -0700187
188 def pack(self):
189 packed = []
190 packed.append(struct.pack("!B", self.version))
191 packed.append(struct.pack("!B", self.type))
192 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
193 packed.append(struct.pack("!L", self.xid))
194 packed.append(struct.pack("!H", self.stats_type))
195 packed.append(struct.pack("!H", self.flags))
196 packed.append('\x00' * 4)
197 packed.append(struct.pack("!Q", self.packet_count))
198 packed.append(struct.pack("!Q", self.byte_count))
199 packed.append(struct.pack("!L", self.flow_count))
200 packed.append('\x00' * 4)
201 length = sum([len(x) for x in packed])
202 packed[2] = struct.pack("!H", length)
203 return ''.join(packed)
204
205 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800206 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700207 obj = aggregate_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -0700208 _version = reader.read("!B")[0]
209 assert(_version == 4)
210 _type = reader.read("!B")[0]
211 assert(_type == 19)
212 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800213 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800214 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -0700215 obj.xid = reader.read("!L")[0]
216 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700217 assert(_stats_type == 2)
Dan Talaycof6202252013-07-02 01:00:29 -0700218 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700219 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -0700220 obj.packet_count = reader.read("!Q")[0]
221 obj.byte_count = reader.read("!Q")[0]
222 obj.flow_count = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700223 reader.skip(4)
224 return obj
225
226 def __eq__(self, other):
227 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -0700228 if self.xid != other.xid: return False
229 if self.flags != other.flags: return False
230 if self.packet_count != other.packet_count: return False
231 if self.byte_count != other.byte_count: return False
232 if self.flow_count != other.flow_count: return False
233 return True
234
Rich Lanec2ee4b82013-04-24 17:12:38 -0700235 def pretty_print(self, q):
236 q.text("aggregate_stats_reply {")
237 with q.group():
238 with q.indent(2):
239 q.breakable()
240 q.text("xid = ");
241 if self.xid != None:
242 q.text("%#x" % self.xid)
243 else:
244 q.text('None')
245 q.text(","); q.breakable()
246 q.text("flags = ");
247 q.text("%#x" % self.flags)
248 q.text(","); q.breakable()
249 q.text("packet_count = ");
250 q.text("%#x" % self.packet_count)
251 q.text(","); q.breakable()
252 q.text("byte_count = ");
253 q.text("%#x" % self.byte_count)
254 q.text(","); q.breakable()
255 q.text("flow_count = ");
256 q.text("%#x" % self.flow_count)
257 q.breakable()
258 q.text('}')
259
Rich Lane7dcdf022013-12-11 14:45:27 -0800260stats_reply.subtypes[2] = aggregate_stats_reply
261
262class stats_request(message):
263 subtypes = {}
264
Rich Lane95f7fc92014-01-27 17:08:16 -0800265 version = 4
266 type = 18
267
268 def __init__(self, xid=None, stats_type=None, flags=None):
269 if xid != None:
270 self.xid = xid
271 else:
272 self.xid = None
273 if stats_type != None:
274 self.stats_type = stats_type
275 else:
276 self.stats_type = 0
277 if flags != None:
278 self.flags = flags
279 else:
280 self.flags = 0
281 return
282
283 def pack(self):
284 packed = []
285 packed.append(struct.pack("!B", self.version))
286 packed.append(struct.pack("!B", self.type))
287 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
288 packed.append(struct.pack("!L", self.xid))
289 packed.append(struct.pack("!H", self.stats_type))
290 packed.append(struct.pack("!H", self.flags))
291 packed.append('\x00' * 4)
292 length = sum([len(x) for x in packed])
293 packed[2] = struct.pack("!H", length)
294 return ''.join(packed)
295
Rich Lane7dcdf022013-12-11 14:45:27 -0800296 @staticmethod
297 def unpack(reader):
298 subtype, = reader.peek('!H', 8)
Rich Lane95f7fc92014-01-27 17:08:16 -0800299 subclass = stats_request.subtypes.get(subtype)
300 if subclass:
301 return subclass.unpack(reader)
302
303 obj = stats_request()
304 _version = reader.read("!B")[0]
305 assert(_version == 4)
306 _type = reader.read("!B")[0]
307 assert(_type == 18)
308 _length = reader.read("!H")[0]
309 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800310 reader = orig_reader.slice(_length, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -0800311 obj.xid = reader.read("!L")[0]
312 obj.stats_type = reader.read("!H")[0]
313 obj.flags = reader.read("!H")[0]
314 reader.skip(4)
315 return obj
316
317 def __eq__(self, other):
318 if type(self) != type(other): return False
319 if self.xid != other.xid: return False
320 if self.stats_type != other.stats_type: return False
321 if self.flags != other.flags: return False
322 return True
323
324 def pretty_print(self, q):
325 q.text("stats_request {")
326 with q.group():
327 with q.indent(2):
328 q.breakable()
329 q.text("xid = ");
330 if self.xid != None:
331 q.text("%#x" % self.xid)
332 else:
333 q.text('None')
334 q.text(","); q.breakable()
335 q.text("flags = ");
336 q.text("%#x" % self.flags)
337 q.breakable()
338 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -0800339
340message.subtypes[18] = stats_request
341
342class aggregate_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -0700343 version = 4
344 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -0700345 stats_type = 2
346
347 def __init__(self, xid=None, flags=None, table_id=None, out_port=None, out_group=None, cookie=None, cookie_mask=None, match=None):
Rich Lane7dcdf022013-12-11 14:45:27 -0800348 if xid != None:
349 self.xid = xid
350 else:
351 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -0700352 if flags != None:
353 self.flags = flags
354 else:
355 self.flags = 0
356 if table_id != None:
357 self.table_id = table_id
358 else:
359 self.table_id = 0
360 if out_port != None:
361 self.out_port = out_port
362 else:
363 self.out_port = 0
364 if out_group != None:
365 self.out_group = out_group
366 else:
367 self.out_group = 0
368 if cookie != None:
369 self.cookie = cookie
370 else:
371 self.cookie = 0
372 if cookie_mask != None:
373 self.cookie_mask = cookie_mask
374 else:
375 self.cookie_mask = 0
376 if match != None:
377 self.match = match
378 else:
Rich Lanee2567702015-01-26 15:04:35 -0800379 self.match = ofp.match()
Rich Lane7dcdf022013-12-11 14:45:27 -0800380 return
Rich Lanec2ee4b82013-04-24 17:12:38 -0700381
382 def pack(self):
383 packed = []
384 packed.append(struct.pack("!B", self.version))
385 packed.append(struct.pack("!B", self.type))
386 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
387 packed.append(struct.pack("!L", self.xid))
388 packed.append(struct.pack("!H", self.stats_type))
389 packed.append(struct.pack("!H", self.flags))
390 packed.append('\x00' * 4)
391 packed.append(struct.pack("!B", self.table_id))
392 packed.append('\x00' * 3)
Dan Talaycof6202252013-07-02 01:00:29 -0700393 packed.append(util.pack_port_no(self.out_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700394 packed.append(struct.pack("!L", self.out_group))
395 packed.append('\x00' * 4)
396 packed.append(struct.pack("!Q", self.cookie))
397 packed.append(struct.pack("!Q", self.cookie_mask))
398 packed.append(self.match.pack())
399 length = sum([len(x) for x in packed])
400 packed[2] = struct.pack("!H", length)
401 return ''.join(packed)
402
403 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800404 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700405 obj = aggregate_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -0700406 _version = reader.read("!B")[0]
407 assert(_version == 4)
408 _type = reader.read("!B")[0]
409 assert(_type == 18)
410 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800411 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800412 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -0700413 obj.xid = reader.read("!L")[0]
414 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700415 assert(_stats_type == 2)
Dan Talaycof6202252013-07-02 01:00:29 -0700416 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700417 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -0700418 obj.table_id = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700419 reader.skip(3)
Dan Talaycof6202252013-07-02 01:00:29 -0700420 obj.out_port = util.unpack_port_no(reader)
421 obj.out_group = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700422 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -0700423 obj.cookie = reader.read("!Q")[0]
424 obj.cookie_mask = reader.read("!Q")[0]
Rich Lanee2567702015-01-26 15:04:35 -0800425 obj.match = ofp.match.unpack(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -0700426 return obj
427
428 def __eq__(self, other):
429 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -0700430 if self.xid != other.xid: return False
431 if self.flags != other.flags: return False
432 if self.table_id != other.table_id: return False
433 if self.out_port != other.out_port: return False
434 if self.out_group != other.out_group: return False
435 if self.cookie != other.cookie: return False
436 if self.cookie_mask != other.cookie_mask: return False
437 if self.match != other.match: return False
438 return True
439
Rich Lanec2ee4b82013-04-24 17:12:38 -0700440 def pretty_print(self, q):
441 q.text("aggregate_stats_request {")
442 with q.group():
443 with q.indent(2):
444 q.breakable()
445 q.text("xid = ");
446 if self.xid != None:
447 q.text("%#x" % self.xid)
448 else:
449 q.text('None')
450 q.text(","); q.breakable()
451 q.text("flags = ");
452 q.text("%#x" % self.flags)
453 q.text(","); q.breakable()
454 q.text("table_id = ");
455 q.text("%#x" % self.table_id)
456 q.text(","); q.breakable()
457 q.text("out_port = ");
458 q.text(util.pretty_port(self.out_port))
459 q.text(","); q.breakable()
460 q.text("out_group = ");
461 q.text("%#x" % self.out_group)
462 q.text(","); q.breakable()
463 q.text("cookie = ");
464 q.text("%#x" % self.cookie)
465 q.text(","); q.breakable()
466 q.text("cookie_mask = ");
467 q.text("%#x" % self.cookie_mask)
468 q.text(","); q.breakable()
469 q.text("match = ");
470 q.pp(self.match)
471 q.breakable()
472 q.text('}')
473
Rich Lane7dcdf022013-12-11 14:45:27 -0800474stats_request.subtypes[2] = aggregate_stats_request
475
476class async_get_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -0700477 version = 4
478 type = 27
Rich Lanec2ee4b82013-04-24 17:12:38 -0700479
480 def __init__(self, xid=None, packet_in_mask_equal_master=None, packet_in_mask_slave=None, port_status_mask_equal_master=None, port_status_mask_slave=None, flow_removed_mask_equal_master=None, flow_removed_mask_slave=None):
Rich Lane7dcdf022013-12-11 14:45:27 -0800481 if xid != None:
482 self.xid = xid
483 else:
484 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -0700485 if packet_in_mask_equal_master != None:
486 self.packet_in_mask_equal_master = packet_in_mask_equal_master
487 else:
488 self.packet_in_mask_equal_master = 0
489 if packet_in_mask_slave != None:
490 self.packet_in_mask_slave = packet_in_mask_slave
491 else:
492 self.packet_in_mask_slave = 0
493 if port_status_mask_equal_master != None:
494 self.port_status_mask_equal_master = port_status_mask_equal_master
495 else:
496 self.port_status_mask_equal_master = 0
497 if port_status_mask_slave != None:
498 self.port_status_mask_slave = port_status_mask_slave
499 else:
500 self.port_status_mask_slave = 0
501 if flow_removed_mask_equal_master != None:
502 self.flow_removed_mask_equal_master = flow_removed_mask_equal_master
503 else:
504 self.flow_removed_mask_equal_master = 0
505 if flow_removed_mask_slave != None:
506 self.flow_removed_mask_slave = flow_removed_mask_slave
507 else:
508 self.flow_removed_mask_slave = 0
Rich Lane7dcdf022013-12-11 14:45:27 -0800509 return
Rich Lanec2ee4b82013-04-24 17:12:38 -0700510
511 def pack(self):
512 packed = []
513 packed.append(struct.pack("!B", self.version))
514 packed.append(struct.pack("!B", self.type))
515 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
516 packed.append(struct.pack("!L", self.xid))
517 packed.append(struct.pack("!L", self.packet_in_mask_equal_master))
518 packed.append(struct.pack("!L", self.packet_in_mask_slave))
519 packed.append(struct.pack("!L", self.port_status_mask_equal_master))
520 packed.append(struct.pack("!L", self.port_status_mask_slave))
521 packed.append(struct.pack("!L", self.flow_removed_mask_equal_master))
522 packed.append(struct.pack("!L", self.flow_removed_mask_slave))
523 length = sum([len(x) for x in packed])
524 packed[2] = struct.pack("!H", length)
525 return ''.join(packed)
526
527 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800528 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700529 obj = async_get_reply()
Dan Talaycof6202252013-07-02 01:00:29 -0700530 _version = reader.read("!B")[0]
531 assert(_version == 4)
532 _type = reader.read("!B")[0]
533 assert(_type == 27)
534 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800535 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800536 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -0700537 obj.xid = reader.read("!L")[0]
538 obj.packet_in_mask_equal_master = reader.read("!L")[0]
539 obj.packet_in_mask_slave = reader.read("!L")[0]
540 obj.port_status_mask_equal_master = reader.read("!L")[0]
541 obj.port_status_mask_slave = reader.read("!L")[0]
542 obj.flow_removed_mask_equal_master = reader.read("!L")[0]
543 obj.flow_removed_mask_slave = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700544 return obj
545
546 def __eq__(self, other):
547 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -0700548 if self.xid != other.xid: return False
549 if self.packet_in_mask_equal_master != other.packet_in_mask_equal_master: return False
550 if self.packet_in_mask_slave != other.packet_in_mask_slave: return False
551 if self.port_status_mask_equal_master != other.port_status_mask_equal_master: return False
552 if self.port_status_mask_slave != other.port_status_mask_slave: return False
553 if self.flow_removed_mask_equal_master != other.flow_removed_mask_equal_master: return False
554 if self.flow_removed_mask_slave != other.flow_removed_mask_slave: return False
555 return True
556
Rich Lanec2ee4b82013-04-24 17:12:38 -0700557 def pretty_print(self, q):
558 q.text("async_get_reply {")
559 with q.group():
560 with q.indent(2):
561 q.breakable()
562 q.text("xid = ");
563 if self.xid != None:
564 q.text("%#x" % self.xid)
565 else:
566 q.text('None')
567 q.text(","); q.breakable()
568 q.text("packet_in_mask_equal_master = ");
569 q.text("%#x" % self.packet_in_mask_equal_master)
570 q.text(","); q.breakable()
571 q.text("packet_in_mask_slave = ");
572 q.text("%#x" % self.packet_in_mask_slave)
573 q.text(","); q.breakable()
574 q.text("port_status_mask_equal_master = ");
575 q.text("%#x" % self.port_status_mask_equal_master)
576 q.text(","); q.breakable()
577 q.text("port_status_mask_slave = ");
578 q.text("%#x" % self.port_status_mask_slave)
579 q.text(","); q.breakable()
580 q.text("flow_removed_mask_equal_master = ");
581 q.text("%#x" % self.flow_removed_mask_equal_master)
582 q.text(","); q.breakable()
583 q.text("flow_removed_mask_slave = ");
584 q.text("%#x" % self.flow_removed_mask_slave)
585 q.breakable()
586 q.text('}')
587
Rich Lane7dcdf022013-12-11 14:45:27 -0800588message.subtypes[27] = async_get_reply
589
590class async_get_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -0700591 version = 4
592 type = 26
Rich Lanec2ee4b82013-04-24 17:12:38 -0700593
594 def __init__(self, xid=None, packet_in_mask_equal_master=None, packet_in_mask_slave=None, port_status_mask_equal_master=None, port_status_mask_slave=None, flow_removed_mask_equal_master=None, flow_removed_mask_slave=None):
Rich Lane7dcdf022013-12-11 14:45:27 -0800595 if xid != None:
596 self.xid = xid
597 else:
598 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -0700599 if packet_in_mask_equal_master != None:
600 self.packet_in_mask_equal_master = packet_in_mask_equal_master
601 else:
602 self.packet_in_mask_equal_master = 0
603 if packet_in_mask_slave != None:
604 self.packet_in_mask_slave = packet_in_mask_slave
605 else:
606 self.packet_in_mask_slave = 0
607 if port_status_mask_equal_master != None:
608 self.port_status_mask_equal_master = port_status_mask_equal_master
609 else:
610 self.port_status_mask_equal_master = 0
611 if port_status_mask_slave != None:
612 self.port_status_mask_slave = port_status_mask_slave
613 else:
614 self.port_status_mask_slave = 0
615 if flow_removed_mask_equal_master != None:
616 self.flow_removed_mask_equal_master = flow_removed_mask_equal_master
617 else:
618 self.flow_removed_mask_equal_master = 0
619 if flow_removed_mask_slave != None:
620 self.flow_removed_mask_slave = flow_removed_mask_slave
621 else:
622 self.flow_removed_mask_slave = 0
Rich Lane7dcdf022013-12-11 14:45:27 -0800623 return
Rich Lanec2ee4b82013-04-24 17:12:38 -0700624
625 def pack(self):
626 packed = []
627 packed.append(struct.pack("!B", self.version))
628 packed.append(struct.pack("!B", self.type))
629 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
630 packed.append(struct.pack("!L", self.xid))
631 packed.append(struct.pack("!L", self.packet_in_mask_equal_master))
632 packed.append(struct.pack("!L", self.packet_in_mask_slave))
633 packed.append(struct.pack("!L", self.port_status_mask_equal_master))
634 packed.append(struct.pack("!L", self.port_status_mask_slave))
635 packed.append(struct.pack("!L", self.flow_removed_mask_equal_master))
636 packed.append(struct.pack("!L", self.flow_removed_mask_slave))
637 length = sum([len(x) for x in packed])
638 packed[2] = struct.pack("!H", length)
639 return ''.join(packed)
640
641 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800642 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700643 obj = async_get_request()
Dan Talaycof6202252013-07-02 01:00:29 -0700644 _version = reader.read("!B")[0]
645 assert(_version == 4)
646 _type = reader.read("!B")[0]
647 assert(_type == 26)
648 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800649 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800650 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -0700651 obj.xid = reader.read("!L")[0]
652 obj.packet_in_mask_equal_master = reader.read("!L")[0]
653 obj.packet_in_mask_slave = reader.read("!L")[0]
654 obj.port_status_mask_equal_master = reader.read("!L")[0]
655 obj.port_status_mask_slave = reader.read("!L")[0]
656 obj.flow_removed_mask_equal_master = reader.read("!L")[0]
657 obj.flow_removed_mask_slave = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700658 return obj
659
660 def __eq__(self, other):
661 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -0700662 if self.xid != other.xid: return False
663 if self.packet_in_mask_equal_master != other.packet_in_mask_equal_master: return False
664 if self.packet_in_mask_slave != other.packet_in_mask_slave: return False
665 if self.port_status_mask_equal_master != other.port_status_mask_equal_master: return False
666 if self.port_status_mask_slave != other.port_status_mask_slave: return False
667 if self.flow_removed_mask_equal_master != other.flow_removed_mask_equal_master: return False
668 if self.flow_removed_mask_slave != other.flow_removed_mask_slave: return False
669 return True
670
Rich Lanec2ee4b82013-04-24 17:12:38 -0700671 def pretty_print(self, q):
672 q.text("async_get_request {")
673 with q.group():
674 with q.indent(2):
675 q.breakable()
676 q.text("xid = ");
677 if self.xid != None:
678 q.text("%#x" % self.xid)
679 else:
680 q.text('None')
681 q.text(","); q.breakable()
682 q.text("packet_in_mask_equal_master = ");
683 q.text("%#x" % self.packet_in_mask_equal_master)
684 q.text(","); q.breakable()
685 q.text("packet_in_mask_slave = ");
686 q.text("%#x" % self.packet_in_mask_slave)
687 q.text(","); q.breakable()
688 q.text("port_status_mask_equal_master = ");
689 q.text("%#x" % self.port_status_mask_equal_master)
690 q.text(","); q.breakable()
691 q.text("port_status_mask_slave = ");
692 q.text("%#x" % self.port_status_mask_slave)
693 q.text(","); q.breakable()
694 q.text("flow_removed_mask_equal_master = ");
695 q.text("%#x" % self.flow_removed_mask_equal_master)
696 q.text(","); q.breakable()
697 q.text("flow_removed_mask_slave = ");
698 q.text("%#x" % self.flow_removed_mask_slave)
699 q.breakable()
700 q.text('}')
701
Rich Lane7dcdf022013-12-11 14:45:27 -0800702message.subtypes[26] = async_get_request
703
704class async_set(message):
Dan Talaycof6202252013-07-02 01:00:29 -0700705 version = 4
706 type = 28
Rich Lanec2ee4b82013-04-24 17:12:38 -0700707
708 def __init__(self, xid=None, packet_in_mask_equal_master=None, packet_in_mask_slave=None, port_status_mask_equal_master=None, port_status_mask_slave=None, flow_removed_mask_equal_master=None, flow_removed_mask_slave=None):
Rich Lane7dcdf022013-12-11 14:45:27 -0800709 if xid != None:
710 self.xid = xid
711 else:
712 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -0700713 if packet_in_mask_equal_master != None:
714 self.packet_in_mask_equal_master = packet_in_mask_equal_master
715 else:
716 self.packet_in_mask_equal_master = 0
717 if packet_in_mask_slave != None:
718 self.packet_in_mask_slave = packet_in_mask_slave
719 else:
720 self.packet_in_mask_slave = 0
721 if port_status_mask_equal_master != None:
722 self.port_status_mask_equal_master = port_status_mask_equal_master
723 else:
724 self.port_status_mask_equal_master = 0
725 if port_status_mask_slave != None:
726 self.port_status_mask_slave = port_status_mask_slave
727 else:
728 self.port_status_mask_slave = 0
729 if flow_removed_mask_equal_master != None:
730 self.flow_removed_mask_equal_master = flow_removed_mask_equal_master
731 else:
732 self.flow_removed_mask_equal_master = 0
733 if flow_removed_mask_slave != None:
734 self.flow_removed_mask_slave = flow_removed_mask_slave
735 else:
736 self.flow_removed_mask_slave = 0
Rich Lane7dcdf022013-12-11 14:45:27 -0800737 return
Rich Lanec2ee4b82013-04-24 17:12:38 -0700738
739 def pack(self):
740 packed = []
741 packed.append(struct.pack("!B", self.version))
742 packed.append(struct.pack("!B", self.type))
743 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
744 packed.append(struct.pack("!L", self.xid))
745 packed.append(struct.pack("!L", self.packet_in_mask_equal_master))
746 packed.append(struct.pack("!L", self.packet_in_mask_slave))
747 packed.append(struct.pack("!L", self.port_status_mask_equal_master))
748 packed.append(struct.pack("!L", self.port_status_mask_slave))
749 packed.append(struct.pack("!L", self.flow_removed_mask_equal_master))
750 packed.append(struct.pack("!L", self.flow_removed_mask_slave))
751 length = sum([len(x) for x in packed])
752 packed[2] = struct.pack("!H", length)
753 return ''.join(packed)
754
755 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800756 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700757 obj = async_set()
Dan Talaycof6202252013-07-02 01:00:29 -0700758 _version = reader.read("!B")[0]
759 assert(_version == 4)
760 _type = reader.read("!B")[0]
761 assert(_type == 28)
762 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800763 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800764 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -0700765 obj.xid = reader.read("!L")[0]
766 obj.packet_in_mask_equal_master = reader.read("!L")[0]
767 obj.packet_in_mask_slave = reader.read("!L")[0]
768 obj.port_status_mask_equal_master = reader.read("!L")[0]
769 obj.port_status_mask_slave = reader.read("!L")[0]
770 obj.flow_removed_mask_equal_master = reader.read("!L")[0]
771 obj.flow_removed_mask_slave = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700772 return obj
773
774 def __eq__(self, other):
775 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -0700776 if self.xid != other.xid: return False
777 if self.packet_in_mask_equal_master != other.packet_in_mask_equal_master: return False
778 if self.packet_in_mask_slave != other.packet_in_mask_slave: return False
779 if self.port_status_mask_equal_master != other.port_status_mask_equal_master: return False
780 if self.port_status_mask_slave != other.port_status_mask_slave: return False
781 if self.flow_removed_mask_equal_master != other.flow_removed_mask_equal_master: return False
782 if self.flow_removed_mask_slave != other.flow_removed_mask_slave: return False
783 return True
784
Rich Lanec2ee4b82013-04-24 17:12:38 -0700785 def pretty_print(self, q):
786 q.text("async_set {")
787 with q.group():
788 with q.indent(2):
789 q.breakable()
790 q.text("xid = ");
791 if self.xid != None:
792 q.text("%#x" % self.xid)
793 else:
794 q.text('None')
795 q.text(","); q.breakable()
796 q.text("packet_in_mask_equal_master = ");
797 q.text("%#x" % self.packet_in_mask_equal_master)
798 q.text(","); q.breakable()
799 q.text("packet_in_mask_slave = ");
800 q.text("%#x" % self.packet_in_mask_slave)
801 q.text(","); q.breakable()
802 q.text("port_status_mask_equal_master = ");
803 q.text("%#x" % self.port_status_mask_equal_master)
804 q.text(","); q.breakable()
805 q.text("port_status_mask_slave = ");
806 q.text("%#x" % self.port_status_mask_slave)
807 q.text(","); q.breakable()
808 q.text("flow_removed_mask_equal_master = ");
809 q.text("%#x" % self.flow_removed_mask_equal_master)
810 q.text(","); q.breakable()
811 q.text("flow_removed_mask_slave = ");
812 q.text("%#x" % self.flow_removed_mask_slave)
813 q.breakable()
814 q.text('}')
815
Rich Lane7dcdf022013-12-11 14:45:27 -0800816message.subtypes[28] = async_set
817
818class error_msg(message):
819 subtypes = {}
820
Rich Lane95f7fc92014-01-27 17:08:16 -0800821 version = 4
822 type = 1
823
824 def __init__(self, xid=None, err_type=None):
825 if xid != None:
826 self.xid = xid
827 else:
828 self.xid = None
829 if err_type != None:
830 self.err_type = err_type
831 else:
832 self.err_type = 0
833 return
834
835 def pack(self):
836 packed = []
837 packed.append(struct.pack("!B", self.version))
838 packed.append(struct.pack("!B", self.type))
839 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
840 packed.append(struct.pack("!L", self.xid))
841 packed.append(struct.pack("!H", self.err_type))
842 length = sum([len(x) for x in packed])
843 packed[2] = struct.pack("!H", length)
844 return ''.join(packed)
845
Rich Lane7dcdf022013-12-11 14:45:27 -0800846 @staticmethod
847 def unpack(reader):
848 subtype, = reader.peek('!H', 8)
Rich Lane95f7fc92014-01-27 17:08:16 -0800849 subclass = error_msg.subtypes.get(subtype)
850 if subclass:
851 return subclass.unpack(reader)
852
853 obj = error_msg()
854 _version = reader.read("!B")[0]
855 assert(_version == 4)
856 _type = reader.read("!B")[0]
857 assert(_type == 1)
858 _length = reader.read("!H")[0]
859 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800860 reader = orig_reader.slice(_length, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -0800861 obj.xid = reader.read("!L")[0]
862 obj.err_type = reader.read("!H")[0]
863 return obj
864
865 def __eq__(self, other):
866 if type(self) != type(other): return False
867 if self.xid != other.xid: return False
868 if self.err_type != other.err_type: return False
869 return True
870
871 def pretty_print(self, q):
872 q.text("error_msg {")
873 with q.group():
874 with q.indent(2):
875 q.breakable()
876 q.text("xid = ");
877 if self.xid != None:
878 q.text("%#x" % self.xid)
879 else:
880 q.text('None')
881 q.breakable()
882 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -0800883
884message.subtypes[1] = error_msg
885
886class bad_action_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -0700887 version = 4
888 type = 1
889 err_type = 2
890
891 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -0800892 if xid != None:
893 self.xid = xid
894 else:
895 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -0700896 if code != None:
897 self.code = code
898 else:
899 self.code = 0
900 if data != None:
901 self.data = data
902 else:
903 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -0800904 return
Rich Lane6f4978c2013-10-20 21:33:52 -0700905
906 def pack(self):
907 packed = []
908 packed.append(struct.pack("!B", self.version))
909 packed.append(struct.pack("!B", self.type))
910 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
911 packed.append(struct.pack("!L", self.xid))
912 packed.append(struct.pack("!H", self.err_type))
913 packed.append(struct.pack("!H", self.code))
914 packed.append(self.data)
915 length = sum([len(x) for x in packed])
916 packed[2] = struct.pack("!H", length)
917 return ''.join(packed)
918
919 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800920 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -0700921 obj = bad_action_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -0700922 _version = reader.read("!B")[0]
923 assert(_version == 4)
924 _type = reader.read("!B")[0]
925 assert(_type == 1)
926 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800927 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800928 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -0700929 obj.xid = reader.read("!L")[0]
930 _err_type = reader.read("!H")[0]
931 assert(_err_type == 2)
932 obj.code = reader.read("!H")[0]
933 obj.data = str(reader.read_all())
934 return obj
935
936 def __eq__(self, other):
937 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -0700938 if self.xid != other.xid: return False
939 if self.code != other.code: return False
940 if self.data != other.data: return False
941 return True
942
Rich Lane6f4978c2013-10-20 21:33:52 -0700943 def pretty_print(self, q):
944 q.text("bad_action_error_msg {")
945 with q.group():
946 with q.indent(2):
947 q.breakable()
948 q.text("xid = ");
949 if self.xid != None:
950 q.text("%#x" % self.xid)
951 else:
952 q.text('None')
953 q.text(","); q.breakable()
954 q.text("code = ");
955 q.text("%#x" % self.code)
956 q.text(","); q.breakable()
957 q.text("data = ");
958 q.pp(self.data)
959 q.breakable()
960 q.text('}')
961
Rich Lane7dcdf022013-12-11 14:45:27 -0800962error_msg.subtypes[2] = bad_action_error_msg
963
964class bad_instruction_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -0700965 version = 4
966 type = 1
967 err_type = 3
968
969 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -0800970 if xid != None:
971 self.xid = xid
972 else:
973 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -0700974 if code != None:
975 self.code = code
976 else:
977 self.code = 0
978 if data != None:
979 self.data = data
980 else:
981 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -0800982 return
Rich Lane6f4978c2013-10-20 21:33:52 -0700983
984 def pack(self):
985 packed = []
986 packed.append(struct.pack("!B", self.version))
987 packed.append(struct.pack("!B", self.type))
988 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
989 packed.append(struct.pack("!L", self.xid))
990 packed.append(struct.pack("!H", self.err_type))
991 packed.append(struct.pack("!H", self.code))
992 packed.append(self.data)
993 length = sum([len(x) for x in packed])
994 packed[2] = struct.pack("!H", length)
995 return ''.join(packed)
996
997 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800998 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -0700999 obj = bad_instruction_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -07001000 _version = reader.read("!B")[0]
1001 assert(_version == 4)
1002 _type = reader.read("!B")[0]
1003 assert(_type == 1)
1004 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001005 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001006 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -07001007 obj.xid = reader.read("!L")[0]
1008 _err_type = reader.read("!H")[0]
1009 assert(_err_type == 3)
1010 obj.code = reader.read("!H")[0]
1011 obj.data = str(reader.read_all())
1012 return obj
1013
1014 def __eq__(self, other):
1015 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07001016 if self.xid != other.xid: return False
1017 if self.code != other.code: return False
1018 if self.data != other.data: return False
1019 return True
1020
Rich Lane6f4978c2013-10-20 21:33:52 -07001021 def pretty_print(self, q):
1022 q.text("bad_instruction_error_msg {")
1023 with q.group():
1024 with q.indent(2):
1025 q.breakable()
1026 q.text("xid = ");
1027 if self.xid != None:
1028 q.text("%#x" % self.xid)
1029 else:
1030 q.text('None')
1031 q.text(","); q.breakable()
1032 q.text("code = ");
1033 q.text("%#x" % self.code)
1034 q.text(","); q.breakable()
1035 q.text("data = ");
1036 q.pp(self.data)
1037 q.breakable()
1038 q.text('}')
1039
Rich Lane7dcdf022013-12-11 14:45:27 -08001040error_msg.subtypes[3] = bad_instruction_error_msg
1041
1042class bad_match_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -07001043 version = 4
1044 type = 1
1045 err_type = 4
1046
1047 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001048 if xid != None:
1049 self.xid = xid
1050 else:
1051 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07001052 if code != None:
1053 self.code = code
1054 else:
1055 self.code = 0
1056 if data != None:
1057 self.data = data
1058 else:
1059 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08001060 return
Rich Lane6f4978c2013-10-20 21:33:52 -07001061
1062 def pack(self):
1063 packed = []
1064 packed.append(struct.pack("!B", self.version))
1065 packed.append(struct.pack("!B", self.type))
1066 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1067 packed.append(struct.pack("!L", self.xid))
1068 packed.append(struct.pack("!H", self.err_type))
1069 packed.append(struct.pack("!H", self.code))
1070 packed.append(self.data)
1071 length = sum([len(x) for x in packed])
1072 packed[2] = struct.pack("!H", length)
1073 return ''.join(packed)
1074
1075 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001076 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07001077 obj = bad_match_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -07001078 _version = reader.read("!B")[0]
1079 assert(_version == 4)
1080 _type = reader.read("!B")[0]
1081 assert(_type == 1)
1082 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001083 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001084 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -07001085 obj.xid = reader.read("!L")[0]
1086 _err_type = reader.read("!H")[0]
1087 assert(_err_type == 4)
1088 obj.code = reader.read("!H")[0]
1089 obj.data = str(reader.read_all())
1090 return obj
1091
1092 def __eq__(self, other):
1093 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07001094 if self.xid != other.xid: return False
1095 if self.code != other.code: return False
1096 if self.data != other.data: return False
1097 return True
1098
Rich Lane6f4978c2013-10-20 21:33:52 -07001099 def pretty_print(self, q):
1100 q.text("bad_match_error_msg {")
1101 with q.group():
1102 with q.indent(2):
1103 q.breakable()
1104 q.text("xid = ");
1105 if self.xid != None:
1106 q.text("%#x" % self.xid)
1107 else:
1108 q.text('None')
1109 q.text(","); q.breakable()
1110 q.text("code = ");
1111 q.text("%#x" % self.code)
1112 q.text(","); q.breakable()
1113 q.text("data = ");
1114 q.pp(self.data)
1115 q.breakable()
1116 q.text('}')
1117
Rich Lane7dcdf022013-12-11 14:45:27 -08001118error_msg.subtypes[4] = bad_match_error_msg
1119
1120class bad_request_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -07001121 version = 4
1122 type = 1
1123 err_type = 1
1124
1125 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001126 if xid != None:
1127 self.xid = xid
1128 else:
1129 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07001130 if code != None:
1131 self.code = code
1132 else:
1133 self.code = 0
1134 if data != None:
1135 self.data = data
1136 else:
1137 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08001138 return
Rich Lane6f4978c2013-10-20 21:33:52 -07001139
1140 def pack(self):
1141 packed = []
1142 packed.append(struct.pack("!B", self.version))
1143 packed.append(struct.pack("!B", self.type))
1144 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1145 packed.append(struct.pack("!L", self.xid))
1146 packed.append(struct.pack("!H", self.err_type))
1147 packed.append(struct.pack("!H", self.code))
1148 packed.append(self.data)
1149 length = sum([len(x) for x in packed])
1150 packed[2] = struct.pack("!H", length)
1151 return ''.join(packed)
1152
1153 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001154 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07001155 obj = bad_request_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -07001156 _version = reader.read("!B")[0]
1157 assert(_version == 4)
1158 _type = reader.read("!B")[0]
1159 assert(_type == 1)
1160 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001161 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001162 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -07001163 obj.xid = reader.read("!L")[0]
1164 _err_type = reader.read("!H")[0]
1165 assert(_err_type == 1)
1166 obj.code = reader.read("!H")[0]
1167 obj.data = str(reader.read_all())
1168 return obj
1169
1170 def __eq__(self, other):
1171 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07001172 if self.xid != other.xid: return False
1173 if self.code != other.code: return False
1174 if self.data != other.data: return False
1175 return True
1176
Rich Lane6f4978c2013-10-20 21:33:52 -07001177 def pretty_print(self, q):
1178 q.text("bad_request_error_msg {")
1179 with q.group():
1180 with q.indent(2):
1181 q.breakable()
1182 q.text("xid = ");
1183 if self.xid != None:
1184 q.text("%#x" % self.xid)
1185 else:
1186 q.text('None')
1187 q.text(","); q.breakable()
1188 q.text("code = ");
1189 q.text("%#x" % self.code)
1190 q.text(","); q.breakable()
1191 q.text("data = ");
1192 q.pp(self.data)
1193 q.breakable()
1194 q.text('}')
1195
Rich Lane7dcdf022013-12-11 14:45:27 -08001196error_msg.subtypes[1] = bad_request_error_msg
1197
1198class barrier_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -07001199 version = 4
1200 type = 21
Rich Lanec2ee4b82013-04-24 17:12:38 -07001201
1202 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001203 if xid != None:
1204 self.xid = xid
1205 else:
1206 self.xid = None
1207 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07001208
1209 def pack(self):
1210 packed = []
1211 packed.append(struct.pack("!B", self.version))
1212 packed.append(struct.pack("!B", self.type))
1213 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1214 packed.append(struct.pack("!L", self.xid))
1215 length = sum([len(x) for x in packed])
1216 packed[2] = struct.pack("!H", length)
1217 return ''.join(packed)
1218
1219 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001220 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001221 obj = barrier_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07001222 _version = reader.read("!B")[0]
1223 assert(_version == 4)
1224 _type = reader.read("!B")[0]
1225 assert(_type == 21)
1226 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001227 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001228 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07001229 obj.xid = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001230 return obj
1231
1232 def __eq__(self, other):
1233 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07001234 if self.xid != other.xid: return False
1235 return True
1236
Rich Lanec2ee4b82013-04-24 17:12:38 -07001237 def pretty_print(self, q):
1238 q.text("barrier_reply {")
1239 with q.group():
1240 with q.indent(2):
1241 q.breakable()
1242 q.text("xid = ");
1243 if self.xid != None:
1244 q.text("%#x" % self.xid)
1245 else:
1246 q.text('None')
1247 q.breakable()
1248 q.text('}')
1249
Rich Lane7dcdf022013-12-11 14:45:27 -08001250message.subtypes[21] = barrier_reply
1251
1252class barrier_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -07001253 version = 4
1254 type = 20
Rich Lanec2ee4b82013-04-24 17:12:38 -07001255
1256 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001257 if xid != None:
1258 self.xid = xid
1259 else:
1260 self.xid = None
1261 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07001262
1263 def pack(self):
1264 packed = []
1265 packed.append(struct.pack("!B", self.version))
1266 packed.append(struct.pack("!B", self.type))
1267 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1268 packed.append(struct.pack("!L", self.xid))
1269 length = sum([len(x) for x in packed])
1270 packed[2] = struct.pack("!H", length)
1271 return ''.join(packed)
1272
1273 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001274 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001275 obj = barrier_request()
Dan Talaycof6202252013-07-02 01:00:29 -07001276 _version = reader.read("!B")[0]
1277 assert(_version == 4)
1278 _type = reader.read("!B")[0]
1279 assert(_type == 20)
1280 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001281 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001282 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07001283 obj.xid = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001284 return obj
1285
1286 def __eq__(self, other):
1287 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07001288 if self.xid != other.xid: return False
1289 return True
1290
Rich Lanec2ee4b82013-04-24 17:12:38 -07001291 def pretty_print(self, q):
1292 q.text("barrier_request {")
1293 with q.group():
1294 with q.indent(2):
1295 q.breakable()
1296 q.text("xid = ");
1297 if self.xid != None:
1298 q.text("%#x" % self.xid)
1299 else:
1300 q.text('None')
1301 q.breakable()
1302 q.text('}')
1303
Rich Lane7dcdf022013-12-11 14:45:27 -08001304message.subtypes[20] = barrier_request
1305
1306class experimenter(message):
1307 subtypes = {}
1308
Rich Lane95f7fc92014-01-27 17:08:16 -08001309 version = 4
1310 type = 4
1311
1312 def __init__(self, xid=None, experimenter=None, subtype=None, data=None):
1313 if xid != None:
1314 self.xid = xid
1315 else:
1316 self.xid = None
1317 if experimenter != None:
1318 self.experimenter = experimenter
1319 else:
1320 self.experimenter = 0
1321 if subtype != None:
1322 self.subtype = subtype
1323 else:
1324 self.subtype = 0
1325 if data != None:
1326 self.data = data
1327 else:
1328 self.data = ''
1329 return
1330
1331 def pack(self):
1332 packed = []
1333 packed.append(struct.pack("!B", self.version))
1334 packed.append(struct.pack("!B", self.type))
1335 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1336 packed.append(struct.pack("!L", self.xid))
1337 packed.append(struct.pack("!L", self.experimenter))
1338 packed.append(struct.pack("!L", self.subtype))
1339 packed.append(self.data)
1340 length = sum([len(x) for x in packed])
1341 packed[2] = struct.pack("!H", length)
1342 return ''.join(packed)
1343
Rich Lane7dcdf022013-12-11 14:45:27 -08001344 @staticmethod
1345 def unpack(reader):
1346 subtype, = reader.peek('!L', 8)
Rich Lane95f7fc92014-01-27 17:08:16 -08001347 subclass = experimenter.subtypes.get(subtype)
1348 if subclass:
1349 return subclass.unpack(reader)
1350
1351 obj = experimenter()
1352 _version = reader.read("!B")[0]
1353 assert(_version == 4)
1354 _type = reader.read("!B")[0]
1355 assert(_type == 4)
1356 _length = reader.read("!H")[0]
1357 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001358 reader = orig_reader.slice(_length, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -08001359 obj.xid = reader.read("!L")[0]
1360 obj.experimenter = reader.read("!L")[0]
1361 obj.subtype = reader.read("!L")[0]
1362 obj.data = str(reader.read_all())
1363 return obj
1364
1365 def __eq__(self, other):
1366 if type(self) != type(other): return False
1367 if self.xid != other.xid: return False
1368 if self.experimenter != other.experimenter: return False
1369 if self.subtype != other.subtype: return False
1370 if self.data != other.data: return False
1371 return True
1372
1373 def pretty_print(self, q):
1374 q.text("experimenter {")
1375 with q.group():
1376 with q.indent(2):
1377 q.breakable()
1378 q.text("xid = ");
1379 if self.xid != None:
1380 q.text("%#x" % self.xid)
1381 else:
1382 q.text('None')
1383 q.text(","); q.breakable()
1384 q.text("subtype = ");
1385 q.text("%#x" % self.subtype)
1386 q.text(","); q.breakable()
1387 q.text("data = ");
1388 q.pp(self.data)
1389 q.breakable()
1390 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -08001391
1392message.subtypes[4] = experimenter
1393
1394class bsn_header(experimenter):
1395 subtypes = {}
1396
Rich Lane95f7fc92014-01-27 17:08:16 -08001397 version = 4
1398 type = 4
1399 experimenter = 6035143
1400
1401 def __init__(self, xid=None, subtype=None):
1402 if xid != None:
1403 self.xid = xid
1404 else:
1405 self.xid = None
1406 if subtype != None:
1407 self.subtype = subtype
1408 else:
1409 self.subtype = 0
1410 return
1411
1412 def pack(self):
1413 packed = []
1414 packed.append(struct.pack("!B", self.version))
1415 packed.append(struct.pack("!B", self.type))
1416 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1417 packed.append(struct.pack("!L", self.xid))
1418 packed.append(struct.pack("!L", self.experimenter))
1419 packed.append(struct.pack("!L", self.subtype))
1420 length = sum([len(x) for x in packed])
1421 packed[2] = struct.pack("!H", length)
1422 return ''.join(packed)
1423
Rich Lane7dcdf022013-12-11 14:45:27 -08001424 @staticmethod
1425 def unpack(reader):
1426 subtype, = reader.peek('!L', 12)
Rich Lane95f7fc92014-01-27 17:08:16 -08001427 subclass = bsn_header.subtypes.get(subtype)
1428 if subclass:
1429 return subclass.unpack(reader)
1430
1431 obj = bsn_header()
1432 _version = reader.read("!B")[0]
1433 assert(_version == 4)
1434 _type = reader.read("!B")[0]
1435 assert(_type == 4)
1436 _length = reader.read("!H")[0]
1437 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001438 reader = orig_reader.slice(_length, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -08001439 obj.xid = reader.read("!L")[0]
1440 _experimenter = reader.read("!L")[0]
1441 assert(_experimenter == 6035143)
1442 obj.subtype = reader.read("!L")[0]
1443 return obj
1444
1445 def __eq__(self, other):
1446 if type(self) != type(other): return False
1447 if self.xid != other.xid: return False
1448 if self.subtype != other.subtype: return False
1449 return True
1450
1451 def pretty_print(self, q):
1452 q.text("bsn_header {")
1453 with q.group():
1454 with q.indent(2):
1455 q.breakable()
1456 q.text("xid = ");
1457 if self.xid != None:
1458 q.text("%#x" % self.xid)
1459 else:
1460 q.text('None')
1461 q.breakable()
1462 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -08001463
1464experimenter.subtypes[6035143] = bsn_header
1465
Rich Lanea61048f2014-01-30 16:14:00 -08001466class bsn_arp_idle(bsn_header):
1467 version = 4
1468 type = 4
1469 experimenter = 6035143
1470 subtype = 60
1471
1472 def __init__(self, xid=None, vlan_vid=None, ipv4_addr=None):
1473 if xid != None:
1474 self.xid = xid
1475 else:
1476 self.xid = None
1477 if vlan_vid != None:
1478 self.vlan_vid = vlan_vid
1479 else:
1480 self.vlan_vid = 0
1481 if ipv4_addr != None:
1482 self.ipv4_addr = ipv4_addr
1483 else:
1484 self.ipv4_addr = 0
1485 return
1486
1487 def pack(self):
1488 packed = []
1489 packed.append(struct.pack("!B", self.version))
1490 packed.append(struct.pack("!B", self.type))
1491 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1492 packed.append(struct.pack("!L", self.xid))
1493 packed.append(struct.pack("!L", self.experimenter))
1494 packed.append(struct.pack("!L", self.subtype))
1495 packed.append(struct.pack("!H", self.vlan_vid))
1496 packed.append('\x00' * 2)
1497 packed.append(struct.pack("!L", self.ipv4_addr))
1498 length = sum([len(x) for x in packed])
1499 packed[2] = struct.pack("!H", length)
1500 return ''.join(packed)
1501
1502 @staticmethod
1503 def unpack(reader):
1504 obj = bsn_arp_idle()
1505 _version = reader.read("!B")[0]
1506 assert(_version == 4)
1507 _type = reader.read("!B")[0]
1508 assert(_type == 4)
1509 _length = reader.read("!H")[0]
1510 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001511 reader = orig_reader.slice(_length, 4)
Rich Lanea61048f2014-01-30 16:14:00 -08001512 obj.xid = reader.read("!L")[0]
1513 _experimenter = reader.read("!L")[0]
1514 assert(_experimenter == 6035143)
1515 _subtype = reader.read("!L")[0]
1516 assert(_subtype == 60)
1517 obj.vlan_vid = reader.read("!H")[0]
1518 reader.skip(2)
1519 obj.ipv4_addr = reader.read("!L")[0]
1520 return obj
1521
1522 def __eq__(self, other):
1523 if type(self) != type(other): return False
1524 if self.xid != other.xid: return False
1525 if self.vlan_vid != other.vlan_vid: return False
1526 if self.ipv4_addr != other.ipv4_addr: return False
1527 return True
1528
1529 def pretty_print(self, q):
1530 q.text("bsn_arp_idle {")
1531 with q.group():
1532 with q.indent(2):
1533 q.breakable()
1534 q.text("xid = ");
1535 if self.xid != None:
1536 q.text("%#x" % self.xid)
1537 else:
1538 q.text('None')
1539 q.text(","); q.breakable()
1540 q.text("vlan_vid = ");
1541 q.text("%#x" % self.vlan_vid)
1542 q.text(","); q.breakable()
1543 q.text("ipv4_addr = ");
1544 q.text(util.pretty_ipv4(self.ipv4_addr))
1545 q.breakable()
1546 q.text('}')
1547
1548bsn_header.subtypes[60] = bsn_arp_idle
1549
Rich Lane7dcdf022013-12-11 14:45:27 -08001550class bsn_bw_clear_data_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001551 version = 4
1552 type = 4
1553 experimenter = 6035143
1554 subtype = 22
1555
1556 def __init__(self, xid=None, status=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001557 if xid != None:
1558 self.xid = xid
1559 else:
1560 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07001561 if status != None:
1562 self.status = status
1563 else:
1564 self.status = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08001565 return
Dan Talaycof6202252013-07-02 01:00:29 -07001566
1567 def pack(self):
1568 packed = []
1569 packed.append(struct.pack("!B", self.version))
1570 packed.append(struct.pack("!B", self.type))
1571 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1572 packed.append(struct.pack("!L", self.xid))
1573 packed.append(struct.pack("!L", self.experimenter))
1574 packed.append(struct.pack("!L", self.subtype))
1575 packed.append(struct.pack("!L", self.status))
1576 length = sum([len(x) for x in packed])
1577 packed[2] = struct.pack("!H", length)
1578 return ''.join(packed)
1579
1580 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001581 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07001582 obj = bsn_bw_clear_data_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07001583 _version = reader.read("!B")[0]
1584 assert(_version == 4)
1585 _type = reader.read("!B")[0]
1586 assert(_type == 4)
1587 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001588 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001589 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07001590 obj.xid = reader.read("!L")[0]
1591 _experimenter = reader.read("!L")[0]
1592 assert(_experimenter == 6035143)
1593 _subtype = reader.read("!L")[0]
1594 assert(_subtype == 22)
1595 obj.status = reader.read("!L")[0]
1596 return obj
1597
1598 def __eq__(self, other):
1599 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07001600 if self.xid != other.xid: return False
1601 if self.status != other.status: return False
1602 return True
1603
Dan Talaycof6202252013-07-02 01:00:29 -07001604 def pretty_print(self, q):
1605 q.text("bsn_bw_clear_data_reply {")
1606 with q.group():
1607 with q.indent(2):
1608 q.breakable()
1609 q.text("xid = ");
1610 if self.xid != None:
1611 q.text("%#x" % self.xid)
1612 else:
1613 q.text('None')
1614 q.text(","); q.breakable()
1615 q.text("status = ");
1616 q.text("%#x" % self.status)
1617 q.breakable()
1618 q.text('}')
1619
Rich Lane7dcdf022013-12-11 14:45:27 -08001620bsn_header.subtypes[22] = bsn_bw_clear_data_reply
1621
1622class bsn_bw_clear_data_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001623 version = 4
1624 type = 4
1625 experimenter = 6035143
1626 subtype = 21
1627
1628 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001629 if xid != None:
1630 self.xid = xid
1631 else:
1632 self.xid = None
1633 return
Dan Talaycof6202252013-07-02 01:00:29 -07001634
1635 def pack(self):
1636 packed = []
1637 packed.append(struct.pack("!B", self.version))
1638 packed.append(struct.pack("!B", self.type))
1639 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1640 packed.append(struct.pack("!L", self.xid))
1641 packed.append(struct.pack("!L", self.experimenter))
1642 packed.append(struct.pack("!L", self.subtype))
1643 length = sum([len(x) for x in packed])
1644 packed[2] = struct.pack("!H", length)
1645 return ''.join(packed)
1646
1647 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001648 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07001649 obj = bsn_bw_clear_data_request()
Dan Talaycof6202252013-07-02 01:00:29 -07001650 _version = reader.read("!B")[0]
1651 assert(_version == 4)
1652 _type = reader.read("!B")[0]
1653 assert(_type == 4)
1654 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001655 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001656 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07001657 obj.xid = reader.read("!L")[0]
1658 _experimenter = reader.read("!L")[0]
1659 assert(_experimenter == 6035143)
1660 _subtype = reader.read("!L")[0]
1661 assert(_subtype == 21)
1662 return obj
1663
1664 def __eq__(self, other):
1665 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07001666 if self.xid != other.xid: return False
1667 return True
1668
Dan Talaycof6202252013-07-02 01:00:29 -07001669 def pretty_print(self, q):
1670 q.text("bsn_bw_clear_data_request {")
1671 with q.group():
1672 with q.indent(2):
1673 q.breakable()
1674 q.text("xid = ");
1675 if self.xid != None:
1676 q.text("%#x" % self.xid)
1677 else:
1678 q.text('None')
1679 q.breakable()
1680 q.text('}')
1681
Rich Lane7dcdf022013-12-11 14:45:27 -08001682bsn_header.subtypes[21] = bsn_bw_clear_data_request
1683
1684class bsn_bw_enable_get_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001685 version = 4
1686 type = 4
1687 experimenter = 6035143
1688 subtype = 20
1689
1690 def __init__(self, xid=None, enabled=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001691 if xid != None:
1692 self.xid = xid
1693 else:
1694 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07001695 if enabled != None:
1696 self.enabled = enabled
1697 else:
1698 self.enabled = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08001699 return
Dan Talaycof6202252013-07-02 01:00:29 -07001700
1701 def pack(self):
1702 packed = []
1703 packed.append(struct.pack("!B", self.version))
1704 packed.append(struct.pack("!B", self.type))
1705 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1706 packed.append(struct.pack("!L", self.xid))
1707 packed.append(struct.pack("!L", self.experimenter))
1708 packed.append(struct.pack("!L", self.subtype))
1709 packed.append(struct.pack("!L", self.enabled))
1710 length = sum([len(x) for x in packed])
1711 packed[2] = struct.pack("!H", length)
1712 return ''.join(packed)
1713
1714 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001715 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07001716 obj = bsn_bw_enable_get_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07001717 _version = reader.read("!B")[0]
1718 assert(_version == 4)
1719 _type = reader.read("!B")[0]
1720 assert(_type == 4)
1721 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001722 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001723 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07001724 obj.xid = reader.read("!L")[0]
1725 _experimenter = reader.read("!L")[0]
1726 assert(_experimenter == 6035143)
1727 _subtype = reader.read("!L")[0]
1728 assert(_subtype == 20)
1729 obj.enabled = reader.read("!L")[0]
1730 return obj
1731
1732 def __eq__(self, other):
1733 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07001734 if self.xid != other.xid: return False
1735 if self.enabled != other.enabled: return False
1736 return True
1737
Dan Talaycof6202252013-07-02 01:00:29 -07001738 def pretty_print(self, q):
1739 q.text("bsn_bw_enable_get_reply {")
1740 with q.group():
1741 with q.indent(2):
1742 q.breakable()
1743 q.text("xid = ");
1744 if self.xid != None:
1745 q.text("%#x" % self.xid)
1746 else:
1747 q.text('None')
1748 q.text(","); q.breakable()
1749 q.text("enabled = ");
1750 q.text("%#x" % self.enabled)
1751 q.breakable()
1752 q.text('}')
1753
Rich Lane7dcdf022013-12-11 14:45:27 -08001754bsn_header.subtypes[20] = bsn_bw_enable_get_reply
1755
1756class bsn_bw_enable_get_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001757 version = 4
1758 type = 4
1759 experimenter = 6035143
1760 subtype = 19
1761
1762 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001763 if xid != None:
1764 self.xid = xid
1765 else:
1766 self.xid = None
1767 return
Dan Talaycof6202252013-07-02 01:00:29 -07001768
1769 def pack(self):
1770 packed = []
1771 packed.append(struct.pack("!B", self.version))
1772 packed.append(struct.pack("!B", self.type))
1773 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1774 packed.append(struct.pack("!L", self.xid))
1775 packed.append(struct.pack("!L", self.experimenter))
1776 packed.append(struct.pack("!L", self.subtype))
1777 length = sum([len(x) for x in packed])
1778 packed[2] = struct.pack("!H", length)
1779 return ''.join(packed)
1780
1781 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001782 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07001783 obj = bsn_bw_enable_get_request()
Dan Talaycof6202252013-07-02 01:00:29 -07001784 _version = reader.read("!B")[0]
1785 assert(_version == 4)
1786 _type = reader.read("!B")[0]
1787 assert(_type == 4)
1788 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001789 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001790 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07001791 obj.xid = reader.read("!L")[0]
1792 _experimenter = reader.read("!L")[0]
1793 assert(_experimenter == 6035143)
1794 _subtype = reader.read("!L")[0]
1795 assert(_subtype == 19)
1796 return obj
1797
1798 def __eq__(self, other):
1799 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07001800 if self.xid != other.xid: return False
1801 return True
1802
Dan Talaycof6202252013-07-02 01:00:29 -07001803 def pretty_print(self, q):
1804 q.text("bsn_bw_enable_get_request {")
1805 with q.group():
1806 with q.indent(2):
1807 q.breakable()
1808 q.text("xid = ");
1809 if self.xid != None:
1810 q.text("%#x" % self.xid)
1811 else:
1812 q.text('None')
1813 q.breakable()
1814 q.text('}')
1815
Rich Lane7dcdf022013-12-11 14:45:27 -08001816bsn_header.subtypes[19] = bsn_bw_enable_get_request
1817
1818class bsn_bw_enable_set_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001819 version = 4
1820 type = 4
1821 experimenter = 6035143
1822 subtype = 23
1823
1824 def __init__(self, xid=None, enable=None, status=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001825 if xid != None:
1826 self.xid = xid
1827 else:
1828 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07001829 if enable != None:
1830 self.enable = enable
1831 else:
1832 self.enable = 0
1833 if status != None:
1834 self.status = status
1835 else:
1836 self.status = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08001837 return
Dan Talaycof6202252013-07-02 01:00:29 -07001838
1839 def pack(self):
1840 packed = []
1841 packed.append(struct.pack("!B", self.version))
1842 packed.append(struct.pack("!B", self.type))
1843 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1844 packed.append(struct.pack("!L", self.xid))
1845 packed.append(struct.pack("!L", self.experimenter))
1846 packed.append(struct.pack("!L", self.subtype))
1847 packed.append(struct.pack("!L", self.enable))
1848 packed.append(struct.pack("!L", self.status))
1849 length = sum([len(x) for x in packed])
1850 packed[2] = struct.pack("!H", length)
1851 return ''.join(packed)
1852
1853 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001854 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07001855 obj = bsn_bw_enable_set_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07001856 _version = reader.read("!B")[0]
1857 assert(_version == 4)
1858 _type = reader.read("!B")[0]
1859 assert(_type == 4)
1860 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001861 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001862 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07001863 obj.xid = reader.read("!L")[0]
1864 _experimenter = reader.read("!L")[0]
1865 assert(_experimenter == 6035143)
1866 _subtype = reader.read("!L")[0]
1867 assert(_subtype == 23)
1868 obj.enable = reader.read("!L")[0]
1869 obj.status = reader.read("!L")[0]
1870 return obj
1871
1872 def __eq__(self, other):
1873 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07001874 if self.xid != other.xid: return False
1875 if self.enable != other.enable: return False
1876 if self.status != other.status: return False
1877 return True
1878
Dan Talaycof6202252013-07-02 01:00:29 -07001879 def pretty_print(self, q):
1880 q.text("bsn_bw_enable_set_reply {")
1881 with q.group():
1882 with q.indent(2):
1883 q.breakable()
1884 q.text("xid = ");
1885 if self.xid != None:
1886 q.text("%#x" % self.xid)
1887 else:
1888 q.text('None')
1889 q.text(","); q.breakable()
1890 q.text("enable = ");
1891 q.text("%#x" % self.enable)
1892 q.text(","); q.breakable()
1893 q.text("status = ");
1894 q.text("%#x" % self.status)
1895 q.breakable()
1896 q.text('}')
1897
Rich Lane7dcdf022013-12-11 14:45:27 -08001898bsn_header.subtypes[23] = bsn_bw_enable_set_reply
1899
1900class bsn_bw_enable_set_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001901 version = 4
1902 type = 4
1903 experimenter = 6035143
1904 subtype = 18
1905
1906 def __init__(self, xid=None, enable=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001907 if xid != None:
1908 self.xid = xid
1909 else:
1910 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07001911 if enable != None:
1912 self.enable = enable
1913 else:
1914 self.enable = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08001915 return
Dan Talaycof6202252013-07-02 01:00:29 -07001916
1917 def pack(self):
1918 packed = []
1919 packed.append(struct.pack("!B", self.version))
1920 packed.append(struct.pack("!B", self.type))
1921 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1922 packed.append(struct.pack("!L", self.xid))
1923 packed.append(struct.pack("!L", self.experimenter))
1924 packed.append(struct.pack("!L", self.subtype))
1925 packed.append(struct.pack("!L", self.enable))
1926 length = sum([len(x) for x in packed])
1927 packed[2] = struct.pack("!H", length)
1928 return ''.join(packed)
1929
1930 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001931 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07001932 obj = bsn_bw_enable_set_request()
Dan Talaycof6202252013-07-02 01:00:29 -07001933 _version = reader.read("!B")[0]
1934 assert(_version == 4)
1935 _type = reader.read("!B")[0]
1936 assert(_type == 4)
1937 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001938 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001939 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07001940 obj.xid = reader.read("!L")[0]
1941 _experimenter = reader.read("!L")[0]
1942 assert(_experimenter == 6035143)
1943 _subtype = reader.read("!L")[0]
1944 assert(_subtype == 18)
1945 obj.enable = reader.read("!L")[0]
1946 return obj
1947
1948 def __eq__(self, other):
1949 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07001950 if self.xid != other.xid: return False
1951 if self.enable != other.enable: return False
1952 return True
1953
Dan Talaycof6202252013-07-02 01:00:29 -07001954 def pretty_print(self, q):
1955 q.text("bsn_bw_enable_set_request {")
1956 with q.group():
1957 with q.indent(2):
1958 q.breakable()
1959 q.text("xid = ");
1960 if self.xid != None:
1961 q.text("%#x" % self.xid)
1962 else:
1963 q.text('None')
1964 q.text(","); q.breakable()
1965 q.text("enable = ");
1966 q.text("%#x" % self.enable)
1967 q.breakable()
1968 q.text('}')
1969
Rich Lane7dcdf022013-12-11 14:45:27 -08001970bsn_header.subtypes[18] = bsn_bw_enable_set_request
1971
Rich Lane5454b682014-01-14 17:07:36 -08001972class bsn_controller_connections_reply(bsn_header):
1973 version = 4
1974 type = 4
1975 experimenter = 6035143
1976 subtype = 57
1977
1978 def __init__(self, xid=None, connections=None):
1979 if xid != None:
1980 self.xid = xid
1981 else:
1982 self.xid = None
1983 if connections != None:
1984 self.connections = connections
1985 else:
1986 self.connections = []
1987 return
1988
1989 def pack(self):
1990 packed = []
1991 packed.append(struct.pack("!B", self.version))
1992 packed.append(struct.pack("!B", self.type))
1993 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1994 packed.append(struct.pack("!L", self.xid))
1995 packed.append(struct.pack("!L", self.experimenter))
1996 packed.append(struct.pack("!L", self.subtype))
1997 packed.append(loxi.generic_util.pack_list(self.connections))
1998 length = sum([len(x) for x in packed])
1999 packed[2] = struct.pack("!H", length)
2000 return ''.join(packed)
2001
2002 @staticmethod
2003 def unpack(reader):
2004 obj = bsn_controller_connections_reply()
2005 _version = reader.read("!B")[0]
2006 assert(_version == 4)
2007 _type = reader.read("!B")[0]
2008 assert(_type == 4)
2009 _length = reader.read("!H")[0]
2010 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002011 reader = orig_reader.slice(_length, 4)
Rich Lane5454b682014-01-14 17:07:36 -08002012 obj.xid = reader.read("!L")[0]
2013 _experimenter = reader.read("!L")[0]
2014 assert(_experimenter == 6035143)
2015 _subtype = reader.read("!L")[0]
2016 assert(_subtype == 57)
Rich Lanee2567702015-01-26 15:04:35 -08002017 obj.connections = loxi.generic_util.unpack_list(reader, ofp.common.bsn_controller_connection.unpack)
Rich Lane5454b682014-01-14 17:07:36 -08002018 return obj
2019
2020 def __eq__(self, other):
2021 if type(self) != type(other): return False
2022 if self.xid != other.xid: return False
2023 if self.connections != other.connections: return False
2024 return True
2025
2026 def pretty_print(self, q):
2027 q.text("bsn_controller_connections_reply {")
2028 with q.group():
2029 with q.indent(2):
2030 q.breakable()
2031 q.text("xid = ");
2032 if self.xid != None:
2033 q.text("%#x" % self.xid)
2034 else:
2035 q.text('None')
2036 q.text(","); q.breakable()
2037 q.text("connections = ");
2038 q.pp(self.connections)
2039 q.breakable()
2040 q.text('}')
2041
2042bsn_header.subtypes[57] = bsn_controller_connections_reply
2043
2044class bsn_controller_connections_request(bsn_header):
2045 version = 4
2046 type = 4
2047 experimenter = 6035143
2048 subtype = 56
2049
2050 def __init__(self, xid=None):
2051 if xid != None:
2052 self.xid = xid
2053 else:
2054 self.xid = None
2055 return
2056
2057 def pack(self):
2058 packed = []
2059 packed.append(struct.pack("!B", self.version))
2060 packed.append(struct.pack("!B", self.type))
2061 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2062 packed.append(struct.pack("!L", self.xid))
2063 packed.append(struct.pack("!L", self.experimenter))
2064 packed.append(struct.pack("!L", self.subtype))
2065 length = sum([len(x) for x in packed])
2066 packed[2] = struct.pack("!H", length)
2067 return ''.join(packed)
2068
2069 @staticmethod
2070 def unpack(reader):
2071 obj = bsn_controller_connections_request()
2072 _version = reader.read("!B")[0]
2073 assert(_version == 4)
2074 _type = reader.read("!B")[0]
2075 assert(_type == 4)
2076 _length = reader.read("!H")[0]
2077 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002078 reader = orig_reader.slice(_length, 4)
Rich Lane5454b682014-01-14 17:07:36 -08002079 obj.xid = reader.read("!L")[0]
2080 _experimenter = reader.read("!L")[0]
2081 assert(_experimenter == 6035143)
2082 _subtype = reader.read("!L")[0]
2083 assert(_subtype == 56)
2084 return obj
2085
2086 def __eq__(self, other):
2087 if type(self) != type(other): return False
2088 if self.xid != other.xid: return False
2089 return True
2090
2091 def pretty_print(self, q):
2092 q.text("bsn_controller_connections_request {")
2093 with q.group():
2094 with q.indent(2):
2095 q.breakable()
2096 q.text("xid = ");
2097 if self.xid != None:
2098 q.text("%#x" % self.xid)
2099 else:
2100 q.text('None')
2101 q.breakable()
2102 q.text('}')
2103
2104bsn_header.subtypes[56] = bsn_controller_connections_request
2105
Rich Lane9ec3fca2014-02-26 16:22:56 -08002106class experimenter_stats_reply(stats_reply):
2107 subtypes = {}
2108
2109 version = 4
2110 type = 19
2111 stats_type = 65535
2112
2113 def __init__(self, xid=None, flags=None, experimenter=None, subtype=None):
2114 if xid != None:
2115 self.xid = xid
2116 else:
2117 self.xid = None
2118 if flags != None:
2119 self.flags = flags
2120 else:
2121 self.flags = 0
2122 if experimenter != None:
2123 self.experimenter = experimenter
2124 else:
2125 self.experimenter = 0
2126 if subtype != None:
2127 self.subtype = subtype
2128 else:
2129 self.subtype = 0
2130 return
2131
2132 def pack(self):
2133 packed = []
2134 packed.append(struct.pack("!B", self.version))
2135 packed.append(struct.pack("!B", self.type))
2136 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2137 packed.append(struct.pack("!L", self.xid))
2138 packed.append(struct.pack("!H", self.stats_type))
2139 packed.append(struct.pack("!H", self.flags))
2140 packed.append('\x00' * 4)
2141 packed.append(struct.pack("!L", self.experimenter))
2142 packed.append(struct.pack("!L", self.subtype))
2143 length = sum([len(x) for x in packed])
2144 packed[2] = struct.pack("!H", length)
2145 return ''.join(packed)
2146
2147 @staticmethod
2148 def unpack(reader):
2149 subtype, = reader.peek('!L', 16)
2150 subclass = experimenter_stats_reply.subtypes.get(subtype)
2151 if subclass:
2152 return subclass.unpack(reader)
2153
2154 obj = experimenter_stats_reply()
2155 _version = reader.read("!B")[0]
2156 assert(_version == 4)
2157 _type = reader.read("!B")[0]
2158 assert(_type == 19)
2159 _length = reader.read("!H")[0]
2160 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002161 reader = orig_reader.slice(_length, 4)
Rich Lane9ec3fca2014-02-26 16:22:56 -08002162 obj.xid = reader.read("!L")[0]
2163 _stats_type = reader.read("!H")[0]
2164 assert(_stats_type == 65535)
2165 obj.flags = reader.read("!H")[0]
2166 reader.skip(4)
2167 obj.experimenter = reader.read("!L")[0]
2168 obj.subtype = reader.read("!L")[0]
2169 return obj
2170
2171 def __eq__(self, other):
2172 if type(self) != type(other): return False
2173 if self.xid != other.xid: return False
2174 if self.flags != other.flags: return False
2175 if self.experimenter != other.experimenter: return False
2176 if self.subtype != other.subtype: return False
2177 return True
2178
2179 def pretty_print(self, q):
2180 q.text("experimenter_stats_reply {")
2181 with q.group():
2182 with q.indent(2):
2183 q.breakable()
2184 q.text("xid = ");
2185 if self.xid != None:
2186 q.text("%#x" % self.xid)
2187 else:
2188 q.text('None')
2189 q.text(","); q.breakable()
2190 q.text("flags = ");
2191 q.text("%#x" % self.flags)
2192 q.text(","); q.breakable()
2193 q.text("subtype = ");
2194 q.text("%#x" % self.subtype)
2195 q.breakable()
2196 q.text('}')
2197
2198stats_reply.subtypes[65535] = experimenter_stats_reply
2199
2200class bsn_stats_reply(experimenter_stats_reply):
2201 subtypes = {}
2202
2203 version = 4
2204 type = 19
2205 stats_type = 65535
2206 experimenter = 6035143
2207
2208 def __init__(self, xid=None, flags=None, subtype=None):
2209 if xid != None:
2210 self.xid = xid
2211 else:
2212 self.xid = None
2213 if flags != None:
2214 self.flags = flags
2215 else:
2216 self.flags = 0
2217 if subtype != None:
2218 self.subtype = subtype
2219 else:
2220 self.subtype = 0
2221 return
2222
2223 def pack(self):
2224 packed = []
2225 packed.append(struct.pack("!B", self.version))
2226 packed.append(struct.pack("!B", self.type))
2227 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2228 packed.append(struct.pack("!L", self.xid))
2229 packed.append(struct.pack("!H", self.stats_type))
2230 packed.append(struct.pack("!H", self.flags))
2231 packed.append('\x00' * 4)
2232 packed.append(struct.pack("!L", self.experimenter))
2233 packed.append(struct.pack("!L", self.subtype))
2234 length = sum([len(x) for x in packed])
2235 packed[2] = struct.pack("!H", length)
2236 return ''.join(packed)
2237
2238 @staticmethod
2239 def unpack(reader):
2240 subtype, = reader.peek('!L', 20)
2241 subclass = bsn_stats_reply.subtypes.get(subtype)
2242 if subclass:
2243 return subclass.unpack(reader)
2244
2245 obj = bsn_stats_reply()
2246 _version = reader.read("!B")[0]
2247 assert(_version == 4)
2248 _type = reader.read("!B")[0]
2249 assert(_type == 19)
2250 _length = reader.read("!H")[0]
2251 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002252 reader = orig_reader.slice(_length, 4)
Rich Lane9ec3fca2014-02-26 16:22:56 -08002253 obj.xid = reader.read("!L")[0]
2254 _stats_type = reader.read("!H")[0]
2255 assert(_stats_type == 65535)
2256 obj.flags = reader.read("!H")[0]
2257 reader.skip(4)
2258 _experimenter = reader.read("!L")[0]
2259 assert(_experimenter == 6035143)
2260 obj.subtype = reader.read("!L")[0]
2261 return obj
2262
2263 def __eq__(self, other):
2264 if type(self) != type(other): return False
2265 if self.xid != other.xid: return False
2266 if self.flags != other.flags: return False
2267 if self.subtype != other.subtype: return False
2268 return True
2269
2270 def pretty_print(self, q):
2271 q.text("bsn_stats_reply {")
2272 with q.group():
2273 with q.indent(2):
2274 q.breakable()
2275 q.text("xid = ");
2276 if self.xid != None:
2277 q.text("%#x" % self.xid)
2278 else:
2279 q.text('None')
2280 q.text(","); q.breakable()
2281 q.text("flags = ");
2282 q.text("%#x" % self.flags)
2283 q.breakable()
2284 q.text('}')
2285
2286experimenter_stats_reply.subtypes[6035143] = bsn_stats_reply
2287
Rich Lane93b33132014-04-21 12:20:58 -07002288class bsn_debug_counter_desc_stats_reply(bsn_stats_reply):
Rich Lane9ec3fca2014-02-26 16:22:56 -08002289 version = 4
2290 type = 19
2291 stats_type = 65535
2292 experimenter = 6035143
Rich Lane93b33132014-04-21 12:20:58 -07002293 subtype = 13
Rich Lane9ec3fca2014-02-26 16:22:56 -08002294
2295 def __init__(self, xid=None, flags=None, entries=None):
2296 if xid != None:
2297 self.xid = xid
2298 else:
2299 self.xid = None
2300 if flags != None:
2301 self.flags = flags
2302 else:
2303 self.flags = 0
2304 if entries != None:
2305 self.entries = entries
2306 else:
2307 self.entries = []
2308 return
2309
2310 def pack(self):
2311 packed = []
2312 packed.append(struct.pack("!B", self.version))
2313 packed.append(struct.pack("!B", self.type))
2314 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2315 packed.append(struct.pack("!L", self.xid))
2316 packed.append(struct.pack("!H", self.stats_type))
2317 packed.append(struct.pack("!H", self.flags))
2318 packed.append('\x00' * 4)
2319 packed.append(struct.pack("!L", self.experimenter))
2320 packed.append(struct.pack("!L", self.subtype))
2321 packed.append(loxi.generic_util.pack_list(self.entries))
2322 length = sum([len(x) for x in packed])
2323 packed[2] = struct.pack("!H", length)
2324 return ''.join(packed)
2325
2326 @staticmethod
2327 def unpack(reader):
Rich Lane93b33132014-04-21 12:20:58 -07002328 obj = bsn_debug_counter_desc_stats_reply()
Rich Lane9ec3fca2014-02-26 16:22:56 -08002329 _version = reader.read("!B")[0]
2330 assert(_version == 4)
2331 _type = reader.read("!B")[0]
2332 assert(_type == 19)
2333 _length = reader.read("!H")[0]
2334 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002335 reader = orig_reader.slice(_length, 4)
Rich Lane9ec3fca2014-02-26 16:22:56 -08002336 obj.xid = reader.read("!L")[0]
2337 _stats_type = reader.read("!H")[0]
2338 assert(_stats_type == 65535)
2339 obj.flags = reader.read("!H")[0]
2340 reader.skip(4)
2341 _experimenter = reader.read("!L")[0]
2342 assert(_experimenter == 6035143)
2343 _subtype = reader.read("!L")[0]
Rich Lane93b33132014-04-21 12:20:58 -07002344 assert(_subtype == 13)
Rich Lanee2567702015-01-26 15:04:35 -08002345 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_debug_counter_desc_stats_entry.unpack)
Rich Lane9ec3fca2014-02-26 16:22:56 -08002346 return obj
2347
2348 def __eq__(self, other):
2349 if type(self) != type(other): return False
2350 if self.xid != other.xid: return False
2351 if self.flags != other.flags: return False
2352 if self.entries != other.entries: return False
2353 return True
2354
2355 def pretty_print(self, q):
Rich Lane93b33132014-04-21 12:20:58 -07002356 q.text("bsn_debug_counter_desc_stats_reply {")
Rich Lane9ec3fca2014-02-26 16:22:56 -08002357 with q.group():
2358 with q.indent(2):
2359 q.breakable()
2360 q.text("xid = ");
2361 if self.xid != None:
2362 q.text("%#x" % self.xid)
2363 else:
2364 q.text('None')
2365 q.text(","); q.breakable()
2366 q.text("flags = ");
2367 q.text("%#x" % self.flags)
2368 q.text(","); q.breakable()
2369 q.text("entries = ");
2370 q.pp(self.entries)
2371 q.breakable()
2372 q.text('}')
2373
Rich Lane93b33132014-04-21 12:20:58 -07002374bsn_stats_reply.subtypes[13] = bsn_debug_counter_desc_stats_reply
Rich Lane9ec3fca2014-02-26 16:22:56 -08002375
2376class experimenter_stats_request(stats_request):
2377 subtypes = {}
2378
2379 version = 4
2380 type = 18
2381 stats_type = 65535
2382
2383 def __init__(self, xid=None, flags=None, experimenter=None, subtype=None):
2384 if xid != None:
2385 self.xid = xid
2386 else:
2387 self.xid = None
2388 if flags != None:
2389 self.flags = flags
2390 else:
2391 self.flags = 0
2392 if experimenter != None:
2393 self.experimenter = experimenter
2394 else:
2395 self.experimenter = 0
2396 if subtype != None:
2397 self.subtype = subtype
2398 else:
2399 self.subtype = 0
2400 return
2401
2402 def pack(self):
2403 packed = []
2404 packed.append(struct.pack("!B", self.version))
2405 packed.append(struct.pack("!B", self.type))
2406 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2407 packed.append(struct.pack("!L", self.xid))
2408 packed.append(struct.pack("!H", self.stats_type))
2409 packed.append(struct.pack("!H", self.flags))
2410 packed.append('\x00' * 4)
2411 packed.append(struct.pack("!L", self.experimenter))
2412 packed.append(struct.pack("!L", self.subtype))
2413 length = sum([len(x) for x in packed])
2414 packed[2] = struct.pack("!H", length)
2415 return ''.join(packed)
2416
2417 @staticmethod
2418 def unpack(reader):
2419 subtype, = reader.peek('!L', 16)
2420 subclass = experimenter_stats_request.subtypes.get(subtype)
2421 if subclass:
2422 return subclass.unpack(reader)
2423
2424 obj = experimenter_stats_request()
2425 _version = reader.read("!B")[0]
2426 assert(_version == 4)
2427 _type = reader.read("!B")[0]
2428 assert(_type == 18)
2429 _length = reader.read("!H")[0]
2430 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002431 reader = orig_reader.slice(_length, 4)
Rich Lane9ec3fca2014-02-26 16:22:56 -08002432 obj.xid = reader.read("!L")[0]
2433 _stats_type = reader.read("!H")[0]
2434 assert(_stats_type == 65535)
2435 obj.flags = reader.read("!H")[0]
2436 reader.skip(4)
2437 obj.experimenter = reader.read("!L")[0]
2438 obj.subtype = reader.read("!L")[0]
2439 return obj
2440
2441 def __eq__(self, other):
2442 if type(self) != type(other): return False
2443 if self.xid != other.xid: return False
2444 if self.flags != other.flags: return False
2445 if self.experimenter != other.experimenter: return False
2446 if self.subtype != other.subtype: return False
2447 return True
2448
2449 def pretty_print(self, q):
2450 q.text("experimenter_stats_request {")
2451 with q.group():
2452 with q.indent(2):
2453 q.breakable()
2454 q.text("xid = ");
2455 if self.xid != None:
2456 q.text("%#x" % self.xid)
2457 else:
2458 q.text('None')
2459 q.text(","); q.breakable()
2460 q.text("flags = ");
2461 q.text("%#x" % self.flags)
2462 q.text(","); q.breakable()
2463 q.text("subtype = ");
2464 q.text("%#x" % self.subtype)
2465 q.breakable()
2466 q.text('}')
2467
2468stats_request.subtypes[65535] = experimenter_stats_request
2469
2470class bsn_stats_request(experimenter_stats_request):
2471 subtypes = {}
2472
2473 version = 4
2474 type = 18
2475 stats_type = 65535
2476 experimenter = 6035143
2477
2478 def __init__(self, xid=None, flags=None, subtype=None):
2479 if xid != None:
2480 self.xid = xid
2481 else:
2482 self.xid = None
2483 if flags != None:
2484 self.flags = flags
2485 else:
2486 self.flags = 0
2487 if subtype != None:
2488 self.subtype = subtype
2489 else:
2490 self.subtype = 0
2491 return
2492
2493 def pack(self):
2494 packed = []
2495 packed.append(struct.pack("!B", self.version))
2496 packed.append(struct.pack("!B", self.type))
2497 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2498 packed.append(struct.pack("!L", self.xid))
2499 packed.append(struct.pack("!H", self.stats_type))
2500 packed.append(struct.pack("!H", self.flags))
2501 packed.append('\x00' * 4)
2502 packed.append(struct.pack("!L", self.experimenter))
2503 packed.append(struct.pack("!L", self.subtype))
2504 length = sum([len(x) for x in packed])
2505 packed[2] = struct.pack("!H", length)
2506 return ''.join(packed)
2507
2508 @staticmethod
2509 def unpack(reader):
2510 subtype, = reader.peek('!L', 20)
2511 subclass = bsn_stats_request.subtypes.get(subtype)
2512 if subclass:
2513 return subclass.unpack(reader)
2514
2515 obj = bsn_stats_request()
2516 _version = reader.read("!B")[0]
2517 assert(_version == 4)
2518 _type = reader.read("!B")[0]
2519 assert(_type == 18)
2520 _length = reader.read("!H")[0]
2521 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002522 reader = orig_reader.slice(_length, 4)
Rich Lane9ec3fca2014-02-26 16:22:56 -08002523 obj.xid = reader.read("!L")[0]
2524 _stats_type = reader.read("!H")[0]
2525 assert(_stats_type == 65535)
2526 obj.flags = reader.read("!H")[0]
2527 reader.skip(4)
2528 _experimenter = reader.read("!L")[0]
2529 assert(_experimenter == 6035143)
2530 obj.subtype = reader.read("!L")[0]
2531 return obj
2532
2533 def __eq__(self, other):
2534 if type(self) != type(other): return False
2535 if self.xid != other.xid: return False
2536 if self.flags != other.flags: return False
2537 if self.subtype != other.subtype: return False
2538 return True
2539
2540 def pretty_print(self, q):
2541 q.text("bsn_stats_request {")
2542 with q.group():
2543 with q.indent(2):
2544 q.breakable()
2545 q.text("xid = ");
2546 if self.xid != None:
2547 q.text("%#x" % self.xid)
2548 else:
2549 q.text('None')
2550 q.text(","); q.breakable()
2551 q.text("flags = ");
2552 q.text("%#x" % self.flags)
2553 q.breakable()
2554 q.text('}')
2555
2556experimenter_stats_request.subtypes[6035143] = bsn_stats_request
2557
Rich Lane93b33132014-04-21 12:20:58 -07002558class bsn_debug_counter_desc_stats_request(bsn_stats_request):
2559 version = 4
2560 type = 18
2561 stats_type = 65535
2562 experimenter = 6035143
2563 subtype = 13
2564
2565 def __init__(self, xid=None, flags=None):
2566 if xid != None:
2567 self.xid = xid
2568 else:
2569 self.xid = None
2570 if flags != None:
2571 self.flags = flags
2572 else:
2573 self.flags = 0
2574 return
2575
2576 def pack(self):
2577 packed = []
2578 packed.append(struct.pack("!B", self.version))
2579 packed.append(struct.pack("!B", self.type))
2580 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2581 packed.append(struct.pack("!L", self.xid))
2582 packed.append(struct.pack("!H", self.stats_type))
2583 packed.append(struct.pack("!H", self.flags))
2584 packed.append('\x00' * 4)
2585 packed.append(struct.pack("!L", self.experimenter))
2586 packed.append(struct.pack("!L", self.subtype))
2587 length = sum([len(x) for x in packed])
2588 packed[2] = struct.pack("!H", length)
2589 return ''.join(packed)
2590
2591 @staticmethod
2592 def unpack(reader):
2593 obj = bsn_debug_counter_desc_stats_request()
2594 _version = reader.read("!B")[0]
2595 assert(_version == 4)
2596 _type = reader.read("!B")[0]
2597 assert(_type == 18)
2598 _length = reader.read("!H")[0]
2599 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002600 reader = orig_reader.slice(_length, 4)
Rich Lane93b33132014-04-21 12:20:58 -07002601 obj.xid = reader.read("!L")[0]
2602 _stats_type = reader.read("!H")[0]
2603 assert(_stats_type == 65535)
2604 obj.flags = reader.read("!H")[0]
2605 reader.skip(4)
2606 _experimenter = reader.read("!L")[0]
2607 assert(_experimenter == 6035143)
2608 _subtype = reader.read("!L")[0]
2609 assert(_subtype == 13)
2610 return obj
2611
2612 def __eq__(self, other):
2613 if type(self) != type(other): return False
2614 if self.xid != other.xid: return False
2615 if self.flags != other.flags: return False
2616 return True
2617
2618 def pretty_print(self, q):
2619 q.text("bsn_debug_counter_desc_stats_request {")
2620 with q.group():
2621 with q.indent(2):
2622 q.breakable()
2623 q.text("xid = ");
2624 if self.xid != None:
2625 q.text("%#x" % self.xid)
2626 else:
2627 q.text('None')
2628 q.text(","); q.breakable()
2629 q.text("flags = ");
2630 q.text("%#x" % self.flags)
2631 q.breakable()
2632 q.text('}')
2633
2634bsn_stats_request.subtypes[13] = bsn_debug_counter_desc_stats_request
2635
2636class bsn_debug_counter_stats_reply(bsn_stats_reply):
2637 version = 4
2638 type = 19
2639 stats_type = 65535
2640 experimenter = 6035143
2641 subtype = 12
2642
2643 def __init__(self, xid=None, flags=None, entries=None):
2644 if xid != None:
2645 self.xid = xid
2646 else:
2647 self.xid = None
2648 if flags != None:
2649 self.flags = flags
2650 else:
2651 self.flags = 0
2652 if entries != None:
2653 self.entries = entries
2654 else:
2655 self.entries = []
2656 return
2657
2658 def pack(self):
2659 packed = []
2660 packed.append(struct.pack("!B", self.version))
2661 packed.append(struct.pack("!B", self.type))
2662 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2663 packed.append(struct.pack("!L", self.xid))
2664 packed.append(struct.pack("!H", self.stats_type))
2665 packed.append(struct.pack("!H", self.flags))
2666 packed.append('\x00' * 4)
2667 packed.append(struct.pack("!L", self.experimenter))
2668 packed.append(struct.pack("!L", self.subtype))
2669 packed.append(loxi.generic_util.pack_list(self.entries))
2670 length = sum([len(x) for x in packed])
2671 packed[2] = struct.pack("!H", length)
2672 return ''.join(packed)
2673
2674 @staticmethod
2675 def unpack(reader):
2676 obj = bsn_debug_counter_stats_reply()
2677 _version = reader.read("!B")[0]
2678 assert(_version == 4)
2679 _type = reader.read("!B")[0]
2680 assert(_type == 19)
2681 _length = reader.read("!H")[0]
2682 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002683 reader = orig_reader.slice(_length, 4)
Rich Lane93b33132014-04-21 12:20:58 -07002684 obj.xid = reader.read("!L")[0]
2685 _stats_type = reader.read("!H")[0]
2686 assert(_stats_type == 65535)
2687 obj.flags = reader.read("!H")[0]
2688 reader.skip(4)
2689 _experimenter = reader.read("!L")[0]
2690 assert(_experimenter == 6035143)
2691 _subtype = reader.read("!L")[0]
2692 assert(_subtype == 12)
Rich Lanee2567702015-01-26 15:04:35 -08002693 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_debug_counter_stats_entry.unpack)
Rich Lane93b33132014-04-21 12:20:58 -07002694 return obj
2695
2696 def __eq__(self, other):
2697 if type(self) != type(other): return False
2698 if self.xid != other.xid: return False
2699 if self.flags != other.flags: return False
2700 if self.entries != other.entries: return False
2701 return True
2702
2703 def pretty_print(self, q):
2704 q.text("bsn_debug_counter_stats_reply {")
2705 with q.group():
2706 with q.indent(2):
2707 q.breakable()
2708 q.text("xid = ");
2709 if self.xid != None:
2710 q.text("%#x" % self.xid)
2711 else:
2712 q.text('None')
2713 q.text(","); q.breakable()
2714 q.text("flags = ");
2715 q.text("%#x" % self.flags)
2716 q.text(","); q.breakable()
2717 q.text("entries = ");
2718 q.pp(self.entries)
2719 q.breakable()
2720 q.text('}')
2721
2722bsn_stats_reply.subtypes[12] = bsn_debug_counter_stats_reply
2723
2724class bsn_debug_counter_stats_request(bsn_stats_request):
2725 version = 4
2726 type = 18
2727 stats_type = 65535
2728 experimenter = 6035143
2729 subtype = 12
2730
2731 def __init__(self, xid=None, flags=None):
2732 if xid != None:
2733 self.xid = xid
2734 else:
2735 self.xid = None
2736 if flags != None:
2737 self.flags = flags
2738 else:
2739 self.flags = 0
2740 return
2741
2742 def pack(self):
2743 packed = []
2744 packed.append(struct.pack("!B", self.version))
2745 packed.append(struct.pack("!B", self.type))
2746 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2747 packed.append(struct.pack("!L", self.xid))
2748 packed.append(struct.pack("!H", self.stats_type))
2749 packed.append(struct.pack("!H", self.flags))
2750 packed.append('\x00' * 4)
2751 packed.append(struct.pack("!L", self.experimenter))
2752 packed.append(struct.pack("!L", self.subtype))
2753 length = sum([len(x) for x in packed])
2754 packed[2] = struct.pack("!H", length)
2755 return ''.join(packed)
2756
2757 @staticmethod
2758 def unpack(reader):
2759 obj = bsn_debug_counter_stats_request()
2760 _version = reader.read("!B")[0]
2761 assert(_version == 4)
2762 _type = reader.read("!B")[0]
2763 assert(_type == 18)
2764 _length = reader.read("!H")[0]
2765 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002766 reader = orig_reader.slice(_length, 4)
Rich Lane93b33132014-04-21 12:20:58 -07002767 obj.xid = reader.read("!L")[0]
2768 _stats_type = reader.read("!H")[0]
2769 assert(_stats_type == 65535)
2770 obj.flags = reader.read("!H")[0]
2771 reader.skip(4)
2772 _experimenter = reader.read("!L")[0]
2773 assert(_experimenter == 6035143)
2774 _subtype = reader.read("!L")[0]
2775 assert(_subtype == 12)
2776 return obj
2777
2778 def __eq__(self, other):
2779 if type(self) != type(other): return False
2780 if self.xid != other.xid: return False
2781 if self.flags != other.flags: return False
2782 return True
2783
2784 def pretty_print(self, q):
2785 q.text("bsn_debug_counter_stats_request {")
2786 with q.group():
2787 with q.indent(2):
2788 q.breakable()
2789 q.text("xid = ");
2790 if self.xid != None:
2791 q.text("%#x" % self.xid)
2792 else:
2793 q.text('None')
2794 q.text(","); q.breakable()
2795 q.text("flags = ");
2796 q.text("%#x" % self.flags)
2797 q.breakable()
2798 q.text('}')
2799
2800bsn_stats_request.subtypes[12] = bsn_debug_counter_stats_request
2801
2802class bsn_flow_checksum_bucket_stats_reply(bsn_stats_reply):
2803 version = 4
2804 type = 19
2805 stats_type = 65535
2806 experimenter = 6035143
2807 subtype = 10
2808
2809 def __init__(self, xid=None, flags=None, entries=None):
2810 if xid != None:
2811 self.xid = xid
2812 else:
2813 self.xid = None
2814 if flags != None:
2815 self.flags = flags
2816 else:
2817 self.flags = 0
2818 if entries != None:
2819 self.entries = entries
2820 else:
2821 self.entries = []
2822 return
2823
2824 def pack(self):
2825 packed = []
2826 packed.append(struct.pack("!B", self.version))
2827 packed.append(struct.pack("!B", self.type))
2828 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2829 packed.append(struct.pack("!L", self.xid))
2830 packed.append(struct.pack("!H", self.stats_type))
2831 packed.append(struct.pack("!H", self.flags))
2832 packed.append('\x00' * 4)
2833 packed.append(struct.pack("!L", self.experimenter))
2834 packed.append(struct.pack("!L", self.subtype))
2835 packed.append(loxi.generic_util.pack_list(self.entries))
2836 length = sum([len(x) for x in packed])
2837 packed[2] = struct.pack("!H", length)
2838 return ''.join(packed)
2839
2840 @staticmethod
2841 def unpack(reader):
2842 obj = bsn_flow_checksum_bucket_stats_reply()
2843 _version = reader.read("!B")[0]
2844 assert(_version == 4)
2845 _type = reader.read("!B")[0]
2846 assert(_type == 19)
2847 _length = reader.read("!H")[0]
2848 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002849 reader = orig_reader.slice(_length, 4)
Rich Lane93b33132014-04-21 12:20:58 -07002850 obj.xid = reader.read("!L")[0]
2851 _stats_type = reader.read("!H")[0]
2852 assert(_stats_type == 65535)
2853 obj.flags = reader.read("!H")[0]
2854 reader.skip(4)
2855 _experimenter = reader.read("!L")[0]
2856 assert(_experimenter == 6035143)
2857 _subtype = reader.read("!L")[0]
2858 assert(_subtype == 10)
Rich Lanee2567702015-01-26 15:04:35 -08002859 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_flow_checksum_bucket_stats_entry.unpack)
Rich Lane93b33132014-04-21 12:20:58 -07002860 return obj
2861
2862 def __eq__(self, other):
2863 if type(self) != type(other): return False
2864 if self.xid != other.xid: return False
2865 if self.flags != other.flags: return False
2866 if self.entries != other.entries: return False
2867 return True
2868
2869 def pretty_print(self, q):
2870 q.text("bsn_flow_checksum_bucket_stats_reply {")
2871 with q.group():
2872 with q.indent(2):
2873 q.breakable()
2874 q.text("xid = ");
2875 if self.xid != None:
2876 q.text("%#x" % self.xid)
2877 else:
2878 q.text('None')
2879 q.text(","); q.breakable()
2880 q.text("flags = ");
2881 q.text("%#x" % self.flags)
2882 q.text(","); q.breakable()
2883 q.text("entries = ");
2884 q.pp(self.entries)
2885 q.breakable()
2886 q.text('}')
2887
2888bsn_stats_reply.subtypes[10] = bsn_flow_checksum_bucket_stats_reply
2889
Rich Lane9ec3fca2014-02-26 16:22:56 -08002890class bsn_flow_checksum_bucket_stats_request(bsn_stats_request):
2891 version = 4
2892 type = 18
2893 stats_type = 65535
2894 experimenter = 6035143
2895 subtype = 10
2896
2897 def __init__(self, xid=None, flags=None, table_id=None):
2898 if xid != None:
2899 self.xid = xid
2900 else:
2901 self.xid = None
2902 if flags != None:
2903 self.flags = flags
2904 else:
2905 self.flags = 0
2906 if table_id != None:
2907 self.table_id = table_id
2908 else:
2909 self.table_id = 0
2910 return
2911
2912 def pack(self):
2913 packed = []
2914 packed.append(struct.pack("!B", self.version))
2915 packed.append(struct.pack("!B", self.type))
2916 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2917 packed.append(struct.pack("!L", self.xid))
2918 packed.append(struct.pack("!H", self.stats_type))
2919 packed.append(struct.pack("!H", self.flags))
2920 packed.append('\x00' * 4)
2921 packed.append(struct.pack("!L", self.experimenter))
2922 packed.append(struct.pack("!L", self.subtype))
2923 packed.append(struct.pack("!B", self.table_id))
2924 length = sum([len(x) for x in packed])
2925 packed[2] = struct.pack("!H", length)
2926 return ''.join(packed)
2927
2928 @staticmethod
2929 def unpack(reader):
2930 obj = bsn_flow_checksum_bucket_stats_request()
2931 _version = reader.read("!B")[0]
2932 assert(_version == 4)
2933 _type = reader.read("!B")[0]
2934 assert(_type == 18)
2935 _length = reader.read("!H")[0]
2936 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002937 reader = orig_reader.slice(_length, 4)
Rich Lane9ec3fca2014-02-26 16:22:56 -08002938 obj.xid = reader.read("!L")[0]
2939 _stats_type = reader.read("!H")[0]
2940 assert(_stats_type == 65535)
2941 obj.flags = reader.read("!H")[0]
2942 reader.skip(4)
2943 _experimenter = reader.read("!L")[0]
2944 assert(_experimenter == 6035143)
2945 _subtype = reader.read("!L")[0]
2946 assert(_subtype == 10)
2947 obj.table_id = reader.read("!B")[0]
2948 return obj
2949
2950 def __eq__(self, other):
2951 if type(self) != type(other): return False
2952 if self.xid != other.xid: return False
2953 if self.flags != other.flags: return False
2954 if self.table_id != other.table_id: return False
2955 return True
2956
2957 def pretty_print(self, q):
2958 q.text("bsn_flow_checksum_bucket_stats_request {")
2959 with q.group():
2960 with q.indent(2):
2961 q.breakable()
2962 q.text("xid = ");
2963 if self.xid != None:
2964 q.text("%#x" % self.xid)
2965 else:
2966 q.text('None')
2967 q.text(","); q.breakable()
2968 q.text("flags = ");
2969 q.text("%#x" % self.flags)
2970 q.text(","); q.breakable()
2971 q.text("table_id = ");
2972 q.text("%#x" % self.table_id)
2973 q.breakable()
2974 q.text('}')
2975
2976bsn_stats_request.subtypes[10] = bsn_flow_checksum_bucket_stats_request
2977
Rich Lane7dcdf022013-12-11 14:45:27 -08002978class bsn_flow_idle(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07002979 version = 4
2980 type = 4
2981 experimenter = 6035143
2982 subtype = 40
2983
2984 def __init__(self, xid=None, cookie=None, priority=None, table_id=None, match=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002985 if xid != None:
2986 self.xid = xid
2987 else:
2988 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07002989 if cookie != None:
2990 self.cookie = cookie
2991 else:
2992 self.cookie = 0
2993 if priority != None:
2994 self.priority = priority
2995 else:
2996 self.priority = 0
2997 if table_id != None:
2998 self.table_id = table_id
2999 else:
3000 self.table_id = 0
3001 if match != None:
3002 self.match = match
3003 else:
Rich Lanee2567702015-01-26 15:04:35 -08003004 self.match = ofp.match()
Rich Lane7dcdf022013-12-11 14:45:27 -08003005 return
Rich Lane6f4978c2013-10-20 21:33:52 -07003006
3007 def pack(self):
3008 packed = []
3009 packed.append(struct.pack("!B", self.version))
3010 packed.append(struct.pack("!B", self.type))
3011 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3012 packed.append(struct.pack("!L", self.xid))
3013 packed.append(struct.pack("!L", self.experimenter))
3014 packed.append(struct.pack("!L", self.subtype))
3015 packed.append(struct.pack("!Q", self.cookie))
3016 packed.append(struct.pack("!H", self.priority))
3017 packed.append(struct.pack("!B", self.table_id))
3018 packed.append('\x00' * 5)
3019 packed.append(self.match.pack())
3020 length = sum([len(x) for x in packed])
3021 packed[2] = struct.pack("!H", length)
3022 return ''.join(packed)
3023
3024 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003025 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07003026 obj = bsn_flow_idle()
Rich Lane6f4978c2013-10-20 21:33:52 -07003027 _version = reader.read("!B")[0]
3028 assert(_version == 4)
3029 _type = reader.read("!B")[0]
3030 assert(_type == 4)
3031 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003032 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003033 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -07003034 obj.xid = reader.read("!L")[0]
3035 _experimenter = reader.read("!L")[0]
3036 assert(_experimenter == 6035143)
3037 _subtype = reader.read("!L")[0]
3038 assert(_subtype == 40)
3039 obj.cookie = reader.read("!Q")[0]
3040 obj.priority = reader.read("!H")[0]
3041 obj.table_id = reader.read("!B")[0]
3042 reader.skip(5)
Rich Lanee2567702015-01-26 15:04:35 -08003043 obj.match = ofp.match.unpack(reader)
Rich Lane6f4978c2013-10-20 21:33:52 -07003044 return obj
3045
3046 def __eq__(self, other):
3047 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07003048 if self.xid != other.xid: return False
3049 if self.cookie != other.cookie: return False
3050 if self.priority != other.priority: return False
3051 if self.table_id != other.table_id: return False
3052 if self.match != other.match: return False
3053 return True
3054
Rich Lane6f4978c2013-10-20 21:33:52 -07003055 def pretty_print(self, q):
3056 q.text("bsn_flow_idle {")
3057 with q.group():
3058 with q.indent(2):
3059 q.breakable()
3060 q.text("xid = ");
3061 if self.xid != None:
3062 q.text("%#x" % self.xid)
3063 else:
3064 q.text('None')
3065 q.text(","); q.breakable()
3066 q.text("cookie = ");
3067 q.text("%#x" % self.cookie)
3068 q.text(","); q.breakable()
3069 q.text("priority = ");
3070 q.text("%#x" % self.priority)
3071 q.text(","); q.breakable()
3072 q.text("table_id = ");
3073 q.text("%#x" % self.table_id)
3074 q.text(","); q.breakable()
3075 q.text("match = ");
3076 q.pp(self.match)
3077 q.breakable()
3078 q.text('}')
3079
Rich Lane7dcdf022013-12-11 14:45:27 -08003080bsn_header.subtypes[40] = bsn_flow_idle
3081
3082class bsn_flow_idle_enable_get_reply(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07003083 version = 4
3084 type = 4
3085 experimenter = 6035143
3086 subtype = 39
3087
3088 def __init__(self, xid=None, enabled=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08003089 if xid != None:
3090 self.xid = xid
3091 else:
3092 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07003093 if enabled != None:
3094 self.enabled = enabled
3095 else:
3096 self.enabled = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08003097 return
Rich Lane6f4978c2013-10-20 21:33:52 -07003098
3099 def pack(self):
3100 packed = []
3101 packed.append(struct.pack("!B", self.version))
3102 packed.append(struct.pack("!B", self.type))
3103 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3104 packed.append(struct.pack("!L", self.xid))
3105 packed.append(struct.pack("!L", self.experimenter))
3106 packed.append(struct.pack("!L", self.subtype))
3107 packed.append(struct.pack("!L", self.enabled))
3108 length = sum([len(x) for x in packed])
3109 packed[2] = struct.pack("!H", length)
3110 return ''.join(packed)
3111
3112 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003113 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07003114 obj = bsn_flow_idle_enable_get_reply()
Rich Lane6f4978c2013-10-20 21:33:52 -07003115 _version = reader.read("!B")[0]
3116 assert(_version == 4)
3117 _type = reader.read("!B")[0]
3118 assert(_type == 4)
3119 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003120 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003121 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -07003122 obj.xid = reader.read("!L")[0]
3123 _experimenter = reader.read("!L")[0]
3124 assert(_experimenter == 6035143)
3125 _subtype = reader.read("!L")[0]
3126 assert(_subtype == 39)
3127 obj.enabled = reader.read("!L")[0]
3128 return obj
3129
3130 def __eq__(self, other):
3131 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07003132 if self.xid != other.xid: return False
3133 if self.enabled != other.enabled: return False
3134 return True
3135
Rich Lane6f4978c2013-10-20 21:33:52 -07003136 def pretty_print(self, q):
3137 q.text("bsn_flow_idle_enable_get_reply {")
3138 with q.group():
3139 with q.indent(2):
3140 q.breakable()
3141 q.text("xid = ");
3142 if self.xid != None:
3143 q.text("%#x" % self.xid)
3144 else:
3145 q.text('None')
3146 q.text(","); q.breakable()
3147 q.text("enabled = ");
3148 q.text("%#x" % self.enabled)
3149 q.breakable()
3150 q.text('}')
3151
Rich Lane7dcdf022013-12-11 14:45:27 -08003152bsn_header.subtypes[39] = bsn_flow_idle_enable_get_reply
3153
3154class bsn_flow_idle_enable_get_request(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07003155 version = 4
3156 type = 4
3157 experimenter = 6035143
3158 subtype = 38
3159
3160 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08003161 if xid != None:
3162 self.xid = xid
3163 else:
3164 self.xid = None
3165 return
Rich Lane6f4978c2013-10-20 21:33:52 -07003166
3167 def pack(self):
3168 packed = []
3169 packed.append(struct.pack("!B", self.version))
3170 packed.append(struct.pack("!B", self.type))
3171 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3172 packed.append(struct.pack("!L", self.xid))
3173 packed.append(struct.pack("!L", self.experimenter))
3174 packed.append(struct.pack("!L", self.subtype))
3175 length = sum([len(x) for x in packed])
3176 packed[2] = struct.pack("!H", length)
3177 return ''.join(packed)
3178
3179 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003180 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07003181 obj = bsn_flow_idle_enable_get_request()
Rich Lane6f4978c2013-10-20 21:33:52 -07003182 _version = reader.read("!B")[0]
3183 assert(_version == 4)
3184 _type = reader.read("!B")[0]
3185 assert(_type == 4)
3186 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003187 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003188 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -07003189 obj.xid = reader.read("!L")[0]
3190 _experimenter = reader.read("!L")[0]
3191 assert(_experimenter == 6035143)
3192 _subtype = reader.read("!L")[0]
3193 assert(_subtype == 38)
3194 return obj
3195
3196 def __eq__(self, other):
3197 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07003198 if self.xid != other.xid: return False
3199 return True
3200
Rich Lane6f4978c2013-10-20 21:33:52 -07003201 def pretty_print(self, q):
3202 q.text("bsn_flow_idle_enable_get_request {")
3203 with q.group():
3204 with q.indent(2):
3205 q.breakable()
3206 q.text("xid = ");
3207 if self.xid != None:
3208 q.text("%#x" % self.xid)
3209 else:
3210 q.text('None')
3211 q.breakable()
3212 q.text('}')
3213
Rich Lane7dcdf022013-12-11 14:45:27 -08003214bsn_header.subtypes[38] = bsn_flow_idle_enable_get_request
3215
3216class bsn_flow_idle_enable_set_reply(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07003217 version = 4
3218 type = 4
3219 experimenter = 6035143
3220 subtype = 37
3221
3222 def __init__(self, xid=None, enable=None, status=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08003223 if xid != None:
3224 self.xid = xid
3225 else:
3226 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07003227 if enable != None:
3228 self.enable = enable
3229 else:
3230 self.enable = 0
3231 if status != None:
3232 self.status = status
3233 else:
3234 self.status = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08003235 return
Rich Lane6f4978c2013-10-20 21:33:52 -07003236
3237 def pack(self):
3238 packed = []
3239 packed.append(struct.pack("!B", self.version))
3240 packed.append(struct.pack("!B", self.type))
3241 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3242 packed.append(struct.pack("!L", self.xid))
3243 packed.append(struct.pack("!L", self.experimenter))
3244 packed.append(struct.pack("!L", self.subtype))
3245 packed.append(struct.pack("!L", self.enable))
3246 packed.append(struct.pack("!L", self.status))
3247 length = sum([len(x) for x in packed])
3248 packed[2] = struct.pack("!H", length)
3249 return ''.join(packed)
3250
3251 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003252 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07003253 obj = bsn_flow_idle_enable_set_reply()
Rich Lane6f4978c2013-10-20 21:33:52 -07003254 _version = reader.read("!B")[0]
3255 assert(_version == 4)
3256 _type = reader.read("!B")[0]
3257 assert(_type == 4)
3258 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003259 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003260 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -07003261 obj.xid = reader.read("!L")[0]
3262 _experimenter = reader.read("!L")[0]
3263 assert(_experimenter == 6035143)
3264 _subtype = reader.read("!L")[0]
3265 assert(_subtype == 37)
3266 obj.enable = reader.read("!L")[0]
3267 obj.status = reader.read("!L")[0]
3268 return obj
3269
3270 def __eq__(self, other):
3271 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07003272 if self.xid != other.xid: return False
3273 if self.enable != other.enable: return False
3274 if self.status != other.status: return False
3275 return True
3276
Rich Lane6f4978c2013-10-20 21:33:52 -07003277 def pretty_print(self, q):
3278 q.text("bsn_flow_idle_enable_set_reply {")
3279 with q.group():
3280 with q.indent(2):
3281 q.breakable()
3282 q.text("xid = ");
3283 if self.xid != None:
3284 q.text("%#x" % self.xid)
3285 else:
3286 q.text('None')
3287 q.text(","); q.breakable()
3288 q.text("enable = ");
3289 q.text("%#x" % self.enable)
3290 q.text(","); q.breakable()
3291 q.text("status = ");
3292 q.text("%#x" % self.status)
3293 q.breakable()
3294 q.text('}')
3295
Rich Lane7dcdf022013-12-11 14:45:27 -08003296bsn_header.subtypes[37] = bsn_flow_idle_enable_set_reply
3297
3298class bsn_flow_idle_enable_set_request(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07003299 version = 4
3300 type = 4
3301 experimenter = 6035143
3302 subtype = 36
3303
3304 def __init__(self, xid=None, enable=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08003305 if xid != None:
3306 self.xid = xid
3307 else:
3308 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07003309 if enable != None:
3310 self.enable = enable
3311 else:
3312 self.enable = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08003313 return
Rich Lane6f4978c2013-10-20 21:33:52 -07003314
3315 def pack(self):
3316 packed = []
3317 packed.append(struct.pack("!B", self.version))
3318 packed.append(struct.pack("!B", self.type))
3319 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3320 packed.append(struct.pack("!L", self.xid))
3321 packed.append(struct.pack("!L", self.experimenter))
3322 packed.append(struct.pack("!L", self.subtype))
3323 packed.append(struct.pack("!L", self.enable))
3324 length = sum([len(x) for x in packed])
3325 packed[2] = struct.pack("!H", length)
3326 return ''.join(packed)
3327
3328 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003329 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07003330 obj = bsn_flow_idle_enable_set_request()
Rich Lane6f4978c2013-10-20 21:33:52 -07003331 _version = reader.read("!B")[0]
3332 assert(_version == 4)
3333 _type = reader.read("!B")[0]
3334 assert(_type == 4)
3335 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003336 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003337 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -07003338 obj.xid = reader.read("!L")[0]
3339 _experimenter = reader.read("!L")[0]
3340 assert(_experimenter == 6035143)
3341 _subtype = reader.read("!L")[0]
3342 assert(_subtype == 36)
3343 obj.enable = reader.read("!L")[0]
3344 return obj
3345
3346 def __eq__(self, other):
3347 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07003348 if self.xid != other.xid: return False
3349 if self.enable != other.enable: return False
3350 return True
3351
Rich Lane6f4978c2013-10-20 21:33:52 -07003352 def pretty_print(self, q):
3353 q.text("bsn_flow_idle_enable_set_request {")
3354 with q.group():
3355 with q.indent(2):
3356 q.breakable()
3357 q.text("xid = ");
3358 if self.xid != None:
3359 q.text("%#x" % self.xid)
3360 else:
3361 q.text('None')
3362 q.text(","); q.breakable()
3363 q.text("enable = ");
3364 q.text("%#x" % self.enable)
3365 q.breakable()
3366 q.text('}')
3367
Rich Lane7dcdf022013-12-11 14:45:27 -08003368bsn_header.subtypes[36] = bsn_flow_idle_enable_set_request
3369
Rich Lanecb18dbd2014-12-18 10:02:29 -08003370class bsn_generic_stats_reply(bsn_stats_reply):
3371 version = 4
3372 type = 19
3373 stats_type = 65535
3374 experimenter = 6035143
3375 subtype = 16
3376
3377 def __init__(self, xid=None, flags=None, entries=None):
3378 if xid != None:
3379 self.xid = xid
3380 else:
3381 self.xid = None
3382 if flags != None:
3383 self.flags = flags
3384 else:
3385 self.flags = 0
3386 if entries != None:
3387 self.entries = entries
3388 else:
3389 self.entries = []
3390 return
3391
3392 def pack(self):
3393 packed = []
3394 packed.append(struct.pack("!B", self.version))
3395 packed.append(struct.pack("!B", self.type))
3396 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3397 packed.append(struct.pack("!L", self.xid))
3398 packed.append(struct.pack("!H", self.stats_type))
3399 packed.append(struct.pack("!H", self.flags))
3400 packed.append('\x00' * 4)
3401 packed.append(struct.pack("!L", self.experimenter))
3402 packed.append(struct.pack("!L", self.subtype))
3403 packed.append(loxi.generic_util.pack_list(self.entries))
3404 length = sum([len(x) for x in packed])
3405 packed[2] = struct.pack("!H", length)
3406 return ''.join(packed)
3407
3408 @staticmethod
3409 def unpack(reader):
3410 obj = bsn_generic_stats_reply()
3411 _version = reader.read("!B")[0]
3412 assert(_version == 4)
3413 _type = reader.read("!B")[0]
3414 assert(_type == 19)
3415 _length = reader.read("!H")[0]
3416 orig_reader = reader
3417 reader = orig_reader.slice(_length, 4)
3418 obj.xid = reader.read("!L")[0]
3419 _stats_type = reader.read("!H")[0]
3420 assert(_stats_type == 65535)
3421 obj.flags = reader.read("!H")[0]
3422 reader.skip(4)
3423 _experimenter = reader.read("!L")[0]
3424 assert(_experimenter == 6035143)
3425 _subtype = reader.read("!L")[0]
3426 assert(_subtype == 16)
Rich Lanee2567702015-01-26 15:04:35 -08003427 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_generic_stats_entry.unpack)
Rich Lanecb18dbd2014-12-18 10:02:29 -08003428 return obj
3429
3430 def __eq__(self, other):
3431 if type(self) != type(other): return False
3432 if self.xid != other.xid: return False
3433 if self.flags != other.flags: return False
3434 if self.entries != other.entries: return False
3435 return True
3436
3437 def pretty_print(self, q):
3438 q.text("bsn_generic_stats_reply {")
3439 with q.group():
3440 with q.indent(2):
3441 q.breakable()
3442 q.text("xid = ");
3443 if self.xid != None:
3444 q.text("%#x" % self.xid)
3445 else:
3446 q.text('None')
3447 q.text(","); q.breakable()
3448 q.text("flags = ");
3449 q.text("%#x" % self.flags)
3450 q.text(","); q.breakable()
3451 q.text("entries = ");
3452 q.pp(self.entries)
3453 q.breakable()
3454 q.text('}')
3455
3456bsn_stats_reply.subtypes[16] = bsn_generic_stats_reply
3457
3458class bsn_generic_stats_request(bsn_stats_request):
3459 version = 4
3460 type = 18
3461 stats_type = 65535
3462 experimenter = 6035143
3463 subtype = 16
3464
3465 def __init__(self, xid=None, flags=None, name=None, tlvs=None):
3466 if xid != None:
3467 self.xid = xid
3468 else:
3469 self.xid = None
3470 if flags != None:
3471 self.flags = flags
3472 else:
3473 self.flags = 0
3474 if name != None:
3475 self.name = name
3476 else:
3477 self.name = ""
3478 if tlvs != None:
3479 self.tlvs = tlvs
3480 else:
3481 self.tlvs = []
3482 return
3483
3484 def pack(self):
3485 packed = []
3486 packed.append(struct.pack("!B", self.version))
3487 packed.append(struct.pack("!B", self.type))
3488 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3489 packed.append(struct.pack("!L", self.xid))
3490 packed.append(struct.pack("!H", self.stats_type))
3491 packed.append(struct.pack("!H", self.flags))
3492 packed.append('\x00' * 4)
3493 packed.append(struct.pack("!L", self.experimenter))
3494 packed.append(struct.pack("!L", self.subtype))
3495 packed.append(struct.pack("!64s", self.name))
3496 packed.append(loxi.generic_util.pack_list(self.tlvs))
3497 length = sum([len(x) for x in packed])
3498 packed[2] = struct.pack("!H", length)
3499 return ''.join(packed)
3500
3501 @staticmethod
3502 def unpack(reader):
3503 obj = bsn_generic_stats_request()
3504 _version = reader.read("!B")[0]
3505 assert(_version == 4)
3506 _type = reader.read("!B")[0]
3507 assert(_type == 18)
3508 _length = reader.read("!H")[0]
3509 orig_reader = reader
3510 reader = orig_reader.slice(_length, 4)
3511 obj.xid = reader.read("!L")[0]
3512 _stats_type = reader.read("!H")[0]
3513 assert(_stats_type == 65535)
3514 obj.flags = reader.read("!H")[0]
3515 reader.skip(4)
3516 _experimenter = reader.read("!L")[0]
3517 assert(_experimenter == 6035143)
3518 _subtype = reader.read("!L")[0]
3519 assert(_subtype == 16)
3520 obj.name = reader.read("!64s")[0].rstrip("\x00")
Rich Lanee2567702015-01-26 15:04:35 -08003521 obj.tlvs = loxi.generic_util.unpack_list(reader, ofp.bsn_tlv.bsn_tlv.unpack)
Rich Lanecb18dbd2014-12-18 10:02:29 -08003522 return obj
3523
3524 def __eq__(self, other):
3525 if type(self) != type(other): return False
3526 if self.xid != other.xid: return False
3527 if self.flags != other.flags: return False
3528 if self.name != other.name: return False
3529 if self.tlvs != other.tlvs: return False
3530 return True
3531
3532 def pretty_print(self, q):
3533 q.text("bsn_generic_stats_request {")
3534 with q.group():
3535 with q.indent(2):
3536 q.breakable()
3537 q.text("xid = ");
3538 if self.xid != None:
3539 q.text("%#x" % self.xid)
3540 else:
3541 q.text('None')
3542 q.text(","); q.breakable()
3543 q.text("flags = ");
3544 q.text("%#x" % self.flags)
3545 q.text(","); q.breakable()
3546 q.text("name = ");
3547 q.pp(self.name)
3548 q.text(","); q.breakable()
3549 q.text("tlvs = ");
3550 q.pp(self.tlvs)
3551 q.breakable()
3552 q.text('}')
3553
3554bsn_stats_request.subtypes[16] = bsn_generic_stats_request
3555
Rich Lane5454b682014-01-14 17:07:36 -08003556class bsn_gentable_bucket_stats_reply(bsn_stats_reply):
3557 version = 4
3558 type = 19
3559 stats_type = 65535
3560 experimenter = 6035143
3561 subtype = 5
3562
3563 def __init__(self, xid=None, flags=None, entries=None):
3564 if xid != None:
3565 self.xid = xid
3566 else:
3567 self.xid = None
3568 if flags != None:
3569 self.flags = flags
3570 else:
3571 self.flags = 0
3572 if entries != None:
3573 self.entries = entries
3574 else:
3575 self.entries = []
3576 return
3577
3578 def pack(self):
3579 packed = []
3580 packed.append(struct.pack("!B", self.version))
3581 packed.append(struct.pack("!B", self.type))
3582 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3583 packed.append(struct.pack("!L", self.xid))
3584 packed.append(struct.pack("!H", self.stats_type))
3585 packed.append(struct.pack("!H", self.flags))
3586 packed.append('\x00' * 4)
3587 packed.append(struct.pack("!L", self.experimenter))
3588 packed.append(struct.pack("!L", self.subtype))
3589 packed.append(loxi.generic_util.pack_list(self.entries))
3590 length = sum([len(x) for x in packed])
3591 packed[2] = struct.pack("!H", length)
3592 return ''.join(packed)
3593
3594 @staticmethod
3595 def unpack(reader):
3596 obj = bsn_gentable_bucket_stats_reply()
3597 _version = reader.read("!B")[0]
3598 assert(_version == 4)
3599 _type = reader.read("!B")[0]
3600 assert(_type == 19)
3601 _length = reader.read("!H")[0]
3602 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003603 reader = orig_reader.slice(_length, 4)
Rich Lane5454b682014-01-14 17:07:36 -08003604 obj.xid = reader.read("!L")[0]
3605 _stats_type = reader.read("!H")[0]
3606 assert(_stats_type == 65535)
3607 obj.flags = reader.read("!H")[0]
3608 reader.skip(4)
3609 _experimenter = reader.read("!L")[0]
3610 assert(_experimenter == 6035143)
3611 _subtype = reader.read("!L")[0]
3612 assert(_subtype == 5)
Rich Lanee2567702015-01-26 15:04:35 -08003613 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_gentable_bucket_stats_entry.unpack)
Rich Lane5454b682014-01-14 17:07:36 -08003614 return obj
3615
3616 def __eq__(self, other):
3617 if type(self) != type(other): return False
3618 if self.xid != other.xid: return False
3619 if self.flags != other.flags: return False
3620 if self.entries != other.entries: return False
3621 return True
3622
3623 def pretty_print(self, q):
3624 q.text("bsn_gentable_bucket_stats_reply {")
3625 with q.group():
3626 with q.indent(2):
3627 q.breakable()
3628 q.text("xid = ");
3629 if self.xid != None:
3630 q.text("%#x" % self.xid)
3631 else:
3632 q.text('None')
3633 q.text(","); q.breakable()
3634 q.text("flags = ");
3635 q.text("%#x" % self.flags)
3636 q.text(","); q.breakable()
3637 q.text("entries = ");
3638 q.pp(self.entries)
3639 q.breakable()
3640 q.text('}')
3641
3642bsn_stats_reply.subtypes[5] = bsn_gentable_bucket_stats_reply
3643
Rich Lane5454b682014-01-14 17:07:36 -08003644class bsn_gentable_bucket_stats_request(bsn_stats_request):
3645 version = 4
3646 type = 18
3647 stats_type = 65535
3648 experimenter = 6035143
3649 subtype = 5
3650
3651 def __init__(self, xid=None, flags=None, table_id=None):
3652 if xid != None:
3653 self.xid = xid
3654 else:
3655 self.xid = None
3656 if flags != None:
3657 self.flags = flags
3658 else:
3659 self.flags = 0
3660 if table_id != None:
3661 self.table_id = table_id
3662 else:
3663 self.table_id = 0
3664 return
3665
3666 def pack(self):
3667 packed = []
3668 packed.append(struct.pack("!B", self.version))
3669 packed.append(struct.pack("!B", self.type))
3670 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3671 packed.append(struct.pack("!L", self.xid))
3672 packed.append(struct.pack("!H", self.stats_type))
3673 packed.append(struct.pack("!H", self.flags))
3674 packed.append('\x00' * 4)
3675 packed.append(struct.pack("!L", self.experimenter))
3676 packed.append(struct.pack("!L", self.subtype))
3677 packed.append(struct.pack("!H", self.table_id))
3678 length = sum([len(x) for x in packed])
3679 packed[2] = struct.pack("!H", length)
3680 return ''.join(packed)
3681
3682 @staticmethod
3683 def unpack(reader):
3684 obj = bsn_gentable_bucket_stats_request()
3685 _version = reader.read("!B")[0]
3686 assert(_version == 4)
3687 _type = reader.read("!B")[0]
3688 assert(_type == 18)
3689 _length = reader.read("!H")[0]
3690 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003691 reader = orig_reader.slice(_length, 4)
Rich Lane5454b682014-01-14 17:07:36 -08003692 obj.xid = reader.read("!L")[0]
3693 _stats_type = reader.read("!H")[0]
3694 assert(_stats_type == 65535)
3695 obj.flags = reader.read("!H")[0]
3696 reader.skip(4)
3697 _experimenter = reader.read("!L")[0]
3698 assert(_experimenter == 6035143)
3699 _subtype = reader.read("!L")[0]
3700 assert(_subtype == 5)
3701 obj.table_id = reader.read("!H")[0]
3702 return obj
3703
3704 def __eq__(self, other):
3705 if type(self) != type(other): return False
3706 if self.xid != other.xid: return False
3707 if self.flags != other.flags: return False
3708 if self.table_id != other.table_id: return False
3709 return True
3710
3711 def pretty_print(self, q):
3712 q.text("bsn_gentable_bucket_stats_request {")
3713 with q.group():
3714 with q.indent(2):
3715 q.breakable()
3716 q.text("xid = ");
3717 if self.xid != None:
3718 q.text("%#x" % self.xid)
3719 else:
3720 q.text('None')
3721 q.text(","); q.breakable()
3722 q.text("flags = ");
3723 q.text("%#x" % self.flags)
3724 q.text(","); q.breakable()
3725 q.text("table_id = ");
3726 q.text("%#x" % self.table_id)
3727 q.breakable()
3728 q.text('}')
3729
3730bsn_stats_request.subtypes[5] = bsn_gentable_bucket_stats_request
3731
3732class bsn_gentable_clear_reply(bsn_header):
3733 version = 4
3734 type = 4
3735 experimenter = 6035143
3736 subtype = 49
3737
3738 def __init__(self, xid=None, table_id=None, deleted_count=None, error_count=None):
3739 if xid != None:
3740 self.xid = xid
3741 else:
3742 self.xid = None
3743 if table_id != None:
3744 self.table_id = table_id
3745 else:
3746 self.table_id = 0
3747 if deleted_count != None:
3748 self.deleted_count = deleted_count
3749 else:
3750 self.deleted_count = 0
3751 if error_count != None:
3752 self.error_count = error_count
3753 else:
3754 self.error_count = 0
3755 return
3756
3757 def pack(self):
3758 packed = []
3759 packed.append(struct.pack("!B", self.version))
3760 packed.append(struct.pack("!B", self.type))
3761 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3762 packed.append(struct.pack("!L", self.xid))
3763 packed.append(struct.pack("!L", self.experimenter))
3764 packed.append(struct.pack("!L", self.subtype))
3765 packed.append(struct.pack("!H", self.table_id))
3766 packed.append('\x00' * 2)
3767 packed.append(struct.pack("!L", self.deleted_count))
3768 packed.append(struct.pack("!L", self.error_count))
3769 length = sum([len(x) for x in packed])
3770 packed[2] = struct.pack("!H", length)
3771 return ''.join(packed)
3772
3773 @staticmethod
3774 def unpack(reader):
3775 obj = bsn_gentable_clear_reply()
3776 _version = reader.read("!B")[0]
3777 assert(_version == 4)
3778 _type = reader.read("!B")[0]
3779 assert(_type == 4)
3780 _length = reader.read("!H")[0]
3781 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003782 reader = orig_reader.slice(_length, 4)
Rich Lane5454b682014-01-14 17:07:36 -08003783 obj.xid = reader.read("!L")[0]
3784 _experimenter = reader.read("!L")[0]
3785 assert(_experimenter == 6035143)
3786 _subtype = reader.read("!L")[0]
3787 assert(_subtype == 49)
3788 obj.table_id = reader.read("!H")[0]
3789 reader.skip(2)
3790 obj.deleted_count = reader.read("!L")[0]
3791 obj.error_count = reader.read("!L")[0]
3792 return obj
3793
3794 def __eq__(self, other):
3795 if type(self) != type(other): return False
3796 if self.xid != other.xid: return False
3797 if self.table_id != other.table_id: return False
3798 if self.deleted_count != other.deleted_count: return False
3799 if self.error_count != other.error_count: return False
3800 return True
3801
3802 def pretty_print(self, q):
3803 q.text("bsn_gentable_clear_reply {")
3804 with q.group():
3805 with q.indent(2):
3806 q.breakable()
3807 q.text("xid = ");
3808 if self.xid != None:
3809 q.text("%#x" % self.xid)
3810 else:
3811 q.text('None')
3812 q.text(","); q.breakable()
3813 q.text("table_id = ");
3814 q.text("%#x" % self.table_id)
3815 q.text(","); q.breakable()
3816 q.text("deleted_count = ");
3817 q.text("%#x" % self.deleted_count)
3818 q.text(","); q.breakable()
3819 q.text("error_count = ");
3820 q.text("%#x" % self.error_count)
3821 q.breakable()
3822 q.text('}')
3823
3824bsn_header.subtypes[49] = bsn_gentable_clear_reply
3825
3826class bsn_gentable_clear_request(bsn_header):
3827 version = 4
3828 type = 4
3829 experimenter = 6035143
3830 subtype = 48
3831
3832 def __init__(self, xid=None, table_id=None, checksum=None, checksum_mask=None):
3833 if xid != None:
3834 self.xid = xid
3835 else:
3836 self.xid = None
3837 if table_id != None:
3838 self.table_id = table_id
3839 else:
3840 self.table_id = 0
3841 if checksum != None:
3842 self.checksum = checksum
3843 else:
3844 self.checksum = 0
3845 if checksum_mask != None:
3846 self.checksum_mask = checksum_mask
3847 else:
3848 self.checksum_mask = 0
3849 return
3850
3851 def pack(self):
3852 packed = []
3853 packed.append(struct.pack("!B", self.version))
3854 packed.append(struct.pack("!B", self.type))
3855 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3856 packed.append(struct.pack("!L", self.xid))
3857 packed.append(struct.pack("!L", self.experimenter))
3858 packed.append(struct.pack("!L", self.subtype))
3859 packed.append(struct.pack("!H", self.table_id))
3860 packed.append('\x00' * 2)
3861 packed.append(util.pack_checksum_128(self.checksum))
3862 packed.append(util.pack_checksum_128(self.checksum_mask))
3863 length = sum([len(x) for x in packed])
3864 packed[2] = struct.pack("!H", length)
3865 return ''.join(packed)
3866
3867 @staticmethod
3868 def unpack(reader):
3869 obj = bsn_gentable_clear_request()
3870 _version = reader.read("!B")[0]
3871 assert(_version == 4)
3872 _type = reader.read("!B")[0]
3873 assert(_type == 4)
3874 _length = reader.read("!H")[0]
3875 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003876 reader = orig_reader.slice(_length, 4)
Rich Lane5454b682014-01-14 17:07:36 -08003877 obj.xid = reader.read("!L")[0]
3878 _experimenter = reader.read("!L")[0]
3879 assert(_experimenter == 6035143)
3880 _subtype = reader.read("!L")[0]
3881 assert(_subtype == 48)
3882 obj.table_id = reader.read("!H")[0]
3883 reader.skip(2)
3884 obj.checksum = util.unpack_checksum_128(reader)
3885 obj.checksum_mask = util.unpack_checksum_128(reader)
3886 return obj
3887
3888 def __eq__(self, other):
3889 if type(self) != type(other): return False
3890 if self.xid != other.xid: return False
3891 if self.table_id != other.table_id: return False
3892 if self.checksum != other.checksum: return False
3893 if self.checksum_mask != other.checksum_mask: return False
3894 return True
3895
3896 def pretty_print(self, q):
3897 q.text("bsn_gentable_clear_request {")
3898 with q.group():
3899 with q.indent(2):
3900 q.breakable()
3901 q.text("xid = ");
3902 if self.xid != None:
3903 q.text("%#x" % self.xid)
3904 else:
3905 q.text('None')
3906 q.text(","); q.breakable()
3907 q.text("table_id = ");
3908 q.text("%#x" % self.table_id)
3909 q.text(","); q.breakable()
3910 q.text("checksum = ");
3911 q.pp(self.checksum)
3912 q.text(","); q.breakable()
3913 q.text("checksum_mask = ");
3914 q.pp(self.checksum_mask)
3915 q.breakable()
3916 q.text('}')
3917
3918bsn_header.subtypes[48] = bsn_gentable_clear_request
3919
3920class bsn_gentable_desc_stats_reply(bsn_stats_reply):
3921 version = 4
3922 type = 19
3923 stats_type = 65535
3924 experimenter = 6035143
3925 subtype = 4
3926
3927 def __init__(self, xid=None, flags=None, entries=None):
3928 if xid != None:
3929 self.xid = xid
3930 else:
3931 self.xid = None
3932 if flags != None:
3933 self.flags = flags
3934 else:
3935 self.flags = 0
3936 if entries != None:
3937 self.entries = entries
3938 else:
3939 self.entries = []
3940 return
3941
3942 def pack(self):
3943 packed = []
3944 packed.append(struct.pack("!B", self.version))
3945 packed.append(struct.pack("!B", self.type))
3946 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3947 packed.append(struct.pack("!L", self.xid))
3948 packed.append(struct.pack("!H", self.stats_type))
3949 packed.append(struct.pack("!H", self.flags))
3950 packed.append('\x00' * 4)
3951 packed.append(struct.pack("!L", self.experimenter))
3952 packed.append(struct.pack("!L", self.subtype))
3953 packed.append(loxi.generic_util.pack_list(self.entries))
3954 length = sum([len(x) for x in packed])
3955 packed[2] = struct.pack("!H", length)
3956 return ''.join(packed)
3957
3958 @staticmethod
3959 def unpack(reader):
3960 obj = bsn_gentable_desc_stats_reply()
3961 _version = reader.read("!B")[0]
3962 assert(_version == 4)
3963 _type = reader.read("!B")[0]
3964 assert(_type == 19)
3965 _length = reader.read("!H")[0]
3966 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003967 reader = orig_reader.slice(_length, 4)
Rich Lane5454b682014-01-14 17:07:36 -08003968 obj.xid = reader.read("!L")[0]
3969 _stats_type = reader.read("!H")[0]
3970 assert(_stats_type == 65535)
3971 obj.flags = reader.read("!H")[0]
3972 reader.skip(4)
3973 _experimenter = reader.read("!L")[0]
3974 assert(_experimenter == 6035143)
3975 _subtype = reader.read("!L")[0]
3976 assert(_subtype == 4)
Rich Lanee2567702015-01-26 15:04:35 -08003977 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_gentable_desc_stats_entry.unpack)
Rich Lane5454b682014-01-14 17:07:36 -08003978 return obj
3979
3980 def __eq__(self, other):
3981 if type(self) != type(other): return False
3982 if self.xid != other.xid: return False
3983 if self.flags != other.flags: return False
3984 if self.entries != other.entries: return False
3985 return True
3986
3987 def pretty_print(self, q):
3988 q.text("bsn_gentable_desc_stats_reply {")
3989 with q.group():
3990 with q.indent(2):
3991 q.breakable()
3992 q.text("xid = ");
3993 if self.xid != None:
3994 q.text("%#x" % self.xid)
3995 else:
3996 q.text('None')
3997 q.text(","); q.breakable()
3998 q.text("flags = ");
3999 q.text("%#x" % self.flags)
4000 q.text(","); q.breakable()
4001 q.text("entries = ");
4002 q.pp(self.entries)
4003 q.breakable()
4004 q.text('}')
4005
4006bsn_stats_reply.subtypes[4] = bsn_gentable_desc_stats_reply
4007
4008class bsn_gentable_desc_stats_request(bsn_stats_request):
4009 version = 4
4010 type = 18
4011 stats_type = 65535
4012 experimenter = 6035143
4013 subtype = 4
4014
4015 def __init__(self, xid=None, flags=None):
4016 if xid != None:
4017 self.xid = xid
4018 else:
4019 self.xid = None
4020 if flags != None:
4021 self.flags = flags
4022 else:
4023 self.flags = 0
4024 return
4025
4026 def pack(self):
4027 packed = []
4028 packed.append(struct.pack("!B", self.version))
4029 packed.append(struct.pack("!B", self.type))
4030 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4031 packed.append(struct.pack("!L", self.xid))
4032 packed.append(struct.pack("!H", self.stats_type))
4033 packed.append(struct.pack("!H", self.flags))
4034 packed.append('\x00' * 4)
4035 packed.append(struct.pack("!L", self.experimenter))
4036 packed.append(struct.pack("!L", self.subtype))
4037 length = sum([len(x) for x in packed])
4038 packed[2] = struct.pack("!H", length)
4039 return ''.join(packed)
4040
4041 @staticmethod
4042 def unpack(reader):
4043 obj = bsn_gentable_desc_stats_request()
4044 _version = reader.read("!B")[0]
4045 assert(_version == 4)
4046 _type = reader.read("!B")[0]
4047 assert(_type == 18)
4048 _length = reader.read("!H")[0]
4049 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08004050 reader = orig_reader.slice(_length, 4)
Rich Lane5454b682014-01-14 17:07:36 -08004051 obj.xid = reader.read("!L")[0]
4052 _stats_type = reader.read("!H")[0]
4053 assert(_stats_type == 65535)
4054 obj.flags = reader.read("!H")[0]
4055 reader.skip(4)
4056 _experimenter = reader.read("!L")[0]
4057 assert(_experimenter == 6035143)
4058 _subtype = reader.read("!L")[0]
4059 assert(_subtype == 4)
4060 return obj
4061
4062 def __eq__(self, other):
4063 if type(self) != type(other): return False
4064 if self.xid != other.xid: return False
4065 if self.flags != other.flags: return False
4066 return True
4067
4068 def pretty_print(self, q):
4069 q.text("bsn_gentable_desc_stats_request {")
4070 with q.group():
4071 with q.indent(2):
4072 q.breakable()
4073 q.text("xid = ");
4074 if self.xid != None:
4075 q.text("%#x" % self.xid)
4076 else:
4077 q.text('None')
4078 q.text(","); q.breakable()
4079 q.text("flags = ");
4080 q.text("%#x" % self.flags)
4081 q.breakable()
4082 q.text('}')
4083
4084bsn_stats_request.subtypes[4] = bsn_gentable_desc_stats_request
4085
4086class bsn_gentable_entry_add(bsn_header):
4087 version = 4
4088 type = 4
4089 experimenter = 6035143
4090 subtype = 46
4091
4092 def __init__(self, xid=None, table_id=None, checksum=None, key=None, value=None):
4093 if xid != None:
4094 self.xid = xid
4095 else:
4096 self.xid = None
4097 if table_id != None:
4098 self.table_id = table_id
4099 else:
4100 self.table_id = 0
4101 if checksum != None:
4102 self.checksum = checksum
4103 else:
4104 self.checksum = 0
4105 if key != None:
4106 self.key = key
4107 else:
4108 self.key = []
4109 if value != None:
4110 self.value = value
4111 else:
4112 self.value = []
4113 return
4114
4115 def pack(self):
4116 packed = []
4117 packed.append(struct.pack("!B", self.version))
4118 packed.append(struct.pack("!B", self.type))
4119 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4120 packed.append(struct.pack("!L", self.xid))
4121 packed.append(struct.pack("!L", self.experimenter))
4122 packed.append(struct.pack("!L", self.subtype))
4123 packed.append(struct.pack("!H", self.table_id))
4124 packed.append(struct.pack("!H", 0)) # placeholder for key_length at index 7
4125 packed.append(util.pack_checksum_128(self.checksum))
4126 packed.append(loxi.generic_util.pack_list(self.key))
4127 packed[7] = struct.pack("!H", len(packed[-1]))
4128 packed.append(loxi.generic_util.pack_list(self.value))
4129 length = sum([len(x) for x in packed])
4130 packed[2] = struct.pack("!H", length)
4131 return ''.join(packed)
4132
4133 @staticmethod
4134 def unpack(reader):
4135 obj = bsn_gentable_entry_add()
4136 _version = reader.read("!B")[0]
4137 assert(_version == 4)
4138 _type = reader.read("!B")[0]
4139 assert(_type == 4)
4140 _length = reader.read("!H")[0]
4141 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08004142 reader = orig_reader.slice(_length, 4)
Rich Lane5454b682014-01-14 17:07:36 -08004143 obj.xid = reader.read("!L")[0]
4144 _experimenter = reader.read("!L")[0]
4145 assert(_experimenter == 6035143)
4146 _subtype = reader.read("!L")[0]
4147 assert(_subtype == 46)
4148 obj.table_id = reader.read("!H")[0]
4149 _key_length = reader.read("!H")[0]
4150 obj.checksum = util.unpack_checksum_128(reader)
Rich Lanee2567702015-01-26 15:04:35 -08004151 obj.key = loxi.generic_util.unpack_list(reader.slice(_key_length), ofp.bsn_tlv.bsn_tlv.unpack)
4152 obj.value = loxi.generic_util.unpack_list(reader, ofp.bsn_tlv.bsn_tlv.unpack)
Rich Lane5454b682014-01-14 17:07:36 -08004153 return obj
4154
4155 def __eq__(self, other):
4156 if type(self) != type(other): return False
4157 if self.xid != other.xid: return False
4158 if self.table_id != other.table_id: return False
4159 if self.checksum != other.checksum: return False
4160 if self.key != other.key: return False
4161 if self.value != other.value: return False
4162 return True
4163
4164 def pretty_print(self, q):
4165 q.text("bsn_gentable_entry_add {")
4166 with q.group():
4167 with q.indent(2):
4168 q.breakable()
4169 q.text("xid = ");
4170 if self.xid != None:
4171 q.text("%#x" % self.xid)
4172 else:
4173 q.text('None')
4174 q.text(","); q.breakable()
4175 q.text("table_id = ");
4176 q.text("%#x" % self.table_id)
4177 q.text(","); q.breakable()
4178 q.text("checksum = ");
4179 q.pp(self.checksum)
4180 q.text(","); q.breakable()
4181 q.text("key = ");
4182 q.pp(self.key)
4183 q.text(","); q.breakable()
4184 q.text("value = ");
4185 q.pp(self.value)
4186 q.breakable()
4187 q.text('}')
4188
4189bsn_header.subtypes[46] = bsn_gentable_entry_add
4190
4191class bsn_gentable_entry_delete(bsn_header):
4192 version = 4
4193 type = 4
4194 experimenter = 6035143
4195 subtype = 47
4196
4197 def __init__(self, xid=None, table_id=None, key=None):
4198 if xid != None:
4199 self.xid = xid
4200 else:
4201 self.xid = None
4202 if table_id != None:
4203 self.table_id = table_id
4204 else:
4205 self.table_id = 0
4206 if key != None:
4207 self.key = key
4208 else:
4209 self.key = []
4210 return
4211
4212 def pack(self):
4213 packed = []
4214 packed.append(struct.pack("!B", self.version))
4215 packed.append(struct.pack("!B", self.type))
4216 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4217 packed.append(struct.pack("!L", self.xid))
4218 packed.append(struct.pack("!L", self.experimenter))
4219 packed.append(struct.pack("!L", self.subtype))
4220 packed.append(struct.pack("!H", self.table_id))
4221 packed.append(loxi.generic_util.pack_list(self.key))
4222 length = sum([len(x) for x in packed])
4223 packed[2] = struct.pack("!H", length)
4224 return ''.join(packed)
4225
4226 @staticmethod
4227 def unpack(reader):
4228 obj = bsn_gentable_entry_delete()
4229 _version = reader.read("!B")[0]
4230 assert(_version == 4)
4231 _type = reader.read("!B")[0]
4232 assert(_type == 4)
4233 _length = reader.read("!H")[0]
4234 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08004235 reader = orig_reader.slice(_length, 4)
Rich Lane5454b682014-01-14 17:07:36 -08004236 obj.xid = reader.read("!L")[0]
4237 _experimenter = reader.read("!L")[0]
4238 assert(_experimenter == 6035143)
4239 _subtype = reader.read("!L")[0]
4240 assert(_subtype == 47)
4241 obj.table_id = reader.read("!H")[0]
Rich Lanee2567702015-01-26 15:04:35 -08004242 obj.key = loxi.generic_util.unpack_list(reader, ofp.bsn_tlv.bsn_tlv.unpack)
Rich Lane5454b682014-01-14 17:07:36 -08004243 return obj
4244
4245 def __eq__(self, other):
4246 if type(self) != type(other): return False
4247 if self.xid != other.xid: return False
4248 if self.table_id != other.table_id: return False
4249 if self.key != other.key: return False
4250 return True
4251
4252 def pretty_print(self, q):
4253 q.text("bsn_gentable_entry_delete {")
4254 with q.group():
4255 with q.indent(2):
4256 q.breakable()
4257 q.text("xid = ");
4258 if self.xid != None:
4259 q.text("%#x" % self.xid)
4260 else:
4261 q.text('None')
4262 q.text(","); q.breakable()
4263 q.text("table_id = ");
4264 q.text("%#x" % self.table_id)
4265 q.text(","); q.breakable()
4266 q.text("key = ");
4267 q.pp(self.key)
4268 q.breakable()
4269 q.text('}')
4270
4271bsn_header.subtypes[47] = bsn_gentable_entry_delete
4272
4273class bsn_gentable_entry_desc_stats_reply(bsn_stats_reply):
4274 version = 4
4275 type = 19
4276 stats_type = 65535
4277 experimenter = 6035143
4278 subtype = 2
4279
4280 def __init__(self, xid=None, flags=None, entries=None):
4281 if xid != None:
4282 self.xid = xid
4283 else:
4284 self.xid = None
4285 if flags != None:
4286 self.flags = flags
4287 else:
4288 self.flags = 0
4289 if entries != None:
4290 self.entries = entries
4291 else:
4292 self.entries = []
4293 return
4294
4295 def pack(self):
4296 packed = []
4297 packed.append(struct.pack("!B", self.version))
4298 packed.append(struct.pack("!B", self.type))
4299 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4300 packed.append(struct.pack("!L", self.xid))
4301 packed.append(struct.pack("!H", self.stats_type))
4302 packed.append(struct.pack("!H", self.flags))
4303 packed.append('\x00' * 4)
4304 packed.append(struct.pack("!L", self.experimenter))
4305 packed.append(struct.pack("!L", self.subtype))
4306 packed.append(loxi.generic_util.pack_list(self.entries))
4307 length = sum([len(x) for x in packed])
4308 packed[2] = struct.pack("!H", length)
4309 return ''.join(packed)
4310
4311 @staticmethod
4312 def unpack(reader):
4313 obj = bsn_gentable_entry_desc_stats_reply()
4314 _version = reader.read("!B")[0]
4315 assert(_version == 4)
4316 _type = reader.read("!B")[0]
4317 assert(_type == 19)
4318 _length = reader.read("!H")[0]
4319 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08004320 reader = orig_reader.slice(_length, 4)
Rich Lane5454b682014-01-14 17:07:36 -08004321 obj.xid = reader.read("!L")[0]
4322 _stats_type = reader.read("!H")[0]
4323 assert(_stats_type == 65535)
4324 obj.flags = reader.read("!H")[0]
4325 reader.skip(4)
4326 _experimenter = reader.read("!L")[0]
4327 assert(_experimenter == 6035143)
4328 _subtype = reader.read("!L")[0]
4329 assert(_subtype == 2)
Rich Lanee2567702015-01-26 15:04:35 -08004330 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_gentable_entry_desc_stats_entry.unpack)
Rich Lane5454b682014-01-14 17:07:36 -08004331 return obj
4332
4333 def __eq__(self, other):
4334 if type(self) != type(other): return False
4335 if self.xid != other.xid: return False
4336 if self.flags != other.flags: return False
4337 if self.entries != other.entries: return False
4338 return True
4339
4340 def pretty_print(self, q):
4341 q.text("bsn_gentable_entry_desc_stats_reply {")
4342 with q.group():
4343 with q.indent(2):
4344 q.breakable()
4345 q.text("xid = ");
4346 if self.xid != None:
4347 q.text("%#x" % self.xid)
4348 else:
4349 q.text('None')
4350 q.text(","); q.breakable()
4351 q.text("flags = ");
4352 q.text("%#x" % self.flags)
4353 q.text(","); q.breakable()
4354 q.text("entries = ");
4355 q.pp(self.entries)
4356 q.breakable()
4357 q.text('}')
4358
4359bsn_stats_reply.subtypes[2] = bsn_gentable_entry_desc_stats_reply
4360
4361class bsn_gentable_entry_desc_stats_request(bsn_stats_request):
4362 version = 4
4363 type = 18
4364 stats_type = 65535
4365 experimenter = 6035143
4366 subtype = 2
4367
4368 def __init__(self, xid=None, flags=None, table_id=None, checksum=None, checksum_mask=None):
4369 if xid != None:
4370 self.xid = xid
4371 else:
4372 self.xid = None
4373 if flags != None:
4374 self.flags = flags
4375 else:
4376 self.flags = 0
4377 if table_id != None:
4378 self.table_id = table_id
4379 else:
4380 self.table_id = 0
4381 if checksum != None:
4382 self.checksum = checksum
4383 else:
4384 self.checksum = 0
4385 if checksum_mask != None:
4386 self.checksum_mask = checksum_mask
4387 else:
4388 self.checksum_mask = 0
4389 return
4390
4391 def pack(self):
4392 packed = []
4393 packed.append(struct.pack("!B", self.version))
4394 packed.append(struct.pack("!B", self.type))
4395 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4396 packed.append(struct.pack("!L", self.xid))
4397 packed.append(struct.pack("!H", self.stats_type))
4398 packed.append(struct.pack("!H", self.flags))
4399 packed.append('\x00' * 4)
4400 packed.append(struct.pack("!L", self.experimenter))
4401 packed.append(struct.pack("!L", self.subtype))
4402 packed.append(struct.pack("!H", self.table_id))
4403 packed.append('\x00' * 2)
4404 packed.append(util.pack_checksum_128(self.checksum))
4405 packed.append(util.pack_checksum_128(self.checksum_mask))
4406 length = sum([len(x) for x in packed])
4407 packed[2] = struct.pack("!H", length)
4408 return ''.join(packed)
4409
4410 @staticmethod
4411 def unpack(reader):
4412 obj = bsn_gentable_entry_desc_stats_request()
4413 _version = reader.read("!B")[0]
4414 assert(_version == 4)
4415 _type = reader.read("!B")[0]
4416 assert(_type == 18)
4417 _length = reader.read("!H")[0]
4418 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08004419 reader = orig_reader.slice(_length, 4)
Rich Lane5454b682014-01-14 17:07:36 -08004420 obj.xid = reader.read("!L")[0]
4421 _stats_type = reader.read("!H")[0]
4422 assert(_stats_type == 65535)
4423 obj.flags = reader.read("!H")[0]
4424 reader.skip(4)
4425 _experimenter = reader.read("!L")[0]
4426 assert(_experimenter == 6035143)
4427 _subtype = reader.read("!L")[0]
4428 assert(_subtype == 2)
4429 obj.table_id = reader.read("!H")[0]
4430 reader.skip(2)
4431 obj.checksum = util.unpack_checksum_128(reader)
4432 obj.checksum_mask = util.unpack_checksum_128(reader)
4433 return obj
4434
4435 def __eq__(self, other):
4436 if type(self) != type(other): return False
4437 if self.xid != other.xid: return False
4438 if self.flags != other.flags: return False
4439 if self.table_id != other.table_id: return False
4440 if self.checksum != other.checksum: return False
4441 if self.checksum_mask != other.checksum_mask: return False
4442 return True
4443
4444 def pretty_print(self, q):
4445 q.text("bsn_gentable_entry_desc_stats_request {")
4446 with q.group():
4447 with q.indent(2):
4448 q.breakable()
4449 q.text("xid = ");
4450 if self.xid != None:
4451 q.text("%#x" % self.xid)
4452 else:
4453 q.text('None')
4454 q.text(","); q.breakable()
4455 q.text("flags = ");
4456 q.text("%#x" % self.flags)
4457 q.text(","); q.breakable()
4458 q.text("table_id = ");
4459 q.text("%#x" % self.table_id)
4460 q.text(","); q.breakable()
4461 q.text("checksum = ");
4462 q.pp(self.checksum)
4463 q.text(","); q.breakable()
4464 q.text("checksum_mask = ");
4465 q.pp(self.checksum_mask)
4466 q.breakable()
4467 q.text('}')
4468
4469bsn_stats_request.subtypes[2] = bsn_gentable_entry_desc_stats_request
4470
4471class bsn_gentable_entry_stats_reply(bsn_stats_reply):
4472 version = 4
4473 type = 19
4474 stats_type = 65535
4475 experimenter = 6035143
4476 subtype = 3
4477
4478 def __init__(self, xid=None, flags=None, entries=None):
4479 if xid != None:
4480 self.xid = xid
4481 else:
4482 self.xid = None
4483 if flags != None:
4484 self.flags = flags
4485 else:
4486 self.flags = 0
4487 if entries != None:
4488 self.entries = entries
4489 else:
4490 self.entries = []
4491 return
4492
4493 def pack(self):
4494 packed = []
4495 packed.append(struct.pack("!B", self.version))
4496 packed.append(struct.pack("!B", self.type))
4497 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4498 packed.append(struct.pack("!L", self.xid))
4499 packed.append(struct.pack("!H", self.stats_type))
4500 packed.append(struct.pack("!H", self.flags))
4501 packed.append('\x00' * 4)
4502 packed.append(struct.pack("!L", self.experimenter))
4503 packed.append(struct.pack("!L", self.subtype))
4504 packed.append(loxi.generic_util.pack_list(self.entries))
4505 length = sum([len(x) for x in packed])
4506 packed[2] = struct.pack("!H", length)
4507 return ''.join(packed)
4508
4509 @staticmethod
4510 def unpack(reader):
4511 obj = bsn_gentable_entry_stats_reply()
4512 _version = reader.read("!B")[0]
4513 assert(_version == 4)
4514 _type = reader.read("!B")[0]
4515 assert(_type == 19)
4516 _length = reader.read("!H")[0]
4517 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08004518 reader = orig_reader.slice(_length, 4)
Rich Lane5454b682014-01-14 17:07:36 -08004519 obj.xid = reader.read("!L")[0]
4520 _stats_type = reader.read("!H")[0]
4521 assert(_stats_type == 65535)
4522 obj.flags = reader.read("!H")[0]
4523 reader.skip(4)
4524 _experimenter = reader.read("!L")[0]
4525 assert(_experimenter == 6035143)
4526 _subtype = reader.read("!L")[0]
4527 assert(_subtype == 3)
Rich Lanee2567702015-01-26 15:04:35 -08004528 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_gentable_entry_stats_entry.unpack)
Rich Lane5454b682014-01-14 17:07:36 -08004529 return obj
4530
4531 def __eq__(self, other):
4532 if type(self) != type(other): return False
4533 if self.xid != other.xid: return False
4534 if self.flags != other.flags: return False
4535 if self.entries != other.entries: return False
4536 return True
4537
4538 def pretty_print(self, q):
4539 q.text("bsn_gentable_entry_stats_reply {")
4540 with q.group():
4541 with q.indent(2):
4542 q.breakable()
4543 q.text("xid = ");
4544 if self.xid != None:
4545 q.text("%#x" % self.xid)
4546 else:
4547 q.text('None')
4548 q.text(","); q.breakable()
4549 q.text("flags = ");
4550 q.text("%#x" % self.flags)
4551 q.text(","); q.breakable()
4552 q.text("entries = ");
4553 q.pp(self.entries)
4554 q.breakable()
4555 q.text('}')
4556
4557bsn_stats_reply.subtypes[3] = bsn_gentable_entry_stats_reply
4558
4559class bsn_gentable_entry_stats_request(bsn_stats_request):
4560 version = 4
4561 type = 18
4562 stats_type = 65535
4563 experimenter = 6035143
4564 subtype = 3
4565
4566 def __init__(self, xid=None, flags=None, table_id=None, checksum=None, checksum_mask=None):
4567 if xid != None:
4568 self.xid = xid
4569 else:
4570 self.xid = None
4571 if flags != None:
4572 self.flags = flags
4573 else:
4574 self.flags = 0
4575 if table_id != None:
4576 self.table_id = table_id
4577 else:
4578 self.table_id = 0
4579 if checksum != None:
4580 self.checksum = checksum
4581 else:
4582 self.checksum = 0
4583 if checksum_mask != None:
4584 self.checksum_mask = checksum_mask
4585 else:
4586 self.checksum_mask = 0
4587 return
4588
4589 def pack(self):
4590 packed = []
4591 packed.append(struct.pack("!B", self.version))
4592 packed.append(struct.pack("!B", self.type))
4593 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4594 packed.append(struct.pack("!L", self.xid))
4595 packed.append(struct.pack("!H", self.stats_type))
4596 packed.append(struct.pack("!H", self.flags))
4597 packed.append('\x00' * 4)
4598 packed.append(struct.pack("!L", self.experimenter))
4599 packed.append(struct.pack("!L", self.subtype))
4600 packed.append(struct.pack("!H", self.table_id))
4601 packed.append('\x00' * 2)
4602 packed.append(util.pack_checksum_128(self.checksum))
4603 packed.append(util.pack_checksum_128(self.checksum_mask))
4604 length = sum([len(x) for x in packed])
4605 packed[2] = struct.pack("!H", length)
4606 return ''.join(packed)
4607
4608 @staticmethod
4609 def unpack(reader):
4610 obj = bsn_gentable_entry_stats_request()
4611 _version = reader.read("!B")[0]
4612 assert(_version == 4)
4613 _type = reader.read("!B")[0]
4614 assert(_type == 18)
4615 _length = reader.read("!H")[0]
4616 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08004617 reader = orig_reader.slice(_length, 4)
Rich Lane5454b682014-01-14 17:07:36 -08004618 obj.xid = reader.read("!L")[0]
4619 _stats_type = reader.read("!H")[0]
4620 assert(_stats_type == 65535)
4621 obj.flags = reader.read("!H")[0]
4622 reader.skip(4)
4623 _experimenter = reader.read("!L")[0]
4624 assert(_experimenter == 6035143)
4625 _subtype = reader.read("!L")[0]
4626 assert(_subtype == 3)
4627 obj.table_id = reader.read("!H")[0]
4628 reader.skip(2)
4629 obj.checksum = util.unpack_checksum_128(reader)
4630 obj.checksum_mask = util.unpack_checksum_128(reader)
4631 return obj
4632
4633 def __eq__(self, other):
4634 if type(self) != type(other): return False
4635 if self.xid != other.xid: return False
4636 if self.flags != other.flags: return False
4637 if self.table_id != other.table_id: return False
4638 if self.checksum != other.checksum: return False
4639 if self.checksum_mask != other.checksum_mask: return False
4640 return True
4641
4642 def pretty_print(self, q):
4643 q.text("bsn_gentable_entry_stats_request {")
4644 with q.group():
4645 with q.indent(2):
4646 q.breakable()
4647 q.text("xid = ");
4648 if self.xid != None:
4649 q.text("%#x" % self.xid)
4650 else:
4651 q.text('None')
4652 q.text(","); q.breakable()
4653 q.text("flags = ");
4654 q.text("%#x" % self.flags)
4655 q.text(","); q.breakable()
4656 q.text("table_id = ");
4657 q.text("%#x" % self.table_id)
4658 q.text(","); q.breakable()
4659 q.text("checksum = ");
4660 q.pp(self.checksum)
4661 q.text(","); q.breakable()
4662 q.text("checksum_mask = ");
4663 q.pp(self.checksum_mask)
4664 q.breakable()
4665 q.text('}')
4666
4667bsn_stats_request.subtypes[3] = bsn_gentable_entry_stats_request
4668
4669class bsn_gentable_set_buckets_size(bsn_header):
4670 version = 4
4671 type = 4
4672 experimenter = 6035143
4673 subtype = 50
4674
4675 def __init__(self, xid=None, table_id=None, buckets_size=None):
4676 if xid != None:
4677 self.xid = xid
4678 else:
4679 self.xid = None
4680 if table_id != None:
4681 self.table_id = table_id
4682 else:
4683 self.table_id = 0
4684 if buckets_size != None:
4685 self.buckets_size = buckets_size
4686 else:
4687 self.buckets_size = 0
4688 return
4689
4690 def pack(self):
4691 packed = []
4692 packed.append(struct.pack("!B", self.version))
4693 packed.append(struct.pack("!B", self.type))
4694 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4695 packed.append(struct.pack("!L", self.xid))
4696 packed.append(struct.pack("!L", self.experimenter))
4697 packed.append(struct.pack("!L", self.subtype))
4698 packed.append(struct.pack("!H", self.table_id))
4699 packed.append('\x00' * 2)
4700 packed.append(struct.pack("!L", self.buckets_size))
4701 length = sum([len(x) for x in packed])
4702 packed[2] = struct.pack("!H", length)
4703 return ''.join(packed)
4704
4705 @staticmethod
4706 def unpack(reader):
4707 obj = bsn_gentable_set_buckets_size()
4708 _version = reader.read("!B")[0]
4709 assert(_version == 4)
4710 _type = reader.read("!B")[0]
4711 assert(_type == 4)
4712 _length = reader.read("!H")[0]
4713 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08004714 reader = orig_reader.slice(_length, 4)
Rich Lane5454b682014-01-14 17:07:36 -08004715 obj.xid = reader.read("!L")[0]
4716 _experimenter = reader.read("!L")[0]
4717 assert(_experimenter == 6035143)
4718 _subtype = reader.read("!L")[0]
4719 assert(_subtype == 50)
4720 obj.table_id = reader.read("!H")[0]
4721 reader.skip(2)
4722 obj.buckets_size = reader.read("!L")[0]
4723 return obj
4724
4725 def __eq__(self, other):
4726 if type(self) != type(other): return False
4727 if self.xid != other.xid: return False
4728 if self.table_id != other.table_id: return False
4729 if self.buckets_size != other.buckets_size: return False
4730 return True
4731
4732 def pretty_print(self, q):
4733 q.text("bsn_gentable_set_buckets_size {")
4734 with q.group():
4735 with q.indent(2):
4736 q.breakable()
4737 q.text("xid = ");
4738 if self.xid != None:
4739 q.text("%#x" % self.xid)
4740 else:
4741 q.text('None')
4742 q.text(","); q.breakable()
4743 q.text("table_id = ");
4744 q.text("%#x" % self.table_id)
4745 q.text(","); q.breakable()
4746 q.text("buckets_size = ");
4747 q.text("%#x" % self.buckets_size)
4748 q.breakable()
4749 q.text('}')
4750
4751bsn_header.subtypes[50] = bsn_gentable_set_buckets_size
4752
4753class bsn_gentable_stats_reply(bsn_stats_reply):
4754 version = 4
4755 type = 19
4756 stats_type = 65535
4757 experimenter = 6035143
4758 subtype = 7
4759
4760 def __init__(self, xid=None, flags=None, entries=None):
4761 if xid != None:
4762 self.xid = xid
4763 else:
4764 self.xid = None
4765 if flags != None:
4766 self.flags = flags
4767 else:
4768 self.flags = 0
4769 if entries != None:
4770 self.entries = entries
4771 else:
4772 self.entries = []
4773 return
4774
4775 def pack(self):
4776 packed = []
4777 packed.append(struct.pack("!B", self.version))
4778 packed.append(struct.pack("!B", self.type))
4779 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4780 packed.append(struct.pack("!L", self.xid))
4781 packed.append(struct.pack("!H", self.stats_type))
4782 packed.append(struct.pack("!H", self.flags))
4783 packed.append('\x00' * 4)
4784 packed.append(struct.pack("!L", self.experimenter))
4785 packed.append(struct.pack("!L", self.subtype))
4786 packed.append(loxi.generic_util.pack_list(self.entries))
4787 length = sum([len(x) for x in packed])
4788 packed[2] = struct.pack("!H", length)
4789 return ''.join(packed)
4790
4791 @staticmethod
4792 def unpack(reader):
4793 obj = bsn_gentable_stats_reply()
4794 _version = reader.read("!B")[0]
4795 assert(_version == 4)
4796 _type = reader.read("!B")[0]
4797 assert(_type == 19)
4798 _length = reader.read("!H")[0]
4799 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08004800 reader = orig_reader.slice(_length, 4)
Rich Lane5454b682014-01-14 17:07:36 -08004801 obj.xid = reader.read("!L")[0]
4802 _stats_type = reader.read("!H")[0]
4803 assert(_stats_type == 65535)
4804 obj.flags = reader.read("!H")[0]
4805 reader.skip(4)
4806 _experimenter = reader.read("!L")[0]
4807 assert(_experimenter == 6035143)
4808 _subtype = reader.read("!L")[0]
4809 assert(_subtype == 7)
Rich Lanee2567702015-01-26 15:04:35 -08004810 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_gentable_stats_entry.unpack)
Rich Lane5454b682014-01-14 17:07:36 -08004811 return obj
4812
4813 def __eq__(self, other):
4814 if type(self) != type(other): return False
4815 if self.xid != other.xid: return False
4816 if self.flags != other.flags: return False
4817 if self.entries != other.entries: return False
4818 return True
4819
4820 def pretty_print(self, q):
4821 q.text("bsn_gentable_stats_reply {")
4822 with q.group():
4823 with q.indent(2):
4824 q.breakable()
4825 q.text("xid = ");
4826 if self.xid != None:
4827 q.text("%#x" % self.xid)
4828 else:
4829 q.text('None')
4830 q.text(","); q.breakable()
4831 q.text("flags = ");
4832 q.text("%#x" % self.flags)
4833 q.text(","); q.breakable()
4834 q.text("entries = ");
4835 q.pp(self.entries)
4836 q.breakable()
4837 q.text('}')
4838
4839bsn_stats_reply.subtypes[7] = bsn_gentable_stats_reply
4840
4841class bsn_gentable_stats_request(bsn_stats_request):
4842 version = 4
4843 type = 18
4844 stats_type = 65535
4845 experimenter = 6035143
4846 subtype = 7
4847
4848 def __init__(self, xid=None, flags=None):
4849 if xid != None:
4850 self.xid = xid
4851 else:
4852 self.xid = None
4853 if flags != None:
4854 self.flags = flags
4855 else:
4856 self.flags = 0
4857 return
4858
4859 def pack(self):
4860 packed = []
4861 packed.append(struct.pack("!B", self.version))
4862 packed.append(struct.pack("!B", self.type))
4863 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4864 packed.append(struct.pack("!L", self.xid))
4865 packed.append(struct.pack("!H", self.stats_type))
4866 packed.append(struct.pack("!H", self.flags))
4867 packed.append('\x00' * 4)
4868 packed.append(struct.pack("!L", self.experimenter))
4869 packed.append(struct.pack("!L", self.subtype))
4870 length = sum([len(x) for x in packed])
4871 packed[2] = struct.pack("!H", length)
4872 return ''.join(packed)
4873
4874 @staticmethod
4875 def unpack(reader):
4876 obj = bsn_gentable_stats_request()
4877 _version = reader.read("!B")[0]
4878 assert(_version == 4)
4879 _type = reader.read("!B")[0]
4880 assert(_type == 18)
4881 _length = reader.read("!H")[0]
4882 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08004883 reader = orig_reader.slice(_length, 4)
Rich Lane5454b682014-01-14 17:07:36 -08004884 obj.xid = reader.read("!L")[0]
4885 _stats_type = reader.read("!H")[0]
4886 assert(_stats_type == 65535)
4887 obj.flags = reader.read("!H")[0]
4888 reader.skip(4)
4889 _experimenter = reader.read("!L")[0]
4890 assert(_experimenter == 6035143)
4891 _subtype = reader.read("!L")[0]
4892 assert(_subtype == 7)
4893 return obj
4894
4895 def __eq__(self, other):
4896 if type(self) != type(other): return False
4897 if self.xid != other.xid: return False
4898 if self.flags != other.flags: return False
4899 return True
4900
4901 def pretty_print(self, q):
4902 q.text("bsn_gentable_stats_request {")
4903 with q.group():
4904 with q.indent(2):
4905 q.breakable()
4906 q.text("xid = ");
4907 if self.xid != None:
4908 q.text("%#x" % self.xid)
4909 else:
4910 q.text('None')
4911 q.text(","); q.breakable()
4912 q.text("flags = ");
4913 q.text("%#x" % self.flags)
4914 q.breakable()
4915 q.text('}')
4916
4917bsn_stats_request.subtypes[7] = bsn_gentable_stats_request
4918
Rich Lane7dcdf022013-12-11 14:45:27 -08004919class bsn_get_interfaces_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07004920 version = 4
4921 type = 4
4922 experimenter = 6035143
Rich Lanec2ee4b82013-04-24 17:12:38 -07004923 subtype = 10
4924
4925 def __init__(self, xid=None, interfaces=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08004926 if xid != None:
4927 self.xid = xid
4928 else:
4929 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07004930 if interfaces != None:
4931 self.interfaces = interfaces
4932 else:
4933 self.interfaces = []
Rich Lane7dcdf022013-12-11 14:45:27 -08004934 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07004935
4936 def pack(self):
4937 packed = []
4938 packed.append(struct.pack("!B", self.version))
4939 packed.append(struct.pack("!B", self.type))
4940 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4941 packed.append(struct.pack("!L", self.xid))
4942 packed.append(struct.pack("!L", self.experimenter))
4943 packed.append(struct.pack("!L", self.subtype))
Rich Lane7dcdf022013-12-11 14:45:27 -08004944 packed.append(loxi.generic_util.pack_list(self.interfaces))
Rich Lanec2ee4b82013-04-24 17:12:38 -07004945 length = sum([len(x) for x in packed])
4946 packed[2] = struct.pack("!H", length)
4947 return ''.join(packed)
4948
4949 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004950 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07004951 obj = bsn_get_interfaces_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07004952 _version = reader.read("!B")[0]
4953 assert(_version == 4)
4954 _type = reader.read("!B")[0]
4955 assert(_type == 4)
4956 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004957 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08004958 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07004959 obj.xid = reader.read("!L")[0]
4960 _experimenter = reader.read("!L")[0]
4961 assert(_experimenter == 6035143)
4962 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07004963 assert(_subtype == 10)
Rich Lanee2567702015-01-26 15:04:35 -08004964 obj.interfaces = loxi.generic_util.unpack_list(reader, ofp.common.bsn_interface.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -07004965 return obj
4966
4967 def __eq__(self, other):
4968 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07004969 if self.xid != other.xid: return False
4970 if self.interfaces != other.interfaces: return False
4971 return True
4972
Rich Lanec2ee4b82013-04-24 17:12:38 -07004973 def pretty_print(self, q):
4974 q.text("bsn_get_interfaces_reply {")
4975 with q.group():
4976 with q.indent(2):
4977 q.breakable()
4978 q.text("xid = ");
4979 if self.xid != None:
4980 q.text("%#x" % self.xid)
4981 else:
4982 q.text('None')
4983 q.text(","); q.breakable()
4984 q.text("interfaces = ");
4985 q.pp(self.interfaces)
4986 q.breakable()
4987 q.text('}')
4988
Rich Lane7dcdf022013-12-11 14:45:27 -08004989bsn_header.subtypes[10] = bsn_get_interfaces_reply
4990
4991class bsn_get_interfaces_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07004992 version = 4
4993 type = 4
4994 experimenter = 6035143
Rich Lanec2ee4b82013-04-24 17:12:38 -07004995 subtype = 9
4996
4997 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08004998 if xid != None:
4999 self.xid = xid
5000 else:
5001 self.xid = None
5002 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07005003
5004 def pack(self):
5005 packed = []
5006 packed.append(struct.pack("!B", self.version))
5007 packed.append(struct.pack("!B", self.type))
5008 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5009 packed.append(struct.pack("!L", self.xid))
5010 packed.append(struct.pack("!L", self.experimenter))
5011 packed.append(struct.pack("!L", self.subtype))
5012 length = sum([len(x) for x in packed])
5013 packed[2] = struct.pack("!H", length)
5014 return ''.join(packed)
5015
5016 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005017 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07005018 obj = bsn_get_interfaces_request()
Dan Talaycof6202252013-07-02 01:00:29 -07005019 _version = reader.read("!B")[0]
5020 assert(_version == 4)
5021 _type = reader.read("!B")[0]
5022 assert(_type == 4)
5023 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005024 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08005025 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07005026 obj.xid = reader.read("!L")[0]
5027 _experimenter = reader.read("!L")[0]
5028 assert(_experimenter == 6035143)
5029 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07005030 assert(_subtype == 9)
5031 return obj
5032
5033 def __eq__(self, other):
5034 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07005035 if self.xid != other.xid: return False
5036 return True
5037
Rich Lanec2ee4b82013-04-24 17:12:38 -07005038 def pretty_print(self, q):
5039 q.text("bsn_get_interfaces_request {")
5040 with q.group():
5041 with q.indent(2):
5042 q.breakable()
5043 q.text("xid = ");
5044 if self.xid != None:
5045 q.text("%#x" % self.xid)
5046 else:
5047 q.text('None')
5048 q.breakable()
5049 q.text('}')
5050
Rich Lane7dcdf022013-12-11 14:45:27 -08005051bsn_header.subtypes[9] = bsn_get_interfaces_request
5052
5053class bsn_get_mirroring_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07005054 version = 4
5055 type = 4
5056 experimenter = 6035143
Rich Lanec2ee4b82013-04-24 17:12:38 -07005057 subtype = 5
5058
5059 def __init__(self, xid=None, report_mirror_ports=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005060 if xid != None:
5061 self.xid = xid
5062 else:
5063 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07005064 if report_mirror_ports != None:
5065 self.report_mirror_ports = report_mirror_ports
5066 else:
5067 self.report_mirror_ports = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08005068 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07005069
5070 def pack(self):
5071 packed = []
5072 packed.append(struct.pack("!B", self.version))
5073 packed.append(struct.pack("!B", self.type))
5074 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5075 packed.append(struct.pack("!L", self.xid))
5076 packed.append(struct.pack("!L", self.experimenter))
5077 packed.append(struct.pack("!L", self.subtype))
5078 packed.append(struct.pack("!B", self.report_mirror_ports))
5079 packed.append('\x00' * 3)
5080 length = sum([len(x) for x in packed])
5081 packed[2] = struct.pack("!H", length)
5082 return ''.join(packed)
5083
5084 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005085 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07005086 obj = bsn_get_mirroring_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07005087 _version = reader.read("!B")[0]
5088 assert(_version == 4)
5089 _type = reader.read("!B")[0]
5090 assert(_type == 4)
5091 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005092 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08005093 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07005094 obj.xid = reader.read("!L")[0]
5095 _experimenter = reader.read("!L")[0]
5096 assert(_experimenter == 6035143)
5097 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07005098 assert(_subtype == 5)
Dan Talaycof6202252013-07-02 01:00:29 -07005099 obj.report_mirror_ports = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07005100 reader.skip(3)
5101 return obj
5102
5103 def __eq__(self, other):
5104 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07005105 if self.xid != other.xid: return False
5106 if self.report_mirror_ports != other.report_mirror_ports: return False
5107 return True
5108
Rich Lanec2ee4b82013-04-24 17:12:38 -07005109 def pretty_print(self, q):
5110 q.text("bsn_get_mirroring_reply {")
5111 with q.group():
5112 with q.indent(2):
5113 q.breakable()
5114 q.text("xid = ");
5115 if self.xid != None:
5116 q.text("%#x" % self.xid)
5117 else:
5118 q.text('None')
5119 q.text(","); q.breakable()
5120 q.text("report_mirror_ports = ");
5121 q.text("%#x" % self.report_mirror_ports)
5122 q.breakable()
5123 q.text('}')
5124
Rich Lane7dcdf022013-12-11 14:45:27 -08005125bsn_header.subtypes[5] = bsn_get_mirroring_reply
5126
5127class bsn_get_mirroring_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07005128 version = 4
5129 type = 4
5130 experimenter = 6035143
Rich Lanec2ee4b82013-04-24 17:12:38 -07005131 subtype = 4
5132
5133 def __init__(self, xid=None, report_mirror_ports=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005134 if xid != None:
5135 self.xid = xid
5136 else:
5137 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07005138 if report_mirror_ports != None:
5139 self.report_mirror_ports = report_mirror_ports
5140 else:
5141 self.report_mirror_ports = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08005142 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07005143
5144 def pack(self):
5145 packed = []
5146 packed.append(struct.pack("!B", self.version))
5147 packed.append(struct.pack("!B", self.type))
5148 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5149 packed.append(struct.pack("!L", self.xid))
5150 packed.append(struct.pack("!L", self.experimenter))
5151 packed.append(struct.pack("!L", self.subtype))
5152 packed.append(struct.pack("!B", self.report_mirror_ports))
5153 packed.append('\x00' * 3)
5154 length = sum([len(x) for x in packed])
5155 packed[2] = struct.pack("!H", length)
5156 return ''.join(packed)
5157
5158 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005159 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07005160 obj = bsn_get_mirroring_request()
Dan Talaycof6202252013-07-02 01:00:29 -07005161 _version = reader.read("!B")[0]
5162 assert(_version == 4)
5163 _type = reader.read("!B")[0]
5164 assert(_type == 4)
5165 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005166 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08005167 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07005168 obj.xid = reader.read("!L")[0]
5169 _experimenter = reader.read("!L")[0]
5170 assert(_experimenter == 6035143)
5171 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07005172 assert(_subtype == 4)
Dan Talaycof6202252013-07-02 01:00:29 -07005173 obj.report_mirror_ports = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07005174 reader.skip(3)
5175 return obj
5176
5177 def __eq__(self, other):
5178 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07005179 if self.xid != other.xid: return False
5180 if self.report_mirror_ports != other.report_mirror_ports: return False
5181 return True
5182
Rich Lanec2ee4b82013-04-24 17:12:38 -07005183 def pretty_print(self, q):
5184 q.text("bsn_get_mirroring_request {")
5185 with q.group():
5186 with q.indent(2):
5187 q.breakable()
5188 q.text("xid = ");
5189 if self.xid != None:
5190 q.text("%#x" % self.xid)
5191 else:
5192 q.text('None')
5193 q.text(","); q.breakable()
5194 q.text("report_mirror_ports = ");
5195 q.text("%#x" % self.report_mirror_ports)
5196 q.breakable()
5197 q.text('}')
5198
Rich Lane7dcdf022013-12-11 14:45:27 -08005199bsn_header.subtypes[4] = bsn_get_mirroring_request
5200
5201class bsn_get_switch_pipeline_reply(bsn_header):
5202 version = 4
5203 type = 4
5204 experimenter = 6035143
5205 subtype = 52
5206
5207 def __init__(self, xid=None, pipeline=None):
5208 if xid != None:
5209 self.xid = xid
5210 else:
5211 self.xid = None
5212 if pipeline != None:
5213 self.pipeline = pipeline
5214 else:
5215 self.pipeline = ""
5216 return
5217
5218 def pack(self):
5219 packed = []
5220 packed.append(struct.pack("!B", self.version))
5221 packed.append(struct.pack("!B", self.type))
5222 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5223 packed.append(struct.pack("!L", self.xid))
5224 packed.append(struct.pack("!L", self.experimenter))
5225 packed.append(struct.pack("!L", self.subtype))
5226 packed.append(struct.pack("!256s", self.pipeline))
5227 length = sum([len(x) for x in packed])
5228 packed[2] = struct.pack("!H", length)
5229 return ''.join(packed)
5230
5231 @staticmethod
5232 def unpack(reader):
5233 obj = bsn_get_switch_pipeline_reply()
5234 _version = reader.read("!B")[0]
5235 assert(_version == 4)
5236 _type = reader.read("!B")[0]
5237 assert(_type == 4)
5238 _length = reader.read("!H")[0]
5239 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08005240 reader = orig_reader.slice(_length, 4)
Rich Lane7dcdf022013-12-11 14:45:27 -08005241 obj.xid = reader.read("!L")[0]
5242 _experimenter = reader.read("!L")[0]
5243 assert(_experimenter == 6035143)
5244 _subtype = reader.read("!L")[0]
5245 assert(_subtype == 52)
5246 obj.pipeline = reader.read("!256s")[0].rstrip("\x00")
5247 return obj
5248
5249 def __eq__(self, other):
5250 if type(self) != type(other): return False
5251 if self.xid != other.xid: return False
5252 if self.pipeline != other.pipeline: return False
5253 return True
5254
5255 def pretty_print(self, q):
5256 q.text("bsn_get_switch_pipeline_reply {")
5257 with q.group():
5258 with q.indent(2):
5259 q.breakable()
5260 q.text("xid = ");
5261 if self.xid != None:
5262 q.text("%#x" % self.xid)
5263 else:
5264 q.text('None')
5265 q.text(","); q.breakable()
5266 q.text("pipeline = ");
5267 q.pp(self.pipeline)
5268 q.breakable()
5269 q.text('}')
5270
5271bsn_header.subtypes[52] = bsn_get_switch_pipeline_reply
5272
5273class bsn_get_switch_pipeline_request(bsn_header):
5274 version = 4
5275 type = 4
5276 experimenter = 6035143
5277 subtype = 51
5278
5279 def __init__(self, xid=None):
5280 if xid != None:
5281 self.xid = xid
5282 else:
5283 self.xid = None
5284 return
5285
5286 def pack(self):
5287 packed = []
5288 packed.append(struct.pack("!B", self.version))
5289 packed.append(struct.pack("!B", self.type))
5290 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5291 packed.append(struct.pack("!L", self.xid))
5292 packed.append(struct.pack("!L", self.experimenter))
5293 packed.append(struct.pack("!L", self.subtype))
5294 length = sum([len(x) for x in packed])
5295 packed[2] = struct.pack("!H", length)
5296 return ''.join(packed)
5297
5298 @staticmethod
5299 def unpack(reader):
5300 obj = bsn_get_switch_pipeline_request()
5301 _version = reader.read("!B")[0]
5302 assert(_version == 4)
5303 _type = reader.read("!B")[0]
5304 assert(_type == 4)
5305 _length = reader.read("!H")[0]
5306 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08005307 reader = orig_reader.slice(_length, 4)
Rich Lane7dcdf022013-12-11 14:45:27 -08005308 obj.xid = reader.read("!L")[0]
5309 _experimenter = reader.read("!L")[0]
5310 assert(_experimenter == 6035143)
5311 _subtype = reader.read("!L")[0]
5312 assert(_subtype == 51)
5313 return obj
5314
5315 def __eq__(self, other):
5316 if type(self) != type(other): return False
5317 if self.xid != other.xid: return False
5318 return True
5319
5320 def pretty_print(self, q):
5321 q.text("bsn_get_switch_pipeline_request {")
5322 with q.group():
5323 with q.indent(2):
5324 q.breakable()
5325 q.text("xid = ");
5326 if self.xid != None:
5327 q.text("%#x" % self.xid)
5328 else:
5329 q.text('None')
5330 q.breakable()
5331 q.text('}')
5332
5333bsn_header.subtypes[51] = bsn_get_switch_pipeline_request
5334
Rich Lane93b33132014-04-21 12:20:58 -07005335class bsn_image_desc_stats_reply(bsn_stats_reply):
5336 version = 4
5337 type = 19
5338 stats_type = 65535
5339 experimenter = 6035143
5340 subtype = 14
5341
5342 def __init__(self, xid=None, flags=None, image_checksum=None, startup_config_checksum=None):
5343 if xid != None:
5344 self.xid = xid
5345 else:
5346 self.xid = None
5347 if flags != None:
5348 self.flags = flags
5349 else:
5350 self.flags = 0
5351 if image_checksum != None:
5352 self.image_checksum = image_checksum
5353 else:
5354 self.image_checksum = ""
5355 if startup_config_checksum != None:
5356 self.startup_config_checksum = startup_config_checksum
5357 else:
5358 self.startup_config_checksum = ""
5359 return
5360
5361 def pack(self):
5362 packed = []
5363 packed.append(struct.pack("!B", self.version))
5364 packed.append(struct.pack("!B", self.type))
5365 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5366 packed.append(struct.pack("!L", self.xid))
5367 packed.append(struct.pack("!H", self.stats_type))
5368 packed.append(struct.pack("!H", self.flags))
5369 packed.append('\x00' * 4)
5370 packed.append(struct.pack("!L", self.experimenter))
5371 packed.append(struct.pack("!L", self.subtype))
5372 packed.append(struct.pack("!256s", self.image_checksum))
5373 packed.append(struct.pack("!256s", self.startup_config_checksum))
5374 length = sum([len(x) for x in packed])
5375 packed[2] = struct.pack("!H", length)
5376 return ''.join(packed)
5377
5378 @staticmethod
5379 def unpack(reader):
5380 obj = bsn_image_desc_stats_reply()
5381 _version = reader.read("!B")[0]
5382 assert(_version == 4)
5383 _type = reader.read("!B")[0]
5384 assert(_type == 19)
5385 _length = reader.read("!H")[0]
5386 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08005387 reader = orig_reader.slice(_length, 4)
Rich Lane93b33132014-04-21 12:20:58 -07005388 obj.xid = reader.read("!L")[0]
5389 _stats_type = reader.read("!H")[0]
5390 assert(_stats_type == 65535)
5391 obj.flags = reader.read("!H")[0]
5392 reader.skip(4)
5393 _experimenter = reader.read("!L")[0]
5394 assert(_experimenter == 6035143)
5395 _subtype = reader.read("!L")[0]
5396 assert(_subtype == 14)
5397 obj.image_checksum = reader.read("!256s")[0].rstrip("\x00")
5398 obj.startup_config_checksum = reader.read("!256s")[0].rstrip("\x00")
5399 return obj
5400
5401 def __eq__(self, other):
5402 if type(self) != type(other): return False
5403 if self.xid != other.xid: return False
5404 if self.flags != other.flags: return False
5405 if self.image_checksum != other.image_checksum: return False
5406 if self.startup_config_checksum != other.startup_config_checksum: return False
5407 return True
5408
5409 def pretty_print(self, q):
5410 q.text("bsn_image_desc_stats_reply {")
5411 with q.group():
5412 with q.indent(2):
5413 q.breakable()
5414 q.text("xid = ");
5415 if self.xid != None:
5416 q.text("%#x" % self.xid)
5417 else:
5418 q.text('None')
5419 q.text(","); q.breakable()
5420 q.text("flags = ");
5421 q.text("%#x" % self.flags)
5422 q.text(","); q.breakable()
5423 q.text("image_checksum = ");
5424 q.pp(self.image_checksum)
5425 q.text(","); q.breakable()
5426 q.text("startup_config_checksum = ");
5427 q.pp(self.startup_config_checksum)
5428 q.breakable()
5429 q.text('}')
5430
5431bsn_stats_reply.subtypes[14] = bsn_image_desc_stats_reply
5432
5433class bsn_image_desc_stats_request(bsn_stats_request):
5434 version = 4
5435 type = 18
5436 stats_type = 65535
5437 experimenter = 6035143
5438 subtype = 14
5439
5440 def __init__(self, xid=None, flags=None):
5441 if xid != None:
5442 self.xid = xid
5443 else:
5444 self.xid = None
5445 if flags != None:
5446 self.flags = flags
5447 else:
5448 self.flags = 0
5449 return
5450
5451 def pack(self):
5452 packed = []
5453 packed.append(struct.pack("!B", self.version))
5454 packed.append(struct.pack("!B", self.type))
5455 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5456 packed.append(struct.pack("!L", self.xid))
5457 packed.append(struct.pack("!H", self.stats_type))
5458 packed.append(struct.pack("!H", self.flags))
5459 packed.append('\x00' * 4)
5460 packed.append(struct.pack("!L", self.experimenter))
5461 packed.append(struct.pack("!L", self.subtype))
5462 length = sum([len(x) for x in packed])
5463 packed[2] = struct.pack("!H", length)
5464 return ''.join(packed)
5465
5466 @staticmethod
5467 def unpack(reader):
5468 obj = bsn_image_desc_stats_request()
5469 _version = reader.read("!B")[0]
5470 assert(_version == 4)
5471 _type = reader.read("!B")[0]
5472 assert(_type == 18)
5473 _length = reader.read("!H")[0]
5474 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08005475 reader = orig_reader.slice(_length, 4)
Rich Lane93b33132014-04-21 12:20:58 -07005476 obj.xid = reader.read("!L")[0]
5477 _stats_type = reader.read("!H")[0]
5478 assert(_stats_type == 65535)
5479 obj.flags = reader.read("!H")[0]
5480 reader.skip(4)
5481 _experimenter = reader.read("!L")[0]
5482 assert(_experimenter == 6035143)
5483 _subtype = reader.read("!L")[0]
5484 assert(_subtype == 14)
5485 return obj
5486
5487 def __eq__(self, other):
5488 if type(self) != type(other): return False
5489 if self.xid != other.xid: return False
5490 if self.flags != other.flags: return False
5491 return True
5492
5493 def pretty_print(self, q):
5494 q.text("bsn_image_desc_stats_request {")
5495 with q.group():
5496 with q.indent(2):
5497 q.breakable()
5498 q.text("xid = ");
5499 if self.xid != None:
5500 q.text("%#x" % self.xid)
5501 else:
5502 q.text('None')
5503 q.text(","); q.breakable()
5504 q.text("flags = ");
5505 q.text("%#x" % self.flags)
5506 q.breakable()
5507 q.text('}')
5508
5509bsn_stats_request.subtypes[14] = bsn_image_desc_stats_request
5510
Rich Lane7dcdf022013-12-11 14:45:27 -08005511class bsn_lacp_convergence_notif(bsn_header):
Rich Lane7b0f2012013-11-22 14:15:26 -08005512 version = 4
5513 type = 4
5514 experimenter = 6035143
5515 subtype = 43
5516
5517 def __init__(self, xid=None, convergence_status=None, port_no=None, actor_sys_priority=None, actor_sys_mac=None, actor_port_priority=None, actor_port_num=None, actor_key=None, partner_sys_priority=None, partner_sys_mac=None, partner_port_priority=None, partner_port_num=None, partner_key=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005518 if xid != None:
5519 self.xid = xid
5520 else:
5521 self.xid = None
Rich Lane7b0f2012013-11-22 14:15:26 -08005522 if convergence_status != None:
5523 self.convergence_status = convergence_status
5524 else:
5525 self.convergence_status = 0
5526 if port_no != None:
5527 self.port_no = port_no
5528 else:
5529 self.port_no = 0
5530 if actor_sys_priority != None:
5531 self.actor_sys_priority = actor_sys_priority
5532 else:
5533 self.actor_sys_priority = 0
5534 if actor_sys_mac != None:
5535 self.actor_sys_mac = actor_sys_mac
5536 else:
5537 self.actor_sys_mac = [0,0,0,0,0,0]
5538 if actor_port_priority != None:
5539 self.actor_port_priority = actor_port_priority
5540 else:
5541 self.actor_port_priority = 0
5542 if actor_port_num != None:
5543 self.actor_port_num = actor_port_num
5544 else:
5545 self.actor_port_num = 0
5546 if actor_key != None:
5547 self.actor_key = actor_key
5548 else:
5549 self.actor_key = 0
5550 if partner_sys_priority != None:
5551 self.partner_sys_priority = partner_sys_priority
5552 else:
5553 self.partner_sys_priority = 0
5554 if partner_sys_mac != None:
5555 self.partner_sys_mac = partner_sys_mac
5556 else:
5557 self.partner_sys_mac = [0,0,0,0,0,0]
5558 if partner_port_priority != None:
5559 self.partner_port_priority = partner_port_priority
5560 else:
5561 self.partner_port_priority = 0
5562 if partner_port_num != None:
5563 self.partner_port_num = partner_port_num
5564 else:
5565 self.partner_port_num = 0
5566 if partner_key != None:
5567 self.partner_key = partner_key
5568 else:
5569 self.partner_key = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08005570 return
Rich Lane7b0f2012013-11-22 14:15:26 -08005571
5572 def pack(self):
5573 packed = []
5574 packed.append(struct.pack("!B", self.version))
5575 packed.append(struct.pack("!B", self.type))
5576 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5577 packed.append(struct.pack("!L", self.xid))
5578 packed.append(struct.pack("!L", self.experimenter))
5579 packed.append(struct.pack("!L", self.subtype))
5580 packed.append(struct.pack("!B", self.convergence_status))
5581 packed.append('\x00' * 3)
5582 packed.append(util.pack_port_no(self.port_no))
5583 packed.append(struct.pack("!H", self.actor_sys_priority))
5584 packed.append(struct.pack("!6B", *self.actor_sys_mac))
5585 packed.append(struct.pack("!H", self.actor_port_priority))
5586 packed.append(struct.pack("!H", self.actor_port_num))
5587 packed.append(struct.pack("!H", self.actor_key))
5588 packed.append(struct.pack("!H", self.partner_sys_priority))
5589 packed.append(struct.pack("!6B", *self.partner_sys_mac))
5590 packed.append(struct.pack("!H", self.partner_port_priority))
5591 packed.append(struct.pack("!H", self.partner_port_num))
5592 packed.append(struct.pack("!H", self.partner_key))
5593 length = sum([len(x) for x in packed])
5594 packed[2] = struct.pack("!H", length)
5595 return ''.join(packed)
5596
5597 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005598 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -08005599 obj = bsn_lacp_convergence_notif()
Rich Lane7b0f2012013-11-22 14:15:26 -08005600 _version = reader.read("!B")[0]
5601 assert(_version == 4)
5602 _type = reader.read("!B")[0]
5603 assert(_type == 4)
5604 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005605 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08005606 reader = orig_reader.slice(_length, 4)
Rich Lane7b0f2012013-11-22 14:15:26 -08005607 obj.xid = reader.read("!L")[0]
5608 _experimenter = reader.read("!L")[0]
5609 assert(_experimenter == 6035143)
5610 _subtype = reader.read("!L")[0]
5611 assert(_subtype == 43)
5612 obj.convergence_status = reader.read("!B")[0]
5613 reader.skip(3)
5614 obj.port_no = util.unpack_port_no(reader)
5615 obj.actor_sys_priority = reader.read("!H")[0]
5616 obj.actor_sys_mac = list(reader.read('!6B'))
5617 obj.actor_port_priority = reader.read("!H")[0]
5618 obj.actor_port_num = reader.read("!H")[0]
5619 obj.actor_key = reader.read("!H")[0]
5620 obj.partner_sys_priority = reader.read("!H")[0]
5621 obj.partner_sys_mac = list(reader.read('!6B'))
5622 obj.partner_port_priority = reader.read("!H")[0]
5623 obj.partner_port_num = reader.read("!H")[0]
5624 obj.partner_key = reader.read("!H")[0]
5625 return obj
5626
5627 def __eq__(self, other):
5628 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -08005629 if self.xid != other.xid: return False
5630 if self.convergence_status != other.convergence_status: return False
5631 if self.port_no != other.port_no: return False
5632 if self.actor_sys_priority != other.actor_sys_priority: return False
5633 if self.actor_sys_mac != other.actor_sys_mac: return False
5634 if self.actor_port_priority != other.actor_port_priority: return False
5635 if self.actor_port_num != other.actor_port_num: return False
5636 if self.actor_key != other.actor_key: return False
5637 if self.partner_sys_priority != other.partner_sys_priority: return False
5638 if self.partner_sys_mac != other.partner_sys_mac: return False
5639 if self.partner_port_priority != other.partner_port_priority: return False
5640 if self.partner_port_num != other.partner_port_num: return False
5641 if self.partner_key != other.partner_key: return False
5642 return True
5643
Rich Lane7b0f2012013-11-22 14:15:26 -08005644 def pretty_print(self, q):
5645 q.text("bsn_lacp_convergence_notif {")
5646 with q.group():
5647 with q.indent(2):
5648 q.breakable()
5649 q.text("xid = ");
5650 if self.xid != None:
5651 q.text("%#x" % self.xid)
5652 else:
5653 q.text('None')
5654 q.text(","); q.breakable()
5655 q.text("convergence_status = ");
5656 q.text("%#x" % self.convergence_status)
5657 q.text(","); q.breakable()
5658 q.text("port_no = ");
5659 q.text(util.pretty_port(self.port_no))
5660 q.text(","); q.breakable()
5661 q.text("actor_sys_priority = ");
5662 q.text("%#x" % self.actor_sys_priority)
5663 q.text(","); q.breakable()
5664 q.text("actor_sys_mac = ");
5665 q.text(util.pretty_mac(self.actor_sys_mac))
5666 q.text(","); q.breakable()
5667 q.text("actor_port_priority = ");
5668 q.text("%#x" % self.actor_port_priority)
5669 q.text(","); q.breakable()
5670 q.text("actor_port_num = ");
5671 q.text("%#x" % self.actor_port_num)
5672 q.text(","); q.breakable()
5673 q.text("actor_key = ");
5674 q.text("%#x" % self.actor_key)
5675 q.text(","); q.breakable()
5676 q.text("partner_sys_priority = ");
5677 q.text("%#x" % self.partner_sys_priority)
5678 q.text(","); q.breakable()
5679 q.text("partner_sys_mac = ");
5680 q.text(util.pretty_mac(self.partner_sys_mac))
5681 q.text(","); q.breakable()
5682 q.text("partner_port_priority = ");
5683 q.text("%#x" % self.partner_port_priority)
5684 q.text(","); q.breakable()
5685 q.text("partner_port_num = ");
5686 q.text("%#x" % self.partner_port_num)
5687 q.text(","); q.breakable()
5688 q.text("partner_key = ");
5689 q.text("%#x" % self.partner_key)
5690 q.breakable()
5691 q.text('}')
5692
Rich Lane7dcdf022013-12-11 14:45:27 -08005693bsn_header.subtypes[43] = bsn_lacp_convergence_notif
5694
Rich Lane7dcdf022013-12-11 14:45:27 -08005695class bsn_lacp_stats_reply(bsn_stats_reply):
Rich Lane7b0f2012013-11-22 14:15:26 -08005696 version = 4
5697 type = 19
5698 stats_type = 65535
5699 experimenter = 6035143
5700 subtype = 1
5701
5702 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005703 if xid != None:
5704 self.xid = xid
5705 else:
5706 self.xid = None
Rich Lane7b0f2012013-11-22 14:15:26 -08005707 if flags != None:
5708 self.flags = flags
5709 else:
5710 self.flags = 0
5711 if entries != None:
5712 self.entries = entries
5713 else:
5714 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -08005715 return
Rich Lane7b0f2012013-11-22 14:15:26 -08005716
5717 def pack(self):
5718 packed = []
5719 packed.append(struct.pack("!B", self.version))
5720 packed.append(struct.pack("!B", self.type))
5721 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5722 packed.append(struct.pack("!L", self.xid))
5723 packed.append(struct.pack("!H", self.stats_type))
5724 packed.append(struct.pack("!H", self.flags))
5725 packed.append('\x00' * 4)
5726 packed.append(struct.pack("!L", self.experimenter))
5727 packed.append(struct.pack("!L", self.subtype))
Rich Lane7dcdf022013-12-11 14:45:27 -08005728 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lane7b0f2012013-11-22 14:15:26 -08005729 length = sum([len(x) for x in packed])
5730 packed[2] = struct.pack("!H", length)
5731 return ''.join(packed)
5732
5733 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005734 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -08005735 obj = bsn_lacp_stats_reply()
Rich Lane7b0f2012013-11-22 14:15:26 -08005736 _version = reader.read("!B")[0]
5737 assert(_version == 4)
5738 _type = reader.read("!B")[0]
5739 assert(_type == 19)
5740 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005741 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08005742 reader = orig_reader.slice(_length, 4)
Rich Lane7b0f2012013-11-22 14:15:26 -08005743 obj.xid = reader.read("!L")[0]
5744 _stats_type = reader.read("!H")[0]
5745 assert(_stats_type == 65535)
5746 obj.flags = reader.read("!H")[0]
5747 reader.skip(4)
5748 _experimenter = reader.read("!L")[0]
5749 assert(_experimenter == 6035143)
5750 _subtype = reader.read("!L")[0]
5751 assert(_subtype == 1)
Rich Lanee2567702015-01-26 15:04:35 -08005752 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_lacp_stats_entry.unpack)
Rich Lane7b0f2012013-11-22 14:15:26 -08005753 return obj
5754
5755 def __eq__(self, other):
5756 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -08005757 if self.xid != other.xid: return False
5758 if self.flags != other.flags: return False
5759 if self.entries != other.entries: return False
5760 return True
5761
Rich Lane7b0f2012013-11-22 14:15:26 -08005762 def pretty_print(self, q):
5763 q.text("bsn_lacp_stats_reply {")
5764 with q.group():
5765 with q.indent(2):
5766 q.breakable()
5767 q.text("xid = ");
5768 if self.xid != None:
5769 q.text("%#x" % self.xid)
5770 else:
5771 q.text('None')
5772 q.text(","); q.breakable()
5773 q.text("flags = ");
5774 q.text("%#x" % self.flags)
5775 q.text(","); q.breakable()
5776 q.text("entries = ");
5777 q.pp(self.entries)
5778 q.breakable()
5779 q.text('}')
5780
Rich Lane7dcdf022013-12-11 14:45:27 -08005781bsn_stats_reply.subtypes[1] = bsn_lacp_stats_reply
5782
Rich Lane7dcdf022013-12-11 14:45:27 -08005783class bsn_lacp_stats_request(bsn_stats_request):
Rich Lane7b0f2012013-11-22 14:15:26 -08005784 version = 4
5785 type = 18
5786 stats_type = 65535
5787 experimenter = 6035143
5788 subtype = 1
5789
5790 def __init__(self, xid=None, flags=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005791 if xid != None:
5792 self.xid = xid
5793 else:
5794 self.xid = None
Rich Lane7b0f2012013-11-22 14:15:26 -08005795 if flags != None:
5796 self.flags = flags
5797 else:
5798 self.flags = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08005799 return
Rich Lane7b0f2012013-11-22 14:15:26 -08005800
5801 def pack(self):
5802 packed = []
5803 packed.append(struct.pack("!B", self.version))
5804 packed.append(struct.pack("!B", self.type))
5805 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5806 packed.append(struct.pack("!L", self.xid))
5807 packed.append(struct.pack("!H", self.stats_type))
5808 packed.append(struct.pack("!H", self.flags))
5809 packed.append('\x00' * 4)
5810 packed.append(struct.pack("!L", self.experimenter))
5811 packed.append(struct.pack("!L", self.subtype))
5812 length = sum([len(x) for x in packed])
5813 packed[2] = struct.pack("!H", length)
5814 return ''.join(packed)
5815
5816 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005817 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -08005818 obj = bsn_lacp_stats_request()
Rich Lane7b0f2012013-11-22 14:15:26 -08005819 _version = reader.read("!B")[0]
5820 assert(_version == 4)
5821 _type = reader.read("!B")[0]
5822 assert(_type == 18)
5823 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005824 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08005825 reader = orig_reader.slice(_length, 4)
Rich Lane7b0f2012013-11-22 14:15:26 -08005826 obj.xid = reader.read("!L")[0]
5827 _stats_type = reader.read("!H")[0]
5828 assert(_stats_type == 65535)
5829 obj.flags = reader.read("!H")[0]
5830 reader.skip(4)
5831 _experimenter = reader.read("!L")[0]
5832 assert(_experimenter == 6035143)
5833 _subtype = reader.read("!L")[0]
5834 assert(_subtype == 1)
5835 return obj
5836
5837 def __eq__(self, other):
5838 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -08005839 if self.xid != other.xid: return False
5840 if self.flags != other.flags: return False
5841 return True
5842
Rich Lane7b0f2012013-11-22 14:15:26 -08005843 def pretty_print(self, q):
5844 q.text("bsn_lacp_stats_request {")
5845 with q.group():
5846 with q.indent(2):
5847 q.breakable()
5848 q.text("xid = ");
5849 if self.xid != None:
5850 q.text("%#x" % self.xid)
5851 else:
5852 q.text('None')
5853 q.text(","); q.breakable()
5854 q.text("flags = ");
5855 q.text("%#x" % self.flags)
5856 q.breakable()
5857 q.text('}')
5858
Rich Lane7dcdf022013-12-11 14:45:27 -08005859bsn_stats_request.subtypes[1] = bsn_lacp_stats_request
5860
Rich Lane5587ab12014-06-30 11:19:09 -07005861class bsn_log(bsn_header):
5862 version = 4
5863 type = 4
5864 experimenter = 6035143
5865 subtype = 63
5866
5867 def __init__(self, xid=None, loglevel=None, data=None):
5868 if xid != None:
5869 self.xid = xid
5870 else:
5871 self.xid = None
5872 if loglevel != None:
5873 self.loglevel = loglevel
5874 else:
5875 self.loglevel = 0
5876 if data != None:
5877 self.data = data
5878 else:
5879 self.data = ''
5880 return
5881
5882 def pack(self):
5883 packed = []
5884 packed.append(struct.pack("!B", self.version))
5885 packed.append(struct.pack("!B", self.type))
5886 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5887 packed.append(struct.pack("!L", self.xid))
5888 packed.append(struct.pack("!L", self.experimenter))
5889 packed.append(struct.pack("!L", self.subtype))
5890 packed.append(struct.pack("!B", self.loglevel))
5891 packed.append(self.data)
5892 length = sum([len(x) for x in packed])
5893 packed[2] = struct.pack("!H", length)
5894 return ''.join(packed)
5895
5896 @staticmethod
5897 def unpack(reader):
5898 obj = bsn_log()
5899 _version = reader.read("!B")[0]
5900 assert(_version == 4)
5901 _type = reader.read("!B")[0]
5902 assert(_type == 4)
5903 _length = reader.read("!H")[0]
5904 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08005905 reader = orig_reader.slice(_length, 4)
Rich Lane5587ab12014-06-30 11:19:09 -07005906 obj.xid = reader.read("!L")[0]
5907 _experimenter = reader.read("!L")[0]
5908 assert(_experimenter == 6035143)
5909 _subtype = reader.read("!L")[0]
5910 assert(_subtype == 63)
5911 obj.loglevel = reader.read("!B")[0]
5912 obj.data = str(reader.read_all())
5913 return obj
5914
5915 def __eq__(self, other):
5916 if type(self) != type(other): return False
5917 if self.xid != other.xid: return False
5918 if self.loglevel != other.loglevel: return False
5919 if self.data != other.data: return False
5920 return True
5921
5922 def pretty_print(self, q):
5923 q.text("bsn_log {")
5924 with q.group():
5925 with q.indent(2):
5926 q.breakable()
5927 q.text("xid = ");
5928 if self.xid != None:
5929 q.text("%#x" % self.xid)
5930 else:
5931 q.text('None')
5932 q.text(","); q.breakable()
5933 q.text("loglevel = ");
5934 q.text("%#x" % self.loglevel)
5935 q.text(","); q.breakable()
5936 q.text("data = ");
5937 q.pp(self.data)
5938 q.breakable()
5939 q.text('}')
5940
5941bsn_header.subtypes[63] = bsn_log
5942
Rich Lane474324f2015-01-14 15:22:56 -08005943class bsn_lua_command_reply(bsn_header):
5944 version = 4
5945 type = 4
5946 experimenter = 6035143
5947 subtype = 66
5948
5949 def __init__(self, xid=None, data=None):
5950 if xid != None:
5951 self.xid = xid
5952 else:
5953 self.xid = None
5954 if data != None:
5955 self.data = data
5956 else:
5957 self.data = ''
5958 return
5959
5960 def pack(self):
5961 packed = []
5962 packed.append(struct.pack("!B", self.version))
5963 packed.append(struct.pack("!B", self.type))
5964 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5965 packed.append(struct.pack("!L", self.xid))
5966 packed.append(struct.pack("!L", self.experimenter))
5967 packed.append(struct.pack("!L", self.subtype))
5968 packed.append(self.data)
5969 length = sum([len(x) for x in packed])
5970 packed[2] = struct.pack("!H", length)
5971 return ''.join(packed)
5972
5973 @staticmethod
5974 def unpack(reader):
5975 obj = bsn_lua_command_reply()
5976 _version = reader.read("!B")[0]
5977 assert(_version == 4)
5978 _type = reader.read("!B")[0]
5979 assert(_type == 4)
5980 _length = reader.read("!H")[0]
5981 orig_reader = reader
5982 reader = orig_reader.slice(_length, 4)
5983 obj.xid = reader.read("!L")[0]
5984 _experimenter = reader.read("!L")[0]
5985 assert(_experimenter == 6035143)
5986 _subtype = reader.read("!L")[0]
5987 assert(_subtype == 66)
5988 obj.data = str(reader.read_all())
5989 return obj
5990
5991 def __eq__(self, other):
5992 if type(self) != type(other): return False
5993 if self.xid != other.xid: return False
5994 if self.data != other.data: return False
5995 return True
5996
5997 def pretty_print(self, q):
5998 q.text("bsn_lua_command_reply {")
5999 with q.group():
6000 with q.indent(2):
6001 q.breakable()
6002 q.text("xid = ");
6003 if self.xid != None:
6004 q.text("%#x" % self.xid)
6005 else:
6006 q.text('None')
6007 q.text(","); q.breakable()
6008 q.text("data = ");
6009 q.pp(self.data)
6010 q.breakable()
6011 q.text('}')
6012
6013bsn_header.subtypes[66] = bsn_lua_command_reply
6014
6015class bsn_lua_command_request(bsn_header):
6016 version = 4
6017 type = 4
6018 experimenter = 6035143
6019 subtype = 65
6020
6021 def __init__(self, xid=None, data=None):
6022 if xid != None:
6023 self.xid = xid
6024 else:
6025 self.xid = None
6026 if data != None:
6027 self.data = data
6028 else:
6029 self.data = ''
6030 return
6031
6032 def pack(self):
6033 packed = []
6034 packed.append(struct.pack("!B", self.version))
6035 packed.append(struct.pack("!B", self.type))
6036 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6037 packed.append(struct.pack("!L", self.xid))
6038 packed.append(struct.pack("!L", self.experimenter))
6039 packed.append(struct.pack("!L", self.subtype))
6040 packed.append(self.data)
6041 length = sum([len(x) for x in packed])
6042 packed[2] = struct.pack("!H", length)
6043 return ''.join(packed)
6044
6045 @staticmethod
6046 def unpack(reader):
6047 obj = bsn_lua_command_request()
6048 _version = reader.read("!B")[0]
6049 assert(_version == 4)
6050 _type = reader.read("!B")[0]
6051 assert(_type == 4)
6052 _length = reader.read("!H")[0]
6053 orig_reader = reader
6054 reader = orig_reader.slice(_length, 4)
6055 obj.xid = reader.read("!L")[0]
6056 _experimenter = reader.read("!L")[0]
6057 assert(_experimenter == 6035143)
6058 _subtype = reader.read("!L")[0]
6059 assert(_subtype == 65)
6060 obj.data = str(reader.read_all())
6061 return obj
6062
6063 def __eq__(self, other):
6064 if type(self) != type(other): return False
6065 if self.xid != other.xid: return False
6066 if self.data != other.data: return False
6067 return True
6068
6069 def pretty_print(self, q):
6070 q.text("bsn_lua_command_request {")
6071 with q.group():
6072 with q.indent(2):
6073 q.breakable()
6074 q.text("xid = ");
6075 if self.xid != None:
6076 q.text("%#x" % self.xid)
6077 else:
6078 q.text('None')
6079 q.text(","); q.breakable()
6080 q.text("data = ");
6081 q.pp(self.data)
6082 q.breakable()
6083 q.text('}')
6084
6085bsn_header.subtypes[65] = bsn_lua_command_request
6086
6087class bsn_lua_notification(bsn_header):
6088 version = 4
6089 type = 4
6090 experimenter = 6035143
6091 subtype = 67
6092
6093 def __init__(self, xid=None, data=None):
6094 if xid != None:
6095 self.xid = xid
6096 else:
6097 self.xid = None
6098 if data != None:
6099 self.data = data
6100 else:
6101 self.data = ''
6102 return
6103
6104 def pack(self):
6105 packed = []
6106 packed.append(struct.pack("!B", self.version))
6107 packed.append(struct.pack("!B", self.type))
6108 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6109 packed.append(struct.pack("!L", self.xid))
6110 packed.append(struct.pack("!L", self.experimenter))
6111 packed.append(struct.pack("!L", self.subtype))
6112 packed.append(self.data)
6113 length = sum([len(x) for x in packed])
6114 packed[2] = struct.pack("!H", length)
6115 return ''.join(packed)
6116
6117 @staticmethod
6118 def unpack(reader):
6119 obj = bsn_lua_notification()
6120 _version = reader.read("!B")[0]
6121 assert(_version == 4)
6122 _type = reader.read("!B")[0]
6123 assert(_type == 4)
6124 _length = reader.read("!H")[0]
6125 orig_reader = reader
6126 reader = orig_reader.slice(_length, 4)
6127 obj.xid = reader.read("!L")[0]
6128 _experimenter = reader.read("!L")[0]
6129 assert(_experimenter == 6035143)
6130 _subtype = reader.read("!L")[0]
6131 assert(_subtype == 67)
6132 obj.data = str(reader.read_all())
6133 return obj
6134
6135 def __eq__(self, other):
6136 if type(self) != type(other): return False
6137 if self.xid != other.xid: return False
6138 if self.data != other.data: return False
6139 return True
6140
6141 def pretty_print(self, q):
6142 q.text("bsn_lua_notification {")
6143 with q.group():
6144 with q.indent(2):
6145 q.breakable()
6146 q.text("xid = ");
6147 if self.xid != None:
6148 q.text("%#x" % self.xid)
6149 else:
6150 q.text('None')
6151 q.text(","); q.breakable()
6152 q.text("data = ");
6153 q.pp(self.data)
6154 q.breakable()
6155 q.text('}')
6156
6157bsn_header.subtypes[67] = bsn_lua_notification
6158
6159class bsn_lua_upload(bsn_header):
6160 version = 4
6161 type = 4
6162 experimenter = 6035143
6163 subtype = 64
6164
6165 def __init__(self, xid=None, flags=None, filename=None, data=None):
6166 if xid != None:
6167 self.xid = xid
6168 else:
6169 self.xid = None
6170 if flags != None:
6171 self.flags = flags
6172 else:
6173 self.flags = 0
6174 if filename != None:
6175 self.filename = filename
6176 else:
6177 self.filename = ""
6178 if data != None:
6179 self.data = data
6180 else:
6181 self.data = ''
6182 return
6183
6184 def pack(self):
6185 packed = []
6186 packed.append(struct.pack("!B", self.version))
6187 packed.append(struct.pack("!B", self.type))
6188 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6189 packed.append(struct.pack("!L", self.xid))
6190 packed.append(struct.pack("!L", self.experimenter))
6191 packed.append(struct.pack("!L", self.subtype))
6192 packed.append(struct.pack("!H", self.flags))
6193 packed.append(struct.pack("!64s", self.filename))
6194 packed.append(self.data)
6195 length = sum([len(x) for x in packed])
6196 packed[2] = struct.pack("!H", length)
6197 return ''.join(packed)
6198
6199 @staticmethod
6200 def unpack(reader):
6201 obj = bsn_lua_upload()
6202 _version = reader.read("!B")[0]
6203 assert(_version == 4)
6204 _type = reader.read("!B")[0]
6205 assert(_type == 4)
6206 _length = reader.read("!H")[0]
6207 orig_reader = reader
6208 reader = orig_reader.slice(_length, 4)
6209 obj.xid = reader.read("!L")[0]
6210 _experimenter = reader.read("!L")[0]
6211 assert(_experimenter == 6035143)
6212 _subtype = reader.read("!L")[0]
6213 assert(_subtype == 64)
6214 obj.flags = reader.read("!H")[0]
6215 obj.filename = reader.read("!64s")[0].rstrip("\x00")
6216 obj.data = str(reader.read_all())
6217 return obj
6218
6219 def __eq__(self, other):
6220 if type(self) != type(other): return False
6221 if self.xid != other.xid: return False
6222 if self.flags != other.flags: return False
6223 if self.filename != other.filename: return False
6224 if self.data != other.data: return False
6225 return True
6226
6227 def pretty_print(self, q):
6228 q.text("bsn_lua_upload {")
6229 with q.group():
6230 with q.indent(2):
6231 q.breakable()
6232 q.text("xid = ");
6233 if self.xid != None:
6234 q.text("%#x" % self.xid)
6235 else:
6236 q.text('None')
6237 q.text(","); q.breakable()
6238 q.text("flags = ");
6239 q.text("%#x" % self.flags)
6240 q.text(","); q.breakable()
6241 q.text("filename = ");
6242 q.pp(self.filename)
6243 q.text(","); q.breakable()
6244 q.text("data = ");
6245 q.pp(self.data)
6246 q.breakable()
6247 q.text('}')
6248
6249bsn_header.subtypes[64] = bsn_lua_upload
6250
Rich Lane7dcdf022013-12-11 14:45:27 -08006251class bsn_pdu_rx_reply(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07006252 version = 4
6253 type = 4
6254 experimenter = 6035143
6255 subtype = 34
6256
Rich Lane7b0f2012013-11-22 14:15:26 -08006257 def __init__(self, xid=None, status=None, port_no=None, slot_num=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006258 if xid != None:
6259 self.xid = xid
6260 else:
6261 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07006262 if status != None:
6263 self.status = status
6264 else:
6265 self.status = 0
Rich Lane7b0f2012013-11-22 14:15:26 -08006266 if port_no != None:
6267 self.port_no = port_no
6268 else:
6269 self.port_no = 0
6270 if slot_num != None:
6271 self.slot_num = slot_num
6272 else:
6273 self.slot_num = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08006274 return
Rich Lane6f4978c2013-10-20 21:33:52 -07006275
6276 def pack(self):
6277 packed = []
6278 packed.append(struct.pack("!B", self.version))
6279 packed.append(struct.pack("!B", self.type))
6280 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6281 packed.append(struct.pack("!L", self.xid))
6282 packed.append(struct.pack("!L", self.experimenter))
6283 packed.append(struct.pack("!L", self.subtype))
6284 packed.append(struct.pack("!L", self.status))
Rich Lane7b0f2012013-11-22 14:15:26 -08006285 packed.append(util.pack_port_no(self.port_no))
6286 packed.append(struct.pack("!B", self.slot_num))
Rich Lane6f4978c2013-10-20 21:33:52 -07006287 length = sum([len(x) for x in packed])
6288 packed[2] = struct.pack("!H", length)
6289 return ''.join(packed)
6290
6291 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006292 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07006293 obj = bsn_pdu_rx_reply()
Rich Lane6f4978c2013-10-20 21:33:52 -07006294 _version = reader.read("!B")[0]
6295 assert(_version == 4)
6296 _type = reader.read("!B")[0]
6297 assert(_type == 4)
6298 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006299 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006300 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -07006301 obj.xid = reader.read("!L")[0]
6302 _experimenter = reader.read("!L")[0]
6303 assert(_experimenter == 6035143)
6304 _subtype = reader.read("!L")[0]
6305 assert(_subtype == 34)
6306 obj.status = reader.read("!L")[0]
Rich Lane7b0f2012013-11-22 14:15:26 -08006307 obj.port_no = util.unpack_port_no(reader)
6308 obj.slot_num = reader.read("!B")[0]
Rich Lane6f4978c2013-10-20 21:33:52 -07006309 return obj
6310
6311 def __eq__(self, other):
6312 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07006313 if self.xid != other.xid: return False
6314 if self.status != other.status: return False
Rich Lane7b0f2012013-11-22 14:15:26 -08006315 if self.port_no != other.port_no: return False
6316 if self.slot_num != other.slot_num: return False
Rich Lane6f4978c2013-10-20 21:33:52 -07006317 return True
6318
Rich Lane6f4978c2013-10-20 21:33:52 -07006319 def pretty_print(self, q):
6320 q.text("bsn_pdu_rx_reply {")
6321 with q.group():
6322 with q.indent(2):
6323 q.breakable()
6324 q.text("xid = ");
6325 if self.xid != None:
6326 q.text("%#x" % self.xid)
6327 else:
6328 q.text('None')
6329 q.text(","); q.breakable()
6330 q.text("status = ");
6331 q.text("%#x" % self.status)
Rich Lane7b0f2012013-11-22 14:15:26 -08006332 q.text(","); q.breakable()
6333 q.text("port_no = ");
6334 q.text(util.pretty_port(self.port_no))
6335 q.text(","); q.breakable()
6336 q.text("slot_num = ");
6337 q.text("%#x" % self.slot_num)
Rich Lane6f4978c2013-10-20 21:33:52 -07006338 q.breakable()
6339 q.text('}')
6340
Rich Lane7dcdf022013-12-11 14:45:27 -08006341bsn_header.subtypes[34] = bsn_pdu_rx_reply
6342
6343class bsn_pdu_rx_request(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07006344 version = 4
6345 type = 4
6346 experimenter = 6035143
6347 subtype = 33
6348
6349 def __init__(self, xid=None, timeout_ms=None, port_no=None, slot_num=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006350 if xid != None:
6351 self.xid = xid
6352 else:
6353 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07006354 if timeout_ms != None:
6355 self.timeout_ms = timeout_ms
6356 else:
6357 self.timeout_ms = 0
6358 if port_no != None:
6359 self.port_no = port_no
6360 else:
6361 self.port_no = 0
6362 if slot_num != None:
6363 self.slot_num = slot_num
6364 else:
6365 self.slot_num = 0
6366 if data != None:
6367 self.data = data
6368 else:
6369 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08006370 return
Rich Lane6f4978c2013-10-20 21:33:52 -07006371
6372 def pack(self):
6373 packed = []
6374 packed.append(struct.pack("!B", self.version))
6375 packed.append(struct.pack("!B", self.type))
6376 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6377 packed.append(struct.pack("!L", self.xid))
6378 packed.append(struct.pack("!L", self.experimenter))
6379 packed.append(struct.pack("!L", self.subtype))
6380 packed.append(struct.pack("!L", self.timeout_ms))
6381 packed.append(util.pack_port_no(self.port_no))
6382 packed.append(struct.pack("!B", self.slot_num))
6383 packed.append('\x00' * 3)
6384 packed.append(self.data)
6385 length = sum([len(x) for x in packed])
6386 packed[2] = struct.pack("!H", length)
6387 return ''.join(packed)
6388
6389 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006390 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07006391 obj = bsn_pdu_rx_request()
Rich Lane6f4978c2013-10-20 21:33:52 -07006392 _version = reader.read("!B")[0]
6393 assert(_version == 4)
6394 _type = reader.read("!B")[0]
6395 assert(_type == 4)
6396 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006397 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006398 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -07006399 obj.xid = reader.read("!L")[0]
6400 _experimenter = reader.read("!L")[0]
6401 assert(_experimenter == 6035143)
6402 _subtype = reader.read("!L")[0]
6403 assert(_subtype == 33)
6404 obj.timeout_ms = reader.read("!L")[0]
6405 obj.port_no = util.unpack_port_no(reader)
6406 obj.slot_num = reader.read("!B")[0]
6407 reader.skip(3)
6408 obj.data = str(reader.read_all())
6409 return obj
6410
6411 def __eq__(self, other):
6412 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07006413 if self.xid != other.xid: return False
6414 if self.timeout_ms != other.timeout_ms: return False
6415 if self.port_no != other.port_no: return False
6416 if self.slot_num != other.slot_num: return False
6417 if self.data != other.data: return False
6418 return True
6419
Rich Lane6f4978c2013-10-20 21:33:52 -07006420 def pretty_print(self, q):
6421 q.text("bsn_pdu_rx_request {")
6422 with q.group():
6423 with q.indent(2):
6424 q.breakable()
6425 q.text("xid = ");
6426 if self.xid != None:
6427 q.text("%#x" % self.xid)
6428 else:
6429 q.text('None')
6430 q.text(","); q.breakable()
6431 q.text("timeout_ms = ");
6432 q.text("%#x" % self.timeout_ms)
6433 q.text(","); q.breakable()
6434 q.text("port_no = ");
6435 q.text(util.pretty_port(self.port_no))
6436 q.text(","); q.breakable()
6437 q.text("slot_num = ");
6438 q.text("%#x" % self.slot_num)
6439 q.text(","); q.breakable()
6440 q.text("data = ");
6441 q.pp(self.data)
6442 q.breakable()
6443 q.text('}')
6444
Rich Lane7dcdf022013-12-11 14:45:27 -08006445bsn_header.subtypes[33] = bsn_pdu_rx_request
6446
6447class bsn_pdu_rx_timeout(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07006448 version = 4
6449 type = 4
6450 experimenter = 6035143
6451 subtype = 35
6452
6453 def __init__(self, xid=None, port_no=None, slot_num=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006454 if xid != None:
6455 self.xid = xid
6456 else:
6457 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07006458 if port_no != None:
6459 self.port_no = port_no
6460 else:
6461 self.port_no = 0
6462 if slot_num != None:
6463 self.slot_num = slot_num
6464 else:
6465 self.slot_num = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08006466 return
Rich Lane6f4978c2013-10-20 21:33:52 -07006467
6468 def pack(self):
6469 packed = []
6470 packed.append(struct.pack("!B", self.version))
6471 packed.append(struct.pack("!B", self.type))
6472 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6473 packed.append(struct.pack("!L", self.xid))
6474 packed.append(struct.pack("!L", self.experimenter))
6475 packed.append(struct.pack("!L", self.subtype))
6476 packed.append(util.pack_port_no(self.port_no))
6477 packed.append(struct.pack("!B", self.slot_num))
6478 length = sum([len(x) for x in packed])
6479 packed[2] = struct.pack("!H", length)
6480 return ''.join(packed)
6481
6482 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006483 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07006484 obj = bsn_pdu_rx_timeout()
Rich Lane6f4978c2013-10-20 21:33:52 -07006485 _version = reader.read("!B")[0]
6486 assert(_version == 4)
6487 _type = reader.read("!B")[0]
6488 assert(_type == 4)
6489 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006490 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006491 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -07006492 obj.xid = reader.read("!L")[0]
6493 _experimenter = reader.read("!L")[0]
6494 assert(_experimenter == 6035143)
6495 _subtype = reader.read("!L")[0]
6496 assert(_subtype == 35)
6497 obj.port_no = util.unpack_port_no(reader)
6498 obj.slot_num = reader.read("!B")[0]
6499 return obj
6500
6501 def __eq__(self, other):
6502 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07006503 if self.xid != other.xid: return False
6504 if self.port_no != other.port_no: return False
6505 if self.slot_num != other.slot_num: return False
6506 return True
6507
Rich Lane6f4978c2013-10-20 21:33:52 -07006508 def pretty_print(self, q):
6509 q.text("bsn_pdu_rx_timeout {")
6510 with q.group():
6511 with q.indent(2):
6512 q.breakable()
6513 q.text("xid = ");
6514 if self.xid != None:
6515 q.text("%#x" % self.xid)
6516 else:
6517 q.text('None')
6518 q.text(","); q.breakable()
6519 q.text("port_no = ");
6520 q.text(util.pretty_port(self.port_no))
6521 q.text(","); q.breakable()
6522 q.text("slot_num = ");
6523 q.text("%#x" % self.slot_num)
6524 q.breakable()
6525 q.text('}')
6526
Rich Lane7dcdf022013-12-11 14:45:27 -08006527bsn_header.subtypes[35] = bsn_pdu_rx_timeout
6528
6529class bsn_pdu_tx_reply(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07006530 version = 4
6531 type = 4
6532 experimenter = 6035143
6533 subtype = 32
6534
Rich Lane7b0f2012013-11-22 14:15:26 -08006535 def __init__(self, xid=None, status=None, port_no=None, slot_num=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006536 if xid != None:
6537 self.xid = xid
6538 else:
6539 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07006540 if status != None:
6541 self.status = status
6542 else:
6543 self.status = 0
Rich Lane7b0f2012013-11-22 14:15:26 -08006544 if port_no != None:
6545 self.port_no = port_no
6546 else:
6547 self.port_no = 0
6548 if slot_num != None:
6549 self.slot_num = slot_num
6550 else:
6551 self.slot_num = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08006552 return
Rich Lane6f4978c2013-10-20 21:33:52 -07006553
6554 def pack(self):
6555 packed = []
6556 packed.append(struct.pack("!B", self.version))
6557 packed.append(struct.pack("!B", self.type))
6558 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6559 packed.append(struct.pack("!L", self.xid))
6560 packed.append(struct.pack("!L", self.experimenter))
6561 packed.append(struct.pack("!L", self.subtype))
6562 packed.append(struct.pack("!L", self.status))
Rich Lane7b0f2012013-11-22 14:15:26 -08006563 packed.append(util.pack_port_no(self.port_no))
6564 packed.append(struct.pack("!B", self.slot_num))
Rich Lane6f4978c2013-10-20 21:33:52 -07006565 length = sum([len(x) for x in packed])
6566 packed[2] = struct.pack("!H", length)
6567 return ''.join(packed)
6568
6569 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006570 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07006571 obj = bsn_pdu_tx_reply()
Rich Lane6f4978c2013-10-20 21:33:52 -07006572 _version = reader.read("!B")[0]
6573 assert(_version == 4)
6574 _type = reader.read("!B")[0]
6575 assert(_type == 4)
6576 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006577 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006578 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -07006579 obj.xid = reader.read("!L")[0]
6580 _experimenter = reader.read("!L")[0]
6581 assert(_experimenter == 6035143)
6582 _subtype = reader.read("!L")[0]
6583 assert(_subtype == 32)
6584 obj.status = reader.read("!L")[0]
Rich Lane7b0f2012013-11-22 14:15:26 -08006585 obj.port_no = util.unpack_port_no(reader)
6586 obj.slot_num = reader.read("!B")[0]
Rich Lane6f4978c2013-10-20 21:33:52 -07006587 return obj
6588
6589 def __eq__(self, other):
6590 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07006591 if self.xid != other.xid: return False
6592 if self.status != other.status: return False
Rich Lane7b0f2012013-11-22 14:15:26 -08006593 if self.port_no != other.port_no: return False
6594 if self.slot_num != other.slot_num: return False
Rich Lane6f4978c2013-10-20 21:33:52 -07006595 return True
6596
Rich Lane6f4978c2013-10-20 21:33:52 -07006597 def pretty_print(self, q):
6598 q.text("bsn_pdu_tx_reply {")
6599 with q.group():
6600 with q.indent(2):
6601 q.breakable()
6602 q.text("xid = ");
6603 if self.xid != None:
6604 q.text("%#x" % self.xid)
6605 else:
6606 q.text('None')
6607 q.text(","); q.breakable()
6608 q.text("status = ");
6609 q.text("%#x" % self.status)
Rich Lane7b0f2012013-11-22 14:15:26 -08006610 q.text(","); q.breakable()
6611 q.text("port_no = ");
6612 q.text(util.pretty_port(self.port_no))
6613 q.text(","); q.breakable()
6614 q.text("slot_num = ");
6615 q.text("%#x" % self.slot_num)
Rich Lane6f4978c2013-10-20 21:33:52 -07006616 q.breakable()
6617 q.text('}')
6618
Rich Lane7dcdf022013-12-11 14:45:27 -08006619bsn_header.subtypes[32] = bsn_pdu_tx_reply
6620
6621class bsn_pdu_tx_request(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07006622 version = 4
6623 type = 4
6624 experimenter = 6035143
6625 subtype = 31
6626
6627 def __init__(self, xid=None, tx_interval_ms=None, port_no=None, slot_num=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006628 if xid != None:
6629 self.xid = xid
6630 else:
6631 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07006632 if tx_interval_ms != None:
6633 self.tx_interval_ms = tx_interval_ms
6634 else:
6635 self.tx_interval_ms = 0
6636 if port_no != None:
6637 self.port_no = port_no
6638 else:
6639 self.port_no = 0
6640 if slot_num != None:
6641 self.slot_num = slot_num
6642 else:
6643 self.slot_num = 0
6644 if data != None:
6645 self.data = data
6646 else:
6647 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08006648 return
Rich Lane6f4978c2013-10-20 21:33:52 -07006649
6650 def pack(self):
6651 packed = []
6652 packed.append(struct.pack("!B", self.version))
6653 packed.append(struct.pack("!B", self.type))
6654 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6655 packed.append(struct.pack("!L", self.xid))
6656 packed.append(struct.pack("!L", self.experimenter))
6657 packed.append(struct.pack("!L", self.subtype))
6658 packed.append(struct.pack("!L", self.tx_interval_ms))
6659 packed.append(util.pack_port_no(self.port_no))
6660 packed.append(struct.pack("!B", self.slot_num))
6661 packed.append('\x00' * 3)
6662 packed.append(self.data)
6663 length = sum([len(x) for x in packed])
6664 packed[2] = struct.pack("!H", length)
6665 return ''.join(packed)
6666
6667 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006668 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07006669 obj = bsn_pdu_tx_request()
Rich Lane6f4978c2013-10-20 21:33:52 -07006670 _version = reader.read("!B")[0]
6671 assert(_version == 4)
6672 _type = reader.read("!B")[0]
6673 assert(_type == 4)
6674 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006675 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006676 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -07006677 obj.xid = reader.read("!L")[0]
6678 _experimenter = reader.read("!L")[0]
6679 assert(_experimenter == 6035143)
6680 _subtype = reader.read("!L")[0]
6681 assert(_subtype == 31)
6682 obj.tx_interval_ms = reader.read("!L")[0]
6683 obj.port_no = util.unpack_port_no(reader)
6684 obj.slot_num = reader.read("!B")[0]
6685 reader.skip(3)
6686 obj.data = str(reader.read_all())
6687 return obj
6688
6689 def __eq__(self, other):
6690 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07006691 if self.xid != other.xid: return False
6692 if self.tx_interval_ms != other.tx_interval_ms: return False
6693 if self.port_no != other.port_no: return False
6694 if self.slot_num != other.slot_num: return False
6695 if self.data != other.data: return False
6696 return True
6697
Rich Lane6f4978c2013-10-20 21:33:52 -07006698 def pretty_print(self, q):
6699 q.text("bsn_pdu_tx_request {")
6700 with q.group():
6701 with q.indent(2):
6702 q.breakable()
6703 q.text("xid = ");
6704 if self.xid != None:
6705 q.text("%#x" % self.xid)
6706 else:
6707 q.text('None')
6708 q.text(","); q.breakable()
6709 q.text("tx_interval_ms = ");
6710 q.text("%#x" % self.tx_interval_ms)
6711 q.text(","); q.breakable()
6712 q.text("port_no = ");
6713 q.text(util.pretty_port(self.port_no))
6714 q.text(","); q.breakable()
6715 q.text("slot_num = ");
6716 q.text("%#x" % self.slot_num)
6717 q.text(","); q.breakable()
6718 q.text("data = ");
6719 q.pp(self.data)
6720 q.breakable()
6721 q.text('}')
6722
Rich Lane7dcdf022013-12-11 14:45:27 -08006723bsn_header.subtypes[31] = bsn_pdu_tx_request
6724
6725class bsn_port_counter_stats_reply(bsn_stats_reply):
6726 version = 4
6727 type = 19
6728 stats_type = 65535
6729 experimenter = 6035143
6730 subtype = 8
6731
6732 def __init__(self, xid=None, flags=None, entries=None):
6733 if xid != None:
6734 self.xid = xid
6735 else:
6736 self.xid = None
6737 if flags != None:
6738 self.flags = flags
6739 else:
6740 self.flags = 0
6741 if entries != None:
6742 self.entries = entries
6743 else:
6744 self.entries = []
6745 return
6746
6747 def pack(self):
6748 packed = []
6749 packed.append(struct.pack("!B", self.version))
6750 packed.append(struct.pack("!B", self.type))
6751 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6752 packed.append(struct.pack("!L", self.xid))
6753 packed.append(struct.pack("!H", self.stats_type))
6754 packed.append(struct.pack("!H", self.flags))
6755 packed.append('\x00' * 4)
6756 packed.append(struct.pack("!L", self.experimenter))
6757 packed.append(struct.pack("!L", self.subtype))
6758 packed.append(loxi.generic_util.pack_list(self.entries))
6759 length = sum([len(x) for x in packed])
6760 packed[2] = struct.pack("!H", length)
6761 return ''.join(packed)
6762
6763 @staticmethod
6764 def unpack(reader):
6765 obj = bsn_port_counter_stats_reply()
6766 _version = reader.read("!B")[0]
6767 assert(_version == 4)
6768 _type = reader.read("!B")[0]
6769 assert(_type == 19)
6770 _length = reader.read("!H")[0]
6771 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006772 reader = orig_reader.slice(_length, 4)
Rich Lane7dcdf022013-12-11 14:45:27 -08006773 obj.xid = reader.read("!L")[0]
6774 _stats_type = reader.read("!H")[0]
6775 assert(_stats_type == 65535)
6776 obj.flags = reader.read("!H")[0]
6777 reader.skip(4)
6778 _experimenter = reader.read("!L")[0]
6779 assert(_experimenter == 6035143)
6780 _subtype = reader.read("!L")[0]
6781 assert(_subtype == 8)
Rich Lanee2567702015-01-26 15:04:35 -08006782 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_port_counter_stats_entry.unpack)
Rich Lane7dcdf022013-12-11 14:45:27 -08006783 return obj
6784
6785 def __eq__(self, other):
6786 if type(self) != type(other): return False
6787 if self.xid != other.xid: return False
6788 if self.flags != other.flags: return False
6789 if self.entries != other.entries: return False
6790 return True
6791
6792 def pretty_print(self, q):
6793 q.text("bsn_port_counter_stats_reply {")
6794 with q.group():
6795 with q.indent(2):
6796 q.breakable()
6797 q.text("xid = ");
6798 if self.xid != None:
6799 q.text("%#x" % self.xid)
6800 else:
6801 q.text('None')
6802 q.text(","); q.breakable()
6803 q.text("flags = ");
6804 q.text("%#x" % self.flags)
6805 q.text(","); q.breakable()
6806 q.text("entries = ");
6807 q.pp(self.entries)
6808 q.breakable()
6809 q.text('}')
6810
6811bsn_stats_reply.subtypes[8] = bsn_port_counter_stats_reply
6812
6813class bsn_port_counter_stats_request(bsn_stats_request):
6814 version = 4
6815 type = 18
6816 stats_type = 65535
6817 experimenter = 6035143
6818 subtype = 8
6819
6820 def __init__(self, xid=None, flags=None, port_no=None):
6821 if xid != None:
6822 self.xid = xid
6823 else:
6824 self.xid = None
6825 if flags != None:
6826 self.flags = flags
6827 else:
6828 self.flags = 0
6829 if port_no != None:
6830 self.port_no = port_no
6831 else:
6832 self.port_no = 0
6833 return
6834
6835 def pack(self):
6836 packed = []
6837 packed.append(struct.pack("!B", self.version))
6838 packed.append(struct.pack("!B", self.type))
6839 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6840 packed.append(struct.pack("!L", self.xid))
6841 packed.append(struct.pack("!H", self.stats_type))
6842 packed.append(struct.pack("!H", self.flags))
6843 packed.append('\x00' * 4)
6844 packed.append(struct.pack("!L", self.experimenter))
6845 packed.append(struct.pack("!L", self.subtype))
6846 packed.append(util.pack_port_no(self.port_no))
6847 length = sum([len(x) for x in packed])
6848 packed[2] = struct.pack("!H", length)
6849 return ''.join(packed)
6850
6851 @staticmethod
6852 def unpack(reader):
6853 obj = bsn_port_counter_stats_request()
6854 _version = reader.read("!B")[0]
6855 assert(_version == 4)
6856 _type = reader.read("!B")[0]
6857 assert(_type == 18)
6858 _length = reader.read("!H")[0]
6859 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006860 reader = orig_reader.slice(_length, 4)
Rich Lane7dcdf022013-12-11 14:45:27 -08006861 obj.xid = reader.read("!L")[0]
6862 _stats_type = reader.read("!H")[0]
6863 assert(_stats_type == 65535)
6864 obj.flags = reader.read("!H")[0]
6865 reader.skip(4)
6866 _experimenter = reader.read("!L")[0]
6867 assert(_experimenter == 6035143)
6868 _subtype = reader.read("!L")[0]
6869 assert(_subtype == 8)
6870 obj.port_no = util.unpack_port_no(reader)
6871 return obj
6872
6873 def __eq__(self, other):
6874 if type(self) != type(other): return False
6875 if self.xid != other.xid: return False
6876 if self.flags != other.flags: return False
6877 if self.port_no != other.port_no: return False
6878 return True
6879
6880 def pretty_print(self, q):
6881 q.text("bsn_port_counter_stats_request {")
6882 with q.group():
6883 with q.indent(2):
6884 q.breakable()
6885 q.text("xid = ");
6886 if self.xid != None:
6887 q.text("%#x" % self.xid)
6888 else:
6889 q.text('None')
6890 q.text(","); q.breakable()
6891 q.text("flags = ");
6892 q.text("%#x" % self.flags)
6893 q.text(","); q.breakable()
6894 q.text("port_no = ");
6895 q.text(util.pretty_port(self.port_no))
6896 q.breakable()
6897 q.text('}')
6898
6899bsn_stats_request.subtypes[8] = bsn_port_counter_stats_request
6900
Rich Lane5454b682014-01-14 17:07:36 -08006901class bsn_role_status(bsn_header):
6902 version = 4
6903 type = 4
6904 experimenter = 6035143
6905 subtype = 55
6906
6907 def __init__(self, xid=None, role=None, reason=None, generation_id=None):
6908 if xid != None:
6909 self.xid = xid
6910 else:
6911 self.xid = None
6912 if role != None:
6913 self.role = role
6914 else:
6915 self.role = 0
6916 if reason != None:
6917 self.reason = reason
6918 else:
6919 self.reason = 0
6920 if generation_id != None:
6921 self.generation_id = generation_id
6922 else:
6923 self.generation_id = 0
6924 return
6925
6926 def pack(self):
6927 packed = []
6928 packed.append(struct.pack("!B", self.version))
6929 packed.append(struct.pack("!B", self.type))
6930 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6931 packed.append(struct.pack("!L", self.xid))
6932 packed.append(struct.pack("!L", self.experimenter))
6933 packed.append(struct.pack("!L", self.subtype))
6934 packed.append(struct.pack("!L", self.role))
6935 packed.append(struct.pack("!B", self.reason))
6936 packed.append('\x00' * 3)
6937 packed.append(struct.pack("!Q", self.generation_id))
6938 length = sum([len(x) for x in packed])
6939 packed[2] = struct.pack("!H", length)
6940 return ''.join(packed)
6941
6942 @staticmethod
6943 def unpack(reader):
6944 obj = bsn_role_status()
6945 _version = reader.read("!B")[0]
6946 assert(_version == 4)
6947 _type = reader.read("!B")[0]
6948 assert(_type == 4)
6949 _length = reader.read("!H")[0]
6950 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006951 reader = orig_reader.slice(_length, 4)
Rich Lane5454b682014-01-14 17:07:36 -08006952 obj.xid = reader.read("!L")[0]
6953 _experimenter = reader.read("!L")[0]
6954 assert(_experimenter == 6035143)
6955 _subtype = reader.read("!L")[0]
6956 assert(_subtype == 55)
6957 obj.role = reader.read("!L")[0]
6958 obj.reason = reader.read("!B")[0]
6959 reader.skip(3)
6960 obj.generation_id = reader.read("!Q")[0]
6961 return obj
6962
6963 def __eq__(self, other):
6964 if type(self) != type(other): return False
6965 if self.xid != other.xid: return False
6966 if self.role != other.role: return False
6967 if self.reason != other.reason: return False
6968 if self.generation_id != other.generation_id: return False
6969 return True
6970
6971 def pretty_print(self, q):
6972 q.text("bsn_role_status {")
6973 with q.group():
6974 with q.indent(2):
6975 q.breakable()
6976 q.text("xid = ");
6977 if self.xid != None:
6978 q.text("%#x" % self.xid)
6979 else:
6980 q.text('None')
6981 q.text(","); q.breakable()
6982 q.text("role = ");
6983 q.text("%#x" % self.role)
6984 q.text(","); q.breakable()
6985 q.text("reason = ");
6986 q.text("%#x" % self.reason)
6987 q.text(","); q.breakable()
6988 q.text("generation_id = ");
6989 q.text("%#x" % self.generation_id)
6990 q.breakable()
6991 q.text('}')
6992
6993bsn_header.subtypes[55] = bsn_role_status
6994
Rich Lane95f7fc92014-01-27 17:08:16 -08006995class bsn_set_aux_cxns_reply(bsn_header):
6996 version = 4
6997 type = 4
6998 experimenter = 6035143
6999 subtype = 59
7000
7001 def __init__(self, xid=None, num_aux=None, status=None):
7002 if xid != None:
7003 self.xid = xid
7004 else:
7005 self.xid = None
7006 if num_aux != None:
7007 self.num_aux = num_aux
7008 else:
7009 self.num_aux = 0
7010 if status != None:
7011 self.status = status
7012 else:
7013 self.status = 0
7014 return
7015
7016 def pack(self):
7017 packed = []
7018 packed.append(struct.pack("!B", self.version))
7019 packed.append(struct.pack("!B", self.type))
7020 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7021 packed.append(struct.pack("!L", self.xid))
7022 packed.append(struct.pack("!L", self.experimenter))
7023 packed.append(struct.pack("!L", self.subtype))
7024 packed.append(struct.pack("!L", self.num_aux))
7025 packed.append(struct.pack("!L", self.status))
7026 length = sum([len(x) for x in packed])
7027 packed[2] = struct.pack("!H", length)
7028 return ''.join(packed)
7029
7030 @staticmethod
7031 def unpack(reader):
7032 obj = bsn_set_aux_cxns_reply()
7033 _version = reader.read("!B")[0]
7034 assert(_version == 4)
7035 _type = reader.read("!B")[0]
7036 assert(_type == 4)
7037 _length = reader.read("!H")[0]
7038 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007039 reader = orig_reader.slice(_length, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -08007040 obj.xid = reader.read("!L")[0]
7041 _experimenter = reader.read("!L")[0]
7042 assert(_experimenter == 6035143)
7043 _subtype = reader.read("!L")[0]
7044 assert(_subtype == 59)
7045 obj.num_aux = reader.read("!L")[0]
7046 obj.status = reader.read("!L")[0]
7047 return obj
7048
7049 def __eq__(self, other):
7050 if type(self) != type(other): return False
7051 if self.xid != other.xid: return False
7052 if self.num_aux != other.num_aux: return False
7053 if self.status != other.status: return False
7054 return True
7055
7056 def pretty_print(self, q):
7057 q.text("bsn_set_aux_cxns_reply {")
7058 with q.group():
7059 with q.indent(2):
7060 q.breakable()
7061 q.text("xid = ");
7062 if self.xid != None:
7063 q.text("%#x" % self.xid)
7064 else:
7065 q.text('None')
7066 q.text(","); q.breakable()
7067 q.text("num_aux = ");
7068 q.text("%#x" % self.num_aux)
7069 q.text(","); q.breakable()
7070 q.text("status = ");
7071 q.text("%#x" % self.status)
7072 q.breakable()
7073 q.text('}')
7074
7075bsn_header.subtypes[59] = bsn_set_aux_cxns_reply
7076
7077class bsn_set_aux_cxns_request(bsn_header):
7078 version = 4
7079 type = 4
7080 experimenter = 6035143
7081 subtype = 58
7082
7083 def __init__(self, xid=None, num_aux=None):
7084 if xid != None:
7085 self.xid = xid
7086 else:
7087 self.xid = None
7088 if num_aux != None:
7089 self.num_aux = num_aux
7090 else:
7091 self.num_aux = 0
7092 return
7093
7094 def pack(self):
7095 packed = []
7096 packed.append(struct.pack("!B", self.version))
7097 packed.append(struct.pack("!B", self.type))
7098 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7099 packed.append(struct.pack("!L", self.xid))
7100 packed.append(struct.pack("!L", self.experimenter))
7101 packed.append(struct.pack("!L", self.subtype))
7102 packed.append(struct.pack("!L", self.num_aux))
7103 length = sum([len(x) for x in packed])
7104 packed[2] = struct.pack("!H", length)
7105 return ''.join(packed)
7106
7107 @staticmethod
7108 def unpack(reader):
7109 obj = bsn_set_aux_cxns_request()
7110 _version = reader.read("!B")[0]
7111 assert(_version == 4)
7112 _type = reader.read("!B")[0]
7113 assert(_type == 4)
7114 _length = reader.read("!H")[0]
7115 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007116 reader = orig_reader.slice(_length, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -08007117 obj.xid = reader.read("!L")[0]
7118 _experimenter = reader.read("!L")[0]
7119 assert(_experimenter == 6035143)
7120 _subtype = reader.read("!L")[0]
7121 assert(_subtype == 58)
7122 obj.num_aux = reader.read("!L")[0]
7123 return obj
7124
7125 def __eq__(self, other):
7126 if type(self) != type(other): return False
7127 if self.xid != other.xid: return False
7128 if self.num_aux != other.num_aux: return False
7129 return True
7130
7131 def pretty_print(self, q):
7132 q.text("bsn_set_aux_cxns_request {")
7133 with q.group():
7134 with q.indent(2):
7135 q.breakable()
7136 q.text("xid = ");
7137 if self.xid != None:
7138 q.text("%#x" % self.xid)
7139 else:
7140 q.text('None')
7141 q.text(","); q.breakable()
7142 q.text("num_aux = ");
7143 q.text("%#x" % self.num_aux)
7144 q.breakable()
7145 q.text('}')
7146
7147bsn_header.subtypes[58] = bsn_set_aux_cxns_request
7148
Rich Lane7dcdf022013-12-11 14:45:27 -08007149class bsn_set_lacp_reply(bsn_header):
Rich Lane7b0f2012013-11-22 14:15:26 -08007150 version = 4
7151 type = 4
7152 experimenter = 6035143
7153 subtype = 42
7154
7155 def __init__(self, xid=None, status=None, port_no=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007156 if xid != None:
7157 self.xid = xid
7158 else:
7159 self.xid = None
Rich Lane7b0f2012013-11-22 14:15:26 -08007160 if status != None:
7161 self.status = status
7162 else:
7163 self.status = 0
7164 if port_no != None:
7165 self.port_no = port_no
7166 else:
7167 self.port_no = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08007168 return
Rich Lane7b0f2012013-11-22 14:15:26 -08007169
7170 def pack(self):
7171 packed = []
7172 packed.append(struct.pack("!B", self.version))
7173 packed.append(struct.pack("!B", self.type))
7174 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7175 packed.append(struct.pack("!L", self.xid))
7176 packed.append(struct.pack("!L", self.experimenter))
7177 packed.append(struct.pack("!L", self.subtype))
7178 packed.append(struct.pack("!L", self.status))
7179 packed.append(util.pack_port_no(self.port_no))
7180 length = sum([len(x) for x in packed])
7181 packed[2] = struct.pack("!H", length)
7182 return ''.join(packed)
7183
7184 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007185 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -08007186 obj = bsn_set_lacp_reply()
Rich Lane7b0f2012013-11-22 14:15:26 -08007187 _version = reader.read("!B")[0]
7188 assert(_version == 4)
7189 _type = reader.read("!B")[0]
7190 assert(_type == 4)
7191 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007192 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007193 reader = orig_reader.slice(_length, 4)
Rich Lane7b0f2012013-11-22 14:15:26 -08007194 obj.xid = reader.read("!L")[0]
7195 _experimenter = reader.read("!L")[0]
7196 assert(_experimenter == 6035143)
7197 _subtype = reader.read("!L")[0]
7198 assert(_subtype == 42)
7199 obj.status = reader.read("!L")[0]
7200 obj.port_no = util.unpack_port_no(reader)
7201 return obj
7202
7203 def __eq__(self, other):
7204 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -08007205 if self.xid != other.xid: return False
7206 if self.status != other.status: return False
7207 if self.port_no != other.port_no: return False
7208 return True
7209
Rich Lane7b0f2012013-11-22 14:15:26 -08007210 def pretty_print(self, q):
7211 q.text("bsn_set_lacp_reply {")
7212 with q.group():
7213 with q.indent(2):
7214 q.breakable()
7215 q.text("xid = ");
7216 if self.xid != None:
7217 q.text("%#x" % self.xid)
7218 else:
7219 q.text('None')
7220 q.text(","); q.breakable()
7221 q.text("status = ");
7222 q.text("%#x" % self.status)
7223 q.text(","); q.breakable()
7224 q.text("port_no = ");
7225 q.text(util.pretty_port(self.port_no))
7226 q.breakable()
7227 q.text('}')
7228
Rich Lane7dcdf022013-12-11 14:45:27 -08007229bsn_header.subtypes[42] = bsn_set_lacp_reply
7230
7231class bsn_set_lacp_request(bsn_header):
Rich Lane7b0f2012013-11-22 14:15:26 -08007232 version = 4
7233 type = 4
7234 experimenter = 6035143
7235 subtype = 41
7236
7237 def __init__(self, xid=None, enabled=None, port_no=None, actor_sys_priority=None, actor_sys_mac=None, actor_port_priority=None, actor_port_num=None, actor_key=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007238 if xid != None:
7239 self.xid = xid
7240 else:
7241 self.xid = None
Rich Lane7b0f2012013-11-22 14:15:26 -08007242 if enabled != None:
7243 self.enabled = enabled
7244 else:
7245 self.enabled = 0
7246 if port_no != None:
7247 self.port_no = port_no
7248 else:
7249 self.port_no = 0
7250 if actor_sys_priority != None:
7251 self.actor_sys_priority = actor_sys_priority
7252 else:
7253 self.actor_sys_priority = 0
7254 if actor_sys_mac != None:
7255 self.actor_sys_mac = actor_sys_mac
7256 else:
7257 self.actor_sys_mac = [0,0,0,0,0,0]
7258 if actor_port_priority != None:
7259 self.actor_port_priority = actor_port_priority
7260 else:
7261 self.actor_port_priority = 0
7262 if actor_port_num != None:
7263 self.actor_port_num = actor_port_num
7264 else:
7265 self.actor_port_num = 0
7266 if actor_key != None:
7267 self.actor_key = actor_key
7268 else:
7269 self.actor_key = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08007270 return
Rich Lane7b0f2012013-11-22 14:15:26 -08007271
7272 def pack(self):
7273 packed = []
7274 packed.append(struct.pack("!B", self.version))
7275 packed.append(struct.pack("!B", self.type))
7276 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7277 packed.append(struct.pack("!L", self.xid))
7278 packed.append(struct.pack("!L", self.experimenter))
7279 packed.append(struct.pack("!L", self.subtype))
7280 packed.append(struct.pack("!B", self.enabled))
7281 packed.append('\x00' * 3)
7282 packed.append(util.pack_port_no(self.port_no))
7283 packed.append(struct.pack("!H", self.actor_sys_priority))
7284 packed.append(struct.pack("!6B", *self.actor_sys_mac))
7285 packed.append(struct.pack("!H", self.actor_port_priority))
7286 packed.append(struct.pack("!H", self.actor_port_num))
7287 packed.append(struct.pack("!H", self.actor_key))
7288 length = sum([len(x) for x in packed])
7289 packed[2] = struct.pack("!H", length)
7290 return ''.join(packed)
7291
7292 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007293 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -08007294 obj = bsn_set_lacp_request()
Rich Lane7b0f2012013-11-22 14:15:26 -08007295 _version = reader.read("!B")[0]
7296 assert(_version == 4)
7297 _type = reader.read("!B")[0]
7298 assert(_type == 4)
7299 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007300 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007301 reader = orig_reader.slice(_length, 4)
Rich Lane7b0f2012013-11-22 14:15:26 -08007302 obj.xid = reader.read("!L")[0]
7303 _experimenter = reader.read("!L")[0]
7304 assert(_experimenter == 6035143)
7305 _subtype = reader.read("!L")[0]
7306 assert(_subtype == 41)
7307 obj.enabled = reader.read("!B")[0]
7308 reader.skip(3)
7309 obj.port_no = util.unpack_port_no(reader)
7310 obj.actor_sys_priority = reader.read("!H")[0]
7311 obj.actor_sys_mac = list(reader.read('!6B'))
7312 obj.actor_port_priority = reader.read("!H")[0]
7313 obj.actor_port_num = reader.read("!H")[0]
7314 obj.actor_key = reader.read("!H")[0]
7315 return obj
7316
7317 def __eq__(self, other):
7318 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -08007319 if self.xid != other.xid: return False
7320 if self.enabled != other.enabled: return False
7321 if self.port_no != other.port_no: return False
7322 if self.actor_sys_priority != other.actor_sys_priority: return False
7323 if self.actor_sys_mac != other.actor_sys_mac: return False
7324 if self.actor_port_priority != other.actor_port_priority: return False
7325 if self.actor_port_num != other.actor_port_num: return False
7326 if self.actor_key != other.actor_key: return False
7327 return True
7328
Rich Lane7b0f2012013-11-22 14:15:26 -08007329 def pretty_print(self, q):
7330 q.text("bsn_set_lacp_request {")
7331 with q.group():
7332 with q.indent(2):
7333 q.breakable()
7334 q.text("xid = ");
7335 if self.xid != None:
7336 q.text("%#x" % self.xid)
7337 else:
7338 q.text('None')
7339 q.text(","); q.breakable()
7340 q.text("enabled = ");
7341 q.text("%#x" % self.enabled)
7342 q.text(","); q.breakable()
7343 q.text("port_no = ");
7344 q.text(util.pretty_port(self.port_no))
7345 q.text(","); q.breakable()
7346 q.text("actor_sys_priority = ");
7347 q.text("%#x" % self.actor_sys_priority)
7348 q.text(","); q.breakable()
7349 q.text("actor_sys_mac = ");
7350 q.text(util.pretty_mac(self.actor_sys_mac))
7351 q.text(","); q.breakable()
7352 q.text("actor_port_priority = ");
7353 q.text("%#x" % self.actor_port_priority)
7354 q.text(","); q.breakable()
7355 q.text("actor_port_num = ");
7356 q.text("%#x" % self.actor_port_num)
7357 q.text(","); q.breakable()
7358 q.text("actor_key = ");
7359 q.text("%#x" % self.actor_key)
7360 q.breakable()
7361 q.text('}')
7362
Rich Lane7dcdf022013-12-11 14:45:27 -08007363bsn_header.subtypes[41] = bsn_set_lacp_request
7364
7365class bsn_set_mirroring(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07007366 version = 4
7367 type = 4
7368 experimenter = 6035143
Rich Lanec2ee4b82013-04-24 17:12:38 -07007369 subtype = 3
7370
7371 def __init__(self, xid=None, report_mirror_ports=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007372 if xid != None:
7373 self.xid = xid
7374 else:
7375 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07007376 if report_mirror_ports != None:
7377 self.report_mirror_ports = report_mirror_ports
7378 else:
7379 self.report_mirror_ports = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08007380 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07007381
7382 def pack(self):
7383 packed = []
7384 packed.append(struct.pack("!B", self.version))
7385 packed.append(struct.pack("!B", self.type))
7386 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7387 packed.append(struct.pack("!L", self.xid))
7388 packed.append(struct.pack("!L", self.experimenter))
7389 packed.append(struct.pack("!L", self.subtype))
7390 packed.append(struct.pack("!B", self.report_mirror_ports))
7391 packed.append('\x00' * 3)
7392 length = sum([len(x) for x in packed])
7393 packed[2] = struct.pack("!H", length)
7394 return ''.join(packed)
7395
7396 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007397 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07007398 obj = bsn_set_mirroring()
Dan Talaycof6202252013-07-02 01:00:29 -07007399 _version = reader.read("!B")[0]
7400 assert(_version == 4)
7401 _type = reader.read("!B")[0]
7402 assert(_type == 4)
7403 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007404 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007405 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07007406 obj.xid = reader.read("!L")[0]
7407 _experimenter = reader.read("!L")[0]
7408 assert(_experimenter == 6035143)
7409 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007410 assert(_subtype == 3)
Dan Talaycof6202252013-07-02 01:00:29 -07007411 obj.report_mirror_ports = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007412 reader.skip(3)
7413 return obj
7414
7415 def __eq__(self, other):
7416 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07007417 if self.xid != other.xid: return False
7418 if self.report_mirror_ports != other.report_mirror_ports: return False
7419 return True
7420
Rich Lanec2ee4b82013-04-24 17:12:38 -07007421 def pretty_print(self, q):
7422 q.text("bsn_set_mirroring {")
7423 with q.group():
7424 with q.indent(2):
7425 q.breakable()
7426 q.text("xid = ");
7427 if self.xid != None:
7428 q.text("%#x" % self.xid)
7429 else:
7430 q.text('None')
7431 q.text(","); q.breakable()
7432 q.text("report_mirror_ports = ");
7433 q.text("%#x" % self.report_mirror_ports)
7434 q.breakable()
7435 q.text('}')
7436
Rich Lane7dcdf022013-12-11 14:45:27 -08007437bsn_header.subtypes[3] = bsn_set_mirroring
7438
7439class bsn_set_pktin_suppression_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07007440 version = 4
7441 type = 4
7442 experimenter = 6035143
7443 subtype = 25
7444
7445 def __init__(self, xid=None, status=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007446 if xid != None:
7447 self.xid = xid
7448 else:
7449 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07007450 if status != None:
7451 self.status = status
7452 else:
7453 self.status = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08007454 return
Dan Talaycof6202252013-07-02 01:00:29 -07007455
7456 def pack(self):
7457 packed = []
7458 packed.append(struct.pack("!B", self.version))
7459 packed.append(struct.pack("!B", self.type))
7460 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7461 packed.append(struct.pack("!L", self.xid))
7462 packed.append(struct.pack("!L", self.experimenter))
7463 packed.append(struct.pack("!L", self.subtype))
7464 packed.append(struct.pack("!L", self.status))
7465 length = sum([len(x) for x in packed])
7466 packed[2] = struct.pack("!H", length)
7467 return ''.join(packed)
7468
7469 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007470 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07007471 obj = bsn_set_pktin_suppression_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07007472 _version = reader.read("!B")[0]
7473 assert(_version == 4)
7474 _type = reader.read("!B")[0]
7475 assert(_type == 4)
7476 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007477 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007478 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07007479 obj.xid = reader.read("!L")[0]
7480 _experimenter = reader.read("!L")[0]
7481 assert(_experimenter == 6035143)
7482 _subtype = reader.read("!L")[0]
7483 assert(_subtype == 25)
7484 obj.status = reader.read("!L")[0]
7485 return obj
7486
7487 def __eq__(self, other):
7488 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07007489 if self.xid != other.xid: return False
7490 if self.status != other.status: return False
7491 return True
7492
Dan Talaycof6202252013-07-02 01:00:29 -07007493 def pretty_print(self, q):
7494 q.text("bsn_set_pktin_suppression_reply {")
7495 with q.group():
7496 with q.indent(2):
7497 q.breakable()
7498 q.text("xid = ");
7499 if self.xid != None:
7500 q.text("%#x" % self.xid)
7501 else:
7502 q.text('None')
7503 q.text(","); q.breakable()
7504 q.text("status = ");
7505 q.text("%#x" % self.status)
7506 q.breakable()
7507 q.text('}')
7508
Rich Lane7dcdf022013-12-11 14:45:27 -08007509bsn_header.subtypes[25] = bsn_set_pktin_suppression_reply
7510
7511class bsn_set_pktin_suppression_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07007512 version = 4
7513 type = 4
7514 experimenter = 6035143
Rich Lanec2ee4b82013-04-24 17:12:38 -07007515 subtype = 11
7516
7517 def __init__(self, xid=None, enabled=None, idle_timeout=None, hard_timeout=None, priority=None, cookie=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007518 if xid != None:
7519 self.xid = xid
7520 else:
7521 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07007522 if enabled != None:
7523 self.enabled = enabled
7524 else:
7525 self.enabled = 0
7526 if idle_timeout != None:
7527 self.idle_timeout = idle_timeout
7528 else:
7529 self.idle_timeout = 0
7530 if hard_timeout != None:
7531 self.hard_timeout = hard_timeout
7532 else:
7533 self.hard_timeout = 0
7534 if priority != None:
7535 self.priority = priority
7536 else:
7537 self.priority = 0
7538 if cookie != None:
7539 self.cookie = cookie
7540 else:
7541 self.cookie = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08007542 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07007543
7544 def pack(self):
7545 packed = []
7546 packed.append(struct.pack("!B", self.version))
7547 packed.append(struct.pack("!B", self.type))
7548 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7549 packed.append(struct.pack("!L", self.xid))
7550 packed.append(struct.pack("!L", self.experimenter))
7551 packed.append(struct.pack("!L", self.subtype))
7552 packed.append(struct.pack("!B", self.enabled))
7553 packed.append('\x00' * 1)
7554 packed.append(struct.pack("!H", self.idle_timeout))
7555 packed.append(struct.pack("!H", self.hard_timeout))
7556 packed.append(struct.pack("!H", self.priority))
7557 packed.append(struct.pack("!Q", self.cookie))
7558 length = sum([len(x) for x in packed])
7559 packed[2] = struct.pack("!H", length)
7560 return ''.join(packed)
7561
7562 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007563 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07007564 obj = bsn_set_pktin_suppression_request()
Dan Talaycof6202252013-07-02 01:00:29 -07007565 _version = reader.read("!B")[0]
7566 assert(_version == 4)
7567 _type = reader.read("!B")[0]
7568 assert(_type == 4)
7569 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007570 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007571 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07007572 obj.xid = reader.read("!L")[0]
7573 _experimenter = reader.read("!L")[0]
7574 assert(_experimenter == 6035143)
7575 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007576 assert(_subtype == 11)
Dan Talaycof6202252013-07-02 01:00:29 -07007577 obj.enabled = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007578 reader.skip(1)
Dan Talaycof6202252013-07-02 01:00:29 -07007579 obj.idle_timeout = reader.read("!H")[0]
7580 obj.hard_timeout = reader.read("!H")[0]
7581 obj.priority = reader.read("!H")[0]
7582 obj.cookie = reader.read("!Q")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007583 return obj
7584
7585 def __eq__(self, other):
7586 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07007587 if self.xid != other.xid: return False
7588 if self.enabled != other.enabled: return False
7589 if self.idle_timeout != other.idle_timeout: return False
7590 if self.hard_timeout != other.hard_timeout: return False
7591 if self.priority != other.priority: return False
7592 if self.cookie != other.cookie: return False
7593 return True
7594
Rich Lanec2ee4b82013-04-24 17:12:38 -07007595 def pretty_print(self, q):
Dan Talaycof6202252013-07-02 01:00:29 -07007596 q.text("bsn_set_pktin_suppression_request {")
Rich Lanec2ee4b82013-04-24 17:12:38 -07007597 with q.group():
7598 with q.indent(2):
7599 q.breakable()
7600 q.text("xid = ");
7601 if self.xid != None:
7602 q.text("%#x" % self.xid)
7603 else:
7604 q.text('None')
7605 q.text(","); q.breakable()
7606 q.text("enabled = ");
7607 q.text("%#x" % self.enabled)
7608 q.text(","); q.breakable()
7609 q.text("idle_timeout = ");
7610 q.text("%#x" % self.idle_timeout)
7611 q.text(","); q.breakable()
7612 q.text("hard_timeout = ");
7613 q.text("%#x" % self.hard_timeout)
7614 q.text(","); q.breakable()
7615 q.text("priority = ");
7616 q.text("%#x" % self.priority)
7617 q.text(","); q.breakable()
7618 q.text("cookie = ");
7619 q.text("%#x" % self.cookie)
7620 q.breakable()
7621 q.text('}')
7622
Rich Lane7dcdf022013-12-11 14:45:27 -08007623bsn_header.subtypes[11] = bsn_set_pktin_suppression_request
7624
7625class bsn_set_switch_pipeline_reply(bsn_header):
7626 version = 4
7627 type = 4
7628 experimenter = 6035143
7629 subtype = 54
7630
7631 def __init__(self, xid=None, status=None):
7632 if xid != None:
7633 self.xid = xid
7634 else:
7635 self.xid = None
7636 if status != None:
7637 self.status = status
7638 else:
7639 self.status = 0
7640 return
7641
7642 def pack(self):
7643 packed = []
7644 packed.append(struct.pack("!B", self.version))
7645 packed.append(struct.pack("!B", self.type))
7646 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7647 packed.append(struct.pack("!L", self.xid))
7648 packed.append(struct.pack("!L", self.experimenter))
7649 packed.append(struct.pack("!L", self.subtype))
7650 packed.append(struct.pack("!L", self.status))
7651 length = sum([len(x) for x in packed])
7652 packed[2] = struct.pack("!H", length)
7653 return ''.join(packed)
7654
7655 @staticmethod
7656 def unpack(reader):
7657 obj = bsn_set_switch_pipeline_reply()
7658 _version = reader.read("!B")[0]
7659 assert(_version == 4)
7660 _type = reader.read("!B")[0]
7661 assert(_type == 4)
7662 _length = reader.read("!H")[0]
7663 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007664 reader = orig_reader.slice(_length, 4)
Rich Lane7dcdf022013-12-11 14:45:27 -08007665 obj.xid = reader.read("!L")[0]
7666 _experimenter = reader.read("!L")[0]
7667 assert(_experimenter == 6035143)
7668 _subtype = reader.read("!L")[0]
7669 assert(_subtype == 54)
7670 obj.status = reader.read("!L")[0]
7671 return obj
7672
7673 def __eq__(self, other):
7674 if type(self) != type(other): return False
7675 if self.xid != other.xid: return False
7676 if self.status != other.status: return False
7677 return True
7678
7679 def pretty_print(self, q):
7680 q.text("bsn_set_switch_pipeline_reply {")
7681 with q.group():
7682 with q.indent(2):
7683 q.breakable()
7684 q.text("xid = ");
7685 if self.xid != None:
7686 q.text("%#x" % self.xid)
7687 else:
7688 q.text('None')
7689 q.text(","); q.breakable()
7690 q.text("status = ");
7691 q.text("%#x" % self.status)
7692 q.breakable()
7693 q.text('}')
7694
7695bsn_header.subtypes[54] = bsn_set_switch_pipeline_reply
7696
7697class bsn_set_switch_pipeline_request(bsn_header):
7698 version = 4
7699 type = 4
7700 experimenter = 6035143
7701 subtype = 53
7702
7703 def __init__(self, xid=None, pipeline=None):
7704 if xid != None:
7705 self.xid = xid
7706 else:
7707 self.xid = None
7708 if pipeline != None:
7709 self.pipeline = pipeline
7710 else:
7711 self.pipeline = ""
7712 return
7713
7714 def pack(self):
7715 packed = []
7716 packed.append(struct.pack("!B", self.version))
7717 packed.append(struct.pack("!B", self.type))
7718 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7719 packed.append(struct.pack("!L", self.xid))
7720 packed.append(struct.pack("!L", self.experimenter))
7721 packed.append(struct.pack("!L", self.subtype))
7722 packed.append(struct.pack("!256s", self.pipeline))
7723 length = sum([len(x) for x in packed])
7724 packed[2] = struct.pack("!H", length)
7725 return ''.join(packed)
7726
7727 @staticmethod
7728 def unpack(reader):
7729 obj = bsn_set_switch_pipeline_request()
7730 _version = reader.read("!B")[0]
7731 assert(_version == 4)
7732 _type = reader.read("!B")[0]
7733 assert(_type == 4)
7734 _length = reader.read("!H")[0]
7735 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007736 reader = orig_reader.slice(_length, 4)
Rich Lane7dcdf022013-12-11 14:45:27 -08007737 obj.xid = reader.read("!L")[0]
7738 _experimenter = reader.read("!L")[0]
7739 assert(_experimenter == 6035143)
7740 _subtype = reader.read("!L")[0]
7741 assert(_subtype == 53)
7742 obj.pipeline = reader.read("!256s")[0].rstrip("\x00")
7743 return obj
7744
7745 def __eq__(self, other):
7746 if type(self) != type(other): return False
7747 if self.xid != other.xid: return False
7748 if self.pipeline != other.pipeline: return False
7749 return True
7750
7751 def pretty_print(self, q):
7752 q.text("bsn_set_switch_pipeline_request {")
7753 with q.group():
7754 with q.indent(2):
7755 q.breakable()
7756 q.text("xid = ");
7757 if self.xid != None:
7758 q.text("%#x" % self.xid)
7759 else:
7760 q.text('None')
7761 q.text(","); q.breakable()
7762 q.text("pipeline = ");
7763 q.pp(self.pipeline)
7764 q.breakable()
7765 q.text('}')
7766
7767bsn_header.subtypes[53] = bsn_set_switch_pipeline_request
7768
7769class bsn_switch_pipeline_stats_reply(bsn_stats_reply):
7770 version = 4
7771 type = 19
7772 stats_type = 65535
7773 experimenter = 6035143
7774 subtype = 6
7775
7776 def __init__(self, xid=None, flags=None, entries=None):
7777 if xid != None:
7778 self.xid = xid
7779 else:
7780 self.xid = None
7781 if flags != None:
7782 self.flags = flags
7783 else:
7784 self.flags = 0
7785 if entries != None:
7786 self.entries = entries
7787 else:
7788 self.entries = []
7789 return
7790
7791 def pack(self):
7792 packed = []
7793 packed.append(struct.pack("!B", self.version))
7794 packed.append(struct.pack("!B", self.type))
7795 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7796 packed.append(struct.pack("!L", self.xid))
7797 packed.append(struct.pack("!H", self.stats_type))
7798 packed.append(struct.pack("!H", self.flags))
7799 packed.append('\x00' * 4)
7800 packed.append(struct.pack("!L", self.experimenter))
7801 packed.append(struct.pack("!L", self.subtype))
7802 packed.append(loxi.generic_util.pack_list(self.entries))
7803 length = sum([len(x) for x in packed])
7804 packed[2] = struct.pack("!H", length)
7805 return ''.join(packed)
7806
7807 @staticmethod
7808 def unpack(reader):
7809 obj = bsn_switch_pipeline_stats_reply()
7810 _version = reader.read("!B")[0]
7811 assert(_version == 4)
7812 _type = reader.read("!B")[0]
7813 assert(_type == 19)
7814 _length = reader.read("!H")[0]
7815 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007816 reader = orig_reader.slice(_length, 4)
Rich Lane7dcdf022013-12-11 14:45:27 -08007817 obj.xid = reader.read("!L")[0]
7818 _stats_type = reader.read("!H")[0]
7819 assert(_stats_type == 65535)
7820 obj.flags = reader.read("!H")[0]
7821 reader.skip(4)
7822 _experimenter = reader.read("!L")[0]
7823 assert(_experimenter == 6035143)
7824 _subtype = reader.read("!L")[0]
7825 assert(_subtype == 6)
Rich Lanee2567702015-01-26 15:04:35 -08007826 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_switch_pipeline_stats_entry.unpack)
Rich Lane7dcdf022013-12-11 14:45:27 -08007827 return obj
7828
7829 def __eq__(self, other):
7830 if type(self) != type(other): return False
7831 if self.xid != other.xid: return False
7832 if self.flags != other.flags: return False
7833 if self.entries != other.entries: return False
7834 return True
7835
7836 def pretty_print(self, q):
7837 q.text("bsn_switch_pipeline_stats_reply {")
7838 with q.group():
7839 with q.indent(2):
7840 q.breakable()
7841 q.text("xid = ");
7842 if self.xid != None:
7843 q.text("%#x" % self.xid)
7844 else:
7845 q.text('None')
7846 q.text(","); q.breakable()
7847 q.text("flags = ");
7848 q.text("%#x" % self.flags)
7849 q.text(","); q.breakable()
7850 q.text("entries = ");
7851 q.pp(self.entries)
7852 q.breakable()
7853 q.text('}')
7854
7855bsn_stats_reply.subtypes[6] = bsn_switch_pipeline_stats_reply
7856
7857class bsn_switch_pipeline_stats_request(bsn_stats_request):
7858 version = 4
7859 type = 18
7860 stats_type = 65535
7861 experimenter = 6035143
7862 subtype = 6
7863
7864 def __init__(self, xid=None, flags=None):
7865 if xid != None:
7866 self.xid = xid
7867 else:
7868 self.xid = None
7869 if flags != None:
7870 self.flags = flags
7871 else:
7872 self.flags = 0
7873 return
7874
7875 def pack(self):
7876 packed = []
7877 packed.append(struct.pack("!B", self.version))
7878 packed.append(struct.pack("!B", self.type))
7879 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7880 packed.append(struct.pack("!L", self.xid))
7881 packed.append(struct.pack("!H", self.stats_type))
7882 packed.append(struct.pack("!H", self.flags))
7883 packed.append('\x00' * 4)
7884 packed.append(struct.pack("!L", self.experimenter))
7885 packed.append(struct.pack("!L", self.subtype))
7886 length = sum([len(x) for x in packed])
7887 packed[2] = struct.pack("!H", length)
7888 return ''.join(packed)
7889
7890 @staticmethod
7891 def unpack(reader):
7892 obj = bsn_switch_pipeline_stats_request()
7893 _version = reader.read("!B")[0]
7894 assert(_version == 4)
7895 _type = reader.read("!B")[0]
7896 assert(_type == 18)
7897 _length = reader.read("!H")[0]
7898 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007899 reader = orig_reader.slice(_length, 4)
Rich Lane7dcdf022013-12-11 14:45:27 -08007900 obj.xid = reader.read("!L")[0]
7901 _stats_type = reader.read("!H")[0]
7902 assert(_stats_type == 65535)
7903 obj.flags = reader.read("!H")[0]
7904 reader.skip(4)
7905 _experimenter = reader.read("!L")[0]
7906 assert(_experimenter == 6035143)
7907 _subtype = reader.read("!L")[0]
7908 assert(_subtype == 6)
7909 return obj
7910
7911 def __eq__(self, other):
7912 if type(self) != type(other): return False
7913 if self.xid != other.xid: return False
7914 if self.flags != other.flags: return False
7915 return True
7916
7917 def pretty_print(self, q):
7918 q.text("bsn_switch_pipeline_stats_request {")
7919 with q.group():
7920 with q.indent(2):
7921 q.breakable()
7922 q.text("xid = ");
7923 if self.xid != None:
7924 q.text("%#x" % self.xid)
7925 else:
7926 q.text('None')
7927 q.text(","); q.breakable()
7928 q.text("flags = ");
7929 q.text("%#x" % self.flags)
7930 q.breakable()
7931 q.text('}')
7932
7933bsn_stats_request.subtypes[6] = bsn_switch_pipeline_stats_request
7934
Rich Lane9ec3fca2014-02-26 16:22:56 -08007935class bsn_table_checksum_stats_reply(bsn_stats_reply):
7936 version = 4
7937 type = 19
7938 stats_type = 65535
7939 experimenter = 6035143
7940 subtype = 11
7941
7942 def __init__(self, xid=None, flags=None, entries=None):
7943 if xid != None:
7944 self.xid = xid
7945 else:
7946 self.xid = None
7947 if flags != None:
7948 self.flags = flags
7949 else:
7950 self.flags = 0
7951 if entries != None:
7952 self.entries = entries
7953 else:
7954 self.entries = []
7955 return
7956
7957 def pack(self):
7958 packed = []
7959 packed.append(struct.pack("!B", self.version))
7960 packed.append(struct.pack("!B", self.type))
7961 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7962 packed.append(struct.pack("!L", self.xid))
7963 packed.append(struct.pack("!H", self.stats_type))
7964 packed.append(struct.pack("!H", self.flags))
7965 packed.append('\x00' * 4)
7966 packed.append(struct.pack("!L", self.experimenter))
7967 packed.append(struct.pack("!L", self.subtype))
7968 packed.append(loxi.generic_util.pack_list(self.entries))
7969 length = sum([len(x) for x in packed])
7970 packed[2] = struct.pack("!H", length)
7971 return ''.join(packed)
7972
7973 @staticmethod
7974 def unpack(reader):
7975 obj = bsn_table_checksum_stats_reply()
7976 _version = reader.read("!B")[0]
7977 assert(_version == 4)
7978 _type = reader.read("!B")[0]
7979 assert(_type == 19)
7980 _length = reader.read("!H")[0]
7981 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007982 reader = orig_reader.slice(_length, 4)
Rich Lane9ec3fca2014-02-26 16:22:56 -08007983 obj.xid = reader.read("!L")[0]
7984 _stats_type = reader.read("!H")[0]
7985 assert(_stats_type == 65535)
7986 obj.flags = reader.read("!H")[0]
7987 reader.skip(4)
7988 _experimenter = reader.read("!L")[0]
7989 assert(_experimenter == 6035143)
7990 _subtype = reader.read("!L")[0]
7991 assert(_subtype == 11)
Rich Lanee2567702015-01-26 15:04:35 -08007992 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_table_checksum_stats_entry.unpack)
Rich Lane9ec3fca2014-02-26 16:22:56 -08007993 return obj
7994
7995 def __eq__(self, other):
7996 if type(self) != type(other): return False
7997 if self.xid != other.xid: return False
7998 if self.flags != other.flags: return False
7999 if self.entries != other.entries: return False
8000 return True
8001
8002 def pretty_print(self, q):
8003 q.text("bsn_table_checksum_stats_reply {")
8004 with q.group():
8005 with q.indent(2):
8006 q.breakable()
8007 q.text("xid = ");
8008 if self.xid != None:
8009 q.text("%#x" % self.xid)
8010 else:
8011 q.text('None')
8012 q.text(","); q.breakable()
8013 q.text("flags = ");
8014 q.text("%#x" % self.flags)
8015 q.text(","); q.breakable()
8016 q.text("entries = ");
8017 q.pp(self.entries)
8018 q.breakable()
8019 q.text('}')
8020
8021bsn_stats_reply.subtypes[11] = bsn_table_checksum_stats_reply
8022
8023class bsn_table_checksum_stats_request(bsn_stats_request):
8024 version = 4
8025 type = 18
8026 stats_type = 65535
8027 experimenter = 6035143
8028 subtype = 11
8029
8030 def __init__(self, xid=None, flags=None):
8031 if xid != None:
8032 self.xid = xid
8033 else:
8034 self.xid = None
8035 if flags != None:
8036 self.flags = flags
8037 else:
8038 self.flags = 0
8039 return
8040
8041 def pack(self):
8042 packed = []
8043 packed.append(struct.pack("!B", self.version))
8044 packed.append(struct.pack("!B", self.type))
8045 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8046 packed.append(struct.pack("!L", self.xid))
8047 packed.append(struct.pack("!H", self.stats_type))
8048 packed.append(struct.pack("!H", self.flags))
8049 packed.append('\x00' * 4)
8050 packed.append(struct.pack("!L", self.experimenter))
8051 packed.append(struct.pack("!L", self.subtype))
8052 length = sum([len(x) for x in packed])
8053 packed[2] = struct.pack("!H", length)
8054 return ''.join(packed)
8055
8056 @staticmethod
8057 def unpack(reader):
8058 obj = bsn_table_checksum_stats_request()
8059 _version = reader.read("!B")[0]
8060 assert(_version == 4)
8061 _type = reader.read("!B")[0]
8062 assert(_type == 18)
8063 _length = reader.read("!H")[0]
8064 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08008065 reader = orig_reader.slice(_length, 4)
Rich Lane9ec3fca2014-02-26 16:22:56 -08008066 obj.xid = reader.read("!L")[0]
8067 _stats_type = reader.read("!H")[0]
8068 assert(_stats_type == 65535)
8069 obj.flags = reader.read("!H")[0]
8070 reader.skip(4)
8071 _experimenter = reader.read("!L")[0]
8072 assert(_experimenter == 6035143)
8073 _subtype = reader.read("!L")[0]
8074 assert(_subtype == 11)
8075 return obj
8076
8077 def __eq__(self, other):
8078 if type(self) != type(other): return False
8079 if self.xid != other.xid: return False
8080 if self.flags != other.flags: return False
8081 return True
8082
8083 def pretty_print(self, q):
8084 q.text("bsn_table_checksum_stats_request {")
8085 with q.group():
8086 with q.indent(2):
8087 q.breakable()
8088 q.text("xid = ");
8089 if self.xid != None:
8090 q.text("%#x" % self.xid)
8091 else:
8092 q.text('None')
8093 q.text(","); q.breakable()
8094 q.text("flags = ");
8095 q.text("%#x" % self.flags)
8096 q.breakable()
8097 q.text('}')
8098
8099bsn_stats_request.subtypes[11] = bsn_table_checksum_stats_request
8100
8101class bsn_table_set_buckets_size(bsn_header):
8102 version = 4
8103 type = 4
8104 experimenter = 6035143
8105 subtype = 61
8106
8107 def __init__(self, xid=None, table_id=None, buckets_size=None):
8108 if xid != None:
8109 self.xid = xid
8110 else:
8111 self.xid = None
8112 if table_id != None:
8113 self.table_id = table_id
8114 else:
8115 self.table_id = 0
8116 if buckets_size != None:
8117 self.buckets_size = buckets_size
8118 else:
8119 self.buckets_size = 0
8120 return
8121
8122 def pack(self):
8123 packed = []
8124 packed.append(struct.pack("!B", self.version))
8125 packed.append(struct.pack("!B", self.type))
8126 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8127 packed.append(struct.pack("!L", self.xid))
8128 packed.append(struct.pack("!L", self.experimenter))
8129 packed.append(struct.pack("!L", self.subtype))
Rich Lane5587ab12014-06-30 11:19:09 -07008130 packed.append('\x00' * 1)
8131 packed.append(struct.pack("!B", self.table_id))
Rich Lane9ec3fca2014-02-26 16:22:56 -08008132 packed.append('\x00' * 2)
8133 packed.append(struct.pack("!L", self.buckets_size))
8134 length = sum([len(x) for x in packed])
8135 packed[2] = struct.pack("!H", length)
8136 return ''.join(packed)
8137
8138 @staticmethod
8139 def unpack(reader):
8140 obj = bsn_table_set_buckets_size()
8141 _version = reader.read("!B")[0]
8142 assert(_version == 4)
8143 _type = reader.read("!B")[0]
8144 assert(_type == 4)
8145 _length = reader.read("!H")[0]
8146 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08008147 reader = orig_reader.slice(_length, 4)
Rich Lane9ec3fca2014-02-26 16:22:56 -08008148 obj.xid = reader.read("!L")[0]
8149 _experimenter = reader.read("!L")[0]
8150 assert(_experimenter == 6035143)
8151 _subtype = reader.read("!L")[0]
8152 assert(_subtype == 61)
Rich Lane5587ab12014-06-30 11:19:09 -07008153 reader.skip(1)
8154 obj.table_id = reader.read("!B")[0]
Rich Lane9ec3fca2014-02-26 16:22:56 -08008155 reader.skip(2)
8156 obj.buckets_size = reader.read("!L")[0]
8157 return obj
8158
8159 def __eq__(self, other):
8160 if type(self) != type(other): return False
8161 if self.xid != other.xid: return False
8162 if self.table_id != other.table_id: return False
8163 if self.buckets_size != other.buckets_size: return False
8164 return True
8165
8166 def pretty_print(self, q):
8167 q.text("bsn_table_set_buckets_size {")
8168 with q.group():
8169 with q.indent(2):
8170 q.breakable()
8171 q.text("xid = ");
8172 if self.xid != None:
8173 q.text("%#x" % self.xid)
8174 else:
8175 q.text('None')
8176 q.text(","); q.breakable()
8177 q.text("table_id = ");
8178 q.text("%#x" % self.table_id)
8179 q.text(","); q.breakable()
8180 q.text("buckets_size = ");
8181 q.text("%#x" % self.buckets_size)
8182 q.breakable()
8183 q.text('}')
8184
8185bsn_header.subtypes[61] = bsn_table_set_buckets_size
8186
Rich Lane7dcdf022013-12-11 14:45:27 -08008187class bsn_time_reply(bsn_header):
Rich Lane7b0f2012013-11-22 14:15:26 -08008188 version = 4
8189 type = 4
8190 experimenter = 6035143
8191 subtype = 45
8192
8193 def __init__(self, xid=None, time_ms=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08008194 if xid != None:
8195 self.xid = xid
8196 else:
8197 self.xid = None
Rich Lane7b0f2012013-11-22 14:15:26 -08008198 if time_ms != None:
8199 self.time_ms = time_ms
8200 else:
8201 self.time_ms = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08008202 return
Rich Lane7b0f2012013-11-22 14:15:26 -08008203
8204 def pack(self):
8205 packed = []
8206 packed.append(struct.pack("!B", self.version))
8207 packed.append(struct.pack("!B", self.type))
8208 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8209 packed.append(struct.pack("!L", self.xid))
8210 packed.append(struct.pack("!L", self.experimenter))
8211 packed.append(struct.pack("!L", self.subtype))
8212 packed.append(struct.pack("!Q", self.time_ms))
8213 length = sum([len(x) for x in packed])
8214 packed[2] = struct.pack("!H", length)
8215 return ''.join(packed)
8216
8217 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08008218 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -08008219 obj = bsn_time_reply()
Rich Lane7b0f2012013-11-22 14:15:26 -08008220 _version = reader.read("!B")[0]
8221 assert(_version == 4)
8222 _type = reader.read("!B")[0]
8223 assert(_type == 4)
8224 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08008225 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08008226 reader = orig_reader.slice(_length, 4)
Rich Lane7b0f2012013-11-22 14:15:26 -08008227 obj.xid = reader.read("!L")[0]
8228 _experimenter = reader.read("!L")[0]
8229 assert(_experimenter == 6035143)
8230 _subtype = reader.read("!L")[0]
8231 assert(_subtype == 45)
8232 obj.time_ms = reader.read("!Q")[0]
8233 return obj
8234
8235 def __eq__(self, other):
8236 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -08008237 if self.xid != other.xid: return False
8238 if self.time_ms != other.time_ms: return False
8239 return True
8240
Rich Lane7b0f2012013-11-22 14:15:26 -08008241 def pretty_print(self, q):
8242 q.text("bsn_time_reply {")
8243 with q.group():
8244 with q.indent(2):
8245 q.breakable()
8246 q.text("xid = ");
8247 if self.xid != None:
8248 q.text("%#x" % self.xid)
8249 else:
8250 q.text('None')
8251 q.text(","); q.breakable()
8252 q.text("time_ms = ");
8253 q.text("%#x" % self.time_ms)
8254 q.breakable()
8255 q.text('}')
8256
Rich Lane7dcdf022013-12-11 14:45:27 -08008257bsn_header.subtypes[45] = bsn_time_reply
8258
8259class bsn_time_request(bsn_header):
Rich Lane7b0f2012013-11-22 14:15:26 -08008260 version = 4
8261 type = 4
8262 experimenter = 6035143
8263 subtype = 44
8264
8265 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08008266 if xid != None:
8267 self.xid = xid
8268 else:
8269 self.xid = None
8270 return
Rich Lane7b0f2012013-11-22 14:15:26 -08008271
8272 def pack(self):
8273 packed = []
8274 packed.append(struct.pack("!B", self.version))
8275 packed.append(struct.pack("!B", self.type))
8276 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8277 packed.append(struct.pack("!L", self.xid))
8278 packed.append(struct.pack("!L", self.experimenter))
8279 packed.append(struct.pack("!L", self.subtype))
8280 length = sum([len(x) for x in packed])
8281 packed[2] = struct.pack("!H", length)
8282 return ''.join(packed)
8283
8284 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08008285 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -08008286 obj = bsn_time_request()
Rich Lane7b0f2012013-11-22 14:15:26 -08008287 _version = reader.read("!B")[0]
8288 assert(_version == 4)
8289 _type = reader.read("!B")[0]
8290 assert(_type == 4)
8291 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08008292 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08008293 reader = orig_reader.slice(_length, 4)
Rich Lane7b0f2012013-11-22 14:15:26 -08008294 obj.xid = reader.read("!L")[0]
8295 _experimenter = reader.read("!L")[0]
8296 assert(_experimenter == 6035143)
8297 _subtype = reader.read("!L")[0]
8298 assert(_subtype == 44)
8299 return obj
8300
8301 def __eq__(self, other):
8302 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -08008303 if self.xid != other.xid: return False
8304 return True
8305
Rich Lane7b0f2012013-11-22 14:15:26 -08008306 def pretty_print(self, q):
8307 q.text("bsn_time_request {")
8308 with q.group():
8309 with q.indent(2):
8310 q.breakable()
8311 q.text("xid = ");
8312 if self.xid != None:
8313 q.text("%#x" % self.xid)
8314 else:
8315 q.text('None')
8316 q.breakable()
8317 q.text('}')
8318
Rich Lane7dcdf022013-12-11 14:45:27 -08008319bsn_header.subtypes[44] = bsn_time_request
8320
8321class bsn_virtual_port_create_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07008322 version = 4
8323 type = 4
8324 experimenter = 6035143
8325 subtype = 16
8326
8327 def __init__(self, xid=None, status=None, vport_no=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08008328 if xid != None:
8329 self.xid = xid
8330 else:
8331 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07008332 if status != None:
8333 self.status = status
8334 else:
8335 self.status = 0
8336 if vport_no != None:
8337 self.vport_no = vport_no
8338 else:
8339 self.vport_no = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08008340 return
Dan Talaycof6202252013-07-02 01:00:29 -07008341
8342 def pack(self):
8343 packed = []
8344 packed.append(struct.pack("!B", self.version))
8345 packed.append(struct.pack("!B", self.type))
8346 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8347 packed.append(struct.pack("!L", self.xid))
8348 packed.append(struct.pack("!L", self.experimenter))
8349 packed.append(struct.pack("!L", self.subtype))
8350 packed.append(struct.pack("!L", self.status))
8351 packed.append(struct.pack("!L", self.vport_no))
8352 length = sum([len(x) for x in packed])
8353 packed[2] = struct.pack("!H", length)
8354 return ''.join(packed)
8355
8356 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08008357 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07008358 obj = bsn_virtual_port_create_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07008359 _version = reader.read("!B")[0]
8360 assert(_version == 4)
8361 _type = reader.read("!B")[0]
8362 assert(_type == 4)
8363 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08008364 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08008365 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07008366 obj.xid = reader.read("!L")[0]
8367 _experimenter = reader.read("!L")[0]
8368 assert(_experimenter == 6035143)
8369 _subtype = reader.read("!L")[0]
8370 assert(_subtype == 16)
8371 obj.status = reader.read("!L")[0]
8372 obj.vport_no = reader.read("!L")[0]
8373 return obj
8374
8375 def __eq__(self, other):
8376 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07008377 if self.xid != other.xid: return False
8378 if self.status != other.status: return False
8379 if self.vport_no != other.vport_no: return False
8380 return True
8381
Dan Talaycof6202252013-07-02 01:00:29 -07008382 def pretty_print(self, q):
8383 q.text("bsn_virtual_port_create_reply {")
8384 with q.group():
8385 with q.indent(2):
8386 q.breakable()
8387 q.text("xid = ");
8388 if self.xid != None:
8389 q.text("%#x" % self.xid)
8390 else:
8391 q.text('None')
8392 q.text(","); q.breakable()
8393 q.text("status = ");
8394 q.text("%#x" % self.status)
8395 q.text(","); q.breakable()
8396 q.text("vport_no = ");
8397 q.text("%#x" % self.vport_no)
8398 q.breakable()
8399 q.text('}')
8400
Rich Lane7dcdf022013-12-11 14:45:27 -08008401bsn_header.subtypes[16] = bsn_virtual_port_create_reply
8402
8403class bsn_virtual_port_create_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07008404 version = 4
8405 type = 4
8406 experimenter = 6035143
8407 subtype = 15
8408
8409 def __init__(self, xid=None, vport=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08008410 if xid != None:
8411 self.xid = xid
8412 else:
8413 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07008414 if vport != None:
8415 self.vport = vport
8416 else:
Rich Lanee2567702015-01-26 15:04:35 -08008417 self.vport = ofp.bsn_vport()
Rich Lane7dcdf022013-12-11 14:45:27 -08008418 return
Dan Talaycof6202252013-07-02 01:00:29 -07008419
8420 def pack(self):
8421 packed = []
8422 packed.append(struct.pack("!B", self.version))
8423 packed.append(struct.pack("!B", self.type))
8424 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8425 packed.append(struct.pack("!L", self.xid))
8426 packed.append(struct.pack("!L", self.experimenter))
8427 packed.append(struct.pack("!L", self.subtype))
8428 packed.append(self.vport.pack())
8429 length = sum([len(x) for x in packed])
8430 packed[2] = struct.pack("!H", length)
8431 return ''.join(packed)
8432
8433 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08008434 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07008435 obj = bsn_virtual_port_create_request()
Dan Talaycof6202252013-07-02 01:00:29 -07008436 _version = reader.read("!B")[0]
8437 assert(_version == 4)
8438 _type = reader.read("!B")[0]
8439 assert(_type == 4)
8440 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08008441 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08008442 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07008443 obj.xid = reader.read("!L")[0]
8444 _experimenter = reader.read("!L")[0]
8445 assert(_experimenter == 6035143)
8446 _subtype = reader.read("!L")[0]
8447 assert(_subtype == 15)
Rich Lanee2567702015-01-26 15:04:35 -08008448 obj.vport = ofp.bsn_vport.unpack(reader)
Dan Talaycof6202252013-07-02 01:00:29 -07008449 return obj
8450
8451 def __eq__(self, other):
8452 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07008453 if self.xid != other.xid: return False
8454 if self.vport != other.vport: return False
8455 return True
8456
Dan Talaycof6202252013-07-02 01:00:29 -07008457 def pretty_print(self, q):
8458 q.text("bsn_virtual_port_create_request {")
8459 with q.group():
8460 with q.indent(2):
8461 q.breakable()
8462 q.text("xid = ");
8463 if self.xid != None:
8464 q.text("%#x" % self.xid)
8465 else:
8466 q.text('None')
8467 q.text(","); q.breakable()
8468 q.text("vport = ");
8469 q.pp(self.vport)
8470 q.breakable()
8471 q.text('}')
8472
Rich Lane7dcdf022013-12-11 14:45:27 -08008473bsn_header.subtypes[15] = bsn_virtual_port_create_request
8474
8475class bsn_virtual_port_remove_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07008476 version = 4
8477 type = 4
8478 experimenter = 6035143
8479 subtype = 26
8480
8481 def __init__(self, xid=None, status=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08008482 if xid != None:
8483 self.xid = xid
8484 else:
8485 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07008486 if status != None:
8487 self.status = status
8488 else:
8489 self.status = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08008490 return
Dan Talaycof6202252013-07-02 01:00:29 -07008491
8492 def pack(self):
8493 packed = []
8494 packed.append(struct.pack("!B", self.version))
8495 packed.append(struct.pack("!B", self.type))
8496 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8497 packed.append(struct.pack("!L", self.xid))
8498 packed.append(struct.pack("!L", self.experimenter))
8499 packed.append(struct.pack("!L", self.subtype))
8500 packed.append(struct.pack("!L", self.status))
8501 length = sum([len(x) for x in packed])
8502 packed[2] = struct.pack("!H", length)
8503 return ''.join(packed)
8504
8505 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08008506 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07008507 obj = bsn_virtual_port_remove_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07008508 _version = reader.read("!B")[0]
8509 assert(_version == 4)
8510 _type = reader.read("!B")[0]
8511 assert(_type == 4)
8512 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08008513 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08008514 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07008515 obj.xid = reader.read("!L")[0]
8516 _experimenter = reader.read("!L")[0]
8517 assert(_experimenter == 6035143)
8518 _subtype = reader.read("!L")[0]
8519 assert(_subtype == 26)
8520 obj.status = reader.read("!L")[0]
8521 return obj
8522
8523 def __eq__(self, other):
8524 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07008525 if self.xid != other.xid: return False
8526 if self.status != other.status: return False
8527 return True
8528
Dan Talaycof6202252013-07-02 01:00:29 -07008529 def pretty_print(self, q):
8530 q.text("bsn_virtual_port_remove_reply {")
8531 with q.group():
8532 with q.indent(2):
8533 q.breakable()
8534 q.text("xid = ");
8535 if self.xid != None:
8536 q.text("%#x" % self.xid)
8537 else:
8538 q.text('None')
8539 q.text(","); q.breakable()
8540 q.text("status = ");
8541 q.text("%#x" % self.status)
8542 q.breakable()
8543 q.text('}')
8544
Rich Lane7dcdf022013-12-11 14:45:27 -08008545bsn_header.subtypes[26] = bsn_virtual_port_remove_reply
8546
8547class bsn_virtual_port_remove_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07008548 version = 4
8549 type = 4
8550 experimenter = 6035143
8551 subtype = 17
8552
8553 def __init__(self, xid=None, vport_no=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08008554 if xid != None:
8555 self.xid = xid
8556 else:
8557 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07008558 if vport_no != None:
8559 self.vport_no = vport_no
8560 else:
8561 self.vport_no = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08008562 return
Dan Talaycof6202252013-07-02 01:00:29 -07008563
8564 def pack(self):
8565 packed = []
8566 packed.append(struct.pack("!B", self.version))
8567 packed.append(struct.pack("!B", self.type))
8568 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8569 packed.append(struct.pack("!L", self.xid))
8570 packed.append(struct.pack("!L", self.experimenter))
8571 packed.append(struct.pack("!L", self.subtype))
8572 packed.append(struct.pack("!L", self.vport_no))
8573 length = sum([len(x) for x in packed])
8574 packed[2] = struct.pack("!H", length)
8575 return ''.join(packed)
8576
8577 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08008578 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07008579 obj = bsn_virtual_port_remove_request()
Dan Talaycof6202252013-07-02 01:00:29 -07008580 _version = reader.read("!B")[0]
8581 assert(_version == 4)
8582 _type = reader.read("!B")[0]
8583 assert(_type == 4)
8584 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08008585 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08008586 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07008587 obj.xid = reader.read("!L")[0]
8588 _experimenter = reader.read("!L")[0]
8589 assert(_experimenter == 6035143)
8590 _subtype = reader.read("!L")[0]
8591 assert(_subtype == 17)
8592 obj.vport_no = reader.read("!L")[0]
8593 return obj
8594
8595 def __eq__(self, other):
8596 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07008597 if self.xid != other.xid: return False
8598 if self.vport_no != other.vport_no: return False
8599 return True
8600
Dan Talaycof6202252013-07-02 01:00:29 -07008601 def pretty_print(self, q):
8602 q.text("bsn_virtual_port_remove_request {")
8603 with q.group():
8604 with q.indent(2):
8605 q.breakable()
8606 q.text("xid = ");
8607 if self.xid != None:
8608 q.text("%#x" % self.xid)
8609 else:
8610 q.text('None')
8611 q.text(","); q.breakable()
8612 q.text("vport_no = ");
8613 q.text("%#x" % self.vport_no)
8614 q.breakable()
8615 q.text('}')
8616
Rich Lane7dcdf022013-12-11 14:45:27 -08008617bsn_header.subtypes[17] = bsn_virtual_port_remove_request
8618
8619class bsn_vlan_counter_stats_reply(bsn_stats_reply):
8620 version = 4
8621 type = 19
8622 stats_type = 65535
8623 experimenter = 6035143
8624 subtype = 9
8625
8626 def __init__(self, xid=None, flags=None, entries=None):
8627 if xid != None:
8628 self.xid = xid
8629 else:
8630 self.xid = None
8631 if flags != None:
8632 self.flags = flags
8633 else:
8634 self.flags = 0
8635 if entries != None:
8636 self.entries = entries
8637 else:
8638 self.entries = []
8639 return
8640
8641 def pack(self):
8642 packed = []
8643 packed.append(struct.pack("!B", self.version))
8644 packed.append(struct.pack("!B", self.type))
8645 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8646 packed.append(struct.pack("!L", self.xid))
8647 packed.append(struct.pack("!H", self.stats_type))
8648 packed.append(struct.pack("!H", self.flags))
8649 packed.append('\x00' * 4)
8650 packed.append(struct.pack("!L", self.experimenter))
8651 packed.append(struct.pack("!L", self.subtype))
8652 packed.append(loxi.generic_util.pack_list(self.entries))
8653 length = sum([len(x) for x in packed])
8654 packed[2] = struct.pack("!H", length)
8655 return ''.join(packed)
8656
8657 @staticmethod
8658 def unpack(reader):
8659 obj = bsn_vlan_counter_stats_reply()
8660 _version = reader.read("!B")[0]
8661 assert(_version == 4)
8662 _type = reader.read("!B")[0]
8663 assert(_type == 19)
8664 _length = reader.read("!H")[0]
8665 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08008666 reader = orig_reader.slice(_length, 4)
Rich Lane7dcdf022013-12-11 14:45:27 -08008667 obj.xid = reader.read("!L")[0]
8668 _stats_type = reader.read("!H")[0]
8669 assert(_stats_type == 65535)
8670 obj.flags = reader.read("!H")[0]
8671 reader.skip(4)
8672 _experimenter = reader.read("!L")[0]
8673 assert(_experimenter == 6035143)
8674 _subtype = reader.read("!L")[0]
8675 assert(_subtype == 9)
Rich Lanee2567702015-01-26 15:04:35 -08008676 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_vlan_counter_stats_entry.unpack)
Rich Lane7dcdf022013-12-11 14:45:27 -08008677 return obj
8678
8679 def __eq__(self, other):
8680 if type(self) != type(other): return False
8681 if self.xid != other.xid: return False
8682 if self.flags != other.flags: return False
8683 if self.entries != other.entries: return False
8684 return True
8685
8686 def pretty_print(self, q):
8687 q.text("bsn_vlan_counter_stats_reply {")
8688 with q.group():
8689 with q.indent(2):
8690 q.breakable()
8691 q.text("xid = ");
8692 if self.xid != None:
8693 q.text("%#x" % self.xid)
8694 else:
8695 q.text('None')
8696 q.text(","); q.breakable()
8697 q.text("flags = ");
8698 q.text("%#x" % self.flags)
8699 q.text(","); q.breakable()
8700 q.text("entries = ");
8701 q.pp(self.entries)
8702 q.breakable()
8703 q.text('}')
8704
8705bsn_stats_reply.subtypes[9] = bsn_vlan_counter_stats_reply
8706
8707class bsn_vlan_counter_stats_request(bsn_stats_request):
8708 version = 4
8709 type = 18
8710 stats_type = 65535
8711 experimenter = 6035143
8712 subtype = 9
8713
8714 def __init__(self, xid=None, flags=None, vlan_vid=None):
8715 if xid != None:
8716 self.xid = xid
8717 else:
8718 self.xid = None
8719 if flags != None:
8720 self.flags = flags
8721 else:
8722 self.flags = 0
8723 if vlan_vid != None:
8724 self.vlan_vid = vlan_vid
8725 else:
8726 self.vlan_vid = 0
8727 return
8728
8729 def pack(self):
8730 packed = []
8731 packed.append(struct.pack("!B", self.version))
8732 packed.append(struct.pack("!B", self.type))
8733 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8734 packed.append(struct.pack("!L", self.xid))
8735 packed.append(struct.pack("!H", self.stats_type))
8736 packed.append(struct.pack("!H", self.flags))
8737 packed.append('\x00' * 4)
8738 packed.append(struct.pack("!L", self.experimenter))
8739 packed.append(struct.pack("!L", self.subtype))
8740 packed.append(struct.pack("!H", self.vlan_vid))
8741 length = sum([len(x) for x in packed])
8742 packed[2] = struct.pack("!H", length)
8743 return ''.join(packed)
8744
8745 @staticmethod
8746 def unpack(reader):
8747 obj = bsn_vlan_counter_stats_request()
8748 _version = reader.read("!B")[0]
8749 assert(_version == 4)
8750 _type = reader.read("!B")[0]
8751 assert(_type == 18)
8752 _length = reader.read("!H")[0]
8753 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08008754 reader = orig_reader.slice(_length, 4)
Rich Lane7dcdf022013-12-11 14:45:27 -08008755 obj.xid = reader.read("!L")[0]
8756 _stats_type = reader.read("!H")[0]
8757 assert(_stats_type == 65535)
8758 obj.flags = reader.read("!H")[0]
8759 reader.skip(4)
8760 _experimenter = reader.read("!L")[0]
8761 assert(_experimenter == 6035143)
8762 _subtype = reader.read("!L")[0]
8763 assert(_subtype == 9)
8764 obj.vlan_vid = reader.read("!H")[0]
8765 return obj
8766
8767 def __eq__(self, other):
8768 if type(self) != type(other): return False
8769 if self.xid != other.xid: return False
8770 if self.flags != other.flags: return False
8771 if self.vlan_vid != other.vlan_vid: return False
8772 return True
8773
8774 def pretty_print(self, q):
8775 q.text("bsn_vlan_counter_stats_request {")
8776 with q.group():
8777 with q.indent(2):
8778 q.breakable()
8779 q.text("xid = ");
8780 if self.xid != None:
8781 q.text("%#x" % self.xid)
8782 else:
8783 q.text('None')
8784 q.text(","); q.breakable()
8785 q.text("flags = ");
8786 q.text("%#x" % self.flags)
8787 q.text(","); q.breakable()
8788 q.text("vlan_vid = ");
8789 q.text("%#x" % self.vlan_vid)
8790 q.breakable()
8791 q.text('}')
8792
8793bsn_stats_request.subtypes[9] = bsn_vlan_counter_stats_request
8794
Rich Lane5587ab12014-06-30 11:19:09 -07008795class bsn_vrf_counter_stats_reply(bsn_stats_reply):
8796 version = 4
8797 type = 19
8798 stats_type = 65535
8799 experimenter = 6035143
8800 subtype = 15
8801
8802 def __init__(self, xid=None, flags=None, entries=None):
8803 if xid != None:
8804 self.xid = xid
8805 else:
8806 self.xid = None
8807 if flags != None:
8808 self.flags = flags
8809 else:
8810 self.flags = 0
8811 if entries != None:
8812 self.entries = entries
8813 else:
8814 self.entries = []
8815 return
8816
8817 def pack(self):
8818 packed = []
8819 packed.append(struct.pack("!B", self.version))
8820 packed.append(struct.pack("!B", self.type))
8821 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8822 packed.append(struct.pack("!L", self.xid))
8823 packed.append(struct.pack("!H", self.stats_type))
8824 packed.append(struct.pack("!H", self.flags))
8825 packed.append('\x00' * 4)
8826 packed.append(struct.pack("!L", self.experimenter))
8827 packed.append(struct.pack("!L", self.subtype))
8828 packed.append(loxi.generic_util.pack_list(self.entries))
8829 length = sum([len(x) for x in packed])
8830 packed[2] = struct.pack("!H", length)
8831 return ''.join(packed)
8832
8833 @staticmethod
8834 def unpack(reader):
8835 obj = bsn_vrf_counter_stats_reply()
8836 _version = reader.read("!B")[0]
8837 assert(_version == 4)
8838 _type = reader.read("!B")[0]
8839 assert(_type == 19)
8840 _length = reader.read("!H")[0]
8841 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08008842 reader = orig_reader.slice(_length, 4)
Rich Lane5587ab12014-06-30 11:19:09 -07008843 obj.xid = reader.read("!L")[0]
8844 _stats_type = reader.read("!H")[0]
8845 assert(_stats_type == 65535)
8846 obj.flags = reader.read("!H")[0]
8847 reader.skip(4)
8848 _experimenter = reader.read("!L")[0]
8849 assert(_experimenter == 6035143)
8850 _subtype = reader.read("!L")[0]
8851 assert(_subtype == 15)
Rich Lanee2567702015-01-26 15:04:35 -08008852 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_vrf_counter_stats_entry.unpack)
Rich Lane5587ab12014-06-30 11:19:09 -07008853 return obj
8854
8855 def __eq__(self, other):
8856 if type(self) != type(other): return False
8857 if self.xid != other.xid: return False
8858 if self.flags != other.flags: return False
8859 if self.entries != other.entries: return False
8860 return True
8861
8862 def pretty_print(self, q):
8863 q.text("bsn_vrf_counter_stats_reply {")
8864 with q.group():
8865 with q.indent(2):
8866 q.breakable()
8867 q.text("xid = ");
8868 if self.xid != None:
8869 q.text("%#x" % self.xid)
8870 else:
8871 q.text('None')
8872 q.text(","); q.breakable()
8873 q.text("flags = ");
8874 q.text("%#x" % self.flags)
8875 q.text(","); q.breakable()
8876 q.text("entries = ");
8877 q.pp(self.entries)
8878 q.breakable()
8879 q.text('}')
8880
8881bsn_stats_reply.subtypes[15] = bsn_vrf_counter_stats_reply
8882
8883class bsn_vrf_counter_stats_request(bsn_stats_request):
8884 version = 4
8885 type = 18
8886 stats_type = 65535
8887 experimenter = 6035143
8888 subtype = 15
8889
8890 def __init__(self, xid=None, flags=None, vrf=None):
8891 if xid != None:
8892 self.xid = xid
8893 else:
8894 self.xid = None
8895 if flags != None:
8896 self.flags = flags
8897 else:
8898 self.flags = 0
8899 if vrf != None:
8900 self.vrf = vrf
8901 else:
8902 self.vrf = 0
8903 return
8904
8905 def pack(self):
8906 packed = []
8907 packed.append(struct.pack("!B", self.version))
8908 packed.append(struct.pack("!B", self.type))
8909 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8910 packed.append(struct.pack("!L", self.xid))
8911 packed.append(struct.pack("!H", self.stats_type))
8912 packed.append(struct.pack("!H", self.flags))
8913 packed.append('\x00' * 4)
8914 packed.append(struct.pack("!L", self.experimenter))
8915 packed.append(struct.pack("!L", self.subtype))
8916 packed.append(struct.pack("!L", self.vrf))
8917 length = sum([len(x) for x in packed])
8918 packed[2] = struct.pack("!H", length)
8919 return ''.join(packed)
8920
8921 @staticmethod
8922 def unpack(reader):
8923 obj = bsn_vrf_counter_stats_request()
8924 _version = reader.read("!B")[0]
8925 assert(_version == 4)
8926 _type = reader.read("!B")[0]
8927 assert(_type == 18)
8928 _length = reader.read("!H")[0]
8929 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08008930 reader = orig_reader.slice(_length, 4)
Rich Lane5587ab12014-06-30 11:19:09 -07008931 obj.xid = reader.read("!L")[0]
8932 _stats_type = reader.read("!H")[0]
8933 assert(_stats_type == 65535)
8934 obj.flags = reader.read("!H")[0]
8935 reader.skip(4)
8936 _experimenter = reader.read("!L")[0]
8937 assert(_experimenter == 6035143)
8938 _subtype = reader.read("!L")[0]
8939 assert(_subtype == 15)
8940 obj.vrf = reader.read("!L")[0]
8941 return obj
8942
8943 def __eq__(self, other):
8944 if type(self) != type(other): return False
8945 if self.xid != other.xid: return False
8946 if self.flags != other.flags: return False
8947 if self.vrf != other.vrf: return False
8948 return True
8949
8950 def pretty_print(self, q):
8951 q.text("bsn_vrf_counter_stats_request {")
8952 with q.group():
8953 with q.indent(2):
8954 q.breakable()
8955 q.text("xid = ");
8956 if self.xid != None:
8957 q.text("%#x" % self.xid)
8958 else:
8959 q.text('None')
8960 q.text(","); q.breakable()
8961 q.text("flags = ");
8962 q.text("%#x" % self.flags)
8963 q.text(","); q.breakable()
8964 q.text("vrf = ");
8965 q.text("%#x" % self.vrf)
8966 q.breakable()
8967 q.text('}')
8968
8969bsn_stats_request.subtypes[15] = bsn_vrf_counter_stats_request
8970
Rich Lane7dcdf022013-12-11 14:45:27 -08008971class desc_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -07008972 version = 4
8973 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -07008974 stats_type = 0
8975
8976 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 -08008977 if xid != None:
8978 self.xid = xid
8979 else:
8980 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07008981 if flags != None:
8982 self.flags = flags
8983 else:
8984 self.flags = 0
8985 if mfr_desc != None:
8986 self.mfr_desc = mfr_desc
8987 else:
8988 self.mfr_desc = ""
8989 if hw_desc != None:
8990 self.hw_desc = hw_desc
8991 else:
8992 self.hw_desc = ""
8993 if sw_desc != None:
8994 self.sw_desc = sw_desc
8995 else:
8996 self.sw_desc = ""
8997 if serial_num != None:
8998 self.serial_num = serial_num
8999 else:
9000 self.serial_num = ""
9001 if dp_desc != None:
9002 self.dp_desc = dp_desc
9003 else:
9004 self.dp_desc = ""
Rich Lane7dcdf022013-12-11 14:45:27 -08009005 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07009006
9007 def pack(self):
9008 packed = []
9009 packed.append(struct.pack("!B", self.version))
9010 packed.append(struct.pack("!B", self.type))
9011 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9012 packed.append(struct.pack("!L", self.xid))
9013 packed.append(struct.pack("!H", self.stats_type))
9014 packed.append(struct.pack("!H", self.flags))
9015 packed.append('\x00' * 4)
9016 packed.append(struct.pack("!256s", self.mfr_desc))
9017 packed.append(struct.pack("!256s", self.hw_desc))
9018 packed.append(struct.pack("!256s", self.sw_desc))
9019 packed.append(struct.pack("!32s", self.serial_num))
9020 packed.append(struct.pack("!256s", self.dp_desc))
9021 length = sum([len(x) for x in packed])
9022 packed[2] = struct.pack("!H", length)
9023 return ''.join(packed)
9024
9025 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08009026 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07009027 obj = desc_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07009028 _version = reader.read("!B")[0]
9029 assert(_version == 4)
9030 _type = reader.read("!B")[0]
9031 assert(_type == 19)
9032 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08009033 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08009034 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07009035 obj.xid = reader.read("!L")[0]
9036 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009037 assert(_stats_type == 0)
Dan Talaycof6202252013-07-02 01:00:29 -07009038 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009039 reader.skip(4)
9040 obj.mfr_desc = reader.read("!256s")[0].rstrip("\x00")
9041 obj.hw_desc = reader.read("!256s")[0].rstrip("\x00")
9042 obj.sw_desc = reader.read("!256s")[0].rstrip("\x00")
9043 obj.serial_num = reader.read("!32s")[0].rstrip("\x00")
9044 obj.dp_desc = reader.read("!256s")[0].rstrip("\x00")
9045 return obj
9046
9047 def __eq__(self, other):
9048 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07009049 if self.xid != other.xid: return False
9050 if self.flags != other.flags: return False
9051 if self.mfr_desc != other.mfr_desc: return False
9052 if self.hw_desc != other.hw_desc: return False
9053 if self.sw_desc != other.sw_desc: return False
9054 if self.serial_num != other.serial_num: return False
9055 if self.dp_desc != other.dp_desc: return False
9056 return True
9057
Rich Lanec2ee4b82013-04-24 17:12:38 -07009058 def pretty_print(self, q):
9059 q.text("desc_stats_reply {")
9060 with q.group():
9061 with q.indent(2):
9062 q.breakable()
9063 q.text("xid = ");
9064 if self.xid != None:
9065 q.text("%#x" % self.xid)
9066 else:
9067 q.text('None')
9068 q.text(","); q.breakable()
9069 q.text("flags = ");
9070 q.text("%#x" % self.flags)
9071 q.text(","); q.breakable()
9072 q.text("mfr_desc = ");
9073 q.pp(self.mfr_desc)
9074 q.text(","); q.breakable()
9075 q.text("hw_desc = ");
9076 q.pp(self.hw_desc)
9077 q.text(","); q.breakable()
9078 q.text("sw_desc = ");
9079 q.pp(self.sw_desc)
9080 q.text(","); q.breakable()
9081 q.text("serial_num = ");
9082 q.pp(self.serial_num)
9083 q.text(","); q.breakable()
9084 q.text("dp_desc = ");
9085 q.pp(self.dp_desc)
9086 q.breakable()
9087 q.text('}')
9088
Rich Lane7dcdf022013-12-11 14:45:27 -08009089stats_reply.subtypes[0] = desc_stats_reply
9090
9091class desc_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -07009092 version = 4
9093 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -07009094 stats_type = 0
9095
9096 def __init__(self, xid=None, flags=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08009097 if xid != None:
9098 self.xid = xid
9099 else:
9100 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07009101 if flags != None:
9102 self.flags = flags
9103 else:
9104 self.flags = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08009105 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07009106
9107 def pack(self):
9108 packed = []
9109 packed.append(struct.pack("!B", self.version))
9110 packed.append(struct.pack("!B", self.type))
9111 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9112 packed.append(struct.pack("!L", self.xid))
9113 packed.append(struct.pack("!H", self.stats_type))
9114 packed.append(struct.pack("!H", self.flags))
9115 packed.append('\x00' * 4)
9116 length = sum([len(x) for x in packed])
9117 packed[2] = struct.pack("!H", length)
9118 return ''.join(packed)
9119
9120 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08009121 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07009122 obj = desc_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -07009123 _version = reader.read("!B")[0]
9124 assert(_version == 4)
9125 _type = reader.read("!B")[0]
9126 assert(_type == 18)
9127 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08009128 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08009129 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07009130 obj.xid = reader.read("!L")[0]
9131 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009132 assert(_stats_type == 0)
Dan Talaycof6202252013-07-02 01:00:29 -07009133 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009134 reader.skip(4)
9135 return obj
9136
9137 def __eq__(self, other):
9138 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07009139 if self.xid != other.xid: return False
9140 if self.flags != other.flags: return False
9141 return True
9142
Rich Lanec2ee4b82013-04-24 17:12:38 -07009143 def pretty_print(self, q):
9144 q.text("desc_stats_request {")
9145 with q.group():
9146 with q.indent(2):
9147 q.breakable()
9148 q.text("xid = ");
9149 if self.xid != None:
9150 q.text("%#x" % self.xid)
9151 else:
9152 q.text('None')
9153 q.text(","); q.breakable()
9154 q.text("flags = ");
9155 q.text("%#x" % self.flags)
9156 q.breakable()
9157 q.text('}')
9158
Rich Lane7dcdf022013-12-11 14:45:27 -08009159stats_request.subtypes[0] = desc_stats_request
9160
9161class echo_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -07009162 version = 4
9163 type = 3
Rich Lanec2ee4b82013-04-24 17:12:38 -07009164
9165 def __init__(self, xid=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08009166 if xid != None:
9167 self.xid = xid
9168 else:
9169 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07009170 if data != None:
9171 self.data = data
9172 else:
Dan Talaycof6202252013-07-02 01:00:29 -07009173 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08009174 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07009175
9176 def pack(self):
9177 packed = []
9178 packed.append(struct.pack("!B", self.version))
9179 packed.append(struct.pack("!B", self.type))
9180 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9181 packed.append(struct.pack("!L", self.xid))
9182 packed.append(self.data)
9183 length = sum([len(x) for x in packed])
9184 packed[2] = struct.pack("!H", length)
9185 return ''.join(packed)
9186
9187 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08009188 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07009189 obj = echo_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07009190 _version = reader.read("!B")[0]
9191 assert(_version == 4)
9192 _type = reader.read("!B")[0]
9193 assert(_type == 3)
9194 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08009195 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08009196 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07009197 obj.xid = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009198 obj.data = str(reader.read_all())
9199 return obj
9200
9201 def __eq__(self, other):
9202 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07009203 if self.xid != other.xid: return False
9204 if self.data != other.data: return False
9205 return True
9206
Rich Lanec2ee4b82013-04-24 17:12:38 -07009207 def pretty_print(self, q):
9208 q.text("echo_reply {")
9209 with q.group():
9210 with q.indent(2):
9211 q.breakable()
9212 q.text("xid = ");
9213 if self.xid != None:
9214 q.text("%#x" % self.xid)
9215 else:
9216 q.text('None')
9217 q.text(","); q.breakable()
9218 q.text("data = ");
9219 q.pp(self.data)
9220 q.breakable()
9221 q.text('}')
9222
Rich Lane7dcdf022013-12-11 14:45:27 -08009223message.subtypes[3] = echo_reply
9224
9225class echo_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -07009226 version = 4
9227 type = 2
Rich Lanec2ee4b82013-04-24 17:12:38 -07009228
9229 def __init__(self, xid=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08009230 if xid != None:
9231 self.xid = xid
9232 else:
9233 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07009234 if data != None:
9235 self.data = data
9236 else:
Dan Talaycof6202252013-07-02 01:00:29 -07009237 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08009238 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07009239
9240 def pack(self):
9241 packed = []
9242 packed.append(struct.pack("!B", self.version))
9243 packed.append(struct.pack("!B", self.type))
9244 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9245 packed.append(struct.pack("!L", self.xid))
9246 packed.append(self.data)
9247 length = sum([len(x) for x in packed])
9248 packed[2] = struct.pack("!H", length)
9249 return ''.join(packed)
9250
9251 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08009252 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07009253 obj = echo_request()
Dan Talaycof6202252013-07-02 01:00:29 -07009254 _version = reader.read("!B")[0]
9255 assert(_version == 4)
9256 _type = reader.read("!B")[0]
9257 assert(_type == 2)
9258 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08009259 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08009260 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07009261 obj.xid = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009262 obj.data = str(reader.read_all())
9263 return obj
9264
9265 def __eq__(self, other):
9266 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07009267 if self.xid != other.xid: return False
9268 if self.data != other.data: return False
9269 return True
9270
Rich Lanec2ee4b82013-04-24 17:12:38 -07009271 def pretty_print(self, q):
9272 q.text("echo_request {")
9273 with q.group():
9274 with q.indent(2):
9275 q.breakable()
9276 q.text("xid = ");
9277 if self.xid != None:
9278 q.text("%#x" % self.xid)
9279 else:
9280 q.text('None')
9281 q.text(","); q.breakable()
9282 q.text("data = ");
9283 q.pp(self.data)
9284 q.breakable()
9285 q.text('}')
9286
Rich Lane7dcdf022013-12-11 14:45:27 -08009287message.subtypes[2] = echo_request
9288
9289class experimenter_error_msg(error_msg):
Dan Talaycof6202252013-07-02 01:00:29 -07009290 version = 4
9291 type = 1
Rich Lane6f4978c2013-10-20 21:33:52 -07009292 err_type = 65535
Rich Lanec2ee4b82013-04-24 17:12:38 -07009293
Rich Lane6f4978c2013-10-20 21:33:52 -07009294 def __init__(self, xid=None, subtype=None, experimenter=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08009295 if xid != None:
9296 self.xid = xid
9297 else:
9298 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07009299 if subtype != None:
9300 self.subtype = subtype
Rich Lanec2ee4b82013-04-24 17:12:38 -07009301 else:
Rich Lane6f4978c2013-10-20 21:33:52 -07009302 self.subtype = 0
9303 if experimenter != None:
9304 self.experimenter = experimenter
Rich Lanec2ee4b82013-04-24 17:12:38 -07009305 else:
Rich Lane6f4978c2013-10-20 21:33:52 -07009306 self.experimenter = 0
Rich Lanec2ee4b82013-04-24 17:12:38 -07009307 if data != None:
9308 self.data = data
9309 else:
Dan Talaycof6202252013-07-02 01:00:29 -07009310 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08009311 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07009312
9313 def pack(self):
9314 packed = []
9315 packed.append(struct.pack("!B", self.version))
9316 packed.append(struct.pack("!B", self.type))
9317 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9318 packed.append(struct.pack("!L", self.xid))
9319 packed.append(struct.pack("!H", self.err_type))
Rich Lane6f4978c2013-10-20 21:33:52 -07009320 packed.append(struct.pack("!H", self.subtype))
9321 packed.append(struct.pack("!L", self.experimenter))
Rich Lanec2ee4b82013-04-24 17:12:38 -07009322 packed.append(self.data)
9323 length = sum([len(x) for x in packed])
9324 packed[2] = struct.pack("!H", length)
9325 return ''.join(packed)
9326
9327 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08009328 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07009329 obj = experimenter_error_msg()
Dan Talaycof6202252013-07-02 01:00:29 -07009330 _version = reader.read("!B")[0]
9331 assert(_version == 4)
9332 _type = reader.read("!B")[0]
9333 assert(_type == 1)
9334 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08009335 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08009336 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07009337 obj.xid = reader.read("!L")[0]
Rich Lane6f4978c2013-10-20 21:33:52 -07009338 _err_type = reader.read("!H")[0]
9339 assert(_err_type == 65535)
9340 obj.subtype = reader.read("!H")[0]
9341 obj.experimenter = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009342 obj.data = str(reader.read_all())
9343 return obj
9344
9345 def __eq__(self, other):
9346 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07009347 if self.xid != other.xid: return False
Rich Lane6f4978c2013-10-20 21:33:52 -07009348 if self.subtype != other.subtype: return False
9349 if self.experimenter != other.experimenter: return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07009350 if self.data != other.data: return False
9351 return True
9352
Rich Lanec2ee4b82013-04-24 17:12:38 -07009353 def pretty_print(self, q):
Rich Lane6f4978c2013-10-20 21:33:52 -07009354 q.text("experimenter_error_msg {")
Rich Lanec2ee4b82013-04-24 17:12:38 -07009355 with q.group():
9356 with q.indent(2):
9357 q.breakable()
9358 q.text("xid = ");
9359 if self.xid != None:
9360 q.text("%#x" % self.xid)
9361 else:
9362 q.text('None')
9363 q.text(","); q.breakable()
Rich Lane6f4978c2013-10-20 21:33:52 -07009364 q.text("subtype = ");
9365 q.text("%#x" % self.subtype)
Rich Lanec2ee4b82013-04-24 17:12:38 -07009366 q.text(","); q.breakable()
Rich Lane6f4978c2013-10-20 21:33:52 -07009367 q.text("experimenter = ");
9368 q.text("%#x" % self.experimenter)
Rich Lanec2ee4b82013-04-24 17:12:38 -07009369 q.text(","); q.breakable()
9370 q.text("data = ");
9371 q.pp(self.data)
9372 q.breakable()
9373 q.text('}')
9374
Rich Lane7dcdf022013-12-11 14:45:27 -08009375error_msg.subtypes[65535] = experimenter_error_msg
9376
9377class features_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -07009378 version = 4
9379 type = 6
Rich Lanec2ee4b82013-04-24 17:12:38 -07009380
9381 def __init__(self, xid=None, datapath_id=None, n_buffers=None, n_tables=None, auxiliary_id=None, capabilities=None, reserved=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08009382 if xid != None:
9383 self.xid = xid
9384 else:
9385 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07009386 if datapath_id != None:
9387 self.datapath_id = datapath_id
9388 else:
9389 self.datapath_id = 0
9390 if n_buffers != None:
9391 self.n_buffers = n_buffers
9392 else:
9393 self.n_buffers = 0
9394 if n_tables != None:
9395 self.n_tables = n_tables
9396 else:
9397 self.n_tables = 0
9398 if auxiliary_id != None:
9399 self.auxiliary_id = auxiliary_id
9400 else:
9401 self.auxiliary_id = 0
9402 if capabilities != None:
9403 self.capabilities = capabilities
9404 else:
9405 self.capabilities = 0
9406 if reserved != None:
9407 self.reserved = reserved
9408 else:
9409 self.reserved = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08009410 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07009411
9412 def pack(self):
9413 packed = []
9414 packed.append(struct.pack("!B", self.version))
9415 packed.append(struct.pack("!B", self.type))
9416 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9417 packed.append(struct.pack("!L", self.xid))
9418 packed.append(struct.pack("!Q", self.datapath_id))
9419 packed.append(struct.pack("!L", self.n_buffers))
9420 packed.append(struct.pack("!B", self.n_tables))
9421 packed.append(struct.pack("!B", self.auxiliary_id))
9422 packed.append('\x00' * 2)
9423 packed.append(struct.pack("!L", self.capabilities))
9424 packed.append(struct.pack("!L", self.reserved))
9425 length = sum([len(x) for x in packed])
9426 packed[2] = struct.pack("!H", length)
9427 return ''.join(packed)
9428
9429 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08009430 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07009431 obj = features_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07009432 _version = reader.read("!B")[0]
9433 assert(_version == 4)
9434 _type = reader.read("!B")[0]
9435 assert(_type == 6)
9436 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08009437 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08009438 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07009439 obj.xid = reader.read("!L")[0]
9440 obj.datapath_id = reader.read("!Q")[0]
9441 obj.n_buffers = reader.read("!L")[0]
9442 obj.n_tables = reader.read("!B")[0]
9443 obj.auxiliary_id = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009444 reader.skip(2)
Dan Talaycof6202252013-07-02 01:00:29 -07009445 obj.capabilities = reader.read("!L")[0]
9446 obj.reserved = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009447 return obj
9448
9449 def __eq__(self, other):
9450 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07009451 if self.xid != other.xid: return False
9452 if self.datapath_id != other.datapath_id: return False
9453 if self.n_buffers != other.n_buffers: return False
9454 if self.n_tables != other.n_tables: return False
9455 if self.auxiliary_id != other.auxiliary_id: return False
9456 if self.capabilities != other.capabilities: return False
9457 if self.reserved != other.reserved: return False
9458 return True
9459
Rich Lanec2ee4b82013-04-24 17:12:38 -07009460 def pretty_print(self, q):
9461 q.text("features_reply {")
9462 with q.group():
9463 with q.indent(2):
9464 q.breakable()
9465 q.text("xid = ");
9466 if self.xid != None:
9467 q.text("%#x" % self.xid)
9468 else:
9469 q.text('None')
9470 q.text(","); q.breakable()
9471 q.text("datapath_id = ");
9472 q.text("%#x" % self.datapath_id)
9473 q.text(","); q.breakable()
9474 q.text("n_buffers = ");
9475 q.text("%#x" % self.n_buffers)
9476 q.text(","); q.breakable()
9477 q.text("n_tables = ");
9478 q.text("%#x" % self.n_tables)
9479 q.text(","); q.breakable()
9480 q.text("auxiliary_id = ");
9481 q.text("%#x" % self.auxiliary_id)
9482 q.text(","); q.breakable()
9483 q.text("capabilities = ");
9484 q.text("%#x" % self.capabilities)
9485 q.text(","); q.breakable()
9486 q.text("reserved = ");
9487 q.text("%#x" % self.reserved)
9488 q.breakable()
9489 q.text('}')
9490
Rich Lane7dcdf022013-12-11 14:45:27 -08009491message.subtypes[6] = features_reply
9492
9493class features_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -07009494 version = 4
9495 type = 5
Rich Lanec2ee4b82013-04-24 17:12:38 -07009496
9497 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08009498 if xid != None:
9499 self.xid = xid
9500 else:
9501 self.xid = None
9502 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07009503
9504 def pack(self):
9505 packed = []
9506 packed.append(struct.pack("!B", self.version))
9507 packed.append(struct.pack("!B", self.type))
9508 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9509 packed.append(struct.pack("!L", self.xid))
9510 length = sum([len(x) for x in packed])
9511 packed[2] = struct.pack("!H", length)
9512 return ''.join(packed)
9513
9514 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08009515 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07009516 obj = features_request()
Dan Talaycof6202252013-07-02 01:00:29 -07009517 _version = reader.read("!B")[0]
9518 assert(_version == 4)
9519 _type = reader.read("!B")[0]
9520 assert(_type == 5)
9521 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08009522 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08009523 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07009524 obj.xid = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009525 return obj
9526
9527 def __eq__(self, other):
9528 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07009529 if self.xid != other.xid: return False
9530 return True
9531
Rich Lanec2ee4b82013-04-24 17:12:38 -07009532 def pretty_print(self, q):
9533 q.text("features_request {")
9534 with q.group():
9535 with q.indent(2):
9536 q.breakable()
9537 q.text("xid = ");
9538 if self.xid != None:
9539 q.text("%#x" % self.xid)
9540 else:
9541 q.text('None')
9542 q.breakable()
9543 q.text('}')
9544
Rich Lane7dcdf022013-12-11 14:45:27 -08009545message.subtypes[5] = features_request
9546
9547class flow_mod(message):
9548 subtypes = {}
9549
Rich Lane95f7fc92014-01-27 17:08:16 -08009550 version = 4
9551 type = 14
9552
9553 def __init__(self, xid=None, cookie=None, cookie_mask=None, table_id=None, _command=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, out_group=None, flags=None, match=None, instructions=None):
9554 if xid != None:
9555 self.xid = xid
9556 else:
9557 self.xid = None
9558 if cookie != None:
9559 self.cookie = cookie
9560 else:
9561 self.cookie = 0
9562 if cookie_mask != None:
9563 self.cookie_mask = cookie_mask
9564 else:
9565 self.cookie_mask = 0
9566 if table_id != None:
9567 self.table_id = table_id
9568 else:
9569 self.table_id = 0
9570 if _command != None:
9571 self._command = _command
9572 else:
9573 self._command = 0
9574 if idle_timeout != None:
9575 self.idle_timeout = idle_timeout
9576 else:
9577 self.idle_timeout = 0
9578 if hard_timeout != None:
9579 self.hard_timeout = hard_timeout
9580 else:
9581 self.hard_timeout = 0
9582 if priority != None:
9583 self.priority = priority
9584 else:
9585 self.priority = 0
9586 if buffer_id != None:
9587 self.buffer_id = buffer_id
9588 else:
9589 self.buffer_id = 0
9590 if out_port != None:
9591 self.out_port = out_port
9592 else:
9593 self.out_port = 0
9594 if out_group != None:
9595 self.out_group = out_group
9596 else:
9597 self.out_group = 0
9598 if flags != None:
9599 self.flags = flags
9600 else:
9601 self.flags = 0
9602 if match != None:
9603 self.match = match
9604 else:
Rich Lanee2567702015-01-26 15:04:35 -08009605 self.match = ofp.match()
Rich Lane95f7fc92014-01-27 17:08:16 -08009606 if instructions != None:
9607 self.instructions = instructions
9608 else:
9609 self.instructions = []
9610 return
9611
9612 def pack(self):
9613 packed = []
9614 packed.append(struct.pack("!B", self.version))
9615 packed.append(struct.pack("!B", self.type))
9616 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9617 packed.append(struct.pack("!L", self.xid))
9618 packed.append(struct.pack("!Q", self.cookie))
9619 packed.append(struct.pack("!Q", self.cookie_mask))
9620 packed.append(struct.pack("!B", self.table_id))
9621 packed.append(util.pack_fm_cmd(self._command))
9622 packed.append(struct.pack("!H", self.idle_timeout))
9623 packed.append(struct.pack("!H", self.hard_timeout))
9624 packed.append(struct.pack("!H", self.priority))
9625 packed.append(struct.pack("!L", self.buffer_id))
9626 packed.append(util.pack_port_no(self.out_port))
9627 packed.append(struct.pack("!L", self.out_group))
9628 packed.append(struct.pack("!H", self.flags))
9629 packed.append('\x00' * 2)
9630 packed.append(self.match.pack())
9631 packed.append(loxi.generic_util.pack_list(self.instructions))
9632 length = sum([len(x) for x in packed])
9633 packed[2] = struct.pack("!H", length)
9634 return ''.join(packed)
9635
Rich Lane7dcdf022013-12-11 14:45:27 -08009636 @staticmethod
9637 def unpack(reader):
9638 subtype, = reader.peek('B', 25)
Rich Lane95f7fc92014-01-27 17:08:16 -08009639 subclass = flow_mod.subtypes.get(subtype)
9640 if subclass:
9641 return subclass.unpack(reader)
9642
9643 obj = flow_mod()
9644 _version = reader.read("!B")[0]
9645 assert(_version == 4)
9646 _type = reader.read("!B")[0]
9647 assert(_type == 14)
9648 _length = reader.read("!H")[0]
9649 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08009650 reader = orig_reader.slice(_length, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -08009651 obj.xid = reader.read("!L")[0]
9652 obj.cookie = reader.read("!Q")[0]
9653 obj.cookie_mask = reader.read("!Q")[0]
9654 obj.table_id = reader.read("!B")[0]
9655 obj._command = util.unpack_fm_cmd(reader)
9656 obj.idle_timeout = reader.read("!H")[0]
9657 obj.hard_timeout = reader.read("!H")[0]
9658 obj.priority = reader.read("!H")[0]
9659 obj.buffer_id = reader.read("!L")[0]
9660 obj.out_port = util.unpack_port_no(reader)
9661 obj.out_group = reader.read("!L")[0]
9662 obj.flags = reader.read("!H")[0]
9663 reader.skip(2)
Rich Lanee2567702015-01-26 15:04:35 -08009664 obj.match = ofp.match.unpack(reader)
9665 obj.instructions = loxi.generic_util.unpack_list(reader, ofp.instruction.instruction.unpack)
Rich Lane95f7fc92014-01-27 17:08:16 -08009666 return obj
9667
9668 def __eq__(self, other):
9669 if type(self) != type(other): return False
9670 if self.xid != other.xid: return False
9671 if self.cookie != other.cookie: return False
9672 if self.cookie_mask != other.cookie_mask: return False
9673 if self.table_id != other.table_id: return False
9674 if self._command != other._command: return False
9675 if self.idle_timeout != other.idle_timeout: return False
9676 if self.hard_timeout != other.hard_timeout: return False
9677 if self.priority != other.priority: return False
9678 if self.buffer_id != other.buffer_id: return False
9679 if self.out_port != other.out_port: return False
9680 if self.out_group != other.out_group: return False
9681 if self.flags != other.flags: return False
9682 if self.match != other.match: return False
9683 if self.instructions != other.instructions: return False
9684 return True
9685
9686 def pretty_print(self, q):
9687 q.text("flow_mod {")
9688 with q.group():
9689 with q.indent(2):
9690 q.breakable()
9691 q.text("xid = ");
9692 if self.xid != None:
9693 q.text("%#x" % self.xid)
9694 else:
9695 q.text('None')
9696 q.text(","); q.breakable()
9697 q.text("cookie = ");
9698 q.text("%#x" % self.cookie)
9699 q.text(","); q.breakable()
9700 q.text("cookie_mask = ");
9701 q.text("%#x" % self.cookie_mask)
9702 q.text(","); q.breakable()
9703 q.text("table_id = ");
9704 q.text("%#x" % self.table_id)
9705 q.text(","); q.breakable()
9706 q.text("idle_timeout = ");
9707 q.text("%#x" % self.idle_timeout)
9708 q.text(","); q.breakable()
9709 q.text("hard_timeout = ");
9710 q.text("%#x" % self.hard_timeout)
9711 q.text(","); q.breakable()
9712 q.text("priority = ");
9713 q.text("%#x" % self.priority)
9714 q.text(","); q.breakable()
9715 q.text("buffer_id = ");
9716 q.text("%#x" % self.buffer_id)
9717 q.text(","); q.breakable()
9718 q.text("out_port = ");
9719 q.text(util.pretty_port(self.out_port))
9720 q.text(","); q.breakable()
9721 q.text("out_group = ");
9722 q.text("%#x" % self.out_group)
9723 q.text(","); q.breakable()
9724 q.text("flags = ");
9725 q.text("%#x" % self.flags)
9726 q.text(","); q.breakable()
9727 q.text("match = ");
9728 q.pp(self.match)
9729 q.text(","); q.breakable()
9730 q.text("instructions = ");
9731 q.pp(self.instructions)
9732 q.breakable()
9733 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -08009734
9735message.subtypes[14] = flow_mod
9736
9737class flow_add(flow_mod):
Dan Talaycof6202252013-07-02 01:00:29 -07009738 version = 4
9739 type = 14
9740 _command = 0
Rich Lanec2ee4b82013-04-24 17:12:38 -07009741
9742 def __init__(self, xid=None, cookie=None, cookie_mask=None, table_id=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, out_group=None, flags=None, match=None, instructions=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08009743 if xid != None:
9744 self.xid = xid
9745 else:
9746 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07009747 if cookie != None:
9748 self.cookie = cookie
9749 else:
9750 self.cookie = 0
9751 if cookie_mask != None:
9752 self.cookie_mask = cookie_mask
9753 else:
9754 self.cookie_mask = 0
9755 if table_id != None:
9756 self.table_id = table_id
9757 else:
9758 self.table_id = 0
9759 if idle_timeout != None:
9760 self.idle_timeout = idle_timeout
9761 else:
9762 self.idle_timeout = 0
9763 if hard_timeout != None:
9764 self.hard_timeout = hard_timeout
9765 else:
9766 self.hard_timeout = 0
9767 if priority != None:
9768 self.priority = priority
9769 else:
9770 self.priority = 0
9771 if buffer_id != None:
9772 self.buffer_id = buffer_id
9773 else:
9774 self.buffer_id = 0
9775 if out_port != None:
9776 self.out_port = out_port
9777 else:
9778 self.out_port = 0
9779 if out_group != None:
9780 self.out_group = out_group
9781 else:
9782 self.out_group = 0
9783 if flags != None:
9784 self.flags = flags
9785 else:
9786 self.flags = 0
9787 if match != None:
9788 self.match = match
9789 else:
Rich Lanee2567702015-01-26 15:04:35 -08009790 self.match = ofp.match()
Rich Lanec2ee4b82013-04-24 17:12:38 -07009791 if instructions != None:
9792 self.instructions = instructions
9793 else:
9794 self.instructions = []
Rich Lane7dcdf022013-12-11 14:45:27 -08009795 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07009796
9797 def pack(self):
9798 packed = []
9799 packed.append(struct.pack("!B", self.version))
9800 packed.append(struct.pack("!B", self.type))
9801 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9802 packed.append(struct.pack("!L", self.xid))
9803 packed.append(struct.pack("!Q", self.cookie))
9804 packed.append(struct.pack("!Q", self.cookie_mask))
9805 packed.append(struct.pack("!B", self.table_id))
Dan Talaycof6202252013-07-02 01:00:29 -07009806 packed.append(util.pack_fm_cmd(self._command))
Rich Lanec2ee4b82013-04-24 17:12:38 -07009807 packed.append(struct.pack("!H", self.idle_timeout))
9808 packed.append(struct.pack("!H", self.hard_timeout))
9809 packed.append(struct.pack("!H", self.priority))
9810 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -07009811 packed.append(util.pack_port_no(self.out_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -07009812 packed.append(struct.pack("!L", self.out_group))
9813 packed.append(struct.pack("!H", self.flags))
9814 packed.append('\x00' * 2)
9815 packed.append(self.match.pack())
Rich Lane7dcdf022013-12-11 14:45:27 -08009816 packed.append(loxi.generic_util.pack_list(self.instructions))
Rich Lanec2ee4b82013-04-24 17:12:38 -07009817 length = sum([len(x) for x in packed])
9818 packed[2] = struct.pack("!H", length)
9819 return ''.join(packed)
9820
9821 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08009822 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07009823 obj = flow_add()
Dan Talaycof6202252013-07-02 01:00:29 -07009824 _version = reader.read("!B")[0]
9825 assert(_version == 4)
9826 _type = reader.read("!B")[0]
9827 assert(_type == 14)
9828 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08009829 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08009830 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07009831 obj.xid = reader.read("!L")[0]
9832 obj.cookie = reader.read("!Q")[0]
9833 obj.cookie_mask = reader.read("!Q")[0]
9834 obj.table_id = reader.read("!B")[0]
9835 __command = util.unpack_fm_cmd(reader)
9836 assert(__command == 0)
9837 obj.idle_timeout = reader.read("!H")[0]
9838 obj.hard_timeout = reader.read("!H")[0]
9839 obj.priority = reader.read("!H")[0]
9840 obj.buffer_id = reader.read("!L")[0]
9841 obj.out_port = util.unpack_port_no(reader)
9842 obj.out_group = reader.read("!L")[0]
9843 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009844 reader.skip(2)
Rich Lanee2567702015-01-26 15:04:35 -08009845 obj.match = ofp.match.unpack(reader)
9846 obj.instructions = loxi.generic_util.unpack_list(reader, ofp.instruction.instruction.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -07009847 return obj
9848
9849 def __eq__(self, other):
9850 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07009851 if self.xid != other.xid: return False
9852 if self.cookie != other.cookie: return False
9853 if self.cookie_mask != other.cookie_mask: return False
9854 if self.table_id != other.table_id: return False
9855 if self.idle_timeout != other.idle_timeout: return False
9856 if self.hard_timeout != other.hard_timeout: return False
9857 if self.priority != other.priority: return False
9858 if self.buffer_id != other.buffer_id: return False
9859 if self.out_port != other.out_port: return False
9860 if self.out_group != other.out_group: return False
9861 if self.flags != other.flags: return False
9862 if self.match != other.match: return False
9863 if self.instructions != other.instructions: return False
9864 return True
9865
Rich Lanec2ee4b82013-04-24 17:12:38 -07009866 def pretty_print(self, q):
9867 q.text("flow_add {")
9868 with q.group():
9869 with q.indent(2):
9870 q.breakable()
9871 q.text("xid = ");
9872 if self.xid != None:
9873 q.text("%#x" % self.xid)
9874 else:
9875 q.text('None')
9876 q.text(","); q.breakable()
9877 q.text("cookie = ");
9878 q.text("%#x" % self.cookie)
9879 q.text(","); q.breakable()
9880 q.text("cookie_mask = ");
9881 q.text("%#x" % self.cookie_mask)
9882 q.text(","); q.breakable()
9883 q.text("table_id = ");
9884 q.text("%#x" % self.table_id)
9885 q.text(","); q.breakable()
9886 q.text("idle_timeout = ");
9887 q.text("%#x" % self.idle_timeout)
9888 q.text(","); q.breakable()
9889 q.text("hard_timeout = ");
9890 q.text("%#x" % self.hard_timeout)
9891 q.text(","); q.breakable()
9892 q.text("priority = ");
9893 q.text("%#x" % self.priority)
9894 q.text(","); q.breakable()
9895 q.text("buffer_id = ");
9896 q.text("%#x" % self.buffer_id)
9897 q.text(","); q.breakable()
9898 q.text("out_port = ");
9899 q.text(util.pretty_port(self.out_port))
9900 q.text(","); q.breakable()
9901 q.text("out_group = ");
9902 q.text("%#x" % self.out_group)
9903 q.text(","); q.breakable()
9904 q.text("flags = ");
9905 q.text("%#x" % self.flags)
9906 q.text(","); q.breakable()
9907 q.text("match = ");
9908 q.pp(self.match)
9909 q.text(","); q.breakable()
9910 q.text("instructions = ");
9911 q.pp(self.instructions)
9912 q.breakable()
9913 q.text('}')
9914
Rich Lane7dcdf022013-12-11 14:45:27 -08009915flow_mod.subtypes[0] = flow_add
9916
9917class flow_delete(flow_mod):
Dan Talaycof6202252013-07-02 01:00:29 -07009918 version = 4
9919 type = 14
9920 _command = 3
Rich Lanec2ee4b82013-04-24 17:12:38 -07009921
9922 def __init__(self, xid=None, cookie=None, cookie_mask=None, table_id=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, out_group=None, flags=None, match=None, instructions=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08009923 if xid != None:
9924 self.xid = xid
9925 else:
9926 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07009927 if cookie != None:
9928 self.cookie = cookie
9929 else:
9930 self.cookie = 0
9931 if cookie_mask != None:
9932 self.cookie_mask = cookie_mask
9933 else:
9934 self.cookie_mask = 0
9935 if table_id != None:
9936 self.table_id = table_id
9937 else:
9938 self.table_id = 0
9939 if idle_timeout != None:
9940 self.idle_timeout = idle_timeout
9941 else:
9942 self.idle_timeout = 0
9943 if hard_timeout != None:
9944 self.hard_timeout = hard_timeout
9945 else:
9946 self.hard_timeout = 0
9947 if priority != None:
9948 self.priority = priority
9949 else:
9950 self.priority = 0
9951 if buffer_id != None:
9952 self.buffer_id = buffer_id
9953 else:
9954 self.buffer_id = 0
9955 if out_port != None:
9956 self.out_port = out_port
9957 else:
9958 self.out_port = 0
9959 if out_group != None:
9960 self.out_group = out_group
9961 else:
9962 self.out_group = 0
9963 if flags != None:
9964 self.flags = flags
9965 else:
9966 self.flags = 0
9967 if match != None:
9968 self.match = match
9969 else:
Rich Lanee2567702015-01-26 15:04:35 -08009970 self.match = ofp.match()
Rich Lanec2ee4b82013-04-24 17:12:38 -07009971 if instructions != None:
9972 self.instructions = instructions
9973 else:
9974 self.instructions = []
Rich Lane7dcdf022013-12-11 14:45:27 -08009975 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07009976
9977 def pack(self):
9978 packed = []
9979 packed.append(struct.pack("!B", self.version))
9980 packed.append(struct.pack("!B", self.type))
9981 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9982 packed.append(struct.pack("!L", self.xid))
9983 packed.append(struct.pack("!Q", self.cookie))
9984 packed.append(struct.pack("!Q", self.cookie_mask))
9985 packed.append(struct.pack("!B", self.table_id))
Dan Talaycof6202252013-07-02 01:00:29 -07009986 packed.append(util.pack_fm_cmd(self._command))
Rich Lanec2ee4b82013-04-24 17:12:38 -07009987 packed.append(struct.pack("!H", self.idle_timeout))
9988 packed.append(struct.pack("!H", self.hard_timeout))
9989 packed.append(struct.pack("!H", self.priority))
9990 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -07009991 packed.append(util.pack_port_no(self.out_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -07009992 packed.append(struct.pack("!L", self.out_group))
9993 packed.append(struct.pack("!H", self.flags))
9994 packed.append('\x00' * 2)
9995 packed.append(self.match.pack())
Rich Lane7dcdf022013-12-11 14:45:27 -08009996 packed.append(loxi.generic_util.pack_list(self.instructions))
Rich Lanec2ee4b82013-04-24 17:12:38 -07009997 length = sum([len(x) for x in packed])
9998 packed[2] = struct.pack("!H", length)
9999 return ''.join(packed)
10000
10001 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080010002 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070010003 obj = flow_delete()
Dan Talaycof6202252013-07-02 01:00:29 -070010004 _version = reader.read("!B")[0]
10005 assert(_version == 4)
10006 _type = reader.read("!B")[0]
10007 assert(_type == 14)
10008 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080010009 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080010010 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070010011 obj.xid = reader.read("!L")[0]
10012 obj.cookie = reader.read("!Q")[0]
10013 obj.cookie_mask = reader.read("!Q")[0]
10014 obj.table_id = reader.read("!B")[0]
10015 __command = util.unpack_fm_cmd(reader)
10016 assert(__command == 3)
10017 obj.idle_timeout = reader.read("!H")[0]
10018 obj.hard_timeout = reader.read("!H")[0]
10019 obj.priority = reader.read("!H")[0]
10020 obj.buffer_id = reader.read("!L")[0]
10021 obj.out_port = util.unpack_port_no(reader)
10022 obj.out_group = reader.read("!L")[0]
10023 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010024 reader.skip(2)
Rich Lanee2567702015-01-26 15:04:35 -080010025 obj.match = ofp.match.unpack(reader)
10026 obj.instructions = loxi.generic_util.unpack_list(reader, ofp.instruction.instruction.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070010027 return obj
10028
10029 def __eq__(self, other):
10030 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070010031 if self.xid != other.xid: return False
10032 if self.cookie != other.cookie: return False
10033 if self.cookie_mask != other.cookie_mask: return False
10034 if self.table_id != other.table_id: return False
10035 if self.idle_timeout != other.idle_timeout: return False
10036 if self.hard_timeout != other.hard_timeout: return False
10037 if self.priority != other.priority: return False
10038 if self.buffer_id != other.buffer_id: return False
10039 if self.out_port != other.out_port: return False
10040 if self.out_group != other.out_group: return False
10041 if self.flags != other.flags: return False
10042 if self.match != other.match: return False
10043 if self.instructions != other.instructions: return False
10044 return True
10045
Rich Lanec2ee4b82013-04-24 17:12:38 -070010046 def pretty_print(self, q):
10047 q.text("flow_delete {")
10048 with q.group():
10049 with q.indent(2):
10050 q.breakable()
10051 q.text("xid = ");
10052 if self.xid != None:
10053 q.text("%#x" % self.xid)
10054 else:
10055 q.text('None')
10056 q.text(","); q.breakable()
10057 q.text("cookie = ");
10058 q.text("%#x" % self.cookie)
10059 q.text(","); q.breakable()
10060 q.text("cookie_mask = ");
10061 q.text("%#x" % self.cookie_mask)
10062 q.text(","); q.breakable()
10063 q.text("table_id = ");
10064 q.text("%#x" % self.table_id)
10065 q.text(","); q.breakable()
10066 q.text("idle_timeout = ");
10067 q.text("%#x" % self.idle_timeout)
10068 q.text(","); q.breakable()
10069 q.text("hard_timeout = ");
10070 q.text("%#x" % self.hard_timeout)
10071 q.text(","); q.breakable()
10072 q.text("priority = ");
10073 q.text("%#x" % self.priority)
10074 q.text(","); q.breakable()
10075 q.text("buffer_id = ");
10076 q.text("%#x" % self.buffer_id)
10077 q.text(","); q.breakable()
10078 q.text("out_port = ");
10079 q.text(util.pretty_port(self.out_port))
10080 q.text(","); q.breakable()
10081 q.text("out_group = ");
10082 q.text("%#x" % self.out_group)
10083 q.text(","); q.breakable()
10084 q.text("flags = ");
10085 q.text("%#x" % self.flags)
10086 q.text(","); q.breakable()
10087 q.text("match = ");
10088 q.pp(self.match)
10089 q.text(","); q.breakable()
10090 q.text("instructions = ");
10091 q.pp(self.instructions)
10092 q.breakable()
10093 q.text('}')
10094
Rich Lane7dcdf022013-12-11 14:45:27 -080010095flow_mod.subtypes[3] = flow_delete
10096
10097class flow_delete_strict(flow_mod):
Dan Talaycof6202252013-07-02 01:00:29 -070010098 version = 4
10099 type = 14
10100 _command = 4
Rich Lanec2ee4b82013-04-24 17:12:38 -070010101
10102 def __init__(self, xid=None, cookie=None, cookie_mask=None, table_id=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, out_group=None, flags=None, match=None, instructions=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080010103 if xid != None:
10104 self.xid = xid
10105 else:
10106 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070010107 if cookie != None:
10108 self.cookie = cookie
10109 else:
10110 self.cookie = 0
10111 if cookie_mask != None:
10112 self.cookie_mask = cookie_mask
10113 else:
10114 self.cookie_mask = 0
10115 if table_id != None:
10116 self.table_id = table_id
10117 else:
10118 self.table_id = 0
10119 if idle_timeout != None:
10120 self.idle_timeout = idle_timeout
10121 else:
10122 self.idle_timeout = 0
10123 if hard_timeout != None:
10124 self.hard_timeout = hard_timeout
10125 else:
10126 self.hard_timeout = 0
10127 if priority != None:
10128 self.priority = priority
10129 else:
10130 self.priority = 0
10131 if buffer_id != None:
10132 self.buffer_id = buffer_id
10133 else:
10134 self.buffer_id = 0
10135 if out_port != None:
10136 self.out_port = out_port
10137 else:
10138 self.out_port = 0
10139 if out_group != None:
10140 self.out_group = out_group
10141 else:
10142 self.out_group = 0
10143 if flags != None:
10144 self.flags = flags
10145 else:
10146 self.flags = 0
10147 if match != None:
10148 self.match = match
10149 else:
Rich Lanee2567702015-01-26 15:04:35 -080010150 self.match = ofp.match()
Rich Lanec2ee4b82013-04-24 17:12:38 -070010151 if instructions != None:
10152 self.instructions = instructions
10153 else:
10154 self.instructions = []
Rich Lane7dcdf022013-12-11 14:45:27 -080010155 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070010156
10157 def pack(self):
10158 packed = []
10159 packed.append(struct.pack("!B", self.version))
10160 packed.append(struct.pack("!B", self.type))
10161 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10162 packed.append(struct.pack("!L", self.xid))
10163 packed.append(struct.pack("!Q", self.cookie))
10164 packed.append(struct.pack("!Q", self.cookie_mask))
10165 packed.append(struct.pack("!B", self.table_id))
Dan Talaycof6202252013-07-02 01:00:29 -070010166 packed.append(util.pack_fm_cmd(self._command))
Rich Lanec2ee4b82013-04-24 17:12:38 -070010167 packed.append(struct.pack("!H", self.idle_timeout))
10168 packed.append(struct.pack("!H", self.hard_timeout))
10169 packed.append(struct.pack("!H", self.priority))
10170 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -070010171 packed.append(util.pack_port_no(self.out_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -070010172 packed.append(struct.pack("!L", self.out_group))
10173 packed.append(struct.pack("!H", self.flags))
10174 packed.append('\x00' * 2)
10175 packed.append(self.match.pack())
Rich Lane7dcdf022013-12-11 14:45:27 -080010176 packed.append(loxi.generic_util.pack_list(self.instructions))
Rich Lanec2ee4b82013-04-24 17:12:38 -070010177 length = sum([len(x) for x in packed])
10178 packed[2] = struct.pack("!H", length)
10179 return ''.join(packed)
10180
10181 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080010182 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070010183 obj = flow_delete_strict()
Dan Talaycof6202252013-07-02 01:00:29 -070010184 _version = reader.read("!B")[0]
10185 assert(_version == 4)
10186 _type = reader.read("!B")[0]
10187 assert(_type == 14)
10188 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080010189 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080010190 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070010191 obj.xid = reader.read("!L")[0]
10192 obj.cookie = reader.read("!Q")[0]
10193 obj.cookie_mask = reader.read("!Q")[0]
10194 obj.table_id = reader.read("!B")[0]
10195 __command = util.unpack_fm_cmd(reader)
10196 assert(__command == 4)
10197 obj.idle_timeout = reader.read("!H")[0]
10198 obj.hard_timeout = reader.read("!H")[0]
10199 obj.priority = reader.read("!H")[0]
10200 obj.buffer_id = reader.read("!L")[0]
10201 obj.out_port = util.unpack_port_no(reader)
10202 obj.out_group = reader.read("!L")[0]
10203 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010204 reader.skip(2)
Rich Lanee2567702015-01-26 15:04:35 -080010205 obj.match = ofp.match.unpack(reader)
10206 obj.instructions = loxi.generic_util.unpack_list(reader, ofp.instruction.instruction.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070010207 return obj
10208
10209 def __eq__(self, other):
10210 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070010211 if self.xid != other.xid: return False
10212 if self.cookie != other.cookie: return False
10213 if self.cookie_mask != other.cookie_mask: return False
10214 if self.table_id != other.table_id: return False
10215 if self.idle_timeout != other.idle_timeout: return False
10216 if self.hard_timeout != other.hard_timeout: return False
10217 if self.priority != other.priority: return False
10218 if self.buffer_id != other.buffer_id: return False
10219 if self.out_port != other.out_port: return False
10220 if self.out_group != other.out_group: return False
10221 if self.flags != other.flags: return False
10222 if self.match != other.match: return False
10223 if self.instructions != other.instructions: return False
10224 return True
10225
Rich Lanec2ee4b82013-04-24 17:12:38 -070010226 def pretty_print(self, q):
10227 q.text("flow_delete_strict {")
10228 with q.group():
10229 with q.indent(2):
10230 q.breakable()
10231 q.text("xid = ");
10232 if self.xid != None:
10233 q.text("%#x" % self.xid)
10234 else:
10235 q.text('None')
10236 q.text(","); q.breakable()
10237 q.text("cookie = ");
10238 q.text("%#x" % self.cookie)
10239 q.text(","); q.breakable()
10240 q.text("cookie_mask = ");
10241 q.text("%#x" % self.cookie_mask)
10242 q.text(","); q.breakable()
10243 q.text("table_id = ");
10244 q.text("%#x" % self.table_id)
10245 q.text(","); q.breakable()
10246 q.text("idle_timeout = ");
10247 q.text("%#x" % self.idle_timeout)
10248 q.text(","); q.breakable()
10249 q.text("hard_timeout = ");
10250 q.text("%#x" % self.hard_timeout)
10251 q.text(","); q.breakable()
10252 q.text("priority = ");
10253 q.text("%#x" % self.priority)
10254 q.text(","); q.breakable()
10255 q.text("buffer_id = ");
10256 q.text("%#x" % self.buffer_id)
10257 q.text(","); q.breakable()
10258 q.text("out_port = ");
10259 q.text(util.pretty_port(self.out_port))
10260 q.text(","); q.breakable()
10261 q.text("out_group = ");
10262 q.text("%#x" % self.out_group)
10263 q.text(","); q.breakable()
10264 q.text("flags = ");
10265 q.text("%#x" % self.flags)
10266 q.text(","); q.breakable()
10267 q.text("match = ");
10268 q.pp(self.match)
10269 q.text(","); q.breakable()
10270 q.text("instructions = ");
10271 q.pp(self.instructions)
10272 q.breakable()
10273 q.text('}')
10274
Rich Lane7dcdf022013-12-11 14:45:27 -080010275flow_mod.subtypes[4] = flow_delete_strict
10276
10277class flow_mod_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -070010278 version = 4
10279 type = 1
10280 err_type = 5
10281
10282 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080010283 if xid != None:
10284 self.xid = xid
10285 else:
10286 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -070010287 if code != None:
10288 self.code = code
10289 else:
10290 self.code = 0
10291 if data != None:
10292 self.data = data
10293 else:
10294 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080010295 return
Rich Lane6f4978c2013-10-20 21:33:52 -070010296
10297 def pack(self):
10298 packed = []
10299 packed.append(struct.pack("!B", self.version))
10300 packed.append(struct.pack("!B", self.type))
10301 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10302 packed.append(struct.pack("!L", self.xid))
10303 packed.append(struct.pack("!H", self.err_type))
10304 packed.append(struct.pack("!H", self.code))
10305 packed.append(self.data)
10306 length = sum([len(x) for x in packed])
10307 packed[2] = struct.pack("!H", length)
10308 return ''.join(packed)
10309
10310 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080010311 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -070010312 obj = flow_mod_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -070010313 _version = reader.read("!B")[0]
10314 assert(_version == 4)
10315 _type = reader.read("!B")[0]
10316 assert(_type == 1)
10317 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080010318 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080010319 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -070010320 obj.xid = reader.read("!L")[0]
10321 _err_type = reader.read("!H")[0]
10322 assert(_err_type == 5)
10323 obj.code = reader.read("!H")[0]
10324 obj.data = str(reader.read_all())
10325 return obj
10326
10327 def __eq__(self, other):
10328 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -070010329 if self.xid != other.xid: return False
10330 if self.code != other.code: return False
10331 if self.data != other.data: return False
10332 return True
10333
Rich Lane6f4978c2013-10-20 21:33:52 -070010334 def pretty_print(self, q):
10335 q.text("flow_mod_failed_error_msg {")
10336 with q.group():
10337 with q.indent(2):
10338 q.breakable()
10339 q.text("xid = ");
10340 if self.xid != None:
10341 q.text("%#x" % self.xid)
10342 else:
10343 q.text('None')
10344 q.text(","); q.breakable()
10345 q.text("code = ");
10346 q.text("%#x" % self.code)
10347 q.text(","); q.breakable()
10348 q.text("data = ");
10349 q.pp(self.data)
10350 q.breakable()
10351 q.text('}')
10352
Rich Lane7dcdf022013-12-11 14:45:27 -080010353error_msg.subtypes[5] = flow_mod_failed_error_msg
10354
10355class flow_modify(flow_mod):
Dan Talaycof6202252013-07-02 01:00:29 -070010356 version = 4
10357 type = 14
10358 _command = 1
Rich Lanec2ee4b82013-04-24 17:12:38 -070010359
10360 def __init__(self, xid=None, cookie=None, cookie_mask=None, table_id=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, out_group=None, flags=None, match=None, instructions=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080010361 if xid != None:
10362 self.xid = xid
10363 else:
10364 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070010365 if cookie != None:
10366 self.cookie = cookie
10367 else:
10368 self.cookie = 0
10369 if cookie_mask != None:
10370 self.cookie_mask = cookie_mask
10371 else:
10372 self.cookie_mask = 0
10373 if table_id != None:
10374 self.table_id = table_id
10375 else:
10376 self.table_id = 0
10377 if idle_timeout != None:
10378 self.idle_timeout = idle_timeout
10379 else:
10380 self.idle_timeout = 0
10381 if hard_timeout != None:
10382 self.hard_timeout = hard_timeout
10383 else:
10384 self.hard_timeout = 0
10385 if priority != None:
10386 self.priority = priority
10387 else:
10388 self.priority = 0
10389 if buffer_id != None:
10390 self.buffer_id = buffer_id
10391 else:
10392 self.buffer_id = 0
10393 if out_port != None:
10394 self.out_port = out_port
10395 else:
10396 self.out_port = 0
10397 if out_group != None:
10398 self.out_group = out_group
10399 else:
10400 self.out_group = 0
10401 if flags != None:
10402 self.flags = flags
10403 else:
10404 self.flags = 0
10405 if match != None:
10406 self.match = match
10407 else:
Rich Lanee2567702015-01-26 15:04:35 -080010408 self.match = ofp.match()
Rich Lanec2ee4b82013-04-24 17:12:38 -070010409 if instructions != None:
10410 self.instructions = instructions
10411 else:
10412 self.instructions = []
Rich Lane7dcdf022013-12-11 14:45:27 -080010413 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070010414
10415 def pack(self):
10416 packed = []
10417 packed.append(struct.pack("!B", self.version))
10418 packed.append(struct.pack("!B", self.type))
10419 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10420 packed.append(struct.pack("!L", self.xid))
10421 packed.append(struct.pack("!Q", self.cookie))
10422 packed.append(struct.pack("!Q", self.cookie_mask))
10423 packed.append(struct.pack("!B", self.table_id))
Dan Talaycof6202252013-07-02 01:00:29 -070010424 packed.append(util.pack_fm_cmd(self._command))
Rich Lanec2ee4b82013-04-24 17:12:38 -070010425 packed.append(struct.pack("!H", self.idle_timeout))
10426 packed.append(struct.pack("!H", self.hard_timeout))
10427 packed.append(struct.pack("!H", self.priority))
10428 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -070010429 packed.append(util.pack_port_no(self.out_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -070010430 packed.append(struct.pack("!L", self.out_group))
10431 packed.append(struct.pack("!H", self.flags))
10432 packed.append('\x00' * 2)
10433 packed.append(self.match.pack())
Rich Lane7dcdf022013-12-11 14:45:27 -080010434 packed.append(loxi.generic_util.pack_list(self.instructions))
Rich Lanec2ee4b82013-04-24 17:12:38 -070010435 length = sum([len(x) for x in packed])
10436 packed[2] = struct.pack("!H", length)
10437 return ''.join(packed)
10438
10439 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080010440 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070010441 obj = flow_modify()
Dan Talaycof6202252013-07-02 01:00:29 -070010442 _version = reader.read("!B")[0]
10443 assert(_version == 4)
10444 _type = reader.read("!B")[0]
10445 assert(_type == 14)
10446 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080010447 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080010448 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070010449 obj.xid = reader.read("!L")[0]
10450 obj.cookie = reader.read("!Q")[0]
10451 obj.cookie_mask = reader.read("!Q")[0]
10452 obj.table_id = reader.read("!B")[0]
10453 __command = util.unpack_fm_cmd(reader)
10454 assert(__command == 1)
10455 obj.idle_timeout = reader.read("!H")[0]
10456 obj.hard_timeout = reader.read("!H")[0]
10457 obj.priority = reader.read("!H")[0]
10458 obj.buffer_id = reader.read("!L")[0]
10459 obj.out_port = util.unpack_port_no(reader)
10460 obj.out_group = reader.read("!L")[0]
10461 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010462 reader.skip(2)
Rich Lanee2567702015-01-26 15:04:35 -080010463 obj.match = ofp.match.unpack(reader)
10464 obj.instructions = loxi.generic_util.unpack_list(reader, ofp.instruction.instruction.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070010465 return obj
10466
10467 def __eq__(self, other):
10468 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070010469 if self.xid != other.xid: return False
10470 if self.cookie != other.cookie: return False
10471 if self.cookie_mask != other.cookie_mask: return False
10472 if self.table_id != other.table_id: return False
10473 if self.idle_timeout != other.idle_timeout: return False
10474 if self.hard_timeout != other.hard_timeout: return False
10475 if self.priority != other.priority: return False
10476 if self.buffer_id != other.buffer_id: return False
10477 if self.out_port != other.out_port: return False
10478 if self.out_group != other.out_group: return False
10479 if self.flags != other.flags: return False
10480 if self.match != other.match: return False
10481 if self.instructions != other.instructions: return False
10482 return True
10483
Rich Lanec2ee4b82013-04-24 17:12:38 -070010484 def pretty_print(self, q):
10485 q.text("flow_modify {")
10486 with q.group():
10487 with q.indent(2):
10488 q.breakable()
10489 q.text("xid = ");
10490 if self.xid != None:
10491 q.text("%#x" % self.xid)
10492 else:
10493 q.text('None')
10494 q.text(","); q.breakable()
10495 q.text("cookie = ");
10496 q.text("%#x" % self.cookie)
10497 q.text(","); q.breakable()
10498 q.text("cookie_mask = ");
10499 q.text("%#x" % self.cookie_mask)
10500 q.text(","); q.breakable()
10501 q.text("table_id = ");
10502 q.text("%#x" % self.table_id)
10503 q.text(","); q.breakable()
10504 q.text("idle_timeout = ");
10505 q.text("%#x" % self.idle_timeout)
10506 q.text(","); q.breakable()
10507 q.text("hard_timeout = ");
10508 q.text("%#x" % self.hard_timeout)
10509 q.text(","); q.breakable()
10510 q.text("priority = ");
10511 q.text("%#x" % self.priority)
10512 q.text(","); q.breakable()
10513 q.text("buffer_id = ");
10514 q.text("%#x" % self.buffer_id)
10515 q.text(","); q.breakable()
10516 q.text("out_port = ");
10517 q.text(util.pretty_port(self.out_port))
10518 q.text(","); q.breakable()
10519 q.text("out_group = ");
10520 q.text("%#x" % self.out_group)
10521 q.text(","); q.breakable()
10522 q.text("flags = ");
10523 q.text("%#x" % self.flags)
10524 q.text(","); q.breakable()
10525 q.text("match = ");
10526 q.pp(self.match)
10527 q.text(","); q.breakable()
10528 q.text("instructions = ");
10529 q.pp(self.instructions)
10530 q.breakable()
10531 q.text('}')
10532
Rich Lane7dcdf022013-12-11 14:45:27 -080010533flow_mod.subtypes[1] = flow_modify
10534
10535class flow_modify_strict(flow_mod):
Dan Talaycof6202252013-07-02 01:00:29 -070010536 version = 4
10537 type = 14
10538 _command = 2
Rich Lanec2ee4b82013-04-24 17:12:38 -070010539
10540 def __init__(self, xid=None, cookie=None, cookie_mask=None, table_id=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, out_group=None, flags=None, match=None, instructions=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080010541 if xid != None:
10542 self.xid = xid
10543 else:
10544 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070010545 if cookie != None:
10546 self.cookie = cookie
10547 else:
10548 self.cookie = 0
10549 if cookie_mask != None:
10550 self.cookie_mask = cookie_mask
10551 else:
10552 self.cookie_mask = 0
10553 if table_id != None:
10554 self.table_id = table_id
10555 else:
10556 self.table_id = 0
10557 if idle_timeout != None:
10558 self.idle_timeout = idle_timeout
10559 else:
10560 self.idle_timeout = 0
10561 if hard_timeout != None:
10562 self.hard_timeout = hard_timeout
10563 else:
10564 self.hard_timeout = 0
10565 if priority != None:
10566 self.priority = priority
10567 else:
10568 self.priority = 0
10569 if buffer_id != None:
10570 self.buffer_id = buffer_id
10571 else:
10572 self.buffer_id = 0
10573 if out_port != None:
10574 self.out_port = out_port
10575 else:
10576 self.out_port = 0
10577 if out_group != None:
10578 self.out_group = out_group
10579 else:
10580 self.out_group = 0
10581 if flags != None:
10582 self.flags = flags
10583 else:
10584 self.flags = 0
10585 if match != None:
10586 self.match = match
10587 else:
Rich Lanee2567702015-01-26 15:04:35 -080010588 self.match = ofp.match()
Rich Lanec2ee4b82013-04-24 17:12:38 -070010589 if instructions != None:
10590 self.instructions = instructions
10591 else:
10592 self.instructions = []
Rich Lane7dcdf022013-12-11 14:45:27 -080010593 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070010594
10595 def pack(self):
10596 packed = []
10597 packed.append(struct.pack("!B", self.version))
10598 packed.append(struct.pack("!B", self.type))
10599 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10600 packed.append(struct.pack("!L", self.xid))
10601 packed.append(struct.pack("!Q", self.cookie))
10602 packed.append(struct.pack("!Q", self.cookie_mask))
10603 packed.append(struct.pack("!B", self.table_id))
Dan Talaycof6202252013-07-02 01:00:29 -070010604 packed.append(util.pack_fm_cmd(self._command))
Rich Lanec2ee4b82013-04-24 17:12:38 -070010605 packed.append(struct.pack("!H", self.idle_timeout))
10606 packed.append(struct.pack("!H", self.hard_timeout))
10607 packed.append(struct.pack("!H", self.priority))
10608 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -070010609 packed.append(util.pack_port_no(self.out_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -070010610 packed.append(struct.pack("!L", self.out_group))
10611 packed.append(struct.pack("!H", self.flags))
10612 packed.append('\x00' * 2)
10613 packed.append(self.match.pack())
Rich Lane7dcdf022013-12-11 14:45:27 -080010614 packed.append(loxi.generic_util.pack_list(self.instructions))
Rich Lanec2ee4b82013-04-24 17:12:38 -070010615 length = sum([len(x) for x in packed])
10616 packed[2] = struct.pack("!H", length)
10617 return ''.join(packed)
10618
10619 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080010620 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070010621 obj = flow_modify_strict()
Dan Talaycof6202252013-07-02 01:00:29 -070010622 _version = reader.read("!B")[0]
10623 assert(_version == 4)
10624 _type = reader.read("!B")[0]
10625 assert(_type == 14)
10626 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080010627 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080010628 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070010629 obj.xid = reader.read("!L")[0]
10630 obj.cookie = reader.read("!Q")[0]
10631 obj.cookie_mask = reader.read("!Q")[0]
10632 obj.table_id = reader.read("!B")[0]
10633 __command = util.unpack_fm_cmd(reader)
10634 assert(__command == 2)
10635 obj.idle_timeout = reader.read("!H")[0]
10636 obj.hard_timeout = reader.read("!H")[0]
10637 obj.priority = reader.read("!H")[0]
10638 obj.buffer_id = reader.read("!L")[0]
10639 obj.out_port = util.unpack_port_no(reader)
10640 obj.out_group = reader.read("!L")[0]
10641 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010642 reader.skip(2)
Rich Lanee2567702015-01-26 15:04:35 -080010643 obj.match = ofp.match.unpack(reader)
10644 obj.instructions = loxi.generic_util.unpack_list(reader, ofp.instruction.instruction.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070010645 return obj
10646
10647 def __eq__(self, other):
10648 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070010649 if self.xid != other.xid: return False
10650 if self.cookie != other.cookie: return False
10651 if self.cookie_mask != other.cookie_mask: return False
10652 if self.table_id != other.table_id: return False
10653 if self.idle_timeout != other.idle_timeout: return False
10654 if self.hard_timeout != other.hard_timeout: return False
10655 if self.priority != other.priority: return False
10656 if self.buffer_id != other.buffer_id: return False
10657 if self.out_port != other.out_port: return False
10658 if self.out_group != other.out_group: return False
10659 if self.flags != other.flags: return False
10660 if self.match != other.match: return False
10661 if self.instructions != other.instructions: return False
10662 return True
10663
Rich Lanec2ee4b82013-04-24 17:12:38 -070010664 def pretty_print(self, q):
10665 q.text("flow_modify_strict {")
10666 with q.group():
10667 with q.indent(2):
10668 q.breakable()
10669 q.text("xid = ");
10670 if self.xid != None:
10671 q.text("%#x" % self.xid)
10672 else:
10673 q.text('None')
10674 q.text(","); q.breakable()
10675 q.text("cookie = ");
10676 q.text("%#x" % self.cookie)
10677 q.text(","); q.breakable()
10678 q.text("cookie_mask = ");
10679 q.text("%#x" % self.cookie_mask)
10680 q.text(","); q.breakable()
10681 q.text("table_id = ");
10682 q.text("%#x" % self.table_id)
10683 q.text(","); q.breakable()
10684 q.text("idle_timeout = ");
10685 q.text("%#x" % self.idle_timeout)
10686 q.text(","); q.breakable()
10687 q.text("hard_timeout = ");
10688 q.text("%#x" % self.hard_timeout)
10689 q.text(","); q.breakable()
10690 q.text("priority = ");
10691 q.text("%#x" % self.priority)
10692 q.text(","); q.breakable()
10693 q.text("buffer_id = ");
10694 q.text("%#x" % self.buffer_id)
10695 q.text(","); q.breakable()
10696 q.text("out_port = ");
10697 q.text(util.pretty_port(self.out_port))
10698 q.text(","); q.breakable()
10699 q.text("out_group = ");
10700 q.text("%#x" % self.out_group)
10701 q.text(","); q.breakable()
10702 q.text("flags = ");
10703 q.text("%#x" % self.flags)
10704 q.text(","); q.breakable()
10705 q.text("match = ");
10706 q.pp(self.match)
10707 q.text(","); q.breakable()
10708 q.text("instructions = ");
10709 q.pp(self.instructions)
10710 q.breakable()
10711 q.text('}')
10712
Rich Lane7dcdf022013-12-11 14:45:27 -080010713flow_mod.subtypes[2] = flow_modify_strict
10714
10715class flow_removed(message):
Dan Talaycof6202252013-07-02 01:00:29 -070010716 version = 4
10717 type = 11
Rich Lanec2ee4b82013-04-24 17:12:38 -070010718
10719 def __init__(self, xid=None, cookie=None, priority=None, reason=None, table_id=None, duration_sec=None, duration_nsec=None, idle_timeout=None, hard_timeout=None, packet_count=None, byte_count=None, match=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080010720 if xid != None:
10721 self.xid = xid
10722 else:
10723 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070010724 if cookie != None:
10725 self.cookie = cookie
10726 else:
10727 self.cookie = 0
10728 if priority != None:
10729 self.priority = priority
10730 else:
10731 self.priority = 0
10732 if reason != None:
10733 self.reason = reason
10734 else:
10735 self.reason = 0
10736 if table_id != None:
10737 self.table_id = table_id
10738 else:
10739 self.table_id = 0
10740 if duration_sec != None:
10741 self.duration_sec = duration_sec
10742 else:
10743 self.duration_sec = 0
10744 if duration_nsec != None:
10745 self.duration_nsec = duration_nsec
10746 else:
10747 self.duration_nsec = 0
10748 if idle_timeout != None:
10749 self.idle_timeout = idle_timeout
10750 else:
10751 self.idle_timeout = 0
10752 if hard_timeout != None:
10753 self.hard_timeout = hard_timeout
10754 else:
10755 self.hard_timeout = 0
10756 if packet_count != None:
10757 self.packet_count = packet_count
10758 else:
10759 self.packet_count = 0
10760 if byte_count != None:
10761 self.byte_count = byte_count
10762 else:
10763 self.byte_count = 0
10764 if match != None:
10765 self.match = match
10766 else:
Rich Lanee2567702015-01-26 15:04:35 -080010767 self.match = ofp.match()
Rich Lane7dcdf022013-12-11 14:45:27 -080010768 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070010769
10770 def pack(self):
10771 packed = []
10772 packed.append(struct.pack("!B", self.version))
10773 packed.append(struct.pack("!B", self.type))
10774 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10775 packed.append(struct.pack("!L", self.xid))
10776 packed.append(struct.pack("!Q", self.cookie))
10777 packed.append(struct.pack("!H", self.priority))
10778 packed.append(struct.pack("!B", self.reason))
10779 packed.append(struct.pack("!B", self.table_id))
10780 packed.append(struct.pack("!L", self.duration_sec))
10781 packed.append(struct.pack("!L", self.duration_nsec))
10782 packed.append(struct.pack("!H", self.idle_timeout))
10783 packed.append(struct.pack("!H", self.hard_timeout))
10784 packed.append(struct.pack("!Q", self.packet_count))
10785 packed.append(struct.pack("!Q", self.byte_count))
10786 packed.append(self.match.pack())
10787 length = sum([len(x) for x in packed])
10788 packed[2] = struct.pack("!H", length)
10789 return ''.join(packed)
10790
10791 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080010792 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070010793 obj = flow_removed()
Dan Talaycof6202252013-07-02 01:00:29 -070010794 _version = reader.read("!B")[0]
10795 assert(_version == 4)
10796 _type = reader.read("!B")[0]
10797 assert(_type == 11)
10798 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080010799 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080010800 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070010801 obj.xid = reader.read("!L")[0]
10802 obj.cookie = reader.read("!Q")[0]
10803 obj.priority = reader.read("!H")[0]
10804 obj.reason = reader.read("!B")[0]
10805 obj.table_id = reader.read("!B")[0]
10806 obj.duration_sec = reader.read("!L")[0]
10807 obj.duration_nsec = reader.read("!L")[0]
10808 obj.idle_timeout = reader.read("!H")[0]
10809 obj.hard_timeout = reader.read("!H")[0]
10810 obj.packet_count = reader.read("!Q")[0]
10811 obj.byte_count = reader.read("!Q")[0]
Rich Lanee2567702015-01-26 15:04:35 -080010812 obj.match = ofp.match.unpack(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -070010813 return obj
10814
10815 def __eq__(self, other):
10816 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070010817 if self.xid != other.xid: return False
10818 if self.cookie != other.cookie: return False
10819 if self.priority != other.priority: return False
10820 if self.reason != other.reason: return False
10821 if self.table_id != other.table_id: return False
10822 if self.duration_sec != other.duration_sec: return False
10823 if self.duration_nsec != other.duration_nsec: return False
10824 if self.idle_timeout != other.idle_timeout: return False
10825 if self.hard_timeout != other.hard_timeout: return False
10826 if self.packet_count != other.packet_count: return False
10827 if self.byte_count != other.byte_count: return False
10828 if self.match != other.match: return False
10829 return True
10830
Rich Lanec2ee4b82013-04-24 17:12:38 -070010831 def pretty_print(self, q):
10832 q.text("flow_removed {")
10833 with q.group():
10834 with q.indent(2):
10835 q.breakable()
10836 q.text("xid = ");
10837 if self.xid != None:
10838 q.text("%#x" % self.xid)
10839 else:
10840 q.text('None')
10841 q.text(","); q.breakable()
10842 q.text("cookie = ");
10843 q.text("%#x" % self.cookie)
10844 q.text(","); q.breakable()
10845 q.text("priority = ");
10846 q.text("%#x" % self.priority)
10847 q.text(","); q.breakable()
10848 q.text("reason = ");
10849 q.text("%#x" % self.reason)
10850 q.text(","); q.breakable()
10851 q.text("table_id = ");
10852 q.text("%#x" % self.table_id)
10853 q.text(","); q.breakable()
10854 q.text("duration_sec = ");
10855 q.text("%#x" % self.duration_sec)
10856 q.text(","); q.breakable()
10857 q.text("duration_nsec = ");
10858 q.text("%#x" % self.duration_nsec)
10859 q.text(","); q.breakable()
10860 q.text("idle_timeout = ");
10861 q.text("%#x" % self.idle_timeout)
10862 q.text(","); q.breakable()
10863 q.text("hard_timeout = ");
10864 q.text("%#x" % self.hard_timeout)
10865 q.text(","); q.breakable()
10866 q.text("packet_count = ");
10867 q.text("%#x" % self.packet_count)
10868 q.text(","); q.breakable()
10869 q.text("byte_count = ");
10870 q.text("%#x" % self.byte_count)
10871 q.text(","); q.breakable()
10872 q.text("match = ");
10873 q.pp(self.match)
10874 q.breakable()
10875 q.text('}')
10876
Rich Lane7dcdf022013-12-11 14:45:27 -080010877message.subtypes[11] = flow_removed
10878
10879class flow_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070010880 version = 4
10881 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070010882 stats_type = 1
10883
10884 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080010885 if xid != None:
10886 self.xid = xid
10887 else:
10888 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070010889 if flags != None:
10890 self.flags = flags
10891 else:
10892 self.flags = 0
10893 if entries != None:
10894 self.entries = entries
10895 else:
10896 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -080010897 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070010898
10899 def pack(self):
10900 packed = []
10901 packed.append(struct.pack("!B", self.version))
10902 packed.append(struct.pack("!B", self.type))
10903 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10904 packed.append(struct.pack("!L", self.xid))
10905 packed.append(struct.pack("!H", self.stats_type))
10906 packed.append(struct.pack("!H", self.flags))
10907 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080010908 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -070010909 length = sum([len(x) for x in packed])
10910 packed[2] = struct.pack("!H", length)
10911 return ''.join(packed)
10912
10913 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080010914 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070010915 obj = flow_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070010916 _version = reader.read("!B")[0]
10917 assert(_version == 4)
10918 _type = reader.read("!B")[0]
10919 assert(_type == 19)
10920 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080010921 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080010922 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070010923 obj.xid = reader.read("!L")[0]
10924 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010925 assert(_stats_type == 1)
Dan Talaycof6202252013-07-02 01:00:29 -070010926 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010927 reader.skip(4)
Rich Lanee2567702015-01-26 15:04:35 -080010928 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.flow_stats_entry.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070010929 return obj
10930
10931 def __eq__(self, other):
10932 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070010933 if self.xid != other.xid: return False
10934 if self.flags != other.flags: return False
10935 if self.entries != other.entries: return False
10936 return True
10937
Rich Lanec2ee4b82013-04-24 17:12:38 -070010938 def pretty_print(self, q):
10939 q.text("flow_stats_reply {")
10940 with q.group():
10941 with q.indent(2):
10942 q.breakable()
10943 q.text("xid = ");
10944 if self.xid != None:
10945 q.text("%#x" % self.xid)
10946 else:
10947 q.text('None')
10948 q.text(","); q.breakable()
10949 q.text("flags = ");
10950 q.text("%#x" % self.flags)
10951 q.text(","); q.breakable()
10952 q.text("entries = ");
10953 q.pp(self.entries)
10954 q.breakable()
10955 q.text('}')
10956
Rich Lane7dcdf022013-12-11 14:45:27 -080010957stats_reply.subtypes[1] = flow_stats_reply
10958
10959class flow_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070010960 version = 4
10961 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070010962 stats_type = 1
10963
10964 def __init__(self, xid=None, flags=None, table_id=None, out_port=None, out_group=None, cookie=None, cookie_mask=None, match=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080010965 if xid != None:
10966 self.xid = xid
10967 else:
10968 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070010969 if flags != None:
10970 self.flags = flags
10971 else:
10972 self.flags = 0
10973 if table_id != None:
10974 self.table_id = table_id
10975 else:
10976 self.table_id = 0
10977 if out_port != None:
10978 self.out_port = out_port
10979 else:
10980 self.out_port = 0
10981 if out_group != None:
10982 self.out_group = out_group
10983 else:
10984 self.out_group = 0
10985 if cookie != None:
10986 self.cookie = cookie
10987 else:
10988 self.cookie = 0
10989 if cookie_mask != None:
10990 self.cookie_mask = cookie_mask
10991 else:
10992 self.cookie_mask = 0
10993 if match != None:
10994 self.match = match
10995 else:
Rich Lanee2567702015-01-26 15:04:35 -080010996 self.match = ofp.match()
Rich Lane7dcdf022013-12-11 14:45:27 -080010997 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070010998
10999 def pack(self):
11000 packed = []
11001 packed.append(struct.pack("!B", self.version))
11002 packed.append(struct.pack("!B", self.type))
11003 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11004 packed.append(struct.pack("!L", self.xid))
11005 packed.append(struct.pack("!H", self.stats_type))
11006 packed.append(struct.pack("!H", self.flags))
11007 packed.append('\x00' * 4)
11008 packed.append(struct.pack("!B", self.table_id))
11009 packed.append('\x00' * 3)
Dan Talaycof6202252013-07-02 01:00:29 -070011010 packed.append(util.pack_port_no(self.out_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -070011011 packed.append(struct.pack("!L", self.out_group))
11012 packed.append('\x00' * 4)
11013 packed.append(struct.pack("!Q", self.cookie))
11014 packed.append(struct.pack("!Q", self.cookie_mask))
11015 packed.append(self.match.pack())
11016 length = sum([len(x) for x in packed])
11017 packed[2] = struct.pack("!H", length)
11018 return ''.join(packed)
11019
11020 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080011021 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070011022 obj = flow_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070011023 _version = reader.read("!B")[0]
11024 assert(_version == 4)
11025 _type = reader.read("!B")[0]
11026 assert(_type == 18)
11027 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011028 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080011029 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070011030 obj.xid = reader.read("!L")[0]
11031 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011032 assert(_stats_type == 1)
Dan Talaycof6202252013-07-02 01:00:29 -070011033 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011034 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -070011035 obj.table_id = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011036 reader.skip(3)
Dan Talaycof6202252013-07-02 01:00:29 -070011037 obj.out_port = util.unpack_port_no(reader)
11038 obj.out_group = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011039 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -070011040 obj.cookie = reader.read("!Q")[0]
11041 obj.cookie_mask = reader.read("!Q")[0]
Rich Lanee2567702015-01-26 15:04:35 -080011042 obj.match = ofp.match.unpack(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -070011043 return obj
11044
11045 def __eq__(self, other):
11046 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070011047 if self.xid != other.xid: return False
11048 if self.flags != other.flags: return False
11049 if self.table_id != other.table_id: return False
11050 if self.out_port != other.out_port: return False
11051 if self.out_group != other.out_group: return False
11052 if self.cookie != other.cookie: return False
11053 if self.cookie_mask != other.cookie_mask: return False
11054 if self.match != other.match: return False
11055 return True
11056
Rich Lanec2ee4b82013-04-24 17:12:38 -070011057 def pretty_print(self, q):
11058 q.text("flow_stats_request {")
11059 with q.group():
11060 with q.indent(2):
11061 q.breakable()
11062 q.text("xid = ");
11063 if self.xid != None:
11064 q.text("%#x" % self.xid)
11065 else:
11066 q.text('None')
11067 q.text(","); q.breakable()
11068 q.text("flags = ");
11069 q.text("%#x" % self.flags)
11070 q.text(","); q.breakable()
11071 q.text("table_id = ");
11072 q.text("%#x" % self.table_id)
11073 q.text(","); q.breakable()
11074 q.text("out_port = ");
11075 q.text(util.pretty_port(self.out_port))
11076 q.text(","); q.breakable()
11077 q.text("out_group = ");
11078 q.text("%#x" % self.out_group)
11079 q.text(","); q.breakable()
11080 q.text("cookie = ");
11081 q.text("%#x" % self.cookie)
11082 q.text(","); q.breakable()
11083 q.text("cookie_mask = ");
11084 q.text("%#x" % self.cookie_mask)
11085 q.text(","); q.breakable()
11086 q.text("match = ");
11087 q.pp(self.match)
11088 q.breakable()
11089 q.text('}')
11090
Rich Lane7dcdf022013-12-11 14:45:27 -080011091stats_request.subtypes[1] = flow_stats_request
11092
11093class get_config_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -070011094 version = 4
11095 type = 8
Rich Lanec2ee4b82013-04-24 17:12:38 -070011096
11097 def __init__(self, xid=None, flags=None, miss_send_len=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080011098 if xid != None:
11099 self.xid = xid
11100 else:
11101 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070011102 if flags != None:
11103 self.flags = flags
11104 else:
11105 self.flags = 0
11106 if miss_send_len != None:
11107 self.miss_send_len = miss_send_len
11108 else:
11109 self.miss_send_len = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080011110 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070011111
11112 def pack(self):
11113 packed = []
11114 packed.append(struct.pack("!B", self.version))
11115 packed.append(struct.pack("!B", self.type))
11116 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11117 packed.append(struct.pack("!L", self.xid))
11118 packed.append(struct.pack("!H", self.flags))
11119 packed.append(struct.pack("!H", self.miss_send_len))
11120 length = sum([len(x) for x in packed])
11121 packed[2] = struct.pack("!H", length)
11122 return ''.join(packed)
11123
11124 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080011125 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070011126 obj = get_config_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070011127 _version = reader.read("!B")[0]
11128 assert(_version == 4)
11129 _type = reader.read("!B")[0]
11130 assert(_type == 8)
11131 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011132 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080011133 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070011134 obj.xid = reader.read("!L")[0]
11135 obj.flags = reader.read("!H")[0]
11136 obj.miss_send_len = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011137 return obj
11138
11139 def __eq__(self, other):
11140 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070011141 if self.xid != other.xid: return False
11142 if self.flags != other.flags: return False
11143 if self.miss_send_len != other.miss_send_len: return False
11144 return True
11145
Rich Lanec2ee4b82013-04-24 17:12:38 -070011146 def pretty_print(self, q):
11147 q.text("get_config_reply {")
11148 with q.group():
11149 with q.indent(2):
11150 q.breakable()
11151 q.text("xid = ");
11152 if self.xid != None:
11153 q.text("%#x" % self.xid)
11154 else:
11155 q.text('None')
11156 q.text(","); q.breakable()
11157 q.text("flags = ");
11158 q.text("%#x" % self.flags)
11159 q.text(","); q.breakable()
11160 q.text("miss_send_len = ");
11161 q.text("%#x" % self.miss_send_len)
11162 q.breakable()
11163 q.text('}')
11164
Rich Lane7dcdf022013-12-11 14:45:27 -080011165message.subtypes[8] = get_config_reply
11166
11167class get_config_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -070011168 version = 4
11169 type = 7
Rich Lanec2ee4b82013-04-24 17:12:38 -070011170
11171 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080011172 if xid != None:
11173 self.xid = xid
11174 else:
11175 self.xid = None
11176 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070011177
11178 def pack(self):
11179 packed = []
11180 packed.append(struct.pack("!B", self.version))
11181 packed.append(struct.pack("!B", self.type))
11182 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11183 packed.append(struct.pack("!L", self.xid))
11184 length = sum([len(x) for x in packed])
11185 packed[2] = struct.pack("!H", length)
11186 return ''.join(packed)
11187
11188 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080011189 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070011190 obj = get_config_request()
Dan Talaycof6202252013-07-02 01:00:29 -070011191 _version = reader.read("!B")[0]
11192 assert(_version == 4)
11193 _type = reader.read("!B")[0]
11194 assert(_type == 7)
11195 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011196 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080011197 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070011198 obj.xid = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011199 return obj
11200
11201 def __eq__(self, other):
11202 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070011203 if self.xid != other.xid: return False
11204 return True
11205
Rich Lanec2ee4b82013-04-24 17:12:38 -070011206 def pretty_print(self, q):
11207 q.text("get_config_request {")
11208 with q.group():
11209 with q.indent(2):
11210 q.breakable()
11211 q.text("xid = ");
11212 if self.xid != None:
11213 q.text("%#x" % self.xid)
11214 else:
11215 q.text('None')
11216 q.breakable()
11217 q.text('}')
11218
Rich Lane7dcdf022013-12-11 14:45:27 -080011219message.subtypes[7] = get_config_request
11220
11221class group_mod(message):
11222 subtypes = {}
11223
Rich Lane95f7fc92014-01-27 17:08:16 -080011224 version = 4
11225 type = 15
11226
11227 def __init__(self, xid=None, command=None, group_type=None, group_id=None, buckets=None):
11228 if xid != None:
11229 self.xid = xid
11230 else:
11231 self.xid = None
11232 if command != None:
11233 self.command = command
11234 else:
11235 self.command = 0
11236 if group_type != None:
11237 self.group_type = group_type
11238 else:
11239 self.group_type = 0
11240 if group_id != None:
11241 self.group_id = group_id
11242 else:
11243 self.group_id = 0
11244 if buckets != None:
11245 self.buckets = buckets
11246 else:
11247 self.buckets = []
11248 return
11249
11250 def pack(self):
11251 packed = []
11252 packed.append(struct.pack("!B", self.version))
11253 packed.append(struct.pack("!B", self.type))
11254 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11255 packed.append(struct.pack("!L", self.xid))
11256 packed.append(struct.pack("!H", self.command))
11257 packed.append(struct.pack("!B", self.group_type))
11258 packed.append('\x00' * 1)
11259 packed.append(struct.pack("!L", self.group_id))
11260 packed.append(loxi.generic_util.pack_list(self.buckets))
11261 length = sum([len(x) for x in packed])
11262 packed[2] = struct.pack("!H", length)
11263 return ''.join(packed)
11264
Rich Lane7dcdf022013-12-11 14:45:27 -080011265 @staticmethod
11266 def unpack(reader):
11267 subtype, = reader.peek('!H', 8)
Rich Lane95f7fc92014-01-27 17:08:16 -080011268 subclass = group_mod.subtypes.get(subtype)
11269 if subclass:
11270 return subclass.unpack(reader)
11271
11272 obj = group_mod()
11273 _version = reader.read("!B")[0]
11274 assert(_version == 4)
11275 _type = reader.read("!B")[0]
11276 assert(_type == 15)
11277 _length = reader.read("!H")[0]
11278 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080011279 reader = orig_reader.slice(_length, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -080011280 obj.xid = reader.read("!L")[0]
11281 obj.command = reader.read("!H")[0]
11282 obj.group_type = reader.read("!B")[0]
11283 reader.skip(1)
11284 obj.group_id = reader.read("!L")[0]
Rich Lanee2567702015-01-26 15:04:35 -080011285 obj.buckets = loxi.generic_util.unpack_list(reader, ofp.common.bucket.unpack)
Rich Lane95f7fc92014-01-27 17:08:16 -080011286 return obj
11287
11288 def __eq__(self, other):
11289 if type(self) != type(other): return False
11290 if self.xid != other.xid: return False
11291 if self.command != other.command: return False
11292 if self.group_type != other.group_type: return False
11293 if self.group_id != other.group_id: return False
11294 if self.buckets != other.buckets: return False
11295 return True
11296
11297 def pretty_print(self, q):
11298 q.text("group_mod {")
11299 with q.group():
11300 with q.indent(2):
11301 q.breakable()
11302 q.text("xid = ");
11303 if self.xid != None:
11304 q.text("%#x" % self.xid)
11305 else:
11306 q.text('None')
11307 q.text(","); q.breakable()
11308 q.text("group_type = ");
11309 q.text("%#x" % self.group_type)
11310 q.text(","); q.breakable()
11311 q.text("group_id = ");
11312 q.text("%#x" % self.group_id)
11313 q.text(","); q.breakable()
11314 q.text("buckets = ");
11315 q.pp(self.buckets)
11316 q.breakable()
11317 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -080011318
11319message.subtypes[15] = group_mod
11320
11321class group_add(group_mod):
Rich Lane7b0f2012013-11-22 14:15:26 -080011322 version = 4
11323 type = 15
11324 command = 0
11325
11326 def __init__(self, xid=None, group_type=None, group_id=None, buckets=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080011327 if xid != None:
11328 self.xid = xid
11329 else:
11330 self.xid = None
Rich Lane7b0f2012013-11-22 14:15:26 -080011331 if group_type != None:
11332 self.group_type = group_type
11333 else:
11334 self.group_type = 0
11335 if group_id != None:
11336 self.group_id = group_id
11337 else:
11338 self.group_id = 0
11339 if buckets != None:
11340 self.buckets = buckets
11341 else:
11342 self.buckets = []
Rich Lane7dcdf022013-12-11 14:45:27 -080011343 return
Rich Lane7b0f2012013-11-22 14:15:26 -080011344
11345 def pack(self):
11346 packed = []
11347 packed.append(struct.pack("!B", self.version))
11348 packed.append(struct.pack("!B", self.type))
11349 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11350 packed.append(struct.pack("!L", self.xid))
11351 packed.append(struct.pack("!H", self.command))
11352 packed.append(struct.pack("!B", self.group_type))
11353 packed.append('\x00' * 1)
11354 packed.append(struct.pack("!L", self.group_id))
Rich Lane7dcdf022013-12-11 14:45:27 -080011355 packed.append(loxi.generic_util.pack_list(self.buckets))
Rich Lane7b0f2012013-11-22 14:15:26 -080011356 length = sum([len(x) for x in packed])
11357 packed[2] = struct.pack("!H", length)
11358 return ''.join(packed)
11359
11360 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080011361 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -080011362 obj = group_add()
Rich Lane7b0f2012013-11-22 14:15:26 -080011363 _version = reader.read("!B")[0]
11364 assert(_version == 4)
11365 _type = reader.read("!B")[0]
11366 assert(_type == 15)
11367 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011368 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080011369 reader = orig_reader.slice(_length, 4)
Rich Lane7b0f2012013-11-22 14:15:26 -080011370 obj.xid = reader.read("!L")[0]
11371 _command = reader.read("!H")[0]
11372 assert(_command == 0)
11373 obj.group_type = reader.read("!B")[0]
11374 reader.skip(1)
11375 obj.group_id = reader.read("!L")[0]
Rich Lanee2567702015-01-26 15:04:35 -080011376 obj.buckets = loxi.generic_util.unpack_list(reader, ofp.common.bucket.unpack)
Rich Lane7b0f2012013-11-22 14:15:26 -080011377 return obj
11378
11379 def __eq__(self, other):
11380 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -080011381 if self.xid != other.xid: return False
11382 if self.group_type != other.group_type: return False
11383 if self.group_id != other.group_id: return False
11384 if self.buckets != other.buckets: return False
11385 return True
11386
Rich Lane7b0f2012013-11-22 14:15:26 -080011387 def pretty_print(self, q):
11388 q.text("group_add {")
11389 with q.group():
11390 with q.indent(2):
11391 q.breakable()
11392 q.text("xid = ");
11393 if self.xid != None:
11394 q.text("%#x" % self.xid)
11395 else:
11396 q.text('None')
11397 q.text(","); q.breakable()
11398 q.text("group_type = ");
11399 q.text("%#x" % self.group_type)
11400 q.text(","); q.breakable()
11401 q.text("group_id = ");
11402 q.text("%#x" % self.group_id)
11403 q.text(","); q.breakable()
11404 q.text("buckets = ");
11405 q.pp(self.buckets)
11406 q.breakable()
11407 q.text('}')
11408
Rich Lane7dcdf022013-12-11 14:45:27 -080011409group_mod.subtypes[0] = group_add
11410
11411class group_delete(group_mod):
Rich Lane7b0f2012013-11-22 14:15:26 -080011412 version = 4
11413 type = 15
11414 command = 2
11415
11416 def __init__(self, xid=None, group_type=None, group_id=None, buckets=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080011417 if xid != None:
11418 self.xid = xid
11419 else:
11420 self.xid = None
Rich Lane7b0f2012013-11-22 14:15:26 -080011421 if group_type != None:
11422 self.group_type = group_type
11423 else:
11424 self.group_type = 0
11425 if group_id != None:
11426 self.group_id = group_id
11427 else:
11428 self.group_id = 0
11429 if buckets != None:
11430 self.buckets = buckets
11431 else:
11432 self.buckets = []
Rich Lane7dcdf022013-12-11 14:45:27 -080011433 return
Rich Lane7b0f2012013-11-22 14:15:26 -080011434
11435 def pack(self):
11436 packed = []
11437 packed.append(struct.pack("!B", self.version))
11438 packed.append(struct.pack("!B", self.type))
11439 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11440 packed.append(struct.pack("!L", self.xid))
11441 packed.append(struct.pack("!H", self.command))
11442 packed.append(struct.pack("!B", self.group_type))
11443 packed.append('\x00' * 1)
11444 packed.append(struct.pack("!L", self.group_id))
Rich Lane7dcdf022013-12-11 14:45:27 -080011445 packed.append(loxi.generic_util.pack_list(self.buckets))
Rich Lane7b0f2012013-11-22 14:15:26 -080011446 length = sum([len(x) for x in packed])
11447 packed[2] = struct.pack("!H", length)
11448 return ''.join(packed)
11449
11450 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080011451 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -080011452 obj = group_delete()
Rich Lane7b0f2012013-11-22 14:15:26 -080011453 _version = reader.read("!B")[0]
11454 assert(_version == 4)
11455 _type = reader.read("!B")[0]
11456 assert(_type == 15)
11457 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011458 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080011459 reader = orig_reader.slice(_length, 4)
Rich Lane7b0f2012013-11-22 14:15:26 -080011460 obj.xid = reader.read("!L")[0]
11461 _command = reader.read("!H")[0]
11462 assert(_command == 2)
11463 obj.group_type = reader.read("!B")[0]
11464 reader.skip(1)
11465 obj.group_id = reader.read("!L")[0]
Rich Lanee2567702015-01-26 15:04:35 -080011466 obj.buckets = loxi.generic_util.unpack_list(reader, ofp.common.bucket.unpack)
Rich Lane7b0f2012013-11-22 14:15:26 -080011467 return obj
11468
11469 def __eq__(self, other):
11470 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -080011471 if self.xid != other.xid: return False
11472 if self.group_type != other.group_type: return False
11473 if self.group_id != other.group_id: return False
11474 if self.buckets != other.buckets: return False
11475 return True
11476
Rich Lane7b0f2012013-11-22 14:15:26 -080011477 def pretty_print(self, q):
11478 q.text("group_delete {")
11479 with q.group():
11480 with q.indent(2):
11481 q.breakable()
11482 q.text("xid = ");
11483 if self.xid != None:
11484 q.text("%#x" % self.xid)
11485 else:
11486 q.text('None')
11487 q.text(","); q.breakable()
11488 q.text("group_type = ");
11489 q.text("%#x" % self.group_type)
11490 q.text(","); q.breakable()
11491 q.text("group_id = ");
11492 q.text("%#x" % self.group_id)
11493 q.text(","); q.breakable()
11494 q.text("buckets = ");
11495 q.pp(self.buckets)
11496 q.breakable()
11497 q.text('}')
11498
Rich Lane7dcdf022013-12-11 14:45:27 -080011499group_mod.subtypes[2] = group_delete
11500
11501class group_desc_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070011502 version = 4
11503 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070011504 stats_type = 7
11505
11506 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080011507 if xid != None:
11508 self.xid = xid
11509 else:
11510 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070011511 if flags != None:
11512 self.flags = flags
11513 else:
11514 self.flags = 0
11515 if entries != None:
11516 self.entries = entries
11517 else:
11518 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -080011519 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070011520
11521 def pack(self):
11522 packed = []
11523 packed.append(struct.pack("!B", self.version))
11524 packed.append(struct.pack("!B", self.type))
11525 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11526 packed.append(struct.pack("!L", self.xid))
11527 packed.append(struct.pack("!H", self.stats_type))
11528 packed.append(struct.pack("!H", self.flags))
11529 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080011530 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -070011531 length = sum([len(x) for x in packed])
11532 packed[2] = struct.pack("!H", length)
11533 return ''.join(packed)
11534
11535 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080011536 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070011537 obj = group_desc_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070011538 _version = reader.read("!B")[0]
11539 assert(_version == 4)
11540 _type = reader.read("!B")[0]
11541 assert(_type == 19)
11542 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011543 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080011544 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070011545 obj.xid = reader.read("!L")[0]
11546 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011547 assert(_stats_type == 7)
Dan Talaycof6202252013-07-02 01:00:29 -070011548 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011549 reader.skip(4)
Rich Lanee2567702015-01-26 15:04:35 -080011550 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.group_desc_stats_entry.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070011551 return obj
11552
11553 def __eq__(self, other):
11554 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070011555 if self.xid != other.xid: return False
11556 if self.flags != other.flags: return False
11557 if self.entries != other.entries: return False
11558 return True
11559
Rich Lanec2ee4b82013-04-24 17:12:38 -070011560 def pretty_print(self, q):
11561 q.text("group_desc_stats_reply {")
11562 with q.group():
11563 with q.indent(2):
11564 q.breakable()
11565 q.text("xid = ");
11566 if self.xid != None:
11567 q.text("%#x" % self.xid)
11568 else:
11569 q.text('None')
11570 q.text(","); q.breakable()
11571 q.text("flags = ");
11572 q.text("%#x" % self.flags)
11573 q.text(","); q.breakable()
11574 q.text("entries = ");
11575 q.pp(self.entries)
11576 q.breakable()
11577 q.text('}')
11578
Rich Lane7dcdf022013-12-11 14:45:27 -080011579stats_reply.subtypes[7] = group_desc_stats_reply
11580
11581class group_desc_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070011582 version = 4
11583 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070011584 stats_type = 7
11585
11586 def __init__(self, xid=None, flags=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080011587 if xid != None:
11588 self.xid = xid
11589 else:
11590 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070011591 if flags != None:
11592 self.flags = flags
11593 else:
11594 self.flags = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080011595 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070011596
11597 def pack(self):
11598 packed = []
11599 packed.append(struct.pack("!B", self.version))
11600 packed.append(struct.pack("!B", self.type))
11601 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11602 packed.append(struct.pack("!L", self.xid))
11603 packed.append(struct.pack("!H", self.stats_type))
11604 packed.append(struct.pack("!H", self.flags))
11605 packed.append('\x00' * 4)
11606 length = sum([len(x) for x in packed])
11607 packed[2] = struct.pack("!H", length)
11608 return ''.join(packed)
11609
11610 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080011611 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070011612 obj = group_desc_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070011613 _version = reader.read("!B")[0]
11614 assert(_version == 4)
11615 _type = reader.read("!B")[0]
11616 assert(_type == 18)
11617 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011618 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080011619 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070011620 obj.xid = reader.read("!L")[0]
11621 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011622 assert(_stats_type == 7)
Dan Talaycof6202252013-07-02 01:00:29 -070011623 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011624 reader.skip(4)
11625 return obj
11626
11627 def __eq__(self, other):
11628 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070011629 if self.xid != other.xid: return False
11630 if self.flags != other.flags: return False
11631 return True
11632
Rich Lanec2ee4b82013-04-24 17:12:38 -070011633 def pretty_print(self, q):
11634 q.text("group_desc_stats_request {")
11635 with q.group():
11636 with q.indent(2):
11637 q.breakable()
11638 q.text("xid = ");
11639 if self.xid != None:
11640 q.text("%#x" % self.xid)
11641 else:
11642 q.text('None')
11643 q.text(","); q.breakable()
11644 q.text("flags = ");
11645 q.text("%#x" % self.flags)
11646 q.breakable()
11647 q.text('}')
11648
Rich Lane7dcdf022013-12-11 14:45:27 -080011649stats_request.subtypes[7] = group_desc_stats_request
11650
11651class group_features_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070011652 version = 4
11653 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070011654 stats_type = 8
11655
11656 def __init__(self, xid=None, flags=None, types=None, capabilities=None, max_groups_all=None, max_groups_select=None, max_groups_indirect=None, max_groups_ff=None, actions_all=None, actions_select=None, actions_indirect=None, actions_ff=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080011657 if xid != None:
11658 self.xid = xid
11659 else:
11660 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070011661 if flags != None:
11662 self.flags = flags
11663 else:
11664 self.flags = 0
11665 if types != None:
11666 self.types = types
11667 else:
11668 self.types = 0
11669 if capabilities != None:
11670 self.capabilities = capabilities
11671 else:
11672 self.capabilities = 0
11673 if max_groups_all != None:
11674 self.max_groups_all = max_groups_all
11675 else:
11676 self.max_groups_all = 0
11677 if max_groups_select != None:
11678 self.max_groups_select = max_groups_select
11679 else:
11680 self.max_groups_select = 0
11681 if max_groups_indirect != None:
11682 self.max_groups_indirect = max_groups_indirect
11683 else:
11684 self.max_groups_indirect = 0
11685 if max_groups_ff != None:
11686 self.max_groups_ff = max_groups_ff
11687 else:
11688 self.max_groups_ff = 0
11689 if actions_all != None:
11690 self.actions_all = actions_all
11691 else:
11692 self.actions_all = 0
11693 if actions_select != None:
11694 self.actions_select = actions_select
11695 else:
11696 self.actions_select = 0
11697 if actions_indirect != None:
11698 self.actions_indirect = actions_indirect
11699 else:
11700 self.actions_indirect = 0
11701 if actions_ff != None:
11702 self.actions_ff = actions_ff
11703 else:
11704 self.actions_ff = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080011705 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070011706
11707 def pack(self):
11708 packed = []
11709 packed.append(struct.pack("!B", self.version))
11710 packed.append(struct.pack("!B", self.type))
11711 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11712 packed.append(struct.pack("!L", self.xid))
11713 packed.append(struct.pack("!H", self.stats_type))
11714 packed.append(struct.pack("!H", self.flags))
11715 packed.append('\x00' * 4)
11716 packed.append(struct.pack("!L", self.types))
11717 packed.append(struct.pack("!L", self.capabilities))
11718 packed.append(struct.pack("!L", self.max_groups_all))
11719 packed.append(struct.pack("!L", self.max_groups_select))
11720 packed.append(struct.pack("!L", self.max_groups_indirect))
11721 packed.append(struct.pack("!L", self.max_groups_ff))
11722 packed.append(struct.pack("!L", self.actions_all))
11723 packed.append(struct.pack("!L", self.actions_select))
11724 packed.append(struct.pack("!L", self.actions_indirect))
11725 packed.append(struct.pack("!L", self.actions_ff))
11726 length = sum([len(x) for x in packed])
11727 packed[2] = struct.pack("!H", length)
11728 return ''.join(packed)
11729
11730 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080011731 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070011732 obj = group_features_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070011733 _version = reader.read("!B")[0]
11734 assert(_version == 4)
11735 _type = reader.read("!B")[0]
11736 assert(_type == 19)
11737 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011738 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080011739 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070011740 obj.xid = reader.read("!L")[0]
11741 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011742 assert(_stats_type == 8)
Dan Talaycof6202252013-07-02 01:00:29 -070011743 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011744 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -070011745 obj.types = reader.read("!L")[0]
11746 obj.capabilities = reader.read("!L")[0]
11747 obj.max_groups_all = reader.read("!L")[0]
11748 obj.max_groups_select = reader.read("!L")[0]
11749 obj.max_groups_indirect = reader.read("!L")[0]
11750 obj.max_groups_ff = reader.read("!L")[0]
11751 obj.actions_all = reader.read("!L")[0]
11752 obj.actions_select = reader.read("!L")[0]
11753 obj.actions_indirect = reader.read("!L")[0]
11754 obj.actions_ff = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011755 return obj
11756
11757 def __eq__(self, other):
11758 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070011759 if self.xid != other.xid: return False
11760 if self.flags != other.flags: return False
11761 if self.types != other.types: return False
11762 if self.capabilities != other.capabilities: return False
11763 if self.max_groups_all != other.max_groups_all: return False
11764 if self.max_groups_select != other.max_groups_select: return False
11765 if self.max_groups_indirect != other.max_groups_indirect: return False
11766 if self.max_groups_ff != other.max_groups_ff: return False
11767 if self.actions_all != other.actions_all: return False
11768 if self.actions_select != other.actions_select: return False
11769 if self.actions_indirect != other.actions_indirect: return False
11770 if self.actions_ff != other.actions_ff: return False
11771 return True
11772
Rich Lanec2ee4b82013-04-24 17:12:38 -070011773 def pretty_print(self, q):
11774 q.text("group_features_stats_reply {")
11775 with q.group():
11776 with q.indent(2):
11777 q.breakable()
11778 q.text("xid = ");
11779 if self.xid != None:
11780 q.text("%#x" % self.xid)
11781 else:
11782 q.text('None')
11783 q.text(","); q.breakable()
11784 q.text("flags = ");
11785 q.text("%#x" % self.flags)
11786 q.text(","); q.breakable()
11787 q.text("types = ");
11788 q.text("%#x" % self.types)
11789 q.text(","); q.breakable()
11790 q.text("capabilities = ");
11791 q.text("%#x" % self.capabilities)
11792 q.text(","); q.breakable()
11793 q.text("max_groups_all = ");
11794 q.text("%#x" % self.max_groups_all)
11795 q.text(","); q.breakable()
11796 q.text("max_groups_select = ");
11797 q.text("%#x" % self.max_groups_select)
11798 q.text(","); q.breakable()
11799 q.text("max_groups_indirect = ");
11800 q.text("%#x" % self.max_groups_indirect)
11801 q.text(","); q.breakable()
11802 q.text("max_groups_ff = ");
11803 q.text("%#x" % self.max_groups_ff)
11804 q.text(","); q.breakable()
11805 q.text("actions_all = ");
11806 q.text("%#x" % self.actions_all)
11807 q.text(","); q.breakable()
11808 q.text("actions_select = ");
11809 q.text("%#x" % self.actions_select)
11810 q.text(","); q.breakable()
11811 q.text("actions_indirect = ");
11812 q.text("%#x" % self.actions_indirect)
11813 q.text(","); q.breakable()
11814 q.text("actions_ff = ");
11815 q.text("%#x" % self.actions_ff)
11816 q.breakable()
11817 q.text('}')
11818
Rich Lane7dcdf022013-12-11 14:45:27 -080011819stats_reply.subtypes[8] = group_features_stats_reply
11820
11821class group_features_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070011822 version = 4
11823 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070011824 stats_type = 8
11825
11826 def __init__(self, xid=None, flags=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080011827 if xid != None:
11828 self.xid = xid
11829 else:
11830 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070011831 if flags != None:
11832 self.flags = flags
11833 else:
11834 self.flags = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080011835 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070011836
11837 def pack(self):
11838 packed = []
11839 packed.append(struct.pack("!B", self.version))
11840 packed.append(struct.pack("!B", self.type))
11841 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11842 packed.append(struct.pack("!L", self.xid))
11843 packed.append(struct.pack("!H", self.stats_type))
11844 packed.append(struct.pack("!H", self.flags))
11845 packed.append('\x00' * 4)
11846 length = sum([len(x) for x in packed])
11847 packed[2] = struct.pack("!H", length)
11848 return ''.join(packed)
11849
11850 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080011851 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070011852 obj = group_features_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070011853 _version = reader.read("!B")[0]
11854 assert(_version == 4)
11855 _type = reader.read("!B")[0]
11856 assert(_type == 18)
11857 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011858 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080011859 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070011860 obj.xid = reader.read("!L")[0]
11861 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011862 assert(_stats_type == 8)
Dan Talaycof6202252013-07-02 01:00:29 -070011863 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011864 reader.skip(4)
11865 return obj
11866
11867 def __eq__(self, other):
11868 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070011869 if self.xid != other.xid: return False
11870 if self.flags != other.flags: return False
11871 return True
11872
Rich Lanec2ee4b82013-04-24 17:12:38 -070011873 def pretty_print(self, q):
11874 q.text("group_features_stats_request {")
11875 with q.group():
11876 with q.indent(2):
11877 q.breakable()
11878 q.text("xid = ");
11879 if self.xid != None:
11880 q.text("%#x" % self.xid)
11881 else:
11882 q.text('None')
11883 q.text(","); q.breakable()
11884 q.text("flags = ");
11885 q.text("%#x" % self.flags)
11886 q.breakable()
11887 q.text('}')
11888
Rich Lane7dcdf022013-12-11 14:45:27 -080011889stats_request.subtypes[8] = group_features_stats_request
11890
11891class group_mod_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -070011892 version = 4
11893 type = 1
11894 err_type = 6
11895
11896 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080011897 if xid != None:
11898 self.xid = xid
11899 else:
11900 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -070011901 if code != None:
11902 self.code = code
11903 else:
11904 self.code = 0
11905 if data != None:
11906 self.data = data
11907 else:
11908 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080011909 return
Rich Lane6f4978c2013-10-20 21:33:52 -070011910
11911 def pack(self):
11912 packed = []
11913 packed.append(struct.pack("!B", self.version))
11914 packed.append(struct.pack("!B", self.type))
11915 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11916 packed.append(struct.pack("!L", self.xid))
11917 packed.append(struct.pack("!H", self.err_type))
11918 packed.append(struct.pack("!H", self.code))
11919 packed.append(self.data)
11920 length = sum([len(x) for x in packed])
11921 packed[2] = struct.pack("!H", length)
11922 return ''.join(packed)
11923
11924 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080011925 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -070011926 obj = group_mod_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -070011927 _version = reader.read("!B")[0]
11928 assert(_version == 4)
11929 _type = reader.read("!B")[0]
11930 assert(_type == 1)
11931 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011932 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080011933 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -070011934 obj.xid = reader.read("!L")[0]
11935 _err_type = reader.read("!H")[0]
11936 assert(_err_type == 6)
11937 obj.code = reader.read("!H")[0]
11938 obj.data = str(reader.read_all())
11939 return obj
11940
11941 def __eq__(self, other):
11942 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -070011943 if self.xid != other.xid: return False
11944 if self.code != other.code: return False
11945 if self.data != other.data: return False
11946 return True
11947
Rich Lane6f4978c2013-10-20 21:33:52 -070011948 def pretty_print(self, q):
11949 q.text("group_mod_failed_error_msg {")
11950 with q.group():
11951 with q.indent(2):
11952 q.breakable()
11953 q.text("xid = ");
11954 if self.xid != None:
11955 q.text("%#x" % self.xid)
11956 else:
11957 q.text('None')
11958 q.text(","); q.breakable()
11959 q.text("code = ");
11960 q.text("%#x" % self.code)
11961 q.text(","); q.breakable()
11962 q.text("data = ");
11963 q.pp(self.data)
11964 q.breakable()
11965 q.text('}')
11966
Rich Lane7dcdf022013-12-11 14:45:27 -080011967error_msg.subtypes[6] = group_mod_failed_error_msg
11968
11969class group_modify(group_mod):
Rich Lane7b0f2012013-11-22 14:15:26 -080011970 version = 4
11971 type = 15
11972 command = 1
11973
11974 def __init__(self, xid=None, group_type=None, group_id=None, buckets=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080011975 if xid != None:
11976 self.xid = xid
11977 else:
11978 self.xid = None
Rich Lane7b0f2012013-11-22 14:15:26 -080011979 if group_type != None:
11980 self.group_type = group_type
11981 else:
11982 self.group_type = 0
11983 if group_id != None:
11984 self.group_id = group_id
11985 else:
11986 self.group_id = 0
11987 if buckets != None:
11988 self.buckets = buckets
11989 else:
11990 self.buckets = []
Rich Lane7dcdf022013-12-11 14:45:27 -080011991 return
Rich Lane7b0f2012013-11-22 14:15:26 -080011992
11993 def pack(self):
11994 packed = []
11995 packed.append(struct.pack("!B", self.version))
11996 packed.append(struct.pack("!B", self.type))
11997 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11998 packed.append(struct.pack("!L", self.xid))
11999 packed.append(struct.pack("!H", self.command))
12000 packed.append(struct.pack("!B", self.group_type))
12001 packed.append('\x00' * 1)
12002 packed.append(struct.pack("!L", self.group_id))
Rich Lane7dcdf022013-12-11 14:45:27 -080012003 packed.append(loxi.generic_util.pack_list(self.buckets))
Rich Lane7b0f2012013-11-22 14:15:26 -080012004 length = sum([len(x) for x in packed])
12005 packed[2] = struct.pack("!H", length)
12006 return ''.join(packed)
12007
12008 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012009 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -080012010 obj = group_modify()
Rich Lane7b0f2012013-11-22 14:15:26 -080012011 _version = reader.read("!B")[0]
12012 assert(_version == 4)
12013 _type = reader.read("!B")[0]
12014 assert(_type == 15)
12015 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012016 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080012017 reader = orig_reader.slice(_length, 4)
Rich Lane7b0f2012013-11-22 14:15:26 -080012018 obj.xid = reader.read("!L")[0]
12019 _command = reader.read("!H")[0]
12020 assert(_command == 1)
12021 obj.group_type = reader.read("!B")[0]
12022 reader.skip(1)
12023 obj.group_id = reader.read("!L")[0]
Rich Lanee2567702015-01-26 15:04:35 -080012024 obj.buckets = loxi.generic_util.unpack_list(reader, ofp.common.bucket.unpack)
Rich Lane7b0f2012013-11-22 14:15:26 -080012025 return obj
12026
12027 def __eq__(self, other):
12028 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -080012029 if self.xid != other.xid: return False
12030 if self.group_type != other.group_type: return False
12031 if self.group_id != other.group_id: return False
12032 if self.buckets != other.buckets: return False
12033 return True
12034
Rich Lane7b0f2012013-11-22 14:15:26 -080012035 def pretty_print(self, q):
12036 q.text("group_modify {")
12037 with q.group():
12038 with q.indent(2):
12039 q.breakable()
12040 q.text("xid = ");
12041 if self.xid != None:
12042 q.text("%#x" % self.xid)
12043 else:
12044 q.text('None')
12045 q.text(","); q.breakable()
12046 q.text("group_type = ");
12047 q.text("%#x" % self.group_type)
12048 q.text(","); q.breakable()
12049 q.text("group_id = ");
12050 q.text("%#x" % self.group_id)
12051 q.text(","); q.breakable()
12052 q.text("buckets = ");
12053 q.pp(self.buckets)
12054 q.breakable()
12055 q.text('}')
12056
Rich Lane7dcdf022013-12-11 14:45:27 -080012057group_mod.subtypes[1] = group_modify
12058
12059class group_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070012060 version = 4
12061 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070012062 stats_type = 6
12063
12064 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012065 if xid != None:
12066 self.xid = xid
12067 else:
12068 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070012069 if flags != None:
12070 self.flags = flags
12071 else:
12072 self.flags = 0
12073 if entries != None:
12074 self.entries = entries
12075 else:
12076 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -080012077 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070012078
12079 def pack(self):
12080 packed = []
12081 packed.append(struct.pack("!B", self.version))
12082 packed.append(struct.pack("!B", self.type))
12083 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12084 packed.append(struct.pack("!L", self.xid))
12085 packed.append(struct.pack("!H", self.stats_type))
12086 packed.append(struct.pack("!H", self.flags))
12087 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080012088 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -070012089 length = sum([len(x) for x in packed])
12090 packed[2] = struct.pack("!H", length)
12091 return ''.join(packed)
12092
12093 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012094 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070012095 obj = group_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070012096 _version = reader.read("!B")[0]
12097 assert(_version == 4)
12098 _type = reader.read("!B")[0]
12099 assert(_type == 19)
12100 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012101 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080012102 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070012103 obj.xid = reader.read("!L")[0]
12104 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012105 assert(_stats_type == 6)
Dan Talaycof6202252013-07-02 01:00:29 -070012106 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012107 reader.skip(4)
Rich Lanee2567702015-01-26 15:04:35 -080012108 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.group_stats_entry.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070012109 return obj
12110
12111 def __eq__(self, other):
12112 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070012113 if self.xid != other.xid: return False
12114 if self.flags != other.flags: return False
12115 if self.entries != other.entries: return False
12116 return True
12117
Rich Lanec2ee4b82013-04-24 17:12:38 -070012118 def pretty_print(self, q):
12119 q.text("group_stats_reply {")
12120 with q.group():
12121 with q.indent(2):
12122 q.breakable()
12123 q.text("xid = ");
12124 if self.xid != None:
12125 q.text("%#x" % self.xid)
12126 else:
12127 q.text('None')
12128 q.text(","); q.breakable()
12129 q.text("flags = ");
12130 q.text("%#x" % self.flags)
12131 q.text(","); q.breakable()
12132 q.text("entries = ");
12133 q.pp(self.entries)
12134 q.breakable()
12135 q.text('}')
12136
Rich Lane7dcdf022013-12-11 14:45:27 -080012137stats_reply.subtypes[6] = group_stats_reply
12138
12139class group_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070012140 version = 4
12141 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070012142 stats_type = 6
12143
12144 def __init__(self, xid=None, flags=None, group_id=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012145 if xid != None:
12146 self.xid = xid
12147 else:
12148 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070012149 if flags != None:
12150 self.flags = flags
12151 else:
12152 self.flags = 0
12153 if group_id != None:
12154 self.group_id = group_id
12155 else:
12156 self.group_id = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080012157 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070012158
12159 def pack(self):
12160 packed = []
12161 packed.append(struct.pack("!B", self.version))
12162 packed.append(struct.pack("!B", self.type))
12163 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12164 packed.append(struct.pack("!L", self.xid))
12165 packed.append(struct.pack("!H", self.stats_type))
12166 packed.append(struct.pack("!H", self.flags))
12167 packed.append('\x00' * 4)
12168 packed.append(struct.pack("!L", self.group_id))
12169 packed.append('\x00' * 4)
12170 length = sum([len(x) for x in packed])
12171 packed[2] = struct.pack("!H", length)
12172 return ''.join(packed)
12173
12174 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012175 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070012176 obj = group_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070012177 _version = reader.read("!B")[0]
12178 assert(_version == 4)
12179 _type = reader.read("!B")[0]
12180 assert(_type == 18)
12181 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012182 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080012183 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070012184 obj.xid = reader.read("!L")[0]
12185 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012186 assert(_stats_type == 6)
Dan Talaycof6202252013-07-02 01:00:29 -070012187 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012188 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -070012189 obj.group_id = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012190 reader.skip(4)
12191 return obj
12192
12193 def __eq__(self, other):
12194 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070012195 if self.xid != other.xid: return False
12196 if self.flags != other.flags: return False
12197 if self.group_id != other.group_id: return False
12198 return True
12199
Rich Lanec2ee4b82013-04-24 17:12:38 -070012200 def pretty_print(self, q):
12201 q.text("group_stats_request {")
12202 with q.group():
12203 with q.indent(2):
12204 q.breakable()
12205 q.text("xid = ");
12206 if self.xid != None:
12207 q.text("%#x" % self.xid)
12208 else:
12209 q.text('None')
12210 q.text(","); q.breakable()
12211 q.text("flags = ");
12212 q.text("%#x" % self.flags)
12213 q.text(","); q.breakable()
12214 q.text("group_id = ");
12215 q.text("%#x" % self.group_id)
12216 q.breakable()
12217 q.text('}')
12218
Rich Lane7dcdf022013-12-11 14:45:27 -080012219stats_request.subtypes[6] = group_stats_request
12220
12221class hello(message):
Dan Talaycof6202252013-07-02 01:00:29 -070012222 version = 4
12223 type = 0
Rich Lanec2ee4b82013-04-24 17:12:38 -070012224
12225 def __init__(self, xid=None, elements=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012226 if xid != None:
12227 self.xid = xid
12228 else:
12229 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070012230 if elements != None:
12231 self.elements = elements
12232 else:
12233 self.elements = []
Rich Lane7dcdf022013-12-11 14:45:27 -080012234 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070012235
12236 def pack(self):
12237 packed = []
12238 packed.append(struct.pack("!B", self.version))
12239 packed.append(struct.pack("!B", self.type))
12240 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12241 packed.append(struct.pack("!L", self.xid))
Rich Lane7dcdf022013-12-11 14:45:27 -080012242 packed.append(loxi.generic_util.pack_list(self.elements))
Rich Lanec2ee4b82013-04-24 17:12:38 -070012243 length = sum([len(x) for x in packed])
12244 packed[2] = struct.pack("!H", length)
12245 return ''.join(packed)
12246
12247 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012248 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070012249 obj = hello()
Dan Talaycof6202252013-07-02 01:00:29 -070012250 _version = reader.read("!B")[0]
12251 assert(_version == 4)
12252 _type = reader.read("!B")[0]
12253 assert(_type == 0)
12254 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012255 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080012256 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070012257 obj.xid = reader.read("!L")[0]
Rich Lanee2567702015-01-26 15:04:35 -080012258 obj.elements = loxi.generic_util.unpack_list(reader, ofp.common.hello_elem.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070012259 return obj
12260
12261 def __eq__(self, other):
12262 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070012263 if self.xid != other.xid: return False
12264 if self.elements != other.elements: return False
12265 return True
12266
Rich Lanec2ee4b82013-04-24 17:12:38 -070012267 def pretty_print(self, q):
12268 q.text("hello {")
12269 with q.group():
12270 with q.indent(2):
12271 q.breakable()
12272 q.text("xid = ");
12273 if self.xid != None:
12274 q.text("%#x" % self.xid)
12275 else:
12276 q.text('None')
12277 q.text(","); q.breakable()
12278 q.text("elements = ");
12279 q.pp(self.elements)
12280 q.breakable()
12281 q.text('}')
12282
Rich Lane7dcdf022013-12-11 14:45:27 -080012283message.subtypes[0] = hello
12284
12285class hello_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -070012286 version = 4
12287 type = 1
12288 err_type = 0
12289
12290 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012291 if xid != None:
12292 self.xid = xid
12293 else:
12294 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -070012295 if code != None:
12296 self.code = code
12297 else:
12298 self.code = 0
12299 if data != None:
12300 self.data = data
12301 else:
12302 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080012303 return
Rich Lane6f4978c2013-10-20 21:33:52 -070012304
12305 def pack(self):
12306 packed = []
12307 packed.append(struct.pack("!B", self.version))
12308 packed.append(struct.pack("!B", self.type))
12309 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12310 packed.append(struct.pack("!L", self.xid))
12311 packed.append(struct.pack("!H", self.err_type))
12312 packed.append(struct.pack("!H", self.code))
12313 packed.append(self.data)
12314 length = sum([len(x) for x in packed])
12315 packed[2] = struct.pack("!H", length)
12316 return ''.join(packed)
12317
12318 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012319 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -070012320 obj = hello_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -070012321 _version = reader.read("!B")[0]
12322 assert(_version == 4)
12323 _type = reader.read("!B")[0]
12324 assert(_type == 1)
12325 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012326 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080012327 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -070012328 obj.xid = reader.read("!L")[0]
12329 _err_type = reader.read("!H")[0]
12330 assert(_err_type == 0)
12331 obj.code = reader.read("!H")[0]
12332 obj.data = str(reader.read_all())
12333 return obj
12334
12335 def __eq__(self, other):
12336 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -070012337 if self.xid != other.xid: return False
12338 if self.code != other.code: return False
12339 if self.data != other.data: return False
12340 return True
12341
Rich Lane6f4978c2013-10-20 21:33:52 -070012342 def pretty_print(self, q):
12343 q.text("hello_failed_error_msg {")
12344 with q.group():
12345 with q.indent(2):
12346 q.breakable()
12347 q.text("xid = ");
12348 if self.xid != None:
12349 q.text("%#x" % self.xid)
12350 else:
12351 q.text('None')
12352 q.text(","); q.breakable()
12353 q.text("code = ");
12354 q.text("%#x" % self.code)
12355 q.text(","); q.breakable()
12356 q.text("data = ");
12357 q.pp(self.data)
12358 q.breakable()
12359 q.text('}')
12360
Rich Lane7dcdf022013-12-11 14:45:27 -080012361error_msg.subtypes[0] = hello_failed_error_msg
12362
12363class meter_config_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070012364 version = 4
12365 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070012366 stats_type = 10
12367
12368 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012369 if xid != None:
12370 self.xid = xid
12371 else:
12372 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070012373 if flags != None:
12374 self.flags = flags
12375 else:
12376 self.flags = 0
12377 if entries != None:
12378 self.entries = entries
12379 else:
12380 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -080012381 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070012382
12383 def pack(self):
12384 packed = []
12385 packed.append(struct.pack("!B", self.version))
12386 packed.append(struct.pack("!B", self.type))
12387 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12388 packed.append(struct.pack("!L", self.xid))
12389 packed.append(struct.pack("!H", self.stats_type))
12390 packed.append(struct.pack("!H", self.flags))
12391 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080012392 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -070012393 length = sum([len(x) for x in packed])
12394 packed[2] = struct.pack("!H", length)
12395 return ''.join(packed)
12396
12397 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012398 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070012399 obj = meter_config_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070012400 _version = reader.read("!B")[0]
12401 assert(_version == 4)
12402 _type = reader.read("!B")[0]
12403 assert(_type == 19)
12404 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012405 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080012406 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070012407 obj.xid = reader.read("!L")[0]
12408 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012409 assert(_stats_type == 10)
Dan Talaycof6202252013-07-02 01:00:29 -070012410 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012411 reader.skip(4)
Rich Lanee2567702015-01-26 15:04:35 -080012412 obj.entries = loxi.generic_util.unpack_list(reader, ofp.meter_band.meter_band.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070012413 return obj
12414
12415 def __eq__(self, other):
12416 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070012417 if self.xid != other.xid: return False
12418 if self.flags != other.flags: return False
12419 if self.entries != other.entries: return False
12420 return True
12421
Rich Lanec2ee4b82013-04-24 17:12:38 -070012422 def pretty_print(self, q):
12423 q.text("meter_config_stats_reply {")
12424 with q.group():
12425 with q.indent(2):
12426 q.breakable()
12427 q.text("xid = ");
12428 if self.xid != None:
12429 q.text("%#x" % self.xid)
12430 else:
12431 q.text('None')
12432 q.text(","); q.breakable()
12433 q.text("flags = ");
12434 q.text("%#x" % self.flags)
12435 q.text(","); q.breakable()
12436 q.text("entries = ");
12437 q.pp(self.entries)
12438 q.breakable()
12439 q.text('}')
12440
Rich Lane7dcdf022013-12-11 14:45:27 -080012441stats_reply.subtypes[10] = meter_config_stats_reply
12442
12443class meter_config_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070012444 version = 4
12445 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070012446 stats_type = 10
12447
12448 def __init__(self, xid=None, flags=None, meter_id=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012449 if xid != None:
12450 self.xid = xid
12451 else:
12452 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070012453 if flags != None:
12454 self.flags = flags
12455 else:
12456 self.flags = 0
12457 if meter_id != None:
12458 self.meter_id = meter_id
12459 else:
12460 self.meter_id = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080012461 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070012462
12463 def pack(self):
12464 packed = []
12465 packed.append(struct.pack("!B", self.version))
12466 packed.append(struct.pack("!B", self.type))
12467 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12468 packed.append(struct.pack("!L", self.xid))
12469 packed.append(struct.pack("!H", self.stats_type))
12470 packed.append(struct.pack("!H", self.flags))
12471 packed.append('\x00' * 4)
12472 packed.append(struct.pack("!L", self.meter_id))
12473 packed.append('\x00' * 4)
12474 length = sum([len(x) for x in packed])
12475 packed[2] = struct.pack("!H", length)
12476 return ''.join(packed)
12477
12478 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012479 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070012480 obj = meter_config_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070012481 _version = reader.read("!B")[0]
12482 assert(_version == 4)
12483 _type = reader.read("!B")[0]
12484 assert(_type == 18)
12485 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012486 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080012487 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070012488 obj.xid = reader.read("!L")[0]
12489 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012490 assert(_stats_type == 10)
Dan Talaycof6202252013-07-02 01:00:29 -070012491 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012492 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -070012493 obj.meter_id = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012494 reader.skip(4)
12495 return obj
12496
12497 def __eq__(self, other):
12498 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070012499 if self.xid != other.xid: return False
12500 if self.flags != other.flags: return False
12501 if self.meter_id != other.meter_id: return False
12502 return True
12503
Rich Lanec2ee4b82013-04-24 17:12:38 -070012504 def pretty_print(self, q):
12505 q.text("meter_config_stats_request {")
12506 with q.group():
12507 with q.indent(2):
12508 q.breakable()
12509 q.text("xid = ");
12510 if self.xid != None:
12511 q.text("%#x" % self.xid)
12512 else:
12513 q.text('None')
12514 q.text(","); q.breakable()
12515 q.text("flags = ");
12516 q.text("%#x" % self.flags)
12517 q.text(","); q.breakable()
12518 q.text("meter_id = ");
12519 q.text("%#x" % self.meter_id)
12520 q.breakable()
12521 q.text('}')
12522
Rich Lane7dcdf022013-12-11 14:45:27 -080012523stats_request.subtypes[10] = meter_config_stats_request
12524
12525class meter_features_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070012526 version = 4
12527 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070012528 stats_type = 11
12529
12530 def __init__(self, xid=None, flags=None, features=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012531 if xid != None:
12532 self.xid = xid
12533 else:
12534 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070012535 if flags != None:
12536 self.flags = flags
12537 else:
12538 self.flags = 0
12539 if features != None:
12540 self.features = features
12541 else:
Rich Lanee2567702015-01-26 15:04:35 -080012542 self.features = ofp.meter_features()
Rich Lane7dcdf022013-12-11 14:45:27 -080012543 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070012544
12545 def pack(self):
12546 packed = []
12547 packed.append(struct.pack("!B", self.version))
12548 packed.append(struct.pack("!B", self.type))
12549 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12550 packed.append(struct.pack("!L", self.xid))
12551 packed.append(struct.pack("!H", self.stats_type))
12552 packed.append(struct.pack("!H", self.flags))
12553 packed.append('\x00' * 4)
12554 packed.append(self.features.pack())
12555 length = sum([len(x) for x in packed])
12556 packed[2] = struct.pack("!H", length)
12557 return ''.join(packed)
12558
12559 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012560 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070012561 obj = meter_features_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070012562 _version = reader.read("!B")[0]
12563 assert(_version == 4)
12564 _type = reader.read("!B")[0]
12565 assert(_type == 19)
12566 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012567 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080012568 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070012569 obj.xid = reader.read("!L")[0]
12570 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012571 assert(_stats_type == 11)
Dan Talaycof6202252013-07-02 01:00:29 -070012572 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012573 reader.skip(4)
Rich Lanee2567702015-01-26 15:04:35 -080012574 obj.features = ofp.meter_features.unpack(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -070012575 return obj
12576
12577 def __eq__(self, other):
12578 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070012579 if self.xid != other.xid: return False
12580 if self.flags != other.flags: return False
12581 if self.features != other.features: return False
12582 return True
12583
Rich Lanec2ee4b82013-04-24 17:12:38 -070012584 def pretty_print(self, q):
12585 q.text("meter_features_stats_reply {")
12586 with q.group():
12587 with q.indent(2):
12588 q.breakable()
12589 q.text("xid = ");
12590 if self.xid != None:
12591 q.text("%#x" % self.xid)
12592 else:
12593 q.text('None')
12594 q.text(","); q.breakable()
12595 q.text("flags = ");
12596 q.text("%#x" % self.flags)
12597 q.text(","); q.breakable()
12598 q.text("features = ");
12599 q.pp(self.features)
12600 q.breakable()
12601 q.text('}')
12602
Rich Lane7dcdf022013-12-11 14:45:27 -080012603stats_reply.subtypes[11] = meter_features_stats_reply
12604
12605class meter_features_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070012606 version = 4
12607 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070012608 stats_type = 11
12609
12610 def __init__(self, xid=None, flags=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012611 if xid != None:
12612 self.xid = xid
12613 else:
12614 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070012615 if flags != None:
12616 self.flags = flags
12617 else:
12618 self.flags = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080012619 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070012620
12621 def pack(self):
12622 packed = []
12623 packed.append(struct.pack("!B", self.version))
12624 packed.append(struct.pack("!B", self.type))
12625 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12626 packed.append(struct.pack("!L", self.xid))
12627 packed.append(struct.pack("!H", self.stats_type))
12628 packed.append(struct.pack("!H", self.flags))
12629 packed.append('\x00' * 4)
12630 length = sum([len(x) for x in packed])
12631 packed[2] = struct.pack("!H", length)
12632 return ''.join(packed)
12633
12634 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012635 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070012636 obj = meter_features_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070012637 _version = reader.read("!B")[0]
12638 assert(_version == 4)
12639 _type = reader.read("!B")[0]
12640 assert(_type == 18)
12641 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012642 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080012643 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070012644 obj.xid = reader.read("!L")[0]
12645 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012646 assert(_stats_type == 11)
Dan Talaycof6202252013-07-02 01:00:29 -070012647 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012648 reader.skip(4)
12649 return obj
12650
12651 def __eq__(self, other):
12652 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070012653 if self.xid != other.xid: return False
12654 if self.flags != other.flags: return False
12655 return True
12656
Rich Lanec2ee4b82013-04-24 17:12:38 -070012657 def pretty_print(self, q):
12658 q.text("meter_features_stats_request {")
12659 with q.group():
12660 with q.indent(2):
12661 q.breakable()
12662 q.text("xid = ");
12663 if self.xid != None:
12664 q.text("%#x" % self.xid)
12665 else:
12666 q.text('None')
12667 q.text(","); q.breakable()
12668 q.text("flags = ");
12669 q.text("%#x" % self.flags)
12670 q.breakable()
12671 q.text('}')
12672
Rich Lane7dcdf022013-12-11 14:45:27 -080012673stats_request.subtypes[11] = meter_features_stats_request
12674
12675class meter_mod(message):
Dan Talaycof6202252013-07-02 01:00:29 -070012676 version = 4
12677 type = 29
Rich Lanec2ee4b82013-04-24 17:12:38 -070012678
12679 def __init__(self, xid=None, command=None, flags=None, meter_id=None, meters=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012680 if xid != None:
12681 self.xid = xid
12682 else:
12683 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070012684 if command != None:
12685 self.command = command
12686 else:
12687 self.command = 0
12688 if flags != None:
12689 self.flags = flags
12690 else:
12691 self.flags = 0
12692 if meter_id != None:
12693 self.meter_id = meter_id
12694 else:
12695 self.meter_id = 0
12696 if meters != None:
12697 self.meters = meters
12698 else:
12699 self.meters = []
Rich Lane7dcdf022013-12-11 14:45:27 -080012700 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070012701
12702 def pack(self):
12703 packed = []
12704 packed.append(struct.pack("!B", self.version))
12705 packed.append(struct.pack("!B", self.type))
12706 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12707 packed.append(struct.pack("!L", self.xid))
12708 packed.append(struct.pack("!H", self.command))
12709 packed.append(struct.pack("!H", self.flags))
12710 packed.append(struct.pack("!L", self.meter_id))
Rich Lane7dcdf022013-12-11 14:45:27 -080012711 packed.append(loxi.generic_util.pack_list(self.meters))
Rich Lanec2ee4b82013-04-24 17:12:38 -070012712 length = sum([len(x) for x in packed])
12713 packed[2] = struct.pack("!H", length)
12714 return ''.join(packed)
12715
12716 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012717 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070012718 obj = meter_mod()
Dan Talaycof6202252013-07-02 01:00:29 -070012719 _version = reader.read("!B")[0]
12720 assert(_version == 4)
12721 _type = reader.read("!B")[0]
12722 assert(_type == 29)
12723 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012724 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080012725 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070012726 obj.xid = reader.read("!L")[0]
12727 obj.command = reader.read("!H")[0]
12728 obj.flags = reader.read("!H")[0]
12729 obj.meter_id = reader.read("!L")[0]
Rich Lanee2567702015-01-26 15:04:35 -080012730 obj.meters = loxi.generic_util.unpack_list(reader, ofp.meter_band.meter_band.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070012731 return obj
12732
12733 def __eq__(self, other):
12734 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070012735 if self.xid != other.xid: return False
12736 if self.command != other.command: return False
12737 if self.flags != other.flags: return False
12738 if self.meter_id != other.meter_id: return False
12739 if self.meters != other.meters: return False
12740 return True
12741
Rich Lanec2ee4b82013-04-24 17:12:38 -070012742 def pretty_print(self, q):
12743 q.text("meter_mod {")
12744 with q.group():
12745 with q.indent(2):
12746 q.breakable()
12747 q.text("xid = ");
12748 if self.xid != None:
12749 q.text("%#x" % self.xid)
12750 else:
12751 q.text('None')
12752 q.text(","); q.breakable()
12753 q.text("command = ");
12754 q.text("%#x" % self.command)
12755 q.text(","); q.breakable()
12756 q.text("flags = ");
12757 q.text("%#x" % self.flags)
12758 q.text(","); q.breakable()
12759 q.text("meter_id = ");
12760 q.text("%#x" % self.meter_id)
12761 q.text(","); q.breakable()
12762 q.text("meters = ");
12763 q.pp(self.meters)
12764 q.breakable()
12765 q.text('}')
12766
Rich Lane7dcdf022013-12-11 14:45:27 -080012767message.subtypes[29] = meter_mod
12768
12769class meter_mod_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -070012770 version = 4
12771 type = 1
12772 err_type = 12
12773
12774 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012775 if xid != None:
12776 self.xid = xid
12777 else:
12778 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -070012779 if code != None:
12780 self.code = code
12781 else:
12782 self.code = 0
12783 if data != None:
12784 self.data = data
12785 else:
12786 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080012787 return
Rich Lane6f4978c2013-10-20 21:33:52 -070012788
12789 def pack(self):
12790 packed = []
12791 packed.append(struct.pack("!B", self.version))
12792 packed.append(struct.pack("!B", self.type))
12793 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12794 packed.append(struct.pack("!L", self.xid))
12795 packed.append(struct.pack("!H", self.err_type))
12796 packed.append(struct.pack("!H", self.code))
12797 packed.append(self.data)
12798 length = sum([len(x) for x in packed])
12799 packed[2] = struct.pack("!H", length)
12800 return ''.join(packed)
12801
12802 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012803 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -070012804 obj = meter_mod_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -070012805 _version = reader.read("!B")[0]
12806 assert(_version == 4)
12807 _type = reader.read("!B")[0]
12808 assert(_type == 1)
12809 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012810 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080012811 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -070012812 obj.xid = reader.read("!L")[0]
12813 _err_type = reader.read("!H")[0]
12814 assert(_err_type == 12)
12815 obj.code = reader.read("!H")[0]
12816 obj.data = str(reader.read_all())
12817 return obj
12818
12819 def __eq__(self, other):
12820 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -070012821 if self.xid != other.xid: return False
12822 if self.code != other.code: return False
12823 if self.data != other.data: return False
12824 return True
12825
Rich Lane6f4978c2013-10-20 21:33:52 -070012826 def pretty_print(self, q):
12827 q.text("meter_mod_failed_error_msg {")
12828 with q.group():
12829 with q.indent(2):
12830 q.breakable()
12831 q.text("xid = ");
12832 if self.xid != None:
12833 q.text("%#x" % self.xid)
12834 else:
12835 q.text('None')
12836 q.text(","); q.breakable()
12837 q.text("code = ");
12838 q.text("%#x" % self.code)
12839 q.text(","); q.breakable()
12840 q.text("data = ");
12841 q.pp(self.data)
12842 q.breakable()
12843 q.text('}')
12844
Rich Lane7dcdf022013-12-11 14:45:27 -080012845error_msg.subtypes[12] = meter_mod_failed_error_msg
12846
12847class meter_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070012848 version = 4
12849 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070012850 stats_type = 9
12851
12852 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012853 if xid != None:
12854 self.xid = xid
12855 else:
12856 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070012857 if flags != None:
12858 self.flags = flags
12859 else:
12860 self.flags = 0
12861 if entries != None:
12862 self.entries = entries
12863 else:
12864 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -080012865 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070012866
12867 def pack(self):
12868 packed = []
12869 packed.append(struct.pack("!B", self.version))
12870 packed.append(struct.pack("!B", self.type))
12871 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12872 packed.append(struct.pack("!L", self.xid))
12873 packed.append(struct.pack("!H", self.stats_type))
12874 packed.append(struct.pack("!H", self.flags))
12875 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080012876 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -070012877 length = sum([len(x) for x in packed])
12878 packed[2] = struct.pack("!H", length)
12879 return ''.join(packed)
12880
12881 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012882 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070012883 obj = meter_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070012884 _version = reader.read("!B")[0]
12885 assert(_version == 4)
12886 _type = reader.read("!B")[0]
12887 assert(_type == 19)
12888 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012889 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080012890 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070012891 obj.xid = reader.read("!L")[0]
12892 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012893 assert(_stats_type == 9)
Dan Talaycof6202252013-07-02 01:00:29 -070012894 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012895 reader.skip(4)
Rich Lanee2567702015-01-26 15:04:35 -080012896 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.meter_stats.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070012897 return obj
12898
12899 def __eq__(self, other):
12900 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070012901 if self.xid != other.xid: return False
12902 if self.flags != other.flags: return False
12903 if self.entries != other.entries: return False
12904 return True
12905
Rich Lanec2ee4b82013-04-24 17:12:38 -070012906 def pretty_print(self, q):
12907 q.text("meter_stats_reply {")
12908 with q.group():
12909 with q.indent(2):
12910 q.breakable()
12911 q.text("xid = ");
12912 if self.xid != None:
12913 q.text("%#x" % self.xid)
12914 else:
12915 q.text('None')
12916 q.text(","); q.breakable()
12917 q.text("flags = ");
12918 q.text("%#x" % self.flags)
12919 q.text(","); q.breakable()
12920 q.text("entries = ");
12921 q.pp(self.entries)
12922 q.breakable()
12923 q.text('}')
12924
Rich Lane7dcdf022013-12-11 14:45:27 -080012925stats_reply.subtypes[9] = meter_stats_reply
12926
12927class meter_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070012928 version = 4
12929 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070012930 stats_type = 9
12931
12932 def __init__(self, xid=None, flags=None, meter_id=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012933 if xid != None:
12934 self.xid = xid
12935 else:
12936 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070012937 if flags != None:
12938 self.flags = flags
12939 else:
12940 self.flags = 0
12941 if meter_id != None:
12942 self.meter_id = meter_id
12943 else:
12944 self.meter_id = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080012945 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070012946
12947 def pack(self):
12948 packed = []
12949 packed.append(struct.pack("!B", self.version))
12950 packed.append(struct.pack("!B", self.type))
12951 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12952 packed.append(struct.pack("!L", self.xid))
12953 packed.append(struct.pack("!H", self.stats_type))
12954 packed.append(struct.pack("!H", self.flags))
12955 packed.append('\x00' * 4)
12956 packed.append(struct.pack("!L", self.meter_id))
12957 packed.append('\x00' * 4)
12958 length = sum([len(x) for x in packed])
12959 packed[2] = struct.pack("!H", length)
12960 return ''.join(packed)
12961
12962 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012963 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070012964 obj = meter_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070012965 _version = reader.read("!B")[0]
12966 assert(_version == 4)
12967 _type = reader.read("!B")[0]
12968 assert(_type == 18)
12969 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012970 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080012971 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070012972 obj.xid = reader.read("!L")[0]
12973 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012974 assert(_stats_type == 9)
Dan Talaycof6202252013-07-02 01:00:29 -070012975 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012976 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -070012977 obj.meter_id = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012978 reader.skip(4)
12979 return obj
12980
12981 def __eq__(self, other):
12982 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070012983 if self.xid != other.xid: return False
12984 if self.flags != other.flags: return False
12985 if self.meter_id != other.meter_id: return False
12986 return True
12987
Rich Lanec2ee4b82013-04-24 17:12:38 -070012988 def pretty_print(self, q):
12989 q.text("meter_stats_request {")
12990 with q.group():
12991 with q.indent(2):
12992 q.breakable()
12993 q.text("xid = ");
12994 if self.xid != None:
12995 q.text("%#x" % self.xid)
12996 else:
12997 q.text('None')
12998 q.text(","); q.breakable()
12999 q.text("flags = ");
13000 q.text("%#x" % self.flags)
13001 q.text(","); q.breakable()
13002 q.text("meter_id = ");
13003 q.text("%#x" % self.meter_id)
13004 q.breakable()
13005 q.text('}')
13006
Rich Lane7dcdf022013-12-11 14:45:27 -080013007stats_request.subtypes[9] = meter_stats_request
13008
13009class nicira_header(experimenter):
13010 subtypes = {}
13011
Rich Lane95f7fc92014-01-27 17:08:16 -080013012 version = 4
13013 type = 4
13014 experimenter = 8992
13015
13016 def __init__(self, xid=None, subtype=None):
13017 if xid != None:
13018 self.xid = xid
13019 else:
13020 self.xid = None
13021 if subtype != None:
13022 self.subtype = subtype
13023 else:
13024 self.subtype = 0
13025 return
13026
13027 def pack(self):
13028 packed = []
13029 packed.append(struct.pack("!B", self.version))
13030 packed.append(struct.pack("!B", self.type))
13031 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13032 packed.append(struct.pack("!L", self.xid))
13033 packed.append(struct.pack("!L", self.experimenter))
13034 packed.append(struct.pack("!L", self.subtype))
13035 length = sum([len(x) for x in packed])
13036 packed[2] = struct.pack("!H", length)
13037 return ''.join(packed)
13038
Rich Lane7dcdf022013-12-11 14:45:27 -080013039 @staticmethod
13040 def unpack(reader):
13041 subtype, = reader.peek('!L', 12)
Rich Lane95f7fc92014-01-27 17:08:16 -080013042 subclass = nicira_header.subtypes.get(subtype)
13043 if subclass:
13044 return subclass.unpack(reader)
13045
13046 obj = nicira_header()
13047 _version = reader.read("!B")[0]
13048 assert(_version == 4)
13049 _type = reader.read("!B")[0]
13050 assert(_type == 4)
13051 _length = reader.read("!H")[0]
13052 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080013053 reader = orig_reader.slice(_length, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -080013054 obj.xid = reader.read("!L")[0]
13055 _experimenter = reader.read("!L")[0]
13056 assert(_experimenter == 8992)
13057 obj.subtype = reader.read("!L")[0]
13058 return obj
13059
13060 def __eq__(self, other):
13061 if type(self) != type(other): return False
13062 if self.xid != other.xid: return False
13063 if self.subtype != other.subtype: return False
13064 return True
13065
13066 def pretty_print(self, q):
13067 q.text("nicira_header {")
13068 with q.group():
13069 with q.indent(2):
13070 q.breakable()
13071 q.text("xid = ");
13072 if self.xid != None:
13073 q.text("%#x" % self.xid)
13074 else:
13075 q.text('None')
13076 q.breakable()
13077 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -080013078
13079experimenter.subtypes[8992] = nicira_header
13080
13081class packet_in(message):
Dan Talaycof6202252013-07-02 01:00:29 -070013082 version = 4
13083 type = 10
Rich Lanec2ee4b82013-04-24 17:12:38 -070013084
13085 def __init__(self, xid=None, buffer_id=None, total_len=None, reason=None, table_id=None, cookie=None, match=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080013086 if xid != None:
13087 self.xid = xid
13088 else:
13089 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070013090 if buffer_id != None:
13091 self.buffer_id = buffer_id
13092 else:
13093 self.buffer_id = 0
13094 if total_len != None:
13095 self.total_len = total_len
13096 else:
13097 self.total_len = 0
13098 if reason != None:
13099 self.reason = reason
13100 else:
13101 self.reason = 0
13102 if table_id != None:
13103 self.table_id = table_id
13104 else:
13105 self.table_id = 0
13106 if cookie != None:
13107 self.cookie = cookie
13108 else:
13109 self.cookie = 0
13110 if match != None:
13111 self.match = match
13112 else:
Rich Lanee2567702015-01-26 15:04:35 -080013113 self.match = ofp.match()
Rich Lanec2ee4b82013-04-24 17:12:38 -070013114 if data != None:
13115 self.data = data
13116 else:
Dan Talaycof6202252013-07-02 01:00:29 -070013117 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080013118 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070013119
13120 def pack(self):
13121 packed = []
13122 packed.append(struct.pack("!B", self.version))
13123 packed.append(struct.pack("!B", self.type))
13124 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13125 packed.append(struct.pack("!L", self.xid))
13126 packed.append(struct.pack("!L", self.buffer_id))
13127 packed.append(struct.pack("!H", self.total_len))
13128 packed.append(struct.pack("!B", self.reason))
13129 packed.append(struct.pack("!B", self.table_id))
13130 packed.append(struct.pack("!Q", self.cookie))
13131 packed.append(self.match.pack())
13132 packed.append('\x00' * 2)
13133 packed.append(self.data)
13134 length = sum([len(x) for x in packed])
13135 packed[2] = struct.pack("!H", length)
13136 return ''.join(packed)
13137
13138 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080013139 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070013140 obj = packet_in()
Dan Talaycof6202252013-07-02 01:00:29 -070013141 _version = reader.read("!B")[0]
13142 assert(_version == 4)
13143 _type = reader.read("!B")[0]
13144 assert(_type == 10)
13145 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080013146 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080013147 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070013148 obj.xid = reader.read("!L")[0]
13149 obj.buffer_id = reader.read("!L")[0]
13150 obj.total_len = reader.read("!H")[0]
13151 obj.reason = reader.read("!B")[0]
13152 obj.table_id = reader.read("!B")[0]
13153 obj.cookie = reader.read("!Q")[0]
Rich Lanee2567702015-01-26 15:04:35 -080013154 obj.match = ofp.match.unpack(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -070013155 reader.skip(2)
13156 obj.data = str(reader.read_all())
13157 return obj
13158
13159 def __eq__(self, other):
13160 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070013161 if self.xid != other.xid: return False
13162 if self.buffer_id != other.buffer_id: return False
13163 if self.total_len != other.total_len: return False
13164 if self.reason != other.reason: return False
13165 if self.table_id != other.table_id: return False
13166 if self.cookie != other.cookie: return False
13167 if self.match != other.match: return False
13168 if self.data != other.data: return False
13169 return True
13170
Rich Lanec2ee4b82013-04-24 17:12:38 -070013171 def pretty_print(self, q):
13172 q.text("packet_in {")
13173 with q.group():
13174 with q.indent(2):
13175 q.breakable()
13176 q.text("xid = ");
13177 if self.xid != None:
13178 q.text("%#x" % self.xid)
13179 else:
13180 q.text('None')
13181 q.text(","); q.breakable()
13182 q.text("buffer_id = ");
13183 q.text("%#x" % self.buffer_id)
13184 q.text(","); q.breakable()
13185 q.text("total_len = ");
13186 q.text("%#x" % self.total_len)
13187 q.text(","); q.breakable()
13188 q.text("reason = ");
13189 q.text("%#x" % self.reason)
13190 q.text(","); q.breakable()
13191 q.text("table_id = ");
13192 q.text("%#x" % self.table_id)
13193 q.text(","); q.breakable()
13194 q.text("cookie = ");
13195 q.text("%#x" % self.cookie)
13196 q.text(","); q.breakable()
13197 q.text("match = ");
13198 q.pp(self.match)
13199 q.text(","); q.breakable()
13200 q.text("data = ");
13201 q.pp(self.data)
13202 q.breakable()
13203 q.text('}')
13204
Rich Lane7dcdf022013-12-11 14:45:27 -080013205message.subtypes[10] = packet_in
13206
13207class packet_out(message):
Dan Talaycof6202252013-07-02 01:00:29 -070013208 version = 4
13209 type = 13
Rich Lanec2ee4b82013-04-24 17:12:38 -070013210
13211 def __init__(self, xid=None, buffer_id=None, in_port=None, actions=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080013212 if xid != None:
13213 self.xid = xid
13214 else:
13215 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070013216 if buffer_id != None:
13217 self.buffer_id = buffer_id
13218 else:
13219 self.buffer_id = 0
13220 if in_port != None:
13221 self.in_port = in_port
13222 else:
13223 self.in_port = 0
13224 if actions != None:
13225 self.actions = actions
13226 else:
13227 self.actions = []
13228 if data != None:
13229 self.data = data
13230 else:
Dan Talaycof6202252013-07-02 01:00:29 -070013231 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080013232 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070013233
13234 def pack(self):
13235 packed = []
13236 packed.append(struct.pack("!B", self.version))
13237 packed.append(struct.pack("!B", self.type))
13238 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13239 packed.append(struct.pack("!L", self.xid))
13240 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -070013241 packed.append(util.pack_port_no(self.in_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -070013242 packed.append(struct.pack("!H", 0)) # placeholder for actions_len at index 6
13243 packed.append('\x00' * 6)
Rich Lane7dcdf022013-12-11 14:45:27 -080013244 packed.append(loxi.generic_util.pack_list(self.actions))
Rich Lanec2ee4b82013-04-24 17:12:38 -070013245 packed[6] = struct.pack("!H", len(packed[-1]))
13246 packed.append(self.data)
13247 length = sum([len(x) for x in packed])
13248 packed[2] = struct.pack("!H", length)
13249 return ''.join(packed)
13250
13251 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080013252 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070013253 obj = packet_out()
Dan Talaycof6202252013-07-02 01:00:29 -070013254 _version = reader.read("!B")[0]
13255 assert(_version == 4)
13256 _type = reader.read("!B")[0]
13257 assert(_type == 13)
13258 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080013259 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080013260 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070013261 obj.xid = reader.read("!L")[0]
13262 obj.buffer_id = reader.read("!L")[0]
13263 obj.in_port = util.unpack_port_no(reader)
13264 _actions_len = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013265 reader.skip(6)
Rich Lanee2567702015-01-26 15:04:35 -080013266 obj.actions = loxi.generic_util.unpack_list(reader.slice(_actions_len), ofp.action.action.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070013267 obj.data = str(reader.read_all())
13268 return obj
13269
13270 def __eq__(self, other):
13271 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070013272 if self.xid != other.xid: return False
13273 if self.buffer_id != other.buffer_id: return False
13274 if self.in_port != other.in_port: return False
13275 if self.actions != other.actions: return False
13276 if self.data != other.data: return False
13277 return True
13278
Rich Lanec2ee4b82013-04-24 17:12:38 -070013279 def pretty_print(self, q):
13280 q.text("packet_out {")
13281 with q.group():
13282 with q.indent(2):
13283 q.breakable()
13284 q.text("xid = ");
13285 if self.xid != None:
13286 q.text("%#x" % self.xid)
13287 else:
13288 q.text('None')
13289 q.text(","); q.breakable()
13290 q.text("buffer_id = ");
13291 q.text("%#x" % self.buffer_id)
13292 q.text(","); q.breakable()
13293 q.text("in_port = ");
13294 q.text(util.pretty_port(self.in_port))
13295 q.text(","); q.breakable()
13296 q.text("actions = ");
13297 q.pp(self.actions)
13298 q.text(","); q.breakable()
13299 q.text("data = ");
13300 q.pp(self.data)
13301 q.breakable()
13302 q.text('}')
13303
Rich Lane7dcdf022013-12-11 14:45:27 -080013304message.subtypes[13] = packet_out
13305
13306class port_desc_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070013307 version = 4
13308 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070013309 stats_type = 13
13310
13311 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080013312 if xid != None:
13313 self.xid = xid
13314 else:
13315 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070013316 if flags != None:
13317 self.flags = flags
13318 else:
13319 self.flags = 0
13320 if entries != None:
13321 self.entries = entries
13322 else:
13323 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -080013324 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070013325
13326 def pack(self):
13327 packed = []
13328 packed.append(struct.pack("!B", self.version))
13329 packed.append(struct.pack("!B", self.type))
13330 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13331 packed.append(struct.pack("!L", self.xid))
13332 packed.append(struct.pack("!H", self.stats_type))
13333 packed.append(struct.pack("!H", self.flags))
13334 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080013335 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -070013336 length = sum([len(x) for x in packed])
13337 packed[2] = struct.pack("!H", length)
13338 return ''.join(packed)
13339
13340 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080013341 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070013342 obj = port_desc_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070013343 _version = reader.read("!B")[0]
13344 assert(_version == 4)
13345 _type = reader.read("!B")[0]
13346 assert(_type == 19)
13347 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080013348 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080013349 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070013350 obj.xid = reader.read("!L")[0]
13351 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013352 assert(_stats_type == 13)
Dan Talaycof6202252013-07-02 01:00:29 -070013353 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013354 reader.skip(4)
Rich Lanee2567702015-01-26 15:04:35 -080013355 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.port_desc.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070013356 return obj
13357
13358 def __eq__(self, other):
13359 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070013360 if self.xid != other.xid: return False
13361 if self.flags != other.flags: return False
13362 if self.entries != other.entries: return False
13363 return True
13364
Rich Lanec2ee4b82013-04-24 17:12:38 -070013365 def pretty_print(self, q):
13366 q.text("port_desc_stats_reply {")
13367 with q.group():
13368 with q.indent(2):
13369 q.breakable()
13370 q.text("xid = ");
13371 if self.xid != None:
13372 q.text("%#x" % self.xid)
13373 else:
13374 q.text('None')
13375 q.text(","); q.breakable()
13376 q.text("flags = ");
13377 q.text("%#x" % self.flags)
13378 q.text(","); q.breakable()
13379 q.text("entries = ");
13380 q.pp(self.entries)
13381 q.breakable()
13382 q.text('}')
13383
Rich Lane7dcdf022013-12-11 14:45:27 -080013384stats_reply.subtypes[13] = port_desc_stats_reply
13385
13386class port_desc_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070013387 version = 4
13388 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070013389 stats_type = 13
13390
13391 def __init__(self, xid=None, flags=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080013392 if xid != None:
13393 self.xid = xid
13394 else:
13395 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070013396 if flags != None:
13397 self.flags = flags
13398 else:
13399 self.flags = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080013400 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070013401
13402 def pack(self):
13403 packed = []
13404 packed.append(struct.pack("!B", self.version))
13405 packed.append(struct.pack("!B", self.type))
13406 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13407 packed.append(struct.pack("!L", self.xid))
13408 packed.append(struct.pack("!H", self.stats_type))
13409 packed.append(struct.pack("!H", self.flags))
13410 packed.append('\x00' * 4)
13411 length = sum([len(x) for x in packed])
13412 packed[2] = struct.pack("!H", length)
13413 return ''.join(packed)
13414
13415 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080013416 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070013417 obj = port_desc_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070013418 _version = reader.read("!B")[0]
13419 assert(_version == 4)
13420 _type = reader.read("!B")[0]
13421 assert(_type == 18)
13422 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080013423 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080013424 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070013425 obj.xid = reader.read("!L")[0]
13426 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013427 assert(_stats_type == 13)
Dan Talaycof6202252013-07-02 01:00:29 -070013428 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013429 reader.skip(4)
13430 return obj
13431
13432 def __eq__(self, other):
13433 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070013434 if self.xid != other.xid: return False
13435 if self.flags != other.flags: return False
13436 return True
13437
Rich Lanec2ee4b82013-04-24 17:12:38 -070013438 def pretty_print(self, q):
13439 q.text("port_desc_stats_request {")
13440 with q.group():
13441 with q.indent(2):
13442 q.breakable()
13443 q.text("xid = ");
13444 if self.xid != None:
13445 q.text("%#x" % self.xid)
13446 else:
13447 q.text('None')
13448 q.text(","); q.breakable()
13449 q.text("flags = ");
13450 q.text("%#x" % self.flags)
13451 q.breakable()
13452 q.text('}')
13453
Rich Lane7dcdf022013-12-11 14:45:27 -080013454stats_request.subtypes[13] = port_desc_stats_request
13455
13456class port_mod(message):
Dan Talaycof6202252013-07-02 01:00:29 -070013457 version = 4
13458 type = 16
Rich Lanec2ee4b82013-04-24 17:12:38 -070013459
13460 def __init__(self, xid=None, port_no=None, hw_addr=None, config=None, mask=None, advertise=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080013461 if xid != None:
13462 self.xid = xid
13463 else:
13464 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070013465 if port_no != None:
13466 self.port_no = port_no
13467 else:
13468 self.port_no = 0
13469 if hw_addr != None:
13470 self.hw_addr = hw_addr
13471 else:
13472 self.hw_addr = [0,0,0,0,0,0]
13473 if config != None:
13474 self.config = config
13475 else:
13476 self.config = 0
13477 if mask != None:
13478 self.mask = mask
13479 else:
13480 self.mask = 0
13481 if advertise != None:
13482 self.advertise = advertise
13483 else:
13484 self.advertise = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080013485 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070013486
13487 def pack(self):
13488 packed = []
13489 packed.append(struct.pack("!B", self.version))
13490 packed.append(struct.pack("!B", self.type))
13491 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13492 packed.append(struct.pack("!L", self.xid))
Dan Talaycof6202252013-07-02 01:00:29 -070013493 packed.append(util.pack_port_no(self.port_no))
Rich Lanec2ee4b82013-04-24 17:12:38 -070013494 packed.append('\x00' * 4)
13495 packed.append(struct.pack("!6B", *self.hw_addr))
13496 packed.append('\x00' * 2)
13497 packed.append(struct.pack("!L", self.config))
13498 packed.append(struct.pack("!L", self.mask))
13499 packed.append(struct.pack("!L", self.advertise))
13500 packed.append('\x00' * 4)
13501 length = sum([len(x) for x in packed])
13502 packed[2] = struct.pack("!H", length)
13503 return ''.join(packed)
13504
13505 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080013506 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070013507 obj = port_mod()
Dan Talaycof6202252013-07-02 01:00:29 -070013508 _version = reader.read("!B")[0]
13509 assert(_version == 4)
13510 _type = reader.read("!B")[0]
13511 assert(_type == 16)
13512 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080013513 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080013514 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070013515 obj.xid = reader.read("!L")[0]
13516 obj.port_no = util.unpack_port_no(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -070013517 reader.skip(4)
13518 obj.hw_addr = list(reader.read('!6B'))
13519 reader.skip(2)
Dan Talaycof6202252013-07-02 01:00:29 -070013520 obj.config = reader.read("!L")[0]
13521 obj.mask = reader.read("!L")[0]
13522 obj.advertise = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013523 reader.skip(4)
13524 return obj
13525
13526 def __eq__(self, other):
13527 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070013528 if self.xid != other.xid: return False
13529 if self.port_no != other.port_no: return False
13530 if self.hw_addr != other.hw_addr: return False
13531 if self.config != other.config: return False
13532 if self.mask != other.mask: return False
13533 if self.advertise != other.advertise: return False
13534 return True
13535
Rich Lanec2ee4b82013-04-24 17:12:38 -070013536 def pretty_print(self, q):
13537 q.text("port_mod {")
13538 with q.group():
13539 with q.indent(2):
13540 q.breakable()
13541 q.text("xid = ");
13542 if self.xid != None:
13543 q.text("%#x" % self.xid)
13544 else:
13545 q.text('None')
13546 q.text(","); q.breakable()
13547 q.text("port_no = ");
13548 q.text(util.pretty_port(self.port_no))
13549 q.text(","); q.breakable()
13550 q.text("hw_addr = ");
13551 q.text(util.pretty_mac(self.hw_addr))
13552 q.text(","); q.breakable()
13553 q.text("config = ");
13554 q.text("%#x" % self.config)
13555 q.text(","); q.breakable()
13556 q.text("mask = ");
13557 q.text("%#x" % self.mask)
13558 q.text(","); q.breakable()
13559 q.text("advertise = ");
13560 q.text("%#x" % self.advertise)
13561 q.breakable()
13562 q.text('}')
13563
Rich Lane7dcdf022013-12-11 14:45:27 -080013564message.subtypes[16] = port_mod
13565
13566class port_mod_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -070013567 version = 4
13568 type = 1
13569 err_type = 7
13570
13571 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080013572 if xid != None:
13573 self.xid = xid
13574 else:
13575 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -070013576 if code != None:
13577 self.code = code
13578 else:
13579 self.code = 0
13580 if data != None:
13581 self.data = data
13582 else:
13583 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080013584 return
Rich Lane6f4978c2013-10-20 21:33:52 -070013585
13586 def pack(self):
13587 packed = []
13588 packed.append(struct.pack("!B", self.version))
13589 packed.append(struct.pack("!B", self.type))
13590 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13591 packed.append(struct.pack("!L", self.xid))
13592 packed.append(struct.pack("!H", self.err_type))
13593 packed.append(struct.pack("!H", self.code))
13594 packed.append(self.data)
13595 length = sum([len(x) for x in packed])
13596 packed[2] = struct.pack("!H", length)
13597 return ''.join(packed)
13598
13599 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080013600 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -070013601 obj = port_mod_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -070013602 _version = reader.read("!B")[0]
13603 assert(_version == 4)
13604 _type = reader.read("!B")[0]
13605 assert(_type == 1)
13606 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080013607 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080013608 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -070013609 obj.xid = reader.read("!L")[0]
13610 _err_type = reader.read("!H")[0]
13611 assert(_err_type == 7)
13612 obj.code = reader.read("!H")[0]
13613 obj.data = str(reader.read_all())
13614 return obj
13615
13616 def __eq__(self, other):
13617 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -070013618 if self.xid != other.xid: return False
13619 if self.code != other.code: return False
13620 if self.data != other.data: return False
13621 return True
13622
Rich Lane6f4978c2013-10-20 21:33:52 -070013623 def pretty_print(self, q):
13624 q.text("port_mod_failed_error_msg {")
13625 with q.group():
13626 with q.indent(2):
13627 q.breakable()
13628 q.text("xid = ");
13629 if self.xid != None:
13630 q.text("%#x" % self.xid)
13631 else:
13632 q.text('None')
13633 q.text(","); q.breakable()
13634 q.text("code = ");
13635 q.text("%#x" % self.code)
13636 q.text(","); q.breakable()
13637 q.text("data = ");
13638 q.pp(self.data)
13639 q.breakable()
13640 q.text('}')
13641
Rich Lane7dcdf022013-12-11 14:45:27 -080013642error_msg.subtypes[7] = port_mod_failed_error_msg
13643
13644class port_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070013645 version = 4
13646 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070013647 stats_type = 4
13648
13649 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080013650 if xid != None:
13651 self.xid = xid
13652 else:
13653 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070013654 if flags != None:
13655 self.flags = flags
13656 else:
13657 self.flags = 0
13658 if entries != None:
13659 self.entries = entries
13660 else:
13661 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -080013662 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070013663
13664 def pack(self):
13665 packed = []
13666 packed.append(struct.pack("!B", self.version))
13667 packed.append(struct.pack("!B", self.type))
13668 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13669 packed.append(struct.pack("!L", self.xid))
13670 packed.append(struct.pack("!H", self.stats_type))
13671 packed.append(struct.pack("!H", self.flags))
13672 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080013673 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -070013674 length = sum([len(x) for x in packed])
13675 packed[2] = struct.pack("!H", length)
13676 return ''.join(packed)
13677
13678 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080013679 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070013680 obj = port_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070013681 _version = reader.read("!B")[0]
13682 assert(_version == 4)
13683 _type = reader.read("!B")[0]
13684 assert(_type == 19)
13685 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080013686 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080013687 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070013688 obj.xid = reader.read("!L")[0]
13689 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013690 assert(_stats_type == 4)
Dan Talaycof6202252013-07-02 01:00:29 -070013691 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013692 reader.skip(4)
Rich Lanee2567702015-01-26 15:04:35 -080013693 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.port_stats_entry.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070013694 return obj
13695
13696 def __eq__(self, other):
13697 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070013698 if self.xid != other.xid: return False
13699 if self.flags != other.flags: return False
13700 if self.entries != other.entries: return False
13701 return True
13702
Rich Lanec2ee4b82013-04-24 17:12:38 -070013703 def pretty_print(self, q):
13704 q.text("port_stats_reply {")
13705 with q.group():
13706 with q.indent(2):
13707 q.breakable()
13708 q.text("xid = ");
13709 if self.xid != None:
13710 q.text("%#x" % self.xid)
13711 else:
13712 q.text('None')
13713 q.text(","); q.breakable()
13714 q.text("flags = ");
13715 q.text("%#x" % self.flags)
13716 q.text(","); q.breakable()
13717 q.text("entries = ");
13718 q.pp(self.entries)
13719 q.breakable()
13720 q.text('}')
13721
Rich Lane7dcdf022013-12-11 14:45:27 -080013722stats_reply.subtypes[4] = port_stats_reply
13723
13724class port_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070013725 version = 4
13726 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070013727 stats_type = 4
13728
13729 def __init__(self, xid=None, flags=None, port_no=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080013730 if xid != None:
13731 self.xid = xid
13732 else:
13733 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070013734 if flags != None:
13735 self.flags = flags
13736 else:
13737 self.flags = 0
13738 if port_no != None:
13739 self.port_no = port_no
13740 else:
13741 self.port_no = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080013742 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070013743
13744 def pack(self):
13745 packed = []
13746 packed.append(struct.pack("!B", self.version))
13747 packed.append(struct.pack("!B", self.type))
13748 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13749 packed.append(struct.pack("!L", self.xid))
13750 packed.append(struct.pack("!H", self.stats_type))
13751 packed.append(struct.pack("!H", self.flags))
13752 packed.append('\x00' * 4)
Dan Talaycof6202252013-07-02 01:00:29 -070013753 packed.append(util.pack_port_no(self.port_no))
Rich Lanec2ee4b82013-04-24 17:12:38 -070013754 packed.append('\x00' * 4)
13755 length = sum([len(x) for x in packed])
13756 packed[2] = struct.pack("!H", length)
13757 return ''.join(packed)
13758
13759 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080013760 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070013761 obj = port_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070013762 _version = reader.read("!B")[0]
13763 assert(_version == 4)
13764 _type = reader.read("!B")[0]
13765 assert(_type == 18)
13766 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080013767 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080013768 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070013769 obj.xid = reader.read("!L")[0]
13770 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013771 assert(_stats_type == 4)
Dan Talaycof6202252013-07-02 01:00:29 -070013772 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013773 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -070013774 obj.port_no = util.unpack_port_no(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -070013775 reader.skip(4)
13776 return obj
13777
13778 def __eq__(self, other):
13779 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070013780 if self.xid != other.xid: return False
13781 if self.flags != other.flags: return False
13782 if self.port_no != other.port_no: return False
13783 return True
13784
Rich Lanec2ee4b82013-04-24 17:12:38 -070013785 def pretty_print(self, q):
13786 q.text("port_stats_request {")
13787 with q.group():
13788 with q.indent(2):
13789 q.breakable()
13790 q.text("xid = ");
13791 if self.xid != None:
13792 q.text("%#x" % self.xid)
13793 else:
13794 q.text('None')
13795 q.text(","); q.breakable()
13796 q.text("flags = ");
13797 q.text("%#x" % self.flags)
13798 q.text(","); q.breakable()
13799 q.text("port_no = ");
13800 q.text(util.pretty_port(self.port_no))
13801 q.breakable()
13802 q.text('}')
13803
Rich Lane7dcdf022013-12-11 14:45:27 -080013804stats_request.subtypes[4] = port_stats_request
13805
13806class port_status(message):
Dan Talaycof6202252013-07-02 01:00:29 -070013807 version = 4
13808 type = 12
Rich Lanec2ee4b82013-04-24 17:12:38 -070013809
13810 def __init__(self, xid=None, reason=None, desc=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080013811 if xid != None:
13812 self.xid = xid
13813 else:
13814 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070013815 if reason != None:
13816 self.reason = reason
13817 else:
13818 self.reason = 0
13819 if desc != None:
13820 self.desc = desc
13821 else:
Rich Lanee2567702015-01-26 15:04:35 -080013822 self.desc = ofp.port_desc()
Rich Lane7dcdf022013-12-11 14:45:27 -080013823 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070013824
13825 def pack(self):
13826 packed = []
13827 packed.append(struct.pack("!B", self.version))
13828 packed.append(struct.pack("!B", self.type))
13829 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13830 packed.append(struct.pack("!L", self.xid))
13831 packed.append(struct.pack("!B", self.reason))
13832 packed.append('\x00' * 7)
13833 packed.append(self.desc.pack())
13834 length = sum([len(x) for x in packed])
13835 packed[2] = struct.pack("!H", length)
13836 return ''.join(packed)
13837
13838 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080013839 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070013840 obj = port_status()
Dan Talaycof6202252013-07-02 01:00:29 -070013841 _version = reader.read("!B")[0]
13842 assert(_version == 4)
13843 _type = reader.read("!B")[0]
13844 assert(_type == 12)
13845 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080013846 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080013847 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070013848 obj.xid = reader.read("!L")[0]
13849 obj.reason = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013850 reader.skip(7)
Rich Lanee2567702015-01-26 15:04:35 -080013851 obj.desc = ofp.port_desc.unpack(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -070013852 return obj
13853
13854 def __eq__(self, other):
13855 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070013856 if self.xid != other.xid: return False
13857 if self.reason != other.reason: return False
13858 if self.desc != other.desc: return False
13859 return True
13860
Rich Lanec2ee4b82013-04-24 17:12:38 -070013861 def pretty_print(self, q):
13862 q.text("port_status {")
13863 with q.group():
13864 with q.indent(2):
13865 q.breakable()
13866 q.text("xid = ");
13867 if self.xid != None:
13868 q.text("%#x" % self.xid)
13869 else:
13870 q.text('None')
13871 q.text(","); q.breakable()
13872 q.text("reason = ");
13873 q.text("%#x" % self.reason)
13874 q.text(","); q.breakable()
13875 q.text("desc = ");
13876 q.pp(self.desc)
13877 q.breakable()
13878 q.text('}')
13879
Rich Lane7dcdf022013-12-11 14:45:27 -080013880message.subtypes[12] = port_status
13881
13882class queue_get_config_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -070013883 version = 4
13884 type = 23
Rich Lanec2ee4b82013-04-24 17:12:38 -070013885
13886 def __init__(self, xid=None, port=None, queues=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080013887 if xid != None:
13888 self.xid = xid
13889 else:
13890 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070013891 if port != None:
13892 self.port = port
13893 else:
13894 self.port = 0
13895 if queues != None:
13896 self.queues = queues
13897 else:
13898 self.queues = []
Rich Lane7dcdf022013-12-11 14:45:27 -080013899 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070013900
13901 def pack(self):
13902 packed = []
13903 packed.append(struct.pack("!B", self.version))
13904 packed.append(struct.pack("!B", self.type))
13905 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13906 packed.append(struct.pack("!L", self.xid))
Dan Talaycof6202252013-07-02 01:00:29 -070013907 packed.append(util.pack_port_no(self.port))
Rich Lanec2ee4b82013-04-24 17:12:38 -070013908 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080013909 packed.append(loxi.generic_util.pack_list(self.queues))
Rich Lanec2ee4b82013-04-24 17:12:38 -070013910 length = sum([len(x) for x in packed])
13911 packed[2] = struct.pack("!H", length)
13912 return ''.join(packed)
13913
13914 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080013915 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070013916 obj = queue_get_config_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070013917 _version = reader.read("!B")[0]
13918 assert(_version == 4)
13919 _type = reader.read("!B")[0]
13920 assert(_type == 23)
13921 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080013922 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080013923 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070013924 obj.xid = reader.read("!L")[0]
13925 obj.port = util.unpack_port_no(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -070013926 reader.skip(4)
Rich Lanee2567702015-01-26 15:04:35 -080013927 obj.queues = loxi.generic_util.unpack_list(reader, ofp.common.packet_queue.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070013928 return obj
13929
13930 def __eq__(self, other):
13931 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070013932 if self.xid != other.xid: return False
13933 if self.port != other.port: return False
13934 if self.queues != other.queues: return False
13935 return True
13936
Rich Lanec2ee4b82013-04-24 17:12:38 -070013937 def pretty_print(self, q):
13938 q.text("queue_get_config_reply {")
13939 with q.group():
13940 with q.indent(2):
13941 q.breakable()
13942 q.text("xid = ");
13943 if self.xid != None:
13944 q.text("%#x" % self.xid)
13945 else:
13946 q.text('None')
13947 q.text(","); q.breakable()
13948 q.text("port = ");
13949 q.text(util.pretty_port(self.port))
13950 q.text(","); q.breakable()
13951 q.text("queues = ");
13952 q.pp(self.queues)
13953 q.breakable()
13954 q.text('}')
13955
Rich Lane7dcdf022013-12-11 14:45:27 -080013956message.subtypes[23] = queue_get_config_reply
13957
13958class queue_get_config_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -070013959 version = 4
13960 type = 22
Rich Lanec2ee4b82013-04-24 17:12:38 -070013961
13962 def __init__(self, xid=None, port=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080013963 if xid != None:
13964 self.xid = xid
13965 else:
13966 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070013967 if port != None:
13968 self.port = port
13969 else:
13970 self.port = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080013971 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070013972
13973 def pack(self):
13974 packed = []
13975 packed.append(struct.pack("!B", self.version))
13976 packed.append(struct.pack("!B", self.type))
13977 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13978 packed.append(struct.pack("!L", self.xid))
Dan Talaycof6202252013-07-02 01:00:29 -070013979 packed.append(util.pack_port_no(self.port))
Rich Lanec2ee4b82013-04-24 17:12:38 -070013980 packed.append('\x00' * 4)
13981 length = sum([len(x) for x in packed])
13982 packed[2] = struct.pack("!H", length)
13983 return ''.join(packed)
13984
13985 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080013986 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070013987 obj = queue_get_config_request()
Dan Talaycof6202252013-07-02 01:00:29 -070013988 _version = reader.read("!B")[0]
13989 assert(_version == 4)
13990 _type = reader.read("!B")[0]
13991 assert(_type == 22)
13992 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080013993 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080013994 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070013995 obj.xid = reader.read("!L")[0]
13996 obj.port = util.unpack_port_no(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -070013997 reader.skip(4)
13998 return obj
13999
14000 def __eq__(self, other):
14001 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070014002 if self.xid != other.xid: return False
14003 if self.port != other.port: return False
14004 return True
14005
Rich Lanec2ee4b82013-04-24 17:12:38 -070014006 def pretty_print(self, q):
14007 q.text("queue_get_config_request {")
14008 with q.group():
14009 with q.indent(2):
14010 q.breakable()
14011 q.text("xid = ");
14012 if self.xid != None:
14013 q.text("%#x" % self.xid)
14014 else:
14015 q.text('None')
14016 q.text(","); q.breakable()
14017 q.text("port = ");
14018 q.text(util.pretty_port(self.port))
14019 q.breakable()
14020 q.text('}')
14021
Rich Lane7dcdf022013-12-11 14:45:27 -080014022message.subtypes[22] = queue_get_config_request
14023
14024class queue_op_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -070014025 version = 4
14026 type = 1
14027 err_type = 9
14028
14029 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080014030 if xid != None:
14031 self.xid = xid
14032 else:
14033 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -070014034 if code != None:
14035 self.code = code
14036 else:
14037 self.code = 0
14038 if data != None:
14039 self.data = data
14040 else:
14041 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080014042 return
Rich Lane6f4978c2013-10-20 21:33:52 -070014043
14044 def pack(self):
14045 packed = []
14046 packed.append(struct.pack("!B", self.version))
14047 packed.append(struct.pack("!B", self.type))
14048 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14049 packed.append(struct.pack("!L", self.xid))
14050 packed.append(struct.pack("!H", self.err_type))
14051 packed.append(struct.pack("!H", self.code))
14052 packed.append(self.data)
14053 length = sum([len(x) for x in packed])
14054 packed[2] = struct.pack("!H", length)
14055 return ''.join(packed)
14056
14057 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080014058 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -070014059 obj = queue_op_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -070014060 _version = reader.read("!B")[0]
14061 assert(_version == 4)
14062 _type = reader.read("!B")[0]
14063 assert(_type == 1)
14064 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080014065 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080014066 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -070014067 obj.xid = reader.read("!L")[0]
14068 _err_type = reader.read("!H")[0]
14069 assert(_err_type == 9)
14070 obj.code = reader.read("!H")[0]
14071 obj.data = str(reader.read_all())
14072 return obj
14073
14074 def __eq__(self, other):
14075 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -070014076 if self.xid != other.xid: return False
14077 if self.code != other.code: return False
14078 if self.data != other.data: return False
14079 return True
14080
Rich Lane6f4978c2013-10-20 21:33:52 -070014081 def pretty_print(self, q):
14082 q.text("queue_op_failed_error_msg {")
14083 with q.group():
14084 with q.indent(2):
14085 q.breakable()
14086 q.text("xid = ");
14087 if self.xid != None:
14088 q.text("%#x" % self.xid)
14089 else:
14090 q.text('None')
14091 q.text(","); q.breakable()
14092 q.text("code = ");
14093 q.text("%#x" % self.code)
14094 q.text(","); q.breakable()
14095 q.text("data = ");
14096 q.pp(self.data)
14097 q.breakable()
14098 q.text('}')
14099
Rich Lane7dcdf022013-12-11 14:45:27 -080014100error_msg.subtypes[9] = queue_op_failed_error_msg
14101
14102class queue_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070014103 version = 4
14104 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070014105 stats_type = 5
14106
14107 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080014108 if xid != None:
14109 self.xid = xid
14110 else:
14111 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070014112 if flags != None:
14113 self.flags = flags
14114 else:
14115 self.flags = 0
14116 if entries != None:
14117 self.entries = entries
14118 else:
14119 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -080014120 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070014121
14122 def pack(self):
14123 packed = []
14124 packed.append(struct.pack("!B", self.version))
14125 packed.append(struct.pack("!B", self.type))
14126 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14127 packed.append(struct.pack("!L", self.xid))
14128 packed.append(struct.pack("!H", self.stats_type))
14129 packed.append(struct.pack("!H", self.flags))
14130 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080014131 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -070014132 length = sum([len(x) for x in packed])
14133 packed[2] = struct.pack("!H", length)
14134 return ''.join(packed)
14135
14136 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080014137 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070014138 obj = queue_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070014139 _version = reader.read("!B")[0]
14140 assert(_version == 4)
14141 _type = reader.read("!B")[0]
14142 assert(_type == 19)
14143 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080014144 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080014145 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070014146 obj.xid = reader.read("!L")[0]
14147 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070014148 assert(_stats_type == 5)
Dan Talaycof6202252013-07-02 01:00:29 -070014149 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070014150 reader.skip(4)
Rich Lanee2567702015-01-26 15:04:35 -080014151 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.queue_stats_entry.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070014152 return obj
14153
14154 def __eq__(self, other):
14155 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070014156 if self.xid != other.xid: return False
14157 if self.flags != other.flags: return False
14158 if self.entries != other.entries: return False
14159 return True
14160
Rich Lanec2ee4b82013-04-24 17:12:38 -070014161 def pretty_print(self, q):
14162 q.text("queue_stats_reply {")
14163 with q.group():
14164 with q.indent(2):
14165 q.breakable()
14166 q.text("xid = ");
14167 if self.xid != None:
14168 q.text("%#x" % self.xid)
14169 else:
14170 q.text('None')
14171 q.text(","); q.breakable()
14172 q.text("flags = ");
14173 q.text("%#x" % self.flags)
14174 q.text(","); q.breakable()
14175 q.text("entries = ");
14176 q.pp(self.entries)
14177 q.breakable()
14178 q.text('}')
14179
Rich Lane7dcdf022013-12-11 14:45:27 -080014180stats_reply.subtypes[5] = queue_stats_reply
14181
14182class queue_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070014183 version = 4
14184 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070014185 stats_type = 5
14186
14187 def __init__(self, xid=None, flags=None, port_no=None, queue_id=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080014188 if xid != None:
14189 self.xid = xid
14190 else:
14191 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070014192 if flags != None:
14193 self.flags = flags
14194 else:
14195 self.flags = 0
14196 if port_no != None:
14197 self.port_no = port_no
14198 else:
14199 self.port_no = 0
14200 if queue_id != None:
14201 self.queue_id = queue_id
14202 else:
14203 self.queue_id = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080014204 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070014205
14206 def pack(self):
14207 packed = []
14208 packed.append(struct.pack("!B", self.version))
14209 packed.append(struct.pack("!B", self.type))
14210 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14211 packed.append(struct.pack("!L", self.xid))
14212 packed.append(struct.pack("!H", self.stats_type))
14213 packed.append(struct.pack("!H", self.flags))
14214 packed.append('\x00' * 4)
Dan Talaycof6202252013-07-02 01:00:29 -070014215 packed.append(util.pack_port_no(self.port_no))
Rich Lanec2ee4b82013-04-24 17:12:38 -070014216 packed.append(struct.pack("!L", self.queue_id))
14217 length = sum([len(x) for x in packed])
14218 packed[2] = struct.pack("!H", length)
14219 return ''.join(packed)
14220
14221 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080014222 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070014223 obj = queue_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070014224 _version = reader.read("!B")[0]
14225 assert(_version == 4)
14226 _type = reader.read("!B")[0]
14227 assert(_type == 18)
14228 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080014229 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080014230 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070014231 obj.xid = reader.read("!L")[0]
14232 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070014233 assert(_stats_type == 5)
Dan Talaycof6202252013-07-02 01:00:29 -070014234 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070014235 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -070014236 obj.port_no = util.unpack_port_no(reader)
14237 obj.queue_id = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070014238 return obj
14239
14240 def __eq__(self, other):
14241 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070014242 if self.xid != other.xid: return False
14243 if self.flags != other.flags: return False
14244 if self.port_no != other.port_no: return False
14245 if self.queue_id != other.queue_id: return False
14246 return True
14247
Rich Lanec2ee4b82013-04-24 17:12:38 -070014248 def pretty_print(self, q):
14249 q.text("queue_stats_request {")
14250 with q.group():
14251 with q.indent(2):
14252 q.breakable()
14253 q.text("xid = ");
14254 if self.xid != None:
14255 q.text("%#x" % self.xid)
14256 else:
14257 q.text('None')
14258 q.text(","); q.breakable()
14259 q.text("flags = ");
14260 q.text("%#x" % self.flags)
14261 q.text(","); q.breakable()
14262 q.text("port_no = ");
14263 q.text(util.pretty_port(self.port_no))
14264 q.text(","); q.breakable()
14265 q.text("queue_id = ");
14266 q.text("%#x" % self.queue_id)
14267 q.breakable()
14268 q.text('}')
14269
Rich Lane7dcdf022013-12-11 14:45:27 -080014270stats_request.subtypes[5] = queue_stats_request
14271
14272class role_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -070014273 version = 4
14274 type = 25
Rich Lanec2ee4b82013-04-24 17:12:38 -070014275
Rich Laned9e3f7b2013-11-04 11:40:43 -080014276 def __init__(self, xid=None, role=None, generation_id=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080014277 if xid != None:
14278 self.xid = xid
14279 else:
14280 self.xid = None
Rich Laned9e3f7b2013-11-04 11:40:43 -080014281 if role != None:
14282 self.role = role
Rich Lanec2ee4b82013-04-24 17:12:38 -070014283 else:
Rich Laned9e3f7b2013-11-04 11:40:43 -080014284 self.role = 0
14285 if generation_id != None:
14286 self.generation_id = generation_id
14287 else:
14288 self.generation_id = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080014289 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070014290
14291 def pack(self):
14292 packed = []
14293 packed.append(struct.pack("!B", self.version))
14294 packed.append(struct.pack("!B", self.type))
14295 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14296 packed.append(struct.pack("!L", self.xid))
Rich Laned9e3f7b2013-11-04 11:40:43 -080014297 packed.append(struct.pack("!L", self.role))
14298 packed.append('\x00' * 4)
14299 packed.append(struct.pack("!Q", self.generation_id))
Rich Lanec2ee4b82013-04-24 17:12:38 -070014300 length = sum([len(x) for x in packed])
14301 packed[2] = struct.pack("!H", length)
14302 return ''.join(packed)
14303
14304 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080014305 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070014306 obj = role_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070014307 _version = reader.read("!B")[0]
14308 assert(_version == 4)
14309 _type = reader.read("!B")[0]
14310 assert(_type == 25)
14311 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080014312 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080014313 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070014314 obj.xid = reader.read("!L")[0]
Rich Laned9e3f7b2013-11-04 11:40:43 -080014315 obj.role = reader.read("!L")[0]
14316 reader.skip(4)
14317 obj.generation_id = reader.read("!Q")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070014318 return obj
14319
14320 def __eq__(self, other):
14321 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070014322 if self.xid != other.xid: return False
Rich Laned9e3f7b2013-11-04 11:40:43 -080014323 if self.role != other.role: return False
14324 if self.generation_id != other.generation_id: return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070014325 return True
14326
Rich Lanec2ee4b82013-04-24 17:12:38 -070014327 def pretty_print(self, q):
14328 q.text("role_reply {")
14329 with q.group():
14330 with q.indent(2):
14331 q.breakable()
14332 q.text("xid = ");
14333 if self.xid != None:
14334 q.text("%#x" % self.xid)
14335 else:
14336 q.text('None')
14337 q.text(","); q.breakable()
Rich Laned9e3f7b2013-11-04 11:40:43 -080014338 q.text("role = ");
14339 q.text("%#x" % self.role)
14340 q.text(","); q.breakable()
14341 q.text("generation_id = ");
14342 q.text("%#x" % self.generation_id)
Rich Lanec2ee4b82013-04-24 17:12:38 -070014343 q.breakable()
14344 q.text('}')
14345
Rich Lane7dcdf022013-12-11 14:45:27 -080014346message.subtypes[25] = role_reply
14347
14348class role_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -070014349 version = 4
14350 type = 24
Rich Lanec2ee4b82013-04-24 17:12:38 -070014351
14352 def __init__(self, xid=None, role=None, generation_id=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080014353 if xid != None:
14354 self.xid = xid
14355 else:
14356 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070014357 if role != None:
14358 self.role = role
14359 else:
14360 self.role = 0
14361 if generation_id != None:
14362 self.generation_id = generation_id
14363 else:
14364 self.generation_id = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080014365 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070014366
14367 def pack(self):
14368 packed = []
14369 packed.append(struct.pack("!B", self.version))
14370 packed.append(struct.pack("!B", self.type))
14371 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14372 packed.append(struct.pack("!L", self.xid))
14373 packed.append(struct.pack("!L", self.role))
14374 packed.append('\x00' * 4)
14375 packed.append(struct.pack("!Q", self.generation_id))
14376 length = sum([len(x) for x in packed])
14377 packed[2] = struct.pack("!H", length)
14378 return ''.join(packed)
14379
14380 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080014381 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070014382 obj = role_request()
Dan Talaycof6202252013-07-02 01:00:29 -070014383 _version = reader.read("!B")[0]
14384 assert(_version == 4)
14385 _type = reader.read("!B")[0]
14386 assert(_type == 24)
14387 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080014388 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080014389 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070014390 obj.xid = reader.read("!L")[0]
14391 obj.role = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070014392 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -070014393 obj.generation_id = reader.read("!Q")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070014394 return obj
14395
14396 def __eq__(self, other):
14397 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070014398 if self.xid != other.xid: return False
14399 if self.role != other.role: return False
14400 if self.generation_id != other.generation_id: return False
14401 return True
14402
Rich Lanec2ee4b82013-04-24 17:12:38 -070014403 def pretty_print(self, q):
14404 q.text("role_request {")
14405 with q.group():
14406 with q.indent(2):
14407 q.breakable()
14408 q.text("xid = ");
14409 if self.xid != None:
14410 q.text("%#x" % self.xid)
14411 else:
14412 q.text('None')
14413 q.text(","); q.breakable()
14414 q.text("role = ");
14415 q.text("%#x" % self.role)
14416 q.text(","); q.breakable()
14417 q.text("generation_id = ");
14418 q.text("%#x" % self.generation_id)
14419 q.breakable()
14420 q.text('}')
14421
Rich Lane7dcdf022013-12-11 14:45:27 -080014422message.subtypes[24] = role_request
14423
14424class role_request_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -070014425 version = 4
14426 type = 1
14427 err_type = 11
14428
14429 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080014430 if xid != None:
14431 self.xid = xid
14432 else:
14433 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -070014434 if code != None:
14435 self.code = code
14436 else:
14437 self.code = 0
14438 if data != None:
14439 self.data = data
14440 else:
14441 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080014442 return
Rich Lane6f4978c2013-10-20 21:33:52 -070014443
14444 def pack(self):
14445 packed = []
14446 packed.append(struct.pack("!B", self.version))
14447 packed.append(struct.pack("!B", self.type))
14448 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14449 packed.append(struct.pack("!L", self.xid))
14450 packed.append(struct.pack("!H", self.err_type))
14451 packed.append(struct.pack("!H", self.code))
14452 packed.append(self.data)
14453 length = sum([len(x) for x in packed])
14454 packed[2] = struct.pack("!H", length)
14455 return ''.join(packed)
14456
14457 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080014458 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -070014459 obj = role_request_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -070014460 _version = reader.read("!B")[0]
14461 assert(_version == 4)
14462 _type = reader.read("!B")[0]
14463 assert(_type == 1)
14464 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080014465 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080014466 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -070014467 obj.xid = reader.read("!L")[0]
14468 _err_type = reader.read("!H")[0]
14469 assert(_err_type == 11)
14470 obj.code = reader.read("!H")[0]
14471 obj.data = str(reader.read_all())
14472 return obj
14473
14474 def __eq__(self, other):
14475 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -070014476 if self.xid != other.xid: return False
14477 if self.code != other.code: return False
14478 if self.data != other.data: return False
14479 return True
14480
Rich Lane6f4978c2013-10-20 21:33:52 -070014481 def pretty_print(self, q):
14482 q.text("role_request_failed_error_msg {")
14483 with q.group():
14484 with q.indent(2):
14485 q.breakable()
14486 q.text("xid = ");
14487 if self.xid != None:
14488 q.text("%#x" % self.xid)
14489 else:
14490 q.text('None')
14491 q.text(","); q.breakable()
14492 q.text("code = ");
14493 q.text("%#x" % self.code)
14494 q.text(","); q.breakable()
14495 q.text("data = ");
14496 q.pp(self.data)
14497 q.breakable()
14498 q.text('}')
14499
Rich Lane7dcdf022013-12-11 14:45:27 -080014500error_msg.subtypes[11] = role_request_failed_error_msg
14501
14502class set_config(message):
Dan Talaycof6202252013-07-02 01:00:29 -070014503 version = 4
14504 type = 9
Rich Lanec2ee4b82013-04-24 17:12:38 -070014505
14506 def __init__(self, xid=None, flags=None, miss_send_len=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080014507 if xid != None:
14508 self.xid = xid
14509 else:
14510 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070014511 if flags != None:
14512 self.flags = flags
14513 else:
14514 self.flags = 0
14515 if miss_send_len != None:
14516 self.miss_send_len = miss_send_len
14517 else:
14518 self.miss_send_len = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080014519 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070014520
14521 def pack(self):
14522 packed = []
14523 packed.append(struct.pack("!B", self.version))
14524 packed.append(struct.pack("!B", self.type))
14525 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14526 packed.append(struct.pack("!L", self.xid))
14527 packed.append(struct.pack("!H", self.flags))
14528 packed.append(struct.pack("!H", self.miss_send_len))
14529 length = sum([len(x) for x in packed])
14530 packed[2] = struct.pack("!H", length)
14531 return ''.join(packed)
14532
14533 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080014534 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070014535 obj = set_config()
Dan Talaycof6202252013-07-02 01:00:29 -070014536 _version = reader.read("!B")[0]
14537 assert(_version == 4)
14538 _type = reader.read("!B")[0]
14539 assert(_type == 9)
14540 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080014541 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080014542 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070014543 obj.xid = reader.read("!L")[0]
14544 obj.flags = reader.read("!H")[0]
14545 obj.miss_send_len = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070014546 return obj
14547
14548 def __eq__(self, other):
14549 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070014550 if self.xid != other.xid: return False
14551 if self.flags != other.flags: return False
14552 if self.miss_send_len != other.miss_send_len: return False
14553 return True
14554
Rich Lanec2ee4b82013-04-24 17:12:38 -070014555 def pretty_print(self, q):
14556 q.text("set_config {")
14557 with q.group():
14558 with q.indent(2):
14559 q.breakable()
14560 q.text("xid = ");
14561 if self.xid != None:
14562 q.text("%#x" % self.xid)
14563 else:
14564 q.text('None')
14565 q.text(","); q.breakable()
14566 q.text("flags = ");
14567 q.text("%#x" % self.flags)
14568 q.text(","); q.breakable()
14569 q.text("miss_send_len = ");
14570 q.text("%#x" % self.miss_send_len)
14571 q.breakable()
14572 q.text('}')
14573
Rich Lane7dcdf022013-12-11 14:45:27 -080014574message.subtypes[9] = set_config
14575
14576class switch_config_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -070014577 version = 4
14578 type = 1
14579 err_type = 10
14580
14581 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080014582 if xid != None:
14583 self.xid = xid
14584 else:
14585 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -070014586 if code != None:
14587 self.code = code
14588 else:
14589 self.code = 0
14590 if data != None:
14591 self.data = data
14592 else:
14593 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080014594 return
Rich Lane6f4978c2013-10-20 21:33:52 -070014595
14596 def pack(self):
14597 packed = []
14598 packed.append(struct.pack("!B", self.version))
14599 packed.append(struct.pack("!B", self.type))
14600 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14601 packed.append(struct.pack("!L", self.xid))
14602 packed.append(struct.pack("!H", self.err_type))
14603 packed.append(struct.pack("!H", self.code))
14604 packed.append(self.data)
14605 length = sum([len(x) for x in packed])
14606 packed[2] = struct.pack("!H", length)
14607 return ''.join(packed)
14608
14609 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080014610 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -070014611 obj = switch_config_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -070014612 _version = reader.read("!B")[0]
14613 assert(_version == 4)
14614 _type = reader.read("!B")[0]
14615 assert(_type == 1)
14616 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080014617 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080014618 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -070014619 obj.xid = reader.read("!L")[0]
14620 _err_type = reader.read("!H")[0]
14621 assert(_err_type == 10)
14622 obj.code = reader.read("!H")[0]
14623 obj.data = str(reader.read_all())
14624 return obj
14625
14626 def __eq__(self, other):
14627 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -070014628 if self.xid != other.xid: return False
14629 if self.code != other.code: return False
14630 if self.data != other.data: return False
14631 return True
14632
Rich Lane6f4978c2013-10-20 21:33:52 -070014633 def pretty_print(self, q):
14634 q.text("switch_config_failed_error_msg {")
14635 with q.group():
14636 with q.indent(2):
14637 q.breakable()
14638 q.text("xid = ");
14639 if self.xid != None:
14640 q.text("%#x" % self.xid)
14641 else:
14642 q.text('None')
14643 q.text(","); q.breakable()
14644 q.text("code = ");
14645 q.text("%#x" % self.code)
14646 q.text(","); q.breakable()
14647 q.text("data = ");
14648 q.pp(self.data)
14649 q.breakable()
14650 q.text('}')
14651
Rich Lane7dcdf022013-12-11 14:45:27 -080014652error_msg.subtypes[10] = switch_config_failed_error_msg
14653
14654class table_features_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -070014655 version = 4
14656 type = 1
14657 err_type = 13
14658
14659 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080014660 if xid != None:
14661 self.xid = xid
14662 else:
14663 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -070014664 if code != None:
14665 self.code = code
14666 else:
14667 self.code = 0
14668 if data != None:
14669 self.data = data
14670 else:
14671 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080014672 return
Rich Lane6f4978c2013-10-20 21:33:52 -070014673
14674 def pack(self):
14675 packed = []
14676 packed.append(struct.pack("!B", self.version))
14677 packed.append(struct.pack("!B", self.type))
14678 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14679 packed.append(struct.pack("!L", self.xid))
14680 packed.append(struct.pack("!H", self.err_type))
14681 packed.append(struct.pack("!H", self.code))
14682 packed.append(self.data)
14683 length = sum([len(x) for x in packed])
14684 packed[2] = struct.pack("!H", length)
14685 return ''.join(packed)
14686
14687 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080014688 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -070014689 obj = table_features_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -070014690 _version = reader.read("!B")[0]
14691 assert(_version == 4)
14692 _type = reader.read("!B")[0]
14693 assert(_type == 1)
14694 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080014695 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080014696 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -070014697 obj.xid = reader.read("!L")[0]
14698 _err_type = reader.read("!H")[0]
14699 assert(_err_type == 13)
14700 obj.code = reader.read("!H")[0]
14701 obj.data = str(reader.read_all())
14702 return obj
14703
14704 def __eq__(self, other):
14705 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -070014706 if self.xid != other.xid: return False
14707 if self.code != other.code: return False
14708 if self.data != other.data: return False
14709 return True
14710
Rich Lane6f4978c2013-10-20 21:33:52 -070014711 def pretty_print(self, q):
14712 q.text("table_features_failed_error_msg {")
14713 with q.group():
14714 with q.indent(2):
14715 q.breakable()
14716 q.text("xid = ");
14717 if self.xid != None:
14718 q.text("%#x" % self.xid)
14719 else:
14720 q.text('None')
14721 q.text(","); q.breakable()
14722 q.text("code = ");
14723 q.text("%#x" % self.code)
14724 q.text(","); q.breakable()
14725 q.text("data = ");
14726 q.pp(self.data)
14727 q.breakable()
14728 q.text('}')
14729
Rich Lane7dcdf022013-12-11 14:45:27 -080014730error_msg.subtypes[13] = table_features_failed_error_msg
14731
14732class table_features_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070014733 version = 4
14734 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070014735 stats_type = 12
14736
14737 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080014738 if xid != None:
14739 self.xid = xid
14740 else:
14741 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070014742 if flags != None:
14743 self.flags = flags
14744 else:
14745 self.flags = 0
14746 if entries != None:
14747 self.entries = entries
14748 else:
14749 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -080014750 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070014751
14752 def pack(self):
14753 packed = []
14754 packed.append(struct.pack("!B", self.version))
14755 packed.append(struct.pack("!B", self.type))
14756 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14757 packed.append(struct.pack("!L", self.xid))
14758 packed.append(struct.pack("!H", self.stats_type))
14759 packed.append(struct.pack("!H", self.flags))
14760 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080014761 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -070014762 length = sum([len(x) for x in packed])
14763 packed[2] = struct.pack("!H", length)
14764 return ''.join(packed)
14765
14766 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080014767 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070014768 obj = table_features_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070014769 _version = reader.read("!B")[0]
14770 assert(_version == 4)
14771 _type = reader.read("!B")[0]
14772 assert(_type == 19)
14773 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080014774 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080014775 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070014776 obj.xid = reader.read("!L")[0]
14777 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070014778 assert(_stats_type == 12)
Dan Talaycof6202252013-07-02 01:00:29 -070014779 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070014780 reader.skip(4)
Rich Lanee2567702015-01-26 15:04:35 -080014781 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.table_features.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070014782 return obj
14783
14784 def __eq__(self, other):
14785 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070014786 if self.xid != other.xid: return False
14787 if self.flags != other.flags: return False
14788 if self.entries != other.entries: return False
14789 return True
14790
Rich Lanec2ee4b82013-04-24 17:12:38 -070014791 def pretty_print(self, q):
14792 q.text("table_features_stats_reply {")
14793 with q.group():
14794 with q.indent(2):
14795 q.breakable()
14796 q.text("xid = ");
14797 if self.xid != None:
14798 q.text("%#x" % self.xid)
14799 else:
14800 q.text('None')
14801 q.text(","); q.breakable()
14802 q.text("flags = ");
14803 q.text("%#x" % self.flags)
14804 q.text(","); q.breakable()
14805 q.text("entries = ");
14806 q.pp(self.entries)
14807 q.breakable()
14808 q.text('}')
14809
Rich Lane7dcdf022013-12-11 14:45:27 -080014810stats_reply.subtypes[12] = table_features_stats_reply
14811
14812class table_features_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070014813 version = 4
14814 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070014815 stats_type = 12
14816
14817 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080014818 if xid != None:
14819 self.xid = xid
14820 else:
14821 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070014822 if flags != None:
14823 self.flags = flags
14824 else:
14825 self.flags = 0
14826 if entries != None:
14827 self.entries = entries
14828 else:
14829 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -080014830 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070014831
14832 def pack(self):
14833 packed = []
14834 packed.append(struct.pack("!B", self.version))
14835 packed.append(struct.pack("!B", self.type))
14836 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14837 packed.append(struct.pack("!L", self.xid))
14838 packed.append(struct.pack("!H", self.stats_type))
14839 packed.append(struct.pack("!H", self.flags))
14840 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080014841 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -070014842 length = sum([len(x) for x in packed])
14843 packed[2] = struct.pack("!H", length)
14844 return ''.join(packed)
14845
14846 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080014847 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070014848 obj = table_features_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070014849 _version = reader.read("!B")[0]
14850 assert(_version == 4)
14851 _type = reader.read("!B")[0]
14852 assert(_type == 18)
14853 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080014854 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080014855 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070014856 obj.xid = reader.read("!L")[0]
14857 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070014858 assert(_stats_type == 12)
Dan Talaycof6202252013-07-02 01:00:29 -070014859 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070014860 reader.skip(4)
Rich Lanee2567702015-01-26 15:04:35 -080014861 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.table_features.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070014862 return obj
14863
14864 def __eq__(self, other):
14865 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070014866 if self.xid != other.xid: return False
14867 if self.flags != other.flags: return False
14868 if self.entries != other.entries: return False
14869 return True
14870
Rich Lanec2ee4b82013-04-24 17:12:38 -070014871 def pretty_print(self, q):
14872 q.text("table_features_stats_request {")
14873 with q.group():
14874 with q.indent(2):
14875 q.breakable()
14876 q.text("xid = ");
14877 if self.xid != None:
14878 q.text("%#x" % self.xid)
14879 else:
14880 q.text('None')
14881 q.text(","); q.breakable()
14882 q.text("flags = ");
14883 q.text("%#x" % self.flags)
14884 q.text(","); q.breakable()
14885 q.text("entries = ");
14886 q.pp(self.entries)
14887 q.breakable()
14888 q.text('}')
14889
Rich Lane7dcdf022013-12-11 14:45:27 -080014890stats_request.subtypes[12] = table_features_stats_request
14891
14892class table_mod(message):
Dan Talaycof6202252013-07-02 01:00:29 -070014893 version = 4
14894 type = 17
Rich Lanec2ee4b82013-04-24 17:12:38 -070014895
14896 def __init__(self, xid=None, table_id=None, config=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080014897 if xid != None:
14898 self.xid = xid
14899 else:
14900 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070014901 if table_id != None:
14902 self.table_id = table_id
14903 else:
14904 self.table_id = 0
14905 if config != None:
14906 self.config = config
14907 else:
14908 self.config = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080014909 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070014910
14911 def pack(self):
14912 packed = []
14913 packed.append(struct.pack("!B", self.version))
14914 packed.append(struct.pack("!B", self.type))
14915 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14916 packed.append(struct.pack("!L", self.xid))
14917 packed.append(struct.pack("!B", self.table_id))
14918 packed.append('\x00' * 3)
14919 packed.append(struct.pack("!L", self.config))
14920 length = sum([len(x) for x in packed])
14921 packed[2] = struct.pack("!H", length)
14922 return ''.join(packed)
14923
14924 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080014925 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070014926 obj = table_mod()
Dan Talaycof6202252013-07-02 01:00:29 -070014927 _version = reader.read("!B")[0]
14928 assert(_version == 4)
14929 _type = reader.read("!B")[0]
14930 assert(_type == 17)
14931 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080014932 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080014933 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070014934 obj.xid = reader.read("!L")[0]
14935 obj.table_id = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070014936 reader.skip(3)
Dan Talaycof6202252013-07-02 01:00:29 -070014937 obj.config = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070014938 return obj
14939
14940 def __eq__(self, other):
14941 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070014942 if self.xid != other.xid: return False
14943 if self.table_id != other.table_id: return False
14944 if self.config != other.config: return False
14945 return True
14946
Rich Lanec2ee4b82013-04-24 17:12:38 -070014947 def pretty_print(self, q):
14948 q.text("table_mod {")
14949 with q.group():
14950 with q.indent(2):
14951 q.breakable()
14952 q.text("xid = ");
14953 if self.xid != None:
14954 q.text("%#x" % self.xid)
14955 else:
14956 q.text('None')
14957 q.text(","); q.breakable()
14958 q.text("table_id = ");
14959 q.text("%#x" % self.table_id)
14960 q.text(","); q.breakable()
14961 q.text("config = ");
14962 q.text("%#x" % self.config)
14963 q.breakable()
14964 q.text('}')
14965
Rich Lane7dcdf022013-12-11 14:45:27 -080014966message.subtypes[17] = table_mod
14967
14968class table_mod_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -070014969 version = 4
14970 type = 1
14971 err_type = 8
14972
14973 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080014974 if xid != None:
14975 self.xid = xid
14976 else:
14977 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -070014978 if code != None:
14979 self.code = code
14980 else:
14981 self.code = 0
14982 if data != None:
14983 self.data = data
14984 else:
14985 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080014986 return
Rich Lane6f4978c2013-10-20 21:33:52 -070014987
14988 def pack(self):
14989 packed = []
14990 packed.append(struct.pack("!B", self.version))
14991 packed.append(struct.pack("!B", self.type))
14992 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14993 packed.append(struct.pack("!L", self.xid))
14994 packed.append(struct.pack("!H", self.err_type))
14995 packed.append(struct.pack("!H", self.code))
14996 packed.append(self.data)
14997 length = sum([len(x) for x in packed])
14998 packed[2] = struct.pack("!H", length)
14999 return ''.join(packed)
15000
15001 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080015002 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -070015003 obj = table_mod_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -070015004 _version = reader.read("!B")[0]
15005 assert(_version == 4)
15006 _type = reader.read("!B")[0]
15007 assert(_type == 1)
15008 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080015009 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080015010 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -070015011 obj.xid = reader.read("!L")[0]
15012 _err_type = reader.read("!H")[0]
15013 assert(_err_type == 8)
15014 obj.code = reader.read("!H")[0]
15015 obj.data = str(reader.read_all())
15016 return obj
15017
15018 def __eq__(self, other):
15019 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -070015020 if self.xid != other.xid: return False
15021 if self.code != other.code: return False
15022 if self.data != other.data: return False
15023 return True
15024
Rich Lane6f4978c2013-10-20 21:33:52 -070015025 def pretty_print(self, q):
15026 q.text("table_mod_failed_error_msg {")
15027 with q.group():
15028 with q.indent(2):
15029 q.breakable()
15030 q.text("xid = ");
15031 if self.xid != None:
15032 q.text("%#x" % self.xid)
15033 else:
15034 q.text('None')
15035 q.text(","); q.breakable()
15036 q.text("code = ");
15037 q.text("%#x" % self.code)
15038 q.text(","); q.breakable()
15039 q.text("data = ");
15040 q.pp(self.data)
15041 q.breakable()
15042 q.text('}')
15043
Rich Lane7dcdf022013-12-11 14:45:27 -080015044error_msg.subtypes[8] = table_mod_failed_error_msg
15045
15046class table_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070015047 version = 4
15048 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070015049 stats_type = 3
15050
15051 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080015052 if xid != None:
15053 self.xid = xid
15054 else:
15055 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070015056 if flags != None:
15057 self.flags = flags
15058 else:
15059 self.flags = 0
15060 if entries != None:
15061 self.entries = entries
15062 else:
15063 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -080015064 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070015065
15066 def pack(self):
15067 packed = []
15068 packed.append(struct.pack("!B", self.version))
15069 packed.append(struct.pack("!B", self.type))
15070 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
15071 packed.append(struct.pack("!L", self.xid))
15072 packed.append(struct.pack("!H", self.stats_type))
15073 packed.append(struct.pack("!H", self.flags))
15074 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080015075 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -070015076 length = sum([len(x) for x in packed])
15077 packed[2] = struct.pack("!H", length)
15078 return ''.join(packed)
15079
15080 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080015081 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070015082 obj = table_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070015083 _version = reader.read("!B")[0]
15084 assert(_version == 4)
15085 _type = reader.read("!B")[0]
15086 assert(_type == 19)
15087 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080015088 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080015089 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070015090 obj.xid = reader.read("!L")[0]
15091 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070015092 assert(_stats_type == 3)
Dan Talaycof6202252013-07-02 01:00:29 -070015093 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070015094 reader.skip(4)
Rich Lanee2567702015-01-26 15:04:35 -080015095 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.table_stats_entry.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070015096 return obj
15097
15098 def __eq__(self, other):
15099 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070015100 if self.xid != other.xid: return False
15101 if self.flags != other.flags: return False
15102 if self.entries != other.entries: return False
15103 return True
15104
Rich Lanec2ee4b82013-04-24 17:12:38 -070015105 def pretty_print(self, q):
15106 q.text("table_stats_reply {")
15107 with q.group():
15108 with q.indent(2):
15109 q.breakable()
15110 q.text("xid = ");
15111 if self.xid != None:
15112 q.text("%#x" % self.xid)
15113 else:
15114 q.text('None')
15115 q.text(","); q.breakable()
15116 q.text("flags = ");
15117 q.text("%#x" % self.flags)
15118 q.text(","); q.breakable()
15119 q.text("entries = ");
15120 q.pp(self.entries)
15121 q.breakable()
15122 q.text('}')
15123
Rich Lane7dcdf022013-12-11 14:45:27 -080015124stats_reply.subtypes[3] = table_stats_reply
15125
15126class table_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070015127 version = 4
15128 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070015129 stats_type = 3
15130
15131 def __init__(self, xid=None, flags=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080015132 if xid != None:
15133 self.xid = xid
15134 else:
15135 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070015136 if flags != None:
15137 self.flags = flags
15138 else:
15139 self.flags = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080015140 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070015141
15142 def pack(self):
15143 packed = []
15144 packed.append(struct.pack("!B", self.version))
15145 packed.append(struct.pack("!B", self.type))
15146 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
15147 packed.append(struct.pack("!L", self.xid))
15148 packed.append(struct.pack("!H", self.stats_type))
15149 packed.append(struct.pack("!H", self.flags))
15150 packed.append('\x00' * 4)
15151 length = sum([len(x) for x in packed])
15152 packed[2] = struct.pack("!H", length)
15153 return ''.join(packed)
15154
15155 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080015156 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070015157 obj = table_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070015158 _version = reader.read("!B")[0]
15159 assert(_version == 4)
15160 _type = reader.read("!B")[0]
15161 assert(_type == 18)
15162 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080015163 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080015164 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070015165 obj.xid = reader.read("!L")[0]
15166 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070015167 assert(_stats_type == 3)
Dan Talaycof6202252013-07-02 01:00:29 -070015168 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070015169 reader.skip(4)
15170 return obj
15171
15172 def __eq__(self, other):
15173 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070015174 if self.xid != other.xid: return False
15175 if self.flags != other.flags: return False
15176 return True
15177
Rich Lanec2ee4b82013-04-24 17:12:38 -070015178 def pretty_print(self, q):
15179 q.text("table_stats_request {")
15180 with q.group():
15181 with q.indent(2):
15182 q.breakable()
15183 q.text("xid = ");
15184 if self.xid != None:
15185 q.text("%#x" % self.xid)
15186 else:
15187 q.text('None')
15188 q.text(","); q.breakable()
15189 q.text("flags = ");
15190 q.text("%#x" % self.flags)
15191 q.breakable()
15192 q.text('}')
15193
Rich Lane7dcdf022013-12-11 14:45:27 -080015194stats_request.subtypes[3] = table_stats_request
15195
Rich Lanec2ee4b82013-04-24 17:12:38 -070015196
15197def parse_header(buf):
15198 if len(buf) < 8:
15199 raise loxi.ProtocolError("too short to be an OpenFlow message")
15200 return struct.unpack_from("!BBHL", buf)
15201
15202def parse_message(buf):
15203 msg_ver, msg_type, msg_len, msg_xid = parse_header(buf)
Rich Lanee2567702015-01-26 15:04:35 -080015204 if msg_ver != ofp.OFP_VERSION and msg_type != ofp.OFPT_HELLO:
15205 raise loxi.ProtocolError("wrong OpenFlow version (expected %d, got %d)" % (ofp.OFP_VERSION, msg_ver))
Rich Lanec2ee4b82013-04-24 17:12:38 -070015206 if len(buf) != msg_len:
15207 raise loxi.ProtocolError("incorrect message size")
Rich Lane7dcdf022013-12-11 14:45:27 -080015208 return message.unpack(loxi.generic_util.OFReader(buf))