blob: c9f27e6ed2175f6a74ab4fb3913969678f822bef [file] [log] [blame]
Matteo Scandoloa229eca2017-08-08 13:05:28 -07001
2# Copyright 2017-present Open Networking Foundation
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16
Rich Lanec2ee4b82013-04-24 17:12:38 -070017# Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
18# Copyright (c) 2011, 2012 Open Networking Foundation
19# Copyright (c) 2012, 2013 Big Switch Networks, Inc.
Dan Talaycof6202252013-07-02 01:00:29 -070020# See the file LICENSE.pyloxi which should have been included in the source distribution
Rich Lanec2ee4b82013-04-24 17:12:38 -070021
Rich Lane7dcdf022013-12-11 14:45:27 -080022# Automatically generated by LOXI from template module.py
Rich Lanec2ee4b82013-04-24 17:12:38 -070023# Do not modify
24
25import struct
26import loxi
Rich Lanec2ee4b82013-04-24 17:12:38 -070027import util
28import loxi.generic_util
29
Rich Lanee2567702015-01-26 15:04:35 -080030import sys
31ofp = sys.modules['loxi.of13']
32
Rich Lane7dcdf022013-12-11 14:45:27 -080033class message(loxi.OFObject):
34 subtypes = {}
Rich Lanec2ee4b82013-04-24 17:12:38 -070035
Rich Lane95f7fc92014-01-27 17:08:16 -080036 version = 4
37
38 def __init__(self, type=None, xid=None):
39 if type != None:
40 self.type = type
41 else:
42 self.type = 0
43 if xid != None:
44 self.xid = xid
45 else:
46 self.xid = None
47 return
48
49 def pack(self):
50 packed = []
51 packed.append(struct.pack("!B", self.version))
52 packed.append(struct.pack("!B", self.type))
53 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
54 packed.append(struct.pack("!L", self.xid))
55 length = sum([len(x) for x in packed])
56 packed[2] = struct.pack("!H", length)
57 return ''.join(packed)
58
Rich Lane7dcdf022013-12-11 14:45:27 -080059 @staticmethod
60 def unpack(reader):
61 subtype, = reader.peek('B', 1)
Rich Lane95f7fc92014-01-27 17:08:16 -080062 subclass = message.subtypes.get(subtype)
63 if subclass:
64 return subclass.unpack(reader)
65
66 obj = message()
67 _version = reader.read("!B")[0]
68 assert(_version == 4)
69 obj.type = reader.read("!B")[0]
70 _length = reader.read("!H")[0]
71 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080072 reader = orig_reader.slice(_length, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -080073 obj.xid = reader.read("!L")[0]
74 return obj
75
76 def __eq__(self, other):
77 if type(self) != type(other): return False
78 if self.type != other.type: return False
79 if self.xid != other.xid: return False
80 return True
81
82 def pretty_print(self, q):
83 q.text("message {")
84 with q.group():
85 with q.indent(2):
86 q.breakable()
87 q.text("xid = ");
88 if self.xid != None:
89 q.text("%#x" % self.xid)
90 else:
91 q.text('None')
92 q.breakable()
93 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -080094
95
96class stats_reply(message):
97 subtypes = {}
98
Rich Lane95f7fc92014-01-27 17:08:16 -080099 version = 4
100 type = 19
101
102 def __init__(self, xid=None, stats_type=None, flags=None):
103 if xid != None:
104 self.xid = xid
105 else:
106 self.xid = None
107 if stats_type != None:
108 self.stats_type = stats_type
109 else:
110 self.stats_type = 0
111 if flags != None:
112 self.flags = flags
113 else:
114 self.flags = 0
115 return
116
117 def pack(self):
118 packed = []
119 packed.append(struct.pack("!B", self.version))
120 packed.append(struct.pack("!B", self.type))
121 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
122 packed.append(struct.pack("!L", self.xid))
123 packed.append(struct.pack("!H", self.stats_type))
124 packed.append(struct.pack("!H", self.flags))
125 packed.append('\x00' * 4)
126 length = sum([len(x) for x in packed])
127 packed[2] = struct.pack("!H", length)
128 return ''.join(packed)
129
Rich Lane7dcdf022013-12-11 14:45:27 -0800130 @staticmethod
131 def unpack(reader):
132 subtype, = reader.peek('!H', 8)
Rich Lane95f7fc92014-01-27 17:08:16 -0800133 subclass = stats_reply.subtypes.get(subtype)
134 if subclass:
135 return subclass.unpack(reader)
136
137 obj = stats_reply()
138 _version = reader.read("!B")[0]
139 assert(_version == 4)
140 _type = reader.read("!B")[0]
141 assert(_type == 19)
142 _length = reader.read("!H")[0]
143 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800144 reader = orig_reader.slice(_length, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -0800145 obj.xid = reader.read("!L")[0]
146 obj.stats_type = reader.read("!H")[0]
147 obj.flags = reader.read("!H")[0]
148 reader.skip(4)
149 return obj
150
151 def __eq__(self, other):
152 if type(self) != type(other): return False
153 if self.xid != other.xid: return False
154 if self.stats_type != other.stats_type: return False
155 if self.flags != other.flags: return False
156 return True
157
158 def pretty_print(self, q):
159 q.text("stats_reply {")
160 with q.group():
161 with q.indent(2):
162 q.breakable()
163 q.text("xid = ");
164 if self.xid != None:
165 q.text("%#x" % self.xid)
166 else:
167 q.text('None')
168 q.text(","); q.breakable()
169 q.text("flags = ");
170 q.text("%#x" % self.flags)
171 q.breakable()
172 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -0800173
174message.subtypes[19] = stats_reply
175
176class aggregate_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -0700177 version = 4
178 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -0700179 stats_type = 2
180
181 def __init__(self, xid=None, flags=None, packet_count=None, byte_count=None, flow_count=None):
Rich Lane7dcdf022013-12-11 14:45:27 -0800182 if xid != None:
183 self.xid = xid
184 else:
185 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -0700186 if flags != None:
187 self.flags = flags
188 else:
189 self.flags = 0
190 if packet_count != None:
191 self.packet_count = packet_count
192 else:
193 self.packet_count = 0
194 if byte_count != None:
195 self.byte_count = byte_count
196 else:
197 self.byte_count = 0
198 if flow_count != None:
199 self.flow_count = flow_count
200 else:
201 self.flow_count = 0
Rich Lane7dcdf022013-12-11 14:45:27 -0800202 return
Rich Lanec2ee4b82013-04-24 17:12:38 -0700203
204 def pack(self):
205 packed = []
206 packed.append(struct.pack("!B", self.version))
207 packed.append(struct.pack("!B", self.type))
208 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
209 packed.append(struct.pack("!L", self.xid))
210 packed.append(struct.pack("!H", self.stats_type))
211 packed.append(struct.pack("!H", self.flags))
212 packed.append('\x00' * 4)
213 packed.append(struct.pack("!Q", self.packet_count))
214 packed.append(struct.pack("!Q", self.byte_count))
215 packed.append(struct.pack("!L", self.flow_count))
216 packed.append('\x00' * 4)
217 length = sum([len(x) for x in packed])
218 packed[2] = struct.pack("!H", length)
219 return ''.join(packed)
220
221 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800222 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700223 obj = aggregate_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -0700224 _version = reader.read("!B")[0]
225 assert(_version == 4)
226 _type = reader.read("!B")[0]
227 assert(_type == 19)
228 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800229 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800230 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -0700231 obj.xid = reader.read("!L")[0]
232 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700233 assert(_stats_type == 2)
Dan Talaycof6202252013-07-02 01:00:29 -0700234 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700235 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -0700236 obj.packet_count = reader.read("!Q")[0]
237 obj.byte_count = reader.read("!Q")[0]
238 obj.flow_count = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700239 reader.skip(4)
240 return obj
241
242 def __eq__(self, other):
243 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -0700244 if self.xid != other.xid: return False
245 if self.flags != other.flags: return False
246 if self.packet_count != other.packet_count: return False
247 if self.byte_count != other.byte_count: return False
248 if self.flow_count != other.flow_count: return False
249 return True
250
Rich Lanec2ee4b82013-04-24 17:12:38 -0700251 def pretty_print(self, q):
252 q.text("aggregate_stats_reply {")
253 with q.group():
254 with q.indent(2):
255 q.breakable()
256 q.text("xid = ");
257 if self.xid != None:
258 q.text("%#x" % self.xid)
259 else:
260 q.text('None')
261 q.text(","); q.breakable()
262 q.text("flags = ");
263 q.text("%#x" % self.flags)
264 q.text(","); q.breakable()
265 q.text("packet_count = ");
266 q.text("%#x" % self.packet_count)
267 q.text(","); q.breakable()
268 q.text("byte_count = ");
269 q.text("%#x" % self.byte_count)
270 q.text(","); q.breakable()
271 q.text("flow_count = ");
272 q.text("%#x" % self.flow_count)
273 q.breakable()
274 q.text('}')
275
Rich Lane7dcdf022013-12-11 14:45:27 -0800276stats_reply.subtypes[2] = aggregate_stats_reply
277
278class stats_request(message):
279 subtypes = {}
280
Rich Lane95f7fc92014-01-27 17:08:16 -0800281 version = 4
282 type = 18
283
284 def __init__(self, xid=None, stats_type=None, flags=None):
285 if xid != None:
286 self.xid = xid
287 else:
288 self.xid = None
289 if stats_type != None:
290 self.stats_type = stats_type
291 else:
292 self.stats_type = 0
293 if flags != None:
294 self.flags = flags
295 else:
296 self.flags = 0
297 return
298
299 def pack(self):
300 packed = []
301 packed.append(struct.pack("!B", self.version))
302 packed.append(struct.pack("!B", self.type))
303 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
304 packed.append(struct.pack("!L", self.xid))
305 packed.append(struct.pack("!H", self.stats_type))
306 packed.append(struct.pack("!H", self.flags))
307 packed.append('\x00' * 4)
308 length = sum([len(x) for x in packed])
309 packed[2] = struct.pack("!H", length)
310 return ''.join(packed)
311
Rich Lane7dcdf022013-12-11 14:45:27 -0800312 @staticmethod
313 def unpack(reader):
314 subtype, = reader.peek('!H', 8)
Rich Lane95f7fc92014-01-27 17:08:16 -0800315 subclass = stats_request.subtypes.get(subtype)
316 if subclass:
317 return subclass.unpack(reader)
318
319 obj = stats_request()
320 _version = reader.read("!B")[0]
321 assert(_version == 4)
322 _type = reader.read("!B")[0]
323 assert(_type == 18)
324 _length = reader.read("!H")[0]
325 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800326 reader = orig_reader.slice(_length, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -0800327 obj.xid = reader.read("!L")[0]
328 obj.stats_type = reader.read("!H")[0]
329 obj.flags = reader.read("!H")[0]
330 reader.skip(4)
331 return obj
332
333 def __eq__(self, other):
334 if type(self) != type(other): return False
335 if self.xid != other.xid: return False
336 if self.stats_type != other.stats_type: return False
337 if self.flags != other.flags: return False
338 return True
339
340 def pretty_print(self, q):
341 q.text("stats_request {")
342 with q.group():
343 with q.indent(2):
344 q.breakable()
345 q.text("xid = ");
346 if self.xid != None:
347 q.text("%#x" % self.xid)
348 else:
349 q.text('None')
350 q.text(","); q.breakable()
351 q.text("flags = ");
352 q.text("%#x" % self.flags)
353 q.breakable()
354 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -0800355
356message.subtypes[18] = stats_request
357
358class aggregate_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -0700359 version = 4
360 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -0700361 stats_type = 2
362
363 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 -0800364 if xid != None:
365 self.xid = xid
366 else:
367 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -0700368 if flags != None:
369 self.flags = flags
370 else:
371 self.flags = 0
372 if table_id != None:
373 self.table_id = table_id
374 else:
375 self.table_id = 0
376 if out_port != None:
377 self.out_port = out_port
378 else:
379 self.out_port = 0
380 if out_group != None:
381 self.out_group = out_group
382 else:
383 self.out_group = 0
384 if cookie != None:
385 self.cookie = cookie
386 else:
387 self.cookie = 0
388 if cookie_mask != None:
389 self.cookie_mask = cookie_mask
390 else:
391 self.cookie_mask = 0
392 if match != None:
393 self.match = match
394 else:
Rich Lanee2567702015-01-26 15:04:35 -0800395 self.match = ofp.match()
Rich Lane7dcdf022013-12-11 14:45:27 -0800396 return
Rich Lanec2ee4b82013-04-24 17:12:38 -0700397
398 def pack(self):
399 packed = []
400 packed.append(struct.pack("!B", self.version))
401 packed.append(struct.pack("!B", self.type))
402 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
403 packed.append(struct.pack("!L", self.xid))
404 packed.append(struct.pack("!H", self.stats_type))
405 packed.append(struct.pack("!H", self.flags))
406 packed.append('\x00' * 4)
407 packed.append(struct.pack("!B", self.table_id))
408 packed.append('\x00' * 3)
Dan Talaycof6202252013-07-02 01:00:29 -0700409 packed.append(util.pack_port_no(self.out_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700410 packed.append(struct.pack("!L", self.out_group))
411 packed.append('\x00' * 4)
412 packed.append(struct.pack("!Q", self.cookie))
413 packed.append(struct.pack("!Q", self.cookie_mask))
414 packed.append(self.match.pack())
415 length = sum([len(x) for x in packed])
416 packed[2] = struct.pack("!H", length)
417 return ''.join(packed)
418
419 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800420 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700421 obj = aggregate_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -0700422 _version = reader.read("!B")[0]
423 assert(_version == 4)
424 _type = reader.read("!B")[0]
425 assert(_type == 18)
426 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800427 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800428 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -0700429 obj.xid = reader.read("!L")[0]
430 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700431 assert(_stats_type == 2)
Dan Talaycof6202252013-07-02 01:00:29 -0700432 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700433 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -0700434 obj.table_id = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700435 reader.skip(3)
Dan Talaycof6202252013-07-02 01:00:29 -0700436 obj.out_port = util.unpack_port_no(reader)
437 obj.out_group = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700438 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -0700439 obj.cookie = reader.read("!Q")[0]
440 obj.cookie_mask = reader.read("!Q")[0]
Rich Lanee2567702015-01-26 15:04:35 -0800441 obj.match = ofp.match.unpack(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -0700442 return obj
443
444 def __eq__(self, other):
445 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -0700446 if self.xid != other.xid: return False
447 if self.flags != other.flags: return False
448 if self.table_id != other.table_id: return False
449 if self.out_port != other.out_port: return False
450 if self.out_group != other.out_group: return False
451 if self.cookie != other.cookie: return False
452 if self.cookie_mask != other.cookie_mask: return False
453 if self.match != other.match: return False
454 return True
455
Rich Lanec2ee4b82013-04-24 17:12:38 -0700456 def pretty_print(self, q):
457 q.text("aggregate_stats_request {")
458 with q.group():
459 with q.indent(2):
460 q.breakable()
461 q.text("xid = ");
462 if self.xid != None:
463 q.text("%#x" % self.xid)
464 else:
465 q.text('None')
466 q.text(","); q.breakable()
467 q.text("flags = ");
468 q.text("%#x" % self.flags)
469 q.text(","); q.breakable()
470 q.text("table_id = ");
471 q.text("%#x" % self.table_id)
472 q.text(","); q.breakable()
473 q.text("out_port = ");
474 q.text(util.pretty_port(self.out_port))
475 q.text(","); q.breakable()
476 q.text("out_group = ");
477 q.text("%#x" % self.out_group)
478 q.text(","); q.breakable()
479 q.text("cookie = ");
480 q.text("%#x" % self.cookie)
481 q.text(","); q.breakable()
482 q.text("cookie_mask = ");
483 q.text("%#x" % self.cookie_mask)
484 q.text(","); q.breakable()
485 q.text("match = ");
486 q.pp(self.match)
487 q.breakable()
488 q.text('}')
489
Rich Lane7dcdf022013-12-11 14:45:27 -0800490stats_request.subtypes[2] = aggregate_stats_request
491
492class async_get_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -0700493 version = 4
494 type = 27
Rich Lanec2ee4b82013-04-24 17:12:38 -0700495
496 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 -0800497 if xid != None:
498 self.xid = xid
499 else:
500 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -0700501 if packet_in_mask_equal_master != None:
502 self.packet_in_mask_equal_master = packet_in_mask_equal_master
503 else:
504 self.packet_in_mask_equal_master = 0
505 if packet_in_mask_slave != None:
506 self.packet_in_mask_slave = packet_in_mask_slave
507 else:
508 self.packet_in_mask_slave = 0
509 if port_status_mask_equal_master != None:
510 self.port_status_mask_equal_master = port_status_mask_equal_master
511 else:
512 self.port_status_mask_equal_master = 0
513 if port_status_mask_slave != None:
514 self.port_status_mask_slave = port_status_mask_slave
515 else:
516 self.port_status_mask_slave = 0
517 if flow_removed_mask_equal_master != None:
518 self.flow_removed_mask_equal_master = flow_removed_mask_equal_master
519 else:
520 self.flow_removed_mask_equal_master = 0
521 if flow_removed_mask_slave != None:
522 self.flow_removed_mask_slave = flow_removed_mask_slave
523 else:
524 self.flow_removed_mask_slave = 0
Rich Lane7dcdf022013-12-11 14:45:27 -0800525 return
Rich Lanec2ee4b82013-04-24 17:12:38 -0700526
527 def pack(self):
528 packed = []
529 packed.append(struct.pack("!B", self.version))
530 packed.append(struct.pack("!B", self.type))
531 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
532 packed.append(struct.pack("!L", self.xid))
533 packed.append(struct.pack("!L", self.packet_in_mask_equal_master))
534 packed.append(struct.pack("!L", self.packet_in_mask_slave))
535 packed.append(struct.pack("!L", self.port_status_mask_equal_master))
536 packed.append(struct.pack("!L", self.port_status_mask_slave))
537 packed.append(struct.pack("!L", self.flow_removed_mask_equal_master))
538 packed.append(struct.pack("!L", self.flow_removed_mask_slave))
539 length = sum([len(x) for x in packed])
540 packed[2] = struct.pack("!H", length)
541 return ''.join(packed)
542
543 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800544 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700545 obj = async_get_reply()
Dan Talaycof6202252013-07-02 01:00:29 -0700546 _version = reader.read("!B")[0]
547 assert(_version == 4)
548 _type = reader.read("!B")[0]
549 assert(_type == 27)
550 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800551 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800552 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -0700553 obj.xid = reader.read("!L")[0]
554 obj.packet_in_mask_equal_master = reader.read("!L")[0]
555 obj.packet_in_mask_slave = reader.read("!L")[0]
556 obj.port_status_mask_equal_master = reader.read("!L")[0]
557 obj.port_status_mask_slave = reader.read("!L")[0]
558 obj.flow_removed_mask_equal_master = reader.read("!L")[0]
559 obj.flow_removed_mask_slave = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700560 return obj
561
562 def __eq__(self, other):
563 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -0700564 if self.xid != other.xid: return False
565 if self.packet_in_mask_equal_master != other.packet_in_mask_equal_master: return False
566 if self.packet_in_mask_slave != other.packet_in_mask_slave: return False
567 if self.port_status_mask_equal_master != other.port_status_mask_equal_master: return False
568 if self.port_status_mask_slave != other.port_status_mask_slave: return False
569 if self.flow_removed_mask_equal_master != other.flow_removed_mask_equal_master: return False
570 if self.flow_removed_mask_slave != other.flow_removed_mask_slave: return False
571 return True
572
Rich Lanec2ee4b82013-04-24 17:12:38 -0700573 def pretty_print(self, q):
574 q.text("async_get_reply {")
575 with q.group():
576 with q.indent(2):
577 q.breakable()
578 q.text("xid = ");
579 if self.xid != None:
580 q.text("%#x" % self.xid)
581 else:
582 q.text('None')
583 q.text(","); q.breakable()
584 q.text("packet_in_mask_equal_master = ");
585 q.text("%#x" % self.packet_in_mask_equal_master)
586 q.text(","); q.breakable()
587 q.text("packet_in_mask_slave = ");
588 q.text("%#x" % self.packet_in_mask_slave)
589 q.text(","); q.breakable()
590 q.text("port_status_mask_equal_master = ");
591 q.text("%#x" % self.port_status_mask_equal_master)
592 q.text(","); q.breakable()
593 q.text("port_status_mask_slave = ");
594 q.text("%#x" % self.port_status_mask_slave)
595 q.text(","); q.breakable()
596 q.text("flow_removed_mask_equal_master = ");
597 q.text("%#x" % self.flow_removed_mask_equal_master)
598 q.text(","); q.breakable()
599 q.text("flow_removed_mask_slave = ");
600 q.text("%#x" % self.flow_removed_mask_slave)
601 q.breakable()
602 q.text('}')
603
Rich Lane7dcdf022013-12-11 14:45:27 -0800604message.subtypes[27] = async_get_reply
605
606class async_get_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -0700607 version = 4
608 type = 26
Rich Lanec2ee4b82013-04-24 17:12:38 -0700609
610 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 -0800611 if xid != None:
612 self.xid = xid
613 else:
614 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -0700615 if packet_in_mask_equal_master != None:
616 self.packet_in_mask_equal_master = packet_in_mask_equal_master
617 else:
618 self.packet_in_mask_equal_master = 0
619 if packet_in_mask_slave != None:
620 self.packet_in_mask_slave = packet_in_mask_slave
621 else:
622 self.packet_in_mask_slave = 0
623 if port_status_mask_equal_master != None:
624 self.port_status_mask_equal_master = port_status_mask_equal_master
625 else:
626 self.port_status_mask_equal_master = 0
627 if port_status_mask_slave != None:
628 self.port_status_mask_slave = port_status_mask_slave
629 else:
630 self.port_status_mask_slave = 0
631 if flow_removed_mask_equal_master != None:
632 self.flow_removed_mask_equal_master = flow_removed_mask_equal_master
633 else:
634 self.flow_removed_mask_equal_master = 0
635 if flow_removed_mask_slave != None:
636 self.flow_removed_mask_slave = flow_removed_mask_slave
637 else:
638 self.flow_removed_mask_slave = 0
Rich Lane7dcdf022013-12-11 14:45:27 -0800639 return
Rich Lanec2ee4b82013-04-24 17:12:38 -0700640
641 def pack(self):
642 packed = []
643 packed.append(struct.pack("!B", self.version))
644 packed.append(struct.pack("!B", self.type))
645 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
646 packed.append(struct.pack("!L", self.xid))
647 packed.append(struct.pack("!L", self.packet_in_mask_equal_master))
648 packed.append(struct.pack("!L", self.packet_in_mask_slave))
649 packed.append(struct.pack("!L", self.port_status_mask_equal_master))
650 packed.append(struct.pack("!L", self.port_status_mask_slave))
651 packed.append(struct.pack("!L", self.flow_removed_mask_equal_master))
652 packed.append(struct.pack("!L", self.flow_removed_mask_slave))
653 length = sum([len(x) for x in packed])
654 packed[2] = struct.pack("!H", length)
655 return ''.join(packed)
656
657 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800658 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700659 obj = async_get_request()
Dan Talaycof6202252013-07-02 01:00:29 -0700660 _version = reader.read("!B")[0]
661 assert(_version == 4)
662 _type = reader.read("!B")[0]
663 assert(_type == 26)
664 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800665 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800666 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -0700667 obj.xid = reader.read("!L")[0]
668 obj.packet_in_mask_equal_master = reader.read("!L")[0]
669 obj.packet_in_mask_slave = reader.read("!L")[0]
670 obj.port_status_mask_equal_master = reader.read("!L")[0]
671 obj.port_status_mask_slave = reader.read("!L")[0]
672 obj.flow_removed_mask_equal_master = reader.read("!L")[0]
673 obj.flow_removed_mask_slave = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700674 return obj
675
676 def __eq__(self, other):
677 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -0700678 if self.xid != other.xid: return False
679 if self.packet_in_mask_equal_master != other.packet_in_mask_equal_master: return False
680 if self.packet_in_mask_slave != other.packet_in_mask_slave: return False
681 if self.port_status_mask_equal_master != other.port_status_mask_equal_master: return False
682 if self.port_status_mask_slave != other.port_status_mask_slave: return False
683 if self.flow_removed_mask_equal_master != other.flow_removed_mask_equal_master: return False
684 if self.flow_removed_mask_slave != other.flow_removed_mask_slave: return False
685 return True
686
Rich Lanec2ee4b82013-04-24 17:12:38 -0700687 def pretty_print(self, q):
688 q.text("async_get_request {")
689 with q.group():
690 with q.indent(2):
691 q.breakable()
692 q.text("xid = ");
693 if self.xid != None:
694 q.text("%#x" % self.xid)
695 else:
696 q.text('None')
697 q.text(","); q.breakable()
698 q.text("packet_in_mask_equal_master = ");
699 q.text("%#x" % self.packet_in_mask_equal_master)
700 q.text(","); q.breakable()
701 q.text("packet_in_mask_slave = ");
702 q.text("%#x" % self.packet_in_mask_slave)
703 q.text(","); q.breakable()
704 q.text("port_status_mask_equal_master = ");
705 q.text("%#x" % self.port_status_mask_equal_master)
706 q.text(","); q.breakable()
707 q.text("port_status_mask_slave = ");
708 q.text("%#x" % self.port_status_mask_slave)
709 q.text(","); q.breakable()
710 q.text("flow_removed_mask_equal_master = ");
711 q.text("%#x" % self.flow_removed_mask_equal_master)
712 q.text(","); q.breakable()
713 q.text("flow_removed_mask_slave = ");
714 q.text("%#x" % self.flow_removed_mask_slave)
715 q.breakable()
716 q.text('}')
717
Rich Lane7dcdf022013-12-11 14:45:27 -0800718message.subtypes[26] = async_get_request
719
720class async_set(message):
Dan Talaycof6202252013-07-02 01:00:29 -0700721 version = 4
722 type = 28
Rich Lanec2ee4b82013-04-24 17:12:38 -0700723
724 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 -0800725 if xid != None:
726 self.xid = xid
727 else:
728 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -0700729 if packet_in_mask_equal_master != None:
730 self.packet_in_mask_equal_master = packet_in_mask_equal_master
731 else:
732 self.packet_in_mask_equal_master = 0
733 if packet_in_mask_slave != None:
734 self.packet_in_mask_slave = packet_in_mask_slave
735 else:
736 self.packet_in_mask_slave = 0
737 if port_status_mask_equal_master != None:
738 self.port_status_mask_equal_master = port_status_mask_equal_master
739 else:
740 self.port_status_mask_equal_master = 0
741 if port_status_mask_slave != None:
742 self.port_status_mask_slave = port_status_mask_slave
743 else:
744 self.port_status_mask_slave = 0
745 if flow_removed_mask_equal_master != None:
746 self.flow_removed_mask_equal_master = flow_removed_mask_equal_master
747 else:
748 self.flow_removed_mask_equal_master = 0
749 if flow_removed_mask_slave != None:
750 self.flow_removed_mask_slave = flow_removed_mask_slave
751 else:
752 self.flow_removed_mask_slave = 0
Rich Lane7dcdf022013-12-11 14:45:27 -0800753 return
Rich Lanec2ee4b82013-04-24 17:12:38 -0700754
755 def pack(self):
756 packed = []
757 packed.append(struct.pack("!B", self.version))
758 packed.append(struct.pack("!B", self.type))
759 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
760 packed.append(struct.pack("!L", self.xid))
761 packed.append(struct.pack("!L", self.packet_in_mask_equal_master))
762 packed.append(struct.pack("!L", self.packet_in_mask_slave))
763 packed.append(struct.pack("!L", self.port_status_mask_equal_master))
764 packed.append(struct.pack("!L", self.port_status_mask_slave))
765 packed.append(struct.pack("!L", self.flow_removed_mask_equal_master))
766 packed.append(struct.pack("!L", self.flow_removed_mask_slave))
767 length = sum([len(x) for x in packed])
768 packed[2] = struct.pack("!H", length)
769 return ''.join(packed)
770
771 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800772 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700773 obj = async_set()
Dan Talaycof6202252013-07-02 01:00:29 -0700774 _version = reader.read("!B")[0]
775 assert(_version == 4)
776 _type = reader.read("!B")[0]
777 assert(_type == 28)
778 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800779 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800780 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -0700781 obj.xid = reader.read("!L")[0]
782 obj.packet_in_mask_equal_master = reader.read("!L")[0]
783 obj.packet_in_mask_slave = reader.read("!L")[0]
784 obj.port_status_mask_equal_master = reader.read("!L")[0]
785 obj.port_status_mask_slave = reader.read("!L")[0]
786 obj.flow_removed_mask_equal_master = reader.read("!L")[0]
787 obj.flow_removed_mask_slave = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700788 return obj
789
790 def __eq__(self, other):
791 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -0700792 if self.xid != other.xid: return False
793 if self.packet_in_mask_equal_master != other.packet_in_mask_equal_master: return False
794 if self.packet_in_mask_slave != other.packet_in_mask_slave: return False
795 if self.port_status_mask_equal_master != other.port_status_mask_equal_master: return False
796 if self.port_status_mask_slave != other.port_status_mask_slave: return False
797 if self.flow_removed_mask_equal_master != other.flow_removed_mask_equal_master: return False
798 if self.flow_removed_mask_slave != other.flow_removed_mask_slave: return False
799 return True
800
Rich Lanec2ee4b82013-04-24 17:12:38 -0700801 def pretty_print(self, q):
802 q.text("async_set {")
803 with q.group():
804 with q.indent(2):
805 q.breakable()
806 q.text("xid = ");
807 if self.xid != None:
808 q.text("%#x" % self.xid)
809 else:
810 q.text('None')
811 q.text(","); q.breakable()
812 q.text("packet_in_mask_equal_master = ");
813 q.text("%#x" % self.packet_in_mask_equal_master)
814 q.text(","); q.breakable()
815 q.text("packet_in_mask_slave = ");
816 q.text("%#x" % self.packet_in_mask_slave)
817 q.text(","); q.breakable()
818 q.text("port_status_mask_equal_master = ");
819 q.text("%#x" % self.port_status_mask_equal_master)
820 q.text(","); q.breakable()
821 q.text("port_status_mask_slave = ");
822 q.text("%#x" % self.port_status_mask_slave)
823 q.text(","); q.breakable()
824 q.text("flow_removed_mask_equal_master = ");
825 q.text("%#x" % self.flow_removed_mask_equal_master)
826 q.text(","); q.breakable()
827 q.text("flow_removed_mask_slave = ");
828 q.text("%#x" % self.flow_removed_mask_slave)
829 q.breakable()
830 q.text('}')
831
Rich Lane7dcdf022013-12-11 14:45:27 -0800832message.subtypes[28] = async_set
833
834class error_msg(message):
835 subtypes = {}
836
Rich Lane95f7fc92014-01-27 17:08:16 -0800837 version = 4
838 type = 1
839
840 def __init__(self, xid=None, err_type=None):
841 if xid != None:
842 self.xid = xid
843 else:
844 self.xid = None
845 if err_type != None:
846 self.err_type = err_type
847 else:
848 self.err_type = 0
849 return
850
851 def pack(self):
852 packed = []
853 packed.append(struct.pack("!B", self.version))
854 packed.append(struct.pack("!B", self.type))
855 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
856 packed.append(struct.pack("!L", self.xid))
857 packed.append(struct.pack("!H", self.err_type))
858 length = sum([len(x) for x in packed])
859 packed[2] = struct.pack("!H", length)
860 return ''.join(packed)
861
Rich Lane7dcdf022013-12-11 14:45:27 -0800862 @staticmethod
863 def unpack(reader):
864 subtype, = reader.peek('!H', 8)
Rich Lane95f7fc92014-01-27 17:08:16 -0800865 subclass = error_msg.subtypes.get(subtype)
866 if subclass:
867 return subclass.unpack(reader)
868
869 obj = error_msg()
870 _version = reader.read("!B")[0]
871 assert(_version == 4)
872 _type = reader.read("!B")[0]
873 assert(_type == 1)
874 _length = reader.read("!H")[0]
875 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800876 reader = orig_reader.slice(_length, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -0800877 obj.xid = reader.read("!L")[0]
878 obj.err_type = reader.read("!H")[0]
879 return obj
880
881 def __eq__(self, other):
882 if type(self) != type(other): return False
883 if self.xid != other.xid: return False
884 if self.err_type != other.err_type: return False
885 return True
886
887 def pretty_print(self, q):
888 q.text("error_msg {")
889 with q.group():
890 with q.indent(2):
891 q.breakable()
892 q.text("xid = ");
893 if self.xid != None:
894 q.text("%#x" % self.xid)
895 else:
896 q.text('None')
897 q.breakable()
898 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -0800899
900message.subtypes[1] = error_msg
901
902class bad_action_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -0700903 version = 4
904 type = 1
905 err_type = 2
906
907 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -0800908 if xid != None:
909 self.xid = xid
910 else:
911 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -0700912 if code != None:
913 self.code = code
914 else:
915 self.code = 0
916 if data != None:
917 self.data = data
918 else:
919 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -0800920 return
Rich Lane6f4978c2013-10-20 21:33:52 -0700921
922 def pack(self):
923 packed = []
924 packed.append(struct.pack("!B", self.version))
925 packed.append(struct.pack("!B", self.type))
926 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
927 packed.append(struct.pack("!L", self.xid))
928 packed.append(struct.pack("!H", self.err_type))
929 packed.append(struct.pack("!H", self.code))
930 packed.append(self.data)
931 length = sum([len(x) for x in packed])
932 packed[2] = struct.pack("!H", length)
933 return ''.join(packed)
934
935 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800936 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -0700937 obj = bad_action_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -0700938 _version = reader.read("!B")[0]
939 assert(_version == 4)
940 _type = reader.read("!B")[0]
941 assert(_type == 1)
942 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800943 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800944 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -0700945 obj.xid = reader.read("!L")[0]
946 _err_type = reader.read("!H")[0]
947 assert(_err_type == 2)
948 obj.code = reader.read("!H")[0]
949 obj.data = str(reader.read_all())
950 return obj
951
952 def __eq__(self, other):
953 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -0700954 if self.xid != other.xid: return False
955 if self.code != other.code: return False
956 if self.data != other.data: return False
957 return True
958
Rich Lane6f4978c2013-10-20 21:33:52 -0700959 def pretty_print(self, q):
960 q.text("bad_action_error_msg {")
961 with q.group():
962 with q.indent(2):
963 q.breakable()
964 q.text("xid = ");
965 if self.xid != None:
966 q.text("%#x" % self.xid)
967 else:
968 q.text('None')
969 q.text(","); q.breakable()
970 q.text("code = ");
971 q.text("%#x" % self.code)
972 q.text(","); q.breakable()
973 q.text("data = ");
974 q.pp(self.data)
975 q.breakable()
976 q.text('}')
977
Rich Lane7dcdf022013-12-11 14:45:27 -0800978error_msg.subtypes[2] = bad_action_error_msg
979
980class bad_instruction_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -0700981 version = 4
982 type = 1
983 err_type = 3
984
985 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -0800986 if xid != None:
987 self.xid = xid
988 else:
989 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -0700990 if code != None:
991 self.code = code
992 else:
993 self.code = 0
994 if data != None:
995 self.data = data
996 else:
997 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -0800998 return
Rich Lane6f4978c2013-10-20 21:33:52 -0700999
1000 def pack(self):
1001 packed = []
1002 packed.append(struct.pack("!B", self.version))
1003 packed.append(struct.pack("!B", self.type))
1004 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1005 packed.append(struct.pack("!L", self.xid))
1006 packed.append(struct.pack("!H", self.err_type))
1007 packed.append(struct.pack("!H", self.code))
1008 packed.append(self.data)
1009 length = sum([len(x) for x in packed])
1010 packed[2] = struct.pack("!H", length)
1011 return ''.join(packed)
1012
1013 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001014 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07001015 obj = bad_instruction_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -07001016 _version = reader.read("!B")[0]
1017 assert(_version == 4)
1018 _type = reader.read("!B")[0]
1019 assert(_type == 1)
1020 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001021 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001022 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -07001023 obj.xid = reader.read("!L")[0]
1024 _err_type = reader.read("!H")[0]
1025 assert(_err_type == 3)
1026 obj.code = reader.read("!H")[0]
1027 obj.data = str(reader.read_all())
1028 return obj
1029
1030 def __eq__(self, other):
1031 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07001032 if self.xid != other.xid: return False
1033 if self.code != other.code: return False
1034 if self.data != other.data: return False
1035 return True
1036
Rich Lane6f4978c2013-10-20 21:33:52 -07001037 def pretty_print(self, q):
1038 q.text("bad_instruction_error_msg {")
1039 with q.group():
1040 with q.indent(2):
1041 q.breakable()
1042 q.text("xid = ");
1043 if self.xid != None:
1044 q.text("%#x" % self.xid)
1045 else:
1046 q.text('None')
1047 q.text(","); q.breakable()
1048 q.text("code = ");
1049 q.text("%#x" % self.code)
1050 q.text(","); q.breakable()
1051 q.text("data = ");
1052 q.pp(self.data)
1053 q.breakable()
1054 q.text('}')
1055
Rich Lane7dcdf022013-12-11 14:45:27 -08001056error_msg.subtypes[3] = bad_instruction_error_msg
1057
1058class bad_match_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -07001059 version = 4
1060 type = 1
1061 err_type = 4
1062
1063 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001064 if xid != None:
1065 self.xid = xid
1066 else:
1067 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07001068 if code != None:
1069 self.code = code
1070 else:
1071 self.code = 0
1072 if data != None:
1073 self.data = data
1074 else:
1075 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08001076 return
Rich Lane6f4978c2013-10-20 21:33:52 -07001077
1078 def pack(self):
1079 packed = []
1080 packed.append(struct.pack("!B", self.version))
1081 packed.append(struct.pack("!B", self.type))
1082 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1083 packed.append(struct.pack("!L", self.xid))
1084 packed.append(struct.pack("!H", self.err_type))
1085 packed.append(struct.pack("!H", self.code))
1086 packed.append(self.data)
1087 length = sum([len(x) for x in packed])
1088 packed[2] = struct.pack("!H", length)
1089 return ''.join(packed)
1090
1091 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001092 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07001093 obj = bad_match_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -07001094 _version = reader.read("!B")[0]
1095 assert(_version == 4)
1096 _type = reader.read("!B")[0]
1097 assert(_type == 1)
1098 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001099 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001100 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -07001101 obj.xid = reader.read("!L")[0]
1102 _err_type = reader.read("!H")[0]
1103 assert(_err_type == 4)
1104 obj.code = reader.read("!H")[0]
1105 obj.data = str(reader.read_all())
1106 return obj
1107
1108 def __eq__(self, other):
1109 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07001110 if self.xid != other.xid: return False
1111 if self.code != other.code: return False
1112 if self.data != other.data: return False
1113 return True
1114
Rich Lane6f4978c2013-10-20 21:33:52 -07001115 def pretty_print(self, q):
1116 q.text("bad_match_error_msg {")
1117 with q.group():
1118 with q.indent(2):
1119 q.breakable()
1120 q.text("xid = ");
1121 if self.xid != None:
1122 q.text("%#x" % self.xid)
1123 else:
1124 q.text('None')
1125 q.text(","); q.breakable()
1126 q.text("code = ");
1127 q.text("%#x" % self.code)
1128 q.text(","); q.breakable()
1129 q.text("data = ");
1130 q.pp(self.data)
1131 q.breakable()
1132 q.text('}')
1133
Rich Lane7dcdf022013-12-11 14:45:27 -08001134error_msg.subtypes[4] = bad_match_error_msg
1135
1136class bad_request_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -07001137 version = 4
1138 type = 1
1139 err_type = 1
1140
1141 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001142 if xid != None:
1143 self.xid = xid
1144 else:
1145 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07001146 if code != None:
1147 self.code = code
1148 else:
1149 self.code = 0
1150 if data != None:
1151 self.data = data
1152 else:
1153 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08001154 return
Rich Lane6f4978c2013-10-20 21:33:52 -07001155
1156 def pack(self):
1157 packed = []
1158 packed.append(struct.pack("!B", self.version))
1159 packed.append(struct.pack("!B", self.type))
1160 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1161 packed.append(struct.pack("!L", self.xid))
1162 packed.append(struct.pack("!H", self.err_type))
1163 packed.append(struct.pack("!H", self.code))
1164 packed.append(self.data)
1165 length = sum([len(x) for x in packed])
1166 packed[2] = struct.pack("!H", length)
1167 return ''.join(packed)
1168
1169 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001170 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07001171 obj = bad_request_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -07001172 _version = reader.read("!B")[0]
1173 assert(_version == 4)
1174 _type = reader.read("!B")[0]
1175 assert(_type == 1)
1176 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001177 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001178 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -07001179 obj.xid = reader.read("!L")[0]
1180 _err_type = reader.read("!H")[0]
1181 assert(_err_type == 1)
1182 obj.code = reader.read("!H")[0]
1183 obj.data = str(reader.read_all())
1184 return obj
1185
1186 def __eq__(self, other):
1187 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07001188 if self.xid != other.xid: return False
1189 if self.code != other.code: return False
1190 if self.data != other.data: return False
1191 return True
1192
Rich Lane6f4978c2013-10-20 21:33:52 -07001193 def pretty_print(self, q):
1194 q.text("bad_request_error_msg {")
1195 with q.group():
1196 with q.indent(2):
1197 q.breakable()
1198 q.text("xid = ");
1199 if self.xid != None:
1200 q.text("%#x" % self.xid)
1201 else:
1202 q.text('None')
1203 q.text(","); q.breakable()
1204 q.text("code = ");
1205 q.text("%#x" % self.code)
1206 q.text(","); q.breakable()
1207 q.text("data = ");
1208 q.pp(self.data)
1209 q.breakable()
1210 q.text('}')
1211
Rich Lane7dcdf022013-12-11 14:45:27 -08001212error_msg.subtypes[1] = bad_request_error_msg
1213
1214class barrier_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -07001215 version = 4
1216 type = 21
Rich Lanec2ee4b82013-04-24 17:12:38 -07001217
1218 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001219 if xid != None:
1220 self.xid = xid
1221 else:
1222 self.xid = None
1223 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07001224
1225 def pack(self):
1226 packed = []
1227 packed.append(struct.pack("!B", self.version))
1228 packed.append(struct.pack("!B", self.type))
1229 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1230 packed.append(struct.pack("!L", self.xid))
1231 length = sum([len(x) for x in packed])
1232 packed[2] = struct.pack("!H", length)
1233 return ''.join(packed)
1234
1235 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001236 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001237 obj = barrier_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07001238 _version = reader.read("!B")[0]
1239 assert(_version == 4)
1240 _type = reader.read("!B")[0]
1241 assert(_type == 21)
1242 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001243 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001244 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07001245 obj.xid = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001246 return obj
1247
1248 def __eq__(self, other):
1249 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07001250 if self.xid != other.xid: return False
1251 return True
1252
Rich Lanec2ee4b82013-04-24 17:12:38 -07001253 def pretty_print(self, q):
1254 q.text("barrier_reply {")
1255 with q.group():
1256 with q.indent(2):
1257 q.breakable()
1258 q.text("xid = ");
1259 if self.xid != None:
1260 q.text("%#x" % self.xid)
1261 else:
1262 q.text('None')
1263 q.breakable()
1264 q.text('}')
1265
Rich Lane7dcdf022013-12-11 14:45:27 -08001266message.subtypes[21] = barrier_reply
1267
1268class barrier_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -07001269 version = 4
1270 type = 20
Rich Lanec2ee4b82013-04-24 17:12:38 -07001271
1272 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001273 if xid != None:
1274 self.xid = xid
1275 else:
1276 self.xid = None
1277 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07001278
1279 def pack(self):
1280 packed = []
1281 packed.append(struct.pack("!B", self.version))
1282 packed.append(struct.pack("!B", self.type))
1283 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1284 packed.append(struct.pack("!L", self.xid))
1285 length = sum([len(x) for x in packed])
1286 packed[2] = struct.pack("!H", length)
1287 return ''.join(packed)
1288
1289 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001290 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001291 obj = barrier_request()
Dan Talaycof6202252013-07-02 01:00:29 -07001292 _version = reader.read("!B")[0]
1293 assert(_version == 4)
1294 _type = reader.read("!B")[0]
1295 assert(_type == 20)
1296 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001297 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001298 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07001299 obj.xid = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001300 return obj
1301
1302 def __eq__(self, other):
1303 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07001304 if self.xid != other.xid: return False
1305 return True
1306
Rich Lanec2ee4b82013-04-24 17:12:38 -07001307 def pretty_print(self, q):
1308 q.text("barrier_request {")
1309 with q.group():
1310 with q.indent(2):
1311 q.breakable()
1312 q.text("xid = ");
1313 if self.xid != None:
1314 q.text("%#x" % self.xid)
1315 else:
1316 q.text('None')
1317 q.breakable()
1318 q.text('}')
1319
Rich Lane7dcdf022013-12-11 14:45:27 -08001320message.subtypes[20] = barrier_request
1321
1322class experimenter(message):
1323 subtypes = {}
1324
Rich Lane95f7fc92014-01-27 17:08:16 -08001325 version = 4
1326 type = 4
1327
1328 def __init__(self, xid=None, experimenter=None, subtype=None, data=None):
1329 if xid != None:
1330 self.xid = xid
1331 else:
1332 self.xid = None
1333 if experimenter != None:
1334 self.experimenter = experimenter
1335 else:
1336 self.experimenter = 0
1337 if subtype != None:
1338 self.subtype = subtype
1339 else:
1340 self.subtype = 0
1341 if data != None:
1342 self.data = data
1343 else:
1344 self.data = ''
1345 return
1346
1347 def pack(self):
1348 packed = []
1349 packed.append(struct.pack("!B", self.version))
1350 packed.append(struct.pack("!B", self.type))
1351 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1352 packed.append(struct.pack("!L", self.xid))
1353 packed.append(struct.pack("!L", self.experimenter))
1354 packed.append(struct.pack("!L", self.subtype))
1355 packed.append(self.data)
1356 length = sum([len(x) for x in packed])
1357 packed[2] = struct.pack("!H", length)
1358 return ''.join(packed)
1359
Rich Lane7dcdf022013-12-11 14:45:27 -08001360 @staticmethod
1361 def unpack(reader):
1362 subtype, = reader.peek('!L', 8)
Rich Lane95f7fc92014-01-27 17:08:16 -08001363 subclass = experimenter.subtypes.get(subtype)
1364 if subclass:
1365 return subclass.unpack(reader)
1366
1367 obj = experimenter()
1368 _version = reader.read("!B")[0]
1369 assert(_version == 4)
1370 _type = reader.read("!B")[0]
1371 assert(_type == 4)
1372 _length = reader.read("!H")[0]
1373 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001374 reader = orig_reader.slice(_length, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -08001375 obj.xid = reader.read("!L")[0]
1376 obj.experimenter = reader.read("!L")[0]
1377 obj.subtype = reader.read("!L")[0]
1378 obj.data = str(reader.read_all())
1379 return obj
1380
1381 def __eq__(self, other):
1382 if type(self) != type(other): return False
1383 if self.xid != other.xid: return False
1384 if self.experimenter != other.experimenter: return False
1385 if self.subtype != other.subtype: return False
1386 if self.data != other.data: return False
1387 return True
1388
1389 def pretty_print(self, q):
1390 q.text("experimenter {")
1391 with q.group():
1392 with q.indent(2):
1393 q.breakable()
1394 q.text("xid = ");
1395 if self.xid != None:
1396 q.text("%#x" % self.xid)
1397 else:
1398 q.text('None')
1399 q.text(","); q.breakable()
1400 q.text("subtype = ");
1401 q.text("%#x" % self.subtype)
1402 q.text(","); q.breakable()
1403 q.text("data = ");
1404 q.pp(self.data)
1405 q.breakable()
1406 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -08001407
1408message.subtypes[4] = experimenter
1409
1410class bsn_header(experimenter):
1411 subtypes = {}
1412
Rich Lane95f7fc92014-01-27 17:08:16 -08001413 version = 4
1414 type = 4
1415 experimenter = 6035143
1416
1417 def __init__(self, xid=None, subtype=None):
1418 if xid != None:
1419 self.xid = xid
1420 else:
1421 self.xid = None
1422 if subtype != None:
1423 self.subtype = subtype
1424 else:
1425 self.subtype = 0
1426 return
1427
1428 def pack(self):
1429 packed = []
1430 packed.append(struct.pack("!B", self.version))
1431 packed.append(struct.pack("!B", self.type))
1432 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1433 packed.append(struct.pack("!L", self.xid))
1434 packed.append(struct.pack("!L", self.experimenter))
1435 packed.append(struct.pack("!L", self.subtype))
1436 length = sum([len(x) for x in packed])
1437 packed[2] = struct.pack("!H", length)
1438 return ''.join(packed)
1439
Rich Lane7dcdf022013-12-11 14:45:27 -08001440 @staticmethod
1441 def unpack(reader):
1442 subtype, = reader.peek('!L', 12)
Rich Lane95f7fc92014-01-27 17:08:16 -08001443 subclass = bsn_header.subtypes.get(subtype)
1444 if subclass:
1445 return subclass.unpack(reader)
1446
1447 obj = bsn_header()
1448 _version = reader.read("!B")[0]
1449 assert(_version == 4)
1450 _type = reader.read("!B")[0]
1451 assert(_type == 4)
1452 _length = reader.read("!H")[0]
1453 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001454 reader = orig_reader.slice(_length, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -08001455 obj.xid = reader.read("!L")[0]
1456 _experimenter = reader.read("!L")[0]
1457 assert(_experimenter == 6035143)
1458 obj.subtype = reader.read("!L")[0]
1459 return obj
1460
1461 def __eq__(self, other):
1462 if type(self) != type(other): return False
1463 if self.xid != other.xid: return False
1464 if self.subtype != other.subtype: return False
1465 return True
1466
1467 def pretty_print(self, q):
1468 q.text("bsn_header {")
1469 with q.group():
1470 with q.indent(2):
1471 q.breakable()
1472 q.text("xid = ");
1473 if self.xid != None:
1474 q.text("%#x" % self.xid)
1475 else:
1476 q.text('None')
1477 q.breakable()
1478 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -08001479
1480experimenter.subtypes[6035143] = bsn_header
1481
Rich Lanea61048f2014-01-30 16:14:00 -08001482class bsn_arp_idle(bsn_header):
1483 version = 4
1484 type = 4
1485 experimenter = 6035143
1486 subtype = 60
1487
1488 def __init__(self, xid=None, vlan_vid=None, ipv4_addr=None):
1489 if xid != None:
1490 self.xid = xid
1491 else:
1492 self.xid = None
1493 if vlan_vid != None:
1494 self.vlan_vid = vlan_vid
1495 else:
1496 self.vlan_vid = 0
1497 if ipv4_addr != None:
1498 self.ipv4_addr = ipv4_addr
1499 else:
1500 self.ipv4_addr = 0
1501 return
1502
1503 def pack(self):
1504 packed = []
1505 packed.append(struct.pack("!B", self.version))
1506 packed.append(struct.pack("!B", self.type))
1507 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1508 packed.append(struct.pack("!L", self.xid))
1509 packed.append(struct.pack("!L", self.experimenter))
1510 packed.append(struct.pack("!L", self.subtype))
1511 packed.append(struct.pack("!H", self.vlan_vid))
1512 packed.append('\x00' * 2)
1513 packed.append(struct.pack("!L", self.ipv4_addr))
1514 length = sum([len(x) for x in packed])
1515 packed[2] = struct.pack("!H", length)
1516 return ''.join(packed)
1517
1518 @staticmethod
1519 def unpack(reader):
1520 obj = bsn_arp_idle()
1521 _version = reader.read("!B")[0]
1522 assert(_version == 4)
1523 _type = reader.read("!B")[0]
1524 assert(_type == 4)
1525 _length = reader.read("!H")[0]
1526 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001527 reader = orig_reader.slice(_length, 4)
Rich Lanea61048f2014-01-30 16:14:00 -08001528 obj.xid = reader.read("!L")[0]
1529 _experimenter = reader.read("!L")[0]
1530 assert(_experimenter == 6035143)
1531 _subtype = reader.read("!L")[0]
1532 assert(_subtype == 60)
1533 obj.vlan_vid = reader.read("!H")[0]
1534 reader.skip(2)
1535 obj.ipv4_addr = reader.read("!L")[0]
1536 return obj
1537
1538 def __eq__(self, other):
1539 if type(self) != type(other): return False
1540 if self.xid != other.xid: return False
1541 if self.vlan_vid != other.vlan_vid: return False
1542 if self.ipv4_addr != other.ipv4_addr: return False
1543 return True
1544
1545 def pretty_print(self, q):
1546 q.text("bsn_arp_idle {")
1547 with q.group():
1548 with q.indent(2):
1549 q.breakable()
1550 q.text("xid = ");
1551 if self.xid != None:
1552 q.text("%#x" % self.xid)
1553 else:
1554 q.text('None')
1555 q.text(","); q.breakable()
1556 q.text("vlan_vid = ");
1557 q.text("%#x" % self.vlan_vid)
1558 q.text(","); q.breakable()
1559 q.text("ipv4_addr = ");
1560 q.text(util.pretty_ipv4(self.ipv4_addr))
1561 q.breakable()
1562 q.text('}')
1563
1564bsn_header.subtypes[60] = bsn_arp_idle
1565
Rich Lane7dcdf022013-12-11 14:45:27 -08001566class bsn_bw_clear_data_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001567 version = 4
1568 type = 4
1569 experimenter = 6035143
1570 subtype = 22
1571
1572 def __init__(self, xid=None, status=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001573 if xid != None:
1574 self.xid = xid
1575 else:
1576 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07001577 if status != None:
1578 self.status = status
1579 else:
1580 self.status = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08001581 return
Dan Talaycof6202252013-07-02 01:00:29 -07001582
1583 def pack(self):
1584 packed = []
1585 packed.append(struct.pack("!B", self.version))
1586 packed.append(struct.pack("!B", self.type))
1587 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1588 packed.append(struct.pack("!L", self.xid))
1589 packed.append(struct.pack("!L", self.experimenter))
1590 packed.append(struct.pack("!L", self.subtype))
1591 packed.append(struct.pack("!L", self.status))
1592 length = sum([len(x) for x in packed])
1593 packed[2] = struct.pack("!H", length)
1594 return ''.join(packed)
1595
1596 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001597 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07001598 obj = bsn_bw_clear_data_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07001599 _version = reader.read("!B")[0]
1600 assert(_version == 4)
1601 _type = reader.read("!B")[0]
1602 assert(_type == 4)
1603 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001604 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001605 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07001606 obj.xid = reader.read("!L")[0]
1607 _experimenter = reader.read("!L")[0]
1608 assert(_experimenter == 6035143)
1609 _subtype = reader.read("!L")[0]
1610 assert(_subtype == 22)
1611 obj.status = reader.read("!L")[0]
1612 return obj
1613
1614 def __eq__(self, other):
1615 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07001616 if self.xid != other.xid: return False
1617 if self.status != other.status: return False
1618 return True
1619
Dan Talaycof6202252013-07-02 01:00:29 -07001620 def pretty_print(self, q):
1621 q.text("bsn_bw_clear_data_reply {")
1622 with q.group():
1623 with q.indent(2):
1624 q.breakable()
1625 q.text("xid = ");
1626 if self.xid != None:
1627 q.text("%#x" % self.xid)
1628 else:
1629 q.text('None')
1630 q.text(","); q.breakable()
1631 q.text("status = ");
1632 q.text("%#x" % self.status)
1633 q.breakable()
1634 q.text('}')
1635
Rich Lane7dcdf022013-12-11 14:45:27 -08001636bsn_header.subtypes[22] = bsn_bw_clear_data_reply
1637
1638class bsn_bw_clear_data_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001639 version = 4
1640 type = 4
1641 experimenter = 6035143
1642 subtype = 21
1643
1644 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001645 if xid != None:
1646 self.xid = xid
1647 else:
1648 self.xid = None
1649 return
Dan Talaycof6202252013-07-02 01:00:29 -07001650
1651 def pack(self):
1652 packed = []
1653 packed.append(struct.pack("!B", self.version))
1654 packed.append(struct.pack("!B", self.type))
1655 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1656 packed.append(struct.pack("!L", self.xid))
1657 packed.append(struct.pack("!L", self.experimenter))
1658 packed.append(struct.pack("!L", self.subtype))
1659 length = sum([len(x) for x in packed])
1660 packed[2] = struct.pack("!H", length)
1661 return ''.join(packed)
1662
1663 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001664 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07001665 obj = bsn_bw_clear_data_request()
Dan Talaycof6202252013-07-02 01:00:29 -07001666 _version = reader.read("!B")[0]
1667 assert(_version == 4)
1668 _type = reader.read("!B")[0]
1669 assert(_type == 4)
1670 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001671 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001672 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07001673 obj.xid = reader.read("!L")[0]
1674 _experimenter = reader.read("!L")[0]
1675 assert(_experimenter == 6035143)
1676 _subtype = reader.read("!L")[0]
1677 assert(_subtype == 21)
1678 return obj
1679
1680 def __eq__(self, other):
1681 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07001682 if self.xid != other.xid: return False
1683 return True
1684
Dan Talaycof6202252013-07-02 01:00:29 -07001685 def pretty_print(self, q):
1686 q.text("bsn_bw_clear_data_request {")
1687 with q.group():
1688 with q.indent(2):
1689 q.breakable()
1690 q.text("xid = ");
1691 if self.xid != None:
1692 q.text("%#x" % self.xid)
1693 else:
1694 q.text('None')
1695 q.breakable()
1696 q.text('}')
1697
Rich Lane7dcdf022013-12-11 14:45:27 -08001698bsn_header.subtypes[21] = bsn_bw_clear_data_request
1699
1700class bsn_bw_enable_get_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001701 version = 4
1702 type = 4
1703 experimenter = 6035143
1704 subtype = 20
1705
1706 def __init__(self, xid=None, enabled=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001707 if xid != None:
1708 self.xid = xid
1709 else:
1710 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07001711 if enabled != None:
1712 self.enabled = enabled
1713 else:
1714 self.enabled = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08001715 return
Dan Talaycof6202252013-07-02 01:00:29 -07001716
1717 def pack(self):
1718 packed = []
1719 packed.append(struct.pack("!B", self.version))
1720 packed.append(struct.pack("!B", self.type))
1721 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1722 packed.append(struct.pack("!L", self.xid))
1723 packed.append(struct.pack("!L", self.experimenter))
1724 packed.append(struct.pack("!L", self.subtype))
1725 packed.append(struct.pack("!L", self.enabled))
1726 length = sum([len(x) for x in packed])
1727 packed[2] = struct.pack("!H", length)
1728 return ''.join(packed)
1729
1730 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001731 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07001732 obj = bsn_bw_enable_get_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07001733 _version = reader.read("!B")[0]
1734 assert(_version == 4)
1735 _type = reader.read("!B")[0]
1736 assert(_type == 4)
1737 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001738 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001739 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07001740 obj.xid = reader.read("!L")[0]
1741 _experimenter = reader.read("!L")[0]
1742 assert(_experimenter == 6035143)
1743 _subtype = reader.read("!L")[0]
1744 assert(_subtype == 20)
1745 obj.enabled = reader.read("!L")[0]
1746 return obj
1747
1748 def __eq__(self, other):
1749 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07001750 if self.xid != other.xid: return False
1751 if self.enabled != other.enabled: return False
1752 return True
1753
Dan Talaycof6202252013-07-02 01:00:29 -07001754 def pretty_print(self, q):
1755 q.text("bsn_bw_enable_get_reply {")
1756 with q.group():
1757 with q.indent(2):
1758 q.breakable()
1759 q.text("xid = ");
1760 if self.xid != None:
1761 q.text("%#x" % self.xid)
1762 else:
1763 q.text('None')
1764 q.text(","); q.breakable()
1765 q.text("enabled = ");
1766 q.text("%#x" % self.enabled)
1767 q.breakable()
1768 q.text('}')
1769
Rich Lane7dcdf022013-12-11 14:45:27 -08001770bsn_header.subtypes[20] = bsn_bw_enable_get_reply
1771
1772class bsn_bw_enable_get_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001773 version = 4
1774 type = 4
1775 experimenter = 6035143
1776 subtype = 19
1777
1778 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001779 if xid != None:
1780 self.xid = xid
1781 else:
1782 self.xid = None
1783 return
Dan Talaycof6202252013-07-02 01:00:29 -07001784
1785 def pack(self):
1786 packed = []
1787 packed.append(struct.pack("!B", self.version))
1788 packed.append(struct.pack("!B", self.type))
1789 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1790 packed.append(struct.pack("!L", self.xid))
1791 packed.append(struct.pack("!L", self.experimenter))
1792 packed.append(struct.pack("!L", self.subtype))
1793 length = sum([len(x) for x in packed])
1794 packed[2] = struct.pack("!H", length)
1795 return ''.join(packed)
1796
1797 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001798 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07001799 obj = bsn_bw_enable_get_request()
Dan Talaycof6202252013-07-02 01:00:29 -07001800 _version = reader.read("!B")[0]
1801 assert(_version == 4)
1802 _type = reader.read("!B")[0]
1803 assert(_type == 4)
1804 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001805 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001806 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07001807 obj.xid = reader.read("!L")[0]
1808 _experimenter = reader.read("!L")[0]
1809 assert(_experimenter == 6035143)
1810 _subtype = reader.read("!L")[0]
1811 assert(_subtype == 19)
1812 return obj
1813
1814 def __eq__(self, other):
1815 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07001816 if self.xid != other.xid: return False
1817 return True
1818
Dan Talaycof6202252013-07-02 01:00:29 -07001819 def pretty_print(self, q):
1820 q.text("bsn_bw_enable_get_request {")
1821 with q.group():
1822 with q.indent(2):
1823 q.breakable()
1824 q.text("xid = ");
1825 if self.xid != None:
1826 q.text("%#x" % self.xid)
1827 else:
1828 q.text('None')
1829 q.breakable()
1830 q.text('}')
1831
Rich Lane7dcdf022013-12-11 14:45:27 -08001832bsn_header.subtypes[19] = bsn_bw_enable_get_request
1833
1834class bsn_bw_enable_set_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001835 version = 4
1836 type = 4
1837 experimenter = 6035143
1838 subtype = 23
1839
1840 def __init__(self, xid=None, enable=None, status=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001841 if xid != None:
1842 self.xid = xid
1843 else:
1844 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07001845 if enable != None:
1846 self.enable = enable
1847 else:
1848 self.enable = 0
1849 if status != None:
1850 self.status = status
1851 else:
1852 self.status = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08001853 return
Dan Talaycof6202252013-07-02 01:00:29 -07001854
1855 def pack(self):
1856 packed = []
1857 packed.append(struct.pack("!B", self.version))
1858 packed.append(struct.pack("!B", self.type))
1859 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1860 packed.append(struct.pack("!L", self.xid))
1861 packed.append(struct.pack("!L", self.experimenter))
1862 packed.append(struct.pack("!L", self.subtype))
1863 packed.append(struct.pack("!L", self.enable))
1864 packed.append(struct.pack("!L", self.status))
1865 length = sum([len(x) for x in packed])
1866 packed[2] = struct.pack("!H", length)
1867 return ''.join(packed)
1868
1869 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001870 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07001871 obj = bsn_bw_enable_set_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07001872 _version = reader.read("!B")[0]
1873 assert(_version == 4)
1874 _type = reader.read("!B")[0]
1875 assert(_type == 4)
1876 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001877 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001878 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07001879 obj.xid = reader.read("!L")[0]
1880 _experimenter = reader.read("!L")[0]
1881 assert(_experimenter == 6035143)
1882 _subtype = reader.read("!L")[0]
1883 assert(_subtype == 23)
1884 obj.enable = reader.read("!L")[0]
1885 obj.status = reader.read("!L")[0]
1886 return obj
1887
1888 def __eq__(self, other):
1889 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07001890 if self.xid != other.xid: return False
1891 if self.enable != other.enable: return False
1892 if self.status != other.status: return False
1893 return True
1894
Dan Talaycof6202252013-07-02 01:00:29 -07001895 def pretty_print(self, q):
1896 q.text("bsn_bw_enable_set_reply {")
1897 with q.group():
1898 with q.indent(2):
1899 q.breakable()
1900 q.text("xid = ");
1901 if self.xid != None:
1902 q.text("%#x" % self.xid)
1903 else:
1904 q.text('None')
1905 q.text(","); q.breakable()
1906 q.text("enable = ");
1907 q.text("%#x" % self.enable)
1908 q.text(","); q.breakable()
1909 q.text("status = ");
1910 q.text("%#x" % self.status)
1911 q.breakable()
1912 q.text('}')
1913
Rich Lane7dcdf022013-12-11 14:45:27 -08001914bsn_header.subtypes[23] = bsn_bw_enable_set_reply
1915
1916class bsn_bw_enable_set_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001917 version = 4
1918 type = 4
1919 experimenter = 6035143
1920 subtype = 18
1921
1922 def __init__(self, xid=None, enable=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001923 if xid != None:
1924 self.xid = xid
1925 else:
1926 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07001927 if enable != None:
1928 self.enable = enable
1929 else:
1930 self.enable = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08001931 return
Dan Talaycof6202252013-07-02 01:00:29 -07001932
1933 def pack(self):
1934 packed = []
1935 packed.append(struct.pack("!B", self.version))
1936 packed.append(struct.pack("!B", self.type))
1937 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1938 packed.append(struct.pack("!L", self.xid))
1939 packed.append(struct.pack("!L", self.experimenter))
1940 packed.append(struct.pack("!L", self.subtype))
1941 packed.append(struct.pack("!L", self.enable))
1942 length = sum([len(x) for x in packed])
1943 packed[2] = struct.pack("!H", length)
1944 return ''.join(packed)
1945
1946 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001947 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07001948 obj = bsn_bw_enable_set_request()
Dan Talaycof6202252013-07-02 01:00:29 -07001949 _version = reader.read("!B")[0]
1950 assert(_version == 4)
1951 _type = reader.read("!B")[0]
1952 assert(_type == 4)
1953 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001954 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001955 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07001956 obj.xid = reader.read("!L")[0]
1957 _experimenter = reader.read("!L")[0]
1958 assert(_experimenter == 6035143)
1959 _subtype = reader.read("!L")[0]
1960 assert(_subtype == 18)
1961 obj.enable = reader.read("!L")[0]
1962 return obj
1963
1964 def __eq__(self, other):
1965 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07001966 if self.xid != other.xid: return False
1967 if self.enable != other.enable: return False
1968 return True
1969
Dan Talaycof6202252013-07-02 01:00:29 -07001970 def pretty_print(self, q):
1971 q.text("bsn_bw_enable_set_request {")
1972 with q.group():
1973 with q.indent(2):
1974 q.breakable()
1975 q.text("xid = ");
1976 if self.xid != None:
1977 q.text("%#x" % self.xid)
1978 else:
1979 q.text('None')
1980 q.text(","); q.breakable()
1981 q.text("enable = ");
1982 q.text("%#x" % self.enable)
1983 q.breakable()
1984 q.text('}')
1985
Rich Lane7dcdf022013-12-11 14:45:27 -08001986bsn_header.subtypes[18] = bsn_bw_enable_set_request
1987
Rich Lane5454b682014-01-14 17:07:36 -08001988class bsn_controller_connections_reply(bsn_header):
1989 version = 4
1990 type = 4
1991 experimenter = 6035143
1992 subtype = 57
1993
1994 def __init__(self, xid=None, connections=None):
1995 if xid != None:
1996 self.xid = xid
1997 else:
1998 self.xid = None
1999 if connections != None:
2000 self.connections = connections
2001 else:
2002 self.connections = []
2003 return
2004
2005 def pack(self):
2006 packed = []
2007 packed.append(struct.pack("!B", self.version))
2008 packed.append(struct.pack("!B", self.type))
2009 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2010 packed.append(struct.pack("!L", self.xid))
2011 packed.append(struct.pack("!L", self.experimenter))
2012 packed.append(struct.pack("!L", self.subtype))
2013 packed.append(loxi.generic_util.pack_list(self.connections))
2014 length = sum([len(x) for x in packed])
2015 packed[2] = struct.pack("!H", length)
2016 return ''.join(packed)
2017
2018 @staticmethod
2019 def unpack(reader):
2020 obj = bsn_controller_connections_reply()
2021 _version = reader.read("!B")[0]
2022 assert(_version == 4)
2023 _type = reader.read("!B")[0]
2024 assert(_type == 4)
2025 _length = reader.read("!H")[0]
2026 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002027 reader = orig_reader.slice(_length, 4)
Rich Lane5454b682014-01-14 17:07:36 -08002028 obj.xid = reader.read("!L")[0]
2029 _experimenter = reader.read("!L")[0]
2030 assert(_experimenter == 6035143)
2031 _subtype = reader.read("!L")[0]
2032 assert(_subtype == 57)
Rich Lanee2567702015-01-26 15:04:35 -08002033 obj.connections = loxi.generic_util.unpack_list(reader, ofp.common.bsn_controller_connection.unpack)
Rich Lane5454b682014-01-14 17:07:36 -08002034 return obj
2035
2036 def __eq__(self, other):
2037 if type(self) != type(other): return False
2038 if self.xid != other.xid: return False
2039 if self.connections != other.connections: return False
2040 return True
2041
2042 def pretty_print(self, q):
2043 q.text("bsn_controller_connections_reply {")
2044 with q.group():
2045 with q.indent(2):
2046 q.breakable()
2047 q.text("xid = ");
2048 if self.xid != None:
2049 q.text("%#x" % self.xid)
2050 else:
2051 q.text('None')
2052 q.text(","); q.breakable()
2053 q.text("connections = ");
2054 q.pp(self.connections)
2055 q.breakable()
2056 q.text('}')
2057
2058bsn_header.subtypes[57] = bsn_controller_connections_reply
2059
2060class bsn_controller_connections_request(bsn_header):
2061 version = 4
2062 type = 4
2063 experimenter = 6035143
2064 subtype = 56
2065
2066 def __init__(self, xid=None):
2067 if xid != None:
2068 self.xid = xid
2069 else:
2070 self.xid = None
2071 return
2072
2073 def pack(self):
2074 packed = []
2075 packed.append(struct.pack("!B", self.version))
2076 packed.append(struct.pack("!B", self.type))
2077 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2078 packed.append(struct.pack("!L", self.xid))
2079 packed.append(struct.pack("!L", self.experimenter))
2080 packed.append(struct.pack("!L", self.subtype))
2081 length = sum([len(x) for x in packed])
2082 packed[2] = struct.pack("!H", length)
2083 return ''.join(packed)
2084
2085 @staticmethod
2086 def unpack(reader):
2087 obj = bsn_controller_connections_request()
2088 _version = reader.read("!B")[0]
2089 assert(_version == 4)
2090 _type = reader.read("!B")[0]
2091 assert(_type == 4)
2092 _length = reader.read("!H")[0]
2093 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002094 reader = orig_reader.slice(_length, 4)
Rich Lane5454b682014-01-14 17:07:36 -08002095 obj.xid = reader.read("!L")[0]
2096 _experimenter = reader.read("!L")[0]
2097 assert(_experimenter == 6035143)
2098 _subtype = reader.read("!L")[0]
2099 assert(_subtype == 56)
2100 return obj
2101
2102 def __eq__(self, other):
2103 if type(self) != type(other): return False
2104 if self.xid != other.xid: return False
2105 return True
2106
2107 def pretty_print(self, q):
2108 q.text("bsn_controller_connections_request {")
2109 with q.group():
2110 with q.indent(2):
2111 q.breakable()
2112 q.text("xid = ");
2113 if self.xid != None:
2114 q.text("%#x" % self.xid)
2115 else:
2116 q.text('None')
2117 q.breakable()
2118 q.text('}')
2119
2120bsn_header.subtypes[56] = bsn_controller_connections_request
2121
Rich Lane9ec3fca2014-02-26 16:22:56 -08002122class experimenter_stats_reply(stats_reply):
2123 subtypes = {}
2124
2125 version = 4
2126 type = 19
2127 stats_type = 65535
2128
2129 def __init__(self, xid=None, flags=None, experimenter=None, subtype=None):
2130 if xid != None:
2131 self.xid = xid
2132 else:
2133 self.xid = None
2134 if flags != None:
2135 self.flags = flags
2136 else:
2137 self.flags = 0
2138 if experimenter != None:
2139 self.experimenter = experimenter
2140 else:
2141 self.experimenter = 0
2142 if subtype != None:
2143 self.subtype = subtype
2144 else:
2145 self.subtype = 0
2146 return
2147
2148 def pack(self):
2149 packed = []
2150 packed.append(struct.pack("!B", self.version))
2151 packed.append(struct.pack("!B", self.type))
2152 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2153 packed.append(struct.pack("!L", self.xid))
2154 packed.append(struct.pack("!H", self.stats_type))
2155 packed.append(struct.pack("!H", self.flags))
2156 packed.append('\x00' * 4)
2157 packed.append(struct.pack("!L", self.experimenter))
2158 packed.append(struct.pack("!L", self.subtype))
2159 length = sum([len(x) for x in packed])
2160 packed[2] = struct.pack("!H", length)
2161 return ''.join(packed)
2162
2163 @staticmethod
2164 def unpack(reader):
2165 subtype, = reader.peek('!L', 16)
2166 subclass = experimenter_stats_reply.subtypes.get(subtype)
2167 if subclass:
2168 return subclass.unpack(reader)
2169
2170 obj = experimenter_stats_reply()
2171 _version = reader.read("!B")[0]
2172 assert(_version == 4)
2173 _type = reader.read("!B")[0]
2174 assert(_type == 19)
2175 _length = reader.read("!H")[0]
2176 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002177 reader = orig_reader.slice(_length, 4)
Rich Lane9ec3fca2014-02-26 16:22:56 -08002178 obj.xid = reader.read("!L")[0]
2179 _stats_type = reader.read("!H")[0]
2180 assert(_stats_type == 65535)
2181 obj.flags = reader.read("!H")[0]
2182 reader.skip(4)
2183 obj.experimenter = reader.read("!L")[0]
2184 obj.subtype = reader.read("!L")[0]
2185 return obj
2186
2187 def __eq__(self, other):
2188 if type(self) != type(other): return False
2189 if self.xid != other.xid: return False
2190 if self.flags != other.flags: return False
2191 if self.experimenter != other.experimenter: return False
2192 if self.subtype != other.subtype: return False
2193 return True
2194
2195 def pretty_print(self, q):
2196 q.text("experimenter_stats_reply {")
2197 with q.group():
2198 with q.indent(2):
2199 q.breakable()
2200 q.text("xid = ");
2201 if self.xid != None:
2202 q.text("%#x" % self.xid)
2203 else:
2204 q.text('None')
2205 q.text(","); q.breakable()
2206 q.text("flags = ");
2207 q.text("%#x" % self.flags)
2208 q.text(","); q.breakable()
2209 q.text("subtype = ");
2210 q.text("%#x" % self.subtype)
2211 q.breakable()
2212 q.text('}')
2213
2214stats_reply.subtypes[65535] = experimenter_stats_reply
2215
2216class bsn_stats_reply(experimenter_stats_reply):
2217 subtypes = {}
2218
2219 version = 4
2220 type = 19
2221 stats_type = 65535
2222 experimenter = 6035143
2223
2224 def __init__(self, xid=None, flags=None, subtype=None):
2225 if xid != None:
2226 self.xid = xid
2227 else:
2228 self.xid = None
2229 if flags != None:
2230 self.flags = flags
2231 else:
2232 self.flags = 0
2233 if subtype != None:
2234 self.subtype = subtype
2235 else:
2236 self.subtype = 0
2237 return
2238
2239 def pack(self):
2240 packed = []
2241 packed.append(struct.pack("!B", self.version))
2242 packed.append(struct.pack("!B", self.type))
2243 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2244 packed.append(struct.pack("!L", self.xid))
2245 packed.append(struct.pack("!H", self.stats_type))
2246 packed.append(struct.pack("!H", self.flags))
2247 packed.append('\x00' * 4)
2248 packed.append(struct.pack("!L", self.experimenter))
2249 packed.append(struct.pack("!L", self.subtype))
2250 length = sum([len(x) for x in packed])
2251 packed[2] = struct.pack("!H", length)
2252 return ''.join(packed)
2253
2254 @staticmethod
2255 def unpack(reader):
2256 subtype, = reader.peek('!L', 20)
2257 subclass = bsn_stats_reply.subtypes.get(subtype)
2258 if subclass:
2259 return subclass.unpack(reader)
2260
2261 obj = bsn_stats_reply()
2262 _version = reader.read("!B")[0]
2263 assert(_version == 4)
2264 _type = reader.read("!B")[0]
2265 assert(_type == 19)
2266 _length = reader.read("!H")[0]
2267 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002268 reader = orig_reader.slice(_length, 4)
Rich Lane9ec3fca2014-02-26 16:22:56 -08002269 obj.xid = reader.read("!L")[0]
2270 _stats_type = reader.read("!H")[0]
2271 assert(_stats_type == 65535)
2272 obj.flags = reader.read("!H")[0]
2273 reader.skip(4)
2274 _experimenter = reader.read("!L")[0]
2275 assert(_experimenter == 6035143)
2276 obj.subtype = reader.read("!L")[0]
2277 return obj
2278
2279 def __eq__(self, other):
2280 if type(self) != type(other): return False
2281 if self.xid != other.xid: return False
2282 if self.flags != other.flags: return False
2283 if self.subtype != other.subtype: return False
2284 return True
2285
2286 def pretty_print(self, q):
2287 q.text("bsn_stats_reply {")
2288 with q.group():
2289 with q.indent(2):
2290 q.breakable()
2291 q.text("xid = ");
2292 if self.xid != None:
2293 q.text("%#x" % self.xid)
2294 else:
2295 q.text('None')
2296 q.text(","); q.breakable()
2297 q.text("flags = ");
2298 q.text("%#x" % self.flags)
2299 q.breakable()
2300 q.text('}')
2301
2302experimenter_stats_reply.subtypes[6035143] = bsn_stats_reply
2303
Rich Lane93b33132014-04-21 12:20:58 -07002304class bsn_debug_counter_desc_stats_reply(bsn_stats_reply):
Rich Lane9ec3fca2014-02-26 16:22:56 -08002305 version = 4
2306 type = 19
2307 stats_type = 65535
2308 experimenter = 6035143
Rich Lane93b33132014-04-21 12:20:58 -07002309 subtype = 13
Rich Lane9ec3fca2014-02-26 16:22:56 -08002310
2311 def __init__(self, xid=None, flags=None, entries=None):
2312 if xid != None:
2313 self.xid = xid
2314 else:
2315 self.xid = None
2316 if flags != None:
2317 self.flags = flags
2318 else:
2319 self.flags = 0
2320 if entries != None:
2321 self.entries = entries
2322 else:
2323 self.entries = []
2324 return
2325
2326 def pack(self):
2327 packed = []
2328 packed.append(struct.pack("!B", self.version))
2329 packed.append(struct.pack("!B", self.type))
2330 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2331 packed.append(struct.pack("!L", self.xid))
2332 packed.append(struct.pack("!H", self.stats_type))
2333 packed.append(struct.pack("!H", self.flags))
2334 packed.append('\x00' * 4)
2335 packed.append(struct.pack("!L", self.experimenter))
2336 packed.append(struct.pack("!L", self.subtype))
2337 packed.append(loxi.generic_util.pack_list(self.entries))
2338 length = sum([len(x) for x in packed])
2339 packed[2] = struct.pack("!H", length)
2340 return ''.join(packed)
2341
2342 @staticmethod
2343 def unpack(reader):
Rich Lane93b33132014-04-21 12:20:58 -07002344 obj = bsn_debug_counter_desc_stats_reply()
Rich Lane9ec3fca2014-02-26 16:22:56 -08002345 _version = reader.read("!B")[0]
2346 assert(_version == 4)
2347 _type = reader.read("!B")[0]
2348 assert(_type == 19)
2349 _length = reader.read("!H")[0]
2350 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002351 reader = orig_reader.slice(_length, 4)
Rich Lane9ec3fca2014-02-26 16:22:56 -08002352 obj.xid = reader.read("!L")[0]
2353 _stats_type = reader.read("!H")[0]
2354 assert(_stats_type == 65535)
2355 obj.flags = reader.read("!H")[0]
2356 reader.skip(4)
2357 _experimenter = reader.read("!L")[0]
2358 assert(_experimenter == 6035143)
2359 _subtype = reader.read("!L")[0]
Rich Lane93b33132014-04-21 12:20:58 -07002360 assert(_subtype == 13)
Rich Lanee2567702015-01-26 15:04:35 -08002361 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_debug_counter_desc_stats_entry.unpack)
Rich Lane9ec3fca2014-02-26 16:22:56 -08002362 return obj
2363
2364 def __eq__(self, other):
2365 if type(self) != type(other): return False
2366 if self.xid != other.xid: return False
2367 if self.flags != other.flags: return False
2368 if self.entries != other.entries: return False
2369 return True
2370
2371 def pretty_print(self, q):
Rich Lane93b33132014-04-21 12:20:58 -07002372 q.text("bsn_debug_counter_desc_stats_reply {")
Rich Lane9ec3fca2014-02-26 16:22:56 -08002373 with q.group():
2374 with q.indent(2):
2375 q.breakable()
2376 q.text("xid = ");
2377 if self.xid != None:
2378 q.text("%#x" % self.xid)
2379 else:
2380 q.text('None')
2381 q.text(","); q.breakable()
2382 q.text("flags = ");
2383 q.text("%#x" % self.flags)
2384 q.text(","); q.breakable()
2385 q.text("entries = ");
2386 q.pp(self.entries)
2387 q.breakable()
2388 q.text('}')
2389
Rich Lane93b33132014-04-21 12:20:58 -07002390bsn_stats_reply.subtypes[13] = bsn_debug_counter_desc_stats_reply
Rich Lane9ec3fca2014-02-26 16:22:56 -08002391
2392class experimenter_stats_request(stats_request):
2393 subtypes = {}
2394
2395 version = 4
2396 type = 18
2397 stats_type = 65535
2398
2399 def __init__(self, xid=None, flags=None, experimenter=None, subtype=None):
2400 if xid != None:
2401 self.xid = xid
2402 else:
2403 self.xid = None
2404 if flags != None:
2405 self.flags = flags
2406 else:
2407 self.flags = 0
2408 if experimenter != None:
2409 self.experimenter = experimenter
2410 else:
2411 self.experimenter = 0
2412 if subtype != None:
2413 self.subtype = subtype
2414 else:
2415 self.subtype = 0
2416 return
2417
2418 def pack(self):
2419 packed = []
2420 packed.append(struct.pack("!B", self.version))
2421 packed.append(struct.pack("!B", self.type))
2422 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2423 packed.append(struct.pack("!L", self.xid))
2424 packed.append(struct.pack("!H", self.stats_type))
2425 packed.append(struct.pack("!H", self.flags))
2426 packed.append('\x00' * 4)
2427 packed.append(struct.pack("!L", self.experimenter))
2428 packed.append(struct.pack("!L", self.subtype))
2429 length = sum([len(x) for x in packed])
2430 packed[2] = struct.pack("!H", length)
2431 return ''.join(packed)
2432
2433 @staticmethod
2434 def unpack(reader):
2435 subtype, = reader.peek('!L', 16)
2436 subclass = experimenter_stats_request.subtypes.get(subtype)
2437 if subclass:
2438 return subclass.unpack(reader)
2439
2440 obj = experimenter_stats_request()
2441 _version = reader.read("!B")[0]
2442 assert(_version == 4)
2443 _type = reader.read("!B")[0]
2444 assert(_type == 18)
2445 _length = reader.read("!H")[0]
2446 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002447 reader = orig_reader.slice(_length, 4)
Rich Lane9ec3fca2014-02-26 16:22:56 -08002448 obj.xid = reader.read("!L")[0]
2449 _stats_type = reader.read("!H")[0]
2450 assert(_stats_type == 65535)
2451 obj.flags = reader.read("!H")[0]
2452 reader.skip(4)
2453 obj.experimenter = reader.read("!L")[0]
2454 obj.subtype = reader.read("!L")[0]
2455 return obj
2456
2457 def __eq__(self, other):
2458 if type(self) != type(other): return False
2459 if self.xid != other.xid: return False
2460 if self.flags != other.flags: return False
2461 if self.experimenter != other.experimenter: return False
2462 if self.subtype != other.subtype: return False
2463 return True
2464
2465 def pretty_print(self, q):
2466 q.text("experimenter_stats_request {")
2467 with q.group():
2468 with q.indent(2):
2469 q.breakable()
2470 q.text("xid = ");
2471 if self.xid != None:
2472 q.text("%#x" % self.xid)
2473 else:
2474 q.text('None')
2475 q.text(","); q.breakable()
2476 q.text("flags = ");
2477 q.text("%#x" % self.flags)
2478 q.text(","); q.breakable()
2479 q.text("subtype = ");
2480 q.text("%#x" % self.subtype)
2481 q.breakable()
2482 q.text('}')
2483
2484stats_request.subtypes[65535] = experimenter_stats_request
2485
2486class bsn_stats_request(experimenter_stats_request):
2487 subtypes = {}
2488
2489 version = 4
2490 type = 18
2491 stats_type = 65535
2492 experimenter = 6035143
2493
2494 def __init__(self, xid=None, flags=None, subtype=None):
2495 if xid != None:
2496 self.xid = xid
2497 else:
2498 self.xid = None
2499 if flags != None:
2500 self.flags = flags
2501 else:
2502 self.flags = 0
2503 if subtype != None:
2504 self.subtype = subtype
2505 else:
2506 self.subtype = 0
2507 return
2508
2509 def pack(self):
2510 packed = []
2511 packed.append(struct.pack("!B", self.version))
2512 packed.append(struct.pack("!B", self.type))
2513 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2514 packed.append(struct.pack("!L", self.xid))
2515 packed.append(struct.pack("!H", self.stats_type))
2516 packed.append(struct.pack("!H", self.flags))
2517 packed.append('\x00' * 4)
2518 packed.append(struct.pack("!L", self.experimenter))
2519 packed.append(struct.pack("!L", self.subtype))
2520 length = sum([len(x) for x in packed])
2521 packed[2] = struct.pack("!H", length)
2522 return ''.join(packed)
2523
2524 @staticmethod
2525 def unpack(reader):
2526 subtype, = reader.peek('!L', 20)
2527 subclass = bsn_stats_request.subtypes.get(subtype)
2528 if subclass:
2529 return subclass.unpack(reader)
2530
2531 obj = bsn_stats_request()
2532 _version = reader.read("!B")[0]
2533 assert(_version == 4)
2534 _type = reader.read("!B")[0]
2535 assert(_type == 18)
2536 _length = reader.read("!H")[0]
2537 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002538 reader = orig_reader.slice(_length, 4)
Rich Lane9ec3fca2014-02-26 16:22:56 -08002539 obj.xid = reader.read("!L")[0]
2540 _stats_type = reader.read("!H")[0]
2541 assert(_stats_type == 65535)
2542 obj.flags = reader.read("!H")[0]
2543 reader.skip(4)
2544 _experimenter = reader.read("!L")[0]
2545 assert(_experimenter == 6035143)
2546 obj.subtype = reader.read("!L")[0]
2547 return obj
2548
2549 def __eq__(self, other):
2550 if type(self) != type(other): return False
2551 if self.xid != other.xid: return False
2552 if self.flags != other.flags: return False
2553 if self.subtype != other.subtype: return False
2554 return True
2555
2556 def pretty_print(self, q):
2557 q.text("bsn_stats_request {")
2558 with q.group():
2559 with q.indent(2):
2560 q.breakable()
2561 q.text("xid = ");
2562 if self.xid != None:
2563 q.text("%#x" % self.xid)
2564 else:
2565 q.text('None')
2566 q.text(","); q.breakable()
2567 q.text("flags = ");
2568 q.text("%#x" % self.flags)
2569 q.breakable()
2570 q.text('}')
2571
2572experimenter_stats_request.subtypes[6035143] = bsn_stats_request
2573
Rich Lane93b33132014-04-21 12:20:58 -07002574class bsn_debug_counter_desc_stats_request(bsn_stats_request):
2575 version = 4
2576 type = 18
2577 stats_type = 65535
2578 experimenter = 6035143
2579 subtype = 13
2580
2581 def __init__(self, xid=None, flags=None):
2582 if xid != None:
2583 self.xid = xid
2584 else:
2585 self.xid = None
2586 if flags != None:
2587 self.flags = flags
2588 else:
2589 self.flags = 0
2590 return
2591
2592 def pack(self):
2593 packed = []
2594 packed.append(struct.pack("!B", self.version))
2595 packed.append(struct.pack("!B", self.type))
2596 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2597 packed.append(struct.pack("!L", self.xid))
2598 packed.append(struct.pack("!H", self.stats_type))
2599 packed.append(struct.pack("!H", self.flags))
2600 packed.append('\x00' * 4)
2601 packed.append(struct.pack("!L", self.experimenter))
2602 packed.append(struct.pack("!L", self.subtype))
2603 length = sum([len(x) for x in packed])
2604 packed[2] = struct.pack("!H", length)
2605 return ''.join(packed)
2606
2607 @staticmethod
2608 def unpack(reader):
2609 obj = bsn_debug_counter_desc_stats_request()
2610 _version = reader.read("!B")[0]
2611 assert(_version == 4)
2612 _type = reader.read("!B")[0]
2613 assert(_type == 18)
2614 _length = reader.read("!H")[0]
2615 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002616 reader = orig_reader.slice(_length, 4)
Rich Lane93b33132014-04-21 12:20:58 -07002617 obj.xid = reader.read("!L")[0]
2618 _stats_type = reader.read("!H")[0]
2619 assert(_stats_type == 65535)
2620 obj.flags = reader.read("!H")[0]
2621 reader.skip(4)
2622 _experimenter = reader.read("!L")[0]
2623 assert(_experimenter == 6035143)
2624 _subtype = reader.read("!L")[0]
2625 assert(_subtype == 13)
2626 return obj
2627
2628 def __eq__(self, other):
2629 if type(self) != type(other): return False
2630 if self.xid != other.xid: return False
2631 if self.flags != other.flags: return False
2632 return True
2633
2634 def pretty_print(self, q):
2635 q.text("bsn_debug_counter_desc_stats_request {")
2636 with q.group():
2637 with q.indent(2):
2638 q.breakable()
2639 q.text("xid = ");
2640 if self.xid != None:
2641 q.text("%#x" % self.xid)
2642 else:
2643 q.text('None')
2644 q.text(","); q.breakable()
2645 q.text("flags = ");
2646 q.text("%#x" % self.flags)
2647 q.breakable()
2648 q.text('}')
2649
2650bsn_stats_request.subtypes[13] = bsn_debug_counter_desc_stats_request
2651
2652class bsn_debug_counter_stats_reply(bsn_stats_reply):
2653 version = 4
2654 type = 19
2655 stats_type = 65535
2656 experimenter = 6035143
2657 subtype = 12
2658
2659 def __init__(self, xid=None, flags=None, entries=None):
2660 if xid != None:
2661 self.xid = xid
2662 else:
2663 self.xid = None
2664 if flags != None:
2665 self.flags = flags
2666 else:
2667 self.flags = 0
2668 if entries != None:
2669 self.entries = entries
2670 else:
2671 self.entries = []
2672 return
2673
2674 def pack(self):
2675 packed = []
2676 packed.append(struct.pack("!B", self.version))
2677 packed.append(struct.pack("!B", self.type))
2678 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2679 packed.append(struct.pack("!L", self.xid))
2680 packed.append(struct.pack("!H", self.stats_type))
2681 packed.append(struct.pack("!H", self.flags))
2682 packed.append('\x00' * 4)
2683 packed.append(struct.pack("!L", self.experimenter))
2684 packed.append(struct.pack("!L", self.subtype))
2685 packed.append(loxi.generic_util.pack_list(self.entries))
2686 length = sum([len(x) for x in packed])
2687 packed[2] = struct.pack("!H", length)
2688 return ''.join(packed)
2689
2690 @staticmethod
2691 def unpack(reader):
2692 obj = bsn_debug_counter_stats_reply()
2693 _version = reader.read("!B")[0]
2694 assert(_version == 4)
2695 _type = reader.read("!B")[0]
2696 assert(_type == 19)
2697 _length = reader.read("!H")[0]
2698 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002699 reader = orig_reader.slice(_length, 4)
Rich Lane93b33132014-04-21 12:20:58 -07002700 obj.xid = reader.read("!L")[0]
2701 _stats_type = reader.read("!H")[0]
2702 assert(_stats_type == 65535)
2703 obj.flags = reader.read("!H")[0]
2704 reader.skip(4)
2705 _experimenter = reader.read("!L")[0]
2706 assert(_experimenter == 6035143)
2707 _subtype = reader.read("!L")[0]
2708 assert(_subtype == 12)
Rich Lanee2567702015-01-26 15:04:35 -08002709 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_debug_counter_stats_entry.unpack)
Rich Lane93b33132014-04-21 12:20:58 -07002710 return obj
2711
2712 def __eq__(self, other):
2713 if type(self) != type(other): return False
2714 if self.xid != other.xid: return False
2715 if self.flags != other.flags: return False
2716 if self.entries != other.entries: return False
2717 return True
2718
2719 def pretty_print(self, q):
2720 q.text("bsn_debug_counter_stats_reply {")
2721 with q.group():
2722 with q.indent(2):
2723 q.breakable()
2724 q.text("xid = ");
2725 if self.xid != None:
2726 q.text("%#x" % self.xid)
2727 else:
2728 q.text('None')
2729 q.text(","); q.breakable()
2730 q.text("flags = ");
2731 q.text("%#x" % self.flags)
2732 q.text(","); q.breakable()
2733 q.text("entries = ");
2734 q.pp(self.entries)
2735 q.breakable()
2736 q.text('}')
2737
2738bsn_stats_reply.subtypes[12] = bsn_debug_counter_stats_reply
2739
2740class bsn_debug_counter_stats_request(bsn_stats_request):
2741 version = 4
2742 type = 18
2743 stats_type = 65535
2744 experimenter = 6035143
2745 subtype = 12
2746
2747 def __init__(self, xid=None, flags=None):
2748 if xid != None:
2749 self.xid = xid
2750 else:
2751 self.xid = None
2752 if flags != None:
2753 self.flags = flags
2754 else:
2755 self.flags = 0
2756 return
2757
2758 def pack(self):
2759 packed = []
2760 packed.append(struct.pack("!B", self.version))
2761 packed.append(struct.pack("!B", self.type))
2762 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2763 packed.append(struct.pack("!L", self.xid))
2764 packed.append(struct.pack("!H", self.stats_type))
2765 packed.append(struct.pack("!H", self.flags))
2766 packed.append('\x00' * 4)
2767 packed.append(struct.pack("!L", self.experimenter))
2768 packed.append(struct.pack("!L", self.subtype))
2769 length = sum([len(x) for x in packed])
2770 packed[2] = struct.pack("!H", length)
2771 return ''.join(packed)
2772
2773 @staticmethod
2774 def unpack(reader):
2775 obj = bsn_debug_counter_stats_request()
2776 _version = reader.read("!B")[0]
2777 assert(_version == 4)
2778 _type = reader.read("!B")[0]
2779 assert(_type == 18)
2780 _length = reader.read("!H")[0]
2781 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002782 reader = orig_reader.slice(_length, 4)
Rich Lane93b33132014-04-21 12:20:58 -07002783 obj.xid = reader.read("!L")[0]
2784 _stats_type = reader.read("!H")[0]
2785 assert(_stats_type == 65535)
2786 obj.flags = reader.read("!H")[0]
2787 reader.skip(4)
2788 _experimenter = reader.read("!L")[0]
2789 assert(_experimenter == 6035143)
2790 _subtype = reader.read("!L")[0]
2791 assert(_subtype == 12)
2792 return obj
2793
2794 def __eq__(self, other):
2795 if type(self) != type(other): return False
2796 if self.xid != other.xid: return False
2797 if self.flags != other.flags: return False
2798 return True
2799
2800 def pretty_print(self, q):
2801 q.text("bsn_debug_counter_stats_request {")
2802 with q.group():
2803 with q.indent(2):
2804 q.breakable()
2805 q.text("xid = ");
2806 if self.xid != None:
2807 q.text("%#x" % self.xid)
2808 else:
2809 q.text('None')
2810 q.text(","); q.breakable()
2811 q.text("flags = ");
2812 q.text("%#x" % self.flags)
2813 q.breakable()
2814 q.text('}')
2815
2816bsn_stats_request.subtypes[12] = bsn_debug_counter_stats_request
2817
2818class bsn_flow_checksum_bucket_stats_reply(bsn_stats_reply):
2819 version = 4
2820 type = 19
2821 stats_type = 65535
2822 experimenter = 6035143
2823 subtype = 10
2824
2825 def __init__(self, xid=None, flags=None, entries=None):
2826 if xid != None:
2827 self.xid = xid
2828 else:
2829 self.xid = None
2830 if flags != None:
2831 self.flags = flags
2832 else:
2833 self.flags = 0
2834 if entries != None:
2835 self.entries = entries
2836 else:
2837 self.entries = []
2838 return
2839
2840 def pack(self):
2841 packed = []
2842 packed.append(struct.pack("!B", self.version))
2843 packed.append(struct.pack("!B", self.type))
2844 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2845 packed.append(struct.pack("!L", self.xid))
2846 packed.append(struct.pack("!H", self.stats_type))
2847 packed.append(struct.pack("!H", self.flags))
2848 packed.append('\x00' * 4)
2849 packed.append(struct.pack("!L", self.experimenter))
2850 packed.append(struct.pack("!L", self.subtype))
2851 packed.append(loxi.generic_util.pack_list(self.entries))
2852 length = sum([len(x) for x in packed])
2853 packed[2] = struct.pack("!H", length)
2854 return ''.join(packed)
2855
2856 @staticmethod
2857 def unpack(reader):
2858 obj = bsn_flow_checksum_bucket_stats_reply()
2859 _version = reader.read("!B")[0]
2860 assert(_version == 4)
2861 _type = reader.read("!B")[0]
2862 assert(_type == 19)
2863 _length = reader.read("!H")[0]
2864 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002865 reader = orig_reader.slice(_length, 4)
Rich Lane93b33132014-04-21 12:20:58 -07002866 obj.xid = reader.read("!L")[0]
2867 _stats_type = reader.read("!H")[0]
2868 assert(_stats_type == 65535)
2869 obj.flags = reader.read("!H")[0]
2870 reader.skip(4)
2871 _experimenter = reader.read("!L")[0]
2872 assert(_experimenter == 6035143)
2873 _subtype = reader.read("!L")[0]
2874 assert(_subtype == 10)
Rich Lanee2567702015-01-26 15:04:35 -08002875 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_flow_checksum_bucket_stats_entry.unpack)
Rich Lane93b33132014-04-21 12:20:58 -07002876 return obj
2877
2878 def __eq__(self, other):
2879 if type(self) != type(other): return False
2880 if self.xid != other.xid: return False
2881 if self.flags != other.flags: return False
2882 if self.entries != other.entries: return False
2883 return True
2884
2885 def pretty_print(self, q):
2886 q.text("bsn_flow_checksum_bucket_stats_reply {")
2887 with q.group():
2888 with q.indent(2):
2889 q.breakable()
2890 q.text("xid = ");
2891 if self.xid != None:
2892 q.text("%#x" % self.xid)
2893 else:
2894 q.text('None')
2895 q.text(","); q.breakable()
2896 q.text("flags = ");
2897 q.text("%#x" % self.flags)
2898 q.text(","); q.breakable()
2899 q.text("entries = ");
2900 q.pp(self.entries)
2901 q.breakable()
2902 q.text('}')
2903
2904bsn_stats_reply.subtypes[10] = bsn_flow_checksum_bucket_stats_reply
2905
Rich Lane9ec3fca2014-02-26 16:22:56 -08002906class bsn_flow_checksum_bucket_stats_request(bsn_stats_request):
2907 version = 4
2908 type = 18
2909 stats_type = 65535
2910 experimenter = 6035143
2911 subtype = 10
2912
2913 def __init__(self, xid=None, flags=None, table_id=None):
2914 if xid != None:
2915 self.xid = xid
2916 else:
2917 self.xid = None
2918 if flags != None:
2919 self.flags = flags
2920 else:
2921 self.flags = 0
2922 if table_id != None:
2923 self.table_id = table_id
2924 else:
2925 self.table_id = 0
2926 return
2927
2928 def pack(self):
2929 packed = []
2930 packed.append(struct.pack("!B", self.version))
2931 packed.append(struct.pack("!B", self.type))
2932 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2933 packed.append(struct.pack("!L", self.xid))
2934 packed.append(struct.pack("!H", self.stats_type))
2935 packed.append(struct.pack("!H", self.flags))
2936 packed.append('\x00' * 4)
2937 packed.append(struct.pack("!L", self.experimenter))
2938 packed.append(struct.pack("!L", self.subtype))
2939 packed.append(struct.pack("!B", self.table_id))
2940 length = sum([len(x) for x in packed])
2941 packed[2] = struct.pack("!H", length)
2942 return ''.join(packed)
2943
2944 @staticmethod
2945 def unpack(reader):
2946 obj = bsn_flow_checksum_bucket_stats_request()
2947 _version = reader.read("!B")[0]
2948 assert(_version == 4)
2949 _type = reader.read("!B")[0]
2950 assert(_type == 18)
2951 _length = reader.read("!H")[0]
2952 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002953 reader = orig_reader.slice(_length, 4)
Rich Lane9ec3fca2014-02-26 16:22:56 -08002954 obj.xid = reader.read("!L")[0]
2955 _stats_type = reader.read("!H")[0]
2956 assert(_stats_type == 65535)
2957 obj.flags = reader.read("!H")[0]
2958 reader.skip(4)
2959 _experimenter = reader.read("!L")[0]
2960 assert(_experimenter == 6035143)
2961 _subtype = reader.read("!L")[0]
2962 assert(_subtype == 10)
2963 obj.table_id = reader.read("!B")[0]
2964 return obj
2965
2966 def __eq__(self, other):
2967 if type(self) != type(other): return False
2968 if self.xid != other.xid: return False
2969 if self.flags != other.flags: return False
2970 if self.table_id != other.table_id: return False
2971 return True
2972
2973 def pretty_print(self, q):
2974 q.text("bsn_flow_checksum_bucket_stats_request {")
2975 with q.group():
2976 with q.indent(2):
2977 q.breakable()
2978 q.text("xid = ");
2979 if self.xid != None:
2980 q.text("%#x" % self.xid)
2981 else:
2982 q.text('None')
2983 q.text(","); q.breakable()
2984 q.text("flags = ");
2985 q.text("%#x" % self.flags)
2986 q.text(","); q.breakable()
2987 q.text("table_id = ");
2988 q.text("%#x" % self.table_id)
2989 q.breakable()
2990 q.text('}')
2991
2992bsn_stats_request.subtypes[10] = bsn_flow_checksum_bucket_stats_request
2993
Rich Lane7dcdf022013-12-11 14:45:27 -08002994class bsn_flow_idle(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07002995 version = 4
2996 type = 4
2997 experimenter = 6035143
2998 subtype = 40
2999
3000 def __init__(self, xid=None, cookie=None, priority=None, table_id=None, match=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08003001 if xid != None:
3002 self.xid = xid
3003 else:
3004 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07003005 if cookie != None:
3006 self.cookie = cookie
3007 else:
3008 self.cookie = 0
3009 if priority != None:
3010 self.priority = priority
3011 else:
3012 self.priority = 0
3013 if table_id != None:
3014 self.table_id = table_id
3015 else:
3016 self.table_id = 0
3017 if match != None:
3018 self.match = match
3019 else:
Rich Lanee2567702015-01-26 15:04:35 -08003020 self.match = ofp.match()
Rich Lane7dcdf022013-12-11 14:45:27 -08003021 return
Rich Lane6f4978c2013-10-20 21:33:52 -07003022
3023 def pack(self):
3024 packed = []
3025 packed.append(struct.pack("!B", self.version))
3026 packed.append(struct.pack("!B", self.type))
3027 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3028 packed.append(struct.pack("!L", self.xid))
3029 packed.append(struct.pack("!L", self.experimenter))
3030 packed.append(struct.pack("!L", self.subtype))
3031 packed.append(struct.pack("!Q", self.cookie))
3032 packed.append(struct.pack("!H", self.priority))
3033 packed.append(struct.pack("!B", self.table_id))
3034 packed.append('\x00' * 5)
3035 packed.append(self.match.pack())
3036 length = sum([len(x) for x in packed])
3037 packed[2] = struct.pack("!H", length)
3038 return ''.join(packed)
3039
3040 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003041 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07003042 obj = bsn_flow_idle()
Rich Lane6f4978c2013-10-20 21:33:52 -07003043 _version = reader.read("!B")[0]
3044 assert(_version == 4)
3045 _type = reader.read("!B")[0]
3046 assert(_type == 4)
3047 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003048 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003049 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -07003050 obj.xid = reader.read("!L")[0]
3051 _experimenter = reader.read("!L")[0]
3052 assert(_experimenter == 6035143)
3053 _subtype = reader.read("!L")[0]
3054 assert(_subtype == 40)
3055 obj.cookie = reader.read("!Q")[0]
3056 obj.priority = reader.read("!H")[0]
3057 obj.table_id = reader.read("!B")[0]
3058 reader.skip(5)
Rich Lanee2567702015-01-26 15:04:35 -08003059 obj.match = ofp.match.unpack(reader)
Rich Lane6f4978c2013-10-20 21:33:52 -07003060 return obj
3061
3062 def __eq__(self, other):
3063 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07003064 if self.xid != other.xid: return False
3065 if self.cookie != other.cookie: return False
3066 if self.priority != other.priority: return False
3067 if self.table_id != other.table_id: return False
3068 if self.match != other.match: return False
3069 return True
3070
Rich Lane6f4978c2013-10-20 21:33:52 -07003071 def pretty_print(self, q):
3072 q.text("bsn_flow_idle {")
3073 with q.group():
3074 with q.indent(2):
3075 q.breakable()
3076 q.text("xid = ");
3077 if self.xid != None:
3078 q.text("%#x" % self.xid)
3079 else:
3080 q.text('None')
3081 q.text(","); q.breakable()
3082 q.text("cookie = ");
3083 q.text("%#x" % self.cookie)
3084 q.text(","); q.breakable()
3085 q.text("priority = ");
3086 q.text("%#x" % self.priority)
3087 q.text(","); q.breakable()
3088 q.text("table_id = ");
3089 q.text("%#x" % self.table_id)
3090 q.text(","); q.breakable()
3091 q.text("match = ");
3092 q.pp(self.match)
3093 q.breakable()
3094 q.text('}')
3095
Rich Lane7dcdf022013-12-11 14:45:27 -08003096bsn_header.subtypes[40] = bsn_flow_idle
3097
3098class bsn_flow_idle_enable_get_reply(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07003099 version = 4
3100 type = 4
3101 experimenter = 6035143
3102 subtype = 39
3103
3104 def __init__(self, xid=None, enabled=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08003105 if xid != None:
3106 self.xid = xid
3107 else:
3108 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07003109 if enabled != None:
3110 self.enabled = enabled
3111 else:
3112 self.enabled = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08003113 return
Rich Lane6f4978c2013-10-20 21:33:52 -07003114
3115 def pack(self):
3116 packed = []
3117 packed.append(struct.pack("!B", self.version))
3118 packed.append(struct.pack("!B", self.type))
3119 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3120 packed.append(struct.pack("!L", self.xid))
3121 packed.append(struct.pack("!L", self.experimenter))
3122 packed.append(struct.pack("!L", self.subtype))
3123 packed.append(struct.pack("!L", self.enabled))
3124 length = sum([len(x) for x in packed])
3125 packed[2] = struct.pack("!H", length)
3126 return ''.join(packed)
3127
3128 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003129 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07003130 obj = bsn_flow_idle_enable_get_reply()
Rich Lane6f4978c2013-10-20 21:33:52 -07003131 _version = reader.read("!B")[0]
3132 assert(_version == 4)
3133 _type = reader.read("!B")[0]
3134 assert(_type == 4)
3135 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003136 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003137 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -07003138 obj.xid = reader.read("!L")[0]
3139 _experimenter = reader.read("!L")[0]
3140 assert(_experimenter == 6035143)
3141 _subtype = reader.read("!L")[0]
3142 assert(_subtype == 39)
3143 obj.enabled = reader.read("!L")[0]
3144 return obj
3145
3146 def __eq__(self, other):
3147 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07003148 if self.xid != other.xid: return False
3149 if self.enabled != other.enabled: return False
3150 return True
3151
Rich Lane6f4978c2013-10-20 21:33:52 -07003152 def pretty_print(self, q):
3153 q.text("bsn_flow_idle_enable_get_reply {")
3154 with q.group():
3155 with q.indent(2):
3156 q.breakable()
3157 q.text("xid = ");
3158 if self.xid != None:
3159 q.text("%#x" % self.xid)
3160 else:
3161 q.text('None')
3162 q.text(","); q.breakable()
3163 q.text("enabled = ");
3164 q.text("%#x" % self.enabled)
3165 q.breakable()
3166 q.text('}')
3167
Rich Lane7dcdf022013-12-11 14:45:27 -08003168bsn_header.subtypes[39] = bsn_flow_idle_enable_get_reply
3169
3170class bsn_flow_idle_enable_get_request(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07003171 version = 4
3172 type = 4
3173 experimenter = 6035143
3174 subtype = 38
3175
3176 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08003177 if xid != None:
3178 self.xid = xid
3179 else:
3180 self.xid = None
3181 return
Rich Lane6f4978c2013-10-20 21:33:52 -07003182
3183 def pack(self):
3184 packed = []
3185 packed.append(struct.pack("!B", self.version))
3186 packed.append(struct.pack("!B", self.type))
3187 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3188 packed.append(struct.pack("!L", self.xid))
3189 packed.append(struct.pack("!L", self.experimenter))
3190 packed.append(struct.pack("!L", self.subtype))
3191 length = sum([len(x) for x in packed])
3192 packed[2] = struct.pack("!H", length)
3193 return ''.join(packed)
3194
3195 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003196 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07003197 obj = bsn_flow_idle_enable_get_request()
Rich Lane6f4978c2013-10-20 21:33:52 -07003198 _version = reader.read("!B")[0]
3199 assert(_version == 4)
3200 _type = reader.read("!B")[0]
3201 assert(_type == 4)
3202 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003203 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003204 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -07003205 obj.xid = reader.read("!L")[0]
3206 _experimenter = reader.read("!L")[0]
3207 assert(_experimenter == 6035143)
3208 _subtype = reader.read("!L")[0]
3209 assert(_subtype == 38)
3210 return obj
3211
3212 def __eq__(self, other):
3213 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07003214 if self.xid != other.xid: return False
3215 return True
3216
Rich Lane6f4978c2013-10-20 21:33:52 -07003217 def pretty_print(self, q):
3218 q.text("bsn_flow_idle_enable_get_request {")
3219 with q.group():
3220 with q.indent(2):
3221 q.breakable()
3222 q.text("xid = ");
3223 if self.xid != None:
3224 q.text("%#x" % self.xid)
3225 else:
3226 q.text('None')
3227 q.breakable()
3228 q.text('}')
3229
Rich Lane7dcdf022013-12-11 14:45:27 -08003230bsn_header.subtypes[38] = bsn_flow_idle_enable_get_request
3231
3232class bsn_flow_idle_enable_set_reply(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07003233 version = 4
3234 type = 4
3235 experimenter = 6035143
3236 subtype = 37
3237
3238 def __init__(self, xid=None, enable=None, status=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08003239 if xid != None:
3240 self.xid = xid
3241 else:
3242 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07003243 if enable != None:
3244 self.enable = enable
3245 else:
3246 self.enable = 0
3247 if status != None:
3248 self.status = status
3249 else:
3250 self.status = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08003251 return
Rich Lane6f4978c2013-10-20 21:33:52 -07003252
3253 def pack(self):
3254 packed = []
3255 packed.append(struct.pack("!B", self.version))
3256 packed.append(struct.pack("!B", self.type))
3257 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3258 packed.append(struct.pack("!L", self.xid))
3259 packed.append(struct.pack("!L", self.experimenter))
3260 packed.append(struct.pack("!L", self.subtype))
3261 packed.append(struct.pack("!L", self.enable))
3262 packed.append(struct.pack("!L", self.status))
3263 length = sum([len(x) for x in packed])
3264 packed[2] = struct.pack("!H", length)
3265 return ''.join(packed)
3266
3267 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003268 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07003269 obj = bsn_flow_idle_enable_set_reply()
Rich Lane6f4978c2013-10-20 21:33:52 -07003270 _version = reader.read("!B")[0]
3271 assert(_version == 4)
3272 _type = reader.read("!B")[0]
3273 assert(_type == 4)
3274 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003275 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003276 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -07003277 obj.xid = reader.read("!L")[0]
3278 _experimenter = reader.read("!L")[0]
3279 assert(_experimenter == 6035143)
3280 _subtype = reader.read("!L")[0]
3281 assert(_subtype == 37)
3282 obj.enable = reader.read("!L")[0]
3283 obj.status = reader.read("!L")[0]
3284 return obj
3285
3286 def __eq__(self, other):
3287 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07003288 if self.xid != other.xid: return False
3289 if self.enable != other.enable: return False
3290 if self.status != other.status: return False
3291 return True
3292
Rich Lane6f4978c2013-10-20 21:33:52 -07003293 def pretty_print(self, q):
3294 q.text("bsn_flow_idle_enable_set_reply {")
3295 with q.group():
3296 with q.indent(2):
3297 q.breakable()
3298 q.text("xid = ");
3299 if self.xid != None:
3300 q.text("%#x" % self.xid)
3301 else:
3302 q.text('None')
3303 q.text(","); q.breakable()
3304 q.text("enable = ");
3305 q.text("%#x" % self.enable)
3306 q.text(","); q.breakable()
3307 q.text("status = ");
3308 q.text("%#x" % self.status)
3309 q.breakable()
3310 q.text('}')
3311
Rich Lane7dcdf022013-12-11 14:45:27 -08003312bsn_header.subtypes[37] = bsn_flow_idle_enable_set_reply
3313
3314class bsn_flow_idle_enable_set_request(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07003315 version = 4
3316 type = 4
3317 experimenter = 6035143
3318 subtype = 36
3319
3320 def __init__(self, xid=None, enable=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08003321 if xid != None:
3322 self.xid = xid
3323 else:
3324 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07003325 if enable != None:
3326 self.enable = enable
3327 else:
3328 self.enable = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08003329 return
Rich Lane6f4978c2013-10-20 21:33:52 -07003330
3331 def pack(self):
3332 packed = []
3333 packed.append(struct.pack("!B", self.version))
3334 packed.append(struct.pack("!B", self.type))
3335 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3336 packed.append(struct.pack("!L", self.xid))
3337 packed.append(struct.pack("!L", self.experimenter))
3338 packed.append(struct.pack("!L", self.subtype))
3339 packed.append(struct.pack("!L", self.enable))
3340 length = sum([len(x) for x in packed])
3341 packed[2] = struct.pack("!H", length)
3342 return ''.join(packed)
3343
3344 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003345 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07003346 obj = bsn_flow_idle_enable_set_request()
Rich Lane6f4978c2013-10-20 21:33:52 -07003347 _version = reader.read("!B")[0]
3348 assert(_version == 4)
3349 _type = reader.read("!B")[0]
3350 assert(_type == 4)
3351 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003352 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003353 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -07003354 obj.xid = reader.read("!L")[0]
3355 _experimenter = reader.read("!L")[0]
3356 assert(_experimenter == 6035143)
3357 _subtype = reader.read("!L")[0]
3358 assert(_subtype == 36)
3359 obj.enable = reader.read("!L")[0]
3360 return obj
3361
3362 def __eq__(self, other):
3363 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07003364 if self.xid != other.xid: return False
3365 if self.enable != other.enable: return False
3366 return True
3367
Rich Lane6f4978c2013-10-20 21:33:52 -07003368 def pretty_print(self, q):
3369 q.text("bsn_flow_idle_enable_set_request {")
3370 with q.group():
3371 with q.indent(2):
3372 q.breakable()
3373 q.text("xid = ");
3374 if self.xid != None:
3375 q.text("%#x" % self.xid)
3376 else:
3377 q.text('None')
3378 q.text(","); q.breakable()
3379 q.text("enable = ");
3380 q.text("%#x" % self.enable)
3381 q.breakable()
3382 q.text('}')
3383
Rich Lane7dcdf022013-12-11 14:45:27 -08003384bsn_header.subtypes[36] = bsn_flow_idle_enable_set_request
3385
Rich Lanecb18dbd2014-12-18 10:02:29 -08003386class bsn_generic_stats_reply(bsn_stats_reply):
3387 version = 4
3388 type = 19
3389 stats_type = 65535
3390 experimenter = 6035143
3391 subtype = 16
3392
3393 def __init__(self, xid=None, flags=None, entries=None):
3394 if xid != None:
3395 self.xid = xid
3396 else:
3397 self.xid = None
3398 if flags != None:
3399 self.flags = flags
3400 else:
3401 self.flags = 0
3402 if entries != None:
3403 self.entries = entries
3404 else:
3405 self.entries = []
3406 return
3407
3408 def pack(self):
3409 packed = []
3410 packed.append(struct.pack("!B", self.version))
3411 packed.append(struct.pack("!B", self.type))
3412 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3413 packed.append(struct.pack("!L", self.xid))
3414 packed.append(struct.pack("!H", self.stats_type))
3415 packed.append(struct.pack("!H", self.flags))
3416 packed.append('\x00' * 4)
3417 packed.append(struct.pack("!L", self.experimenter))
3418 packed.append(struct.pack("!L", self.subtype))
3419 packed.append(loxi.generic_util.pack_list(self.entries))
3420 length = sum([len(x) for x in packed])
3421 packed[2] = struct.pack("!H", length)
3422 return ''.join(packed)
3423
3424 @staticmethod
3425 def unpack(reader):
3426 obj = bsn_generic_stats_reply()
3427 _version = reader.read("!B")[0]
3428 assert(_version == 4)
3429 _type = reader.read("!B")[0]
3430 assert(_type == 19)
3431 _length = reader.read("!H")[0]
3432 orig_reader = reader
3433 reader = orig_reader.slice(_length, 4)
3434 obj.xid = reader.read("!L")[0]
3435 _stats_type = reader.read("!H")[0]
3436 assert(_stats_type == 65535)
3437 obj.flags = reader.read("!H")[0]
3438 reader.skip(4)
3439 _experimenter = reader.read("!L")[0]
3440 assert(_experimenter == 6035143)
3441 _subtype = reader.read("!L")[0]
3442 assert(_subtype == 16)
Rich Lanee2567702015-01-26 15:04:35 -08003443 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_generic_stats_entry.unpack)
Rich Lanecb18dbd2014-12-18 10:02:29 -08003444 return obj
3445
3446 def __eq__(self, other):
3447 if type(self) != type(other): return False
3448 if self.xid != other.xid: return False
3449 if self.flags != other.flags: return False
3450 if self.entries != other.entries: return False
3451 return True
3452
3453 def pretty_print(self, q):
3454 q.text("bsn_generic_stats_reply {")
3455 with q.group():
3456 with q.indent(2):
3457 q.breakable()
3458 q.text("xid = ");
3459 if self.xid != None:
3460 q.text("%#x" % self.xid)
3461 else:
3462 q.text('None')
3463 q.text(","); q.breakable()
3464 q.text("flags = ");
3465 q.text("%#x" % self.flags)
3466 q.text(","); q.breakable()
3467 q.text("entries = ");
3468 q.pp(self.entries)
3469 q.breakable()
3470 q.text('}')
3471
3472bsn_stats_reply.subtypes[16] = bsn_generic_stats_reply
3473
3474class bsn_generic_stats_request(bsn_stats_request):
3475 version = 4
3476 type = 18
3477 stats_type = 65535
3478 experimenter = 6035143
3479 subtype = 16
3480
3481 def __init__(self, xid=None, flags=None, name=None, tlvs=None):
3482 if xid != None:
3483 self.xid = xid
3484 else:
3485 self.xid = None
3486 if flags != None:
3487 self.flags = flags
3488 else:
3489 self.flags = 0
3490 if name != None:
3491 self.name = name
3492 else:
3493 self.name = ""
3494 if tlvs != None:
3495 self.tlvs = tlvs
3496 else:
3497 self.tlvs = []
3498 return
3499
3500 def pack(self):
3501 packed = []
3502 packed.append(struct.pack("!B", self.version))
3503 packed.append(struct.pack("!B", self.type))
3504 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3505 packed.append(struct.pack("!L", self.xid))
3506 packed.append(struct.pack("!H", self.stats_type))
3507 packed.append(struct.pack("!H", self.flags))
3508 packed.append('\x00' * 4)
3509 packed.append(struct.pack("!L", self.experimenter))
3510 packed.append(struct.pack("!L", self.subtype))
3511 packed.append(struct.pack("!64s", self.name))
3512 packed.append(loxi.generic_util.pack_list(self.tlvs))
3513 length = sum([len(x) for x in packed])
3514 packed[2] = struct.pack("!H", length)
3515 return ''.join(packed)
3516
3517 @staticmethod
3518 def unpack(reader):
3519 obj = bsn_generic_stats_request()
3520 _version = reader.read("!B")[0]
3521 assert(_version == 4)
3522 _type = reader.read("!B")[0]
3523 assert(_type == 18)
3524 _length = reader.read("!H")[0]
3525 orig_reader = reader
3526 reader = orig_reader.slice(_length, 4)
3527 obj.xid = reader.read("!L")[0]
3528 _stats_type = reader.read("!H")[0]
3529 assert(_stats_type == 65535)
3530 obj.flags = reader.read("!H")[0]
3531 reader.skip(4)
3532 _experimenter = reader.read("!L")[0]
3533 assert(_experimenter == 6035143)
3534 _subtype = reader.read("!L")[0]
3535 assert(_subtype == 16)
3536 obj.name = reader.read("!64s")[0].rstrip("\x00")
Rich Lanee2567702015-01-26 15:04:35 -08003537 obj.tlvs = loxi.generic_util.unpack_list(reader, ofp.bsn_tlv.bsn_tlv.unpack)
Rich Lanecb18dbd2014-12-18 10:02:29 -08003538 return obj
3539
3540 def __eq__(self, other):
3541 if type(self) != type(other): return False
3542 if self.xid != other.xid: return False
3543 if self.flags != other.flags: return False
3544 if self.name != other.name: return False
3545 if self.tlvs != other.tlvs: return False
3546 return True
3547
3548 def pretty_print(self, q):
3549 q.text("bsn_generic_stats_request {")
3550 with q.group():
3551 with q.indent(2):
3552 q.breakable()
3553 q.text("xid = ");
3554 if self.xid != None:
3555 q.text("%#x" % self.xid)
3556 else:
3557 q.text('None')
3558 q.text(","); q.breakable()
3559 q.text("flags = ");
3560 q.text("%#x" % self.flags)
3561 q.text(","); q.breakable()
3562 q.text("name = ");
3563 q.pp(self.name)
3564 q.text(","); q.breakable()
3565 q.text("tlvs = ");
3566 q.pp(self.tlvs)
3567 q.breakable()
3568 q.text('}')
3569
3570bsn_stats_request.subtypes[16] = bsn_generic_stats_request
3571
Rich Lane5454b682014-01-14 17:07:36 -08003572class bsn_gentable_bucket_stats_reply(bsn_stats_reply):
3573 version = 4
3574 type = 19
3575 stats_type = 65535
3576 experimenter = 6035143
3577 subtype = 5
3578
3579 def __init__(self, xid=None, flags=None, entries=None):
3580 if xid != None:
3581 self.xid = xid
3582 else:
3583 self.xid = None
3584 if flags != None:
3585 self.flags = flags
3586 else:
3587 self.flags = 0
3588 if entries != None:
3589 self.entries = entries
3590 else:
3591 self.entries = []
3592 return
3593
3594 def pack(self):
3595 packed = []
3596 packed.append(struct.pack("!B", self.version))
3597 packed.append(struct.pack("!B", self.type))
3598 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3599 packed.append(struct.pack("!L", self.xid))
3600 packed.append(struct.pack("!H", self.stats_type))
3601 packed.append(struct.pack("!H", self.flags))
3602 packed.append('\x00' * 4)
3603 packed.append(struct.pack("!L", self.experimenter))
3604 packed.append(struct.pack("!L", self.subtype))
3605 packed.append(loxi.generic_util.pack_list(self.entries))
3606 length = sum([len(x) for x in packed])
3607 packed[2] = struct.pack("!H", length)
3608 return ''.join(packed)
3609
3610 @staticmethod
3611 def unpack(reader):
3612 obj = bsn_gentable_bucket_stats_reply()
3613 _version = reader.read("!B")[0]
3614 assert(_version == 4)
3615 _type = reader.read("!B")[0]
3616 assert(_type == 19)
3617 _length = reader.read("!H")[0]
3618 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003619 reader = orig_reader.slice(_length, 4)
Rich Lane5454b682014-01-14 17:07:36 -08003620 obj.xid = reader.read("!L")[0]
3621 _stats_type = reader.read("!H")[0]
3622 assert(_stats_type == 65535)
3623 obj.flags = reader.read("!H")[0]
3624 reader.skip(4)
3625 _experimenter = reader.read("!L")[0]
3626 assert(_experimenter == 6035143)
3627 _subtype = reader.read("!L")[0]
3628 assert(_subtype == 5)
Rich Lanee2567702015-01-26 15:04:35 -08003629 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_gentable_bucket_stats_entry.unpack)
Rich Lane5454b682014-01-14 17:07:36 -08003630 return obj
3631
3632 def __eq__(self, other):
3633 if type(self) != type(other): return False
3634 if self.xid != other.xid: return False
3635 if self.flags != other.flags: return False
3636 if self.entries != other.entries: return False
3637 return True
3638
3639 def pretty_print(self, q):
3640 q.text("bsn_gentable_bucket_stats_reply {")
3641 with q.group():
3642 with q.indent(2):
3643 q.breakable()
3644 q.text("xid = ");
3645 if self.xid != None:
3646 q.text("%#x" % self.xid)
3647 else:
3648 q.text('None')
3649 q.text(","); q.breakable()
3650 q.text("flags = ");
3651 q.text("%#x" % self.flags)
3652 q.text(","); q.breakable()
3653 q.text("entries = ");
3654 q.pp(self.entries)
3655 q.breakable()
3656 q.text('}')
3657
3658bsn_stats_reply.subtypes[5] = bsn_gentable_bucket_stats_reply
3659
Rich Lane5454b682014-01-14 17:07:36 -08003660class bsn_gentable_bucket_stats_request(bsn_stats_request):
3661 version = 4
3662 type = 18
3663 stats_type = 65535
3664 experimenter = 6035143
3665 subtype = 5
3666
3667 def __init__(self, xid=None, flags=None, table_id=None):
3668 if xid != None:
3669 self.xid = xid
3670 else:
3671 self.xid = None
3672 if flags != None:
3673 self.flags = flags
3674 else:
3675 self.flags = 0
3676 if table_id != None:
3677 self.table_id = table_id
3678 else:
3679 self.table_id = 0
3680 return
3681
3682 def pack(self):
3683 packed = []
3684 packed.append(struct.pack("!B", self.version))
3685 packed.append(struct.pack("!B", self.type))
3686 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3687 packed.append(struct.pack("!L", self.xid))
3688 packed.append(struct.pack("!H", self.stats_type))
3689 packed.append(struct.pack("!H", self.flags))
3690 packed.append('\x00' * 4)
3691 packed.append(struct.pack("!L", self.experimenter))
3692 packed.append(struct.pack("!L", self.subtype))
3693 packed.append(struct.pack("!H", self.table_id))
3694 length = sum([len(x) for x in packed])
3695 packed[2] = struct.pack("!H", length)
3696 return ''.join(packed)
3697
3698 @staticmethod
3699 def unpack(reader):
3700 obj = bsn_gentable_bucket_stats_request()
3701 _version = reader.read("!B")[0]
3702 assert(_version == 4)
3703 _type = reader.read("!B")[0]
3704 assert(_type == 18)
3705 _length = reader.read("!H")[0]
3706 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003707 reader = orig_reader.slice(_length, 4)
Rich Lane5454b682014-01-14 17:07:36 -08003708 obj.xid = reader.read("!L")[0]
3709 _stats_type = reader.read("!H")[0]
3710 assert(_stats_type == 65535)
3711 obj.flags = reader.read("!H")[0]
3712 reader.skip(4)
3713 _experimenter = reader.read("!L")[0]
3714 assert(_experimenter == 6035143)
3715 _subtype = reader.read("!L")[0]
3716 assert(_subtype == 5)
3717 obj.table_id = reader.read("!H")[0]
3718 return obj
3719
3720 def __eq__(self, other):
3721 if type(self) != type(other): return False
3722 if self.xid != other.xid: return False
3723 if self.flags != other.flags: return False
3724 if self.table_id != other.table_id: return False
3725 return True
3726
3727 def pretty_print(self, q):
3728 q.text("bsn_gentable_bucket_stats_request {")
3729 with q.group():
3730 with q.indent(2):
3731 q.breakable()
3732 q.text("xid = ");
3733 if self.xid != None:
3734 q.text("%#x" % self.xid)
3735 else:
3736 q.text('None')
3737 q.text(","); q.breakable()
3738 q.text("flags = ");
3739 q.text("%#x" % self.flags)
3740 q.text(","); q.breakable()
3741 q.text("table_id = ");
3742 q.text("%#x" % self.table_id)
3743 q.breakable()
3744 q.text('}')
3745
3746bsn_stats_request.subtypes[5] = bsn_gentable_bucket_stats_request
3747
3748class bsn_gentable_clear_reply(bsn_header):
3749 version = 4
3750 type = 4
3751 experimenter = 6035143
3752 subtype = 49
3753
3754 def __init__(self, xid=None, table_id=None, deleted_count=None, error_count=None):
3755 if xid != None:
3756 self.xid = xid
3757 else:
3758 self.xid = None
3759 if table_id != None:
3760 self.table_id = table_id
3761 else:
3762 self.table_id = 0
3763 if deleted_count != None:
3764 self.deleted_count = deleted_count
3765 else:
3766 self.deleted_count = 0
3767 if error_count != None:
3768 self.error_count = error_count
3769 else:
3770 self.error_count = 0
3771 return
3772
3773 def pack(self):
3774 packed = []
3775 packed.append(struct.pack("!B", self.version))
3776 packed.append(struct.pack("!B", self.type))
3777 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3778 packed.append(struct.pack("!L", self.xid))
3779 packed.append(struct.pack("!L", self.experimenter))
3780 packed.append(struct.pack("!L", self.subtype))
3781 packed.append(struct.pack("!H", self.table_id))
3782 packed.append('\x00' * 2)
3783 packed.append(struct.pack("!L", self.deleted_count))
3784 packed.append(struct.pack("!L", self.error_count))
3785 length = sum([len(x) for x in packed])
3786 packed[2] = struct.pack("!H", length)
3787 return ''.join(packed)
3788
3789 @staticmethod
3790 def unpack(reader):
3791 obj = bsn_gentable_clear_reply()
3792 _version = reader.read("!B")[0]
3793 assert(_version == 4)
3794 _type = reader.read("!B")[0]
3795 assert(_type == 4)
3796 _length = reader.read("!H")[0]
3797 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003798 reader = orig_reader.slice(_length, 4)
Rich Lane5454b682014-01-14 17:07:36 -08003799 obj.xid = reader.read("!L")[0]
3800 _experimenter = reader.read("!L")[0]
3801 assert(_experimenter == 6035143)
3802 _subtype = reader.read("!L")[0]
3803 assert(_subtype == 49)
3804 obj.table_id = reader.read("!H")[0]
3805 reader.skip(2)
3806 obj.deleted_count = reader.read("!L")[0]
3807 obj.error_count = reader.read("!L")[0]
3808 return obj
3809
3810 def __eq__(self, other):
3811 if type(self) != type(other): return False
3812 if self.xid != other.xid: return False
3813 if self.table_id != other.table_id: return False
3814 if self.deleted_count != other.deleted_count: return False
3815 if self.error_count != other.error_count: return False
3816 return True
3817
3818 def pretty_print(self, q):
3819 q.text("bsn_gentable_clear_reply {")
3820 with q.group():
3821 with q.indent(2):
3822 q.breakable()
3823 q.text("xid = ");
3824 if self.xid != None:
3825 q.text("%#x" % self.xid)
3826 else:
3827 q.text('None')
3828 q.text(","); q.breakable()
3829 q.text("table_id = ");
3830 q.text("%#x" % self.table_id)
3831 q.text(","); q.breakable()
3832 q.text("deleted_count = ");
3833 q.text("%#x" % self.deleted_count)
3834 q.text(","); q.breakable()
3835 q.text("error_count = ");
3836 q.text("%#x" % self.error_count)
3837 q.breakable()
3838 q.text('}')
3839
3840bsn_header.subtypes[49] = bsn_gentable_clear_reply
3841
3842class bsn_gentable_clear_request(bsn_header):
3843 version = 4
3844 type = 4
3845 experimenter = 6035143
3846 subtype = 48
3847
3848 def __init__(self, xid=None, table_id=None, checksum=None, checksum_mask=None):
3849 if xid != None:
3850 self.xid = xid
3851 else:
3852 self.xid = None
3853 if table_id != None:
3854 self.table_id = table_id
3855 else:
3856 self.table_id = 0
3857 if checksum != None:
3858 self.checksum = checksum
3859 else:
3860 self.checksum = 0
3861 if checksum_mask != None:
3862 self.checksum_mask = checksum_mask
3863 else:
3864 self.checksum_mask = 0
3865 return
3866
3867 def pack(self):
3868 packed = []
3869 packed.append(struct.pack("!B", self.version))
3870 packed.append(struct.pack("!B", self.type))
3871 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3872 packed.append(struct.pack("!L", self.xid))
3873 packed.append(struct.pack("!L", self.experimenter))
3874 packed.append(struct.pack("!L", self.subtype))
3875 packed.append(struct.pack("!H", self.table_id))
3876 packed.append('\x00' * 2)
3877 packed.append(util.pack_checksum_128(self.checksum))
3878 packed.append(util.pack_checksum_128(self.checksum_mask))
3879 length = sum([len(x) for x in packed])
3880 packed[2] = struct.pack("!H", length)
3881 return ''.join(packed)
3882
3883 @staticmethod
3884 def unpack(reader):
3885 obj = bsn_gentable_clear_request()
3886 _version = reader.read("!B")[0]
3887 assert(_version == 4)
3888 _type = reader.read("!B")[0]
3889 assert(_type == 4)
3890 _length = reader.read("!H")[0]
3891 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003892 reader = orig_reader.slice(_length, 4)
Rich Lane5454b682014-01-14 17:07:36 -08003893 obj.xid = reader.read("!L")[0]
3894 _experimenter = reader.read("!L")[0]
3895 assert(_experimenter == 6035143)
3896 _subtype = reader.read("!L")[0]
3897 assert(_subtype == 48)
3898 obj.table_id = reader.read("!H")[0]
3899 reader.skip(2)
3900 obj.checksum = util.unpack_checksum_128(reader)
3901 obj.checksum_mask = util.unpack_checksum_128(reader)
3902 return obj
3903
3904 def __eq__(self, other):
3905 if type(self) != type(other): return False
3906 if self.xid != other.xid: return False
3907 if self.table_id != other.table_id: return False
3908 if self.checksum != other.checksum: return False
3909 if self.checksum_mask != other.checksum_mask: return False
3910 return True
3911
3912 def pretty_print(self, q):
3913 q.text("bsn_gentable_clear_request {")
3914 with q.group():
3915 with q.indent(2):
3916 q.breakable()
3917 q.text("xid = ");
3918 if self.xid != None:
3919 q.text("%#x" % self.xid)
3920 else:
3921 q.text('None')
3922 q.text(","); q.breakable()
3923 q.text("table_id = ");
3924 q.text("%#x" % self.table_id)
3925 q.text(","); q.breakable()
3926 q.text("checksum = ");
3927 q.pp(self.checksum)
3928 q.text(","); q.breakable()
3929 q.text("checksum_mask = ");
3930 q.pp(self.checksum_mask)
3931 q.breakable()
3932 q.text('}')
3933
3934bsn_header.subtypes[48] = bsn_gentable_clear_request
3935
3936class bsn_gentable_desc_stats_reply(bsn_stats_reply):
3937 version = 4
3938 type = 19
3939 stats_type = 65535
3940 experimenter = 6035143
3941 subtype = 4
3942
3943 def __init__(self, xid=None, flags=None, entries=None):
3944 if xid != None:
3945 self.xid = xid
3946 else:
3947 self.xid = None
3948 if flags != None:
3949 self.flags = flags
3950 else:
3951 self.flags = 0
3952 if entries != None:
3953 self.entries = entries
3954 else:
3955 self.entries = []
3956 return
3957
3958 def pack(self):
3959 packed = []
3960 packed.append(struct.pack("!B", self.version))
3961 packed.append(struct.pack("!B", self.type))
3962 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3963 packed.append(struct.pack("!L", self.xid))
3964 packed.append(struct.pack("!H", self.stats_type))
3965 packed.append(struct.pack("!H", self.flags))
3966 packed.append('\x00' * 4)
3967 packed.append(struct.pack("!L", self.experimenter))
3968 packed.append(struct.pack("!L", self.subtype))
3969 packed.append(loxi.generic_util.pack_list(self.entries))
3970 length = sum([len(x) for x in packed])
3971 packed[2] = struct.pack("!H", length)
3972 return ''.join(packed)
3973
3974 @staticmethod
3975 def unpack(reader):
3976 obj = bsn_gentable_desc_stats_reply()
3977 _version = reader.read("!B")[0]
3978 assert(_version == 4)
3979 _type = reader.read("!B")[0]
3980 assert(_type == 19)
3981 _length = reader.read("!H")[0]
3982 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003983 reader = orig_reader.slice(_length, 4)
Rich Lane5454b682014-01-14 17:07:36 -08003984 obj.xid = reader.read("!L")[0]
3985 _stats_type = reader.read("!H")[0]
3986 assert(_stats_type == 65535)
3987 obj.flags = reader.read("!H")[0]
3988 reader.skip(4)
3989 _experimenter = reader.read("!L")[0]
3990 assert(_experimenter == 6035143)
3991 _subtype = reader.read("!L")[0]
3992 assert(_subtype == 4)
Rich Lanee2567702015-01-26 15:04:35 -08003993 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_gentable_desc_stats_entry.unpack)
Rich Lane5454b682014-01-14 17:07:36 -08003994 return obj
3995
3996 def __eq__(self, other):
3997 if type(self) != type(other): return False
3998 if self.xid != other.xid: return False
3999 if self.flags != other.flags: return False
4000 if self.entries != other.entries: return False
4001 return True
4002
4003 def pretty_print(self, q):
4004 q.text("bsn_gentable_desc_stats_reply {")
4005 with q.group():
4006 with q.indent(2):
4007 q.breakable()
4008 q.text("xid = ");
4009 if self.xid != None:
4010 q.text("%#x" % self.xid)
4011 else:
4012 q.text('None')
4013 q.text(","); q.breakable()
4014 q.text("flags = ");
4015 q.text("%#x" % self.flags)
4016 q.text(","); q.breakable()
4017 q.text("entries = ");
4018 q.pp(self.entries)
4019 q.breakable()
4020 q.text('}')
4021
4022bsn_stats_reply.subtypes[4] = bsn_gentable_desc_stats_reply
4023
4024class bsn_gentable_desc_stats_request(bsn_stats_request):
4025 version = 4
4026 type = 18
4027 stats_type = 65535
4028 experimenter = 6035143
4029 subtype = 4
4030
4031 def __init__(self, xid=None, flags=None):
4032 if xid != None:
4033 self.xid = xid
4034 else:
4035 self.xid = None
4036 if flags != None:
4037 self.flags = flags
4038 else:
4039 self.flags = 0
4040 return
4041
4042 def pack(self):
4043 packed = []
4044 packed.append(struct.pack("!B", self.version))
4045 packed.append(struct.pack("!B", self.type))
4046 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4047 packed.append(struct.pack("!L", self.xid))
4048 packed.append(struct.pack("!H", self.stats_type))
4049 packed.append(struct.pack("!H", self.flags))
4050 packed.append('\x00' * 4)
4051 packed.append(struct.pack("!L", self.experimenter))
4052 packed.append(struct.pack("!L", self.subtype))
4053 length = sum([len(x) for x in packed])
4054 packed[2] = struct.pack("!H", length)
4055 return ''.join(packed)
4056
4057 @staticmethod
4058 def unpack(reader):
4059 obj = bsn_gentable_desc_stats_request()
4060 _version = reader.read("!B")[0]
4061 assert(_version == 4)
4062 _type = reader.read("!B")[0]
4063 assert(_type == 18)
4064 _length = reader.read("!H")[0]
4065 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08004066 reader = orig_reader.slice(_length, 4)
Rich Lane5454b682014-01-14 17:07:36 -08004067 obj.xid = reader.read("!L")[0]
4068 _stats_type = reader.read("!H")[0]
4069 assert(_stats_type == 65535)
4070 obj.flags = reader.read("!H")[0]
4071 reader.skip(4)
4072 _experimenter = reader.read("!L")[0]
4073 assert(_experimenter == 6035143)
4074 _subtype = reader.read("!L")[0]
4075 assert(_subtype == 4)
4076 return obj
4077
4078 def __eq__(self, other):
4079 if type(self) != type(other): return False
4080 if self.xid != other.xid: return False
4081 if self.flags != other.flags: return False
4082 return True
4083
4084 def pretty_print(self, q):
4085 q.text("bsn_gentable_desc_stats_request {")
4086 with q.group():
4087 with q.indent(2):
4088 q.breakable()
4089 q.text("xid = ");
4090 if self.xid != None:
4091 q.text("%#x" % self.xid)
4092 else:
4093 q.text('None')
4094 q.text(","); q.breakable()
4095 q.text("flags = ");
4096 q.text("%#x" % self.flags)
4097 q.breakable()
4098 q.text('}')
4099
4100bsn_stats_request.subtypes[4] = bsn_gentable_desc_stats_request
4101
4102class bsn_gentable_entry_add(bsn_header):
4103 version = 4
4104 type = 4
4105 experimenter = 6035143
4106 subtype = 46
4107
4108 def __init__(self, xid=None, table_id=None, checksum=None, key=None, value=None):
4109 if xid != None:
4110 self.xid = xid
4111 else:
4112 self.xid = None
4113 if table_id != None:
4114 self.table_id = table_id
4115 else:
4116 self.table_id = 0
4117 if checksum != None:
4118 self.checksum = checksum
4119 else:
4120 self.checksum = 0
4121 if key != None:
4122 self.key = key
4123 else:
4124 self.key = []
4125 if value != None:
4126 self.value = value
4127 else:
4128 self.value = []
4129 return
4130
4131 def pack(self):
4132 packed = []
4133 packed.append(struct.pack("!B", self.version))
4134 packed.append(struct.pack("!B", self.type))
4135 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4136 packed.append(struct.pack("!L", self.xid))
4137 packed.append(struct.pack("!L", self.experimenter))
4138 packed.append(struct.pack("!L", self.subtype))
4139 packed.append(struct.pack("!H", self.table_id))
4140 packed.append(struct.pack("!H", 0)) # placeholder for key_length at index 7
4141 packed.append(util.pack_checksum_128(self.checksum))
4142 packed.append(loxi.generic_util.pack_list(self.key))
4143 packed[7] = struct.pack("!H", len(packed[-1]))
4144 packed.append(loxi.generic_util.pack_list(self.value))
4145 length = sum([len(x) for x in packed])
4146 packed[2] = struct.pack("!H", length)
4147 return ''.join(packed)
4148
4149 @staticmethod
4150 def unpack(reader):
4151 obj = bsn_gentable_entry_add()
4152 _version = reader.read("!B")[0]
4153 assert(_version == 4)
4154 _type = reader.read("!B")[0]
4155 assert(_type == 4)
4156 _length = reader.read("!H")[0]
4157 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08004158 reader = orig_reader.slice(_length, 4)
Rich Lane5454b682014-01-14 17:07:36 -08004159 obj.xid = reader.read("!L")[0]
4160 _experimenter = reader.read("!L")[0]
4161 assert(_experimenter == 6035143)
4162 _subtype = reader.read("!L")[0]
4163 assert(_subtype == 46)
4164 obj.table_id = reader.read("!H")[0]
4165 _key_length = reader.read("!H")[0]
4166 obj.checksum = util.unpack_checksum_128(reader)
Rich Lanee2567702015-01-26 15:04:35 -08004167 obj.key = loxi.generic_util.unpack_list(reader.slice(_key_length), ofp.bsn_tlv.bsn_tlv.unpack)
4168 obj.value = loxi.generic_util.unpack_list(reader, ofp.bsn_tlv.bsn_tlv.unpack)
Rich Lane5454b682014-01-14 17:07:36 -08004169 return obj
4170
4171 def __eq__(self, other):
4172 if type(self) != type(other): return False
4173 if self.xid != other.xid: return False
4174 if self.table_id != other.table_id: return False
4175 if self.checksum != other.checksum: return False
4176 if self.key != other.key: return False
4177 if self.value != other.value: return False
4178 return True
4179
4180 def pretty_print(self, q):
4181 q.text("bsn_gentable_entry_add {")
4182 with q.group():
4183 with q.indent(2):
4184 q.breakable()
4185 q.text("xid = ");
4186 if self.xid != None:
4187 q.text("%#x" % self.xid)
4188 else:
4189 q.text('None')
4190 q.text(","); q.breakable()
4191 q.text("table_id = ");
4192 q.text("%#x" % self.table_id)
4193 q.text(","); q.breakable()
4194 q.text("checksum = ");
4195 q.pp(self.checksum)
4196 q.text(","); q.breakable()
4197 q.text("key = ");
4198 q.pp(self.key)
4199 q.text(","); q.breakable()
4200 q.text("value = ");
4201 q.pp(self.value)
4202 q.breakable()
4203 q.text('}')
4204
4205bsn_header.subtypes[46] = bsn_gentable_entry_add
4206
4207class bsn_gentable_entry_delete(bsn_header):
4208 version = 4
4209 type = 4
4210 experimenter = 6035143
4211 subtype = 47
4212
4213 def __init__(self, xid=None, table_id=None, key=None):
4214 if xid != None:
4215 self.xid = xid
4216 else:
4217 self.xid = None
4218 if table_id != None:
4219 self.table_id = table_id
4220 else:
4221 self.table_id = 0
4222 if key != None:
4223 self.key = key
4224 else:
4225 self.key = []
4226 return
4227
4228 def pack(self):
4229 packed = []
4230 packed.append(struct.pack("!B", self.version))
4231 packed.append(struct.pack("!B", self.type))
4232 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4233 packed.append(struct.pack("!L", self.xid))
4234 packed.append(struct.pack("!L", self.experimenter))
4235 packed.append(struct.pack("!L", self.subtype))
4236 packed.append(struct.pack("!H", self.table_id))
4237 packed.append(loxi.generic_util.pack_list(self.key))
4238 length = sum([len(x) for x in packed])
4239 packed[2] = struct.pack("!H", length)
4240 return ''.join(packed)
4241
4242 @staticmethod
4243 def unpack(reader):
4244 obj = bsn_gentable_entry_delete()
4245 _version = reader.read("!B")[0]
4246 assert(_version == 4)
4247 _type = reader.read("!B")[0]
4248 assert(_type == 4)
4249 _length = reader.read("!H")[0]
4250 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08004251 reader = orig_reader.slice(_length, 4)
Rich Lane5454b682014-01-14 17:07:36 -08004252 obj.xid = reader.read("!L")[0]
4253 _experimenter = reader.read("!L")[0]
4254 assert(_experimenter == 6035143)
4255 _subtype = reader.read("!L")[0]
4256 assert(_subtype == 47)
4257 obj.table_id = reader.read("!H")[0]
Rich Lanee2567702015-01-26 15:04:35 -08004258 obj.key = loxi.generic_util.unpack_list(reader, ofp.bsn_tlv.bsn_tlv.unpack)
Rich Lane5454b682014-01-14 17:07:36 -08004259 return obj
4260
4261 def __eq__(self, other):
4262 if type(self) != type(other): return False
4263 if self.xid != other.xid: return False
4264 if self.table_id != other.table_id: return False
4265 if self.key != other.key: return False
4266 return True
4267
4268 def pretty_print(self, q):
4269 q.text("bsn_gentable_entry_delete {")
4270 with q.group():
4271 with q.indent(2):
4272 q.breakable()
4273 q.text("xid = ");
4274 if self.xid != None:
4275 q.text("%#x" % self.xid)
4276 else:
4277 q.text('None')
4278 q.text(","); q.breakable()
4279 q.text("table_id = ");
4280 q.text("%#x" % self.table_id)
4281 q.text(","); q.breakable()
4282 q.text("key = ");
4283 q.pp(self.key)
4284 q.breakable()
4285 q.text('}')
4286
4287bsn_header.subtypes[47] = bsn_gentable_entry_delete
4288
4289class bsn_gentable_entry_desc_stats_reply(bsn_stats_reply):
4290 version = 4
4291 type = 19
4292 stats_type = 65535
4293 experimenter = 6035143
4294 subtype = 2
4295
4296 def __init__(self, xid=None, flags=None, entries=None):
4297 if xid != None:
4298 self.xid = xid
4299 else:
4300 self.xid = None
4301 if flags != None:
4302 self.flags = flags
4303 else:
4304 self.flags = 0
4305 if entries != None:
4306 self.entries = entries
4307 else:
4308 self.entries = []
4309 return
4310
4311 def pack(self):
4312 packed = []
4313 packed.append(struct.pack("!B", self.version))
4314 packed.append(struct.pack("!B", self.type))
4315 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4316 packed.append(struct.pack("!L", self.xid))
4317 packed.append(struct.pack("!H", self.stats_type))
4318 packed.append(struct.pack("!H", self.flags))
4319 packed.append('\x00' * 4)
4320 packed.append(struct.pack("!L", self.experimenter))
4321 packed.append(struct.pack("!L", self.subtype))
4322 packed.append(loxi.generic_util.pack_list(self.entries))
4323 length = sum([len(x) for x in packed])
4324 packed[2] = struct.pack("!H", length)
4325 return ''.join(packed)
4326
4327 @staticmethod
4328 def unpack(reader):
4329 obj = bsn_gentable_entry_desc_stats_reply()
4330 _version = reader.read("!B")[0]
4331 assert(_version == 4)
4332 _type = reader.read("!B")[0]
4333 assert(_type == 19)
4334 _length = reader.read("!H")[0]
4335 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08004336 reader = orig_reader.slice(_length, 4)
Rich Lane5454b682014-01-14 17:07:36 -08004337 obj.xid = reader.read("!L")[0]
4338 _stats_type = reader.read("!H")[0]
4339 assert(_stats_type == 65535)
4340 obj.flags = reader.read("!H")[0]
4341 reader.skip(4)
4342 _experimenter = reader.read("!L")[0]
4343 assert(_experimenter == 6035143)
4344 _subtype = reader.read("!L")[0]
4345 assert(_subtype == 2)
Rich Lanee2567702015-01-26 15:04:35 -08004346 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_gentable_entry_desc_stats_entry.unpack)
Rich Lane5454b682014-01-14 17:07:36 -08004347 return obj
4348
4349 def __eq__(self, other):
4350 if type(self) != type(other): return False
4351 if self.xid != other.xid: return False
4352 if self.flags != other.flags: return False
4353 if self.entries != other.entries: return False
4354 return True
4355
4356 def pretty_print(self, q):
4357 q.text("bsn_gentable_entry_desc_stats_reply {")
4358 with q.group():
4359 with q.indent(2):
4360 q.breakable()
4361 q.text("xid = ");
4362 if self.xid != None:
4363 q.text("%#x" % self.xid)
4364 else:
4365 q.text('None')
4366 q.text(","); q.breakable()
4367 q.text("flags = ");
4368 q.text("%#x" % self.flags)
4369 q.text(","); q.breakable()
4370 q.text("entries = ");
4371 q.pp(self.entries)
4372 q.breakable()
4373 q.text('}')
4374
4375bsn_stats_reply.subtypes[2] = bsn_gentable_entry_desc_stats_reply
4376
4377class bsn_gentable_entry_desc_stats_request(bsn_stats_request):
4378 version = 4
4379 type = 18
4380 stats_type = 65535
4381 experimenter = 6035143
4382 subtype = 2
4383
4384 def __init__(self, xid=None, flags=None, table_id=None, checksum=None, checksum_mask=None):
4385 if xid != None:
4386 self.xid = xid
4387 else:
4388 self.xid = None
4389 if flags != None:
4390 self.flags = flags
4391 else:
4392 self.flags = 0
4393 if table_id != None:
4394 self.table_id = table_id
4395 else:
4396 self.table_id = 0
4397 if checksum != None:
4398 self.checksum = checksum
4399 else:
4400 self.checksum = 0
4401 if checksum_mask != None:
4402 self.checksum_mask = checksum_mask
4403 else:
4404 self.checksum_mask = 0
4405 return
4406
4407 def pack(self):
4408 packed = []
4409 packed.append(struct.pack("!B", self.version))
4410 packed.append(struct.pack("!B", self.type))
4411 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4412 packed.append(struct.pack("!L", self.xid))
4413 packed.append(struct.pack("!H", self.stats_type))
4414 packed.append(struct.pack("!H", self.flags))
4415 packed.append('\x00' * 4)
4416 packed.append(struct.pack("!L", self.experimenter))
4417 packed.append(struct.pack("!L", self.subtype))
4418 packed.append(struct.pack("!H", self.table_id))
4419 packed.append('\x00' * 2)
4420 packed.append(util.pack_checksum_128(self.checksum))
4421 packed.append(util.pack_checksum_128(self.checksum_mask))
4422 length = sum([len(x) for x in packed])
4423 packed[2] = struct.pack("!H", length)
4424 return ''.join(packed)
4425
4426 @staticmethod
4427 def unpack(reader):
4428 obj = bsn_gentable_entry_desc_stats_request()
4429 _version = reader.read("!B")[0]
4430 assert(_version == 4)
4431 _type = reader.read("!B")[0]
4432 assert(_type == 18)
4433 _length = reader.read("!H")[0]
4434 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08004435 reader = orig_reader.slice(_length, 4)
Rich Lane5454b682014-01-14 17:07:36 -08004436 obj.xid = reader.read("!L")[0]
4437 _stats_type = reader.read("!H")[0]
4438 assert(_stats_type == 65535)
4439 obj.flags = reader.read("!H")[0]
4440 reader.skip(4)
4441 _experimenter = reader.read("!L")[0]
4442 assert(_experimenter == 6035143)
4443 _subtype = reader.read("!L")[0]
4444 assert(_subtype == 2)
4445 obj.table_id = reader.read("!H")[0]
4446 reader.skip(2)
4447 obj.checksum = util.unpack_checksum_128(reader)
4448 obj.checksum_mask = util.unpack_checksum_128(reader)
4449 return obj
4450
4451 def __eq__(self, other):
4452 if type(self) != type(other): return False
4453 if self.xid != other.xid: return False
4454 if self.flags != other.flags: return False
4455 if self.table_id != other.table_id: return False
4456 if self.checksum != other.checksum: return False
4457 if self.checksum_mask != other.checksum_mask: return False
4458 return True
4459
4460 def pretty_print(self, q):
4461 q.text("bsn_gentable_entry_desc_stats_request {")
4462 with q.group():
4463 with q.indent(2):
4464 q.breakable()
4465 q.text("xid = ");
4466 if self.xid != None:
4467 q.text("%#x" % self.xid)
4468 else:
4469 q.text('None')
4470 q.text(","); q.breakable()
4471 q.text("flags = ");
4472 q.text("%#x" % self.flags)
4473 q.text(","); q.breakable()
4474 q.text("table_id = ");
4475 q.text("%#x" % self.table_id)
4476 q.text(","); q.breakable()
4477 q.text("checksum = ");
4478 q.pp(self.checksum)
4479 q.text(","); q.breakable()
4480 q.text("checksum_mask = ");
4481 q.pp(self.checksum_mask)
4482 q.breakable()
4483 q.text('}')
4484
4485bsn_stats_request.subtypes[2] = bsn_gentable_entry_desc_stats_request
4486
4487class bsn_gentable_entry_stats_reply(bsn_stats_reply):
4488 version = 4
4489 type = 19
4490 stats_type = 65535
4491 experimenter = 6035143
4492 subtype = 3
4493
4494 def __init__(self, xid=None, flags=None, entries=None):
4495 if xid != None:
4496 self.xid = xid
4497 else:
4498 self.xid = None
4499 if flags != None:
4500 self.flags = flags
4501 else:
4502 self.flags = 0
4503 if entries != None:
4504 self.entries = entries
4505 else:
4506 self.entries = []
4507 return
4508
4509 def pack(self):
4510 packed = []
4511 packed.append(struct.pack("!B", self.version))
4512 packed.append(struct.pack("!B", self.type))
4513 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4514 packed.append(struct.pack("!L", self.xid))
4515 packed.append(struct.pack("!H", self.stats_type))
4516 packed.append(struct.pack("!H", self.flags))
4517 packed.append('\x00' * 4)
4518 packed.append(struct.pack("!L", self.experimenter))
4519 packed.append(struct.pack("!L", self.subtype))
4520 packed.append(loxi.generic_util.pack_list(self.entries))
4521 length = sum([len(x) for x in packed])
4522 packed[2] = struct.pack("!H", length)
4523 return ''.join(packed)
4524
4525 @staticmethod
4526 def unpack(reader):
4527 obj = bsn_gentable_entry_stats_reply()
4528 _version = reader.read("!B")[0]
4529 assert(_version == 4)
4530 _type = reader.read("!B")[0]
4531 assert(_type == 19)
4532 _length = reader.read("!H")[0]
4533 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08004534 reader = orig_reader.slice(_length, 4)
Rich Lane5454b682014-01-14 17:07:36 -08004535 obj.xid = reader.read("!L")[0]
4536 _stats_type = reader.read("!H")[0]
4537 assert(_stats_type == 65535)
4538 obj.flags = reader.read("!H")[0]
4539 reader.skip(4)
4540 _experimenter = reader.read("!L")[0]
4541 assert(_experimenter == 6035143)
4542 _subtype = reader.read("!L")[0]
4543 assert(_subtype == 3)
Rich Lanee2567702015-01-26 15:04:35 -08004544 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_gentable_entry_stats_entry.unpack)
Rich Lane5454b682014-01-14 17:07:36 -08004545 return obj
4546
4547 def __eq__(self, other):
4548 if type(self) != type(other): return False
4549 if self.xid != other.xid: return False
4550 if self.flags != other.flags: return False
4551 if self.entries != other.entries: return False
4552 return True
4553
4554 def pretty_print(self, q):
4555 q.text("bsn_gentable_entry_stats_reply {")
4556 with q.group():
4557 with q.indent(2):
4558 q.breakable()
4559 q.text("xid = ");
4560 if self.xid != None:
4561 q.text("%#x" % self.xid)
4562 else:
4563 q.text('None')
4564 q.text(","); q.breakable()
4565 q.text("flags = ");
4566 q.text("%#x" % self.flags)
4567 q.text(","); q.breakable()
4568 q.text("entries = ");
4569 q.pp(self.entries)
4570 q.breakable()
4571 q.text('}')
4572
4573bsn_stats_reply.subtypes[3] = bsn_gentable_entry_stats_reply
4574
4575class bsn_gentable_entry_stats_request(bsn_stats_request):
4576 version = 4
4577 type = 18
4578 stats_type = 65535
4579 experimenter = 6035143
4580 subtype = 3
4581
4582 def __init__(self, xid=None, flags=None, table_id=None, checksum=None, checksum_mask=None):
4583 if xid != None:
4584 self.xid = xid
4585 else:
4586 self.xid = None
4587 if flags != None:
4588 self.flags = flags
4589 else:
4590 self.flags = 0
4591 if table_id != None:
4592 self.table_id = table_id
4593 else:
4594 self.table_id = 0
4595 if checksum != None:
4596 self.checksum = checksum
4597 else:
4598 self.checksum = 0
4599 if checksum_mask != None:
4600 self.checksum_mask = checksum_mask
4601 else:
4602 self.checksum_mask = 0
4603 return
4604
4605 def pack(self):
4606 packed = []
4607 packed.append(struct.pack("!B", self.version))
4608 packed.append(struct.pack("!B", self.type))
4609 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4610 packed.append(struct.pack("!L", self.xid))
4611 packed.append(struct.pack("!H", self.stats_type))
4612 packed.append(struct.pack("!H", self.flags))
4613 packed.append('\x00' * 4)
4614 packed.append(struct.pack("!L", self.experimenter))
4615 packed.append(struct.pack("!L", self.subtype))
4616 packed.append(struct.pack("!H", self.table_id))
4617 packed.append('\x00' * 2)
4618 packed.append(util.pack_checksum_128(self.checksum))
4619 packed.append(util.pack_checksum_128(self.checksum_mask))
4620 length = sum([len(x) for x in packed])
4621 packed[2] = struct.pack("!H", length)
4622 return ''.join(packed)
4623
4624 @staticmethod
4625 def unpack(reader):
4626 obj = bsn_gentable_entry_stats_request()
4627 _version = reader.read("!B")[0]
4628 assert(_version == 4)
4629 _type = reader.read("!B")[0]
4630 assert(_type == 18)
4631 _length = reader.read("!H")[0]
4632 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08004633 reader = orig_reader.slice(_length, 4)
Rich Lane5454b682014-01-14 17:07:36 -08004634 obj.xid = reader.read("!L")[0]
4635 _stats_type = reader.read("!H")[0]
4636 assert(_stats_type == 65535)
4637 obj.flags = reader.read("!H")[0]
4638 reader.skip(4)
4639 _experimenter = reader.read("!L")[0]
4640 assert(_experimenter == 6035143)
4641 _subtype = reader.read("!L")[0]
4642 assert(_subtype == 3)
4643 obj.table_id = reader.read("!H")[0]
4644 reader.skip(2)
4645 obj.checksum = util.unpack_checksum_128(reader)
4646 obj.checksum_mask = util.unpack_checksum_128(reader)
4647 return obj
4648
4649 def __eq__(self, other):
4650 if type(self) != type(other): return False
4651 if self.xid != other.xid: return False
4652 if self.flags != other.flags: return False
4653 if self.table_id != other.table_id: return False
4654 if self.checksum != other.checksum: return False
4655 if self.checksum_mask != other.checksum_mask: return False
4656 return True
4657
4658 def pretty_print(self, q):
4659 q.text("bsn_gentable_entry_stats_request {")
4660 with q.group():
4661 with q.indent(2):
4662 q.breakable()
4663 q.text("xid = ");
4664 if self.xid != None:
4665 q.text("%#x" % self.xid)
4666 else:
4667 q.text('None')
4668 q.text(","); q.breakable()
4669 q.text("flags = ");
4670 q.text("%#x" % self.flags)
4671 q.text(","); q.breakable()
4672 q.text("table_id = ");
4673 q.text("%#x" % self.table_id)
4674 q.text(","); q.breakable()
4675 q.text("checksum = ");
4676 q.pp(self.checksum)
4677 q.text(","); q.breakable()
4678 q.text("checksum_mask = ");
4679 q.pp(self.checksum_mask)
4680 q.breakable()
4681 q.text('}')
4682
4683bsn_stats_request.subtypes[3] = bsn_gentable_entry_stats_request
4684
4685class bsn_gentable_set_buckets_size(bsn_header):
4686 version = 4
4687 type = 4
4688 experimenter = 6035143
4689 subtype = 50
4690
4691 def __init__(self, xid=None, table_id=None, buckets_size=None):
4692 if xid != None:
4693 self.xid = xid
4694 else:
4695 self.xid = None
4696 if table_id != None:
4697 self.table_id = table_id
4698 else:
4699 self.table_id = 0
4700 if buckets_size != None:
4701 self.buckets_size = buckets_size
4702 else:
4703 self.buckets_size = 0
4704 return
4705
4706 def pack(self):
4707 packed = []
4708 packed.append(struct.pack("!B", self.version))
4709 packed.append(struct.pack("!B", self.type))
4710 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4711 packed.append(struct.pack("!L", self.xid))
4712 packed.append(struct.pack("!L", self.experimenter))
4713 packed.append(struct.pack("!L", self.subtype))
4714 packed.append(struct.pack("!H", self.table_id))
4715 packed.append('\x00' * 2)
4716 packed.append(struct.pack("!L", self.buckets_size))
4717 length = sum([len(x) for x in packed])
4718 packed[2] = struct.pack("!H", length)
4719 return ''.join(packed)
4720
4721 @staticmethod
4722 def unpack(reader):
4723 obj = bsn_gentable_set_buckets_size()
4724 _version = reader.read("!B")[0]
4725 assert(_version == 4)
4726 _type = reader.read("!B")[0]
4727 assert(_type == 4)
4728 _length = reader.read("!H")[0]
4729 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08004730 reader = orig_reader.slice(_length, 4)
Rich Lane5454b682014-01-14 17:07:36 -08004731 obj.xid = reader.read("!L")[0]
4732 _experimenter = reader.read("!L")[0]
4733 assert(_experimenter == 6035143)
4734 _subtype = reader.read("!L")[0]
4735 assert(_subtype == 50)
4736 obj.table_id = reader.read("!H")[0]
4737 reader.skip(2)
4738 obj.buckets_size = reader.read("!L")[0]
4739 return obj
4740
4741 def __eq__(self, other):
4742 if type(self) != type(other): return False
4743 if self.xid != other.xid: return False
4744 if self.table_id != other.table_id: return False
4745 if self.buckets_size != other.buckets_size: return False
4746 return True
4747
4748 def pretty_print(self, q):
4749 q.text("bsn_gentable_set_buckets_size {")
4750 with q.group():
4751 with q.indent(2):
4752 q.breakable()
4753 q.text("xid = ");
4754 if self.xid != None:
4755 q.text("%#x" % self.xid)
4756 else:
4757 q.text('None')
4758 q.text(","); q.breakable()
4759 q.text("table_id = ");
4760 q.text("%#x" % self.table_id)
4761 q.text(","); q.breakable()
4762 q.text("buckets_size = ");
4763 q.text("%#x" % self.buckets_size)
4764 q.breakable()
4765 q.text('}')
4766
4767bsn_header.subtypes[50] = bsn_gentable_set_buckets_size
4768
4769class bsn_gentable_stats_reply(bsn_stats_reply):
4770 version = 4
4771 type = 19
4772 stats_type = 65535
4773 experimenter = 6035143
4774 subtype = 7
4775
4776 def __init__(self, xid=None, flags=None, entries=None):
4777 if xid != None:
4778 self.xid = xid
4779 else:
4780 self.xid = None
4781 if flags != None:
4782 self.flags = flags
4783 else:
4784 self.flags = 0
4785 if entries != None:
4786 self.entries = entries
4787 else:
4788 self.entries = []
4789 return
4790
4791 def pack(self):
4792 packed = []
4793 packed.append(struct.pack("!B", self.version))
4794 packed.append(struct.pack("!B", self.type))
4795 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4796 packed.append(struct.pack("!L", self.xid))
4797 packed.append(struct.pack("!H", self.stats_type))
4798 packed.append(struct.pack("!H", self.flags))
4799 packed.append('\x00' * 4)
4800 packed.append(struct.pack("!L", self.experimenter))
4801 packed.append(struct.pack("!L", self.subtype))
4802 packed.append(loxi.generic_util.pack_list(self.entries))
4803 length = sum([len(x) for x in packed])
4804 packed[2] = struct.pack("!H", length)
4805 return ''.join(packed)
4806
4807 @staticmethod
4808 def unpack(reader):
4809 obj = bsn_gentable_stats_reply()
4810 _version = reader.read("!B")[0]
4811 assert(_version == 4)
4812 _type = reader.read("!B")[0]
4813 assert(_type == 19)
4814 _length = reader.read("!H")[0]
4815 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08004816 reader = orig_reader.slice(_length, 4)
Rich Lane5454b682014-01-14 17:07:36 -08004817 obj.xid = reader.read("!L")[0]
4818 _stats_type = reader.read("!H")[0]
4819 assert(_stats_type == 65535)
4820 obj.flags = reader.read("!H")[0]
4821 reader.skip(4)
4822 _experimenter = reader.read("!L")[0]
4823 assert(_experimenter == 6035143)
4824 _subtype = reader.read("!L")[0]
4825 assert(_subtype == 7)
Rich Lanee2567702015-01-26 15:04:35 -08004826 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_gentable_stats_entry.unpack)
Rich Lane5454b682014-01-14 17:07:36 -08004827 return obj
4828
4829 def __eq__(self, other):
4830 if type(self) != type(other): return False
4831 if self.xid != other.xid: return False
4832 if self.flags != other.flags: return False
4833 if self.entries != other.entries: return False
4834 return True
4835
4836 def pretty_print(self, q):
4837 q.text("bsn_gentable_stats_reply {")
4838 with q.group():
4839 with q.indent(2):
4840 q.breakable()
4841 q.text("xid = ");
4842 if self.xid != None:
4843 q.text("%#x" % self.xid)
4844 else:
4845 q.text('None')
4846 q.text(","); q.breakable()
4847 q.text("flags = ");
4848 q.text("%#x" % self.flags)
4849 q.text(","); q.breakable()
4850 q.text("entries = ");
4851 q.pp(self.entries)
4852 q.breakable()
4853 q.text('}')
4854
4855bsn_stats_reply.subtypes[7] = bsn_gentable_stats_reply
4856
4857class bsn_gentable_stats_request(bsn_stats_request):
4858 version = 4
4859 type = 18
4860 stats_type = 65535
4861 experimenter = 6035143
4862 subtype = 7
4863
4864 def __init__(self, xid=None, flags=None):
4865 if xid != None:
4866 self.xid = xid
4867 else:
4868 self.xid = None
4869 if flags != None:
4870 self.flags = flags
4871 else:
4872 self.flags = 0
4873 return
4874
4875 def pack(self):
4876 packed = []
4877 packed.append(struct.pack("!B", self.version))
4878 packed.append(struct.pack("!B", self.type))
4879 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4880 packed.append(struct.pack("!L", self.xid))
4881 packed.append(struct.pack("!H", self.stats_type))
4882 packed.append(struct.pack("!H", self.flags))
4883 packed.append('\x00' * 4)
4884 packed.append(struct.pack("!L", self.experimenter))
4885 packed.append(struct.pack("!L", self.subtype))
4886 length = sum([len(x) for x in packed])
4887 packed[2] = struct.pack("!H", length)
4888 return ''.join(packed)
4889
4890 @staticmethod
4891 def unpack(reader):
4892 obj = bsn_gentable_stats_request()
4893 _version = reader.read("!B")[0]
4894 assert(_version == 4)
4895 _type = reader.read("!B")[0]
4896 assert(_type == 18)
4897 _length = reader.read("!H")[0]
4898 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08004899 reader = orig_reader.slice(_length, 4)
Rich Lane5454b682014-01-14 17:07:36 -08004900 obj.xid = reader.read("!L")[0]
4901 _stats_type = reader.read("!H")[0]
4902 assert(_stats_type == 65535)
4903 obj.flags = reader.read("!H")[0]
4904 reader.skip(4)
4905 _experimenter = reader.read("!L")[0]
4906 assert(_experimenter == 6035143)
4907 _subtype = reader.read("!L")[0]
4908 assert(_subtype == 7)
4909 return obj
4910
4911 def __eq__(self, other):
4912 if type(self) != type(other): return False
4913 if self.xid != other.xid: return False
4914 if self.flags != other.flags: return False
4915 return True
4916
4917 def pretty_print(self, q):
4918 q.text("bsn_gentable_stats_request {")
4919 with q.group():
4920 with q.indent(2):
4921 q.breakable()
4922 q.text("xid = ");
4923 if self.xid != None:
4924 q.text("%#x" % self.xid)
4925 else:
4926 q.text('None')
4927 q.text(","); q.breakable()
4928 q.text("flags = ");
4929 q.text("%#x" % self.flags)
4930 q.breakable()
4931 q.text('}')
4932
4933bsn_stats_request.subtypes[7] = bsn_gentable_stats_request
4934
Rich Lane7dcdf022013-12-11 14:45:27 -08004935class bsn_get_interfaces_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07004936 version = 4
4937 type = 4
4938 experimenter = 6035143
Rich Lanec2ee4b82013-04-24 17:12:38 -07004939 subtype = 10
4940
4941 def __init__(self, xid=None, interfaces=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08004942 if xid != None:
4943 self.xid = xid
4944 else:
4945 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07004946 if interfaces != None:
4947 self.interfaces = interfaces
4948 else:
4949 self.interfaces = []
Rich Lane7dcdf022013-12-11 14:45:27 -08004950 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07004951
4952 def pack(self):
4953 packed = []
4954 packed.append(struct.pack("!B", self.version))
4955 packed.append(struct.pack("!B", self.type))
4956 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4957 packed.append(struct.pack("!L", self.xid))
4958 packed.append(struct.pack("!L", self.experimenter))
4959 packed.append(struct.pack("!L", self.subtype))
Rich Lane7dcdf022013-12-11 14:45:27 -08004960 packed.append(loxi.generic_util.pack_list(self.interfaces))
Rich Lanec2ee4b82013-04-24 17:12:38 -07004961 length = sum([len(x) for x in packed])
4962 packed[2] = struct.pack("!H", length)
4963 return ''.join(packed)
4964
4965 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004966 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07004967 obj = bsn_get_interfaces_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07004968 _version = reader.read("!B")[0]
4969 assert(_version == 4)
4970 _type = reader.read("!B")[0]
4971 assert(_type == 4)
4972 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004973 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08004974 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07004975 obj.xid = reader.read("!L")[0]
4976 _experimenter = reader.read("!L")[0]
4977 assert(_experimenter == 6035143)
4978 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07004979 assert(_subtype == 10)
Rich Lanee2567702015-01-26 15:04:35 -08004980 obj.interfaces = loxi.generic_util.unpack_list(reader, ofp.common.bsn_interface.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -07004981 return obj
4982
4983 def __eq__(self, other):
4984 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07004985 if self.xid != other.xid: return False
4986 if self.interfaces != other.interfaces: return False
4987 return True
4988
Rich Lanec2ee4b82013-04-24 17:12:38 -07004989 def pretty_print(self, q):
4990 q.text("bsn_get_interfaces_reply {")
4991 with q.group():
4992 with q.indent(2):
4993 q.breakable()
4994 q.text("xid = ");
4995 if self.xid != None:
4996 q.text("%#x" % self.xid)
4997 else:
4998 q.text('None')
4999 q.text(","); q.breakable()
5000 q.text("interfaces = ");
5001 q.pp(self.interfaces)
5002 q.breakable()
5003 q.text('}')
5004
Rich Lane7dcdf022013-12-11 14:45:27 -08005005bsn_header.subtypes[10] = bsn_get_interfaces_reply
5006
5007class bsn_get_interfaces_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07005008 version = 4
5009 type = 4
5010 experimenter = 6035143
Rich Lanec2ee4b82013-04-24 17:12:38 -07005011 subtype = 9
5012
5013 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005014 if xid != None:
5015 self.xid = xid
5016 else:
5017 self.xid = None
5018 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07005019
5020 def pack(self):
5021 packed = []
5022 packed.append(struct.pack("!B", self.version))
5023 packed.append(struct.pack("!B", self.type))
5024 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5025 packed.append(struct.pack("!L", self.xid))
5026 packed.append(struct.pack("!L", self.experimenter))
5027 packed.append(struct.pack("!L", self.subtype))
5028 length = sum([len(x) for x in packed])
5029 packed[2] = struct.pack("!H", length)
5030 return ''.join(packed)
5031
5032 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005033 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07005034 obj = bsn_get_interfaces_request()
Dan Talaycof6202252013-07-02 01:00:29 -07005035 _version = reader.read("!B")[0]
5036 assert(_version == 4)
5037 _type = reader.read("!B")[0]
5038 assert(_type == 4)
5039 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005040 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08005041 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07005042 obj.xid = reader.read("!L")[0]
5043 _experimenter = reader.read("!L")[0]
5044 assert(_experimenter == 6035143)
5045 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07005046 assert(_subtype == 9)
5047 return obj
5048
5049 def __eq__(self, other):
5050 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07005051 if self.xid != other.xid: return False
5052 return True
5053
Rich Lanec2ee4b82013-04-24 17:12:38 -07005054 def pretty_print(self, q):
5055 q.text("bsn_get_interfaces_request {")
5056 with q.group():
5057 with q.indent(2):
5058 q.breakable()
5059 q.text("xid = ");
5060 if self.xid != None:
5061 q.text("%#x" % self.xid)
5062 else:
5063 q.text('None')
5064 q.breakable()
5065 q.text('}')
5066
Rich Lane7dcdf022013-12-11 14:45:27 -08005067bsn_header.subtypes[9] = bsn_get_interfaces_request
5068
5069class bsn_get_mirroring_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07005070 version = 4
5071 type = 4
5072 experimenter = 6035143
Rich Lanec2ee4b82013-04-24 17:12:38 -07005073 subtype = 5
5074
5075 def __init__(self, xid=None, report_mirror_ports=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005076 if xid != None:
5077 self.xid = xid
5078 else:
5079 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07005080 if report_mirror_ports != None:
5081 self.report_mirror_ports = report_mirror_ports
5082 else:
5083 self.report_mirror_ports = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08005084 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07005085
5086 def pack(self):
5087 packed = []
5088 packed.append(struct.pack("!B", self.version))
5089 packed.append(struct.pack("!B", self.type))
5090 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5091 packed.append(struct.pack("!L", self.xid))
5092 packed.append(struct.pack("!L", self.experimenter))
5093 packed.append(struct.pack("!L", self.subtype))
5094 packed.append(struct.pack("!B", self.report_mirror_ports))
5095 packed.append('\x00' * 3)
5096 length = sum([len(x) for x in packed])
5097 packed[2] = struct.pack("!H", length)
5098 return ''.join(packed)
5099
5100 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005101 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07005102 obj = bsn_get_mirroring_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07005103 _version = reader.read("!B")[0]
5104 assert(_version == 4)
5105 _type = reader.read("!B")[0]
5106 assert(_type == 4)
5107 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005108 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08005109 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07005110 obj.xid = reader.read("!L")[0]
5111 _experimenter = reader.read("!L")[0]
5112 assert(_experimenter == 6035143)
5113 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07005114 assert(_subtype == 5)
Dan Talaycof6202252013-07-02 01:00:29 -07005115 obj.report_mirror_ports = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07005116 reader.skip(3)
5117 return obj
5118
5119 def __eq__(self, other):
5120 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07005121 if self.xid != other.xid: return False
5122 if self.report_mirror_ports != other.report_mirror_ports: return False
5123 return True
5124
Rich Lanec2ee4b82013-04-24 17:12:38 -07005125 def pretty_print(self, q):
5126 q.text("bsn_get_mirroring_reply {")
5127 with q.group():
5128 with q.indent(2):
5129 q.breakable()
5130 q.text("xid = ");
5131 if self.xid != None:
5132 q.text("%#x" % self.xid)
5133 else:
5134 q.text('None')
5135 q.text(","); q.breakable()
5136 q.text("report_mirror_ports = ");
5137 q.text("%#x" % self.report_mirror_ports)
5138 q.breakable()
5139 q.text('}')
5140
Rich Lane7dcdf022013-12-11 14:45:27 -08005141bsn_header.subtypes[5] = bsn_get_mirroring_reply
5142
5143class bsn_get_mirroring_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07005144 version = 4
5145 type = 4
5146 experimenter = 6035143
Rich Lanec2ee4b82013-04-24 17:12:38 -07005147 subtype = 4
5148
5149 def __init__(self, xid=None, report_mirror_ports=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005150 if xid != None:
5151 self.xid = xid
5152 else:
5153 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07005154 if report_mirror_ports != None:
5155 self.report_mirror_ports = report_mirror_ports
5156 else:
5157 self.report_mirror_ports = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08005158 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07005159
5160 def pack(self):
5161 packed = []
5162 packed.append(struct.pack("!B", self.version))
5163 packed.append(struct.pack("!B", self.type))
5164 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5165 packed.append(struct.pack("!L", self.xid))
5166 packed.append(struct.pack("!L", self.experimenter))
5167 packed.append(struct.pack("!L", self.subtype))
5168 packed.append(struct.pack("!B", self.report_mirror_ports))
5169 packed.append('\x00' * 3)
5170 length = sum([len(x) for x in packed])
5171 packed[2] = struct.pack("!H", length)
5172 return ''.join(packed)
5173
5174 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005175 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07005176 obj = bsn_get_mirroring_request()
Dan Talaycof6202252013-07-02 01:00:29 -07005177 _version = reader.read("!B")[0]
5178 assert(_version == 4)
5179 _type = reader.read("!B")[0]
5180 assert(_type == 4)
5181 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005182 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08005183 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07005184 obj.xid = reader.read("!L")[0]
5185 _experimenter = reader.read("!L")[0]
5186 assert(_experimenter == 6035143)
5187 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07005188 assert(_subtype == 4)
Dan Talaycof6202252013-07-02 01:00:29 -07005189 obj.report_mirror_ports = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07005190 reader.skip(3)
5191 return obj
5192
5193 def __eq__(self, other):
5194 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07005195 if self.xid != other.xid: return False
5196 if self.report_mirror_ports != other.report_mirror_ports: return False
5197 return True
5198
Rich Lanec2ee4b82013-04-24 17:12:38 -07005199 def pretty_print(self, q):
5200 q.text("bsn_get_mirroring_request {")
5201 with q.group():
5202 with q.indent(2):
5203 q.breakable()
5204 q.text("xid = ");
5205 if self.xid != None:
5206 q.text("%#x" % self.xid)
5207 else:
5208 q.text('None')
5209 q.text(","); q.breakable()
5210 q.text("report_mirror_ports = ");
5211 q.text("%#x" % self.report_mirror_ports)
5212 q.breakable()
5213 q.text('}')
5214
Rich Lane7dcdf022013-12-11 14:45:27 -08005215bsn_header.subtypes[4] = bsn_get_mirroring_request
5216
5217class bsn_get_switch_pipeline_reply(bsn_header):
5218 version = 4
5219 type = 4
5220 experimenter = 6035143
5221 subtype = 52
5222
5223 def __init__(self, xid=None, pipeline=None):
5224 if xid != None:
5225 self.xid = xid
5226 else:
5227 self.xid = None
5228 if pipeline != None:
5229 self.pipeline = pipeline
5230 else:
5231 self.pipeline = ""
5232 return
5233
5234 def pack(self):
5235 packed = []
5236 packed.append(struct.pack("!B", self.version))
5237 packed.append(struct.pack("!B", self.type))
5238 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5239 packed.append(struct.pack("!L", self.xid))
5240 packed.append(struct.pack("!L", self.experimenter))
5241 packed.append(struct.pack("!L", self.subtype))
5242 packed.append(struct.pack("!256s", self.pipeline))
5243 length = sum([len(x) for x in packed])
5244 packed[2] = struct.pack("!H", length)
5245 return ''.join(packed)
5246
5247 @staticmethod
5248 def unpack(reader):
5249 obj = bsn_get_switch_pipeline_reply()
5250 _version = reader.read("!B")[0]
5251 assert(_version == 4)
5252 _type = reader.read("!B")[0]
5253 assert(_type == 4)
5254 _length = reader.read("!H")[0]
5255 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08005256 reader = orig_reader.slice(_length, 4)
Rich Lane7dcdf022013-12-11 14:45:27 -08005257 obj.xid = reader.read("!L")[0]
5258 _experimenter = reader.read("!L")[0]
5259 assert(_experimenter == 6035143)
5260 _subtype = reader.read("!L")[0]
5261 assert(_subtype == 52)
5262 obj.pipeline = reader.read("!256s")[0].rstrip("\x00")
5263 return obj
5264
5265 def __eq__(self, other):
5266 if type(self) != type(other): return False
5267 if self.xid != other.xid: return False
5268 if self.pipeline != other.pipeline: return False
5269 return True
5270
5271 def pretty_print(self, q):
5272 q.text("bsn_get_switch_pipeline_reply {")
5273 with q.group():
5274 with q.indent(2):
5275 q.breakable()
5276 q.text("xid = ");
5277 if self.xid != None:
5278 q.text("%#x" % self.xid)
5279 else:
5280 q.text('None')
5281 q.text(","); q.breakable()
5282 q.text("pipeline = ");
5283 q.pp(self.pipeline)
5284 q.breakable()
5285 q.text('}')
5286
5287bsn_header.subtypes[52] = bsn_get_switch_pipeline_reply
5288
5289class bsn_get_switch_pipeline_request(bsn_header):
5290 version = 4
5291 type = 4
5292 experimenter = 6035143
5293 subtype = 51
5294
5295 def __init__(self, xid=None):
5296 if xid != None:
5297 self.xid = xid
5298 else:
5299 self.xid = None
5300 return
5301
5302 def pack(self):
5303 packed = []
5304 packed.append(struct.pack("!B", self.version))
5305 packed.append(struct.pack("!B", self.type))
5306 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5307 packed.append(struct.pack("!L", self.xid))
5308 packed.append(struct.pack("!L", self.experimenter))
5309 packed.append(struct.pack("!L", self.subtype))
5310 length = sum([len(x) for x in packed])
5311 packed[2] = struct.pack("!H", length)
5312 return ''.join(packed)
5313
5314 @staticmethod
5315 def unpack(reader):
5316 obj = bsn_get_switch_pipeline_request()
5317 _version = reader.read("!B")[0]
5318 assert(_version == 4)
5319 _type = reader.read("!B")[0]
5320 assert(_type == 4)
5321 _length = reader.read("!H")[0]
5322 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08005323 reader = orig_reader.slice(_length, 4)
Rich Lane7dcdf022013-12-11 14:45:27 -08005324 obj.xid = reader.read("!L")[0]
5325 _experimenter = reader.read("!L")[0]
5326 assert(_experimenter == 6035143)
5327 _subtype = reader.read("!L")[0]
5328 assert(_subtype == 51)
5329 return obj
5330
5331 def __eq__(self, other):
5332 if type(self) != type(other): return False
5333 if self.xid != other.xid: return False
5334 return True
5335
5336 def pretty_print(self, q):
5337 q.text("bsn_get_switch_pipeline_request {")
5338 with q.group():
5339 with q.indent(2):
5340 q.breakable()
5341 q.text("xid = ");
5342 if self.xid != None:
5343 q.text("%#x" % self.xid)
5344 else:
5345 q.text('None')
5346 q.breakable()
5347 q.text('}')
5348
5349bsn_header.subtypes[51] = bsn_get_switch_pipeline_request
5350
Rich Lane93b33132014-04-21 12:20:58 -07005351class bsn_image_desc_stats_reply(bsn_stats_reply):
5352 version = 4
5353 type = 19
5354 stats_type = 65535
5355 experimenter = 6035143
5356 subtype = 14
5357
5358 def __init__(self, xid=None, flags=None, image_checksum=None, startup_config_checksum=None):
5359 if xid != None:
5360 self.xid = xid
5361 else:
5362 self.xid = None
5363 if flags != None:
5364 self.flags = flags
5365 else:
5366 self.flags = 0
5367 if image_checksum != None:
5368 self.image_checksum = image_checksum
5369 else:
5370 self.image_checksum = ""
5371 if startup_config_checksum != None:
5372 self.startup_config_checksum = startup_config_checksum
5373 else:
5374 self.startup_config_checksum = ""
5375 return
5376
5377 def pack(self):
5378 packed = []
5379 packed.append(struct.pack("!B", self.version))
5380 packed.append(struct.pack("!B", self.type))
5381 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5382 packed.append(struct.pack("!L", self.xid))
5383 packed.append(struct.pack("!H", self.stats_type))
5384 packed.append(struct.pack("!H", self.flags))
5385 packed.append('\x00' * 4)
5386 packed.append(struct.pack("!L", self.experimenter))
5387 packed.append(struct.pack("!L", self.subtype))
5388 packed.append(struct.pack("!256s", self.image_checksum))
5389 packed.append(struct.pack("!256s", self.startup_config_checksum))
5390 length = sum([len(x) for x in packed])
5391 packed[2] = struct.pack("!H", length)
5392 return ''.join(packed)
5393
5394 @staticmethod
5395 def unpack(reader):
5396 obj = bsn_image_desc_stats_reply()
5397 _version = reader.read("!B")[0]
5398 assert(_version == 4)
5399 _type = reader.read("!B")[0]
5400 assert(_type == 19)
5401 _length = reader.read("!H")[0]
5402 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08005403 reader = orig_reader.slice(_length, 4)
Rich Lane93b33132014-04-21 12:20:58 -07005404 obj.xid = reader.read("!L")[0]
5405 _stats_type = reader.read("!H")[0]
5406 assert(_stats_type == 65535)
5407 obj.flags = reader.read("!H")[0]
5408 reader.skip(4)
5409 _experimenter = reader.read("!L")[0]
5410 assert(_experimenter == 6035143)
5411 _subtype = reader.read("!L")[0]
5412 assert(_subtype == 14)
5413 obj.image_checksum = reader.read("!256s")[0].rstrip("\x00")
5414 obj.startup_config_checksum = reader.read("!256s")[0].rstrip("\x00")
5415 return obj
5416
5417 def __eq__(self, other):
5418 if type(self) != type(other): return False
5419 if self.xid != other.xid: return False
5420 if self.flags != other.flags: return False
5421 if self.image_checksum != other.image_checksum: return False
5422 if self.startup_config_checksum != other.startup_config_checksum: return False
5423 return True
5424
5425 def pretty_print(self, q):
5426 q.text("bsn_image_desc_stats_reply {")
5427 with q.group():
5428 with q.indent(2):
5429 q.breakable()
5430 q.text("xid = ");
5431 if self.xid != None:
5432 q.text("%#x" % self.xid)
5433 else:
5434 q.text('None')
5435 q.text(","); q.breakable()
5436 q.text("flags = ");
5437 q.text("%#x" % self.flags)
5438 q.text(","); q.breakable()
5439 q.text("image_checksum = ");
5440 q.pp(self.image_checksum)
5441 q.text(","); q.breakable()
5442 q.text("startup_config_checksum = ");
5443 q.pp(self.startup_config_checksum)
5444 q.breakable()
5445 q.text('}')
5446
5447bsn_stats_reply.subtypes[14] = bsn_image_desc_stats_reply
5448
5449class bsn_image_desc_stats_request(bsn_stats_request):
5450 version = 4
5451 type = 18
5452 stats_type = 65535
5453 experimenter = 6035143
5454 subtype = 14
5455
5456 def __init__(self, xid=None, flags=None):
5457 if xid != None:
5458 self.xid = xid
5459 else:
5460 self.xid = None
5461 if flags != None:
5462 self.flags = flags
5463 else:
5464 self.flags = 0
5465 return
5466
5467 def pack(self):
5468 packed = []
5469 packed.append(struct.pack("!B", self.version))
5470 packed.append(struct.pack("!B", self.type))
5471 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5472 packed.append(struct.pack("!L", self.xid))
5473 packed.append(struct.pack("!H", self.stats_type))
5474 packed.append(struct.pack("!H", self.flags))
5475 packed.append('\x00' * 4)
5476 packed.append(struct.pack("!L", self.experimenter))
5477 packed.append(struct.pack("!L", self.subtype))
5478 length = sum([len(x) for x in packed])
5479 packed[2] = struct.pack("!H", length)
5480 return ''.join(packed)
5481
5482 @staticmethod
5483 def unpack(reader):
5484 obj = bsn_image_desc_stats_request()
5485 _version = reader.read("!B")[0]
5486 assert(_version == 4)
5487 _type = reader.read("!B")[0]
5488 assert(_type == 18)
5489 _length = reader.read("!H")[0]
5490 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08005491 reader = orig_reader.slice(_length, 4)
Rich Lane93b33132014-04-21 12:20:58 -07005492 obj.xid = reader.read("!L")[0]
5493 _stats_type = reader.read("!H")[0]
5494 assert(_stats_type == 65535)
5495 obj.flags = reader.read("!H")[0]
5496 reader.skip(4)
5497 _experimenter = reader.read("!L")[0]
5498 assert(_experimenter == 6035143)
5499 _subtype = reader.read("!L")[0]
5500 assert(_subtype == 14)
5501 return obj
5502
5503 def __eq__(self, other):
5504 if type(self) != type(other): return False
5505 if self.xid != other.xid: return False
5506 if self.flags != other.flags: return False
5507 return True
5508
5509 def pretty_print(self, q):
5510 q.text("bsn_image_desc_stats_request {")
5511 with q.group():
5512 with q.indent(2):
5513 q.breakable()
5514 q.text("xid = ");
5515 if self.xid != None:
5516 q.text("%#x" % self.xid)
5517 else:
5518 q.text('None')
5519 q.text(","); q.breakable()
5520 q.text("flags = ");
5521 q.text("%#x" % self.flags)
5522 q.breakable()
5523 q.text('}')
5524
5525bsn_stats_request.subtypes[14] = bsn_image_desc_stats_request
5526
Rich Lane7dcdf022013-12-11 14:45:27 -08005527class bsn_lacp_convergence_notif(bsn_header):
Rich Lane7b0f2012013-11-22 14:15:26 -08005528 version = 4
5529 type = 4
5530 experimenter = 6035143
5531 subtype = 43
5532
5533 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 -08005534 if xid != None:
5535 self.xid = xid
5536 else:
5537 self.xid = None
Rich Lane7b0f2012013-11-22 14:15:26 -08005538 if convergence_status != None:
5539 self.convergence_status = convergence_status
5540 else:
5541 self.convergence_status = 0
5542 if port_no != None:
5543 self.port_no = port_no
5544 else:
5545 self.port_no = 0
5546 if actor_sys_priority != None:
5547 self.actor_sys_priority = actor_sys_priority
5548 else:
5549 self.actor_sys_priority = 0
5550 if actor_sys_mac != None:
5551 self.actor_sys_mac = actor_sys_mac
5552 else:
5553 self.actor_sys_mac = [0,0,0,0,0,0]
5554 if actor_port_priority != None:
5555 self.actor_port_priority = actor_port_priority
5556 else:
5557 self.actor_port_priority = 0
5558 if actor_port_num != None:
5559 self.actor_port_num = actor_port_num
5560 else:
5561 self.actor_port_num = 0
5562 if actor_key != None:
5563 self.actor_key = actor_key
5564 else:
5565 self.actor_key = 0
5566 if partner_sys_priority != None:
5567 self.partner_sys_priority = partner_sys_priority
5568 else:
5569 self.partner_sys_priority = 0
5570 if partner_sys_mac != None:
5571 self.partner_sys_mac = partner_sys_mac
5572 else:
5573 self.partner_sys_mac = [0,0,0,0,0,0]
5574 if partner_port_priority != None:
5575 self.partner_port_priority = partner_port_priority
5576 else:
5577 self.partner_port_priority = 0
5578 if partner_port_num != None:
5579 self.partner_port_num = partner_port_num
5580 else:
5581 self.partner_port_num = 0
5582 if partner_key != None:
5583 self.partner_key = partner_key
5584 else:
5585 self.partner_key = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08005586 return
Rich Lane7b0f2012013-11-22 14:15:26 -08005587
5588 def pack(self):
5589 packed = []
5590 packed.append(struct.pack("!B", self.version))
5591 packed.append(struct.pack("!B", self.type))
5592 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5593 packed.append(struct.pack("!L", self.xid))
5594 packed.append(struct.pack("!L", self.experimenter))
5595 packed.append(struct.pack("!L", self.subtype))
5596 packed.append(struct.pack("!B", self.convergence_status))
5597 packed.append('\x00' * 3)
5598 packed.append(util.pack_port_no(self.port_no))
5599 packed.append(struct.pack("!H", self.actor_sys_priority))
5600 packed.append(struct.pack("!6B", *self.actor_sys_mac))
5601 packed.append(struct.pack("!H", self.actor_port_priority))
5602 packed.append(struct.pack("!H", self.actor_port_num))
5603 packed.append(struct.pack("!H", self.actor_key))
5604 packed.append(struct.pack("!H", self.partner_sys_priority))
5605 packed.append(struct.pack("!6B", *self.partner_sys_mac))
5606 packed.append(struct.pack("!H", self.partner_port_priority))
5607 packed.append(struct.pack("!H", self.partner_port_num))
5608 packed.append(struct.pack("!H", self.partner_key))
5609 length = sum([len(x) for x in packed])
5610 packed[2] = struct.pack("!H", length)
5611 return ''.join(packed)
5612
5613 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005614 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -08005615 obj = bsn_lacp_convergence_notif()
Rich Lane7b0f2012013-11-22 14:15:26 -08005616 _version = reader.read("!B")[0]
5617 assert(_version == 4)
5618 _type = reader.read("!B")[0]
5619 assert(_type == 4)
5620 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005621 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08005622 reader = orig_reader.slice(_length, 4)
Rich Lane7b0f2012013-11-22 14:15:26 -08005623 obj.xid = reader.read("!L")[0]
5624 _experimenter = reader.read("!L")[0]
5625 assert(_experimenter == 6035143)
5626 _subtype = reader.read("!L")[0]
5627 assert(_subtype == 43)
5628 obj.convergence_status = reader.read("!B")[0]
5629 reader.skip(3)
5630 obj.port_no = util.unpack_port_no(reader)
5631 obj.actor_sys_priority = reader.read("!H")[0]
5632 obj.actor_sys_mac = list(reader.read('!6B'))
5633 obj.actor_port_priority = reader.read("!H")[0]
5634 obj.actor_port_num = reader.read("!H")[0]
5635 obj.actor_key = reader.read("!H")[0]
5636 obj.partner_sys_priority = reader.read("!H")[0]
5637 obj.partner_sys_mac = list(reader.read('!6B'))
5638 obj.partner_port_priority = reader.read("!H")[0]
5639 obj.partner_port_num = reader.read("!H")[0]
5640 obj.partner_key = reader.read("!H")[0]
5641 return obj
5642
5643 def __eq__(self, other):
5644 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -08005645 if self.xid != other.xid: return False
5646 if self.convergence_status != other.convergence_status: return False
5647 if self.port_no != other.port_no: return False
5648 if self.actor_sys_priority != other.actor_sys_priority: return False
5649 if self.actor_sys_mac != other.actor_sys_mac: return False
5650 if self.actor_port_priority != other.actor_port_priority: return False
5651 if self.actor_port_num != other.actor_port_num: return False
5652 if self.actor_key != other.actor_key: return False
5653 if self.partner_sys_priority != other.partner_sys_priority: return False
5654 if self.partner_sys_mac != other.partner_sys_mac: return False
5655 if self.partner_port_priority != other.partner_port_priority: return False
5656 if self.partner_port_num != other.partner_port_num: return False
5657 if self.partner_key != other.partner_key: return False
5658 return True
5659
Rich Lane7b0f2012013-11-22 14:15:26 -08005660 def pretty_print(self, q):
5661 q.text("bsn_lacp_convergence_notif {")
5662 with q.group():
5663 with q.indent(2):
5664 q.breakable()
5665 q.text("xid = ");
5666 if self.xid != None:
5667 q.text("%#x" % self.xid)
5668 else:
5669 q.text('None')
5670 q.text(","); q.breakable()
5671 q.text("convergence_status = ");
5672 q.text("%#x" % self.convergence_status)
5673 q.text(","); q.breakable()
5674 q.text("port_no = ");
5675 q.text(util.pretty_port(self.port_no))
5676 q.text(","); q.breakable()
5677 q.text("actor_sys_priority = ");
5678 q.text("%#x" % self.actor_sys_priority)
5679 q.text(","); q.breakable()
5680 q.text("actor_sys_mac = ");
5681 q.text(util.pretty_mac(self.actor_sys_mac))
5682 q.text(","); q.breakable()
5683 q.text("actor_port_priority = ");
5684 q.text("%#x" % self.actor_port_priority)
5685 q.text(","); q.breakable()
5686 q.text("actor_port_num = ");
5687 q.text("%#x" % self.actor_port_num)
5688 q.text(","); q.breakable()
5689 q.text("actor_key = ");
5690 q.text("%#x" % self.actor_key)
5691 q.text(","); q.breakable()
5692 q.text("partner_sys_priority = ");
5693 q.text("%#x" % self.partner_sys_priority)
5694 q.text(","); q.breakable()
5695 q.text("partner_sys_mac = ");
5696 q.text(util.pretty_mac(self.partner_sys_mac))
5697 q.text(","); q.breakable()
5698 q.text("partner_port_priority = ");
5699 q.text("%#x" % self.partner_port_priority)
5700 q.text(","); q.breakable()
5701 q.text("partner_port_num = ");
5702 q.text("%#x" % self.partner_port_num)
5703 q.text(","); q.breakable()
5704 q.text("partner_key = ");
5705 q.text("%#x" % self.partner_key)
5706 q.breakable()
5707 q.text('}')
5708
Rich Lane7dcdf022013-12-11 14:45:27 -08005709bsn_header.subtypes[43] = bsn_lacp_convergence_notif
5710
Rich Lane7dcdf022013-12-11 14:45:27 -08005711class bsn_lacp_stats_reply(bsn_stats_reply):
Rich Lane7b0f2012013-11-22 14:15:26 -08005712 version = 4
5713 type = 19
5714 stats_type = 65535
5715 experimenter = 6035143
5716 subtype = 1
5717
5718 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005719 if xid != None:
5720 self.xid = xid
5721 else:
5722 self.xid = None
Rich Lane7b0f2012013-11-22 14:15:26 -08005723 if flags != None:
5724 self.flags = flags
5725 else:
5726 self.flags = 0
5727 if entries != None:
5728 self.entries = entries
5729 else:
5730 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -08005731 return
Rich Lane7b0f2012013-11-22 14:15:26 -08005732
5733 def pack(self):
5734 packed = []
5735 packed.append(struct.pack("!B", self.version))
5736 packed.append(struct.pack("!B", self.type))
5737 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5738 packed.append(struct.pack("!L", self.xid))
5739 packed.append(struct.pack("!H", self.stats_type))
5740 packed.append(struct.pack("!H", self.flags))
5741 packed.append('\x00' * 4)
5742 packed.append(struct.pack("!L", self.experimenter))
5743 packed.append(struct.pack("!L", self.subtype))
Rich Lane7dcdf022013-12-11 14:45:27 -08005744 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lane7b0f2012013-11-22 14:15:26 -08005745 length = sum([len(x) for x in packed])
5746 packed[2] = struct.pack("!H", length)
5747 return ''.join(packed)
5748
5749 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005750 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -08005751 obj = bsn_lacp_stats_reply()
Rich Lane7b0f2012013-11-22 14:15:26 -08005752 _version = reader.read("!B")[0]
5753 assert(_version == 4)
5754 _type = reader.read("!B")[0]
5755 assert(_type == 19)
5756 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005757 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08005758 reader = orig_reader.slice(_length, 4)
Rich Lane7b0f2012013-11-22 14:15:26 -08005759 obj.xid = reader.read("!L")[0]
5760 _stats_type = reader.read("!H")[0]
5761 assert(_stats_type == 65535)
5762 obj.flags = reader.read("!H")[0]
5763 reader.skip(4)
5764 _experimenter = reader.read("!L")[0]
5765 assert(_experimenter == 6035143)
5766 _subtype = reader.read("!L")[0]
5767 assert(_subtype == 1)
Rich Lanee2567702015-01-26 15:04:35 -08005768 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_lacp_stats_entry.unpack)
Rich Lane7b0f2012013-11-22 14:15:26 -08005769 return obj
5770
5771 def __eq__(self, other):
5772 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -08005773 if self.xid != other.xid: return False
5774 if self.flags != other.flags: return False
5775 if self.entries != other.entries: return False
5776 return True
5777
Rich Lane7b0f2012013-11-22 14:15:26 -08005778 def pretty_print(self, q):
5779 q.text("bsn_lacp_stats_reply {")
5780 with q.group():
5781 with q.indent(2):
5782 q.breakable()
5783 q.text("xid = ");
5784 if self.xid != None:
5785 q.text("%#x" % self.xid)
5786 else:
5787 q.text('None')
5788 q.text(","); q.breakable()
5789 q.text("flags = ");
5790 q.text("%#x" % self.flags)
5791 q.text(","); q.breakable()
5792 q.text("entries = ");
5793 q.pp(self.entries)
5794 q.breakable()
5795 q.text('}')
5796
Rich Lane7dcdf022013-12-11 14:45:27 -08005797bsn_stats_reply.subtypes[1] = bsn_lacp_stats_reply
5798
Rich Lane7dcdf022013-12-11 14:45:27 -08005799class bsn_lacp_stats_request(bsn_stats_request):
Rich Lane7b0f2012013-11-22 14:15:26 -08005800 version = 4
5801 type = 18
5802 stats_type = 65535
5803 experimenter = 6035143
5804 subtype = 1
5805
5806 def __init__(self, xid=None, flags=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005807 if xid != None:
5808 self.xid = xid
5809 else:
5810 self.xid = None
Rich Lane7b0f2012013-11-22 14:15:26 -08005811 if flags != None:
5812 self.flags = flags
5813 else:
5814 self.flags = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08005815 return
Rich Lane7b0f2012013-11-22 14:15:26 -08005816
5817 def pack(self):
5818 packed = []
5819 packed.append(struct.pack("!B", self.version))
5820 packed.append(struct.pack("!B", self.type))
5821 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5822 packed.append(struct.pack("!L", self.xid))
5823 packed.append(struct.pack("!H", self.stats_type))
5824 packed.append(struct.pack("!H", self.flags))
5825 packed.append('\x00' * 4)
5826 packed.append(struct.pack("!L", self.experimenter))
5827 packed.append(struct.pack("!L", self.subtype))
5828 length = sum([len(x) for x in packed])
5829 packed[2] = struct.pack("!H", length)
5830 return ''.join(packed)
5831
5832 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005833 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -08005834 obj = bsn_lacp_stats_request()
Rich Lane7b0f2012013-11-22 14:15:26 -08005835 _version = reader.read("!B")[0]
5836 assert(_version == 4)
5837 _type = reader.read("!B")[0]
5838 assert(_type == 18)
5839 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005840 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08005841 reader = orig_reader.slice(_length, 4)
Rich Lane7b0f2012013-11-22 14:15:26 -08005842 obj.xid = reader.read("!L")[0]
5843 _stats_type = reader.read("!H")[0]
5844 assert(_stats_type == 65535)
5845 obj.flags = reader.read("!H")[0]
5846 reader.skip(4)
5847 _experimenter = reader.read("!L")[0]
5848 assert(_experimenter == 6035143)
5849 _subtype = reader.read("!L")[0]
5850 assert(_subtype == 1)
5851 return obj
5852
5853 def __eq__(self, other):
5854 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -08005855 if self.xid != other.xid: return False
5856 if self.flags != other.flags: return False
5857 return True
5858
Rich Lane7b0f2012013-11-22 14:15:26 -08005859 def pretty_print(self, q):
5860 q.text("bsn_lacp_stats_request {")
5861 with q.group():
5862 with q.indent(2):
5863 q.breakable()
5864 q.text("xid = ");
5865 if self.xid != None:
5866 q.text("%#x" % self.xid)
5867 else:
5868 q.text('None')
5869 q.text(","); q.breakable()
5870 q.text("flags = ");
5871 q.text("%#x" % self.flags)
5872 q.breakable()
5873 q.text('}')
5874
Rich Lane7dcdf022013-12-11 14:45:27 -08005875bsn_stats_request.subtypes[1] = bsn_lacp_stats_request
5876
Rich Lane5587ab12014-06-30 11:19:09 -07005877class bsn_log(bsn_header):
5878 version = 4
5879 type = 4
5880 experimenter = 6035143
5881 subtype = 63
5882
5883 def __init__(self, xid=None, loglevel=None, data=None):
5884 if xid != None:
5885 self.xid = xid
5886 else:
5887 self.xid = None
5888 if loglevel != None:
5889 self.loglevel = loglevel
5890 else:
5891 self.loglevel = 0
5892 if data != None:
5893 self.data = data
5894 else:
5895 self.data = ''
5896 return
5897
5898 def pack(self):
5899 packed = []
5900 packed.append(struct.pack("!B", self.version))
5901 packed.append(struct.pack("!B", self.type))
5902 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5903 packed.append(struct.pack("!L", self.xid))
5904 packed.append(struct.pack("!L", self.experimenter))
5905 packed.append(struct.pack("!L", self.subtype))
5906 packed.append(struct.pack("!B", self.loglevel))
5907 packed.append(self.data)
5908 length = sum([len(x) for x in packed])
5909 packed[2] = struct.pack("!H", length)
5910 return ''.join(packed)
5911
5912 @staticmethod
5913 def unpack(reader):
5914 obj = bsn_log()
5915 _version = reader.read("!B")[0]
5916 assert(_version == 4)
5917 _type = reader.read("!B")[0]
5918 assert(_type == 4)
5919 _length = reader.read("!H")[0]
5920 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08005921 reader = orig_reader.slice(_length, 4)
Rich Lane5587ab12014-06-30 11:19:09 -07005922 obj.xid = reader.read("!L")[0]
5923 _experimenter = reader.read("!L")[0]
5924 assert(_experimenter == 6035143)
5925 _subtype = reader.read("!L")[0]
5926 assert(_subtype == 63)
5927 obj.loglevel = reader.read("!B")[0]
5928 obj.data = str(reader.read_all())
5929 return obj
5930
5931 def __eq__(self, other):
5932 if type(self) != type(other): return False
5933 if self.xid != other.xid: return False
5934 if self.loglevel != other.loglevel: return False
5935 if self.data != other.data: return False
5936 return True
5937
5938 def pretty_print(self, q):
5939 q.text("bsn_log {")
5940 with q.group():
5941 with q.indent(2):
5942 q.breakable()
5943 q.text("xid = ");
5944 if self.xid != None:
5945 q.text("%#x" % self.xid)
5946 else:
5947 q.text('None')
5948 q.text(","); q.breakable()
5949 q.text("loglevel = ");
5950 q.text("%#x" % self.loglevel)
5951 q.text(","); q.breakable()
5952 q.text("data = ");
5953 q.pp(self.data)
5954 q.breakable()
5955 q.text('}')
5956
5957bsn_header.subtypes[63] = bsn_log
5958
Rich Lane474324f2015-01-14 15:22:56 -08005959class bsn_lua_command_reply(bsn_header):
5960 version = 4
5961 type = 4
5962 experimenter = 6035143
5963 subtype = 66
5964
5965 def __init__(self, xid=None, data=None):
5966 if xid != None:
5967 self.xid = xid
5968 else:
5969 self.xid = None
5970 if data != None:
5971 self.data = data
5972 else:
5973 self.data = ''
5974 return
5975
5976 def pack(self):
5977 packed = []
5978 packed.append(struct.pack("!B", self.version))
5979 packed.append(struct.pack("!B", self.type))
5980 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5981 packed.append(struct.pack("!L", self.xid))
5982 packed.append(struct.pack("!L", self.experimenter))
5983 packed.append(struct.pack("!L", self.subtype))
5984 packed.append(self.data)
5985 length = sum([len(x) for x in packed])
5986 packed[2] = struct.pack("!H", length)
5987 return ''.join(packed)
5988
5989 @staticmethod
5990 def unpack(reader):
5991 obj = bsn_lua_command_reply()
5992 _version = reader.read("!B")[0]
5993 assert(_version == 4)
5994 _type = reader.read("!B")[0]
5995 assert(_type == 4)
5996 _length = reader.read("!H")[0]
5997 orig_reader = reader
5998 reader = orig_reader.slice(_length, 4)
5999 obj.xid = reader.read("!L")[0]
6000 _experimenter = reader.read("!L")[0]
6001 assert(_experimenter == 6035143)
6002 _subtype = reader.read("!L")[0]
6003 assert(_subtype == 66)
6004 obj.data = str(reader.read_all())
6005 return obj
6006
6007 def __eq__(self, other):
6008 if type(self) != type(other): return False
6009 if self.xid != other.xid: return False
6010 if self.data != other.data: return False
6011 return True
6012
6013 def pretty_print(self, q):
6014 q.text("bsn_lua_command_reply {")
6015 with q.group():
6016 with q.indent(2):
6017 q.breakable()
6018 q.text("xid = ");
6019 if self.xid != None:
6020 q.text("%#x" % self.xid)
6021 else:
6022 q.text('None')
6023 q.text(","); q.breakable()
6024 q.text("data = ");
6025 q.pp(self.data)
6026 q.breakable()
6027 q.text('}')
6028
6029bsn_header.subtypes[66] = bsn_lua_command_reply
6030
6031class bsn_lua_command_request(bsn_header):
6032 version = 4
6033 type = 4
6034 experimenter = 6035143
6035 subtype = 65
6036
6037 def __init__(self, xid=None, data=None):
6038 if xid != None:
6039 self.xid = xid
6040 else:
6041 self.xid = None
6042 if data != None:
6043 self.data = data
6044 else:
6045 self.data = ''
6046 return
6047
6048 def pack(self):
6049 packed = []
6050 packed.append(struct.pack("!B", self.version))
6051 packed.append(struct.pack("!B", self.type))
6052 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6053 packed.append(struct.pack("!L", self.xid))
6054 packed.append(struct.pack("!L", self.experimenter))
6055 packed.append(struct.pack("!L", self.subtype))
6056 packed.append(self.data)
6057 length = sum([len(x) for x in packed])
6058 packed[2] = struct.pack("!H", length)
6059 return ''.join(packed)
6060
6061 @staticmethod
6062 def unpack(reader):
6063 obj = bsn_lua_command_request()
6064 _version = reader.read("!B")[0]
6065 assert(_version == 4)
6066 _type = reader.read("!B")[0]
6067 assert(_type == 4)
6068 _length = reader.read("!H")[0]
6069 orig_reader = reader
6070 reader = orig_reader.slice(_length, 4)
6071 obj.xid = reader.read("!L")[0]
6072 _experimenter = reader.read("!L")[0]
6073 assert(_experimenter == 6035143)
6074 _subtype = reader.read("!L")[0]
6075 assert(_subtype == 65)
6076 obj.data = str(reader.read_all())
6077 return obj
6078
6079 def __eq__(self, other):
6080 if type(self) != type(other): return False
6081 if self.xid != other.xid: return False
6082 if self.data != other.data: return False
6083 return True
6084
6085 def pretty_print(self, q):
6086 q.text("bsn_lua_command_request {")
6087 with q.group():
6088 with q.indent(2):
6089 q.breakable()
6090 q.text("xid = ");
6091 if self.xid != None:
6092 q.text("%#x" % self.xid)
6093 else:
6094 q.text('None')
6095 q.text(","); q.breakable()
6096 q.text("data = ");
6097 q.pp(self.data)
6098 q.breakable()
6099 q.text('}')
6100
6101bsn_header.subtypes[65] = bsn_lua_command_request
6102
6103class bsn_lua_notification(bsn_header):
6104 version = 4
6105 type = 4
6106 experimenter = 6035143
6107 subtype = 67
6108
6109 def __init__(self, xid=None, data=None):
6110 if xid != None:
6111 self.xid = xid
6112 else:
6113 self.xid = None
6114 if data != None:
6115 self.data = data
6116 else:
6117 self.data = ''
6118 return
6119
6120 def pack(self):
6121 packed = []
6122 packed.append(struct.pack("!B", self.version))
6123 packed.append(struct.pack("!B", self.type))
6124 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6125 packed.append(struct.pack("!L", self.xid))
6126 packed.append(struct.pack("!L", self.experimenter))
6127 packed.append(struct.pack("!L", self.subtype))
6128 packed.append(self.data)
6129 length = sum([len(x) for x in packed])
6130 packed[2] = struct.pack("!H", length)
6131 return ''.join(packed)
6132
6133 @staticmethod
6134 def unpack(reader):
6135 obj = bsn_lua_notification()
6136 _version = reader.read("!B")[0]
6137 assert(_version == 4)
6138 _type = reader.read("!B")[0]
6139 assert(_type == 4)
6140 _length = reader.read("!H")[0]
6141 orig_reader = reader
6142 reader = orig_reader.slice(_length, 4)
6143 obj.xid = reader.read("!L")[0]
6144 _experimenter = reader.read("!L")[0]
6145 assert(_experimenter == 6035143)
6146 _subtype = reader.read("!L")[0]
6147 assert(_subtype == 67)
6148 obj.data = str(reader.read_all())
6149 return obj
6150
6151 def __eq__(self, other):
6152 if type(self) != type(other): return False
6153 if self.xid != other.xid: return False
6154 if self.data != other.data: return False
6155 return True
6156
6157 def pretty_print(self, q):
6158 q.text("bsn_lua_notification {")
6159 with q.group():
6160 with q.indent(2):
6161 q.breakable()
6162 q.text("xid = ");
6163 if self.xid != None:
6164 q.text("%#x" % self.xid)
6165 else:
6166 q.text('None')
6167 q.text(","); q.breakable()
6168 q.text("data = ");
6169 q.pp(self.data)
6170 q.breakable()
6171 q.text('}')
6172
6173bsn_header.subtypes[67] = bsn_lua_notification
6174
6175class bsn_lua_upload(bsn_header):
6176 version = 4
6177 type = 4
6178 experimenter = 6035143
6179 subtype = 64
6180
6181 def __init__(self, xid=None, flags=None, filename=None, data=None):
6182 if xid != None:
6183 self.xid = xid
6184 else:
6185 self.xid = None
6186 if flags != None:
6187 self.flags = flags
6188 else:
6189 self.flags = 0
6190 if filename != None:
6191 self.filename = filename
6192 else:
6193 self.filename = ""
6194 if data != None:
6195 self.data = data
6196 else:
6197 self.data = ''
6198 return
6199
6200 def pack(self):
6201 packed = []
6202 packed.append(struct.pack("!B", self.version))
6203 packed.append(struct.pack("!B", self.type))
6204 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6205 packed.append(struct.pack("!L", self.xid))
6206 packed.append(struct.pack("!L", self.experimenter))
6207 packed.append(struct.pack("!L", self.subtype))
6208 packed.append(struct.pack("!H", self.flags))
6209 packed.append(struct.pack("!64s", self.filename))
6210 packed.append(self.data)
6211 length = sum([len(x) for x in packed])
6212 packed[2] = struct.pack("!H", length)
6213 return ''.join(packed)
6214
6215 @staticmethod
6216 def unpack(reader):
6217 obj = bsn_lua_upload()
6218 _version = reader.read("!B")[0]
6219 assert(_version == 4)
6220 _type = reader.read("!B")[0]
6221 assert(_type == 4)
6222 _length = reader.read("!H")[0]
6223 orig_reader = reader
6224 reader = orig_reader.slice(_length, 4)
6225 obj.xid = reader.read("!L")[0]
6226 _experimenter = reader.read("!L")[0]
6227 assert(_experimenter == 6035143)
6228 _subtype = reader.read("!L")[0]
6229 assert(_subtype == 64)
6230 obj.flags = reader.read("!H")[0]
6231 obj.filename = reader.read("!64s")[0].rstrip("\x00")
6232 obj.data = str(reader.read_all())
6233 return obj
6234
6235 def __eq__(self, other):
6236 if type(self) != type(other): return False
6237 if self.xid != other.xid: return False
6238 if self.flags != other.flags: return False
6239 if self.filename != other.filename: return False
6240 if self.data != other.data: return False
6241 return True
6242
6243 def pretty_print(self, q):
6244 q.text("bsn_lua_upload {")
6245 with q.group():
6246 with q.indent(2):
6247 q.breakable()
6248 q.text("xid = ");
6249 if self.xid != None:
6250 q.text("%#x" % self.xid)
6251 else:
6252 q.text('None')
6253 q.text(","); q.breakable()
6254 q.text("flags = ");
6255 q.text("%#x" % self.flags)
6256 q.text(","); q.breakable()
6257 q.text("filename = ");
6258 q.pp(self.filename)
6259 q.text(","); q.breakable()
6260 q.text("data = ");
6261 q.pp(self.data)
6262 q.breakable()
6263 q.text('}')
6264
6265bsn_header.subtypes[64] = bsn_lua_upload
6266
Rich Lane7dcdf022013-12-11 14:45:27 -08006267class bsn_pdu_rx_reply(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07006268 version = 4
6269 type = 4
6270 experimenter = 6035143
6271 subtype = 34
6272
Rich Lane7b0f2012013-11-22 14:15:26 -08006273 def __init__(self, xid=None, status=None, port_no=None, slot_num=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006274 if xid != None:
6275 self.xid = xid
6276 else:
6277 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07006278 if status != None:
6279 self.status = status
6280 else:
6281 self.status = 0
Rich Lane7b0f2012013-11-22 14:15:26 -08006282 if port_no != None:
6283 self.port_no = port_no
6284 else:
6285 self.port_no = 0
6286 if slot_num != None:
6287 self.slot_num = slot_num
6288 else:
6289 self.slot_num = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08006290 return
Rich Lane6f4978c2013-10-20 21:33:52 -07006291
6292 def pack(self):
6293 packed = []
6294 packed.append(struct.pack("!B", self.version))
6295 packed.append(struct.pack("!B", self.type))
6296 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6297 packed.append(struct.pack("!L", self.xid))
6298 packed.append(struct.pack("!L", self.experimenter))
6299 packed.append(struct.pack("!L", self.subtype))
6300 packed.append(struct.pack("!L", self.status))
Rich Lane7b0f2012013-11-22 14:15:26 -08006301 packed.append(util.pack_port_no(self.port_no))
6302 packed.append(struct.pack("!B", self.slot_num))
Rich Lane6f4978c2013-10-20 21:33:52 -07006303 length = sum([len(x) for x in packed])
6304 packed[2] = struct.pack("!H", length)
6305 return ''.join(packed)
6306
6307 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006308 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07006309 obj = bsn_pdu_rx_reply()
Rich Lane6f4978c2013-10-20 21:33:52 -07006310 _version = reader.read("!B")[0]
6311 assert(_version == 4)
6312 _type = reader.read("!B")[0]
6313 assert(_type == 4)
6314 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006315 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006316 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -07006317 obj.xid = reader.read("!L")[0]
6318 _experimenter = reader.read("!L")[0]
6319 assert(_experimenter == 6035143)
6320 _subtype = reader.read("!L")[0]
6321 assert(_subtype == 34)
6322 obj.status = reader.read("!L")[0]
Rich Lane7b0f2012013-11-22 14:15:26 -08006323 obj.port_no = util.unpack_port_no(reader)
6324 obj.slot_num = reader.read("!B")[0]
Rich Lane6f4978c2013-10-20 21:33:52 -07006325 return obj
6326
6327 def __eq__(self, other):
6328 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07006329 if self.xid != other.xid: return False
6330 if self.status != other.status: return False
Rich Lane7b0f2012013-11-22 14:15:26 -08006331 if self.port_no != other.port_no: return False
6332 if self.slot_num != other.slot_num: return False
Rich Lane6f4978c2013-10-20 21:33:52 -07006333 return True
6334
Rich Lane6f4978c2013-10-20 21:33:52 -07006335 def pretty_print(self, q):
6336 q.text("bsn_pdu_rx_reply {")
6337 with q.group():
6338 with q.indent(2):
6339 q.breakable()
6340 q.text("xid = ");
6341 if self.xid != None:
6342 q.text("%#x" % self.xid)
6343 else:
6344 q.text('None')
6345 q.text(","); q.breakable()
6346 q.text("status = ");
6347 q.text("%#x" % self.status)
Rich Lane7b0f2012013-11-22 14:15:26 -08006348 q.text(","); q.breakable()
6349 q.text("port_no = ");
6350 q.text(util.pretty_port(self.port_no))
6351 q.text(","); q.breakable()
6352 q.text("slot_num = ");
6353 q.text("%#x" % self.slot_num)
Rich Lane6f4978c2013-10-20 21:33:52 -07006354 q.breakable()
6355 q.text('}')
6356
Rich Lane7dcdf022013-12-11 14:45:27 -08006357bsn_header.subtypes[34] = bsn_pdu_rx_reply
6358
6359class bsn_pdu_rx_request(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07006360 version = 4
6361 type = 4
6362 experimenter = 6035143
6363 subtype = 33
6364
6365 def __init__(self, xid=None, timeout_ms=None, port_no=None, slot_num=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006366 if xid != None:
6367 self.xid = xid
6368 else:
6369 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07006370 if timeout_ms != None:
6371 self.timeout_ms = timeout_ms
6372 else:
6373 self.timeout_ms = 0
6374 if port_no != None:
6375 self.port_no = port_no
6376 else:
6377 self.port_no = 0
6378 if slot_num != None:
6379 self.slot_num = slot_num
6380 else:
6381 self.slot_num = 0
6382 if data != None:
6383 self.data = data
6384 else:
6385 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08006386 return
Rich Lane6f4978c2013-10-20 21:33:52 -07006387
6388 def pack(self):
6389 packed = []
6390 packed.append(struct.pack("!B", self.version))
6391 packed.append(struct.pack("!B", self.type))
6392 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6393 packed.append(struct.pack("!L", self.xid))
6394 packed.append(struct.pack("!L", self.experimenter))
6395 packed.append(struct.pack("!L", self.subtype))
6396 packed.append(struct.pack("!L", self.timeout_ms))
6397 packed.append(util.pack_port_no(self.port_no))
6398 packed.append(struct.pack("!B", self.slot_num))
6399 packed.append('\x00' * 3)
6400 packed.append(self.data)
6401 length = sum([len(x) for x in packed])
6402 packed[2] = struct.pack("!H", length)
6403 return ''.join(packed)
6404
6405 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006406 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07006407 obj = bsn_pdu_rx_request()
Rich Lane6f4978c2013-10-20 21:33:52 -07006408 _version = reader.read("!B")[0]
6409 assert(_version == 4)
6410 _type = reader.read("!B")[0]
6411 assert(_type == 4)
6412 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006413 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006414 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -07006415 obj.xid = reader.read("!L")[0]
6416 _experimenter = reader.read("!L")[0]
6417 assert(_experimenter == 6035143)
6418 _subtype = reader.read("!L")[0]
6419 assert(_subtype == 33)
6420 obj.timeout_ms = reader.read("!L")[0]
6421 obj.port_no = util.unpack_port_no(reader)
6422 obj.slot_num = reader.read("!B")[0]
6423 reader.skip(3)
6424 obj.data = str(reader.read_all())
6425 return obj
6426
6427 def __eq__(self, other):
6428 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07006429 if self.xid != other.xid: return False
6430 if self.timeout_ms != other.timeout_ms: return False
6431 if self.port_no != other.port_no: return False
6432 if self.slot_num != other.slot_num: return False
6433 if self.data != other.data: return False
6434 return True
6435
Rich Lane6f4978c2013-10-20 21:33:52 -07006436 def pretty_print(self, q):
6437 q.text("bsn_pdu_rx_request {")
6438 with q.group():
6439 with q.indent(2):
6440 q.breakable()
6441 q.text("xid = ");
6442 if self.xid != None:
6443 q.text("%#x" % self.xid)
6444 else:
6445 q.text('None')
6446 q.text(","); q.breakable()
6447 q.text("timeout_ms = ");
6448 q.text("%#x" % self.timeout_ms)
6449 q.text(","); q.breakable()
6450 q.text("port_no = ");
6451 q.text(util.pretty_port(self.port_no))
6452 q.text(","); q.breakable()
6453 q.text("slot_num = ");
6454 q.text("%#x" % self.slot_num)
6455 q.text(","); q.breakable()
6456 q.text("data = ");
6457 q.pp(self.data)
6458 q.breakable()
6459 q.text('}')
6460
Rich Lane7dcdf022013-12-11 14:45:27 -08006461bsn_header.subtypes[33] = bsn_pdu_rx_request
6462
6463class bsn_pdu_rx_timeout(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07006464 version = 4
6465 type = 4
6466 experimenter = 6035143
6467 subtype = 35
6468
6469 def __init__(self, xid=None, port_no=None, slot_num=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006470 if xid != None:
6471 self.xid = xid
6472 else:
6473 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07006474 if port_no != None:
6475 self.port_no = port_no
6476 else:
6477 self.port_no = 0
6478 if slot_num != None:
6479 self.slot_num = slot_num
6480 else:
6481 self.slot_num = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08006482 return
Rich Lane6f4978c2013-10-20 21:33:52 -07006483
6484 def pack(self):
6485 packed = []
6486 packed.append(struct.pack("!B", self.version))
6487 packed.append(struct.pack("!B", self.type))
6488 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6489 packed.append(struct.pack("!L", self.xid))
6490 packed.append(struct.pack("!L", self.experimenter))
6491 packed.append(struct.pack("!L", self.subtype))
6492 packed.append(util.pack_port_no(self.port_no))
6493 packed.append(struct.pack("!B", self.slot_num))
6494 length = sum([len(x) for x in packed])
6495 packed[2] = struct.pack("!H", length)
6496 return ''.join(packed)
6497
6498 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006499 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07006500 obj = bsn_pdu_rx_timeout()
Rich Lane6f4978c2013-10-20 21:33:52 -07006501 _version = reader.read("!B")[0]
6502 assert(_version == 4)
6503 _type = reader.read("!B")[0]
6504 assert(_type == 4)
6505 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006506 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006507 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -07006508 obj.xid = reader.read("!L")[0]
6509 _experimenter = reader.read("!L")[0]
6510 assert(_experimenter == 6035143)
6511 _subtype = reader.read("!L")[0]
6512 assert(_subtype == 35)
6513 obj.port_no = util.unpack_port_no(reader)
6514 obj.slot_num = reader.read("!B")[0]
6515 return obj
6516
6517 def __eq__(self, other):
6518 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07006519 if self.xid != other.xid: return False
6520 if self.port_no != other.port_no: return False
6521 if self.slot_num != other.slot_num: return False
6522 return True
6523
Rich Lane6f4978c2013-10-20 21:33:52 -07006524 def pretty_print(self, q):
6525 q.text("bsn_pdu_rx_timeout {")
6526 with q.group():
6527 with q.indent(2):
6528 q.breakable()
6529 q.text("xid = ");
6530 if self.xid != None:
6531 q.text("%#x" % self.xid)
6532 else:
6533 q.text('None')
6534 q.text(","); q.breakable()
6535 q.text("port_no = ");
6536 q.text(util.pretty_port(self.port_no))
6537 q.text(","); q.breakable()
6538 q.text("slot_num = ");
6539 q.text("%#x" % self.slot_num)
6540 q.breakable()
6541 q.text('}')
6542
Rich Lane7dcdf022013-12-11 14:45:27 -08006543bsn_header.subtypes[35] = bsn_pdu_rx_timeout
6544
6545class bsn_pdu_tx_reply(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07006546 version = 4
6547 type = 4
6548 experimenter = 6035143
6549 subtype = 32
6550
Rich Lane7b0f2012013-11-22 14:15:26 -08006551 def __init__(self, xid=None, status=None, port_no=None, slot_num=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006552 if xid != None:
6553 self.xid = xid
6554 else:
6555 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07006556 if status != None:
6557 self.status = status
6558 else:
6559 self.status = 0
Rich Lane7b0f2012013-11-22 14:15:26 -08006560 if port_no != None:
6561 self.port_no = port_no
6562 else:
6563 self.port_no = 0
6564 if slot_num != None:
6565 self.slot_num = slot_num
6566 else:
6567 self.slot_num = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08006568 return
Rich Lane6f4978c2013-10-20 21:33:52 -07006569
6570 def pack(self):
6571 packed = []
6572 packed.append(struct.pack("!B", self.version))
6573 packed.append(struct.pack("!B", self.type))
6574 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6575 packed.append(struct.pack("!L", self.xid))
6576 packed.append(struct.pack("!L", self.experimenter))
6577 packed.append(struct.pack("!L", self.subtype))
6578 packed.append(struct.pack("!L", self.status))
Rich Lane7b0f2012013-11-22 14:15:26 -08006579 packed.append(util.pack_port_no(self.port_no))
6580 packed.append(struct.pack("!B", self.slot_num))
Rich Lane6f4978c2013-10-20 21:33:52 -07006581 length = sum([len(x) for x in packed])
6582 packed[2] = struct.pack("!H", length)
6583 return ''.join(packed)
6584
6585 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006586 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07006587 obj = bsn_pdu_tx_reply()
Rich Lane6f4978c2013-10-20 21:33:52 -07006588 _version = reader.read("!B")[0]
6589 assert(_version == 4)
6590 _type = reader.read("!B")[0]
6591 assert(_type == 4)
6592 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006593 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006594 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -07006595 obj.xid = reader.read("!L")[0]
6596 _experimenter = reader.read("!L")[0]
6597 assert(_experimenter == 6035143)
6598 _subtype = reader.read("!L")[0]
6599 assert(_subtype == 32)
6600 obj.status = reader.read("!L")[0]
Rich Lane7b0f2012013-11-22 14:15:26 -08006601 obj.port_no = util.unpack_port_no(reader)
6602 obj.slot_num = reader.read("!B")[0]
Rich Lane6f4978c2013-10-20 21:33:52 -07006603 return obj
6604
6605 def __eq__(self, other):
6606 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07006607 if self.xid != other.xid: return False
6608 if self.status != other.status: return False
Rich Lane7b0f2012013-11-22 14:15:26 -08006609 if self.port_no != other.port_no: return False
6610 if self.slot_num != other.slot_num: return False
Rich Lane6f4978c2013-10-20 21:33:52 -07006611 return True
6612
Rich Lane6f4978c2013-10-20 21:33:52 -07006613 def pretty_print(self, q):
6614 q.text("bsn_pdu_tx_reply {")
6615 with q.group():
6616 with q.indent(2):
6617 q.breakable()
6618 q.text("xid = ");
6619 if self.xid != None:
6620 q.text("%#x" % self.xid)
6621 else:
6622 q.text('None')
6623 q.text(","); q.breakable()
6624 q.text("status = ");
6625 q.text("%#x" % self.status)
Rich Lane7b0f2012013-11-22 14:15:26 -08006626 q.text(","); q.breakable()
6627 q.text("port_no = ");
6628 q.text(util.pretty_port(self.port_no))
6629 q.text(","); q.breakable()
6630 q.text("slot_num = ");
6631 q.text("%#x" % self.slot_num)
Rich Lane6f4978c2013-10-20 21:33:52 -07006632 q.breakable()
6633 q.text('}')
6634
Rich Lane7dcdf022013-12-11 14:45:27 -08006635bsn_header.subtypes[32] = bsn_pdu_tx_reply
6636
6637class bsn_pdu_tx_request(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07006638 version = 4
6639 type = 4
6640 experimenter = 6035143
6641 subtype = 31
6642
6643 def __init__(self, xid=None, tx_interval_ms=None, port_no=None, slot_num=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006644 if xid != None:
6645 self.xid = xid
6646 else:
6647 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07006648 if tx_interval_ms != None:
6649 self.tx_interval_ms = tx_interval_ms
6650 else:
6651 self.tx_interval_ms = 0
6652 if port_no != None:
6653 self.port_no = port_no
6654 else:
6655 self.port_no = 0
6656 if slot_num != None:
6657 self.slot_num = slot_num
6658 else:
6659 self.slot_num = 0
6660 if data != None:
6661 self.data = data
6662 else:
6663 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08006664 return
Rich Lane6f4978c2013-10-20 21:33:52 -07006665
6666 def pack(self):
6667 packed = []
6668 packed.append(struct.pack("!B", self.version))
6669 packed.append(struct.pack("!B", self.type))
6670 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6671 packed.append(struct.pack("!L", self.xid))
6672 packed.append(struct.pack("!L", self.experimenter))
6673 packed.append(struct.pack("!L", self.subtype))
6674 packed.append(struct.pack("!L", self.tx_interval_ms))
6675 packed.append(util.pack_port_no(self.port_no))
6676 packed.append(struct.pack("!B", self.slot_num))
6677 packed.append('\x00' * 3)
6678 packed.append(self.data)
6679 length = sum([len(x) for x in packed])
6680 packed[2] = struct.pack("!H", length)
6681 return ''.join(packed)
6682
6683 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006684 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07006685 obj = bsn_pdu_tx_request()
Rich Lane6f4978c2013-10-20 21:33:52 -07006686 _version = reader.read("!B")[0]
6687 assert(_version == 4)
6688 _type = reader.read("!B")[0]
6689 assert(_type == 4)
6690 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006691 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006692 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -07006693 obj.xid = reader.read("!L")[0]
6694 _experimenter = reader.read("!L")[0]
6695 assert(_experimenter == 6035143)
6696 _subtype = reader.read("!L")[0]
6697 assert(_subtype == 31)
6698 obj.tx_interval_ms = reader.read("!L")[0]
6699 obj.port_no = util.unpack_port_no(reader)
6700 obj.slot_num = reader.read("!B")[0]
6701 reader.skip(3)
6702 obj.data = str(reader.read_all())
6703 return obj
6704
6705 def __eq__(self, other):
6706 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07006707 if self.xid != other.xid: return False
6708 if self.tx_interval_ms != other.tx_interval_ms: return False
6709 if self.port_no != other.port_no: return False
6710 if self.slot_num != other.slot_num: return False
6711 if self.data != other.data: return False
6712 return True
6713
Rich Lane6f4978c2013-10-20 21:33:52 -07006714 def pretty_print(self, q):
6715 q.text("bsn_pdu_tx_request {")
6716 with q.group():
6717 with q.indent(2):
6718 q.breakable()
6719 q.text("xid = ");
6720 if self.xid != None:
6721 q.text("%#x" % self.xid)
6722 else:
6723 q.text('None')
6724 q.text(","); q.breakable()
6725 q.text("tx_interval_ms = ");
6726 q.text("%#x" % self.tx_interval_ms)
6727 q.text(","); q.breakable()
6728 q.text("port_no = ");
6729 q.text(util.pretty_port(self.port_no))
6730 q.text(","); q.breakable()
6731 q.text("slot_num = ");
6732 q.text("%#x" % self.slot_num)
6733 q.text(","); q.breakable()
6734 q.text("data = ");
6735 q.pp(self.data)
6736 q.breakable()
6737 q.text('}')
6738
Rich Lane7dcdf022013-12-11 14:45:27 -08006739bsn_header.subtypes[31] = bsn_pdu_tx_request
6740
6741class bsn_port_counter_stats_reply(bsn_stats_reply):
6742 version = 4
6743 type = 19
6744 stats_type = 65535
6745 experimenter = 6035143
6746 subtype = 8
6747
6748 def __init__(self, xid=None, flags=None, entries=None):
6749 if xid != None:
6750 self.xid = xid
6751 else:
6752 self.xid = None
6753 if flags != None:
6754 self.flags = flags
6755 else:
6756 self.flags = 0
6757 if entries != None:
6758 self.entries = entries
6759 else:
6760 self.entries = []
6761 return
6762
6763 def pack(self):
6764 packed = []
6765 packed.append(struct.pack("!B", self.version))
6766 packed.append(struct.pack("!B", self.type))
6767 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6768 packed.append(struct.pack("!L", self.xid))
6769 packed.append(struct.pack("!H", self.stats_type))
6770 packed.append(struct.pack("!H", self.flags))
6771 packed.append('\x00' * 4)
6772 packed.append(struct.pack("!L", self.experimenter))
6773 packed.append(struct.pack("!L", self.subtype))
6774 packed.append(loxi.generic_util.pack_list(self.entries))
6775 length = sum([len(x) for x in packed])
6776 packed[2] = struct.pack("!H", length)
6777 return ''.join(packed)
6778
6779 @staticmethod
6780 def unpack(reader):
6781 obj = bsn_port_counter_stats_reply()
6782 _version = reader.read("!B")[0]
6783 assert(_version == 4)
6784 _type = reader.read("!B")[0]
6785 assert(_type == 19)
6786 _length = reader.read("!H")[0]
6787 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006788 reader = orig_reader.slice(_length, 4)
Rich Lane7dcdf022013-12-11 14:45:27 -08006789 obj.xid = reader.read("!L")[0]
6790 _stats_type = reader.read("!H")[0]
6791 assert(_stats_type == 65535)
6792 obj.flags = reader.read("!H")[0]
6793 reader.skip(4)
6794 _experimenter = reader.read("!L")[0]
6795 assert(_experimenter == 6035143)
6796 _subtype = reader.read("!L")[0]
6797 assert(_subtype == 8)
Rich Lanee2567702015-01-26 15:04:35 -08006798 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_port_counter_stats_entry.unpack)
Rich Lane7dcdf022013-12-11 14:45:27 -08006799 return obj
6800
6801 def __eq__(self, other):
6802 if type(self) != type(other): return False
6803 if self.xid != other.xid: return False
6804 if self.flags != other.flags: return False
6805 if self.entries != other.entries: return False
6806 return True
6807
6808 def pretty_print(self, q):
6809 q.text("bsn_port_counter_stats_reply {")
6810 with q.group():
6811 with q.indent(2):
6812 q.breakable()
6813 q.text("xid = ");
6814 if self.xid != None:
6815 q.text("%#x" % self.xid)
6816 else:
6817 q.text('None')
6818 q.text(","); q.breakable()
6819 q.text("flags = ");
6820 q.text("%#x" % self.flags)
6821 q.text(","); q.breakable()
6822 q.text("entries = ");
6823 q.pp(self.entries)
6824 q.breakable()
6825 q.text('}')
6826
6827bsn_stats_reply.subtypes[8] = bsn_port_counter_stats_reply
6828
6829class bsn_port_counter_stats_request(bsn_stats_request):
6830 version = 4
6831 type = 18
6832 stats_type = 65535
6833 experimenter = 6035143
6834 subtype = 8
6835
6836 def __init__(self, xid=None, flags=None, port_no=None):
6837 if xid != None:
6838 self.xid = xid
6839 else:
6840 self.xid = None
6841 if flags != None:
6842 self.flags = flags
6843 else:
6844 self.flags = 0
6845 if port_no != None:
6846 self.port_no = port_no
6847 else:
6848 self.port_no = 0
6849 return
6850
6851 def pack(self):
6852 packed = []
6853 packed.append(struct.pack("!B", self.version))
6854 packed.append(struct.pack("!B", self.type))
6855 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6856 packed.append(struct.pack("!L", self.xid))
6857 packed.append(struct.pack("!H", self.stats_type))
6858 packed.append(struct.pack("!H", self.flags))
6859 packed.append('\x00' * 4)
6860 packed.append(struct.pack("!L", self.experimenter))
6861 packed.append(struct.pack("!L", self.subtype))
6862 packed.append(util.pack_port_no(self.port_no))
6863 length = sum([len(x) for x in packed])
6864 packed[2] = struct.pack("!H", length)
6865 return ''.join(packed)
6866
6867 @staticmethod
6868 def unpack(reader):
6869 obj = bsn_port_counter_stats_request()
6870 _version = reader.read("!B")[0]
6871 assert(_version == 4)
6872 _type = reader.read("!B")[0]
6873 assert(_type == 18)
6874 _length = reader.read("!H")[0]
6875 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006876 reader = orig_reader.slice(_length, 4)
Rich Lane7dcdf022013-12-11 14:45:27 -08006877 obj.xid = reader.read("!L")[0]
6878 _stats_type = reader.read("!H")[0]
6879 assert(_stats_type == 65535)
6880 obj.flags = reader.read("!H")[0]
6881 reader.skip(4)
6882 _experimenter = reader.read("!L")[0]
6883 assert(_experimenter == 6035143)
6884 _subtype = reader.read("!L")[0]
6885 assert(_subtype == 8)
6886 obj.port_no = util.unpack_port_no(reader)
6887 return obj
6888
6889 def __eq__(self, other):
6890 if type(self) != type(other): return False
6891 if self.xid != other.xid: return False
6892 if self.flags != other.flags: return False
6893 if self.port_no != other.port_no: return False
6894 return True
6895
6896 def pretty_print(self, q):
6897 q.text("bsn_port_counter_stats_request {")
6898 with q.group():
6899 with q.indent(2):
6900 q.breakable()
6901 q.text("xid = ");
6902 if self.xid != None:
6903 q.text("%#x" % self.xid)
6904 else:
6905 q.text('None')
6906 q.text(","); q.breakable()
6907 q.text("flags = ");
6908 q.text("%#x" % self.flags)
6909 q.text(","); q.breakable()
6910 q.text("port_no = ");
6911 q.text(util.pretty_port(self.port_no))
6912 q.breakable()
6913 q.text('}')
6914
6915bsn_stats_request.subtypes[8] = bsn_port_counter_stats_request
6916
Rich Lane5454b682014-01-14 17:07:36 -08006917class bsn_role_status(bsn_header):
6918 version = 4
6919 type = 4
6920 experimenter = 6035143
6921 subtype = 55
6922
6923 def __init__(self, xid=None, role=None, reason=None, generation_id=None):
6924 if xid != None:
6925 self.xid = xid
6926 else:
6927 self.xid = None
6928 if role != None:
6929 self.role = role
6930 else:
6931 self.role = 0
6932 if reason != None:
6933 self.reason = reason
6934 else:
6935 self.reason = 0
6936 if generation_id != None:
6937 self.generation_id = generation_id
6938 else:
6939 self.generation_id = 0
6940 return
6941
6942 def pack(self):
6943 packed = []
6944 packed.append(struct.pack("!B", self.version))
6945 packed.append(struct.pack("!B", self.type))
6946 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6947 packed.append(struct.pack("!L", self.xid))
6948 packed.append(struct.pack("!L", self.experimenter))
6949 packed.append(struct.pack("!L", self.subtype))
6950 packed.append(struct.pack("!L", self.role))
6951 packed.append(struct.pack("!B", self.reason))
6952 packed.append('\x00' * 3)
6953 packed.append(struct.pack("!Q", self.generation_id))
6954 length = sum([len(x) for x in packed])
6955 packed[2] = struct.pack("!H", length)
6956 return ''.join(packed)
6957
6958 @staticmethod
6959 def unpack(reader):
6960 obj = bsn_role_status()
6961 _version = reader.read("!B")[0]
6962 assert(_version == 4)
6963 _type = reader.read("!B")[0]
6964 assert(_type == 4)
6965 _length = reader.read("!H")[0]
6966 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006967 reader = orig_reader.slice(_length, 4)
Rich Lane5454b682014-01-14 17:07:36 -08006968 obj.xid = reader.read("!L")[0]
6969 _experimenter = reader.read("!L")[0]
6970 assert(_experimenter == 6035143)
6971 _subtype = reader.read("!L")[0]
6972 assert(_subtype == 55)
6973 obj.role = reader.read("!L")[0]
6974 obj.reason = reader.read("!B")[0]
6975 reader.skip(3)
6976 obj.generation_id = reader.read("!Q")[0]
6977 return obj
6978
6979 def __eq__(self, other):
6980 if type(self) != type(other): return False
6981 if self.xid != other.xid: return False
6982 if self.role != other.role: return False
6983 if self.reason != other.reason: return False
6984 if self.generation_id != other.generation_id: return False
6985 return True
6986
6987 def pretty_print(self, q):
6988 q.text("bsn_role_status {")
6989 with q.group():
6990 with q.indent(2):
6991 q.breakable()
6992 q.text("xid = ");
6993 if self.xid != None:
6994 q.text("%#x" % self.xid)
6995 else:
6996 q.text('None')
6997 q.text(","); q.breakable()
6998 q.text("role = ");
6999 q.text("%#x" % self.role)
7000 q.text(","); q.breakable()
7001 q.text("reason = ");
7002 q.text("%#x" % self.reason)
7003 q.text(","); q.breakable()
7004 q.text("generation_id = ");
7005 q.text("%#x" % self.generation_id)
7006 q.breakable()
7007 q.text('}')
7008
7009bsn_header.subtypes[55] = bsn_role_status
7010
Rich Lane95f7fc92014-01-27 17:08:16 -08007011class bsn_set_aux_cxns_reply(bsn_header):
7012 version = 4
7013 type = 4
7014 experimenter = 6035143
7015 subtype = 59
7016
7017 def __init__(self, xid=None, num_aux=None, status=None):
7018 if xid != None:
7019 self.xid = xid
7020 else:
7021 self.xid = None
7022 if num_aux != None:
7023 self.num_aux = num_aux
7024 else:
7025 self.num_aux = 0
7026 if status != None:
7027 self.status = status
7028 else:
7029 self.status = 0
7030 return
7031
7032 def pack(self):
7033 packed = []
7034 packed.append(struct.pack("!B", self.version))
7035 packed.append(struct.pack("!B", self.type))
7036 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7037 packed.append(struct.pack("!L", self.xid))
7038 packed.append(struct.pack("!L", self.experimenter))
7039 packed.append(struct.pack("!L", self.subtype))
7040 packed.append(struct.pack("!L", self.num_aux))
7041 packed.append(struct.pack("!L", self.status))
7042 length = sum([len(x) for x in packed])
7043 packed[2] = struct.pack("!H", length)
7044 return ''.join(packed)
7045
7046 @staticmethod
7047 def unpack(reader):
7048 obj = bsn_set_aux_cxns_reply()
7049 _version = reader.read("!B")[0]
7050 assert(_version == 4)
7051 _type = reader.read("!B")[0]
7052 assert(_type == 4)
7053 _length = reader.read("!H")[0]
7054 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007055 reader = orig_reader.slice(_length, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -08007056 obj.xid = reader.read("!L")[0]
7057 _experimenter = reader.read("!L")[0]
7058 assert(_experimenter == 6035143)
7059 _subtype = reader.read("!L")[0]
7060 assert(_subtype == 59)
7061 obj.num_aux = reader.read("!L")[0]
7062 obj.status = reader.read("!L")[0]
7063 return obj
7064
7065 def __eq__(self, other):
7066 if type(self) != type(other): return False
7067 if self.xid != other.xid: return False
7068 if self.num_aux != other.num_aux: return False
7069 if self.status != other.status: return False
7070 return True
7071
7072 def pretty_print(self, q):
7073 q.text("bsn_set_aux_cxns_reply {")
7074 with q.group():
7075 with q.indent(2):
7076 q.breakable()
7077 q.text("xid = ");
7078 if self.xid != None:
7079 q.text("%#x" % self.xid)
7080 else:
7081 q.text('None')
7082 q.text(","); q.breakable()
7083 q.text("num_aux = ");
7084 q.text("%#x" % self.num_aux)
7085 q.text(","); q.breakable()
7086 q.text("status = ");
7087 q.text("%#x" % self.status)
7088 q.breakable()
7089 q.text('}')
7090
7091bsn_header.subtypes[59] = bsn_set_aux_cxns_reply
7092
7093class bsn_set_aux_cxns_request(bsn_header):
7094 version = 4
7095 type = 4
7096 experimenter = 6035143
7097 subtype = 58
7098
7099 def __init__(self, xid=None, num_aux=None):
7100 if xid != None:
7101 self.xid = xid
7102 else:
7103 self.xid = None
7104 if num_aux != None:
7105 self.num_aux = num_aux
7106 else:
7107 self.num_aux = 0
7108 return
7109
7110 def pack(self):
7111 packed = []
7112 packed.append(struct.pack("!B", self.version))
7113 packed.append(struct.pack("!B", self.type))
7114 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7115 packed.append(struct.pack("!L", self.xid))
7116 packed.append(struct.pack("!L", self.experimenter))
7117 packed.append(struct.pack("!L", self.subtype))
7118 packed.append(struct.pack("!L", self.num_aux))
7119 length = sum([len(x) for x in packed])
7120 packed[2] = struct.pack("!H", length)
7121 return ''.join(packed)
7122
7123 @staticmethod
7124 def unpack(reader):
7125 obj = bsn_set_aux_cxns_request()
7126 _version = reader.read("!B")[0]
7127 assert(_version == 4)
7128 _type = reader.read("!B")[0]
7129 assert(_type == 4)
7130 _length = reader.read("!H")[0]
7131 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007132 reader = orig_reader.slice(_length, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -08007133 obj.xid = reader.read("!L")[0]
7134 _experimenter = reader.read("!L")[0]
7135 assert(_experimenter == 6035143)
7136 _subtype = reader.read("!L")[0]
7137 assert(_subtype == 58)
7138 obj.num_aux = reader.read("!L")[0]
7139 return obj
7140
7141 def __eq__(self, other):
7142 if type(self) != type(other): return False
7143 if self.xid != other.xid: return False
7144 if self.num_aux != other.num_aux: return False
7145 return True
7146
7147 def pretty_print(self, q):
7148 q.text("bsn_set_aux_cxns_request {")
7149 with q.group():
7150 with q.indent(2):
7151 q.breakable()
7152 q.text("xid = ");
7153 if self.xid != None:
7154 q.text("%#x" % self.xid)
7155 else:
7156 q.text('None')
7157 q.text(","); q.breakable()
7158 q.text("num_aux = ");
7159 q.text("%#x" % self.num_aux)
7160 q.breakable()
7161 q.text('}')
7162
7163bsn_header.subtypes[58] = bsn_set_aux_cxns_request
7164
Rich Lane7dcdf022013-12-11 14:45:27 -08007165class bsn_set_lacp_reply(bsn_header):
Rich Lane7b0f2012013-11-22 14:15:26 -08007166 version = 4
7167 type = 4
7168 experimenter = 6035143
7169 subtype = 42
7170
7171 def __init__(self, xid=None, status=None, port_no=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007172 if xid != None:
7173 self.xid = xid
7174 else:
7175 self.xid = None
Rich Lane7b0f2012013-11-22 14:15:26 -08007176 if status != None:
7177 self.status = status
7178 else:
7179 self.status = 0
7180 if port_no != None:
7181 self.port_no = port_no
7182 else:
7183 self.port_no = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08007184 return
Rich Lane7b0f2012013-11-22 14:15:26 -08007185
7186 def pack(self):
7187 packed = []
7188 packed.append(struct.pack("!B", self.version))
7189 packed.append(struct.pack("!B", self.type))
7190 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7191 packed.append(struct.pack("!L", self.xid))
7192 packed.append(struct.pack("!L", self.experimenter))
7193 packed.append(struct.pack("!L", self.subtype))
7194 packed.append(struct.pack("!L", self.status))
7195 packed.append(util.pack_port_no(self.port_no))
7196 length = sum([len(x) for x in packed])
7197 packed[2] = struct.pack("!H", length)
7198 return ''.join(packed)
7199
7200 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007201 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -08007202 obj = bsn_set_lacp_reply()
Rich Lane7b0f2012013-11-22 14:15:26 -08007203 _version = reader.read("!B")[0]
7204 assert(_version == 4)
7205 _type = reader.read("!B")[0]
7206 assert(_type == 4)
7207 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007208 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007209 reader = orig_reader.slice(_length, 4)
Rich Lane7b0f2012013-11-22 14:15:26 -08007210 obj.xid = reader.read("!L")[0]
7211 _experimenter = reader.read("!L")[0]
7212 assert(_experimenter == 6035143)
7213 _subtype = reader.read("!L")[0]
7214 assert(_subtype == 42)
7215 obj.status = reader.read("!L")[0]
7216 obj.port_no = util.unpack_port_no(reader)
7217 return obj
7218
7219 def __eq__(self, other):
7220 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -08007221 if self.xid != other.xid: return False
7222 if self.status != other.status: return False
7223 if self.port_no != other.port_no: return False
7224 return True
7225
Rich Lane7b0f2012013-11-22 14:15:26 -08007226 def pretty_print(self, q):
7227 q.text("bsn_set_lacp_reply {")
7228 with q.group():
7229 with q.indent(2):
7230 q.breakable()
7231 q.text("xid = ");
7232 if self.xid != None:
7233 q.text("%#x" % self.xid)
7234 else:
7235 q.text('None')
7236 q.text(","); q.breakable()
7237 q.text("status = ");
7238 q.text("%#x" % self.status)
7239 q.text(","); q.breakable()
7240 q.text("port_no = ");
7241 q.text(util.pretty_port(self.port_no))
7242 q.breakable()
7243 q.text('}')
7244
Rich Lane7dcdf022013-12-11 14:45:27 -08007245bsn_header.subtypes[42] = bsn_set_lacp_reply
7246
7247class bsn_set_lacp_request(bsn_header):
Rich Lane7b0f2012013-11-22 14:15:26 -08007248 version = 4
7249 type = 4
7250 experimenter = 6035143
7251 subtype = 41
7252
7253 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 -08007254 if xid != None:
7255 self.xid = xid
7256 else:
7257 self.xid = None
Rich Lane7b0f2012013-11-22 14:15:26 -08007258 if enabled != None:
7259 self.enabled = enabled
7260 else:
7261 self.enabled = 0
7262 if port_no != None:
7263 self.port_no = port_no
7264 else:
7265 self.port_no = 0
7266 if actor_sys_priority != None:
7267 self.actor_sys_priority = actor_sys_priority
7268 else:
7269 self.actor_sys_priority = 0
7270 if actor_sys_mac != None:
7271 self.actor_sys_mac = actor_sys_mac
7272 else:
7273 self.actor_sys_mac = [0,0,0,0,0,0]
7274 if actor_port_priority != None:
7275 self.actor_port_priority = actor_port_priority
7276 else:
7277 self.actor_port_priority = 0
7278 if actor_port_num != None:
7279 self.actor_port_num = actor_port_num
7280 else:
7281 self.actor_port_num = 0
7282 if actor_key != None:
7283 self.actor_key = actor_key
7284 else:
7285 self.actor_key = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08007286 return
Rich Lane7b0f2012013-11-22 14:15:26 -08007287
7288 def pack(self):
7289 packed = []
7290 packed.append(struct.pack("!B", self.version))
7291 packed.append(struct.pack("!B", self.type))
7292 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7293 packed.append(struct.pack("!L", self.xid))
7294 packed.append(struct.pack("!L", self.experimenter))
7295 packed.append(struct.pack("!L", self.subtype))
7296 packed.append(struct.pack("!B", self.enabled))
7297 packed.append('\x00' * 3)
7298 packed.append(util.pack_port_no(self.port_no))
7299 packed.append(struct.pack("!H", self.actor_sys_priority))
7300 packed.append(struct.pack("!6B", *self.actor_sys_mac))
7301 packed.append(struct.pack("!H", self.actor_port_priority))
7302 packed.append(struct.pack("!H", self.actor_port_num))
7303 packed.append(struct.pack("!H", self.actor_key))
7304 length = sum([len(x) for x in packed])
7305 packed[2] = struct.pack("!H", length)
7306 return ''.join(packed)
7307
7308 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007309 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -08007310 obj = bsn_set_lacp_request()
Rich Lane7b0f2012013-11-22 14:15:26 -08007311 _version = reader.read("!B")[0]
7312 assert(_version == 4)
7313 _type = reader.read("!B")[0]
7314 assert(_type == 4)
7315 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007316 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007317 reader = orig_reader.slice(_length, 4)
Rich Lane7b0f2012013-11-22 14:15:26 -08007318 obj.xid = reader.read("!L")[0]
7319 _experimenter = reader.read("!L")[0]
7320 assert(_experimenter == 6035143)
7321 _subtype = reader.read("!L")[0]
7322 assert(_subtype == 41)
7323 obj.enabled = reader.read("!B")[0]
7324 reader.skip(3)
7325 obj.port_no = util.unpack_port_no(reader)
7326 obj.actor_sys_priority = reader.read("!H")[0]
7327 obj.actor_sys_mac = list(reader.read('!6B'))
7328 obj.actor_port_priority = reader.read("!H")[0]
7329 obj.actor_port_num = reader.read("!H")[0]
7330 obj.actor_key = reader.read("!H")[0]
7331 return obj
7332
7333 def __eq__(self, other):
7334 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -08007335 if self.xid != other.xid: return False
7336 if self.enabled != other.enabled: return False
7337 if self.port_no != other.port_no: return False
7338 if self.actor_sys_priority != other.actor_sys_priority: return False
7339 if self.actor_sys_mac != other.actor_sys_mac: return False
7340 if self.actor_port_priority != other.actor_port_priority: return False
7341 if self.actor_port_num != other.actor_port_num: return False
7342 if self.actor_key != other.actor_key: return False
7343 return True
7344
Rich Lane7b0f2012013-11-22 14:15:26 -08007345 def pretty_print(self, q):
7346 q.text("bsn_set_lacp_request {")
7347 with q.group():
7348 with q.indent(2):
7349 q.breakable()
7350 q.text("xid = ");
7351 if self.xid != None:
7352 q.text("%#x" % self.xid)
7353 else:
7354 q.text('None')
7355 q.text(","); q.breakable()
7356 q.text("enabled = ");
7357 q.text("%#x" % self.enabled)
7358 q.text(","); q.breakable()
7359 q.text("port_no = ");
7360 q.text(util.pretty_port(self.port_no))
7361 q.text(","); q.breakable()
7362 q.text("actor_sys_priority = ");
7363 q.text("%#x" % self.actor_sys_priority)
7364 q.text(","); q.breakable()
7365 q.text("actor_sys_mac = ");
7366 q.text(util.pretty_mac(self.actor_sys_mac))
7367 q.text(","); q.breakable()
7368 q.text("actor_port_priority = ");
7369 q.text("%#x" % self.actor_port_priority)
7370 q.text(","); q.breakable()
7371 q.text("actor_port_num = ");
7372 q.text("%#x" % self.actor_port_num)
7373 q.text(","); q.breakable()
7374 q.text("actor_key = ");
7375 q.text("%#x" % self.actor_key)
7376 q.breakable()
7377 q.text('}')
7378
Rich Lane7dcdf022013-12-11 14:45:27 -08007379bsn_header.subtypes[41] = bsn_set_lacp_request
7380
7381class bsn_set_mirroring(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07007382 version = 4
7383 type = 4
7384 experimenter = 6035143
Rich Lanec2ee4b82013-04-24 17:12:38 -07007385 subtype = 3
7386
7387 def __init__(self, xid=None, report_mirror_ports=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007388 if xid != None:
7389 self.xid = xid
7390 else:
7391 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07007392 if report_mirror_ports != None:
7393 self.report_mirror_ports = report_mirror_ports
7394 else:
7395 self.report_mirror_ports = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08007396 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07007397
7398 def pack(self):
7399 packed = []
7400 packed.append(struct.pack("!B", self.version))
7401 packed.append(struct.pack("!B", self.type))
7402 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7403 packed.append(struct.pack("!L", self.xid))
7404 packed.append(struct.pack("!L", self.experimenter))
7405 packed.append(struct.pack("!L", self.subtype))
7406 packed.append(struct.pack("!B", self.report_mirror_ports))
7407 packed.append('\x00' * 3)
7408 length = sum([len(x) for x in packed])
7409 packed[2] = struct.pack("!H", length)
7410 return ''.join(packed)
7411
7412 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007413 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07007414 obj = bsn_set_mirroring()
Dan Talaycof6202252013-07-02 01:00:29 -07007415 _version = reader.read("!B")[0]
7416 assert(_version == 4)
7417 _type = reader.read("!B")[0]
7418 assert(_type == 4)
7419 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007420 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007421 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07007422 obj.xid = reader.read("!L")[0]
7423 _experimenter = reader.read("!L")[0]
7424 assert(_experimenter == 6035143)
7425 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007426 assert(_subtype == 3)
Dan Talaycof6202252013-07-02 01:00:29 -07007427 obj.report_mirror_ports = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007428 reader.skip(3)
7429 return obj
7430
7431 def __eq__(self, other):
7432 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07007433 if self.xid != other.xid: return False
7434 if self.report_mirror_ports != other.report_mirror_ports: return False
7435 return True
7436
Rich Lanec2ee4b82013-04-24 17:12:38 -07007437 def pretty_print(self, q):
7438 q.text("bsn_set_mirroring {")
7439 with q.group():
7440 with q.indent(2):
7441 q.breakable()
7442 q.text("xid = ");
7443 if self.xid != None:
7444 q.text("%#x" % self.xid)
7445 else:
7446 q.text('None')
7447 q.text(","); q.breakable()
7448 q.text("report_mirror_ports = ");
7449 q.text("%#x" % self.report_mirror_ports)
7450 q.breakable()
7451 q.text('}')
7452
Rich Lane7dcdf022013-12-11 14:45:27 -08007453bsn_header.subtypes[3] = bsn_set_mirroring
7454
7455class bsn_set_pktin_suppression_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07007456 version = 4
7457 type = 4
7458 experimenter = 6035143
7459 subtype = 25
7460
7461 def __init__(self, xid=None, status=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007462 if xid != None:
7463 self.xid = xid
7464 else:
7465 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07007466 if status != None:
7467 self.status = status
7468 else:
7469 self.status = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08007470 return
Dan Talaycof6202252013-07-02 01:00:29 -07007471
7472 def pack(self):
7473 packed = []
7474 packed.append(struct.pack("!B", self.version))
7475 packed.append(struct.pack("!B", self.type))
7476 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7477 packed.append(struct.pack("!L", self.xid))
7478 packed.append(struct.pack("!L", self.experimenter))
7479 packed.append(struct.pack("!L", self.subtype))
7480 packed.append(struct.pack("!L", self.status))
7481 length = sum([len(x) for x in packed])
7482 packed[2] = struct.pack("!H", length)
7483 return ''.join(packed)
7484
7485 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007486 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07007487 obj = bsn_set_pktin_suppression_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07007488 _version = reader.read("!B")[0]
7489 assert(_version == 4)
7490 _type = reader.read("!B")[0]
7491 assert(_type == 4)
7492 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007493 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007494 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07007495 obj.xid = reader.read("!L")[0]
7496 _experimenter = reader.read("!L")[0]
7497 assert(_experimenter == 6035143)
7498 _subtype = reader.read("!L")[0]
7499 assert(_subtype == 25)
7500 obj.status = reader.read("!L")[0]
7501 return obj
7502
7503 def __eq__(self, other):
7504 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07007505 if self.xid != other.xid: return False
7506 if self.status != other.status: return False
7507 return True
7508
Dan Talaycof6202252013-07-02 01:00:29 -07007509 def pretty_print(self, q):
7510 q.text("bsn_set_pktin_suppression_reply {")
7511 with q.group():
7512 with q.indent(2):
7513 q.breakable()
7514 q.text("xid = ");
7515 if self.xid != None:
7516 q.text("%#x" % self.xid)
7517 else:
7518 q.text('None')
7519 q.text(","); q.breakable()
7520 q.text("status = ");
7521 q.text("%#x" % self.status)
7522 q.breakable()
7523 q.text('}')
7524
Rich Lane7dcdf022013-12-11 14:45:27 -08007525bsn_header.subtypes[25] = bsn_set_pktin_suppression_reply
7526
7527class bsn_set_pktin_suppression_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07007528 version = 4
7529 type = 4
7530 experimenter = 6035143
Rich Lanec2ee4b82013-04-24 17:12:38 -07007531 subtype = 11
7532
7533 def __init__(self, xid=None, enabled=None, idle_timeout=None, hard_timeout=None, priority=None, cookie=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007534 if xid != None:
7535 self.xid = xid
7536 else:
7537 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07007538 if enabled != None:
7539 self.enabled = enabled
7540 else:
7541 self.enabled = 0
7542 if idle_timeout != None:
7543 self.idle_timeout = idle_timeout
7544 else:
7545 self.idle_timeout = 0
7546 if hard_timeout != None:
7547 self.hard_timeout = hard_timeout
7548 else:
7549 self.hard_timeout = 0
7550 if priority != None:
7551 self.priority = priority
7552 else:
7553 self.priority = 0
7554 if cookie != None:
7555 self.cookie = cookie
7556 else:
7557 self.cookie = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08007558 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07007559
7560 def pack(self):
7561 packed = []
7562 packed.append(struct.pack("!B", self.version))
7563 packed.append(struct.pack("!B", self.type))
7564 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7565 packed.append(struct.pack("!L", self.xid))
7566 packed.append(struct.pack("!L", self.experimenter))
7567 packed.append(struct.pack("!L", self.subtype))
7568 packed.append(struct.pack("!B", self.enabled))
7569 packed.append('\x00' * 1)
7570 packed.append(struct.pack("!H", self.idle_timeout))
7571 packed.append(struct.pack("!H", self.hard_timeout))
7572 packed.append(struct.pack("!H", self.priority))
7573 packed.append(struct.pack("!Q", self.cookie))
7574 length = sum([len(x) for x in packed])
7575 packed[2] = struct.pack("!H", length)
7576 return ''.join(packed)
7577
7578 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007579 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07007580 obj = bsn_set_pktin_suppression_request()
Dan Talaycof6202252013-07-02 01:00:29 -07007581 _version = reader.read("!B")[0]
7582 assert(_version == 4)
7583 _type = reader.read("!B")[0]
7584 assert(_type == 4)
7585 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007586 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007587 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07007588 obj.xid = reader.read("!L")[0]
7589 _experimenter = reader.read("!L")[0]
7590 assert(_experimenter == 6035143)
7591 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007592 assert(_subtype == 11)
Dan Talaycof6202252013-07-02 01:00:29 -07007593 obj.enabled = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007594 reader.skip(1)
Dan Talaycof6202252013-07-02 01:00:29 -07007595 obj.idle_timeout = reader.read("!H")[0]
7596 obj.hard_timeout = reader.read("!H")[0]
7597 obj.priority = reader.read("!H")[0]
7598 obj.cookie = reader.read("!Q")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007599 return obj
7600
7601 def __eq__(self, other):
7602 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07007603 if self.xid != other.xid: return False
7604 if self.enabled != other.enabled: return False
7605 if self.idle_timeout != other.idle_timeout: return False
7606 if self.hard_timeout != other.hard_timeout: return False
7607 if self.priority != other.priority: return False
7608 if self.cookie != other.cookie: return False
7609 return True
7610
Rich Lanec2ee4b82013-04-24 17:12:38 -07007611 def pretty_print(self, q):
Dan Talaycof6202252013-07-02 01:00:29 -07007612 q.text("bsn_set_pktin_suppression_request {")
Rich Lanec2ee4b82013-04-24 17:12:38 -07007613 with q.group():
7614 with q.indent(2):
7615 q.breakable()
7616 q.text("xid = ");
7617 if self.xid != None:
7618 q.text("%#x" % self.xid)
7619 else:
7620 q.text('None')
7621 q.text(","); q.breakable()
7622 q.text("enabled = ");
7623 q.text("%#x" % self.enabled)
7624 q.text(","); q.breakable()
7625 q.text("idle_timeout = ");
7626 q.text("%#x" % self.idle_timeout)
7627 q.text(","); q.breakable()
7628 q.text("hard_timeout = ");
7629 q.text("%#x" % self.hard_timeout)
7630 q.text(","); q.breakable()
7631 q.text("priority = ");
7632 q.text("%#x" % self.priority)
7633 q.text(","); q.breakable()
7634 q.text("cookie = ");
7635 q.text("%#x" % self.cookie)
7636 q.breakable()
7637 q.text('}')
7638
Rich Lane7dcdf022013-12-11 14:45:27 -08007639bsn_header.subtypes[11] = bsn_set_pktin_suppression_request
7640
7641class bsn_set_switch_pipeline_reply(bsn_header):
7642 version = 4
7643 type = 4
7644 experimenter = 6035143
7645 subtype = 54
7646
7647 def __init__(self, xid=None, status=None):
7648 if xid != None:
7649 self.xid = xid
7650 else:
7651 self.xid = None
7652 if status != None:
7653 self.status = status
7654 else:
7655 self.status = 0
7656 return
7657
7658 def pack(self):
7659 packed = []
7660 packed.append(struct.pack("!B", self.version))
7661 packed.append(struct.pack("!B", self.type))
7662 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7663 packed.append(struct.pack("!L", self.xid))
7664 packed.append(struct.pack("!L", self.experimenter))
7665 packed.append(struct.pack("!L", self.subtype))
7666 packed.append(struct.pack("!L", self.status))
7667 length = sum([len(x) for x in packed])
7668 packed[2] = struct.pack("!H", length)
7669 return ''.join(packed)
7670
7671 @staticmethod
7672 def unpack(reader):
7673 obj = bsn_set_switch_pipeline_reply()
7674 _version = reader.read("!B")[0]
7675 assert(_version == 4)
7676 _type = reader.read("!B")[0]
7677 assert(_type == 4)
7678 _length = reader.read("!H")[0]
7679 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007680 reader = orig_reader.slice(_length, 4)
Rich Lane7dcdf022013-12-11 14:45:27 -08007681 obj.xid = reader.read("!L")[0]
7682 _experimenter = reader.read("!L")[0]
7683 assert(_experimenter == 6035143)
7684 _subtype = reader.read("!L")[0]
7685 assert(_subtype == 54)
7686 obj.status = reader.read("!L")[0]
7687 return obj
7688
7689 def __eq__(self, other):
7690 if type(self) != type(other): return False
7691 if self.xid != other.xid: return False
7692 if self.status != other.status: return False
7693 return True
7694
7695 def pretty_print(self, q):
7696 q.text("bsn_set_switch_pipeline_reply {")
7697 with q.group():
7698 with q.indent(2):
7699 q.breakable()
7700 q.text("xid = ");
7701 if self.xid != None:
7702 q.text("%#x" % self.xid)
7703 else:
7704 q.text('None')
7705 q.text(","); q.breakable()
7706 q.text("status = ");
7707 q.text("%#x" % self.status)
7708 q.breakable()
7709 q.text('}')
7710
7711bsn_header.subtypes[54] = bsn_set_switch_pipeline_reply
7712
7713class bsn_set_switch_pipeline_request(bsn_header):
7714 version = 4
7715 type = 4
7716 experimenter = 6035143
7717 subtype = 53
7718
7719 def __init__(self, xid=None, pipeline=None):
7720 if xid != None:
7721 self.xid = xid
7722 else:
7723 self.xid = None
7724 if pipeline != None:
7725 self.pipeline = pipeline
7726 else:
7727 self.pipeline = ""
7728 return
7729
7730 def pack(self):
7731 packed = []
7732 packed.append(struct.pack("!B", self.version))
7733 packed.append(struct.pack("!B", self.type))
7734 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7735 packed.append(struct.pack("!L", self.xid))
7736 packed.append(struct.pack("!L", self.experimenter))
7737 packed.append(struct.pack("!L", self.subtype))
7738 packed.append(struct.pack("!256s", self.pipeline))
7739 length = sum([len(x) for x in packed])
7740 packed[2] = struct.pack("!H", length)
7741 return ''.join(packed)
7742
7743 @staticmethod
7744 def unpack(reader):
7745 obj = bsn_set_switch_pipeline_request()
7746 _version = reader.read("!B")[0]
7747 assert(_version == 4)
7748 _type = reader.read("!B")[0]
7749 assert(_type == 4)
7750 _length = reader.read("!H")[0]
7751 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007752 reader = orig_reader.slice(_length, 4)
Rich Lane7dcdf022013-12-11 14:45:27 -08007753 obj.xid = reader.read("!L")[0]
7754 _experimenter = reader.read("!L")[0]
7755 assert(_experimenter == 6035143)
7756 _subtype = reader.read("!L")[0]
7757 assert(_subtype == 53)
7758 obj.pipeline = reader.read("!256s")[0].rstrip("\x00")
7759 return obj
7760
7761 def __eq__(self, other):
7762 if type(self) != type(other): return False
7763 if self.xid != other.xid: return False
7764 if self.pipeline != other.pipeline: return False
7765 return True
7766
7767 def pretty_print(self, q):
7768 q.text("bsn_set_switch_pipeline_request {")
7769 with q.group():
7770 with q.indent(2):
7771 q.breakable()
7772 q.text("xid = ");
7773 if self.xid != None:
7774 q.text("%#x" % self.xid)
7775 else:
7776 q.text('None')
7777 q.text(","); q.breakable()
7778 q.text("pipeline = ");
7779 q.pp(self.pipeline)
7780 q.breakable()
7781 q.text('}')
7782
7783bsn_header.subtypes[53] = bsn_set_switch_pipeline_request
7784
7785class bsn_switch_pipeline_stats_reply(bsn_stats_reply):
7786 version = 4
7787 type = 19
7788 stats_type = 65535
7789 experimenter = 6035143
7790 subtype = 6
7791
7792 def __init__(self, xid=None, flags=None, entries=None):
7793 if xid != None:
7794 self.xid = xid
7795 else:
7796 self.xid = None
7797 if flags != None:
7798 self.flags = flags
7799 else:
7800 self.flags = 0
7801 if entries != None:
7802 self.entries = entries
7803 else:
7804 self.entries = []
7805 return
7806
7807 def pack(self):
7808 packed = []
7809 packed.append(struct.pack("!B", self.version))
7810 packed.append(struct.pack("!B", self.type))
7811 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7812 packed.append(struct.pack("!L", self.xid))
7813 packed.append(struct.pack("!H", self.stats_type))
7814 packed.append(struct.pack("!H", self.flags))
7815 packed.append('\x00' * 4)
7816 packed.append(struct.pack("!L", self.experimenter))
7817 packed.append(struct.pack("!L", self.subtype))
7818 packed.append(loxi.generic_util.pack_list(self.entries))
7819 length = sum([len(x) for x in packed])
7820 packed[2] = struct.pack("!H", length)
7821 return ''.join(packed)
7822
7823 @staticmethod
7824 def unpack(reader):
7825 obj = bsn_switch_pipeline_stats_reply()
7826 _version = reader.read("!B")[0]
7827 assert(_version == 4)
7828 _type = reader.read("!B")[0]
7829 assert(_type == 19)
7830 _length = reader.read("!H")[0]
7831 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007832 reader = orig_reader.slice(_length, 4)
Rich Lane7dcdf022013-12-11 14:45:27 -08007833 obj.xid = reader.read("!L")[0]
7834 _stats_type = reader.read("!H")[0]
7835 assert(_stats_type == 65535)
7836 obj.flags = reader.read("!H")[0]
7837 reader.skip(4)
7838 _experimenter = reader.read("!L")[0]
7839 assert(_experimenter == 6035143)
7840 _subtype = reader.read("!L")[0]
7841 assert(_subtype == 6)
Rich Lanee2567702015-01-26 15:04:35 -08007842 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_switch_pipeline_stats_entry.unpack)
Rich Lane7dcdf022013-12-11 14:45:27 -08007843 return obj
7844
7845 def __eq__(self, other):
7846 if type(self) != type(other): return False
7847 if self.xid != other.xid: return False
7848 if self.flags != other.flags: return False
7849 if self.entries != other.entries: return False
7850 return True
7851
7852 def pretty_print(self, q):
7853 q.text("bsn_switch_pipeline_stats_reply {")
7854 with q.group():
7855 with q.indent(2):
7856 q.breakable()
7857 q.text("xid = ");
7858 if self.xid != None:
7859 q.text("%#x" % self.xid)
7860 else:
7861 q.text('None')
7862 q.text(","); q.breakable()
7863 q.text("flags = ");
7864 q.text("%#x" % self.flags)
7865 q.text(","); q.breakable()
7866 q.text("entries = ");
7867 q.pp(self.entries)
7868 q.breakable()
7869 q.text('}')
7870
7871bsn_stats_reply.subtypes[6] = bsn_switch_pipeline_stats_reply
7872
7873class bsn_switch_pipeline_stats_request(bsn_stats_request):
7874 version = 4
7875 type = 18
7876 stats_type = 65535
7877 experimenter = 6035143
7878 subtype = 6
7879
7880 def __init__(self, xid=None, flags=None):
7881 if xid != None:
7882 self.xid = xid
7883 else:
7884 self.xid = None
7885 if flags != None:
7886 self.flags = flags
7887 else:
7888 self.flags = 0
7889 return
7890
7891 def pack(self):
7892 packed = []
7893 packed.append(struct.pack("!B", self.version))
7894 packed.append(struct.pack("!B", self.type))
7895 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7896 packed.append(struct.pack("!L", self.xid))
7897 packed.append(struct.pack("!H", self.stats_type))
7898 packed.append(struct.pack("!H", self.flags))
7899 packed.append('\x00' * 4)
7900 packed.append(struct.pack("!L", self.experimenter))
7901 packed.append(struct.pack("!L", self.subtype))
7902 length = sum([len(x) for x in packed])
7903 packed[2] = struct.pack("!H", length)
7904 return ''.join(packed)
7905
7906 @staticmethod
7907 def unpack(reader):
7908 obj = bsn_switch_pipeline_stats_request()
7909 _version = reader.read("!B")[0]
7910 assert(_version == 4)
7911 _type = reader.read("!B")[0]
7912 assert(_type == 18)
7913 _length = reader.read("!H")[0]
7914 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007915 reader = orig_reader.slice(_length, 4)
Rich Lane7dcdf022013-12-11 14:45:27 -08007916 obj.xid = reader.read("!L")[0]
7917 _stats_type = reader.read("!H")[0]
7918 assert(_stats_type == 65535)
7919 obj.flags = reader.read("!H")[0]
7920 reader.skip(4)
7921 _experimenter = reader.read("!L")[0]
7922 assert(_experimenter == 6035143)
7923 _subtype = reader.read("!L")[0]
7924 assert(_subtype == 6)
7925 return obj
7926
7927 def __eq__(self, other):
7928 if type(self) != type(other): return False
7929 if self.xid != other.xid: return False
7930 if self.flags != other.flags: return False
7931 return True
7932
7933 def pretty_print(self, q):
7934 q.text("bsn_switch_pipeline_stats_request {")
7935 with q.group():
7936 with q.indent(2):
7937 q.breakable()
7938 q.text("xid = ");
7939 if self.xid != None:
7940 q.text("%#x" % self.xid)
7941 else:
7942 q.text('None')
7943 q.text(","); q.breakable()
7944 q.text("flags = ");
7945 q.text("%#x" % self.flags)
7946 q.breakable()
7947 q.text('}')
7948
7949bsn_stats_request.subtypes[6] = bsn_switch_pipeline_stats_request
7950
Rich Lane9ec3fca2014-02-26 16:22:56 -08007951class bsn_table_checksum_stats_reply(bsn_stats_reply):
7952 version = 4
7953 type = 19
7954 stats_type = 65535
7955 experimenter = 6035143
7956 subtype = 11
7957
7958 def __init__(self, xid=None, flags=None, entries=None):
7959 if xid != None:
7960 self.xid = xid
7961 else:
7962 self.xid = None
7963 if flags != None:
7964 self.flags = flags
7965 else:
7966 self.flags = 0
7967 if entries != None:
7968 self.entries = entries
7969 else:
7970 self.entries = []
7971 return
7972
7973 def pack(self):
7974 packed = []
7975 packed.append(struct.pack("!B", self.version))
7976 packed.append(struct.pack("!B", self.type))
7977 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7978 packed.append(struct.pack("!L", self.xid))
7979 packed.append(struct.pack("!H", self.stats_type))
7980 packed.append(struct.pack("!H", self.flags))
7981 packed.append('\x00' * 4)
7982 packed.append(struct.pack("!L", self.experimenter))
7983 packed.append(struct.pack("!L", self.subtype))
7984 packed.append(loxi.generic_util.pack_list(self.entries))
7985 length = sum([len(x) for x in packed])
7986 packed[2] = struct.pack("!H", length)
7987 return ''.join(packed)
7988
7989 @staticmethod
7990 def unpack(reader):
7991 obj = bsn_table_checksum_stats_reply()
7992 _version = reader.read("!B")[0]
7993 assert(_version == 4)
7994 _type = reader.read("!B")[0]
7995 assert(_type == 19)
7996 _length = reader.read("!H")[0]
7997 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007998 reader = orig_reader.slice(_length, 4)
Rich Lane9ec3fca2014-02-26 16:22:56 -08007999 obj.xid = reader.read("!L")[0]
8000 _stats_type = reader.read("!H")[0]
8001 assert(_stats_type == 65535)
8002 obj.flags = reader.read("!H")[0]
8003 reader.skip(4)
8004 _experimenter = reader.read("!L")[0]
8005 assert(_experimenter == 6035143)
8006 _subtype = reader.read("!L")[0]
8007 assert(_subtype == 11)
Rich Lanee2567702015-01-26 15:04:35 -08008008 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_table_checksum_stats_entry.unpack)
Rich Lane9ec3fca2014-02-26 16:22:56 -08008009 return obj
8010
8011 def __eq__(self, other):
8012 if type(self) != type(other): return False
8013 if self.xid != other.xid: return False
8014 if self.flags != other.flags: return False
8015 if self.entries != other.entries: return False
8016 return True
8017
8018 def pretty_print(self, q):
8019 q.text("bsn_table_checksum_stats_reply {")
8020 with q.group():
8021 with q.indent(2):
8022 q.breakable()
8023 q.text("xid = ");
8024 if self.xid != None:
8025 q.text("%#x" % self.xid)
8026 else:
8027 q.text('None')
8028 q.text(","); q.breakable()
8029 q.text("flags = ");
8030 q.text("%#x" % self.flags)
8031 q.text(","); q.breakable()
8032 q.text("entries = ");
8033 q.pp(self.entries)
8034 q.breakable()
8035 q.text('}')
8036
8037bsn_stats_reply.subtypes[11] = bsn_table_checksum_stats_reply
8038
8039class bsn_table_checksum_stats_request(bsn_stats_request):
8040 version = 4
8041 type = 18
8042 stats_type = 65535
8043 experimenter = 6035143
8044 subtype = 11
8045
8046 def __init__(self, xid=None, flags=None):
8047 if xid != None:
8048 self.xid = xid
8049 else:
8050 self.xid = None
8051 if flags != None:
8052 self.flags = flags
8053 else:
8054 self.flags = 0
8055 return
8056
8057 def pack(self):
8058 packed = []
8059 packed.append(struct.pack("!B", self.version))
8060 packed.append(struct.pack("!B", self.type))
8061 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8062 packed.append(struct.pack("!L", self.xid))
8063 packed.append(struct.pack("!H", self.stats_type))
8064 packed.append(struct.pack("!H", self.flags))
8065 packed.append('\x00' * 4)
8066 packed.append(struct.pack("!L", self.experimenter))
8067 packed.append(struct.pack("!L", self.subtype))
8068 length = sum([len(x) for x in packed])
8069 packed[2] = struct.pack("!H", length)
8070 return ''.join(packed)
8071
8072 @staticmethod
8073 def unpack(reader):
8074 obj = bsn_table_checksum_stats_request()
8075 _version = reader.read("!B")[0]
8076 assert(_version == 4)
8077 _type = reader.read("!B")[0]
8078 assert(_type == 18)
8079 _length = reader.read("!H")[0]
8080 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08008081 reader = orig_reader.slice(_length, 4)
Rich Lane9ec3fca2014-02-26 16:22:56 -08008082 obj.xid = reader.read("!L")[0]
8083 _stats_type = reader.read("!H")[0]
8084 assert(_stats_type == 65535)
8085 obj.flags = reader.read("!H")[0]
8086 reader.skip(4)
8087 _experimenter = reader.read("!L")[0]
8088 assert(_experimenter == 6035143)
8089 _subtype = reader.read("!L")[0]
8090 assert(_subtype == 11)
8091 return obj
8092
8093 def __eq__(self, other):
8094 if type(self) != type(other): return False
8095 if self.xid != other.xid: return False
8096 if self.flags != other.flags: return False
8097 return True
8098
8099 def pretty_print(self, q):
8100 q.text("bsn_table_checksum_stats_request {")
8101 with q.group():
8102 with q.indent(2):
8103 q.breakable()
8104 q.text("xid = ");
8105 if self.xid != None:
8106 q.text("%#x" % self.xid)
8107 else:
8108 q.text('None')
8109 q.text(","); q.breakable()
8110 q.text("flags = ");
8111 q.text("%#x" % self.flags)
8112 q.breakable()
8113 q.text('}')
8114
8115bsn_stats_request.subtypes[11] = bsn_table_checksum_stats_request
8116
8117class bsn_table_set_buckets_size(bsn_header):
8118 version = 4
8119 type = 4
8120 experimenter = 6035143
8121 subtype = 61
8122
8123 def __init__(self, xid=None, table_id=None, buckets_size=None):
8124 if xid != None:
8125 self.xid = xid
8126 else:
8127 self.xid = None
8128 if table_id != None:
8129 self.table_id = table_id
8130 else:
8131 self.table_id = 0
8132 if buckets_size != None:
8133 self.buckets_size = buckets_size
8134 else:
8135 self.buckets_size = 0
8136 return
8137
8138 def pack(self):
8139 packed = []
8140 packed.append(struct.pack("!B", self.version))
8141 packed.append(struct.pack("!B", self.type))
8142 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8143 packed.append(struct.pack("!L", self.xid))
8144 packed.append(struct.pack("!L", self.experimenter))
8145 packed.append(struct.pack("!L", self.subtype))
Rich Lane5587ab12014-06-30 11:19:09 -07008146 packed.append('\x00' * 1)
8147 packed.append(struct.pack("!B", self.table_id))
Rich Lane9ec3fca2014-02-26 16:22:56 -08008148 packed.append('\x00' * 2)
8149 packed.append(struct.pack("!L", self.buckets_size))
8150 length = sum([len(x) for x in packed])
8151 packed[2] = struct.pack("!H", length)
8152 return ''.join(packed)
8153
8154 @staticmethod
8155 def unpack(reader):
8156 obj = bsn_table_set_buckets_size()
8157 _version = reader.read("!B")[0]
8158 assert(_version == 4)
8159 _type = reader.read("!B")[0]
8160 assert(_type == 4)
8161 _length = reader.read("!H")[0]
8162 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08008163 reader = orig_reader.slice(_length, 4)
Rich Lane9ec3fca2014-02-26 16:22:56 -08008164 obj.xid = reader.read("!L")[0]
8165 _experimenter = reader.read("!L")[0]
8166 assert(_experimenter == 6035143)
8167 _subtype = reader.read("!L")[0]
8168 assert(_subtype == 61)
Rich Lane5587ab12014-06-30 11:19:09 -07008169 reader.skip(1)
8170 obj.table_id = reader.read("!B")[0]
Rich Lane9ec3fca2014-02-26 16:22:56 -08008171 reader.skip(2)
8172 obj.buckets_size = reader.read("!L")[0]
8173 return obj
8174
8175 def __eq__(self, other):
8176 if type(self) != type(other): return False
8177 if self.xid != other.xid: return False
8178 if self.table_id != other.table_id: return False
8179 if self.buckets_size != other.buckets_size: return False
8180 return True
8181
8182 def pretty_print(self, q):
8183 q.text("bsn_table_set_buckets_size {")
8184 with q.group():
8185 with q.indent(2):
8186 q.breakable()
8187 q.text("xid = ");
8188 if self.xid != None:
8189 q.text("%#x" % self.xid)
8190 else:
8191 q.text('None')
8192 q.text(","); q.breakable()
8193 q.text("table_id = ");
8194 q.text("%#x" % self.table_id)
8195 q.text(","); q.breakable()
8196 q.text("buckets_size = ");
8197 q.text("%#x" % self.buckets_size)
8198 q.breakable()
8199 q.text('}')
8200
8201bsn_header.subtypes[61] = bsn_table_set_buckets_size
8202
Rich Lane7dcdf022013-12-11 14:45:27 -08008203class bsn_time_reply(bsn_header):
Rich Lane7b0f2012013-11-22 14:15:26 -08008204 version = 4
8205 type = 4
8206 experimenter = 6035143
8207 subtype = 45
8208
8209 def __init__(self, xid=None, time_ms=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08008210 if xid != None:
8211 self.xid = xid
8212 else:
8213 self.xid = None
Rich Lane7b0f2012013-11-22 14:15:26 -08008214 if time_ms != None:
8215 self.time_ms = time_ms
8216 else:
8217 self.time_ms = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08008218 return
Rich Lane7b0f2012013-11-22 14:15:26 -08008219
8220 def pack(self):
8221 packed = []
8222 packed.append(struct.pack("!B", self.version))
8223 packed.append(struct.pack("!B", self.type))
8224 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8225 packed.append(struct.pack("!L", self.xid))
8226 packed.append(struct.pack("!L", self.experimenter))
8227 packed.append(struct.pack("!L", self.subtype))
8228 packed.append(struct.pack("!Q", self.time_ms))
8229 length = sum([len(x) for x in packed])
8230 packed[2] = struct.pack("!H", length)
8231 return ''.join(packed)
8232
8233 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08008234 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -08008235 obj = bsn_time_reply()
Rich Lane7b0f2012013-11-22 14:15:26 -08008236 _version = reader.read("!B")[0]
8237 assert(_version == 4)
8238 _type = reader.read("!B")[0]
8239 assert(_type == 4)
8240 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08008241 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08008242 reader = orig_reader.slice(_length, 4)
Rich Lane7b0f2012013-11-22 14:15:26 -08008243 obj.xid = reader.read("!L")[0]
8244 _experimenter = reader.read("!L")[0]
8245 assert(_experimenter == 6035143)
8246 _subtype = reader.read("!L")[0]
8247 assert(_subtype == 45)
8248 obj.time_ms = reader.read("!Q")[0]
8249 return obj
8250
8251 def __eq__(self, other):
8252 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -08008253 if self.xid != other.xid: return False
8254 if self.time_ms != other.time_ms: return False
8255 return True
8256
Rich Lane7b0f2012013-11-22 14:15:26 -08008257 def pretty_print(self, q):
8258 q.text("bsn_time_reply {")
8259 with q.group():
8260 with q.indent(2):
8261 q.breakable()
8262 q.text("xid = ");
8263 if self.xid != None:
8264 q.text("%#x" % self.xid)
8265 else:
8266 q.text('None')
8267 q.text(","); q.breakable()
8268 q.text("time_ms = ");
8269 q.text("%#x" % self.time_ms)
8270 q.breakable()
8271 q.text('}')
8272
Rich Lane7dcdf022013-12-11 14:45:27 -08008273bsn_header.subtypes[45] = bsn_time_reply
8274
8275class bsn_time_request(bsn_header):
Rich Lane7b0f2012013-11-22 14:15:26 -08008276 version = 4
8277 type = 4
8278 experimenter = 6035143
8279 subtype = 44
8280
8281 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08008282 if xid != None:
8283 self.xid = xid
8284 else:
8285 self.xid = None
8286 return
Rich Lane7b0f2012013-11-22 14:15:26 -08008287
8288 def pack(self):
8289 packed = []
8290 packed.append(struct.pack("!B", self.version))
8291 packed.append(struct.pack("!B", self.type))
8292 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8293 packed.append(struct.pack("!L", self.xid))
8294 packed.append(struct.pack("!L", self.experimenter))
8295 packed.append(struct.pack("!L", self.subtype))
8296 length = sum([len(x) for x in packed])
8297 packed[2] = struct.pack("!H", length)
8298 return ''.join(packed)
8299
8300 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08008301 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -08008302 obj = bsn_time_request()
Rich Lane7b0f2012013-11-22 14:15:26 -08008303 _version = reader.read("!B")[0]
8304 assert(_version == 4)
8305 _type = reader.read("!B")[0]
8306 assert(_type == 4)
8307 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08008308 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08008309 reader = orig_reader.slice(_length, 4)
Rich Lane7b0f2012013-11-22 14:15:26 -08008310 obj.xid = reader.read("!L")[0]
8311 _experimenter = reader.read("!L")[0]
8312 assert(_experimenter == 6035143)
8313 _subtype = reader.read("!L")[0]
8314 assert(_subtype == 44)
8315 return obj
8316
8317 def __eq__(self, other):
8318 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -08008319 if self.xid != other.xid: return False
8320 return True
8321
Rich Lane7b0f2012013-11-22 14:15:26 -08008322 def pretty_print(self, q):
8323 q.text("bsn_time_request {")
8324 with q.group():
8325 with q.indent(2):
8326 q.breakable()
8327 q.text("xid = ");
8328 if self.xid != None:
8329 q.text("%#x" % self.xid)
8330 else:
8331 q.text('None')
8332 q.breakable()
8333 q.text('}')
8334
Rich Lane7dcdf022013-12-11 14:45:27 -08008335bsn_header.subtypes[44] = bsn_time_request
8336
8337class bsn_virtual_port_create_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07008338 version = 4
8339 type = 4
8340 experimenter = 6035143
8341 subtype = 16
8342
8343 def __init__(self, xid=None, status=None, vport_no=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08008344 if xid != None:
8345 self.xid = xid
8346 else:
8347 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07008348 if status != None:
8349 self.status = status
8350 else:
8351 self.status = 0
8352 if vport_no != None:
8353 self.vport_no = vport_no
8354 else:
8355 self.vport_no = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08008356 return
Dan Talaycof6202252013-07-02 01:00:29 -07008357
8358 def pack(self):
8359 packed = []
8360 packed.append(struct.pack("!B", self.version))
8361 packed.append(struct.pack("!B", self.type))
8362 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8363 packed.append(struct.pack("!L", self.xid))
8364 packed.append(struct.pack("!L", self.experimenter))
8365 packed.append(struct.pack("!L", self.subtype))
8366 packed.append(struct.pack("!L", self.status))
8367 packed.append(struct.pack("!L", self.vport_no))
8368 length = sum([len(x) for x in packed])
8369 packed[2] = struct.pack("!H", length)
8370 return ''.join(packed)
8371
8372 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08008373 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07008374 obj = bsn_virtual_port_create_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07008375 _version = reader.read("!B")[0]
8376 assert(_version == 4)
8377 _type = reader.read("!B")[0]
8378 assert(_type == 4)
8379 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08008380 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08008381 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07008382 obj.xid = reader.read("!L")[0]
8383 _experimenter = reader.read("!L")[0]
8384 assert(_experimenter == 6035143)
8385 _subtype = reader.read("!L")[0]
8386 assert(_subtype == 16)
8387 obj.status = reader.read("!L")[0]
8388 obj.vport_no = reader.read("!L")[0]
8389 return obj
8390
8391 def __eq__(self, other):
8392 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07008393 if self.xid != other.xid: return False
8394 if self.status != other.status: return False
8395 if self.vport_no != other.vport_no: return False
8396 return True
8397
Dan Talaycof6202252013-07-02 01:00:29 -07008398 def pretty_print(self, q):
8399 q.text("bsn_virtual_port_create_reply {")
8400 with q.group():
8401 with q.indent(2):
8402 q.breakable()
8403 q.text("xid = ");
8404 if self.xid != None:
8405 q.text("%#x" % self.xid)
8406 else:
8407 q.text('None')
8408 q.text(","); q.breakable()
8409 q.text("status = ");
8410 q.text("%#x" % self.status)
8411 q.text(","); q.breakable()
8412 q.text("vport_no = ");
8413 q.text("%#x" % self.vport_no)
8414 q.breakable()
8415 q.text('}')
8416
Rich Lane7dcdf022013-12-11 14:45:27 -08008417bsn_header.subtypes[16] = bsn_virtual_port_create_reply
8418
8419class bsn_virtual_port_create_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07008420 version = 4
8421 type = 4
8422 experimenter = 6035143
8423 subtype = 15
8424
8425 def __init__(self, xid=None, vport=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08008426 if xid != None:
8427 self.xid = xid
8428 else:
8429 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07008430 if vport != None:
8431 self.vport = vport
8432 else:
Rich Lanee2567702015-01-26 15:04:35 -08008433 self.vport = ofp.bsn_vport()
Rich Lane7dcdf022013-12-11 14:45:27 -08008434 return
Dan Talaycof6202252013-07-02 01:00:29 -07008435
8436 def pack(self):
8437 packed = []
8438 packed.append(struct.pack("!B", self.version))
8439 packed.append(struct.pack("!B", self.type))
8440 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8441 packed.append(struct.pack("!L", self.xid))
8442 packed.append(struct.pack("!L", self.experimenter))
8443 packed.append(struct.pack("!L", self.subtype))
8444 packed.append(self.vport.pack())
8445 length = sum([len(x) for x in packed])
8446 packed[2] = struct.pack("!H", length)
8447 return ''.join(packed)
8448
8449 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08008450 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07008451 obj = bsn_virtual_port_create_request()
Dan Talaycof6202252013-07-02 01:00:29 -07008452 _version = reader.read("!B")[0]
8453 assert(_version == 4)
8454 _type = reader.read("!B")[0]
8455 assert(_type == 4)
8456 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08008457 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08008458 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07008459 obj.xid = reader.read("!L")[0]
8460 _experimenter = reader.read("!L")[0]
8461 assert(_experimenter == 6035143)
8462 _subtype = reader.read("!L")[0]
8463 assert(_subtype == 15)
Rich Lanee2567702015-01-26 15:04:35 -08008464 obj.vport = ofp.bsn_vport.unpack(reader)
Dan Talaycof6202252013-07-02 01:00:29 -07008465 return obj
8466
8467 def __eq__(self, other):
8468 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07008469 if self.xid != other.xid: return False
8470 if self.vport != other.vport: return False
8471 return True
8472
Dan Talaycof6202252013-07-02 01:00:29 -07008473 def pretty_print(self, q):
8474 q.text("bsn_virtual_port_create_request {")
8475 with q.group():
8476 with q.indent(2):
8477 q.breakable()
8478 q.text("xid = ");
8479 if self.xid != None:
8480 q.text("%#x" % self.xid)
8481 else:
8482 q.text('None')
8483 q.text(","); q.breakable()
8484 q.text("vport = ");
8485 q.pp(self.vport)
8486 q.breakable()
8487 q.text('}')
8488
Rich Lane7dcdf022013-12-11 14:45:27 -08008489bsn_header.subtypes[15] = bsn_virtual_port_create_request
8490
8491class bsn_virtual_port_remove_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07008492 version = 4
8493 type = 4
8494 experimenter = 6035143
8495 subtype = 26
8496
8497 def __init__(self, xid=None, status=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08008498 if xid != None:
8499 self.xid = xid
8500 else:
8501 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07008502 if status != None:
8503 self.status = status
8504 else:
8505 self.status = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08008506 return
Dan Talaycof6202252013-07-02 01:00:29 -07008507
8508 def pack(self):
8509 packed = []
8510 packed.append(struct.pack("!B", self.version))
8511 packed.append(struct.pack("!B", self.type))
8512 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8513 packed.append(struct.pack("!L", self.xid))
8514 packed.append(struct.pack("!L", self.experimenter))
8515 packed.append(struct.pack("!L", self.subtype))
8516 packed.append(struct.pack("!L", self.status))
8517 length = sum([len(x) for x in packed])
8518 packed[2] = struct.pack("!H", length)
8519 return ''.join(packed)
8520
8521 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08008522 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07008523 obj = bsn_virtual_port_remove_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07008524 _version = reader.read("!B")[0]
8525 assert(_version == 4)
8526 _type = reader.read("!B")[0]
8527 assert(_type == 4)
8528 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08008529 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08008530 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07008531 obj.xid = reader.read("!L")[0]
8532 _experimenter = reader.read("!L")[0]
8533 assert(_experimenter == 6035143)
8534 _subtype = reader.read("!L")[0]
8535 assert(_subtype == 26)
8536 obj.status = reader.read("!L")[0]
8537 return obj
8538
8539 def __eq__(self, other):
8540 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07008541 if self.xid != other.xid: return False
8542 if self.status != other.status: return False
8543 return True
8544
Dan Talaycof6202252013-07-02 01:00:29 -07008545 def pretty_print(self, q):
8546 q.text("bsn_virtual_port_remove_reply {")
8547 with q.group():
8548 with q.indent(2):
8549 q.breakable()
8550 q.text("xid = ");
8551 if self.xid != None:
8552 q.text("%#x" % self.xid)
8553 else:
8554 q.text('None')
8555 q.text(","); q.breakable()
8556 q.text("status = ");
8557 q.text("%#x" % self.status)
8558 q.breakable()
8559 q.text('}')
8560
Rich Lane7dcdf022013-12-11 14:45:27 -08008561bsn_header.subtypes[26] = bsn_virtual_port_remove_reply
8562
8563class bsn_virtual_port_remove_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07008564 version = 4
8565 type = 4
8566 experimenter = 6035143
8567 subtype = 17
8568
8569 def __init__(self, xid=None, vport_no=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08008570 if xid != None:
8571 self.xid = xid
8572 else:
8573 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07008574 if vport_no != None:
8575 self.vport_no = vport_no
8576 else:
8577 self.vport_no = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08008578 return
Dan Talaycof6202252013-07-02 01:00:29 -07008579
8580 def pack(self):
8581 packed = []
8582 packed.append(struct.pack("!B", self.version))
8583 packed.append(struct.pack("!B", self.type))
8584 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8585 packed.append(struct.pack("!L", self.xid))
8586 packed.append(struct.pack("!L", self.experimenter))
8587 packed.append(struct.pack("!L", self.subtype))
8588 packed.append(struct.pack("!L", self.vport_no))
8589 length = sum([len(x) for x in packed])
8590 packed[2] = struct.pack("!H", length)
8591 return ''.join(packed)
8592
8593 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08008594 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07008595 obj = bsn_virtual_port_remove_request()
Dan Talaycof6202252013-07-02 01:00:29 -07008596 _version = reader.read("!B")[0]
8597 assert(_version == 4)
8598 _type = reader.read("!B")[0]
8599 assert(_type == 4)
8600 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08008601 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08008602 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07008603 obj.xid = reader.read("!L")[0]
8604 _experimenter = reader.read("!L")[0]
8605 assert(_experimenter == 6035143)
8606 _subtype = reader.read("!L")[0]
8607 assert(_subtype == 17)
8608 obj.vport_no = reader.read("!L")[0]
8609 return obj
8610
8611 def __eq__(self, other):
8612 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07008613 if self.xid != other.xid: return False
8614 if self.vport_no != other.vport_no: return False
8615 return True
8616
Dan Talaycof6202252013-07-02 01:00:29 -07008617 def pretty_print(self, q):
8618 q.text("bsn_virtual_port_remove_request {")
8619 with q.group():
8620 with q.indent(2):
8621 q.breakable()
8622 q.text("xid = ");
8623 if self.xid != None:
8624 q.text("%#x" % self.xid)
8625 else:
8626 q.text('None')
8627 q.text(","); q.breakable()
8628 q.text("vport_no = ");
8629 q.text("%#x" % self.vport_no)
8630 q.breakable()
8631 q.text('}')
8632
Rich Lane7dcdf022013-12-11 14:45:27 -08008633bsn_header.subtypes[17] = bsn_virtual_port_remove_request
8634
8635class bsn_vlan_counter_stats_reply(bsn_stats_reply):
8636 version = 4
8637 type = 19
8638 stats_type = 65535
8639 experimenter = 6035143
8640 subtype = 9
8641
8642 def __init__(self, xid=None, flags=None, entries=None):
8643 if xid != None:
8644 self.xid = xid
8645 else:
8646 self.xid = None
8647 if flags != None:
8648 self.flags = flags
8649 else:
8650 self.flags = 0
8651 if entries != None:
8652 self.entries = entries
8653 else:
8654 self.entries = []
8655 return
8656
8657 def pack(self):
8658 packed = []
8659 packed.append(struct.pack("!B", self.version))
8660 packed.append(struct.pack("!B", self.type))
8661 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8662 packed.append(struct.pack("!L", self.xid))
8663 packed.append(struct.pack("!H", self.stats_type))
8664 packed.append(struct.pack("!H", self.flags))
8665 packed.append('\x00' * 4)
8666 packed.append(struct.pack("!L", self.experimenter))
8667 packed.append(struct.pack("!L", self.subtype))
8668 packed.append(loxi.generic_util.pack_list(self.entries))
8669 length = sum([len(x) for x in packed])
8670 packed[2] = struct.pack("!H", length)
8671 return ''.join(packed)
8672
8673 @staticmethod
8674 def unpack(reader):
8675 obj = bsn_vlan_counter_stats_reply()
8676 _version = reader.read("!B")[0]
8677 assert(_version == 4)
8678 _type = reader.read("!B")[0]
8679 assert(_type == 19)
8680 _length = reader.read("!H")[0]
8681 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08008682 reader = orig_reader.slice(_length, 4)
Rich Lane7dcdf022013-12-11 14:45:27 -08008683 obj.xid = reader.read("!L")[0]
8684 _stats_type = reader.read("!H")[0]
8685 assert(_stats_type == 65535)
8686 obj.flags = reader.read("!H")[0]
8687 reader.skip(4)
8688 _experimenter = reader.read("!L")[0]
8689 assert(_experimenter == 6035143)
8690 _subtype = reader.read("!L")[0]
8691 assert(_subtype == 9)
Rich Lanee2567702015-01-26 15:04:35 -08008692 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_vlan_counter_stats_entry.unpack)
Rich Lane7dcdf022013-12-11 14:45:27 -08008693 return obj
8694
8695 def __eq__(self, other):
8696 if type(self) != type(other): return False
8697 if self.xid != other.xid: return False
8698 if self.flags != other.flags: return False
8699 if self.entries != other.entries: return False
8700 return True
8701
8702 def pretty_print(self, q):
8703 q.text("bsn_vlan_counter_stats_reply {")
8704 with q.group():
8705 with q.indent(2):
8706 q.breakable()
8707 q.text("xid = ");
8708 if self.xid != None:
8709 q.text("%#x" % self.xid)
8710 else:
8711 q.text('None')
8712 q.text(","); q.breakable()
8713 q.text("flags = ");
8714 q.text("%#x" % self.flags)
8715 q.text(","); q.breakable()
8716 q.text("entries = ");
8717 q.pp(self.entries)
8718 q.breakable()
8719 q.text('}')
8720
8721bsn_stats_reply.subtypes[9] = bsn_vlan_counter_stats_reply
8722
8723class bsn_vlan_counter_stats_request(bsn_stats_request):
8724 version = 4
8725 type = 18
8726 stats_type = 65535
8727 experimenter = 6035143
8728 subtype = 9
8729
8730 def __init__(self, xid=None, flags=None, vlan_vid=None):
8731 if xid != None:
8732 self.xid = xid
8733 else:
8734 self.xid = None
8735 if flags != None:
8736 self.flags = flags
8737 else:
8738 self.flags = 0
8739 if vlan_vid != None:
8740 self.vlan_vid = vlan_vid
8741 else:
8742 self.vlan_vid = 0
8743 return
8744
8745 def pack(self):
8746 packed = []
8747 packed.append(struct.pack("!B", self.version))
8748 packed.append(struct.pack("!B", self.type))
8749 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8750 packed.append(struct.pack("!L", self.xid))
8751 packed.append(struct.pack("!H", self.stats_type))
8752 packed.append(struct.pack("!H", self.flags))
8753 packed.append('\x00' * 4)
8754 packed.append(struct.pack("!L", self.experimenter))
8755 packed.append(struct.pack("!L", self.subtype))
8756 packed.append(struct.pack("!H", self.vlan_vid))
8757 length = sum([len(x) for x in packed])
8758 packed[2] = struct.pack("!H", length)
8759 return ''.join(packed)
8760
8761 @staticmethod
8762 def unpack(reader):
8763 obj = bsn_vlan_counter_stats_request()
8764 _version = reader.read("!B")[0]
8765 assert(_version == 4)
8766 _type = reader.read("!B")[0]
8767 assert(_type == 18)
8768 _length = reader.read("!H")[0]
8769 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08008770 reader = orig_reader.slice(_length, 4)
Rich Lane7dcdf022013-12-11 14:45:27 -08008771 obj.xid = reader.read("!L")[0]
8772 _stats_type = reader.read("!H")[0]
8773 assert(_stats_type == 65535)
8774 obj.flags = reader.read("!H")[0]
8775 reader.skip(4)
8776 _experimenter = reader.read("!L")[0]
8777 assert(_experimenter == 6035143)
8778 _subtype = reader.read("!L")[0]
8779 assert(_subtype == 9)
8780 obj.vlan_vid = reader.read("!H")[0]
8781 return obj
8782
8783 def __eq__(self, other):
8784 if type(self) != type(other): return False
8785 if self.xid != other.xid: return False
8786 if self.flags != other.flags: return False
8787 if self.vlan_vid != other.vlan_vid: return False
8788 return True
8789
8790 def pretty_print(self, q):
8791 q.text("bsn_vlan_counter_stats_request {")
8792 with q.group():
8793 with q.indent(2):
8794 q.breakable()
8795 q.text("xid = ");
8796 if self.xid != None:
8797 q.text("%#x" % self.xid)
8798 else:
8799 q.text('None')
8800 q.text(","); q.breakable()
8801 q.text("flags = ");
8802 q.text("%#x" % self.flags)
8803 q.text(","); q.breakable()
8804 q.text("vlan_vid = ");
8805 q.text("%#x" % self.vlan_vid)
8806 q.breakable()
8807 q.text('}')
8808
8809bsn_stats_request.subtypes[9] = bsn_vlan_counter_stats_request
8810
Rich Lane5587ab12014-06-30 11:19:09 -07008811class bsn_vrf_counter_stats_reply(bsn_stats_reply):
8812 version = 4
8813 type = 19
8814 stats_type = 65535
8815 experimenter = 6035143
8816 subtype = 15
8817
8818 def __init__(self, xid=None, flags=None, entries=None):
8819 if xid != None:
8820 self.xid = xid
8821 else:
8822 self.xid = None
8823 if flags != None:
8824 self.flags = flags
8825 else:
8826 self.flags = 0
8827 if entries != None:
8828 self.entries = entries
8829 else:
8830 self.entries = []
8831 return
8832
8833 def pack(self):
8834 packed = []
8835 packed.append(struct.pack("!B", self.version))
8836 packed.append(struct.pack("!B", self.type))
8837 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8838 packed.append(struct.pack("!L", self.xid))
8839 packed.append(struct.pack("!H", self.stats_type))
8840 packed.append(struct.pack("!H", self.flags))
8841 packed.append('\x00' * 4)
8842 packed.append(struct.pack("!L", self.experimenter))
8843 packed.append(struct.pack("!L", self.subtype))
8844 packed.append(loxi.generic_util.pack_list(self.entries))
8845 length = sum([len(x) for x in packed])
8846 packed[2] = struct.pack("!H", length)
8847 return ''.join(packed)
8848
8849 @staticmethod
8850 def unpack(reader):
8851 obj = bsn_vrf_counter_stats_reply()
8852 _version = reader.read("!B")[0]
8853 assert(_version == 4)
8854 _type = reader.read("!B")[0]
8855 assert(_type == 19)
8856 _length = reader.read("!H")[0]
8857 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08008858 reader = orig_reader.slice(_length, 4)
Rich Lane5587ab12014-06-30 11:19:09 -07008859 obj.xid = reader.read("!L")[0]
8860 _stats_type = reader.read("!H")[0]
8861 assert(_stats_type == 65535)
8862 obj.flags = reader.read("!H")[0]
8863 reader.skip(4)
8864 _experimenter = reader.read("!L")[0]
8865 assert(_experimenter == 6035143)
8866 _subtype = reader.read("!L")[0]
8867 assert(_subtype == 15)
Rich Lanee2567702015-01-26 15:04:35 -08008868 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_vrf_counter_stats_entry.unpack)
Rich Lane5587ab12014-06-30 11:19:09 -07008869 return obj
8870
8871 def __eq__(self, other):
8872 if type(self) != type(other): return False
8873 if self.xid != other.xid: return False
8874 if self.flags != other.flags: return False
8875 if self.entries != other.entries: return False
8876 return True
8877
8878 def pretty_print(self, q):
8879 q.text("bsn_vrf_counter_stats_reply {")
8880 with q.group():
8881 with q.indent(2):
8882 q.breakable()
8883 q.text("xid = ");
8884 if self.xid != None:
8885 q.text("%#x" % self.xid)
8886 else:
8887 q.text('None')
8888 q.text(","); q.breakable()
8889 q.text("flags = ");
8890 q.text("%#x" % self.flags)
8891 q.text(","); q.breakable()
8892 q.text("entries = ");
8893 q.pp(self.entries)
8894 q.breakable()
8895 q.text('}')
8896
8897bsn_stats_reply.subtypes[15] = bsn_vrf_counter_stats_reply
8898
8899class bsn_vrf_counter_stats_request(bsn_stats_request):
8900 version = 4
8901 type = 18
8902 stats_type = 65535
8903 experimenter = 6035143
8904 subtype = 15
8905
8906 def __init__(self, xid=None, flags=None, vrf=None):
8907 if xid != None:
8908 self.xid = xid
8909 else:
8910 self.xid = None
8911 if flags != None:
8912 self.flags = flags
8913 else:
8914 self.flags = 0
8915 if vrf != None:
8916 self.vrf = vrf
8917 else:
8918 self.vrf = 0
8919 return
8920
8921 def pack(self):
8922 packed = []
8923 packed.append(struct.pack("!B", self.version))
8924 packed.append(struct.pack("!B", self.type))
8925 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8926 packed.append(struct.pack("!L", self.xid))
8927 packed.append(struct.pack("!H", self.stats_type))
8928 packed.append(struct.pack("!H", self.flags))
8929 packed.append('\x00' * 4)
8930 packed.append(struct.pack("!L", self.experimenter))
8931 packed.append(struct.pack("!L", self.subtype))
8932 packed.append(struct.pack("!L", self.vrf))
8933 length = sum([len(x) for x in packed])
8934 packed[2] = struct.pack("!H", length)
8935 return ''.join(packed)
8936
8937 @staticmethod
8938 def unpack(reader):
8939 obj = bsn_vrf_counter_stats_request()
8940 _version = reader.read("!B")[0]
8941 assert(_version == 4)
8942 _type = reader.read("!B")[0]
8943 assert(_type == 18)
8944 _length = reader.read("!H")[0]
8945 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08008946 reader = orig_reader.slice(_length, 4)
Rich Lane5587ab12014-06-30 11:19:09 -07008947 obj.xid = reader.read("!L")[0]
8948 _stats_type = reader.read("!H")[0]
8949 assert(_stats_type == 65535)
8950 obj.flags = reader.read("!H")[0]
8951 reader.skip(4)
8952 _experimenter = reader.read("!L")[0]
8953 assert(_experimenter == 6035143)
8954 _subtype = reader.read("!L")[0]
8955 assert(_subtype == 15)
8956 obj.vrf = reader.read("!L")[0]
8957 return obj
8958
8959 def __eq__(self, other):
8960 if type(self) != type(other): return False
8961 if self.xid != other.xid: return False
8962 if self.flags != other.flags: return False
8963 if self.vrf != other.vrf: return False
8964 return True
8965
8966 def pretty_print(self, q):
8967 q.text("bsn_vrf_counter_stats_request {")
8968 with q.group():
8969 with q.indent(2):
8970 q.breakable()
8971 q.text("xid = ");
8972 if self.xid != None:
8973 q.text("%#x" % self.xid)
8974 else:
8975 q.text('None')
8976 q.text(","); q.breakable()
8977 q.text("flags = ");
8978 q.text("%#x" % self.flags)
8979 q.text(","); q.breakable()
8980 q.text("vrf = ");
8981 q.text("%#x" % self.vrf)
8982 q.breakable()
8983 q.text('}')
8984
8985bsn_stats_request.subtypes[15] = bsn_vrf_counter_stats_request
8986
Rich Lane7dcdf022013-12-11 14:45:27 -08008987class desc_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -07008988 version = 4
8989 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -07008990 stats_type = 0
8991
8992 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 -08008993 if xid != None:
8994 self.xid = xid
8995 else:
8996 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07008997 if flags != None:
8998 self.flags = flags
8999 else:
9000 self.flags = 0
9001 if mfr_desc != None:
9002 self.mfr_desc = mfr_desc
9003 else:
9004 self.mfr_desc = ""
9005 if hw_desc != None:
9006 self.hw_desc = hw_desc
9007 else:
9008 self.hw_desc = ""
9009 if sw_desc != None:
9010 self.sw_desc = sw_desc
9011 else:
9012 self.sw_desc = ""
9013 if serial_num != None:
9014 self.serial_num = serial_num
9015 else:
9016 self.serial_num = ""
9017 if dp_desc != None:
9018 self.dp_desc = dp_desc
9019 else:
9020 self.dp_desc = ""
Rich Lane7dcdf022013-12-11 14:45:27 -08009021 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07009022
9023 def pack(self):
9024 packed = []
9025 packed.append(struct.pack("!B", self.version))
9026 packed.append(struct.pack("!B", self.type))
9027 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9028 packed.append(struct.pack("!L", self.xid))
9029 packed.append(struct.pack("!H", self.stats_type))
9030 packed.append(struct.pack("!H", self.flags))
9031 packed.append('\x00' * 4)
9032 packed.append(struct.pack("!256s", self.mfr_desc))
9033 packed.append(struct.pack("!256s", self.hw_desc))
9034 packed.append(struct.pack("!256s", self.sw_desc))
9035 packed.append(struct.pack("!32s", self.serial_num))
9036 packed.append(struct.pack("!256s", self.dp_desc))
9037 length = sum([len(x) for x in packed])
9038 packed[2] = struct.pack("!H", length)
9039 return ''.join(packed)
9040
9041 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08009042 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07009043 obj = desc_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07009044 _version = reader.read("!B")[0]
9045 assert(_version == 4)
9046 _type = reader.read("!B")[0]
9047 assert(_type == 19)
9048 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08009049 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08009050 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07009051 obj.xid = reader.read("!L")[0]
9052 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009053 assert(_stats_type == 0)
Dan Talaycof6202252013-07-02 01:00:29 -07009054 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009055 reader.skip(4)
9056 obj.mfr_desc = reader.read("!256s")[0].rstrip("\x00")
9057 obj.hw_desc = reader.read("!256s")[0].rstrip("\x00")
9058 obj.sw_desc = reader.read("!256s")[0].rstrip("\x00")
9059 obj.serial_num = reader.read("!32s")[0].rstrip("\x00")
9060 obj.dp_desc = reader.read("!256s")[0].rstrip("\x00")
9061 return obj
9062
9063 def __eq__(self, other):
9064 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07009065 if self.xid != other.xid: return False
9066 if self.flags != other.flags: return False
9067 if self.mfr_desc != other.mfr_desc: return False
9068 if self.hw_desc != other.hw_desc: return False
9069 if self.sw_desc != other.sw_desc: return False
9070 if self.serial_num != other.serial_num: return False
9071 if self.dp_desc != other.dp_desc: return False
9072 return True
9073
Rich Lanec2ee4b82013-04-24 17:12:38 -07009074 def pretty_print(self, q):
9075 q.text("desc_stats_reply {")
9076 with q.group():
9077 with q.indent(2):
9078 q.breakable()
9079 q.text("xid = ");
9080 if self.xid != None:
9081 q.text("%#x" % self.xid)
9082 else:
9083 q.text('None')
9084 q.text(","); q.breakable()
9085 q.text("flags = ");
9086 q.text("%#x" % self.flags)
9087 q.text(","); q.breakable()
9088 q.text("mfr_desc = ");
9089 q.pp(self.mfr_desc)
9090 q.text(","); q.breakable()
9091 q.text("hw_desc = ");
9092 q.pp(self.hw_desc)
9093 q.text(","); q.breakable()
9094 q.text("sw_desc = ");
9095 q.pp(self.sw_desc)
9096 q.text(","); q.breakable()
9097 q.text("serial_num = ");
9098 q.pp(self.serial_num)
9099 q.text(","); q.breakable()
9100 q.text("dp_desc = ");
9101 q.pp(self.dp_desc)
9102 q.breakable()
9103 q.text('}')
9104
Rich Lane7dcdf022013-12-11 14:45:27 -08009105stats_reply.subtypes[0] = desc_stats_reply
9106
9107class desc_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -07009108 version = 4
9109 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -07009110 stats_type = 0
9111
9112 def __init__(self, xid=None, flags=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08009113 if xid != None:
9114 self.xid = xid
9115 else:
9116 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07009117 if flags != None:
9118 self.flags = flags
9119 else:
9120 self.flags = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08009121 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07009122
9123 def pack(self):
9124 packed = []
9125 packed.append(struct.pack("!B", self.version))
9126 packed.append(struct.pack("!B", self.type))
9127 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9128 packed.append(struct.pack("!L", self.xid))
9129 packed.append(struct.pack("!H", self.stats_type))
9130 packed.append(struct.pack("!H", self.flags))
9131 packed.append('\x00' * 4)
9132 length = sum([len(x) for x in packed])
9133 packed[2] = struct.pack("!H", length)
9134 return ''.join(packed)
9135
9136 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08009137 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07009138 obj = desc_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -07009139 _version = reader.read("!B")[0]
9140 assert(_version == 4)
9141 _type = reader.read("!B")[0]
9142 assert(_type == 18)
9143 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08009144 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08009145 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07009146 obj.xid = reader.read("!L")[0]
9147 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009148 assert(_stats_type == 0)
Dan Talaycof6202252013-07-02 01:00:29 -07009149 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009150 reader.skip(4)
9151 return obj
9152
9153 def __eq__(self, other):
9154 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07009155 if self.xid != other.xid: return False
9156 if self.flags != other.flags: return False
9157 return True
9158
Rich Lanec2ee4b82013-04-24 17:12:38 -07009159 def pretty_print(self, q):
9160 q.text("desc_stats_request {")
9161 with q.group():
9162 with q.indent(2):
9163 q.breakable()
9164 q.text("xid = ");
9165 if self.xid != None:
9166 q.text("%#x" % self.xid)
9167 else:
9168 q.text('None')
9169 q.text(","); q.breakable()
9170 q.text("flags = ");
9171 q.text("%#x" % self.flags)
9172 q.breakable()
9173 q.text('}')
9174
Rich Lane7dcdf022013-12-11 14:45:27 -08009175stats_request.subtypes[0] = desc_stats_request
9176
9177class echo_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -07009178 version = 4
9179 type = 3
Rich Lanec2ee4b82013-04-24 17:12:38 -07009180
9181 def __init__(self, xid=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08009182 if xid != None:
9183 self.xid = xid
9184 else:
9185 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07009186 if data != None:
9187 self.data = data
9188 else:
Dan Talaycof6202252013-07-02 01:00:29 -07009189 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08009190 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07009191
9192 def pack(self):
9193 packed = []
9194 packed.append(struct.pack("!B", self.version))
9195 packed.append(struct.pack("!B", self.type))
9196 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9197 packed.append(struct.pack("!L", self.xid))
9198 packed.append(self.data)
9199 length = sum([len(x) for x in packed])
9200 packed[2] = struct.pack("!H", length)
9201 return ''.join(packed)
9202
9203 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08009204 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07009205 obj = echo_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07009206 _version = reader.read("!B")[0]
9207 assert(_version == 4)
9208 _type = reader.read("!B")[0]
9209 assert(_type == 3)
9210 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08009211 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08009212 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07009213 obj.xid = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009214 obj.data = str(reader.read_all())
9215 return obj
9216
9217 def __eq__(self, other):
9218 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07009219 if self.xid != other.xid: return False
9220 if self.data != other.data: return False
9221 return True
9222
Rich Lanec2ee4b82013-04-24 17:12:38 -07009223 def pretty_print(self, q):
9224 q.text("echo_reply {")
9225 with q.group():
9226 with q.indent(2):
9227 q.breakable()
9228 q.text("xid = ");
9229 if self.xid != None:
9230 q.text("%#x" % self.xid)
9231 else:
9232 q.text('None')
9233 q.text(","); q.breakable()
9234 q.text("data = ");
9235 q.pp(self.data)
9236 q.breakable()
9237 q.text('}')
9238
Rich Lane7dcdf022013-12-11 14:45:27 -08009239message.subtypes[3] = echo_reply
9240
9241class echo_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -07009242 version = 4
9243 type = 2
Rich Lanec2ee4b82013-04-24 17:12:38 -07009244
9245 def __init__(self, xid=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08009246 if xid != None:
9247 self.xid = xid
9248 else:
9249 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07009250 if data != None:
9251 self.data = data
9252 else:
Dan Talaycof6202252013-07-02 01:00:29 -07009253 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08009254 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07009255
9256 def pack(self):
9257 packed = []
9258 packed.append(struct.pack("!B", self.version))
9259 packed.append(struct.pack("!B", self.type))
9260 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9261 packed.append(struct.pack("!L", self.xid))
9262 packed.append(self.data)
9263 length = sum([len(x) for x in packed])
9264 packed[2] = struct.pack("!H", length)
9265 return ''.join(packed)
9266
9267 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08009268 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07009269 obj = echo_request()
Dan Talaycof6202252013-07-02 01:00:29 -07009270 _version = reader.read("!B")[0]
9271 assert(_version == 4)
9272 _type = reader.read("!B")[0]
9273 assert(_type == 2)
9274 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08009275 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08009276 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07009277 obj.xid = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009278 obj.data = str(reader.read_all())
9279 return obj
9280
9281 def __eq__(self, other):
9282 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07009283 if self.xid != other.xid: return False
9284 if self.data != other.data: return False
9285 return True
9286
Rich Lanec2ee4b82013-04-24 17:12:38 -07009287 def pretty_print(self, q):
9288 q.text("echo_request {")
9289 with q.group():
9290 with q.indent(2):
9291 q.breakable()
9292 q.text("xid = ");
9293 if self.xid != None:
9294 q.text("%#x" % self.xid)
9295 else:
9296 q.text('None')
9297 q.text(","); q.breakable()
9298 q.text("data = ");
9299 q.pp(self.data)
9300 q.breakable()
9301 q.text('}')
9302
Rich Lane7dcdf022013-12-11 14:45:27 -08009303message.subtypes[2] = echo_request
9304
9305class experimenter_error_msg(error_msg):
Dan Talaycof6202252013-07-02 01:00:29 -07009306 version = 4
9307 type = 1
Rich Lane6f4978c2013-10-20 21:33:52 -07009308 err_type = 65535
Rich Lanec2ee4b82013-04-24 17:12:38 -07009309
Rich Lane6f4978c2013-10-20 21:33:52 -07009310 def __init__(self, xid=None, subtype=None, experimenter=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08009311 if xid != None:
9312 self.xid = xid
9313 else:
9314 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07009315 if subtype != None:
9316 self.subtype = subtype
Rich Lanec2ee4b82013-04-24 17:12:38 -07009317 else:
Rich Lane6f4978c2013-10-20 21:33:52 -07009318 self.subtype = 0
9319 if experimenter != None:
9320 self.experimenter = experimenter
Rich Lanec2ee4b82013-04-24 17:12:38 -07009321 else:
Rich Lane6f4978c2013-10-20 21:33:52 -07009322 self.experimenter = 0
Rich Lanec2ee4b82013-04-24 17:12:38 -07009323 if data != None:
9324 self.data = data
9325 else:
Dan Talaycof6202252013-07-02 01:00:29 -07009326 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08009327 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07009328
9329 def pack(self):
9330 packed = []
9331 packed.append(struct.pack("!B", self.version))
9332 packed.append(struct.pack("!B", self.type))
9333 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9334 packed.append(struct.pack("!L", self.xid))
9335 packed.append(struct.pack("!H", self.err_type))
Rich Lane6f4978c2013-10-20 21:33:52 -07009336 packed.append(struct.pack("!H", self.subtype))
9337 packed.append(struct.pack("!L", self.experimenter))
Rich Lanec2ee4b82013-04-24 17:12:38 -07009338 packed.append(self.data)
9339 length = sum([len(x) for x in packed])
9340 packed[2] = struct.pack("!H", length)
9341 return ''.join(packed)
9342
9343 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08009344 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07009345 obj = experimenter_error_msg()
Dan Talaycof6202252013-07-02 01:00:29 -07009346 _version = reader.read("!B")[0]
9347 assert(_version == 4)
9348 _type = reader.read("!B")[0]
9349 assert(_type == 1)
9350 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08009351 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08009352 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07009353 obj.xid = reader.read("!L")[0]
Rich Lane6f4978c2013-10-20 21:33:52 -07009354 _err_type = reader.read("!H")[0]
9355 assert(_err_type == 65535)
9356 obj.subtype = reader.read("!H")[0]
9357 obj.experimenter = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009358 obj.data = str(reader.read_all())
9359 return obj
9360
9361 def __eq__(self, other):
9362 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07009363 if self.xid != other.xid: return False
Rich Lane6f4978c2013-10-20 21:33:52 -07009364 if self.subtype != other.subtype: return False
9365 if self.experimenter != other.experimenter: return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07009366 if self.data != other.data: return False
9367 return True
9368
Rich Lanec2ee4b82013-04-24 17:12:38 -07009369 def pretty_print(self, q):
Rich Lane6f4978c2013-10-20 21:33:52 -07009370 q.text("experimenter_error_msg {")
Rich Lanec2ee4b82013-04-24 17:12:38 -07009371 with q.group():
9372 with q.indent(2):
9373 q.breakable()
9374 q.text("xid = ");
9375 if self.xid != None:
9376 q.text("%#x" % self.xid)
9377 else:
9378 q.text('None')
9379 q.text(","); q.breakable()
Rich Lane6f4978c2013-10-20 21:33:52 -07009380 q.text("subtype = ");
9381 q.text("%#x" % self.subtype)
Rich Lanec2ee4b82013-04-24 17:12:38 -07009382 q.text(","); q.breakable()
Rich Lane6f4978c2013-10-20 21:33:52 -07009383 q.text("experimenter = ");
9384 q.text("%#x" % self.experimenter)
Rich Lanec2ee4b82013-04-24 17:12:38 -07009385 q.text(","); q.breakable()
9386 q.text("data = ");
9387 q.pp(self.data)
9388 q.breakable()
9389 q.text('}')
9390
Rich Lane7dcdf022013-12-11 14:45:27 -08009391error_msg.subtypes[65535] = experimenter_error_msg
9392
9393class features_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -07009394 version = 4
9395 type = 6
Rich Lanec2ee4b82013-04-24 17:12:38 -07009396
9397 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 -08009398 if xid != None:
9399 self.xid = xid
9400 else:
9401 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07009402 if datapath_id != None:
9403 self.datapath_id = datapath_id
9404 else:
9405 self.datapath_id = 0
9406 if n_buffers != None:
9407 self.n_buffers = n_buffers
9408 else:
9409 self.n_buffers = 0
9410 if n_tables != None:
9411 self.n_tables = n_tables
9412 else:
9413 self.n_tables = 0
9414 if auxiliary_id != None:
9415 self.auxiliary_id = auxiliary_id
9416 else:
9417 self.auxiliary_id = 0
9418 if capabilities != None:
9419 self.capabilities = capabilities
9420 else:
9421 self.capabilities = 0
9422 if reserved != None:
9423 self.reserved = reserved
9424 else:
9425 self.reserved = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08009426 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07009427
9428 def pack(self):
9429 packed = []
9430 packed.append(struct.pack("!B", self.version))
9431 packed.append(struct.pack("!B", self.type))
9432 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9433 packed.append(struct.pack("!L", self.xid))
9434 packed.append(struct.pack("!Q", self.datapath_id))
9435 packed.append(struct.pack("!L", self.n_buffers))
9436 packed.append(struct.pack("!B", self.n_tables))
9437 packed.append(struct.pack("!B", self.auxiliary_id))
9438 packed.append('\x00' * 2)
9439 packed.append(struct.pack("!L", self.capabilities))
9440 packed.append(struct.pack("!L", self.reserved))
9441 length = sum([len(x) for x in packed])
9442 packed[2] = struct.pack("!H", length)
9443 return ''.join(packed)
9444
9445 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08009446 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07009447 obj = features_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07009448 _version = reader.read("!B")[0]
9449 assert(_version == 4)
9450 _type = reader.read("!B")[0]
9451 assert(_type == 6)
9452 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08009453 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08009454 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07009455 obj.xid = reader.read("!L")[0]
9456 obj.datapath_id = reader.read("!Q")[0]
9457 obj.n_buffers = reader.read("!L")[0]
9458 obj.n_tables = reader.read("!B")[0]
9459 obj.auxiliary_id = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009460 reader.skip(2)
Dan Talaycof6202252013-07-02 01:00:29 -07009461 obj.capabilities = reader.read("!L")[0]
9462 obj.reserved = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009463 return obj
9464
9465 def __eq__(self, other):
9466 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07009467 if self.xid != other.xid: return False
9468 if self.datapath_id != other.datapath_id: return False
9469 if self.n_buffers != other.n_buffers: return False
9470 if self.n_tables != other.n_tables: return False
9471 if self.auxiliary_id != other.auxiliary_id: return False
9472 if self.capabilities != other.capabilities: return False
9473 if self.reserved != other.reserved: return False
9474 return True
9475
Rich Lanec2ee4b82013-04-24 17:12:38 -07009476 def pretty_print(self, q):
9477 q.text("features_reply {")
9478 with q.group():
9479 with q.indent(2):
9480 q.breakable()
9481 q.text("xid = ");
9482 if self.xid != None:
9483 q.text("%#x" % self.xid)
9484 else:
9485 q.text('None')
9486 q.text(","); q.breakable()
9487 q.text("datapath_id = ");
9488 q.text("%#x" % self.datapath_id)
9489 q.text(","); q.breakable()
9490 q.text("n_buffers = ");
9491 q.text("%#x" % self.n_buffers)
9492 q.text(","); q.breakable()
9493 q.text("n_tables = ");
9494 q.text("%#x" % self.n_tables)
9495 q.text(","); q.breakable()
9496 q.text("auxiliary_id = ");
9497 q.text("%#x" % self.auxiliary_id)
9498 q.text(","); q.breakable()
9499 q.text("capabilities = ");
9500 q.text("%#x" % self.capabilities)
9501 q.text(","); q.breakable()
9502 q.text("reserved = ");
9503 q.text("%#x" % self.reserved)
9504 q.breakable()
9505 q.text('}')
9506
Rich Lane7dcdf022013-12-11 14:45:27 -08009507message.subtypes[6] = features_reply
9508
9509class features_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -07009510 version = 4
9511 type = 5
Rich Lanec2ee4b82013-04-24 17:12:38 -07009512
9513 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08009514 if xid != None:
9515 self.xid = xid
9516 else:
9517 self.xid = None
9518 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07009519
9520 def pack(self):
9521 packed = []
9522 packed.append(struct.pack("!B", self.version))
9523 packed.append(struct.pack("!B", self.type))
9524 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9525 packed.append(struct.pack("!L", self.xid))
9526 length = sum([len(x) for x in packed])
9527 packed[2] = struct.pack("!H", length)
9528 return ''.join(packed)
9529
9530 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08009531 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07009532 obj = features_request()
Dan Talaycof6202252013-07-02 01:00:29 -07009533 _version = reader.read("!B")[0]
9534 assert(_version == 4)
9535 _type = reader.read("!B")[0]
9536 assert(_type == 5)
9537 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08009538 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08009539 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07009540 obj.xid = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009541 return obj
9542
9543 def __eq__(self, other):
9544 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07009545 if self.xid != other.xid: return False
9546 return True
9547
Rich Lanec2ee4b82013-04-24 17:12:38 -07009548 def pretty_print(self, q):
9549 q.text("features_request {")
9550 with q.group():
9551 with q.indent(2):
9552 q.breakable()
9553 q.text("xid = ");
9554 if self.xid != None:
9555 q.text("%#x" % self.xid)
9556 else:
9557 q.text('None')
9558 q.breakable()
9559 q.text('}')
9560
Rich Lane7dcdf022013-12-11 14:45:27 -08009561message.subtypes[5] = features_request
9562
9563class flow_mod(message):
9564 subtypes = {}
9565
Rich Lane95f7fc92014-01-27 17:08:16 -08009566 version = 4
9567 type = 14
9568
9569 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):
9570 if xid != None:
9571 self.xid = xid
9572 else:
9573 self.xid = None
9574 if cookie != None:
9575 self.cookie = cookie
9576 else:
9577 self.cookie = 0
9578 if cookie_mask != None:
9579 self.cookie_mask = cookie_mask
9580 else:
9581 self.cookie_mask = 0
9582 if table_id != None:
9583 self.table_id = table_id
9584 else:
9585 self.table_id = 0
9586 if _command != None:
9587 self._command = _command
9588 else:
9589 self._command = 0
9590 if idle_timeout != None:
9591 self.idle_timeout = idle_timeout
9592 else:
9593 self.idle_timeout = 0
9594 if hard_timeout != None:
9595 self.hard_timeout = hard_timeout
9596 else:
9597 self.hard_timeout = 0
9598 if priority != None:
9599 self.priority = priority
9600 else:
9601 self.priority = 0
9602 if buffer_id != None:
9603 self.buffer_id = buffer_id
9604 else:
9605 self.buffer_id = 0
9606 if out_port != None:
9607 self.out_port = out_port
9608 else:
9609 self.out_port = 0
9610 if out_group != None:
9611 self.out_group = out_group
9612 else:
9613 self.out_group = 0
9614 if flags != None:
9615 self.flags = flags
9616 else:
9617 self.flags = 0
9618 if match != None:
9619 self.match = match
9620 else:
Rich Lanee2567702015-01-26 15:04:35 -08009621 self.match = ofp.match()
Rich Lane95f7fc92014-01-27 17:08:16 -08009622 if instructions != None:
9623 self.instructions = instructions
9624 else:
9625 self.instructions = []
9626 return
9627
9628 def pack(self):
9629 packed = []
9630 packed.append(struct.pack("!B", self.version))
9631 packed.append(struct.pack("!B", self.type))
9632 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9633 packed.append(struct.pack("!L", self.xid))
9634 packed.append(struct.pack("!Q", self.cookie))
9635 packed.append(struct.pack("!Q", self.cookie_mask))
9636 packed.append(struct.pack("!B", self.table_id))
9637 packed.append(util.pack_fm_cmd(self._command))
9638 packed.append(struct.pack("!H", self.idle_timeout))
9639 packed.append(struct.pack("!H", self.hard_timeout))
9640 packed.append(struct.pack("!H", self.priority))
9641 packed.append(struct.pack("!L", self.buffer_id))
9642 packed.append(util.pack_port_no(self.out_port))
9643 packed.append(struct.pack("!L", self.out_group))
9644 packed.append(struct.pack("!H", self.flags))
9645 packed.append('\x00' * 2)
9646 packed.append(self.match.pack())
9647 packed.append(loxi.generic_util.pack_list(self.instructions))
9648 length = sum([len(x) for x in packed])
9649 packed[2] = struct.pack("!H", length)
9650 return ''.join(packed)
9651
Rich Lane7dcdf022013-12-11 14:45:27 -08009652 @staticmethod
9653 def unpack(reader):
9654 subtype, = reader.peek('B', 25)
Rich Lane95f7fc92014-01-27 17:08:16 -08009655 subclass = flow_mod.subtypes.get(subtype)
9656 if subclass:
9657 return subclass.unpack(reader)
9658
9659 obj = flow_mod()
9660 _version = reader.read("!B")[0]
9661 assert(_version == 4)
9662 _type = reader.read("!B")[0]
9663 assert(_type == 14)
9664 _length = reader.read("!H")[0]
9665 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08009666 reader = orig_reader.slice(_length, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -08009667 obj.xid = reader.read("!L")[0]
9668 obj.cookie = reader.read("!Q")[0]
9669 obj.cookie_mask = reader.read("!Q")[0]
9670 obj.table_id = reader.read("!B")[0]
9671 obj._command = util.unpack_fm_cmd(reader)
9672 obj.idle_timeout = reader.read("!H")[0]
9673 obj.hard_timeout = reader.read("!H")[0]
9674 obj.priority = reader.read("!H")[0]
9675 obj.buffer_id = reader.read("!L")[0]
9676 obj.out_port = util.unpack_port_no(reader)
9677 obj.out_group = reader.read("!L")[0]
9678 obj.flags = reader.read("!H")[0]
9679 reader.skip(2)
Rich Lanee2567702015-01-26 15:04:35 -08009680 obj.match = ofp.match.unpack(reader)
9681 obj.instructions = loxi.generic_util.unpack_list(reader, ofp.instruction.instruction.unpack)
Rich Lane95f7fc92014-01-27 17:08:16 -08009682 return obj
9683
9684 def __eq__(self, other):
9685 if type(self) != type(other): return False
9686 if self.xid != other.xid: return False
9687 if self.cookie != other.cookie: return False
9688 if self.cookie_mask != other.cookie_mask: return False
9689 if self.table_id != other.table_id: return False
9690 if self._command != other._command: return False
9691 if self.idle_timeout != other.idle_timeout: return False
9692 if self.hard_timeout != other.hard_timeout: return False
9693 if self.priority != other.priority: return False
9694 if self.buffer_id != other.buffer_id: return False
9695 if self.out_port != other.out_port: return False
9696 if self.out_group != other.out_group: return False
9697 if self.flags != other.flags: return False
9698 if self.match != other.match: return False
9699 if self.instructions != other.instructions: return False
9700 return True
9701
9702 def pretty_print(self, q):
9703 q.text("flow_mod {")
9704 with q.group():
9705 with q.indent(2):
9706 q.breakable()
9707 q.text("xid = ");
9708 if self.xid != None:
9709 q.text("%#x" % self.xid)
9710 else:
9711 q.text('None')
9712 q.text(","); q.breakable()
9713 q.text("cookie = ");
9714 q.text("%#x" % self.cookie)
9715 q.text(","); q.breakable()
9716 q.text("cookie_mask = ");
9717 q.text("%#x" % self.cookie_mask)
9718 q.text(","); q.breakable()
9719 q.text("table_id = ");
9720 q.text("%#x" % self.table_id)
9721 q.text(","); q.breakable()
9722 q.text("idle_timeout = ");
9723 q.text("%#x" % self.idle_timeout)
9724 q.text(","); q.breakable()
9725 q.text("hard_timeout = ");
9726 q.text("%#x" % self.hard_timeout)
9727 q.text(","); q.breakable()
9728 q.text("priority = ");
9729 q.text("%#x" % self.priority)
9730 q.text(","); q.breakable()
9731 q.text("buffer_id = ");
9732 q.text("%#x" % self.buffer_id)
9733 q.text(","); q.breakable()
9734 q.text("out_port = ");
9735 q.text(util.pretty_port(self.out_port))
9736 q.text(","); q.breakable()
9737 q.text("out_group = ");
9738 q.text("%#x" % self.out_group)
9739 q.text(","); q.breakable()
9740 q.text("flags = ");
9741 q.text("%#x" % self.flags)
9742 q.text(","); q.breakable()
9743 q.text("match = ");
9744 q.pp(self.match)
9745 q.text(","); q.breakable()
9746 q.text("instructions = ");
9747 q.pp(self.instructions)
9748 q.breakable()
9749 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -08009750
9751message.subtypes[14] = flow_mod
9752
9753class flow_add(flow_mod):
Dan Talaycof6202252013-07-02 01:00:29 -07009754 version = 4
9755 type = 14
9756 _command = 0
Rich Lanec2ee4b82013-04-24 17:12:38 -07009757
9758 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 -08009759 if xid != None:
9760 self.xid = xid
9761 else:
9762 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07009763 if cookie != None:
9764 self.cookie = cookie
9765 else:
9766 self.cookie = 0
9767 if cookie_mask != None:
9768 self.cookie_mask = cookie_mask
9769 else:
9770 self.cookie_mask = 0
9771 if table_id != None:
9772 self.table_id = table_id
9773 else:
9774 self.table_id = 0
9775 if idle_timeout != None:
9776 self.idle_timeout = idle_timeout
9777 else:
9778 self.idle_timeout = 0
9779 if hard_timeout != None:
9780 self.hard_timeout = hard_timeout
9781 else:
9782 self.hard_timeout = 0
9783 if priority != None:
9784 self.priority = priority
9785 else:
9786 self.priority = 0
9787 if buffer_id != None:
9788 self.buffer_id = buffer_id
9789 else:
9790 self.buffer_id = 0
9791 if out_port != None:
9792 self.out_port = out_port
9793 else:
9794 self.out_port = 0
9795 if out_group != None:
9796 self.out_group = out_group
9797 else:
9798 self.out_group = 0
9799 if flags != None:
9800 self.flags = flags
9801 else:
9802 self.flags = 0
9803 if match != None:
9804 self.match = match
9805 else:
Rich Lanee2567702015-01-26 15:04:35 -08009806 self.match = ofp.match()
Rich Lanec2ee4b82013-04-24 17:12:38 -07009807 if instructions != None:
9808 self.instructions = instructions
9809 else:
9810 self.instructions = []
Rich Lane7dcdf022013-12-11 14:45:27 -08009811 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07009812
9813 def pack(self):
9814 packed = []
9815 packed.append(struct.pack("!B", self.version))
9816 packed.append(struct.pack("!B", self.type))
9817 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9818 packed.append(struct.pack("!L", self.xid))
9819 packed.append(struct.pack("!Q", self.cookie))
9820 packed.append(struct.pack("!Q", self.cookie_mask))
9821 packed.append(struct.pack("!B", self.table_id))
Dan Talaycof6202252013-07-02 01:00:29 -07009822 packed.append(util.pack_fm_cmd(self._command))
Rich Lanec2ee4b82013-04-24 17:12:38 -07009823 packed.append(struct.pack("!H", self.idle_timeout))
9824 packed.append(struct.pack("!H", self.hard_timeout))
9825 packed.append(struct.pack("!H", self.priority))
9826 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -07009827 packed.append(util.pack_port_no(self.out_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -07009828 packed.append(struct.pack("!L", self.out_group))
9829 packed.append(struct.pack("!H", self.flags))
9830 packed.append('\x00' * 2)
9831 packed.append(self.match.pack())
Rich Lane7dcdf022013-12-11 14:45:27 -08009832 packed.append(loxi.generic_util.pack_list(self.instructions))
Rich Lanec2ee4b82013-04-24 17:12:38 -07009833 length = sum([len(x) for x in packed])
9834 packed[2] = struct.pack("!H", length)
9835 return ''.join(packed)
9836
9837 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08009838 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07009839 obj = flow_add()
Dan Talaycof6202252013-07-02 01:00:29 -07009840 _version = reader.read("!B")[0]
9841 assert(_version == 4)
9842 _type = reader.read("!B")[0]
9843 assert(_type == 14)
9844 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08009845 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08009846 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07009847 obj.xid = reader.read("!L")[0]
9848 obj.cookie = reader.read("!Q")[0]
9849 obj.cookie_mask = reader.read("!Q")[0]
9850 obj.table_id = reader.read("!B")[0]
9851 __command = util.unpack_fm_cmd(reader)
9852 assert(__command == 0)
9853 obj.idle_timeout = reader.read("!H")[0]
9854 obj.hard_timeout = reader.read("!H")[0]
9855 obj.priority = reader.read("!H")[0]
9856 obj.buffer_id = reader.read("!L")[0]
9857 obj.out_port = util.unpack_port_no(reader)
9858 obj.out_group = reader.read("!L")[0]
9859 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07009860 reader.skip(2)
Rich Lanee2567702015-01-26 15:04:35 -08009861 obj.match = ofp.match.unpack(reader)
9862 obj.instructions = loxi.generic_util.unpack_list(reader, ofp.instruction.instruction.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -07009863 return obj
9864
9865 def __eq__(self, other):
9866 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07009867 if self.xid != other.xid: return False
9868 if self.cookie != other.cookie: return False
9869 if self.cookie_mask != other.cookie_mask: return False
9870 if self.table_id != other.table_id: return False
9871 if self.idle_timeout != other.idle_timeout: return False
9872 if self.hard_timeout != other.hard_timeout: return False
9873 if self.priority != other.priority: return False
9874 if self.buffer_id != other.buffer_id: return False
9875 if self.out_port != other.out_port: return False
9876 if self.out_group != other.out_group: return False
9877 if self.flags != other.flags: return False
9878 if self.match != other.match: return False
9879 if self.instructions != other.instructions: return False
9880 return True
9881
Rich Lanec2ee4b82013-04-24 17:12:38 -07009882 def pretty_print(self, q):
9883 q.text("flow_add {")
9884 with q.group():
9885 with q.indent(2):
9886 q.breakable()
9887 q.text("xid = ");
9888 if self.xid != None:
9889 q.text("%#x" % self.xid)
9890 else:
9891 q.text('None')
9892 q.text(","); q.breakable()
9893 q.text("cookie = ");
9894 q.text("%#x" % self.cookie)
9895 q.text(","); q.breakable()
9896 q.text("cookie_mask = ");
9897 q.text("%#x" % self.cookie_mask)
9898 q.text(","); q.breakable()
9899 q.text("table_id = ");
9900 q.text("%#x" % self.table_id)
9901 q.text(","); q.breakable()
9902 q.text("idle_timeout = ");
9903 q.text("%#x" % self.idle_timeout)
9904 q.text(","); q.breakable()
9905 q.text("hard_timeout = ");
9906 q.text("%#x" % self.hard_timeout)
9907 q.text(","); q.breakable()
9908 q.text("priority = ");
9909 q.text("%#x" % self.priority)
9910 q.text(","); q.breakable()
9911 q.text("buffer_id = ");
9912 q.text("%#x" % self.buffer_id)
9913 q.text(","); q.breakable()
9914 q.text("out_port = ");
9915 q.text(util.pretty_port(self.out_port))
9916 q.text(","); q.breakable()
9917 q.text("out_group = ");
9918 q.text("%#x" % self.out_group)
9919 q.text(","); q.breakable()
9920 q.text("flags = ");
9921 q.text("%#x" % self.flags)
9922 q.text(","); q.breakable()
9923 q.text("match = ");
9924 q.pp(self.match)
9925 q.text(","); q.breakable()
9926 q.text("instructions = ");
9927 q.pp(self.instructions)
9928 q.breakable()
9929 q.text('}')
9930
Rich Lane7dcdf022013-12-11 14:45:27 -08009931flow_mod.subtypes[0] = flow_add
9932
9933class flow_delete(flow_mod):
Dan Talaycof6202252013-07-02 01:00:29 -07009934 version = 4
9935 type = 14
9936 _command = 3
Rich Lanec2ee4b82013-04-24 17:12:38 -07009937
9938 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 -08009939 if xid != None:
9940 self.xid = xid
9941 else:
9942 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07009943 if cookie != None:
9944 self.cookie = cookie
9945 else:
9946 self.cookie = 0
9947 if cookie_mask != None:
9948 self.cookie_mask = cookie_mask
9949 else:
9950 self.cookie_mask = 0
9951 if table_id != None:
9952 self.table_id = table_id
9953 else:
9954 self.table_id = 0
9955 if idle_timeout != None:
9956 self.idle_timeout = idle_timeout
9957 else:
9958 self.idle_timeout = 0
9959 if hard_timeout != None:
9960 self.hard_timeout = hard_timeout
9961 else:
9962 self.hard_timeout = 0
9963 if priority != None:
9964 self.priority = priority
9965 else:
9966 self.priority = 0
9967 if buffer_id != None:
9968 self.buffer_id = buffer_id
9969 else:
9970 self.buffer_id = 0
9971 if out_port != None:
9972 self.out_port = out_port
9973 else:
9974 self.out_port = 0
9975 if out_group != None:
9976 self.out_group = out_group
9977 else:
9978 self.out_group = 0
9979 if flags != None:
9980 self.flags = flags
9981 else:
9982 self.flags = 0
9983 if match != None:
9984 self.match = match
9985 else:
Rich Lanee2567702015-01-26 15:04:35 -08009986 self.match = ofp.match()
Rich Lanec2ee4b82013-04-24 17:12:38 -07009987 if instructions != None:
9988 self.instructions = instructions
9989 else:
9990 self.instructions = []
Rich Lane7dcdf022013-12-11 14:45:27 -08009991 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07009992
9993 def pack(self):
9994 packed = []
9995 packed.append(struct.pack("!B", self.version))
9996 packed.append(struct.pack("!B", self.type))
9997 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9998 packed.append(struct.pack("!L", self.xid))
9999 packed.append(struct.pack("!Q", self.cookie))
10000 packed.append(struct.pack("!Q", self.cookie_mask))
10001 packed.append(struct.pack("!B", self.table_id))
Dan Talaycof6202252013-07-02 01:00:29 -070010002 packed.append(util.pack_fm_cmd(self._command))
Rich Lanec2ee4b82013-04-24 17:12:38 -070010003 packed.append(struct.pack("!H", self.idle_timeout))
10004 packed.append(struct.pack("!H", self.hard_timeout))
10005 packed.append(struct.pack("!H", self.priority))
10006 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -070010007 packed.append(util.pack_port_no(self.out_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -070010008 packed.append(struct.pack("!L", self.out_group))
10009 packed.append(struct.pack("!H", self.flags))
10010 packed.append('\x00' * 2)
10011 packed.append(self.match.pack())
Rich Lane7dcdf022013-12-11 14:45:27 -080010012 packed.append(loxi.generic_util.pack_list(self.instructions))
Rich Lanec2ee4b82013-04-24 17:12:38 -070010013 length = sum([len(x) for x in packed])
10014 packed[2] = struct.pack("!H", length)
10015 return ''.join(packed)
10016
10017 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080010018 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070010019 obj = flow_delete()
Dan Talaycof6202252013-07-02 01:00:29 -070010020 _version = reader.read("!B")[0]
10021 assert(_version == 4)
10022 _type = reader.read("!B")[0]
10023 assert(_type == 14)
10024 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080010025 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080010026 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070010027 obj.xid = reader.read("!L")[0]
10028 obj.cookie = reader.read("!Q")[0]
10029 obj.cookie_mask = reader.read("!Q")[0]
10030 obj.table_id = reader.read("!B")[0]
10031 __command = util.unpack_fm_cmd(reader)
10032 assert(__command == 3)
10033 obj.idle_timeout = reader.read("!H")[0]
10034 obj.hard_timeout = reader.read("!H")[0]
10035 obj.priority = reader.read("!H")[0]
10036 obj.buffer_id = reader.read("!L")[0]
10037 obj.out_port = util.unpack_port_no(reader)
10038 obj.out_group = reader.read("!L")[0]
10039 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010040 reader.skip(2)
Rich Lanee2567702015-01-26 15:04:35 -080010041 obj.match = ofp.match.unpack(reader)
10042 obj.instructions = loxi.generic_util.unpack_list(reader, ofp.instruction.instruction.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070010043 return obj
10044
10045 def __eq__(self, other):
10046 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070010047 if self.xid != other.xid: return False
10048 if self.cookie != other.cookie: return False
10049 if self.cookie_mask != other.cookie_mask: return False
10050 if self.table_id != other.table_id: return False
10051 if self.idle_timeout != other.idle_timeout: return False
10052 if self.hard_timeout != other.hard_timeout: return False
10053 if self.priority != other.priority: return False
10054 if self.buffer_id != other.buffer_id: return False
10055 if self.out_port != other.out_port: return False
10056 if self.out_group != other.out_group: return False
10057 if self.flags != other.flags: return False
10058 if self.match != other.match: return False
10059 if self.instructions != other.instructions: return False
10060 return True
10061
Rich Lanec2ee4b82013-04-24 17:12:38 -070010062 def pretty_print(self, q):
10063 q.text("flow_delete {")
10064 with q.group():
10065 with q.indent(2):
10066 q.breakable()
10067 q.text("xid = ");
10068 if self.xid != None:
10069 q.text("%#x" % self.xid)
10070 else:
10071 q.text('None')
10072 q.text(","); q.breakable()
10073 q.text("cookie = ");
10074 q.text("%#x" % self.cookie)
10075 q.text(","); q.breakable()
10076 q.text("cookie_mask = ");
10077 q.text("%#x" % self.cookie_mask)
10078 q.text(","); q.breakable()
10079 q.text("table_id = ");
10080 q.text("%#x" % self.table_id)
10081 q.text(","); q.breakable()
10082 q.text("idle_timeout = ");
10083 q.text("%#x" % self.idle_timeout)
10084 q.text(","); q.breakable()
10085 q.text("hard_timeout = ");
10086 q.text("%#x" % self.hard_timeout)
10087 q.text(","); q.breakable()
10088 q.text("priority = ");
10089 q.text("%#x" % self.priority)
10090 q.text(","); q.breakable()
10091 q.text("buffer_id = ");
10092 q.text("%#x" % self.buffer_id)
10093 q.text(","); q.breakable()
10094 q.text("out_port = ");
10095 q.text(util.pretty_port(self.out_port))
10096 q.text(","); q.breakable()
10097 q.text("out_group = ");
10098 q.text("%#x" % self.out_group)
10099 q.text(","); q.breakable()
10100 q.text("flags = ");
10101 q.text("%#x" % self.flags)
10102 q.text(","); q.breakable()
10103 q.text("match = ");
10104 q.pp(self.match)
10105 q.text(","); q.breakable()
10106 q.text("instructions = ");
10107 q.pp(self.instructions)
10108 q.breakable()
10109 q.text('}')
10110
Rich Lane7dcdf022013-12-11 14:45:27 -080010111flow_mod.subtypes[3] = flow_delete
10112
10113class flow_delete_strict(flow_mod):
Dan Talaycof6202252013-07-02 01:00:29 -070010114 version = 4
10115 type = 14
10116 _command = 4
Rich Lanec2ee4b82013-04-24 17:12:38 -070010117
10118 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 -080010119 if xid != None:
10120 self.xid = xid
10121 else:
10122 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070010123 if cookie != None:
10124 self.cookie = cookie
10125 else:
10126 self.cookie = 0
10127 if cookie_mask != None:
10128 self.cookie_mask = cookie_mask
10129 else:
10130 self.cookie_mask = 0
10131 if table_id != None:
10132 self.table_id = table_id
10133 else:
10134 self.table_id = 0
10135 if idle_timeout != None:
10136 self.idle_timeout = idle_timeout
10137 else:
10138 self.idle_timeout = 0
10139 if hard_timeout != None:
10140 self.hard_timeout = hard_timeout
10141 else:
10142 self.hard_timeout = 0
10143 if priority != None:
10144 self.priority = priority
10145 else:
10146 self.priority = 0
10147 if buffer_id != None:
10148 self.buffer_id = buffer_id
10149 else:
10150 self.buffer_id = 0
10151 if out_port != None:
10152 self.out_port = out_port
10153 else:
10154 self.out_port = 0
10155 if out_group != None:
10156 self.out_group = out_group
10157 else:
10158 self.out_group = 0
10159 if flags != None:
10160 self.flags = flags
10161 else:
10162 self.flags = 0
10163 if match != None:
10164 self.match = match
10165 else:
Rich Lanee2567702015-01-26 15:04:35 -080010166 self.match = ofp.match()
Rich Lanec2ee4b82013-04-24 17:12:38 -070010167 if instructions != None:
10168 self.instructions = instructions
10169 else:
10170 self.instructions = []
Rich Lane7dcdf022013-12-11 14:45:27 -080010171 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070010172
10173 def pack(self):
10174 packed = []
10175 packed.append(struct.pack("!B", self.version))
10176 packed.append(struct.pack("!B", self.type))
10177 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10178 packed.append(struct.pack("!L", self.xid))
10179 packed.append(struct.pack("!Q", self.cookie))
10180 packed.append(struct.pack("!Q", self.cookie_mask))
10181 packed.append(struct.pack("!B", self.table_id))
Dan Talaycof6202252013-07-02 01:00:29 -070010182 packed.append(util.pack_fm_cmd(self._command))
Rich Lanec2ee4b82013-04-24 17:12:38 -070010183 packed.append(struct.pack("!H", self.idle_timeout))
10184 packed.append(struct.pack("!H", self.hard_timeout))
10185 packed.append(struct.pack("!H", self.priority))
10186 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -070010187 packed.append(util.pack_port_no(self.out_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -070010188 packed.append(struct.pack("!L", self.out_group))
10189 packed.append(struct.pack("!H", self.flags))
10190 packed.append('\x00' * 2)
10191 packed.append(self.match.pack())
Rich Lane7dcdf022013-12-11 14:45:27 -080010192 packed.append(loxi.generic_util.pack_list(self.instructions))
Rich Lanec2ee4b82013-04-24 17:12:38 -070010193 length = sum([len(x) for x in packed])
10194 packed[2] = struct.pack("!H", length)
10195 return ''.join(packed)
10196
10197 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080010198 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070010199 obj = flow_delete_strict()
Dan Talaycof6202252013-07-02 01:00:29 -070010200 _version = reader.read("!B")[0]
10201 assert(_version == 4)
10202 _type = reader.read("!B")[0]
10203 assert(_type == 14)
10204 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080010205 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080010206 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070010207 obj.xid = reader.read("!L")[0]
10208 obj.cookie = reader.read("!Q")[0]
10209 obj.cookie_mask = reader.read("!Q")[0]
10210 obj.table_id = reader.read("!B")[0]
10211 __command = util.unpack_fm_cmd(reader)
10212 assert(__command == 4)
10213 obj.idle_timeout = reader.read("!H")[0]
10214 obj.hard_timeout = reader.read("!H")[0]
10215 obj.priority = reader.read("!H")[0]
10216 obj.buffer_id = reader.read("!L")[0]
10217 obj.out_port = util.unpack_port_no(reader)
10218 obj.out_group = reader.read("!L")[0]
10219 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010220 reader.skip(2)
Rich Lanee2567702015-01-26 15:04:35 -080010221 obj.match = ofp.match.unpack(reader)
10222 obj.instructions = loxi.generic_util.unpack_list(reader, ofp.instruction.instruction.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070010223 return obj
10224
10225 def __eq__(self, other):
10226 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070010227 if self.xid != other.xid: return False
10228 if self.cookie != other.cookie: return False
10229 if self.cookie_mask != other.cookie_mask: return False
10230 if self.table_id != other.table_id: return False
10231 if self.idle_timeout != other.idle_timeout: return False
10232 if self.hard_timeout != other.hard_timeout: return False
10233 if self.priority != other.priority: return False
10234 if self.buffer_id != other.buffer_id: return False
10235 if self.out_port != other.out_port: return False
10236 if self.out_group != other.out_group: return False
10237 if self.flags != other.flags: return False
10238 if self.match != other.match: return False
10239 if self.instructions != other.instructions: return False
10240 return True
10241
Rich Lanec2ee4b82013-04-24 17:12:38 -070010242 def pretty_print(self, q):
10243 q.text("flow_delete_strict {")
10244 with q.group():
10245 with q.indent(2):
10246 q.breakable()
10247 q.text("xid = ");
10248 if self.xid != None:
10249 q.text("%#x" % self.xid)
10250 else:
10251 q.text('None')
10252 q.text(","); q.breakable()
10253 q.text("cookie = ");
10254 q.text("%#x" % self.cookie)
10255 q.text(","); q.breakable()
10256 q.text("cookie_mask = ");
10257 q.text("%#x" % self.cookie_mask)
10258 q.text(","); q.breakable()
10259 q.text("table_id = ");
10260 q.text("%#x" % self.table_id)
10261 q.text(","); q.breakable()
10262 q.text("idle_timeout = ");
10263 q.text("%#x" % self.idle_timeout)
10264 q.text(","); q.breakable()
10265 q.text("hard_timeout = ");
10266 q.text("%#x" % self.hard_timeout)
10267 q.text(","); q.breakable()
10268 q.text("priority = ");
10269 q.text("%#x" % self.priority)
10270 q.text(","); q.breakable()
10271 q.text("buffer_id = ");
10272 q.text("%#x" % self.buffer_id)
10273 q.text(","); q.breakable()
10274 q.text("out_port = ");
10275 q.text(util.pretty_port(self.out_port))
10276 q.text(","); q.breakable()
10277 q.text("out_group = ");
10278 q.text("%#x" % self.out_group)
10279 q.text(","); q.breakable()
10280 q.text("flags = ");
10281 q.text("%#x" % self.flags)
10282 q.text(","); q.breakable()
10283 q.text("match = ");
10284 q.pp(self.match)
10285 q.text(","); q.breakable()
10286 q.text("instructions = ");
10287 q.pp(self.instructions)
10288 q.breakable()
10289 q.text('}')
10290
Rich Lane7dcdf022013-12-11 14:45:27 -080010291flow_mod.subtypes[4] = flow_delete_strict
10292
10293class flow_mod_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -070010294 version = 4
10295 type = 1
10296 err_type = 5
10297
10298 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080010299 if xid != None:
10300 self.xid = xid
10301 else:
10302 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -070010303 if code != None:
10304 self.code = code
10305 else:
10306 self.code = 0
10307 if data != None:
10308 self.data = data
10309 else:
10310 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080010311 return
Rich Lane6f4978c2013-10-20 21:33:52 -070010312
10313 def pack(self):
10314 packed = []
10315 packed.append(struct.pack("!B", self.version))
10316 packed.append(struct.pack("!B", self.type))
10317 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10318 packed.append(struct.pack("!L", self.xid))
10319 packed.append(struct.pack("!H", self.err_type))
10320 packed.append(struct.pack("!H", self.code))
10321 packed.append(self.data)
10322 length = sum([len(x) for x in packed])
10323 packed[2] = struct.pack("!H", length)
10324 return ''.join(packed)
10325
10326 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080010327 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -070010328 obj = flow_mod_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -070010329 _version = reader.read("!B")[0]
10330 assert(_version == 4)
10331 _type = reader.read("!B")[0]
10332 assert(_type == 1)
10333 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080010334 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080010335 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -070010336 obj.xid = reader.read("!L")[0]
10337 _err_type = reader.read("!H")[0]
10338 assert(_err_type == 5)
10339 obj.code = reader.read("!H")[0]
10340 obj.data = str(reader.read_all())
10341 return obj
10342
10343 def __eq__(self, other):
10344 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -070010345 if self.xid != other.xid: return False
10346 if self.code != other.code: return False
10347 if self.data != other.data: return False
10348 return True
10349
Rich Lane6f4978c2013-10-20 21:33:52 -070010350 def pretty_print(self, q):
10351 q.text("flow_mod_failed_error_msg {")
10352 with q.group():
10353 with q.indent(2):
10354 q.breakable()
10355 q.text("xid = ");
10356 if self.xid != None:
10357 q.text("%#x" % self.xid)
10358 else:
10359 q.text('None')
10360 q.text(","); q.breakable()
10361 q.text("code = ");
10362 q.text("%#x" % self.code)
10363 q.text(","); q.breakable()
10364 q.text("data = ");
10365 q.pp(self.data)
10366 q.breakable()
10367 q.text('}')
10368
Rich Lane7dcdf022013-12-11 14:45:27 -080010369error_msg.subtypes[5] = flow_mod_failed_error_msg
10370
10371class flow_modify(flow_mod):
Dan Talaycof6202252013-07-02 01:00:29 -070010372 version = 4
10373 type = 14
10374 _command = 1
Rich Lanec2ee4b82013-04-24 17:12:38 -070010375
10376 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 -080010377 if xid != None:
10378 self.xid = xid
10379 else:
10380 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070010381 if cookie != None:
10382 self.cookie = cookie
10383 else:
10384 self.cookie = 0
10385 if cookie_mask != None:
10386 self.cookie_mask = cookie_mask
10387 else:
10388 self.cookie_mask = 0
10389 if table_id != None:
10390 self.table_id = table_id
10391 else:
10392 self.table_id = 0
10393 if idle_timeout != None:
10394 self.idle_timeout = idle_timeout
10395 else:
10396 self.idle_timeout = 0
10397 if hard_timeout != None:
10398 self.hard_timeout = hard_timeout
10399 else:
10400 self.hard_timeout = 0
10401 if priority != None:
10402 self.priority = priority
10403 else:
10404 self.priority = 0
10405 if buffer_id != None:
10406 self.buffer_id = buffer_id
10407 else:
10408 self.buffer_id = 0
10409 if out_port != None:
10410 self.out_port = out_port
10411 else:
10412 self.out_port = 0
10413 if out_group != None:
10414 self.out_group = out_group
10415 else:
10416 self.out_group = 0
10417 if flags != None:
10418 self.flags = flags
10419 else:
10420 self.flags = 0
10421 if match != None:
10422 self.match = match
10423 else:
Rich Lanee2567702015-01-26 15:04:35 -080010424 self.match = ofp.match()
Rich Lanec2ee4b82013-04-24 17:12:38 -070010425 if instructions != None:
10426 self.instructions = instructions
10427 else:
10428 self.instructions = []
Rich Lane7dcdf022013-12-11 14:45:27 -080010429 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070010430
10431 def pack(self):
10432 packed = []
10433 packed.append(struct.pack("!B", self.version))
10434 packed.append(struct.pack("!B", self.type))
10435 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10436 packed.append(struct.pack("!L", self.xid))
10437 packed.append(struct.pack("!Q", self.cookie))
10438 packed.append(struct.pack("!Q", self.cookie_mask))
10439 packed.append(struct.pack("!B", self.table_id))
Dan Talaycof6202252013-07-02 01:00:29 -070010440 packed.append(util.pack_fm_cmd(self._command))
Rich Lanec2ee4b82013-04-24 17:12:38 -070010441 packed.append(struct.pack("!H", self.idle_timeout))
10442 packed.append(struct.pack("!H", self.hard_timeout))
10443 packed.append(struct.pack("!H", self.priority))
10444 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -070010445 packed.append(util.pack_port_no(self.out_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -070010446 packed.append(struct.pack("!L", self.out_group))
10447 packed.append(struct.pack("!H", self.flags))
10448 packed.append('\x00' * 2)
10449 packed.append(self.match.pack())
Rich Lane7dcdf022013-12-11 14:45:27 -080010450 packed.append(loxi.generic_util.pack_list(self.instructions))
Rich Lanec2ee4b82013-04-24 17:12:38 -070010451 length = sum([len(x) for x in packed])
10452 packed[2] = struct.pack("!H", length)
10453 return ''.join(packed)
10454
10455 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080010456 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070010457 obj = flow_modify()
Dan Talaycof6202252013-07-02 01:00:29 -070010458 _version = reader.read("!B")[0]
10459 assert(_version == 4)
10460 _type = reader.read("!B")[0]
10461 assert(_type == 14)
10462 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080010463 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080010464 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070010465 obj.xid = reader.read("!L")[0]
10466 obj.cookie = reader.read("!Q")[0]
10467 obj.cookie_mask = reader.read("!Q")[0]
10468 obj.table_id = reader.read("!B")[0]
10469 __command = util.unpack_fm_cmd(reader)
10470 assert(__command == 1)
10471 obj.idle_timeout = reader.read("!H")[0]
10472 obj.hard_timeout = reader.read("!H")[0]
10473 obj.priority = reader.read("!H")[0]
10474 obj.buffer_id = reader.read("!L")[0]
10475 obj.out_port = util.unpack_port_no(reader)
10476 obj.out_group = reader.read("!L")[0]
10477 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010478 reader.skip(2)
Rich Lanee2567702015-01-26 15:04:35 -080010479 obj.match = ofp.match.unpack(reader)
10480 obj.instructions = loxi.generic_util.unpack_list(reader, ofp.instruction.instruction.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070010481 return obj
10482
10483 def __eq__(self, other):
10484 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070010485 if self.xid != other.xid: return False
10486 if self.cookie != other.cookie: return False
10487 if self.cookie_mask != other.cookie_mask: return False
10488 if self.table_id != other.table_id: return False
10489 if self.idle_timeout != other.idle_timeout: return False
10490 if self.hard_timeout != other.hard_timeout: return False
10491 if self.priority != other.priority: return False
10492 if self.buffer_id != other.buffer_id: return False
10493 if self.out_port != other.out_port: return False
10494 if self.out_group != other.out_group: return False
10495 if self.flags != other.flags: return False
10496 if self.match != other.match: return False
10497 if self.instructions != other.instructions: return False
10498 return True
10499
Rich Lanec2ee4b82013-04-24 17:12:38 -070010500 def pretty_print(self, q):
10501 q.text("flow_modify {")
10502 with q.group():
10503 with q.indent(2):
10504 q.breakable()
10505 q.text("xid = ");
10506 if self.xid != None:
10507 q.text("%#x" % self.xid)
10508 else:
10509 q.text('None')
10510 q.text(","); q.breakable()
10511 q.text("cookie = ");
10512 q.text("%#x" % self.cookie)
10513 q.text(","); q.breakable()
10514 q.text("cookie_mask = ");
10515 q.text("%#x" % self.cookie_mask)
10516 q.text(","); q.breakable()
10517 q.text("table_id = ");
10518 q.text("%#x" % self.table_id)
10519 q.text(","); q.breakable()
10520 q.text("idle_timeout = ");
10521 q.text("%#x" % self.idle_timeout)
10522 q.text(","); q.breakable()
10523 q.text("hard_timeout = ");
10524 q.text("%#x" % self.hard_timeout)
10525 q.text(","); q.breakable()
10526 q.text("priority = ");
10527 q.text("%#x" % self.priority)
10528 q.text(","); q.breakable()
10529 q.text("buffer_id = ");
10530 q.text("%#x" % self.buffer_id)
10531 q.text(","); q.breakable()
10532 q.text("out_port = ");
10533 q.text(util.pretty_port(self.out_port))
10534 q.text(","); q.breakable()
10535 q.text("out_group = ");
10536 q.text("%#x" % self.out_group)
10537 q.text(","); q.breakable()
10538 q.text("flags = ");
10539 q.text("%#x" % self.flags)
10540 q.text(","); q.breakable()
10541 q.text("match = ");
10542 q.pp(self.match)
10543 q.text(","); q.breakable()
10544 q.text("instructions = ");
10545 q.pp(self.instructions)
10546 q.breakable()
10547 q.text('}')
10548
Rich Lane7dcdf022013-12-11 14:45:27 -080010549flow_mod.subtypes[1] = flow_modify
10550
10551class flow_modify_strict(flow_mod):
Dan Talaycof6202252013-07-02 01:00:29 -070010552 version = 4
10553 type = 14
10554 _command = 2
Rich Lanec2ee4b82013-04-24 17:12:38 -070010555
10556 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 -080010557 if xid != None:
10558 self.xid = xid
10559 else:
10560 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070010561 if cookie != None:
10562 self.cookie = cookie
10563 else:
10564 self.cookie = 0
10565 if cookie_mask != None:
10566 self.cookie_mask = cookie_mask
10567 else:
10568 self.cookie_mask = 0
10569 if table_id != None:
10570 self.table_id = table_id
10571 else:
10572 self.table_id = 0
10573 if idle_timeout != None:
10574 self.idle_timeout = idle_timeout
10575 else:
10576 self.idle_timeout = 0
10577 if hard_timeout != None:
10578 self.hard_timeout = hard_timeout
10579 else:
10580 self.hard_timeout = 0
10581 if priority != None:
10582 self.priority = priority
10583 else:
10584 self.priority = 0
10585 if buffer_id != None:
10586 self.buffer_id = buffer_id
10587 else:
10588 self.buffer_id = 0
10589 if out_port != None:
10590 self.out_port = out_port
10591 else:
10592 self.out_port = 0
10593 if out_group != None:
10594 self.out_group = out_group
10595 else:
10596 self.out_group = 0
10597 if flags != None:
10598 self.flags = flags
10599 else:
10600 self.flags = 0
10601 if match != None:
10602 self.match = match
10603 else:
Rich Lanee2567702015-01-26 15:04:35 -080010604 self.match = ofp.match()
Rich Lanec2ee4b82013-04-24 17:12:38 -070010605 if instructions != None:
10606 self.instructions = instructions
10607 else:
10608 self.instructions = []
Rich Lane7dcdf022013-12-11 14:45:27 -080010609 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070010610
10611 def pack(self):
10612 packed = []
10613 packed.append(struct.pack("!B", self.version))
10614 packed.append(struct.pack("!B", self.type))
10615 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10616 packed.append(struct.pack("!L", self.xid))
10617 packed.append(struct.pack("!Q", self.cookie))
10618 packed.append(struct.pack("!Q", self.cookie_mask))
10619 packed.append(struct.pack("!B", self.table_id))
Dan Talaycof6202252013-07-02 01:00:29 -070010620 packed.append(util.pack_fm_cmd(self._command))
Rich Lanec2ee4b82013-04-24 17:12:38 -070010621 packed.append(struct.pack("!H", self.idle_timeout))
10622 packed.append(struct.pack("!H", self.hard_timeout))
10623 packed.append(struct.pack("!H", self.priority))
10624 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -070010625 packed.append(util.pack_port_no(self.out_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -070010626 packed.append(struct.pack("!L", self.out_group))
10627 packed.append(struct.pack("!H", self.flags))
10628 packed.append('\x00' * 2)
10629 packed.append(self.match.pack())
Rich Lane7dcdf022013-12-11 14:45:27 -080010630 packed.append(loxi.generic_util.pack_list(self.instructions))
Rich Lanec2ee4b82013-04-24 17:12:38 -070010631 length = sum([len(x) for x in packed])
10632 packed[2] = struct.pack("!H", length)
10633 return ''.join(packed)
10634
10635 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080010636 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070010637 obj = flow_modify_strict()
Dan Talaycof6202252013-07-02 01:00:29 -070010638 _version = reader.read("!B")[0]
10639 assert(_version == 4)
10640 _type = reader.read("!B")[0]
10641 assert(_type == 14)
10642 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080010643 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080010644 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070010645 obj.xid = reader.read("!L")[0]
10646 obj.cookie = reader.read("!Q")[0]
10647 obj.cookie_mask = reader.read("!Q")[0]
10648 obj.table_id = reader.read("!B")[0]
10649 __command = util.unpack_fm_cmd(reader)
10650 assert(__command == 2)
10651 obj.idle_timeout = reader.read("!H")[0]
10652 obj.hard_timeout = reader.read("!H")[0]
10653 obj.priority = reader.read("!H")[0]
10654 obj.buffer_id = reader.read("!L")[0]
10655 obj.out_port = util.unpack_port_no(reader)
10656 obj.out_group = reader.read("!L")[0]
10657 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010658 reader.skip(2)
Rich Lanee2567702015-01-26 15:04:35 -080010659 obj.match = ofp.match.unpack(reader)
10660 obj.instructions = loxi.generic_util.unpack_list(reader, ofp.instruction.instruction.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070010661 return obj
10662
10663 def __eq__(self, other):
10664 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070010665 if self.xid != other.xid: return False
10666 if self.cookie != other.cookie: return False
10667 if self.cookie_mask != other.cookie_mask: return False
10668 if self.table_id != other.table_id: return False
10669 if self.idle_timeout != other.idle_timeout: return False
10670 if self.hard_timeout != other.hard_timeout: return False
10671 if self.priority != other.priority: return False
10672 if self.buffer_id != other.buffer_id: return False
10673 if self.out_port != other.out_port: return False
10674 if self.out_group != other.out_group: return False
10675 if self.flags != other.flags: return False
10676 if self.match != other.match: return False
10677 if self.instructions != other.instructions: return False
10678 return True
10679
Rich Lanec2ee4b82013-04-24 17:12:38 -070010680 def pretty_print(self, q):
10681 q.text("flow_modify_strict {")
10682 with q.group():
10683 with q.indent(2):
10684 q.breakable()
10685 q.text("xid = ");
10686 if self.xid != None:
10687 q.text("%#x" % self.xid)
10688 else:
10689 q.text('None')
10690 q.text(","); q.breakable()
10691 q.text("cookie = ");
10692 q.text("%#x" % self.cookie)
10693 q.text(","); q.breakable()
10694 q.text("cookie_mask = ");
10695 q.text("%#x" % self.cookie_mask)
10696 q.text(","); q.breakable()
10697 q.text("table_id = ");
10698 q.text("%#x" % self.table_id)
10699 q.text(","); q.breakable()
10700 q.text("idle_timeout = ");
10701 q.text("%#x" % self.idle_timeout)
10702 q.text(","); q.breakable()
10703 q.text("hard_timeout = ");
10704 q.text("%#x" % self.hard_timeout)
10705 q.text(","); q.breakable()
10706 q.text("priority = ");
10707 q.text("%#x" % self.priority)
10708 q.text(","); q.breakable()
10709 q.text("buffer_id = ");
10710 q.text("%#x" % self.buffer_id)
10711 q.text(","); q.breakable()
10712 q.text("out_port = ");
10713 q.text(util.pretty_port(self.out_port))
10714 q.text(","); q.breakable()
10715 q.text("out_group = ");
10716 q.text("%#x" % self.out_group)
10717 q.text(","); q.breakable()
10718 q.text("flags = ");
10719 q.text("%#x" % self.flags)
10720 q.text(","); q.breakable()
10721 q.text("match = ");
10722 q.pp(self.match)
10723 q.text(","); q.breakable()
10724 q.text("instructions = ");
10725 q.pp(self.instructions)
10726 q.breakable()
10727 q.text('}')
10728
Rich Lane7dcdf022013-12-11 14:45:27 -080010729flow_mod.subtypes[2] = flow_modify_strict
10730
10731class flow_removed(message):
Dan Talaycof6202252013-07-02 01:00:29 -070010732 version = 4
10733 type = 11
Rich Lanec2ee4b82013-04-24 17:12:38 -070010734
10735 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 -080010736 if xid != None:
10737 self.xid = xid
10738 else:
10739 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070010740 if cookie != None:
10741 self.cookie = cookie
10742 else:
10743 self.cookie = 0
10744 if priority != None:
10745 self.priority = priority
10746 else:
10747 self.priority = 0
10748 if reason != None:
10749 self.reason = reason
10750 else:
10751 self.reason = 0
10752 if table_id != None:
10753 self.table_id = table_id
10754 else:
10755 self.table_id = 0
10756 if duration_sec != None:
10757 self.duration_sec = duration_sec
10758 else:
10759 self.duration_sec = 0
10760 if duration_nsec != None:
10761 self.duration_nsec = duration_nsec
10762 else:
10763 self.duration_nsec = 0
10764 if idle_timeout != None:
10765 self.idle_timeout = idle_timeout
10766 else:
10767 self.idle_timeout = 0
10768 if hard_timeout != None:
10769 self.hard_timeout = hard_timeout
10770 else:
10771 self.hard_timeout = 0
10772 if packet_count != None:
10773 self.packet_count = packet_count
10774 else:
10775 self.packet_count = 0
10776 if byte_count != None:
10777 self.byte_count = byte_count
10778 else:
10779 self.byte_count = 0
10780 if match != None:
10781 self.match = match
10782 else:
Rich Lanee2567702015-01-26 15:04:35 -080010783 self.match = ofp.match()
Rich Lane7dcdf022013-12-11 14:45:27 -080010784 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070010785
10786 def pack(self):
10787 packed = []
10788 packed.append(struct.pack("!B", self.version))
10789 packed.append(struct.pack("!B", self.type))
10790 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10791 packed.append(struct.pack("!L", self.xid))
10792 packed.append(struct.pack("!Q", self.cookie))
10793 packed.append(struct.pack("!H", self.priority))
10794 packed.append(struct.pack("!B", self.reason))
10795 packed.append(struct.pack("!B", self.table_id))
10796 packed.append(struct.pack("!L", self.duration_sec))
10797 packed.append(struct.pack("!L", self.duration_nsec))
10798 packed.append(struct.pack("!H", self.idle_timeout))
10799 packed.append(struct.pack("!H", self.hard_timeout))
10800 packed.append(struct.pack("!Q", self.packet_count))
10801 packed.append(struct.pack("!Q", self.byte_count))
10802 packed.append(self.match.pack())
10803 length = sum([len(x) for x in packed])
10804 packed[2] = struct.pack("!H", length)
10805 return ''.join(packed)
10806
10807 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080010808 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070010809 obj = flow_removed()
Dan Talaycof6202252013-07-02 01:00:29 -070010810 _version = reader.read("!B")[0]
10811 assert(_version == 4)
10812 _type = reader.read("!B")[0]
10813 assert(_type == 11)
10814 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080010815 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080010816 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070010817 obj.xid = reader.read("!L")[0]
10818 obj.cookie = reader.read("!Q")[0]
10819 obj.priority = reader.read("!H")[0]
10820 obj.reason = reader.read("!B")[0]
10821 obj.table_id = reader.read("!B")[0]
10822 obj.duration_sec = reader.read("!L")[0]
10823 obj.duration_nsec = reader.read("!L")[0]
10824 obj.idle_timeout = reader.read("!H")[0]
10825 obj.hard_timeout = reader.read("!H")[0]
10826 obj.packet_count = reader.read("!Q")[0]
10827 obj.byte_count = reader.read("!Q")[0]
Rich Lanee2567702015-01-26 15:04:35 -080010828 obj.match = ofp.match.unpack(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -070010829 return obj
10830
10831 def __eq__(self, other):
10832 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070010833 if self.xid != other.xid: return False
10834 if self.cookie != other.cookie: return False
10835 if self.priority != other.priority: return False
10836 if self.reason != other.reason: return False
10837 if self.table_id != other.table_id: return False
10838 if self.duration_sec != other.duration_sec: return False
10839 if self.duration_nsec != other.duration_nsec: return False
10840 if self.idle_timeout != other.idle_timeout: return False
10841 if self.hard_timeout != other.hard_timeout: return False
10842 if self.packet_count != other.packet_count: return False
10843 if self.byte_count != other.byte_count: return False
10844 if self.match != other.match: return False
10845 return True
10846
Rich Lanec2ee4b82013-04-24 17:12:38 -070010847 def pretty_print(self, q):
10848 q.text("flow_removed {")
10849 with q.group():
10850 with q.indent(2):
10851 q.breakable()
10852 q.text("xid = ");
10853 if self.xid != None:
10854 q.text("%#x" % self.xid)
10855 else:
10856 q.text('None')
10857 q.text(","); q.breakable()
10858 q.text("cookie = ");
10859 q.text("%#x" % self.cookie)
10860 q.text(","); q.breakable()
10861 q.text("priority = ");
10862 q.text("%#x" % self.priority)
10863 q.text(","); q.breakable()
10864 q.text("reason = ");
10865 q.text("%#x" % self.reason)
10866 q.text(","); q.breakable()
10867 q.text("table_id = ");
10868 q.text("%#x" % self.table_id)
10869 q.text(","); q.breakable()
10870 q.text("duration_sec = ");
10871 q.text("%#x" % self.duration_sec)
10872 q.text(","); q.breakable()
10873 q.text("duration_nsec = ");
10874 q.text("%#x" % self.duration_nsec)
10875 q.text(","); q.breakable()
10876 q.text("idle_timeout = ");
10877 q.text("%#x" % self.idle_timeout)
10878 q.text(","); q.breakable()
10879 q.text("hard_timeout = ");
10880 q.text("%#x" % self.hard_timeout)
10881 q.text(","); q.breakable()
10882 q.text("packet_count = ");
10883 q.text("%#x" % self.packet_count)
10884 q.text(","); q.breakable()
10885 q.text("byte_count = ");
10886 q.text("%#x" % self.byte_count)
10887 q.text(","); q.breakable()
10888 q.text("match = ");
10889 q.pp(self.match)
10890 q.breakable()
10891 q.text('}')
10892
Rich Lane7dcdf022013-12-11 14:45:27 -080010893message.subtypes[11] = flow_removed
10894
10895class flow_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070010896 version = 4
10897 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070010898 stats_type = 1
10899
10900 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080010901 if xid != None:
10902 self.xid = xid
10903 else:
10904 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070010905 if flags != None:
10906 self.flags = flags
10907 else:
10908 self.flags = 0
10909 if entries != None:
10910 self.entries = entries
10911 else:
10912 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -080010913 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070010914
10915 def pack(self):
10916 packed = []
10917 packed.append(struct.pack("!B", self.version))
10918 packed.append(struct.pack("!B", self.type))
10919 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10920 packed.append(struct.pack("!L", self.xid))
10921 packed.append(struct.pack("!H", self.stats_type))
10922 packed.append(struct.pack("!H", self.flags))
10923 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080010924 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -070010925 length = sum([len(x) for x in packed])
10926 packed[2] = struct.pack("!H", length)
10927 return ''.join(packed)
10928
10929 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080010930 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070010931 obj = flow_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070010932 _version = reader.read("!B")[0]
10933 assert(_version == 4)
10934 _type = reader.read("!B")[0]
10935 assert(_type == 19)
10936 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080010937 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080010938 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070010939 obj.xid = reader.read("!L")[0]
10940 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010941 assert(_stats_type == 1)
Dan Talaycof6202252013-07-02 01:00:29 -070010942 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070010943 reader.skip(4)
Rich Lanee2567702015-01-26 15:04:35 -080010944 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.flow_stats_entry.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070010945 return obj
10946
10947 def __eq__(self, other):
10948 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070010949 if self.xid != other.xid: return False
10950 if self.flags != other.flags: return False
10951 if self.entries != other.entries: return False
10952 return True
10953
Rich Lanec2ee4b82013-04-24 17:12:38 -070010954 def pretty_print(self, q):
10955 q.text("flow_stats_reply {")
10956 with q.group():
10957 with q.indent(2):
10958 q.breakable()
10959 q.text("xid = ");
10960 if self.xid != None:
10961 q.text("%#x" % self.xid)
10962 else:
10963 q.text('None')
10964 q.text(","); q.breakable()
10965 q.text("flags = ");
10966 q.text("%#x" % self.flags)
10967 q.text(","); q.breakable()
10968 q.text("entries = ");
10969 q.pp(self.entries)
10970 q.breakable()
10971 q.text('}')
10972
Rich Lane7dcdf022013-12-11 14:45:27 -080010973stats_reply.subtypes[1] = flow_stats_reply
10974
10975class flow_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070010976 version = 4
10977 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070010978 stats_type = 1
10979
10980 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 -080010981 if xid != None:
10982 self.xid = xid
10983 else:
10984 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070010985 if flags != None:
10986 self.flags = flags
10987 else:
10988 self.flags = 0
10989 if table_id != None:
10990 self.table_id = table_id
10991 else:
10992 self.table_id = 0
10993 if out_port != None:
10994 self.out_port = out_port
10995 else:
10996 self.out_port = 0
10997 if out_group != None:
10998 self.out_group = out_group
10999 else:
11000 self.out_group = 0
11001 if cookie != None:
11002 self.cookie = cookie
11003 else:
11004 self.cookie = 0
11005 if cookie_mask != None:
11006 self.cookie_mask = cookie_mask
11007 else:
11008 self.cookie_mask = 0
11009 if match != None:
11010 self.match = match
11011 else:
Rich Lanee2567702015-01-26 15:04:35 -080011012 self.match = ofp.match()
Rich Lane7dcdf022013-12-11 14:45:27 -080011013 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070011014
11015 def pack(self):
11016 packed = []
11017 packed.append(struct.pack("!B", self.version))
11018 packed.append(struct.pack("!B", self.type))
11019 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11020 packed.append(struct.pack("!L", self.xid))
11021 packed.append(struct.pack("!H", self.stats_type))
11022 packed.append(struct.pack("!H", self.flags))
11023 packed.append('\x00' * 4)
11024 packed.append(struct.pack("!B", self.table_id))
11025 packed.append('\x00' * 3)
Dan Talaycof6202252013-07-02 01:00:29 -070011026 packed.append(util.pack_port_no(self.out_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -070011027 packed.append(struct.pack("!L", self.out_group))
11028 packed.append('\x00' * 4)
11029 packed.append(struct.pack("!Q", self.cookie))
11030 packed.append(struct.pack("!Q", self.cookie_mask))
11031 packed.append(self.match.pack())
11032 length = sum([len(x) for x in packed])
11033 packed[2] = struct.pack("!H", length)
11034 return ''.join(packed)
11035
11036 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080011037 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070011038 obj = flow_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070011039 _version = reader.read("!B")[0]
11040 assert(_version == 4)
11041 _type = reader.read("!B")[0]
11042 assert(_type == 18)
11043 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011044 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080011045 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070011046 obj.xid = reader.read("!L")[0]
11047 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011048 assert(_stats_type == 1)
Dan Talaycof6202252013-07-02 01:00:29 -070011049 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011050 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -070011051 obj.table_id = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011052 reader.skip(3)
Dan Talaycof6202252013-07-02 01:00:29 -070011053 obj.out_port = util.unpack_port_no(reader)
11054 obj.out_group = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011055 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -070011056 obj.cookie = reader.read("!Q")[0]
11057 obj.cookie_mask = reader.read("!Q")[0]
Rich Lanee2567702015-01-26 15:04:35 -080011058 obj.match = ofp.match.unpack(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -070011059 return obj
11060
11061 def __eq__(self, other):
11062 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070011063 if self.xid != other.xid: return False
11064 if self.flags != other.flags: return False
11065 if self.table_id != other.table_id: return False
11066 if self.out_port != other.out_port: return False
11067 if self.out_group != other.out_group: return False
11068 if self.cookie != other.cookie: return False
11069 if self.cookie_mask != other.cookie_mask: return False
11070 if self.match != other.match: return False
11071 return True
11072
Rich Lanec2ee4b82013-04-24 17:12:38 -070011073 def pretty_print(self, q):
11074 q.text("flow_stats_request {")
11075 with q.group():
11076 with q.indent(2):
11077 q.breakable()
11078 q.text("xid = ");
11079 if self.xid != None:
11080 q.text("%#x" % self.xid)
11081 else:
11082 q.text('None')
11083 q.text(","); q.breakable()
11084 q.text("flags = ");
11085 q.text("%#x" % self.flags)
11086 q.text(","); q.breakable()
11087 q.text("table_id = ");
11088 q.text("%#x" % self.table_id)
11089 q.text(","); q.breakable()
11090 q.text("out_port = ");
11091 q.text(util.pretty_port(self.out_port))
11092 q.text(","); q.breakable()
11093 q.text("out_group = ");
11094 q.text("%#x" % self.out_group)
11095 q.text(","); q.breakable()
11096 q.text("cookie = ");
11097 q.text("%#x" % self.cookie)
11098 q.text(","); q.breakable()
11099 q.text("cookie_mask = ");
11100 q.text("%#x" % self.cookie_mask)
11101 q.text(","); q.breakable()
11102 q.text("match = ");
11103 q.pp(self.match)
11104 q.breakable()
11105 q.text('}')
11106
Rich Lane7dcdf022013-12-11 14:45:27 -080011107stats_request.subtypes[1] = flow_stats_request
11108
11109class get_config_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -070011110 version = 4
11111 type = 8
Rich Lanec2ee4b82013-04-24 17:12:38 -070011112
11113 def __init__(self, xid=None, flags=None, miss_send_len=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080011114 if xid != None:
11115 self.xid = xid
11116 else:
11117 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070011118 if flags != None:
11119 self.flags = flags
11120 else:
11121 self.flags = 0
11122 if miss_send_len != None:
11123 self.miss_send_len = miss_send_len
11124 else:
11125 self.miss_send_len = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080011126 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070011127
11128 def pack(self):
11129 packed = []
11130 packed.append(struct.pack("!B", self.version))
11131 packed.append(struct.pack("!B", self.type))
11132 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11133 packed.append(struct.pack("!L", self.xid))
11134 packed.append(struct.pack("!H", self.flags))
11135 packed.append(struct.pack("!H", self.miss_send_len))
11136 length = sum([len(x) for x in packed])
11137 packed[2] = struct.pack("!H", length)
11138 return ''.join(packed)
11139
11140 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080011141 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070011142 obj = get_config_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070011143 _version = reader.read("!B")[0]
11144 assert(_version == 4)
11145 _type = reader.read("!B")[0]
11146 assert(_type == 8)
11147 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011148 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080011149 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070011150 obj.xid = reader.read("!L")[0]
11151 obj.flags = reader.read("!H")[0]
11152 obj.miss_send_len = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011153 return obj
11154
11155 def __eq__(self, other):
11156 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070011157 if self.xid != other.xid: return False
11158 if self.flags != other.flags: return False
11159 if self.miss_send_len != other.miss_send_len: return False
11160 return True
11161
Rich Lanec2ee4b82013-04-24 17:12:38 -070011162 def pretty_print(self, q):
11163 q.text("get_config_reply {")
11164 with q.group():
11165 with q.indent(2):
11166 q.breakable()
11167 q.text("xid = ");
11168 if self.xid != None:
11169 q.text("%#x" % self.xid)
11170 else:
11171 q.text('None')
11172 q.text(","); q.breakable()
11173 q.text("flags = ");
11174 q.text("%#x" % self.flags)
11175 q.text(","); q.breakable()
11176 q.text("miss_send_len = ");
11177 q.text("%#x" % self.miss_send_len)
11178 q.breakable()
11179 q.text('}')
11180
Rich Lane7dcdf022013-12-11 14:45:27 -080011181message.subtypes[8] = get_config_reply
11182
11183class get_config_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -070011184 version = 4
11185 type = 7
Rich Lanec2ee4b82013-04-24 17:12:38 -070011186
11187 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080011188 if xid != None:
11189 self.xid = xid
11190 else:
11191 self.xid = None
11192 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070011193
11194 def pack(self):
11195 packed = []
11196 packed.append(struct.pack("!B", self.version))
11197 packed.append(struct.pack("!B", self.type))
11198 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11199 packed.append(struct.pack("!L", self.xid))
11200 length = sum([len(x) for x in packed])
11201 packed[2] = struct.pack("!H", length)
11202 return ''.join(packed)
11203
11204 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080011205 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070011206 obj = get_config_request()
Dan Talaycof6202252013-07-02 01:00:29 -070011207 _version = reader.read("!B")[0]
11208 assert(_version == 4)
11209 _type = reader.read("!B")[0]
11210 assert(_type == 7)
11211 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011212 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080011213 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070011214 obj.xid = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011215 return obj
11216
11217 def __eq__(self, other):
11218 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070011219 if self.xid != other.xid: return False
11220 return True
11221
Rich Lanec2ee4b82013-04-24 17:12:38 -070011222 def pretty_print(self, q):
11223 q.text("get_config_request {")
11224 with q.group():
11225 with q.indent(2):
11226 q.breakable()
11227 q.text("xid = ");
11228 if self.xid != None:
11229 q.text("%#x" % self.xid)
11230 else:
11231 q.text('None')
11232 q.breakable()
11233 q.text('}')
11234
Rich Lane7dcdf022013-12-11 14:45:27 -080011235message.subtypes[7] = get_config_request
11236
11237class group_mod(message):
11238 subtypes = {}
11239
Rich Lane95f7fc92014-01-27 17:08:16 -080011240 version = 4
11241 type = 15
11242
11243 def __init__(self, xid=None, command=None, group_type=None, group_id=None, buckets=None):
11244 if xid != None:
11245 self.xid = xid
11246 else:
11247 self.xid = None
11248 if command != None:
11249 self.command = command
11250 else:
11251 self.command = 0
11252 if group_type != None:
11253 self.group_type = group_type
11254 else:
11255 self.group_type = 0
11256 if group_id != None:
11257 self.group_id = group_id
11258 else:
11259 self.group_id = 0
11260 if buckets != None:
11261 self.buckets = buckets
11262 else:
11263 self.buckets = []
11264 return
11265
11266 def pack(self):
11267 packed = []
11268 packed.append(struct.pack("!B", self.version))
11269 packed.append(struct.pack("!B", self.type))
11270 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11271 packed.append(struct.pack("!L", self.xid))
11272 packed.append(struct.pack("!H", self.command))
11273 packed.append(struct.pack("!B", self.group_type))
11274 packed.append('\x00' * 1)
11275 packed.append(struct.pack("!L", self.group_id))
11276 packed.append(loxi.generic_util.pack_list(self.buckets))
11277 length = sum([len(x) for x in packed])
11278 packed[2] = struct.pack("!H", length)
11279 return ''.join(packed)
11280
Rich Lane7dcdf022013-12-11 14:45:27 -080011281 @staticmethod
11282 def unpack(reader):
11283 subtype, = reader.peek('!H', 8)
Rich Lane95f7fc92014-01-27 17:08:16 -080011284 subclass = group_mod.subtypes.get(subtype)
11285 if subclass:
11286 return subclass.unpack(reader)
11287
11288 obj = group_mod()
11289 _version = reader.read("!B")[0]
11290 assert(_version == 4)
11291 _type = reader.read("!B")[0]
11292 assert(_type == 15)
11293 _length = reader.read("!H")[0]
11294 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080011295 reader = orig_reader.slice(_length, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -080011296 obj.xid = reader.read("!L")[0]
11297 obj.command = reader.read("!H")[0]
11298 obj.group_type = reader.read("!B")[0]
11299 reader.skip(1)
11300 obj.group_id = reader.read("!L")[0]
Rich Lanee2567702015-01-26 15:04:35 -080011301 obj.buckets = loxi.generic_util.unpack_list(reader, ofp.common.bucket.unpack)
Rich Lane95f7fc92014-01-27 17:08:16 -080011302 return obj
11303
11304 def __eq__(self, other):
11305 if type(self) != type(other): return False
11306 if self.xid != other.xid: return False
11307 if self.command != other.command: return False
11308 if self.group_type != other.group_type: return False
11309 if self.group_id != other.group_id: return False
11310 if self.buckets != other.buckets: return False
11311 return True
11312
11313 def pretty_print(self, q):
11314 q.text("group_mod {")
11315 with q.group():
11316 with q.indent(2):
11317 q.breakable()
11318 q.text("xid = ");
11319 if self.xid != None:
11320 q.text("%#x" % self.xid)
11321 else:
11322 q.text('None')
11323 q.text(","); q.breakable()
11324 q.text("group_type = ");
11325 q.text("%#x" % self.group_type)
11326 q.text(","); q.breakable()
11327 q.text("group_id = ");
11328 q.text("%#x" % self.group_id)
11329 q.text(","); q.breakable()
11330 q.text("buckets = ");
11331 q.pp(self.buckets)
11332 q.breakable()
11333 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -080011334
11335message.subtypes[15] = group_mod
11336
11337class group_add(group_mod):
Rich Lane7b0f2012013-11-22 14:15:26 -080011338 version = 4
11339 type = 15
11340 command = 0
11341
11342 def __init__(self, xid=None, group_type=None, group_id=None, buckets=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080011343 if xid != None:
11344 self.xid = xid
11345 else:
11346 self.xid = None
Rich Lane7b0f2012013-11-22 14:15:26 -080011347 if group_type != None:
11348 self.group_type = group_type
11349 else:
11350 self.group_type = 0
11351 if group_id != None:
11352 self.group_id = group_id
11353 else:
11354 self.group_id = 0
11355 if buckets != None:
11356 self.buckets = buckets
11357 else:
11358 self.buckets = []
Rich Lane7dcdf022013-12-11 14:45:27 -080011359 return
Rich Lane7b0f2012013-11-22 14:15:26 -080011360
11361 def pack(self):
11362 packed = []
11363 packed.append(struct.pack("!B", self.version))
11364 packed.append(struct.pack("!B", self.type))
11365 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11366 packed.append(struct.pack("!L", self.xid))
11367 packed.append(struct.pack("!H", self.command))
11368 packed.append(struct.pack("!B", self.group_type))
11369 packed.append('\x00' * 1)
11370 packed.append(struct.pack("!L", self.group_id))
Rich Lane7dcdf022013-12-11 14:45:27 -080011371 packed.append(loxi.generic_util.pack_list(self.buckets))
Rich Lane7b0f2012013-11-22 14:15:26 -080011372 length = sum([len(x) for x in packed])
11373 packed[2] = struct.pack("!H", length)
11374 return ''.join(packed)
11375
11376 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080011377 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -080011378 obj = group_add()
Rich Lane7b0f2012013-11-22 14:15:26 -080011379 _version = reader.read("!B")[0]
11380 assert(_version == 4)
11381 _type = reader.read("!B")[0]
11382 assert(_type == 15)
11383 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011384 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080011385 reader = orig_reader.slice(_length, 4)
Rich Lane7b0f2012013-11-22 14:15:26 -080011386 obj.xid = reader.read("!L")[0]
11387 _command = reader.read("!H")[0]
11388 assert(_command == 0)
11389 obj.group_type = reader.read("!B")[0]
11390 reader.skip(1)
11391 obj.group_id = reader.read("!L")[0]
Rich Lanee2567702015-01-26 15:04:35 -080011392 obj.buckets = loxi.generic_util.unpack_list(reader, ofp.common.bucket.unpack)
Rich Lane7b0f2012013-11-22 14:15:26 -080011393 return obj
11394
11395 def __eq__(self, other):
11396 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -080011397 if self.xid != other.xid: return False
11398 if self.group_type != other.group_type: return False
11399 if self.group_id != other.group_id: return False
11400 if self.buckets != other.buckets: return False
11401 return True
11402
Rich Lane7b0f2012013-11-22 14:15:26 -080011403 def pretty_print(self, q):
11404 q.text("group_add {")
11405 with q.group():
11406 with q.indent(2):
11407 q.breakable()
11408 q.text("xid = ");
11409 if self.xid != None:
11410 q.text("%#x" % self.xid)
11411 else:
11412 q.text('None')
11413 q.text(","); q.breakable()
11414 q.text("group_type = ");
11415 q.text("%#x" % self.group_type)
11416 q.text(","); q.breakable()
11417 q.text("group_id = ");
11418 q.text("%#x" % self.group_id)
11419 q.text(","); q.breakable()
11420 q.text("buckets = ");
11421 q.pp(self.buckets)
11422 q.breakable()
11423 q.text('}')
11424
Rich Lane7dcdf022013-12-11 14:45:27 -080011425group_mod.subtypes[0] = group_add
11426
11427class group_delete(group_mod):
Rich Lane7b0f2012013-11-22 14:15:26 -080011428 version = 4
11429 type = 15
11430 command = 2
11431
11432 def __init__(self, xid=None, group_type=None, group_id=None, buckets=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080011433 if xid != None:
11434 self.xid = xid
11435 else:
11436 self.xid = None
Rich Lane7b0f2012013-11-22 14:15:26 -080011437 if group_type != None:
11438 self.group_type = group_type
11439 else:
11440 self.group_type = 0
11441 if group_id != None:
11442 self.group_id = group_id
11443 else:
11444 self.group_id = 0
11445 if buckets != None:
11446 self.buckets = buckets
11447 else:
11448 self.buckets = []
Rich Lane7dcdf022013-12-11 14:45:27 -080011449 return
Rich Lane7b0f2012013-11-22 14:15:26 -080011450
11451 def pack(self):
11452 packed = []
11453 packed.append(struct.pack("!B", self.version))
11454 packed.append(struct.pack("!B", self.type))
11455 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11456 packed.append(struct.pack("!L", self.xid))
11457 packed.append(struct.pack("!H", self.command))
11458 packed.append(struct.pack("!B", self.group_type))
11459 packed.append('\x00' * 1)
11460 packed.append(struct.pack("!L", self.group_id))
Rich Lane7dcdf022013-12-11 14:45:27 -080011461 packed.append(loxi.generic_util.pack_list(self.buckets))
Rich Lane7b0f2012013-11-22 14:15:26 -080011462 length = sum([len(x) for x in packed])
11463 packed[2] = struct.pack("!H", length)
11464 return ''.join(packed)
11465
11466 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080011467 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -080011468 obj = group_delete()
Rich Lane7b0f2012013-11-22 14:15:26 -080011469 _version = reader.read("!B")[0]
11470 assert(_version == 4)
11471 _type = reader.read("!B")[0]
11472 assert(_type == 15)
11473 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011474 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080011475 reader = orig_reader.slice(_length, 4)
Rich Lane7b0f2012013-11-22 14:15:26 -080011476 obj.xid = reader.read("!L")[0]
11477 _command = reader.read("!H")[0]
11478 assert(_command == 2)
11479 obj.group_type = reader.read("!B")[0]
11480 reader.skip(1)
11481 obj.group_id = reader.read("!L")[0]
Rich Lanee2567702015-01-26 15:04:35 -080011482 obj.buckets = loxi.generic_util.unpack_list(reader, ofp.common.bucket.unpack)
Rich Lane7b0f2012013-11-22 14:15:26 -080011483 return obj
11484
11485 def __eq__(self, other):
11486 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -080011487 if self.xid != other.xid: return False
11488 if self.group_type != other.group_type: return False
11489 if self.group_id != other.group_id: return False
11490 if self.buckets != other.buckets: return False
11491 return True
11492
Rich Lane7b0f2012013-11-22 14:15:26 -080011493 def pretty_print(self, q):
11494 q.text("group_delete {")
11495 with q.group():
11496 with q.indent(2):
11497 q.breakable()
11498 q.text("xid = ");
11499 if self.xid != None:
11500 q.text("%#x" % self.xid)
11501 else:
11502 q.text('None')
11503 q.text(","); q.breakable()
11504 q.text("group_type = ");
11505 q.text("%#x" % self.group_type)
11506 q.text(","); q.breakable()
11507 q.text("group_id = ");
11508 q.text("%#x" % self.group_id)
11509 q.text(","); q.breakable()
11510 q.text("buckets = ");
11511 q.pp(self.buckets)
11512 q.breakable()
11513 q.text('}')
11514
Rich Lane7dcdf022013-12-11 14:45:27 -080011515group_mod.subtypes[2] = group_delete
11516
11517class group_desc_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070011518 version = 4
11519 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070011520 stats_type = 7
11521
11522 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080011523 if xid != None:
11524 self.xid = xid
11525 else:
11526 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070011527 if flags != None:
11528 self.flags = flags
11529 else:
11530 self.flags = 0
11531 if entries != None:
11532 self.entries = entries
11533 else:
11534 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -080011535 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070011536
11537 def pack(self):
11538 packed = []
11539 packed.append(struct.pack("!B", self.version))
11540 packed.append(struct.pack("!B", self.type))
11541 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11542 packed.append(struct.pack("!L", self.xid))
11543 packed.append(struct.pack("!H", self.stats_type))
11544 packed.append(struct.pack("!H", self.flags))
11545 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080011546 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -070011547 length = sum([len(x) for x in packed])
11548 packed[2] = struct.pack("!H", length)
11549 return ''.join(packed)
11550
11551 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080011552 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070011553 obj = group_desc_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070011554 _version = reader.read("!B")[0]
11555 assert(_version == 4)
11556 _type = reader.read("!B")[0]
11557 assert(_type == 19)
11558 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011559 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080011560 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070011561 obj.xid = reader.read("!L")[0]
11562 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011563 assert(_stats_type == 7)
Dan Talaycof6202252013-07-02 01:00:29 -070011564 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011565 reader.skip(4)
Rich Lanee2567702015-01-26 15:04:35 -080011566 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.group_desc_stats_entry.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070011567 return obj
11568
11569 def __eq__(self, other):
11570 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070011571 if self.xid != other.xid: return False
11572 if self.flags != other.flags: return False
11573 if self.entries != other.entries: return False
11574 return True
11575
Rich Lanec2ee4b82013-04-24 17:12:38 -070011576 def pretty_print(self, q):
11577 q.text("group_desc_stats_reply {")
11578 with q.group():
11579 with q.indent(2):
11580 q.breakable()
11581 q.text("xid = ");
11582 if self.xid != None:
11583 q.text("%#x" % self.xid)
11584 else:
11585 q.text('None')
11586 q.text(","); q.breakable()
11587 q.text("flags = ");
11588 q.text("%#x" % self.flags)
11589 q.text(","); q.breakable()
11590 q.text("entries = ");
11591 q.pp(self.entries)
11592 q.breakable()
11593 q.text('}')
11594
Rich Lane7dcdf022013-12-11 14:45:27 -080011595stats_reply.subtypes[7] = group_desc_stats_reply
11596
11597class group_desc_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070011598 version = 4
11599 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070011600 stats_type = 7
11601
11602 def __init__(self, xid=None, flags=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080011603 if xid != None:
11604 self.xid = xid
11605 else:
11606 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070011607 if flags != None:
11608 self.flags = flags
11609 else:
11610 self.flags = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080011611 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070011612
11613 def pack(self):
11614 packed = []
11615 packed.append(struct.pack("!B", self.version))
11616 packed.append(struct.pack("!B", self.type))
11617 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11618 packed.append(struct.pack("!L", self.xid))
11619 packed.append(struct.pack("!H", self.stats_type))
11620 packed.append(struct.pack("!H", self.flags))
11621 packed.append('\x00' * 4)
11622 length = sum([len(x) for x in packed])
11623 packed[2] = struct.pack("!H", length)
11624 return ''.join(packed)
11625
11626 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080011627 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070011628 obj = group_desc_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070011629 _version = reader.read("!B")[0]
11630 assert(_version == 4)
11631 _type = reader.read("!B")[0]
11632 assert(_type == 18)
11633 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011634 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080011635 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070011636 obj.xid = reader.read("!L")[0]
11637 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011638 assert(_stats_type == 7)
Dan Talaycof6202252013-07-02 01:00:29 -070011639 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011640 reader.skip(4)
11641 return obj
11642
11643 def __eq__(self, other):
11644 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070011645 if self.xid != other.xid: return False
11646 if self.flags != other.flags: return False
11647 return True
11648
Rich Lanec2ee4b82013-04-24 17:12:38 -070011649 def pretty_print(self, q):
11650 q.text("group_desc_stats_request {")
11651 with q.group():
11652 with q.indent(2):
11653 q.breakable()
11654 q.text("xid = ");
11655 if self.xid != None:
11656 q.text("%#x" % self.xid)
11657 else:
11658 q.text('None')
11659 q.text(","); q.breakable()
11660 q.text("flags = ");
11661 q.text("%#x" % self.flags)
11662 q.breakable()
11663 q.text('}')
11664
Rich Lane7dcdf022013-12-11 14:45:27 -080011665stats_request.subtypes[7] = group_desc_stats_request
11666
11667class group_features_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070011668 version = 4
11669 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070011670 stats_type = 8
11671
11672 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 -080011673 if xid != None:
11674 self.xid = xid
11675 else:
11676 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070011677 if flags != None:
11678 self.flags = flags
11679 else:
11680 self.flags = 0
11681 if types != None:
11682 self.types = types
11683 else:
11684 self.types = 0
11685 if capabilities != None:
11686 self.capabilities = capabilities
11687 else:
11688 self.capabilities = 0
11689 if max_groups_all != None:
11690 self.max_groups_all = max_groups_all
11691 else:
11692 self.max_groups_all = 0
11693 if max_groups_select != None:
11694 self.max_groups_select = max_groups_select
11695 else:
11696 self.max_groups_select = 0
11697 if max_groups_indirect != None:
11698 self.max_groups_indirect = max_groups_indirect
11699 else:
11700 self.max_groups_indirect = 0
11701 if max_groups_ff != None:
11702 self.max_groups_ff = max_groups_ff
11703 else:
11704 self.max_groups_ff = 0
11705 if actions_all != None:
11706 self.actions_all = actions_all
11707 else:
11708 self.actions_all = 0
11709 if actions_select != None:
11710 self.actions_select = actions_select
11711 else:
11712 self.actions_select = 0
11713 if actions_indirect != None:
11714 self.actions_indirect = actions_indirect
11715 else:
11716 self.actions_indirect = 0
11717 if actions_ff != None:
11718 self.actions_ff = actions_ff
11719 else:
11720 self.actions_ff = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080011721 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070011722
11723 def pack(self):
11724 packed = []
11725 packed.append(struct.pack("!B", self.version))
11726 packed.append(struct.pack("!B", self.type))
11727 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11728 packed.append(struct.pack("!L", self.xid))
11729 packed.append(struct.pack("!H", self.stats_type))
11730 packed.append(struct.pack("!H", self.flags))
11731 packed.append('\x00' * 4)
11732 packed.append(struct.pack("!L", self.types))
11733 packed.append(struct.pack("!L", self.capabilities))
11734 packed.append(struct.pack("!L", self.max_groups_all))
11735 packed.append(struct.pack("!L", self.max_groups_select))
11736 packed.append(struct.pack("!L", self.max_groups_indirect))
11737 packed.append(struct.pack("!L", self.max_groups_ff))
11738 packed.append(struct.pack("!L", self.actions_all))
11739 packed.append(struct.pack("!L", self.actions_select))
11740 packed.append(struct.pack("!L", self.actions_indirect))
11741 packed.append(struct.pack("!L", self.actions_ff))
11742 length = sum([len(x) for x in packed])
11743 packed[2] = struct.pack("!H", length)
11744 return ''.join(packed)
11745
11746 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080011747 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070011748 obj = group_features_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070011749 _version = reader.read("!B")[0]
11750 assert(_version == 4)
11751 _type = reader.read("!B")[0]
11752 assert(_type == 19)
11753 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011754 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080011755 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070011756 obj.xid = reader.read("!L")[0]
11757 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011758 assert(_stats_type == 8)
Dan Talaycof6202252013-07-02 01:00:29 -070011759 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011760 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -070011761 obj.types = reader.read("!L")[0]
11762 obj.capabilities = reader.read("!L")[0]
11763 obj.max_groups_all = reader.read("!L")[0]
11764 obj.max_groups_select = reader.read("!L")[0]
11765 obj.max_groups_indirect = reader.read("!L")[0]
11766 obj.max_groups_ff = reader.read("!L")[0]
11767 obj.actions_all = reader.read("!L")[0]
11768 obj.actions_select = reader.read("!L")[0]
11769 obj.actions_indirect = reader.read("!L")[0]
11770 obj.actions_ff = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011771 return obj
11772
11773 def __eq__(self, other):
11774 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070011775 if self.xid != other.xid: return False
11776 if self.flags != other.flags: return False
11777 if self.types != other.types: return False
11778 if self.capabilities != other.capabilities: return False
11779 if self.max_groups_all != other.max_groups_all: return False
11780 if self.max_groups_select != other.max_groups_select: return False
11781 if self.max_groups_indirect != other.max_groups_indirect: return False
11782 if self.max_groups_ff != other.max_groups_ff: return False
11783 if self.actions_all != other.actions_all: return False
11784 if self.actions_select != other.actions_select: return False
11785 if self.actions_indirect != other.actions_indirect: return False
11786 if self.actions_ff != other.actions_ff: return False
11787 return True
11788
Rich Lanec2ee4b82013-04-24 17:12:38 -070011789 def pretty_print(self, q):
11790 q.text("group_features_stats_reply {")
11791 with q.group():
11792 with q.indent(2):
11793 q.breakable()
11794 q.text("xid = ");
11795 if self.xid != None:
11796 q.text("%#x" % self.xid)
11797 else:
11798 q.text('None')
11799 q.text(","); q.breakable()
11800 q.text("flags = ");
11801 q.text("%#x" % self.flags)
11802 q.text(","); q.breakable()
11803 q.text("types = ");
11804 q.text("%#x" % self.types)
11805 q.text(","); q.breakable()
11806 q.text("capabilities = ");
11807 q.text("%#x" % self.capabilities)
11808 q.text(","); q.breakable()
11809 q.text("max_groups_all = ");
11810 q.text("%#x" % self.max_groups_all)
11811 q.text(","); q.breakable()
11812 q.text("max_groups_select = ");
11813 q.text("%#x" % self.max_groups_select)
11814 q.text(","); q.breakable()
11815 q.text("max_groups_indirect = ");
11816 q.text("%#x" % self.max_groups_indirect)
11817 q.text(","); q.breakable()
11818 q.text("max_groups_ff = ");
11819 q.text("%#x" % self.max_groups_ff)
11820 q.text(","); q.breakable()
11821 q.text("actions_all = ");
11822 q.text("%#x" % self.actions_all)
11823 q.text(","); q.breakable()
11824 q.text("actions_select = ");
11825 q.text("%#x" % self.actions_select)
11826 q.text(","); q.breakable()
11827 q.text("actions_indirect = ");
11828 q.text("%#x" % self.actions_indirect)
11829 q.text(","); q.breakable()
11830 q.text("actions_ff = ");
11831 q.text("%#x" % self.actions_ff)
11832 q.breakable()
11833 q.text('}')
11834
Rich Lane7dcdf022013-12-11 14:45:27 -080011835stats_reply.subtypes[8] = group_features_stats_reply
11836
11837class group_features_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070011838 version = 4
11839 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070011840 stats_type = 8
11841
11842 def __init__(self, xid=None, flags=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080011843 if xid != None:
11844 self.xid = xid
11845 else:
11846 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070011847 if flags != None:
11848 self.flags = flags
11849 else:
11850 self.flags = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080011851 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070011852
11853 def pack(self):
11854 packed = []
11855 packed.append(struct.pack("!B", self.version))
11856 packed.append(struct.pack("!B", self.type))
11857 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11858 packed.append(struct.pack("!L", self.xid))
11859 packed.append(struct.pack("!H", self.stats_type))
11860 packed.append(struct.pack("!H", self.flags))
11861 packed.append('\x00' * 4)
11862 length = sum([len(x) for x in packed])
11863 packed[2] = struct.pack("!H", length)
11864 return ''.join(packed)
11865
11866 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080011867 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070011868 obj = group_features_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070011869 _version = reader.read("!B")[0]
11870 assert(_version == 4)
11871 _type = reader.read("!B")[0]
11872 assert(_type == 18)
11873 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011874 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080011875 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070011876 obj.xid = reader.read("!L")[0]
11877 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011878 assert(_stats_type == 8)
Dan Talaycof6202252013-07-02 01:00:29 -070011879 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070011880 reader.skip(4)
11881 return obj
11882
11883 def __eq__(self, other):
11884 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070011885 if self.xid != other.xid: return False
11886 if self.flags != other.flags: return False
11887 return True
11888
Rich Lanec2ee4b82013-04-24 17:12:38 -070011889 def pretty_print(self, q):
11890 q.text("group_features_stats_request {")
11891 with q.group():
11892 with q.indent(2):
11893 q.breakable()
11894 q.text("xid = ");
11895 if self.xid != None:
11896 q.text("%#x" % self.xid)
11897 else:
11898 q.text('None')
11899 q.text(","); q.breakable()
11900 q.text("flags = ");
11901 q.text("%#x" % self.flags)
11902 q.breakable()
11903 q.text('}')
11904
Rich Lane7dcdf022013-12-11 14:45:27 -080011905stats_request.subtypes[8] = group_features_stats_request
11906
11907class group_mod_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -070011908 version = 4
11909 type = 1
11910 err_type = 6
11911
11912 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080011913 if xid != None:
11914 self.xid = xid
11915 else:
11916 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -070011917 if code != None:
11918 self.code = code
11919 else:
11920 self.code = 0
11921 if data != None:
11922 self.data = data
11923 else:
11924 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080011925 return
Rich Lane6f4978c2013-10-20 21:33:52 -070011926
11927 def pack(self):
11928 packed = []
11929 packed.append(struct.pack("!B", self.version))
11930 packed.append(struct.pack("!B", self.type))
11931 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11932 packed.append(struct.pack("!L", self.xid))
11933 packed.append(struct.pack("!H", self.err_type))
11934 packed.append(struct.pack("!H", self.code))
11935 packed.append(self.data)
11936 length = sum([len(x) for x in packed])
11937 packed[2] = struct.pack("!H", length)
11938 return ''.join(packed)
11939
11940 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080011941 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -070011942 obj = group_mod_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -070011943 _version = reader.read("!B")[0]
11944 assert(_version == 4)
11945 _type = reader.read("!B")[0]
11946 assert(_type == 1)
11947 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080011948 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080011949 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -070011950 obj.xid = reader.read("!L")[0]
11951 _err_type = reader.read("!H")[0]
11952 assert(_err_type == 6)
11953 obj.code = reader.read("!H")[0]
11954 obj.data = str(reader.read_all())
11955 return obj
11956
11957 def __eq__(self, other):
11958 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -070011959 if self.xid != other.xid: return False
11960 if self.code != other.code: return False
11961 if self.data != other.data: return False
11962 return True
11963
Rich Lane6f4978c2013-10-20 21:33:52 -070011964 def pretty_print(self, q):
11965 q.text("group_mod_failed_error_msg {")
11966 with q.group():
11967 with q.indent(2):
11968 q.breakable()
11969 q.text("xid = ");
11970 if self.xid != None:
11971 q.text("%#x" % self.xid)
11972 else:
11973 q.text('None')
11974 q.text(","); q.breakable()
11975 q.text("code = ");
11976 q.text("%#x" % self.code)
11977 q.text(","); q.breakable()
11978 q.text("data = ");
11979 q.pp(self.data)
11980 q.breakable()
11981 q.text('}')
11982
Rich Lane7dcdf022013-12-11 14:45:27 -080011983error_msg.subtypes[6] = group_mod_failed_error_msg
11984
11985class group_modify(group_mod):
Rich Lane7b0f2012013-11-22 14:15:26 -080011986 version = 4
11987 type = 15
11988 command = 1
11989
11990 def __init__(self, xid=None, group_type=None, group_id=None, buckets=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080011991 if xid != None:
11992 self.xid = xid
11993 else:
11994 self.xid = None
Rich Lane7b0f2012013-11-22 14:15:26 -080011995 if group_type != None:
11996 self.group_type = group_type
11997 else:
11998 self.group_type = 0
11999 if group_id != None:
12000 self.group_id = group_id
12001 else:
12002 self.group_id = 0
12003 if buckets != None:
12004 self.buckets = buckets
12005 else:
12006 self.buckets = []
Rich Lane7dcdf022013-12-11 14:45:27 -080012007 return
Rich Lane7b0f2012013-11-22 14:15:26 -080012008
12009 def pack(self):
12010 packed = []
12011 packed.append(struct.pack("!B", self.version))
12012 packed.append(struct.pack("!B", self.type))
12013 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12014 packed.append(struct.pack("!L", self.xid))
12015 packed.append(struct.pack("!H", self.command))
12016 packed.append(struct.pack("!B", self.group_type))
12017 packed.append('\x00' * 1)
12018 packed.append(struct.pack("!L", self.group_id))
Rich Lane7dcdf022013-12-11 14:45:27 -080012019 packed.append(loxi.generic_util.pack_list(self.buckets))
Rich Lane7b0f2012013-11-22 14:15:26 -080012020 length = sum([len(x) for x in packed])
12021 packed[2] = struct.pack("!H", length)
12022 return ''.join(packed)
12023
12024 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012025 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -080012026 obj = group_modify()
Rich Lane7b0f2012013-11-22 14:15:26 -080012027 _version = reader.read("!B")[0]
12028 assert(_version == 4)
12029 _type = reader.read("!B")[0]
12030 assert(_type == 15)
12031 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012032 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080012033 reader = orig_reader.slice(_length, 4)
Rich Lane7b0f2012013-11-22 14:15:26 -080012034 obj.xid = reader.read("!L")[0]
12035 _command = reader.read("!H")[0]
12036 assert(_command == 1)
12037 obj.group_type = reader.read("!B")[0]
12038 reader.skip(1)
12039 obj.group_id = reader.read("!L")[0]
Rich Lanee2567702015-01-26 15:04:35 -080012040 obj.buckets = loxi.generic_util.unpack_list(reader, ofp.common.bucket.unpack)
Rich Lane7b0f2012013-11-22 14:15:26 -080012041 return obj
12042
12043 def __eq__(self, other):
12044 if type(self) != type(other): return False
Rich Lane7b0f2012013-11-22 14:15:26 -080012045 if self.xid != other.xid: return False
12046 if self.group_type != other.group_type: return False
12047 if self.group_id != other.group_id: return False
12048 if self.buckets != other.buckets: return False
12049 return True
12050
Rich Lane7b0f2012013-11-22 14:15:26 -080012051 def pretty_print(self, q):
12052 q.text("group_modify {")
12053 with q.group():
12054 with q.indent(2):
12055 q.breakable()
12056 q.text("xid = ");
12057 if self.xid != None:
12058 q.text("%#x" % self.xid)
12059 else:
12060 q.text('None')
12061 q.text(","); q.breakable()
12062 q.text("group_type = ");
12063 q.text("%#x" % self.group_type)
12064 q.text(","); q.breakable()
12065 q.text("group_id = ");
12066 q.text("%#x" % self.group_id)
12067 q.text(","); q.breakable()
12068 q.text("buckets = ");
12069 q.pp(self.buckets)
12070 q.breakable()
12071 q.text('}')
12072
Rich Lane7dcdf022013-12-11 14:45:27 -080012073group_mod.subtypes[1] = group_modify
12074
12075class group_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070012076 version = 4
12077 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070012078 stats_type = 6
12079
12080 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012081 if xid != None:
12082 self.xid = xid
12083 else:
12084 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070012085 if flags != None:
12086 self.flags = flags
12087 else:
12088 self.flags = 0
12089 if entries != None:
12090 self.entries = entries
12091 else:
12092 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -080012093 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070012094
12095 def pack(self):
12096 packed = []
12097 packed.append(struct.pack("!B", self.version))
12098 packed.append(struct.pack("!B", self.type))
12099 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12100 packed.append(struct.pack("!L", self.xid))
12101 packed.append(struct.pack("!H", self.stats_type))
12102 packed.append(struct.pack("!H", self.flags))
12103 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080012104 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -070012105 length = sum([len(x) for x in packed])
12106 packed[2] = struct.pack("!H", length)
12107 return ''.join(packed)
12108
12109 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012110 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070012111 obj = group_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070012112 _version = reader.read("!B")[0]
12113 assert(_version == 4)
12114 _type = reader.read("!B")[0]
12115 assert(_type == 19)
12116 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012117 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080012118 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070012119 obj.xid = reader.read("!L")[0]
12120 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012121 assert(_stats_type == 6)
Dan Talaycof6202252013-07-02 01:00:29 -070012122 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012123 reader.skip(4)
Rich Lanee2567702015-01-26 15:04:35 -080012124 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.group_stats_entry.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070012125 return obj
12126
12127 def __eq__(self, other):
12128 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070012129 if self.xid != other.xid: return False
12130 if self.flags != other.flags: return False
12131 if self.entries != other.entries: return False
12132 return True
12133
Rich Lanec2ee4b82013-04-24 17:12:38 -070012134 def pretty_print(self, q):
12135 q.text("group_stats_reply {")
12136 with q.group():
12137 with q.indent(2):
12138 q.breakable()
12139 q.text("xid = ");
12140 if self.xid != None:
12141 q.text("%#x" % self.xid)
12142 else:
12143 q.text('None')
12144 q.text(","); q.breakable()
12145 q.text("flags = ");
12146 q.text("%#x" % self.flags)
12147 q.text(","); q.breakable()
12148 q.text("entries = ");
12149 q.pp(self.entries)
12150 q.breakable()
12151 q.text('}')
12152
Rich Lane7dcdf022013-12-11 14:45:27 -080012153stats_reply.subtypes[6] = group_stats_reply
12154
12155class group_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070012156 version = 4
12157 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070012158 stats_type = 6
12159
12160 def __init__(self, xid=None, flags=None, group_id=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012161 if xid != None:
12162 self.xid = xid
12163 else:
12164 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070012165 if flags != None:
12166 self.flags = flags
12167 else:
12168 self.flags = 0
12169 if group_id != None:
12170 self.group_id = group_id
12171 else:
12172 self.group_id = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080012173 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070012174
12175 def pack(self):
12176 packed = []
12177 packed.append(struct.pack("!B", self.version))
12178 packed.append(struct.pack("!B", self.type))
12179 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12180 packed.append(struct.pack("!L", self.xid))
12181 packed.append(struct.pack("!H", self.stats_type))
12182 packed.append(struct.pack("!H", self.flags))
12183 packed.append('\x00' * 4)
12184 packed.append(struct.pack("!L", self.group_id))
12185 packed.append('\x00' * 4)
12186 length = sum([len(x) for x in packed])
12187 packed[2] = struct.pack("!H", length)
12188 return ''.join(packed)
12189
12190 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012191 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070012192 obj = group_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070012193 _version = reader.read("!B")[0]
12194 assert(_version == 4)
12195 _type = reader.read("!B")[0]
12196 assert(_type == 18)
12197 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012198 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080012199 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070012200 obj.xid = reader.read("!L")[0]
12201 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012202 assert(_stats_type == 6)
Dan Talaycof6202252013-07-02 01:00:29 -070012203 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012204 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -070012205 obj.group_id = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012206 reader.skip(4)
12207 return obj
12208
12209 def __eq__(self, other):
12210 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070012211 if self.xid != other.xid: return False
12212 if self.flags != other.flags: return False
12213 if self.group_id != other.group_id: return False
12214 return True
12215
Rich Lanec2ee4b82013-04-24 17:12:38 -070012216 def pretty_print(self, q):
12217 q.text("group_stats_request {")
12218 with q.group():
12219 with q.indent(2):
12220 q.breakable()
12221 q.text("xid = ");
12222 if self.xid != None:
12223 q.text("%#x" % self.xid)
12224 else:
12225 q.text('None')
12226 q.text(","); q.breakable()
12227 q.text("flags = ");
12228 q.text("%#x" % self.flags)
12229 q.text(","); q.breakable()
12230 q.text("group_id = ");
12231 q.text("%#x" % self.group_id)
12232 q.breakable()
12233 q.text('}')
12234
Rich Lane7dcdf022013-12-11 14:45:27 -080012235stats_request.subtypes[6] = group_stats_request
12236
12237class hello(message):
Dan Talaycof6202252013-07-02 01:00:29 -070012238 version = 4
12239 type = 0
Rich Lanec2ee4b82013-04-24 17:12:38 -070012240
12241 def __init__(self, xid=None, elements=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012242 if xid != None:
12243 self.xid = xid
12244 else:
12245 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070012246 if elements != None:
12247 self.elements = elements
12248 else:
12249 self.elements = []
Rich Lane7dcdf022013-12-11 14:45:27 -080012250 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070012251
12252 def pack(self):
12253 packed = []
12254 packed.append(struct.pack("!B", self.version))
12255 packed.append(struct.pack("!B", self.type))
12256 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12257 packed.append(struct.pack("!L", self.xid))
Rich Lane7dcdf022013-12-11 14:45:27 -080012258 packed.append(loxi.generic_util.pack_list(self.elements))
Rich Lanec2ee4b82013-04-24 17:12:38 -070012259 length = sum([len(x) for x in packed])
12260 packed[2] = struct.pack("!H", length)
12261 return ''.join(packed)
12262
12263 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012264 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070012265 obj = hello()
Dan Talaycof6202252013-07-02 01:00:29 -070012266 _version = reader.read("!B")[0]
12267 assert(_version == 4)
12268 _type = reader.read("!B")[0]
12269 assert(_type == 0)
12270 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012271 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080012272 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070012273 obj.xid = reader.read("!L")[0]
Rich Lanee2567702015-01-26 15:04:35 -080012274 obj.elements = loxi.generic_util.unpack_list(reader, ofp.common.hello_elem.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070012275 return obj
12276
12277 def __eq__(self, other):
12278 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070012279 if self.xid != other.xid: return False
12280 if self.elements != other.elements: return False
12281 return True
12282
Rich Lanec2ee4b82013-04-24 17:12:38 -070012283 def pretty_print(self, q):
12284 q.text("hello {")
12285 with q.group():
12286 with q.indent(2):
12287 q.breakable()
12288 q.text("xid = ");
12289 if self.xid != None:
12290 q.text("%#x" % self.xid)
12291 else:
12292 q.text('None')
12293 q.text(","); q.breakable()
12294 q.text("elements = ");
12295 q.pp(self.elements)
12296 q.breakable()
12297 q.text('}')
12298
Rich Lane7dcdf022013-12-11 14:45:27 -080012299message.subtypes[0] = hello
12300
12301class hello_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -070012302 version = 4
12303 type = 1
12304 err_type = 0
12305
12306 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012307 if xid != None:
12308 self.xid = xid
12309 else:
12310 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -070012311 if code != None:
12312 self.code = code
12313 else:
12314 self.code = 0
12315 if data != None:
12316 self.data = data
12317 else:
12318 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080012319 return
Rich Lane6f4978c2013-10-20 21:33:52 -070012320
12321 def pack(self):
12322 packed = []
12323 packed.append(struct.pack("!B", self.version))
12324 packed.append(struct.pack("!B", self.type))
12325 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12326 packed.append(struct.pack("!L", self.xid))
12327 packed.append(struct.pack("!H", self.err_type))
12328 packed.append(struct.pack("!H", self.code))
12329 packed.append(self.data)
12330 length = sum([len(x) for x in packed])
12331 packed[2] = struct.pack("!H", length)
12332 return ''.join(packed)
12333
12334 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012335 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -070012336 obj = hello_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -070012337 _version = reader.read("!B")[0]
12338 assert(_version == 4)
12339 _type = reader.read("!B")[0]
12340 assert(_type == 1)
12341 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012342 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080012343 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -070012344 obj.xid = reader.read("!L")[0]
12345 _err_type = reader.read("!H")[0]
12346 assert(_err_type == 0)
12347 obj.code = reader.read("!H")[0]
12348 obj.data = str(reader.read_all())
12349 return obj
12350
12351 def __eq__(self, other):
12352 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -070012353 if self.xid != other.xid: return False
12354 if self.code != other.code: return False
12355 if self.data != other.data: return False
12356 return True
12357
Rich Lane6f4978c2013-10-20 21:33:52 -070012358 def pretty_print(self, q):
12359 q.text("hello_failed_error_msg {")
12360 with q.group():
12361 with q.indent(2):
12362 q.breakable()
12363 q.text("xid = ");
12364 if self.xid != None:
12365 q.text("%#x" % self.xid)
12366 else:
12367 q.text('None')
12368 q.text(","); q.breakable()
12369 q.text("code = ");
12370 q.text("%#x" % self.code)
12371 q.text(","); q.breakable()
12372 q.text("data = ");
12373 q.pp(self.data)
12374 q.breakable()
12375 q.text('}')
12376
Rich Lane7dcdf022013-12-11 14:45:27 -080012377error_msg.subtypes[0] = hello_failed_error_msg
12378
12379class meter_config_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070012380 version = 4
12381 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070012382 stats_type = 10
12383
12384 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012385 if xid != None:
12386 self.xid = xid
12387 else:
12388 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070012389 if flags != None:
12390 self.flags = flags
12391 else:
12392 self.flags = 0
12393 if entries != None:
12394 self.entries = entries
12395 else:
12396 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -080012397 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070012398
12399 def pack(self):
12400 packed = []
12401 packed.append(struct.pack("!B", self.version))
12402 packed.append(struct.pack("!B", self.type))
12403 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12404 packed.append(struct.pack("!L", self.xid))
12405 packed.append(struct.pack("!H", self.stats_type))
12406 packed.append(struct.pack("!H", self.flags))
12407 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080012408 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -070012409 length = sum([len(x) for x in packed])
12410 packed[2] = struct.pack("!H", length)
12411 return ''.join(packed)
12412
12413 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012414 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070012415 obj = meter_config_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070012416 _version = reader.read("!B")[0]
12417 assert(_version == 4)
12418 _type = reader.read("!B")[0]
12419 assert(_type == 19)
12420 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012421 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080012422 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070012423 obj.xid = reader.read("!L")[0]
12424 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012425 assert(_stats_type == 10)
Dan Talaycof6202252013-07-02 01:00:29 -070012426 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012427 reader.skip(4)
Rich Lanee2567702015-01-26 15:04:35 -080012428 obj.entries = loxi.generic_util.unpack_list(reader, ofp.meter_band.meter_band.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070012429 return obj
12430
12431 def __eq__(self, other):
12432 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070012433 if self.xid != other.xid: return False
12434 if self.flags != other.flags: return False
12435 if self.entries != other.entries: return False
12436 return True
12437
Rich Lanec2ee4b82013-04-24 17:12:38 -070012438 def pretty_print(self, q):
12439 q.text("meter_config_stats_reply {")
12440 with q.group():
12441 with q.indent(2):
12442 q.breakable()
12443 q.text("xid = ");
12444 if self.xid != None:
12445 q.text("%#x" % self.xid)
12446 else:
12447 q.text('None')
12448 q.text(","); q.breakable()
12449 q.text("flags = ");
12450 q.text("%#x" % self.flags)
12451 q.text(","); q.breakable()
12452 q.text("entries = ");
12453 q.pp(self.entries)
12454 q.breakable()
12455 q.text('}')
12456
Rich Lane7dcdf022013-12-11 14:45:27 -080012457stats_reply.subtypes[10] = meter_config_stats_reply
12458
12459class meter_config_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070012460 version = 4
12461 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070012462 stats_type = 10
12463
12464 def __init__(self, xid=None, flags=None, meter_id=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012465 if xid != None:
12466 self.xid = xid
12467 else:
12468 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070012469 if flags != None:
12470 self.flags = flags
12471 else:
12472 self.flags = 0
12473 if meter_id != None:
12474 self.meter_id = meter_id
12475 else:
12476 self.meter_id = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080012477 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070012478
12479 def pack(self):
12480 packed = []
12481 packed.append(struct.pack("!B", self.version))
12482 packed.append(struct.pack("!B", self.type))
12483 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12484 packed.append(struct.pack("!L", self.xid))
12485 packed.append(struct.pack("!H", self.stats_type))
12486 packed.append(struct.pack("!H", self.flags))
12487 packed.append('\x00' * 4)
12488 packed.append(struct.pack("!L", self.meter_id))
12489 packed.append('\x00' * 4)
12490 length = sum([len(x) for x in packed])
12491 packed[2] = struct.pack("!H", length)
12492 return ''.join(packed)
12493
12494 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012495 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070012496 obj = meter_config_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070012497 _version = reader.read("!B")[0]
12498 assert(_version == 4)
12499 _type = reader.read("!B")[0]
12500 assert(_type == 18)
12501 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012502 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080012503 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070012504 obj.xid = reader.read("!L")[0]
12505 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012506 assert(_stats_type == 10)
Dan Talaycof6202252013-07-02 01:00:29 -070012507 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012508 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -070012509 obj.meter_id = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012510 reader.skip(4)
12511 return obj
12512
12513 def __eq__(self, other):
12514 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070012515 if self.xid != other.xid: return False
12516 if self.flags != other.flags: return False
12517 if self.meter_id != other.meter_id: return False
12518 return True
12519
Rich Lanec2ee4b82013-04-24 17:12:38 -070012520 def pretty_print(self, q):
12521 q.text("meter_config_stats_request {")
12522 with q.group():
12523 with q.indent(2):
12524 q.breakable()
12525 q.text("xid = ");
12526 if self.xid != None:
12527 q.text("%#x" % self.xid)
12528 else:
12529 q.text('None')
12530 q.text(","); q.breakable()
12531 q.text("flags = ");
12532 q.text("%#x" % self.flags)
12533 q.text(","); q.breakable()
12534 q.text("meter_id = ");
12535 q.text("%#x" % self.meter_id)
12536 q.breakable()
12537 q.text('}')
12538
Rich Lane7dcdf022013-12-11 14:45:27 -080012539stats_request.subtypes[10] = meter_config_stats_request
12540
12541class meter_features_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070012542 version = 4
12543 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070012544 stats_type = 11
12545
12546 def __init__(self, xid=None, flags=None, features=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012547 if xid != None:
12548 self.xid = xid
12549 else:
12550 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070012551 if flags != None:
12552 self.flags = flags
12553 else:
12554 self.flags = 0
12555 if features != None:
12556 self.features = features
12557 else:
Rich Lanee2567702015-01-26 15:04:35 -080012558 self.features = ofp.meter_features()
Rich Lane7dcdf022013-12-11 14:45:27 -080012559 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070012560
12561 def pack(self):
12562 packed = []
12563 packed.append(struct.pack("!B", self.version))
12564 packed.append(struct.pack("!B", self.type))
12565 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12566 packed.append(struct.pack("!L", self.xid))
12567 packed.append(struct.pack("!H", self.stats_type))
12568 packed.append(struct.pack("!H", self.flags))
12569 packed.append('\x00' * 4)
12570 packed.append(self.features.pack())
12571 length = sum([len(x) for x in packed])
12572 packed[2] = struct.pack("!H", length)
12573 return ''.join(packed)
12574
12575 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012576 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070012577 obj = meter_features_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070012578 _version = reader.read("!B")[0]
12579 assert(_version == 4)
12580 _type = reader.read("!B")[0]
12581 assert(_type == 19)
12582 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012583 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080012584 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070012585 obj.xid = reader.read("!L")[0]
12586 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012587 assert(_stats_type == 11)
Dan Talaycof6202252013-07-02 01:00:29 -070012588 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012589 reader.skip(4)
Rich Lanee2567702015-01-26 15:04:35 -080012590 obj.features = ofp.meter_features.unpack(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -070012591 return obj
12592
12593 def __eq__(self, other):
12594 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070012595 if self.xid != other.xid: return False
12596 if self.flags != other.flags: return False
12597 if self.features != other.features: return False
12598 return True
12599
Rich Lanec2ee4b82013-04-24 17:12:38 -070012600 def pretty_print(self, q):
12601 q.text("meter_features_stats_reply {")
12602 with q.group():
12603 with q.indent(2):
12604 q.breakable()
12605 q.text("xid = ");
12606 if self.xid != None:
12607 q.text("%#x" % self.xid)
12608 else:
12609 q.text('None')
12610 q.text(","); q.breakable()
12611 q.text("flags = ");
12612 q.text("%#x" % self.flags)
12613 q.text(","); q.breakable()
12614 q.text("features = ");
12615 q.pp(self.features)
12616 q.breakable()
12617 q.text('}')
12618
Rich Lane7dcdf022013-12-11 14:45:27 -080012619stats_reply.subtypes[11] = meter_features_stats_reply
12620
12621class meter_features_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070012622 version = 4
12623 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070012624 stats_type = 11
12625
12626 def __init__(self, xid=None, flags=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012627 if xid != None:
12628 self.xid = xid
12629 else:
12630 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070012631 if flags != None:
12632 self.flags = flags
12633 else:
12634 self.flags = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080012635 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070012636
12637 def pack(self):
12638 packed = []
12639 packed.append(struct.pack("!B", self.version))
12640 packed.append(struct.pack("!B", self.type))
12641 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12642 packed.append(struct.pack("!L", self.xid))
12643 packed.append(struct.pack("!H", self.stats_type))
12644 packed.append(struct.pack("!H", self.flags))
12645 packed.append('\x00' * 4)
12646 length = sum([len(x) for x in packed])
12647 packed[2] = struct.pack("!H", length)
12648 return ''.join(packed)
12649
12650 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012651 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070012652 obj = meter_features_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070012653 _version = reader.read("!B")[0]
12654 assert(_version == 4)
12655 _type = reader.read("!B")[0]
12656 assert(_type == 18)
12657 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012658 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080012659 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070012660 obj.xid = reader.read("!L")[0]
12661 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012662 assert(_stats_type == 11)
Dan Talaycof6202252013-07-02 01:00:29 -070012663 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012664 reader.skip(4)
12665 return obj
12666
12667 def __eq__(self, other):
12668 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070012669 if self.xid != other.xid: return False
12670 if self.flags != other.flags: return False
12671 return True
12672
Rich Lanec2ee4b82013-04-24 17:12:38 -070012673 def pretty_print(self, q):
12674 q.text("meter_features_stats_request {")
12675 with q.group():
12676 with q.indent(2):
12677 q.breakable()
12678 q.text("xid = ");
12679 if self.xid != None:
12680 q.text("%#x" % self.xid)
12681 else:
12682 q.text('None')
12683 q.text(","); q.breakable()
12684 q.text("flags = ");
12685 q.text("%#x" % self.flags)
12686 q.breakable()
12687 q.text('}')
12688
Rich Lane7dcdf022013-12-11 14:45:27 -080012689stats_request.subtypes[11] = meter_features_stats_request
12690
12691class meter_mod(message):
Dan Talaycof6202252013-07-02 01:00:29 -070012692 version = 4
12693 type = 29
Rich Lanec2ee4b82013-04-24 17:12:38 -070012694
12695 def __init__(self, xid=None, command=None, flags=None, meter_id=None, meters=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012696 if xid != None:
12697 self.xid = xid
12698 else:
12699 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070012700 if command != None:
12701 self.command = command
12702 else:
12703 self.command = 0
12704 if flags != None:
12705 self.flags = flags
12706 else:
12707 self.flags = 0
12708 if meter_id != None:
12709 self.meter_id = meter_id
12710 else:
12711 self.meter_id = 0
12712 if meters != None:
12713 self.meters = meters
12714 else:
12715 self.meters = []
Rich Lane7dcdf022013-12-11 14:45:27 -080012716 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070012717
12718 def pack(self):
12719 packed = []
12720 packed.append(struct.pack("!B", self.version))
12721 packed.append(struct.pack("!B", self.type))
12722 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12723 packed.append(struct.pack("!L", self.xid))
12724 packed.append(struct.pack("!H", self.command))
12725 packed.append(struct.pack("!H", self.flags))
12726 packed.append(struct.pack("!L", self.meter_id))
Rich Lane7dcdf022013-12-11 14:45:27 -080012727 packed.append(loxi.generic_util.pack_list(self.meters))
Rich Lanec2ee4b82013-04-24 17:12:38 -070012728 length = sum([len(x) for x in packed])
12729 packed[2] = struct.pack("!H", length)
12730 return ''.join(packed)
12731
12732 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012733 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070012734 obj = meter_mod()
Dan Talaycof6202252013-07-02 01:00:29 -070012735 _version = reader.read("!B")[0]
12736 assert(_version == 4)
12737 _type = reader.read("!B")[0]
12738 assert(_type == 29)
12739 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012740 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080012741 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070012742 obj.xid = reader.read("!L")[0]
12743 obj.command = reader.read("!H")[0]
12744 obj.flags = reader.read("!H")[0]
12745 obj.meter_id = reader.read("!L")[0]
Rich Lanee2567702015-01-26 15:04:35 -080012746 obj.meters = loxi.generic_util.unpack_list(reader, ofp.meter_band.meter_band.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070012747 return obj
12748
12749 def __eq__(self, other):
12750 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070012751 if self.xid != other.xid: return False
12752 if self.command != other.command: return False
12753 if self.flags != other.flags: return False
12754 if self.meter_id != other.meter_id: return False
12755 if self.meters != other.meters: return False
12756 return True
12757
Rich Lanec2ee4b82013-04-24 17:12:38 -070012758 def pretty_print(self, q):
12759 q.text("meter_mod {")
12760 with q.group():
12761 with q.indent(2):
12762 q.breakable()
12763 q.text("xid = ");
12764 if self.xid != None:
12765 q.text("%#x" % self.xid)
12766 else:
12767 q.text('None')
12768 q.text(","); q.breakable()
12769 q.text("command = ");
12770 q.text("%#x" % self.command)
12771 q.text(","); q.breakable()
12772 q.text("flags = ");
12773 q.text("%#x" % self.flags)
12774 q.text(","); q.breakable()
12775 q.text("meter_id = ");
12776 q.text("%#x" % self.meter_id)
12777 q.text(","); q.breakable()
12778 q.text("meters = ");
12779 q.pp(self.meters)
12780 q.breakable()
12781 q.text('}')
12782
Rich Lane7dcdf022013-12-11 14:45:27 -080012783message.subtypes[29] = meter_mod
12784
12785class meter_mod_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -070012786 version = 4
12787 type = 1
12788 err_type = 12
12789
12790 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012791 if xid != None:
12792 self.xid = xid
12793 else:
12794 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -070012795 if code != None:
12796 self.code = code
12797 else:
12798 self.code = 0
12799 if data != None:
12800 self.data = data
12801 else:
12802 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080012803 return
Rich Lane6f4978c2013-10-20 21:33:52 -070012804
12805 def pack(self):
12806 packed = []
12807 packed.append(struct.pack("!B", self.version))
12808 packed.append(struct.pack("!B", self.type))
12809 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12810 packed.append(struct.pack("!L", self.xid))
12811 packed.append(struct.pack("!H", self.err_type))
12812 packed.append(struct.pack("!H", self.code))
12813 packed.append(self.data)
12814 length = sum([len(x) for x in packed])
12815 packed[2] = struct.pack("!H", length)
12816 return ''.join(packed)
12817
12818 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012819 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -070012820 obj = meter_mod_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -070012821 _version = reader.read("!B")[0]
12822 assert(_version == 4)
12823 _type = reader.read("!B")[0]
12824 assert(_type == 1)
12825 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012826 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080012827 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -070012828 obj.xid = reader.read("!L")[0]
12829 _err_type = reader.read("!H")[0]
12830 assert(_err_type == 12)
12831 obj.code = reader.read("!H")[0]
12832 obj.data = str(reader.read_all())
12833 return obj
12834
12835 def __eq__(self, other):
12836 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -070012837 if self.xid != other.xid: return False
12838 if self.code != other.code: return False
12839 if self.data != other.data: return False
12840 return True
12841
Rich Lane6f4978c2013-10-20 21:33:52 -070012842 def pretty_print(self, q):
12843 q.text("meter_mod_failed_error_msg {")
12844 with q.group():
12845 with q.indent(2):
12846 q.breakable()
12847 q.text("xid = ");
12848 if self.xid != None:
12849 q.text("%#x" % self.xid)
12850 else:
12851 q.text('None')
12852 q.text(","); q.breakable()
12853 q.text("code = ");
12854 q.text("%#x" % self.code)
12855 q.text(","); q.breakable()
12856 q.text("data = ");
12857 q.pp(self.data)
12858 q.breakable()
12859 q.text('}')
12860
Rich Lane7dcdf022013-12-11 14:45:27 -080012861error_msg.subtypes[12] = meter_mod_failed_error_msg
12862
12863class meter_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070012864 version = 4
12865 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070012866 stats_type = 9
12867
12868 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012869 if xid != None:
12870 self.xid = xid
12871 else:
12872 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070012873 if flags != None:
12874 self.flags = flags
12875 else:
12876 self.flags = 0
12877 if entries != None:
12878 self.entries = entries
12879 else:
12880 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -080012881 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070012882
12883 def pack(self):
12884 packed = []
12885 packed.append(struct.pack("!B", self.version))
12886 packed.append(struct.pack("!B", self.type))
12887 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12888 packed.append(struct.pack("!L", self.xid))
12889 packed.append(struct.pack("!H", self.stats_type))
12890 packed.append(struct.pack("!H", self.flags))
12891 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080012892 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -070012893 length = sum([len(x) for x in packed])
12894 packed[2] = struct.pack("!H", length)
12895 return ''.join(packed)
12896
12897 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012898 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070012899 obj = meter_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070012900 _version = reader.read("!B")[0]
12901 assert(_version == 4)
12902 _type = reader.read("!B")[0]
12903 assert(_type == 19)
12904 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012905 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080012906 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070012907 obj.xid = reader.read("!L")[0]
12908 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012909 assert(_stats_type == 9)
Dan Talaycof6202252013-07-02 01:00:29 -070012910 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012911 reader.skip(4)
Rich Lanee2567702015-01-26 15:04:35 -080012912 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.meter_stats.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070012913 return obj
12914
12915 def __eq__(self, other):
12916 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070012917 if self.xid != other.xid: return False
12918 if self.flags != other.flags: return False
12919 if self.entries != other.entries: return False
12920 return True
12921
Rich Lanec2ee4b82013-04-24 17:12:38 -070012922 def pretty_print(self, q):
12923 q.text("meter_stats_reply {")
12924 with q.group():
12925 with q.indent(2):
12926 q.breakable()
12927 q.text("xid = ");
12928 if self.xid != None:
12929 q.text("%#x" % self.xid)
12930 else:
12931 q.text('None')
12932 q.text(","); q.breakable()
12933 q.text("flags = ");
12934 q.text("%#x" % self.flags)
12935 q.text(","); q.breakable()
12936 q.text("entries = ");
12937 q.pp(self.entries)
12938 q.breakable()
12939 q.text('}')
12940
Rich Lane7dcdf022013-12-11 14:45:27 -080012941stats_reply.subtypes[9] = meter_stats_reply
12942
12943class meter_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070012944 version = 4
12945 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070012946 stats_type = 9
12947
12948 def __init__(self, xid=None, flags=None, meter_id=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080012949 if xid != None:
12950 self.xid = xid
12951 else:
12952 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070012953 if flags != None:
12954 self.flags = flags
12955 else:
12956 self.flags = 0
12957 if meter_id != None:
12958 self.meter_id = meter_id
12959 else:
12960 self.meter_id = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080012961 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070012962
12963 def pack(self):
12964 packed = []
12965 packed.append(struct.pack("!B", self.version))
12966 packed.append(struct.pack("!B", self.type))
12967 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12968 packed.append(struct.pack("!L", self.xid))
12969 packed.append(struct.pack("!H", self.stats_type))
12970 packed.append(struct.pack("!H", self.flags))
12971 packed.append('\x00' * 4)
12972 packed.append(struct.pack("!L", self.meter_id))
12973 packed.append('\x00' * 4)
12974 length = sum([len(x) for x in packed])
12975 packed[2] = struct.pack("!H", length)
12976 return ''.join(packed)
12977
12978 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080012979 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070012980 obj = meter_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070012981 _version = reader.read("!B")[0]
12982 assert(_version == 4)
12983 _type = reader.read("!B")[0]
12984 assert(_type == 18)
12985 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080012986 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080012987 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070012988 obj.xid = reader.read("!L")[0]
12989 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012990 assert(_stats_type == 9)
Dan Talaycof6202252013-07-02 01:00:29 -070012991 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012992 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -070012993 obj.meter_id = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070012994 reader.skip(4)
12995 return obj
12996
12997 def __eq__(self, other):
12998 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070012999 if self.xid != other.xid: return False
13000 if self.flags != other.flags: return False
13001 if self.meter_id != other.meter_id: return False
13002 return True
13003
Rich Lanec2ee4b82013-04-24 17:12:38 -070013004 def pretty_print(self, q):
13005 q.text("meter_stats_request {")
13006 with q.group():
13007 with q.indent(2):
13008 q.breakable()
13009 q.text("xid = ");
13010 if self.xid != None:
13011 q.text("%#x" % self.xid)
13012 else:
13013 q.text('None')
13014 q.text(","); q.breakable()
13015 q.text("flags = ");
13016 q.text("%#x" % self.flags)
13017 q.text(","); q.breakable()
13018 q.text("meter_id = ");
13019 q.text("%#x" % self.meter_id)
13020 q.breakable()
13021 q.text('}')
13022
Rich Lane7dcdf022013-12-11 14:45:27 -080013023stats_request.subtypes[9] = meter_stats_request
13024
13025class nicira_header(experimenter):
13026 subtypes = {}
13027
Rich Lane95f7fc92014-01-27 17:08:16 -080013028 version = 4
13029 type = 4
13030 experimenter = 8992
13031
13032 def __init__(self, xid=None, subtype=None):
13033 if xid != None:
13034 self.xid = xid
13035 else:
13036 self.xid = None
13037 if subtype != None:
13038 self.subtype = subtype
13039 else:
13040 self.subtype = 0
13041 return
13042
13043 def pack(self):
13044 packed = []
13045 packed.append(struct.pack("!B", self.version))
13046 packed.append(struct.pack("!B", self.type))
13047 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13048 packed.append(struct.pack("!L", self.xid))
13049 packed.append(struct.pack("!L", self.experimenter))
13050 packed.append(struct.pack("!L", self.subtype))
13051 length = sum([len(x) for x in packed])
13052 packed[2] = struct.pack("!H", length)
13053 return ''.join(packed)
13054
Rich Lane7dcdf022013-12-11 14:45:27 -080013055 @staticmethod
13056 def unpack(reader):
13057 subtype, = reader.peek('!L', 12)
Rich Lane95f7fc92014-01-27 17:08:16 -080013058 subclass = nicira_header.subtypes.get(subtype)
13059 if subclass:
13060 return subclass.unpack(reader)
13061
13062 obj = nicira_header()
13063 _version = reader.read("!B")[0]
13064 assert(_version == 4)
13065 _type = reader.read("!B")[0]
13066 assert(_type == 4)
13067 _length = reader.read("!H")[0]
13068 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080013069 reader = orig_reader.slice(_length, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -080013070 obj.xid = reader.read("!L")[0]
13071 _experimenter = reader.read("!L")[0]
13072 assert(_experimenter == 8992)
13073 obj.subtype = reader.read("!L")[0]
13074 return obj
13075
13076 def __eq__(self, other):
13077 if type(self) != type(other): return False
13078 if self.xid != other.xid: return False
13079 if self.subtype != other.subtype: return False
13080 return True
13081
13082 def pretty_print(self, q):
13083 q.text("nicira_header {")
13084 with q.group():
13085 with q.indent(2):
13086 q.breakable()
13087 q.text("xid = ");
13088 if self.xid != None:
13089 q.text("%#x" % self.xid)
13090 else:
13091 q.text('None')
13092 q.breakable()
13093 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -080013094
13095experimenter.subtypes[8992] = nicira_header
13096
13097class packet_in(message):
Dan Talaycof6202252013-07-02 01:00:29 -070013098 version = 4
13099 type = 10
Rich Lanec2ee4b82013-04-24 17:12:38 -070013100
13101 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 -080013102 if xid != None:
13103 self.xid = xid
13104 else:
13105 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070013106 if buffer_id != None:
13107 self.buffer_id = buffer_id
13108 else:
13109 self.buffer_id = 0
13110 if total_len != None:
13111 self.total_len = total_len
13112 else:
13113 self.total_len = 0
13114 if reason != None:
13115 self.reason = reason
13116 else:
13117 self.reason = 0
13118 if table_id != None:
13119 self.table_id = table_id
13120 else:
13121 self.table_id = 0
13122 if cookie != None:
13123 self.cookie = cookie
13124 else:
13125 self.cookie = 0
13126 if match != None:
13127 self.match = match
13128 else:
Rich Lanee2567702015-01-26 15:04:35 -080013129 self.match = ofp.match()
Rich Lanec2ee4b82013-04-24 17:12:38 -070013130 if data != None:
13131 self.data = data
13132 else:
Dan Talaycof6202252013-07-02 01:00:29 -070013133 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080013134 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070013135
13136 def pack(self):
13137 packed = []
13138 packed.append(struct.pack("!B", self.version))
13139 packed.append(struct.pack("!B", self.type))
13140 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13141 packed.append(struct.pack("!L", self.xid))
13142 packed.append(struct.pack("!L", self.buffer_id))
13143 packed.append(struct.pack("!H", self.total_len))
13144 packed.append(struct.pack("!B", self.reason))
13145 packed.append(struct.pack("!B", self.table_id))
13146 packed.append(struct.pack("!Q", self.cookie))
13147 packed.append(self.match.pack())
13148 packed.append('\x00' * 2)
13149 packed.append(self.data)
13150 length = sum([len(x) for x in packed])
13151 packed[2] = struct.pack("!H", length)
13152 return ''.join(packed)
13153
13154 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080013155 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070013156 obj = packet_in()
Dan Talaycof6202252013-07-02 01:00:29 -070013157 _version = reader.read("!B")[0]
13158 assert(_version == 4)
13159 _type = reader.read("!B")[0]
13160 assert(_type == 10)
13161 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080013162 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080013163 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070013164 obj.xid = reader.read("!L")[0]
13165 obj.buffer_id = reader.read("!L")[0]
13166 obj.total_len = reader.read("!H")[0]
13167 obj.reason = reader.read("!B")[0]
13168 obj.table_id = reader.read("!B")[0]
13169 obj.cookie = reader.read("!Q")[0]
Rich Lanee2567702015-01-26 15:04:35 -080013170 obj.match = ofp.match.unpack(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -070013171 reader.skip(2)
13172 obj.data = str(reader.read_all())
13173 return obj
13174
13175 def __eq__(self, other):
13176 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070013177 if self.xid != other.xid: return False
13178 if self.buffer_id != other.buffer_id: return False
13179 if self.total_len != other.total_len: return False
13180 if self.reason != other.reason: return False
13181 if self.table_id != other.table_id: return False
13182 if self.cookie != other.cookie: return False
13183 if self.match != other.match: return False
13184 if self.data != other.data: return False
13185 return True
13186
Rich Lanec2ee4b82013-04-24 17:12:38 -070013187 def pretty_print(self, q):
13188 q.text("packet_in {")
13189 with q.group():
13190 with q.indent(2):
13191 q.breakable()
13192 q.text("xid = ");
13193 if self.xid != None:
13194 q.text("%#x" % self.xid)
13195 else:
13196 q.text('None')
13197 q.text(","); q.breakable()
13198 q.text("buffer_id = ");
13199 q.text("%#x" % self.buffer_id)
13200 q.text(","); q.breakable()
13201 q.text("total_len = ");
13202 q.text("%#x" % self.total_len)
13203 q.text(","); q.breakable()
13204 q.text("reason = ");
13205 q.text("%#x" % self.reason)
13206 q.text(","); q.breakable()
13207 q.text("table_id = ");
13208 q.text("%#x" % self.table_id)
13209 q.text(","); q.breakable()
13210 q.text("cookie = ");
13211 q.text("%#x" % self.cookie)
13212 q.text(","); q.breakable()
13213 q.text("match = ");
13214 q.pp(self.match)
13215 q.text(","); q.breakable()
13216 q.text("data = ");
13217 q.pp(self.data)
13218 q.breakable()
13219 q.text('}')
13220
Rich Lane7dcdf022013-12-11 14:45:27 -080013221message.subtypes[10] = packet_in
13222
13223class packet_out(message):
Dan Talaycof6202252013-07-02 01:00:29 -070013224 version = 4
13225 type = 13
Rich Lanec2ee4b82013-04-24 17:12:38 -070013226
13227 def __init__(self, xid=None, buffer_id=None, in_port=None, actions=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080013228 if xid != None:
13229 self.xid = xid
13230 else:
13231 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070013232 if buffer_id != None:
13233 self.buffer_id = buffer_id
13234 else:
13235 self.buffer_id = 0
13236 if in_port != None:
13237 self.in_port = in_port
13238 else:
13239 self.in_port = 0
13240 if actions != None:
13241 self.actions = actions
13242 else:
13243 self.actions = []
13244 if data != None:
13245 self.data = data
13246 else:
Dan Talaycof6202252013-07-02 01:00:29 -070013247 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080013248 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070013249
13250 def pack(self):
13251 packed = []
13252 packed.append(struct.pack("!B", self.version))
13253 packed.append(struct.pack("!B", self.type))
13254 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13255 packed.append(struct.pack("!L", self.xid))
13256 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -070013257 packed.append(util.pack_port_no(self.in_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -070013258 packed.append(struct.pack("!H", 0)) # placeholder for actions_len at index 6
13259 packed.append('\x00' * 6)
Rich Lane7dcdf022013-12-11 14:45:27 -080013260 packed.append(loxi.generic_util.pack_list(self.actions))
Rich Lanec2ee4b82013-04-24 17:12:38 -070013261 packed[6] = struct.pack("!H", len(packed[-1]))
13262 packed.append(self.data)
13263 length = sum([len(x) for x in packed])
13264 packed[2] = struct.pack("!H", length)
13265 return ''.join(packed)
13266
13267 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080013268 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070013269 obj = packet_out()
Dan Talaycof6202252013-07-02 01:00:29 -070013270 _version = reader.read("!B")[0]
13271 assert(_version == 4)
13272 _type = reader.read("!B")[0]
13273 assert(_type == 13)
13274 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080013275 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080013276 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070013277 obj.xid = reader.read("!L")[0]
13278 obj.buffer_id = reader.read("!L")[0]
13279 obj.in_port = util.unpack_port_no(reader)
13280 _actions_len = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013281 reader.skip(6)
Rich Lanee2567702015-01-26 15:04:35 -080013282 obj.actions = loxi.generic_util.unpack_list(reader.slice(_actions_len), ofp.action.action.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070013283 obj.data = str(reader.read_all())
13284 return obj
13285
13286 def __eq__(self, other):
13287 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070013288 if self.xid != other.xid: return False
13289 if self.buffer_id != other.buffer_id: return False
13290 if self.in_port != other.in_port: return False
13291 if self.actions != other.actions: return False
13292 if self.data != other.data: return False
13293 return True
13294
Rich Lanec2ee4b82013-04-24 17:12:38 -070013295 def pretty_print(self, q):
13296 q.text("packet_out {")
13297 with q.group():
13298 with q.indent(2):
13299 q.breakable()
13300 q.text("xid = ");
13301 if self.xid != None:
13302 q.text("%#x" % self.xid)
13303 else:
13304 q.text('None')
13305 q.text(","); q.breakable()
13306 q.text("buffer_id = ");
13307 q.text("%#x" % self.buffer_id)
13308 q.text(","); q.breakable()
13309 q.text("in_port = ");
13310 q.text(util.pretty_port(self.in_port))
13311 q.text(","); q.breakable()
13312 q.text("actions = ");
13313 q.pp(self.actions)
13314 q.text(","); q.breakable()
13315 q.text("data = ");
13316 q.pp(self.data)
13317 q.breakable()
13318 q.text('}')
13319
Rich Lane7dcdf022013-12-11 14:45:27 -080013320message.subtypes[13] = packet_out
13321
13322class port_desc_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070013323 version = 4
13324 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070013325 stats_type = 13
13326
13327 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080013328 if xid != None:
13329 self.xid = xid
13330 else:
13331 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070013332 if flags != None:
13333 self.flags = flags
13334 else:
13335 self.flags = 0
13336 if entries != None:
13337 self.entries = entries
13338 else:
13339 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -080013340 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070013341
13342 def pack(self):
13343 packed = []
13344 packed.append(struct.pack("!B", self.version))
13345 packed.append(struct.pack("!B", self.type))
13346 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13347 packed.append(struct.pack("!L", self.xid))
13348 packed.append(struct.pack("!H", self.stats_type))
13349 packed.append(struct.pack("!H", self.flags))
13350 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080013351 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -070013352 length = sum([len(x) for x in packed])
13353 packed[2] = struct.pack("!H", length)
13354 return ''.join(packed)
13355
13356 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080013357 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070013358 obj = port_desc_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070013359 _version = reader.read("!B")[0]
13360 assert(_version == 4)
13361 _type = reader.read("!B")[0]
13362 assert(_type == 19)
13363 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080013364 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080013365 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070013366 obj.xid = reader.read("!L")[0]
13367 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013368 assert(_stats_type == 13)
Dan Talaycof6202252013-07-02 01:00:29 -070013369 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013370 reader.skip(4)
Rich Lanee2567702015-01-26 15:04:35 -080013371 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.port_desc.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070013372 return obj
13373
13374 def __eq__(self, other):
13375 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070013376 if self.xid != other.xid: return False
13377 if self.flags != other.flags: return False
13378 if self.entries != other.entries: return False
13379 return True
13380
Rich Lanec2ee4b82013-04-24 17:12:38 -070013381 def pretty_print(self, q):
13382 q.text("port_desc_stats_reply {")
13383 with q.group():
13384 with q.indent(2):
13385 q.breakable()
13386 q.text("xid = ");
13387 if self.xid != None:
13388 q.text("%#x" % self.xid)
13389 else:
13390 q.text('None')
13391 q.text(","); q.breakable()
13392 q.text("flags = ");
13393 q.text("%#x" % self.flags)
13394 q.text(","); q.breakable()
13395 q.text("entries = ");
13396 q.pp(self.entries)
13397 q.breakable()
13398 q.text('}')
13399
Rich Lane7dcdf022013-12-11 14:45:27 -080013400stats_reply.subtypes[13] = port_desc_stats_reply
13401
13402class port_desc_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070013403 version = 4
13404 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070013405 stats_type = 13
13406
13407 def __init__(self, xid=None, flags=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080013408 if xid != None:
13409 self.xid = xid
13410 else:
13411 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070013412 if flags != None:
13413 self.flags = flags
13414 else:
13415 self.flags = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080013416 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070013417
13418 def pack(self):
13419 packed = []
13420 packed.append(struct.pack("!B", self.version))
13421 packed.append(struct.pack("!B", self.type))
13422 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13423 packed.append(struct.pack("!L", self.xid))
13424 packed.append(struct.pack("!H", self.stats_type))
13425 packed.append(struct.pack("!H", self.flags))
13426 packed.append('\x00' * 4)
13427 length = sum([len(x) for x in packed])
13428 packed[2] = struct.pack("!H", length)
13429 return ''.join(packed)
13430
13431 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080013432 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070013433 obj = port_desc_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070013434 _version = reader.read("!B")[0]
13435 assert(_version == 4)
13436 _type = reader.read("!B")[0]
13437 assert(_type == 18)
13438 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080013439 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080013440 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070013441 obj.xid = reader.read("!L")[0]
13442 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013443 assert(_stats_type == 13)
Dan Talaycof6202252013-07-02 01:00:29 -070013444 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013445 reader.skip(4)
13446 return obj
13447
13448 def __eq__(self, other):
13449 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070013450 if self.xid != other.xid: return False
13451 if self.flags != other.flags: return False
13452 return True
13453
Rich Lanec2ee4b82013-04-24 17:12:38 -070013454 def pretty_print(self, q):
13455 q.text("port_desc_stats_request {")
13456 with q.group():
13457 with q.indent(2):
13458 q.breakable()
13459 q.text("xid = ");
13460 if self.xid != None:
13461 q.text("%#x" % self.xid)
13462 else:
13463 q.text('None')
13464 q.text(","); q.breakable()
13465 q.text("flags = ");
13466 q.text("%#x" % self.flags)
13467 q.breakable()
13468 q.text('}')
13469
Rich Lane7dcdf022013-12-11 14:45:27 -080013470stats_request.subtypes[13] = port_desc_stats_request
13471
13472class port_mod(message):
Dan Talaycof6202252013-07-02 01:00:29 -070013473 version = 4
13474 type = 16
Rich Lanec2ee4b82013-04-24 17:12:38 -070013475
13476 def __init__(self, xid=None, port_no=None, hw_addr=None, config=None, mask=None, advertise=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080013477 if xid != None:
13478 self.xid = xid
13479 else:
13480 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070013481 if port_no != None:
13482 self.port_no = port_no
13483 else:
13484 self.port_no = 0
13485 if hw_addr != None:
13486 self.hw_addr = hw_addr
13487 else:
13488 self.hw_addr = [0,0,0,0,0,0]
13489 if config != None:
13490 self.config = config
13491 else:
13492 self.config = 0
13493 if mask != None:
13494 self.mask = mask
13495 else:
13496 self.mask = 0
13497 if advertise != None:
13498 self.advertise = advertise
13499 else:
13500 self.advertise = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080013501 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070013502
13503 def pack(self):
13504 packed = []
13505 packed.append(struct.pack("!B", self.version))
13506 packed.append(struct.pack("!B", self.type))
13507 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13508 packed.append(struct.pack("!L", self.xid))
Dan Talaycof6202252013-07-02 01:00:29 -070013509 packed.append(util.pack_port_no(self.port_no))
Rich Lanec2ee4b82013-04-24 17:12:38 -070013510 packed.append('\x00' * 4)
13511 packed.append(struct.pack("!6B", *self.hw_addr))
13512 packed.append('\x00' * 2)
13513 packed.append(struct.pack("!L", self.config))
13514 packed.append(struct.pack("!L", self.mask))
13515 packed.append(struct.pack("!L", self.advertise))
13516 packed.append('\x00' * 4)
13517 length = sum([len(x) for x in packed])
13518 packed[2] = struct.pack("!H", length)
13519 return ''.join(packed)
13520
13521 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080013522 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070013523 obj = port_mod()
Dan Talaycof6202252013-07-02 01:00:29 -070013524 _version = reader.read("!B")[0]
13525 assert(_version == 4)
13526 _type = reader.read("!B")[0]
13527 assert(_type == 16)
13528 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080013529 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080013530 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070013531 obj.xid = reader.read("!L")[0]
13532 obj.port_no = util.unpack_port_no(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -070013533 reader.skip(4)
13534 obj.hw_addr = list(reader.read('!6B'))
13535 reader.skip(2)
Dan Talaycof6202252013-07-02 01:00:29 -070013536 obj.config = reader.read("!L")[0]
13537 obj.mask = reader.read("!L")[0]
13538 obj.advertise = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013539 reader.skip(4)
13540 return obj
13541
13542 def __eq__(self, other):
13543 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070013544 if self.xid != other.xid: return False
13545 if self.port_no != other.port_no: return False
13546 if self.hw_addr != other.hw_addr: return False
13547 if self.config != other.config: return False
13548 if self.mask != other.mask: return False
13549 if self.advertise != other.advertise: return False
13550 return True
13551
Rich Lanec2ee4b82013-04-24 17:12:38 -070013552 def pretty_print(self, q):
13553 q.text("port_mod {")
13554 with q.group():
13555 with q.indent(2):
13556 q.breakable()
13557 q.text("xid = ");
13558 if self.xid != None:
13559 q.text("%#x" % self.xid)
13560 else:
13561 q.text('None')
13562 q.text(","); q.breakable()
13563 q.text("port_no = ");
13564 q.text(util.pretty_port(self.port_no))
13565 q.text(","); q.breakable()
13566 q.text("hw_addr = ");
13567 q.text(util.pretty_mac(self.hw_addr))
13568 q.text(","); q.breakable()
13569 q.text("config = ");
13570 q.text("%#x" % self.config)
13571 q.text(","); q.breakable()
13572 q.text("mask = ");
13573 q.text("%#x" % self.mask)
13574 q.text(","); q.breakable()
13575 q.text("advertise = ");
13576 q.text("%#x" % self.advertise)
13577 q.breakable()
13578 q.text('}')
13579
Rich Lane7dcdf022013-12-11 14:45:27 -080013580message.subtypes[16] = port_mod
13581
13582class port_mod_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -070013583 version = 4
13584 type = 1
13585 err_type = 7
13586
13587 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080013588 if xid != None:
13589 self.xid = xid
13590 else:
13591 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -070013592 if code != None:
13593 self.code = code
13594 else:
13595 self.code = 0
13596 if data != None:
13597 self.data = data
13598 else:
13599 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080013600 return
Rich Lane6f4978c2013-10-20 21:33:52 -070013601
13602 def pack(self):
13603 packed = []
13604 packed.append(struct.pack("!B", self.version))
13605 packed.append(struct.pack("!B", self.type))
13606 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13607 packed.append(struct.pack("!L", self.xid))
13608 packed.append(struct.pack("!H", self.err_type))
13609 packed.append(struct.pack("!H", self.code))
13610 packed.append(self.data)
13611 length = sum([len(x) for x in packed])
13612 packed[2] = struct.pack("!H", length)
13613 return ''.join(packed)
13614
13615 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080013616 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -070013617 obj = port_mod_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -070013618 _version = reader.read("!B")[0]
13619 assert(_version == 4)
13620 _type = reader.read("!B")[0]
13621 assert(_type == 1)
13622 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080013623 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080013624 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -070013625 obj.xid = reader.read("!L")[0]
13626 _err_type = reader.read("!H")[0]
13627 assert(_err_type == 7)
13628 obj.code = reader.read("!H")[0]
13629 obj.data = str(reader.read_all())
13630 return obj
13631
13632 def __eq__(self, other):
13633 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -070013634 if self.xid != other.xid: return False
13635 if self.code != other.code: return False
13636 if self.data != other.data: return False
13637 return True
13638
Rich Lane6f4978c2013-10-20 21:33:52 -070013639 def pretty_print(self, q):
13640 q.text("port_mod_failed_error_msg {")
13641 with q.group():
13642 with q.indent(2):
13643 q.breakable()
13644 q.text("xid = ");
13645 if self.xid != None:
13646 q.text("%#x" % self.xid)
13647 else:
13648 q.text('None')
13649 q.text(","); q.breakable()
13650 q.text("code = ");
13651 q.text("%#x" % self.code)
13652 q.text(","); q.breakable()
13653 q.text("data = ");
13654 q.pp(self.data)
13655 q.breakable()
13656 q.text('}')
13657
Rich Lane7dcdf022013-12-11 14:45:27 -080013658error_msg.subtypes[7] = port_mod_failed_error_msg
13659
13660class port_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070013661 version = 4
13662 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070013663 stats_type = 4
13664
13665 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080013666 if xid != None:
13667 self.xid = xid
13668 else:
13669 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070013670 if flags != None:
13671 self.flags = flags
13672 else:
13673 self.flags = 0
13674 if entries != None:
13675 self.entries = entries
13676 else:
13677 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -080013678 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070013679
13680 def pack(self):
13681 packed = []
13682 packed.append(struct.pack("!B", self.version))
13683 packed.append(struct.pack("!B", self.type))
13684 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13685 packed.append(struct.pack("!L", self.xid))
13686 packed.append(struct.pack("!H", self.stats_type))
13687 packed.append(struct.pack("!H", self.flags))
13688 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080013689 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -070013690 length = sum([len(x) for x in packed])
13691 packed[2] = struct.pack("!H", length)
13692 return ''.join(packed)
13693
13694 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080013695 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070013696 obj = port_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070013697 _version = reader.read("!B")[0]
13698 assert(_version == 4)
13699 _type = reader.read("!B")[0]
13700 assert(_type == 19)
13701 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080013702 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080013703 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070013704 obj.xid = reader.read("!L")[0]
13705 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013706 assert(_stats_type == 4)
Dan Talaycof6202252013-07-02 01:00:29 -070013707 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013708 reader.skip(4)
Rich Lanee2567702015-01-26 15:04:35 -080013709 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.port_stats_entry.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070013710 return obj
13711
13712 def __eq__(self, other):
13713 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070013714 if self.xid != other.xid: return False
13715 if self.flags != other.flags: return False
13716 if self.entries != other.entries: return False
13717 return True
13718
Rich Lanec2ee4b82013-04-24 17:12:38 -070013719 def pretty_print(self, q):
13720 q.text("port_stats_reply {")
13721 with q.group():
13722 with q.indent(2):
13723 q.breakable()
13724 q.text("xid = ");
13725 if self.xid != None:
13726 q.text("%#x" % self.xid)
13727 else:
13728 q.text('None')
13729 q.text(","); q.breakable()
13730 q.text("flags = ");
13731 q.text("%#x" % self.flags)
13732 q.text(","); q.breakable()
13733 q.text("entries = ");
13734 q.pp(self.entries)
13735 q.breakable()
13736 q.text('}')
13737
Rich Lane7dcdf022013-12-11 14:45:27 -080013738stats_reply.subtypes[4] = port_stats_reply
13739
13740class port_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070013741 version = 4
13742 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070013743 stats_type = 4
13744
13745 def __init__(self, xid=None, flags=None, port_no=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080013746 if xid != None:
13747 self.xid = xid
13748 else:
13749 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070013750 if flags != None:
13751 self.flags = flags
13752 else:
13753 self.flags = 0
13754 if port_no != None:
13755 self.port_no = port_no
13756 else:
13757 self.port_no = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080013758 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070013759
13760 def pack(self):
13761 packed = []
13762 packed.append(struct.pack("!B", self.version))
13763 packed.append(struct.pack("!B", self.type))
13764 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13765 packed.append(struct.pack("!L", self.xid))
13766 packed.append(struct.pack("!H", self.stats_type))
13767 packed.append(struct.pack("!H", self.flags))
13768 packed.append('\x00' * 4)
Dan Talaycof6202252013-07-02 01:00:29 -070013769 packed.append(util.pack_port_no(self.port_no))
Rich Lanec2ee4b82013-04-24 17:12:38 -070013770 packed.append('\x00' * 4)
13771 length = sum([len(x) for x in packed])
13772 packed[2] = struct.pack("!H", length)
13773 return ''.join(packed)
13774
13775 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080013776 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070013777 obj = port_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070013778 _version = reader.read("!B")[0]
13779 assert(_version == 4)
13780 _type = reader.read("!B")[0]
13781 assert(_type == 18)
13782 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080013783 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080013784 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070013785 obj.xid = reader.read("!L")[0]
13786 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013787 assert(_stats_type == 4)
Dan Talaycof6202252013-07-02 01:00:29 -070013788 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013789 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -070013790 obj.port_no = util.unpack_port_no(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -070013791 reader.skip(4)
13792 return obj
13793
13794 def __eq__(self, other):
13795 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070013796 if self.xid != other.xid: return False
13797 if self.flags != other.flags: return False
13798 if self.port_no != other.port_no: return False
13799 return True
13800
Rich Lanec2ee4b82013-04-24 17:12:38 -070013801 def pretty_print(self, q):
13802 q.text("port_stats_request {")
13803 with q.group():
13804 with q.indent(2):
13805 q.breakable()
13806 q.text("xid = ");
13807 if self.xid != None:
13808 q.text("%#x" % self.xid)
13809 else:
13810 q.text('None')
13811 q.text(","); q.breakable()
13812 q.text("flags = ");
13813 q.text("%#x" % self.flags)
13814 q.text(","); q.breakable()
13815 q.text("port_no = ");
13816 q.text(util.pretty_port(self.port_no))
13817 q.breakable()
13818 q.text('}')
13819
Rich Lane7dcdf022013-12-11 14:45:27 -080013820stats_request.subtypes[4] = port_stats_request
13821
13822class port_status(message):
Dan Talaycof6202252013-07-02 01:00:29 -070013823 version = 4
13824 type = 12
Rich Lanec2ee4b82013-04-24 17:12:38 -070013825
13826 def __init__(self, xid=None, reason=None, desc=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080013827 if xid != None:
13828 self.xid = xid
13829 else:
13830 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070013831 if reason != None:
13832 self.reason = reason
13833 else:
13834 self.reason = 0
13835 if desc != None:
13836 self.desc = desc
13837 else:
Rich Lanee2567702015-01-26 15:04:35 -080013838 self.desc = ofp.port_desc()
Rich Lane7dcdf022013-12-11 14:45:27 -080013839 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070013840
13841 def pack(self):
13842 packed = []
13843 packed.append(struct.pack("!B", self.version))
13844 packed.append(struct.pack("!B", self.type))
13845 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13846 packed.append(struct.pack("!L", self.xid))
13847 packed.append(struct.pack("!B", self.reason))
13848 packed.append('\x00' * 7)
13849 packed.append(self.desc.pack())
13850 length = sum([len(x) for x in packed])
13851 packed[2] = struct.pack("!H", length)
13852 return ''.join(packed)
13853
13854 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080013855 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070013856 obj = port_status()
Dan Talaycof6202252013-07-02 01:00:29 -070013857 _version = reader.read("!B")[0]
13858 assert(_version == 4)
13859 _type = reader.read("!B")[0]
13860 assert(_type == 12)
13861 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080013862 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080013863 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070013864 obj.xid = reader.read("!L")[0]
13865 obj.reason = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070013866 reader.skip(7)
Rich Lanee2567702015-01-26 15:04:35 -080013867 obj.desc = ofp.port_desc.unpack(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -070013868 return obj
13869
13870 def __eq__(self, other):
13871 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070013872 if self.xid != other.xid: return False
13873 if self.reason != other.reason: return False
13874 if self.desc != other.desc: return False
13875 return True
13876
Rich Lanec2ee4b82013-04-24 17:12:38 -070013877 def pretty_print(self, q):
13878 q.text("port_status {")
13879 with q.group():
13880 with q.indent(2):
13881 q.breakable()
13882 q.text("xid = ");
13883 if self.xid != None:
13884 q.text("%#x" % self.xid)
13885 else:
13886 q.text('None')
13887 q.text(","); q.breakable()
13888 q.text("reason = ");
13889 q.text("%#x" % self.reason)
13890 q.text(","); q.breakable()
13891 q.text("desc = ");
13892 q.pp(self.desc)
13893 q.breakable()
13894 q.text('}')
13895
Rich Lane7dcdf022013-12-11 14:45:27 -080013896message.subtypes[12] = port_status
13897
13898class queue_get_config_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -070013899 version = 4
13900 type = 23
Rich Lanec2ee4b82013-04-24 17:12:38 -070013901
13902 def __init__(self, xid=None, port=None, queues=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080013903 if xid != None:
13904 self.xid = xid
13905 else:
13906 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070013907 if port != None:
13908 self.port = port
13909 else:
13910 self.port = 0
13911 if queues != None:
13912 self.queues = queues
13913 else:
13914 self.queues = []
Rich Lane7dcdf022013-12-11 14:45:27 -080013915 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070013916
13917 def pack(self):
13918 packed = []
13919 packed.append(struct.pack("!B", self.version))
13920 packed.append(struct.pack("!B", self.type))
13921 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13922 packed.append(struct.pack("!L", self.xid))
Dan Talaycof6202252013-07-02 01:00:29 -070013923 packed.append(util.pack_port_no(self.port))
Rich Lanec2ee4b82013-04-24 17:12:38 -070013924 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080013925 packed.append(loxi.generic_util.pack_list(self.queues))
Rich Lanec2ee4b82013-04-24 17:12:38 -070013926 length = sum([len(x) for x in packed])
13927 packed[2] = struct.pack("!H", length)
13928 return ''.join(packed)
13929
13930 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080013931 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070013932 obj = queue_get_config_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070013933 _version = reader.read("!B")[0]
13934 assert(_version == 4)
13935 _type = reader.read("!B")[0]
13936 assert(_type == 23)
13937 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080013938 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080013939 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070013940 obj.xid = reader.read("!L")[0]
13941 obj.port = util.unpack_port_no(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -070013942 reader.skip(4)
Rich Lanee2567702015-01-26 15:04:35 -080013943 obj.queues = loxi.generic_util.unpack_list(reader, ofp.common.packet_queue.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070013944 return obj
13945
13946 def __eq__(self, other):
13947 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070013948 if self.xid != other.xid: return False
13949 if self.port != other.port: return False
13950 if self.queues != other.queues: return False
13951 return True
13952
Rich Lanec2ee4b82013-04-24 17:12:38 -070013953 def pretty_print(self, q):
13954 q.text("queue_get_config_reply {")
13955 with q.group():
13956 with q.indent(2):
13957 q.breakable()
13958 q.text("xid = ");
13959 if self.xid != None:
13960 q.text("%#x" % self.xid)
13961 else:
13962 q.text('None')
13963 q.text(","); q.breakable()
13964 q.text("port = ");
13965 q.text(util.pretty_port(self.port))
13966 q.text(","); q.breakable()
13967 q.text("queues = ");
13968 q.pp(self.queues)
13969 q.breakable()
13970 q.text('}')
13971
Rich Lane7dcdf022013-12-11 14:45:27 -080013972message.subtypes[23] = queue_get_config_reply
13973
13974class queue_get_config_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -070013975 version = 4
13976 type = 22
Rich Lanec2ee4b82013-04-24 17:12:38 -070013977
13978 def __init__(self, xid=None, port=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080013979 if xid != None:
13980 self.xid = xid
13981 else:
13982 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070013983 if port != None:
13984 self.port = port
13985 else:
13986 self.port = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080013987 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070013988
13989 def pack(self):
13990 packed = []
13991 packed.append(struct.pack("!B", self.version))
13992 packed.append(struct.pack("!B", self.type))
13993 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13994 packed.append(struct.pack("!L", self.xid))
Dan Talaycof6202252013-07-02 01:00:29 -070013995 packed.append(util.pack_port_no(self.port))
Rich Lanec2ee4b82013-04-24 17:12:38 -070013996 packed.append('\x00' * 4)
13997 length = sum([len(x) for x in packed])
13998 packed[2] = struct.pack("!H", length)
13999 return ''.join(packed)
14000
14001 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080014002 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070014003 obj = queue_get_config_request()
Dan Talaycof6202252013-07-02 01:00:29 -070014004 _version = reader.read("!B")[0]
14005 assert(_version == 4)
14006 _type = reader.read("!B")[0]
14007 assert(_type == 22)
14008 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080014009 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080014010 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070014011 obj.xid = reader.read("!L")[0]
14012 obj.port = util.unpack_port_no(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -070014013 reader.skip(4)
14014 return obj
14015
14016 def __eq__(self, other):
14017 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070014018 if self.xid != other.xid: return False
14019 if self.port != other.port: return False
14020 return True
14021
Rich Lanec2ee4b82013-04-24 17:12:38 -070014022 def pretty_print(self, q):
14023 q.text("queue_get_config_request {")
14024 with q.group():
14025 with q.indent(2):
14026 q.breakable()
14027 q.text("xid = ");
14028 if self.xid != None:
14029 q.text("%#x" % self.xid)
14030 else:
14031 q.text('None')
14032 q.text(","); q.breakable()
14033 q.text("port = ");
14034 q.text(util.pretty_port(self.port))
14035 q.breakable()
14036 q.text('}')
14037
Rich Lane7dcdf022013-12-11 14:45:27 -080014038message.subtypes[22] = queue_get_config_request
14039
14040class queue_op_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -070014041 version = 4
14042 type = 1
14043 err_type = 9
14044
14045 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080014046 if xid != None:
14047 self.xid = xid
14048 else:
14049 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -070014050 if code != None:
14051 self.code = code
14052 else:
14053 self.code = 0
14054 if data != None:
14055 self.data = data
14056 else:
14057 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080014058 return
Rich Lane6f4978c2013-10-20 21:33:52 -070014059
14060 def pack(self):
14061 packed = []
14062 packed.append(struct.pack("!B", self.version))
14063 packed.append(struct.pack("!B", self.type))
14064 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14065 packed.append(struct.pack("!L", self.xid))
14066 packed.append(struct.pack("!H", self.err_type))
14067 packed.append(struct.pack("!H", self.code))
14068 packed.append(self.data)
14069 length = sum([len(x) for x in packed])
14070 packed[2] = struct.pack("!H", length)
14071 return ''.join(packed)
14072
14073 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080014074 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -070014075 obj = queue_op_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -070014076 _version = reader.read("!B")[0]
14077 assert(_version == 4)
14078 _type = reader.read("!B")[0]
14079 assert(_type == 1)
14080 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080014081 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080014082 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -070014083 obj.xid = reader.read("!L")[0]
14084 _err_type = reader.read("!H")[0]
14085 assert(_err_type == 9)
14086 obj.code = reader.read("!H")[0]
14087 obj.data = str(reader.read_all())
14088 return obj
14089
14090 def __eq__(self, other):
14091 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -070014092 if self.xid != other.xid: return False
14093 if self.code != other.code: return False
14094 if self.data != other.data: return False
14095 return True
14096
Rich Lane6f4978c2013-10-20 21:33:52 -070014097 def pretty_print(self, q):
14098 q.text("queue_op_failed_error_msg {")
14099 with q.group():
14100 with q.indent(2):
14101 q.breakable()
14102 q.text("xid = ");
14103 if self.xid != None:
14104 q.text("%#x" % self.xid)
14105 else:
14106 q.text('None')
14107 q.text(","); q.breakable()
14108 q.text("code = ");
14109 q.text("%#x" % self.code)
14110 q.text(","); q.breakable()
14111 q.text("data = ");
14112 q.pp(self.data)
14113 q.breakable()
14114 q.text('}')
14115
Rich Lane7dcdf022013-12-11 14:45:27 -080014116error_msg.subtypes[9] = queue_op_failed_error_msg
14117
14118class queue_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070014119 version = 4
14120 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070014121 stats_type = 5
14122
14123 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080014124 if xid != None:
14125 self.xid = xid
14126 else:
14127 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070014128 if flags != None:
14129 self.flags = flags
14130 else:
14131 self.flags = 0
14132 if entries != None:
14133 self.entries = entries
14134 else:
14135 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -080014136 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070014137
14138 def pack(self):
14139 packed = []
14140 packed.append(struct.pack("!B", self.version))
14141 packed.append(struct.pack("!B", self.type))
14142 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14143 packed.append(struct.pack("!L", self.xid))
14144 packed.append(struct.pack("!H", self.stats_type))
14145 packed.append(struct.pack("!H", self.flags))
14146 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080014147 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -070014148 length = sum([len(x) for x in packed])
14149 packed[2] = struct.pack("!H", length)
14150 return ''.join(packed)
14151
14152 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080014153 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070014154 obj = queue_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070014155 _version = reader.read("!B")[0]
14156 assert(_version == 4)
14157 _type = reader.read("!B")[0]
14158 assert(_type == 19)
14159 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080014160 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080014161 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070014162 obj.xid = reader.read("!L")[0]
14163 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070014164 assert(_stats_type == 5)
Dan Talaycof6202252013-07-02 01:00:29 -070014165 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070014166 reader.skip(4)
Rich Lanee2567702015-01-26 15:04:35 -080014167 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.queue_stats_entry.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070014168 return obj
14169
14170 def __eq__(self, other):
14171 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070014172 if self.xid != other.xid: return False
14173 if self.flags != other.flags: return False
14174 if self.entries != other.entries: return False
14175 return True
14176
Rich Lanec2ee4b82013-04-24 17:12:38 -070014177 def pretty_print(self, q):
14178 q.text("queue_stats_reply {")
14179 with q.group():
14180 with q.indent(2):
14181 q.breakable()
14182 q.text("xid = ");
14183 if self.xid != None:
14184 q.text("%#x" % self.xid)
14185 else:
14186 q.text('None')
14187 q.text(","); q.breakable()
14188 q.text("flags = ");
14189 q.text("%#x" % self.flags)
14190 q.text(","); q.breakable()
14191 q.text("entries = ");
14192 q.pp(self.entries)
14193 q.breakable()
14194 q.text('}')
14195
Rich Lane7dcdf022013-12-11 14:45:27 -080014196stats_reply.subtypes[5] = queue_stats_reply
14197
14198class queue_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070014199 version = 4
14200 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070014201 stats_type = 5
14202
14203 def __init__(self, xid=None, flags=None, port_no=None, queue_id=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080014204 if xid != None:
14205 self.xid = xid
14206 else:
14207 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070014208 if flags != None:
14209 self.flags = flags
14210 else:
14211 self.flags = 0
14212 if port_no != None:
14213 self.port_no = port_no
14214 else:
14215 self.port_no = 0
14216 if queue_id != None:
14217 self.queue_id = queue_id
14218 else:
14219 self.queue_id = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080014220 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070014221
14222 def pack(self):
14223 packed = []
14224 packed.append(struct.pack("!B", self.version))
14225 packed.append(struct.pack("!B", self.type))
14226 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14227 packed.append(struct.pack("!L", self.xid))
14228 packed.append(struct.pack("!H", self.stats_type))
14229 packed.append(struct.pack("!H", self.flags))
14230 packed.append('\x00' * 4)
Dan Talaycof6202252013-07-02 01:00:29 -070014231 packed.append(util.pack_port_no(self.port_no))
Rich Lanec2ee4b82013-04-24 17:12:38 -070014232 packed.append(struct.pack("!L", self.queue_id))
14233 length = sum([len(x) for x in packed])
14234 packed[2] = struct.pack("!H", length)
14235 return ''.join(packed)
14236
14237 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080014238 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070014239 obj = queue_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070014240 _version = reader.read("!B")[0]
14241 assert(_version == 4)
14242 _type = reader.read("!B")[0]
14243 assert(_type == 18)
14244 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080014245 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080014246 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070014247 obj.xid = reader.read("!L")[0]
14248 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070014249 assert(_stats_type == 5)
Dan Talaycof6202252013-07-02 01:00:29 -070014250 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070014251 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -070014252 obj.port_no = util.unpack_port_no(reader)
14253 obj.queue_id = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070014254 return obj
14255
14256 def __eq__(self, other):
14257 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070014258 if self.xid != other.xid: return False
14259 if self.flags != other.flags: return False
14260 if self.port_no != other.port_no: return False
14261 if self.queue_id != other.queue_id: return False
14262 return True
14263
Rich Lanec2ee4b82013-04-24 17:12:38 -070014264 def pretty_print(self, q):
14265 q.text("queue_stats_request {")
14266 with q.group():
14267 with q.indent(2):
14268 q.breakable()
14269 q.text("xid = ");
14270 if self.xid != None:
14271 q.text("%#x" % self.xid)
14272 else:
14273 q.text('None')
14274 q.text(","); q.breakable()
14275 q.text("flags = ");
14276 q.text("%#x" % self.flags)
14277 q.text(","); q.breakable()
14278 q.text("port_no = ");
14279 q.text(util.pretty_port(self.port_no))
14280 q.text(","); q.breakable()
14281 q.text("queue_id = ");
14282 q.text("%#x" % self.queue_id)
14283 q.breakable()
14284 q.text('}')
14285
Rich Lane7dcdf022013-12-11 14:45:27 -080014286stats_request.subtypes[5] = queue_stats_request
14287
14288class role_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -070014289 version = 4
14290 type = 25
Rich Lanec2ee4b82013-04-24 17:12:38 -070014291
Rich Laned9e3f7b2013-11-04 11:40:43 -080014292 def __init__(self, xid=None, role=None, generation_id=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080014293 if xid != None:
14294 self.xid = xid
14295 else:
14296 self.xid = None
Rich Laned9e3f7b2013-11-04 11:40:43 -080014297 if role != None:
14298 self.role = role
Rich Lanec2ee4b82013-04-24 17:12:38 -070014299 else:
Rich Laned9e3f7b2013-11-04 11:40:43 -080014300 self.role = 0
14301 if generation_id != None:
14302 self.generation_id = generation_id
14303 else:
14304 self.generation_id = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080014305 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070014306
14307 def pack(self):
14308 packed = []
14309 packed.append(struct.pack("!B", self.version))
14310 packed.append(struct.pack("!B", self.type))
14311 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14312 packed.append(struct.pack("!L", self.xid))
Rich Laned9e3f7b2013-11-04 11:40:43 -080014313 packed.append(struct.pack("!L", self.role))
14314 packed.append('\x00' * 4)
14315 packed.append(struct.pack("!Q", self.generation_id))
Rich Lanec2ee4b82013-04-24 17:12:38 -070014316 length = sum([len(x) for x in packed])
14317 packed[2] = struct.pack("!H", length)
14318 return ''.join(packed)
14319
14320 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080014321 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070014322 obj = role_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070014323 _version = reader.read("!B")[0]
14324 assert(_version == 4)
14325 _type = reader.read("!B")[0]
14326 assert(_type == 25)
14327 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080014328 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080014329 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070014330 obj.xid = reader.read("!L")[0]
Rich Laned9e3f7b2013-11-04 11:40:43 -080014331 obj.role = reader.read("!L")[0]
14332 reader.skip(4)
14333 obj.generation_id = reader.read("!Q")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070014334 return obj
14335
14336 def __eq__(self, other):
14337 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070014338 if self.xid != other.xid: return False
Rich Laned9e3f7b2013-11-04 11:40:43 -080014339 if self.role != other.role: return False
14340 if self.generation_id != other.generation_id: return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070014341 return True
14342
Rich Lanec2ee4b82013-04-24 17:12:38 -070014343 def pretty_print(self, q):
14344 q.text("role_reply {")
14345 with q.group():
14346 with q.indent(2):
14347 q.breakable()
14348 q.text("xid = ");
14349 if self.xid != None:
14350 q.text("%#x" % self.xid)
14351 else:
14352 q.text('None')
14353 q.text(","); q.breakable()
Rich Laned9e3f7b2013-11-04 11:40:43 -080014354 q.text("role = ");
14355 q.text("%#x" % self.role)
14356 q.text(","); q.breakable()
14357 q.text("generation_id = ");
14358 q.text("%#x" % self.generation_id)
Rich Lanec2ee4b82013-04-24 17:12:38 -070014359 q.breakable()
14360 q.text('}')
14361
Rich Lane7dcdf022013-12-11 14:45:27 -080014362message.subtypes[25] = role_reply
14363
14364class role_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -070014365 version = 4
14366 type = 24
Rich Lanec2ee4b82013-04-24 17:12:38 -070014367
14368 def __init__(self, xid=None, role=None, generation_id=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080014369 if xid != None:
14370 self.xid = xid
14371 else:
14372 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070014373 if role != None:
14374 self.role = role
14375 else:
14376 self.role = 0
14377 if generation_id != None:
14378 self.generation_id = generation_id
14379 else:
14380 self.generation_id = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080014381 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070014382
14383 def pack(self):
14384 packed = []
14385 packed.append(struct.pack("!B", self.version))
14386 packed.append(struct.pack("!B", self.type))
14387 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14388 packed.append(struct.pack("!L", self.xid))
14389 packed.append(struct.pack("!L", self.role))
14390 packed.append('\x00' * 4)
14391 packed.append(struct.pack("!Q", self.generation_id))
14392 length = sum([len(x) for x in packed])
14393 packed[2] = struct.pack("!H", length)
14394 return ''.join(packed)
14395
14396 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080014397 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070014398 obj = role_request()
Dan Talaycof6202252013-07-02 01:00:29 -070014399 _version = reader.read("!B")[0]
14400 assert(_version == 4)
14401 _type = reader.read("!B")[0]
14402 assert(_type == 24)
14403 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080014404 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080014405 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070014406 obj.xid = reader.read("!L")[0]
14407 obj.role = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070014408 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -070014409 obj.generation_id = reader.read("!Q")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070014410 return obj
14411
14412 def __eq__(self, other):
14413 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070014414 if self.xid != other.xid: return False
14415 if self.role != other.role: return False
14416 if self.generation_id != other.generation_id: return False
14417 return True
14418
Rich Lanec2ee4b82013-04-24 17:12:38 -070014419 def pretty_print(self, q):
14420 q.text("role_request {")
14421 with q.group():
14422 with q.indent(2):
14423 q.breakable()
14424 q.text("xid = ");
14425 if self.xid != None:
14426 q.text("%#x" % self.xid)
14427 else:
14428 q.text('None')
14429 q.text(","); q.breakable()
14430 q.text("role = ");
14431 q.text("%#x" % self.role)
14432 q.text(","); q.breakable()
14433 q.text("generation_id = ");
14434 q.text("%#x" % self.generation_id)
14435 q.breakable()
14436 q.text('}')
14437
Rich Lane7dcdf022013-12-11 14:45:27 -080014438message.subtypes[24] = role_request
14439
14440class role_request_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -070014441 version = 4
14442 type = 1
14443 err_type = 11
14444
14445 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080014446 if xid != None:
14447 self.xid = xid
14448 else:
14449 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -070014450 if code != None:
14451 self.code = code
14452 else:
14453 self.code = 0
14454 if data != None:
14455 self.data = data
14456 else:
14457 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080014458 return
Rich Lane6f4978c2013-10-20 21:33:52 -070014459
14460 def pack(self):
14461 packed = []
14462 packed.append(struct.pack("!B", self.version))
14463 packed.append(struct.pack("!B", self.type))
14464 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14465 packed.append(struct.pack("!L", self.xid))
14466 packed.append(struct.pack("!H", self.err_type))
14467 packed.append(struct.pack("!H", self.code))
14468 packed.append(self.data)
14469 length = sum([len(x) for x in packed])
14470 packed[2] = struct.pack("!H", length)
14471 return ''.join(packed)
14472
14473 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080014474 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -070014475 obj = role_request_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -070014476 _version = reader.read("!B")[0]
14477 assert(_version == 4)
14478 _type = reader.read("!B")[0]
14479 assert(_type == 1)
14480 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080014481 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080014482 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -070014483 obj.xid = reader.read("!L")[0]
14484 _err_type = reader.read("!H")[0]
14485 assert(_err_type == 11)
14486 obj.code = reader.read("!H")[0]
14487 obj.data = str(reader.read_all())
14488 return obj
14489
14490 def __eq__(self, other):
14491 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -070014492 if self.xid != other.xid: return False
14493 if self.code != other.code: return False
14494 if self.data != other.data: return False
14495 return True
14496
Rich Lane6f4978c2013-10-20 21:33:52 -070014497 def pretty_print(self, q):
14498 q.text("role_request_failed_error_msg {")
14499 with q.group():
14500 with q.indent(2):
14501 q.breakable()
14502 q.text("xid = ");
14503 if self.xid != None:
14504 q.text("%#x" % self.xid)
14505 else:
14506 q.text('None')
14507 q.text(","); q.breakable()
14508 q.text("code = ");
14509 q.text("%#x" % self.code)
14510 q.text(","); q.breakable()
14511 q.text("data = ");
14512 q.pp(self.data)
14513 q.breakable()
14514 q.text('}')
14515
Rich Lane7dcdf022013-12-11 14:45:27 -080014516error_msg.subtypes[11] = role_request_failed_error_msg
14517
14518class set_config(message):
Dan Talaycof6202252013-07-02 01:00:29 -070014519 version = 4
14520 type = 9
Rich Lanec2ee4b82013-04-24 17:12:38 -070014521
14522 def __init__(self, xid=None, flags=None, miss_send_len=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080014523 if xid != None:
14524 self.xid = xid
14525 else:
14526 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070014527 if flags != None:
14528 self.flags = flags
14529 else:
14530 self.flags = 0
14531 if miss_send_len != None:
14532 self.miss_send_len = miss_send_len
14533 else:
14534 self.miss_send_len = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080014535 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070014536
14537 def pack(self):
14538 packed = []
14539 packed.append(struct.pack("!B", self.version))
14540 packed.append(struct.pack("!B", self.type))
14541 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14542 packed.append(struct.pack("!L", self.xid))
14543 packed.append(struct.pack("!H", self.flags))
14544 packed.append(struct.pack("!H", self.miss_send_len))
14545 length = sum([len(x) for x in packed])
14546 packed[2] = struct.pack("!H", length)
14547 return ''.join(packed)
14548
14549 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080014550 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070014551 obj = set_config()
Dan Talaycof6202252013-07-02 01:00:29 -070014552 _version = reader.read("!B")[0]
14553 assert(_version == 4)
14554 _type = reader.read("!B")[0]
14555 assert(_type == 9)
14556 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080014557 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080014558 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070014559 obj.xid = reader.read("!L")[0]
14560 obj.flags = reader.read("!H")[0]
14561 obj.miss_send_len = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070014562 return obj
14563
14564 def __eq__(self, other):
14565 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070014566 if self.xid != other.xid: return False
14567 if self.flags != other.flags: return False
14568 if self.miss_send_len != other.miss_send_len: return False
14569 return True
14570
Rich Lanec2ee4b82013-04-24 17:12:38 -070014571 def pretty_print(self, q):
14572 q.text("set_config {")
14573 with q.group():
14574 with q.indent(2):
14575 q.breakable()
14576 q.text("xid = ");
14577 if self.xid != None:
14578 q.text("%#x" % self.xid)
14579 else:
14580 q.text('None')
14581 q.text(","); q.breakable()
14582 q.text("flags = ");
14583 q.text("%#x" % self.flags)
14584 q.text(","); q.breakable()
14585 q.text("miss_send_len = ");
14586 q.text("%#x" % self.miss_send_len)
14587 q.breakable()
14588 q.text('}')
14589
Rich Lane7dcdf022013-12-11 14:45:27 -080014590message.subtypes[9] = set_config
14591
14592class switch_config_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -070014593 version = 4
14594 type = 1
14595 err_type = 10
14596
14597 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080014598 if xid != None:
14599 self.xid = xid
14600 else:
14601 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -070014602 if code != None:
14603 self.code = code
14604 else:
14605 self.code = 0
14606 if data != None:
14607 self.data = data
14608 else:
14609 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080014610 return
Rich Lane6f4978c2013-10-20 21:33:52 -070014611
14612 def pack(self):
14613 packed = []
14614 packed.append(struct.pack("!B", self.version))
14615 packed.append(struct.pack("!B", self.type))
14616 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14617 packed.append(struct.pack("!L", self.xid))
14618 packed.append(struct.pack("!H", self.err_type))
14619 packed.append(struct.pack("!H", self.code))
14620 packed.append(self.data)
14621 length = sum([len(x) for x in packed])
14622 packed[2] = struct.pack("!H", length)
14623 return ''.join(packed)
14624
14625 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080014626 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -070014627 obj = switch_config_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -070014628 _version = reader.read("!B")[0]
14629 assert(_version == 4)
14630 _type = reader.read("!B")[0]
14631 assert(_type == 1)
14632 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080014633 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080014634 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -070014635 obj.xid = reader.read("!L")[0]
14636 _err_type = reader.read("!H")[0]
14637 assert(_err_type == 10)
14638 obj.code = reader.read("!H")[0]
14639 obj.data = str(reader.read_all())
14640 return obj
14641
14642 def __eq__(self, other):
14643 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -070014644 if self.xid != other.xid: return False
14645 if self.code != other.code: return False
14646 if self.data != other.data: return False
14647 return True
14648
Rich Lane6f4978c2013-10-20 21:33:52 -070014649 def pretty_print(self, q):
14650 q.text("switch_config_failed_error_msg {")
14651 with q.group():
14652 with q.indent(2):
14653 q.breakable()
14654 q.text("xid = ");
14655 if self.xid != None:
14656 q.text("%#x" % self.xid)
14657 else:
14658 q.text('None')
14659 q.text(","); q.breakable()
14660 q.text("code = ");
14661 q.text("%#x" % self.code)
14662 q.text(","); q.breakable()
14663 q.text("data = ");
14664 q.pp(self.data)
14665 q.breakable()
14666 q.text('}')
14667
Rich Lane7dcdf022013-12-11 14:45:27 -080014668error_msg.subtypes[10] = switch_config_failed_error_msg
14669
14670class table_features_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -070014671 version = 4
14672 type = 1
14673 err_type = 13
14674
14675 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080014676 if xid != None:
14677 self.xid = xid
14678 else:
14679 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -070014680 if code != None:
14681 self.code = code
14682 else:
14683 self.code = 0
14684 if data != None:
14685 self.data = data
14686 else:
14687 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080014688 return
Rich Lane6f4978c2013-10-20 21:33:52 -070014689
14690 def pack(self):
14691 packed = []
14692 packed.append(struct.pack("!B", self.version))
14693 packed.append(struct.pack("!B", self.type))
14694 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14695 packed.append(struct.pack("!L", self.xid))
14696 packed.append(struct.pack("!H", self.err_type))
14697 packed.append(struct.pack("!H", self.code))
14698 packed.append(self.data)
14699 length = sum([len(x) for x in packed])
14700 packed[2] = struct.pack("!H", length)
14701 return ''.join(packed)
14702
14703 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080014704 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -070014705 obj = table_features_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -070014706 _version = reader.read("!B")[0]
14707 assert(_version == 4)
14708 _type = reader.read("!B")[0]
14709 assert(_type == 1)
14710 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080014711 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080014712 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -070014713 obj.xid = reader.read("!L")[0]
14714 _err_type = reader.read("!H")[0]
14715 assert(_err_type == 13)
14716 obj.code = reader.read("!H")[0]
14717 obj.data = str(reader.read_all())
14718 return obj
14719
14720 def __eq__(self, other):
14721 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -070014722 if self.xid != other.xid: return False
14723 if self.code != other.code: return False
14724 if self.data != other.data: return False
14725 return True
14726
Rich Lane6f4978c2013-10-20 21:33:52 -070014727 def pretty_print(self, q):
14728 q.text("table_features_failed_error_msg {")
14729 with q.group():
14730 with q.indent(2):
14731 q.breakable()
14732 q.text("xid = ");
14733 if self.xid != None:
14734 q.text("%#x" % self.xid)
14735 else:
14736 q.text('None')
14737 q.text(","); q.breakable()
14738 q.text("code = ");
14739 q.text("%#x" % self.code)
14740 q.text(","); q.breakable()
14741 q.text("data = ");
14742 q.pp(self.data)
14743 q.breakable()
14744 q.text('}')
14745
Rich Lane7dcdf022013-12-11 14:45:27 -080014746error_msg.subtypes[13] = table_features_failed_error_msg
14747
14748class table_features_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070014749 version = 4
14750 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070014751 stats_type = 12
14752
14753 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080014754 if xid != None:
14755 self.xid = xid
14756 else:
14757 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070014758 if flags != None:
14759 self.flags = flags
14760 else:
14761 self.flags = 0
14762 if entries != None:
14763 self.entries = entries
14764 else:
14765 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -080014766 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070014767
14768 def pack(self):
14769 packed = []
14770 packed.append(struct.pack("!B", self.version))
14771 packed.append(struct.pack("!B", self.type))
14772 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14773 packed.append(struct.pack("!L", self.xid))
14774 packed.append(struct.pack("!H", self.stats_type))
14775 packed.append(struct.pack("!H", self.flags))
14776 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080014777 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -070014778 length = sum([len(x) for x in packed])
14779 packed[2] = struct.pack("!H", length)
14780 return ''.join(packed)
14781
14782 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080014783 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070014784 obj = table_features_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070014785 _version = reader.read("!B")[0]
14786 assert(_version == 4)
14787 _type = reader.read("!B")[0]
14788 assert(_type == 19)
14789 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080014790 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080014791 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070014792 obj.xid = reader.read("!L")[0]
14793 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070014794 assert(_stats_type == 12)
Dan Talaycof6202252013-07-02 01:00:29 -070014795 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070014796 reader.skip(4)
Rich Lanee2567702015-01-26 15:04:35 -080014797 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.table_features.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070014798 return obj
14799
14800 def __eq__(self, other):
14801 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070014802 if self.xid != other.xid: return False
14803 if self.flags != other.flags: return False
14804 if self.entries != other.entries: return False
14805 return True
14806
Rich Lanec2ee4b82013-04-24 17:12:38 -070014807 def pretty_print(self, q):
14808 q.text("table_features_stats_reply {")
14809 with q.group():
14810 with q.indent(2):
14811 q.breakable()
14812 q.text("xid = ");
14813 if self.xid != None:
14814 q.text("%#x" % self.xid)
14815 else:
14816 q.text('None')
14817 q.text(","); q.breakable()
14818 q.text("flags = ");
14819 q.text("%#x" % self.flags)
14820 q.text(","); q.breakable()
14821 q.text("entries = ");
14822 q.pp(self.entries)
14823 q.breakable()
14824 q.text('}')
14825
Rich Lane7dcdf022013-12-11 14:45:27 -080014826stats_reply.subtypes[12] = table_features_stats_reply
14827
14828class table_features_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070014829 version = 4
14830 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070014831 stats_type = 12
14832
14833 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080014834 if xid != None:
14835 self.xid = xid
14836 else:
14837 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070014838 if flags != None:
14839 self.flags = flags
14840 else:
14841 self.flags = 0
14842 if entries != None:
14843 self.entries = entries
14844 else:
14845 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -080014846 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070014847
14848 def pack(self):
14849 packed = []
14850 packed.append(struct.pack("!B", self.version))
14851 packed.append(struct.pack("!B", self.type))
14852 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14853 packed.append(struct.pack("!L", self.xid))
14854 packed.append(struct.pack("!H", self.stats_type))
14855 packed.append(struct.pack("!H", self.flags))
14856 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080014857 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -070014858 length = sum([len(x) for x in packed])
14859 packed[2] = struct.pack("!H", length)
14860 return ''.join(packed)
14861
14862 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080014863 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070014864 obj = table_features_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070014865 _version = reader.read("!B")[0]
14866 assert(_version == 4)
14867 _type = reader.read("!B")[0]
14868 assert(_type == 18)
14869 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080014870 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080014871 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070014872 obj.xid = reader.read("!L")[0]
14873 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070014874 assert(_stats_type == 12)
Dan Talaycof6202252013-07-02 01:00:29 -070014875 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070014876 reader.skip(4)
Rich Lanee2567702015-01-26 15:04:35 -080014877 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.table_features.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070014878 return obj
14879
14880 def __eq__(self, other):
14881 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070014882 if self.xid != other.xid: return False
14883 if self.flags != other.flags: return False
14884 if self.entries != other.entries: return False
14885 return True
14886
Rich Lanec2ee4b82013-04-24 17:12:38 -070014887 def pretty_print(self, q):
14888 q.text("table_features_stats_request {")
14889 with q.group():
14890 with q.indent(2):
14891 q.breakable()
14892 q.text("xid = ");
14893 if self.xid != None:
14894 q.text("%#x" % self.xid)
14895 else:
14896 q.text('None')
14897 q.text(","); q.breakable()
14898 q.text("flags = ");
14899 q.text("%#x" % self.flags)
14900 q.text(","); q.breakable()
14901 q.text("entries = ");
14902 q.pp(self.entries)
14903 q.breakable()
14904 q.text('}')
14905
Rich Lane7dcdf022013-12-11 14:45:27 -080014906stats_request.subtypes[12] = table_features_stats_request
14907
14908class table_mod(message):
Dan Talaycof6202252013-07-02 01:00:29 -070014909 version = 4
14910 type = 17
Rich Lanec2ee4b82013-04-24 17:12:38 -070014911
14912 def __init__(self, xid=None, table_id=None, config=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080014913 if xid != None:
14914 self.xid = xid
14915 else:
14916 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070014917 if table_id != None:
14918 self.table_id = table_id
14919 else:
14920 self.table_id = 0
14921 if config != None:
14922 self.config = config
14923 else:
14924 self.config = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080014925 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070014926
14927 def pack(self):
14928 packed = []
14929 packed.append(struct.pack("!B", self.version))
14930 packed.append(struct.pack("!B", self.type))
14931 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14932 packed.append(struct.pack("!L", self.xid))
14933 packed.append(struct.pack("!B", self.table_id))
14934 packed.append('\x00' * 3)
14935 packed.append(struct.pack("!L", self.config))
14936 length = sum([len(x) for x in packed])
14937 packed[2] = struct.pack("!H", length)
14938 return ''.join(packed)
14939
14940 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080014941 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070014942 obj = table_mod()
Dan Talaycof6202252013-07-02 01:00:29 -070014943 _version = reader.read("!B")[0]
14944 assert(_version == 4)
14945 _type = reader.read("!B")[0]
14946 assert(_type == 17)
14947 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080014948 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080014949 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070014950 obj.xid = reader.read("!L")[0]
14951 obj.table_id = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070014952 reader.skip(3)
Dan Talaycof6202252013-07-02 01:00:29 -070014953 obj.config = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070014954 return obj
14955
14956 def __eq__(self, other):
14957 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070014958 if self.xid != other.xid: return False
14959 if self.table_id != other.table_id: return False
14960 if self.config != other.config: return False
14961 return True
14962
Rich Lanec2ee4b82013-04-24 17:12:38 -070014963 def pretty_print(self, q):
14964 q.text("table_mod {")
14965 with q.group():
14966 with q.indent(2):
14967 q.breakable()
14968 q.text("xid = ");
14969 if self.xid != None:
14970 q.text("%#x" % self.xid)
14971 else:
14972 q.text('None')
14973 q.text(","); q.breakable()
14974 q.text("table_id = ");
14975 q.text("%#x" % self.table_id)
14976 q.text(","); q.breakable()
14977 q.text("config = ");
14978 q.text("%#x" % self.config)
14979 q.breakable()
14980 q.text('}')
14981
Rich Lane7dcdf022013-12-11 14:45:27 -080014982message.subtypes[17] = table_mod
14983
14984class table_mod_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -070014985 version = 4
14986 type = 1
14987 err_type = 8
14988
14989 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080014990 if xid != None:
14991 self.xid = xid
14992 else:
14993 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -070014994 if code != None:
14995 self.code = code
14996 else:
14997 self.code = 0
14998 if data != None:
14999 self.data = data
15000 else:
15001 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -080015002 return
Rich Lane6f4978c2013-10-20 21:33:52 -070015003
15004 def pack(self):
15005 packed = []
15006 packed.append(struct.pack("!B", self.version))
15007 packed.append(struct.pack("!B", self.type))
15008 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
15009 packed.append(struct.pack("!L", self.xid))
15010 packed.append(struct.pack("!H", self.err_type))
15011 packed.append(struct.pack("!H", self.code))
15012 packed.append(self.data)
15013 length = sum([len(x) for x in packed])
15014 packed[2] = struct.pack("!H", length)
15015 return ''.join(packed)
15016
15017 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080015018 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -070015019 obj = table_mod_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -070015020 _version = reader.read("!B")[0]
15021 assert(_version == 4)
15022 _type = reader.read("!B")[0]
15023 assert(_type == 1)
15024 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080015025 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080015026 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -070015027 obj.xid = reader.read("!L")[0]
15028 _err_type = reader.read("!H")[0]
15029 assert(_err_type == 8)
15030 obj.code = reader.read("!H")[0]
15031 obj.data = str(reader.read_all())
15032 return obj
15033
15034 def __eq__(self, other):
15035 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -070015036 if self.xid != other.xid: return False
15037 if self.code != other.code: return False
15038 if self.data != other.data: return False
15039 return True
15040
Rich Lane6f4978c2013-10-20 21:33:52 -070015041 def pretty_print(self, q):
15042 q.text("table_mod_failed_error_msg {")
15043 with q.group():
15044 with q.indent(2):
15045 q.breakable()
15046 q.text("xid = ");
15047 if self.xid != None:
15048 q.text("%#x" % self.xid)
15049 else:
15050 q.text('None')
15051 q.text(","); q.breakable()
15052 q.text("code = ");
15053 q.text("%#x" % self.code)
15054 q.text(","); q.breakable()
15055 q.text("data = ");
15056 q.pp(self.data)
15057 q.breakable()
15058 q.text('}')
15059
Rich Lane7dcdf022013-12-11 14:45:27 -080015060error_msg.subtypes[8] = table_mod_failed_error_msg
15061
15062class table_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -070015063 version = 4
15064 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -070015065 stats_type = 3
15066
15067 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080015068 if xid != None:
15069 self.xid = xid
15070 else:
15071 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070015072 if flags != None:
15073 self.flags = flags
15074 else:
15075 self.flags = 0
15076 if entries != None:
15077 self.entries = entries
15078 else:
15079 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -080015080 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070015081
15082 def pack(self):
15083 packed = []
15084 packed.append(struct.pack("!B", self.version))
15085 packed.append(struct.pack("!B", self.type))
15086 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
15087 packed.append(struct.pack("!L", self.xid))
15088 packed.append(struct.pack("!H", self.stats_type))
15089 packed.append(struct.pack("!H", self.flags))
15090 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080015091 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -070015092 length = sum([len(x) for x in packed])
15093 packed[2] = struct.pack("!H", length)
15094 return ''.join(packed)
15095
15096 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080015097 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070015098 obj = table_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -070015099 _version = reader.read("!B")[0]
15100 assert(_version == 4)
15101 _type = reader.read("!B")[0]
15102 assert(_type == 19)
15103 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080015104 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080015105 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070015106 obj.xid = reader.read("!L")[0]
15107 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070015108 assert(_stats_type == 3)
Dan Talaycof6202252013-07-02 01:00:29 -070015109 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070015110 reader.skip(4)
Rich Lanee2567702015-01-26 15:04:35 -080015111 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.table_stats_entry.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -070015112 return obj
15113
15114 def __eq__(self, other):
15115 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070015116 if self.xid != other.xid: return False
15117 if self.flags != other.flags: return False
15118 if self.entries != other.entries: return False
15119 return True
15120
Rich Lanec2ee4b82013-04-24 17:12:38 -070015121 def pretty_print(self, q):
15122 q.text("table_stats_reply {")
15123 with q.group():
15124 with q.indent(2):
15125 q.breakable()
15126 q.text("xid = ");
15127 if self.xid != None:
15128 q.text("%#x" % self.xid)
15129 else:
15130 q.text('None')
15131 q.text(","); q.breakable()
15132 q.text("flags = ");
15133 q.text("%#x" % self.flags)
15134 q.text(","); q.breakable()
15135 q.text("entries = ");
15136 q.pp(self.entries)
15137 q.breakable()
15138 q.text('}')
15139
Rich Lane7dcdf022013-12-11 14:45:27 -080015140stats_reply.subtypes[3] = table_stats_reply
15141
15142class table_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -070015143 version = 4
15144 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -070015145 stats_type = 3
15146
15147 def __init__(self, xid=None, flags=None):
Rich Lane7dcdf022013-12-11 14:45:27 -080015148 if xid != None:
15149 self.xid = xid
15150 else:
15151 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -070015152 if flags != None:
15153 self.flags = flags
15154 else:
15155 self.flags = 0
Rich Lane7dcdf022013-12-11 14:45:27 -080015156 return
Rich Lanec2ee4b82013-04-24 17:12:38 -070015157
15158 def pack(self):
15159 packed = []
15160 packed.append(struct.pack("!B", self.version))
15161 packed.append(struct.pack("!B", self.type))
15162 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
15163 packed.append(struct.pack("!L", self.xid))
15164 packed.append(struct.pack("!H", self.stats_type))
15165 packed.append(struct.pack("!H", self.flags))
15166 packed.append('\x00' * 4)
15167 length = sum([len(x) for x in packed])
15168 packed[2] = struct.pack("!H", length)
15169 return ''.join(packed)
15170
15171 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080015172 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070015173 obj = table_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -070015174 _version = reader.read("!B")[0]
15175 assert(_version == 4)
15176 _type = reader.read("!B")[0]
15177 assert(_type == 18)
15178 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080015179 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080015180 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -070015181 obj.xid = reader.read("!L")[0]
15182 _stats_type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070015183 assert(_stats_type == 3)
Dan Talaycof6202252013-07-02 01:00:29 -070015184 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070015185 reader.skip(4)
15186 return obj
15187
15188 def __eq__(self, other):
15189 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -070015190 if self.xid != other.xid: return False
15191 if self.flags != other.flags: return False
15192 return True
15193
Rich Lanec2ee4b82013-04-24 17:12:38 -070015194 def pretty_print(self, q):
15195 q.text("table_stats_request {")
15196 with q.group():
15197 with q.indent(2):
15198 q.breakable()
15199 q.text("xid = ");
15200 if self.xid != None:
15201 q.text("%#x" % self.xid)
15202 else:
15203 q.text('None')
15204 q.text(","); q.breakable()
15205 q.text("flags = ");
15206 q.text("%#x" % self.flags)
15207 q.breakable()
15208 q.text('}')
15209
Rich Lane7dcdf022013-12-11 14:45:27 -080015210stats_request.subtypes[3] = table_stats_request
15211
Rich Lanec2ee4b82013-04-24 17:12:38 -070015212
15213def parse_header(buf):
15214 if len(buf) < 8:
15215 raise loxi.ProtocolError("too short to be an OpenFlow message")
15216 return struct.unpack_from("!BBHL", buf)
15217
15218def parse_message(buf):
15219 msg_ver, msg_type, msg_len, msg_xid = parse_header(buf)
Rich Lanee2567702015-01-26 15:04:35 -080015220 if msg_ver != ofp.OFP_VERSION and msg_type != ofp.OFPT_HELLO:
15221 raise loxi.ProtocolError("wrong OpenFlow version (expected %d, got %d)" % (ofp.OFP_VERSION, msg_ver))
Rich Lanec2ee4b82013-04-24 17:12:38 -070015222 if len(buf) != msg_len:
15223 raise loxi.ProtocolError("incorrect message size")
Rich Lane7dcdf022013-12-11 14:45:27 -080015224 return message.unpack(loxi.generic_util.OFReader(buf))