blob: 5ffc5f317351ae8d79f4f47b7b8f0cdc4df4facf [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 Laneb658ddd2013-03-12 10:15:10 -070021
Rich Lane7dcdf022013-12-11 14:45:27 -080022# Automatically generated by LOXI from template module.py
Rich Laneb658ddd2013-03-12 10:15:10 -070023# Do not modify
24
25import struct
26import loxi
Rich Laneb658ddd2013-03-12 10:15:10 -070027import util
Rich Lanec2ee4b82013-04-24 17:12:38 -070028import loxi.generic_util
Rich Laneb658ddd2013-03-12 10:15:10 -070029
Rich Lanee2567702015-01-26 15:04:35 -080030import sys
31ofp = sys.modules['loxi.of10']
32
Rich Lane7dcdf022013-12-11 14:45:27 -080033class message(loxi.OFObject):
34 subtypes = {}
Rich Laneb658ddd2013-03-12 10:15:10 -070035
Rich Lane95f7fc92014-01-27 17:08:16 -080036 version = 1
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 == 1)
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 = 1
100 type = 17
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 length = sum([len(x) for x in packed])
126 packed[2] = struct.pack("!H", length)
127 return ''.join(packed)
128
Rich Lane7dcdf022013-12-11 14:45:27 -0800129 @staticmethod
130 def unpack(reader):
131 subtype, = reader.peek('!H', 8)
Rich Lane95f7fc92014-01-27 17:08:16 -0800132 subclass = stats_reply.subtypes.get(subtype)
133 if subclass:
134 return subclass.unpack(reader)
135
136 obj = stats_reply()
137 _version = reader.read("!B")[0]
138 assert(_version == 1)
139 _type = reader.read("!B")[0]
140 assert(_type == 17)
141 _length = reader.read("!H")[0]
142 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800143 reader = orig_reader.slice(_length, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -0800144 obj.xid = reader.read("!L")[0]
145 obj.stats_type = reader.read("!H")[0]
146 obj.flags = reader.read("!H")[0]
147 return obj
148
149 def __eq__(self, other):
150 if type(self) != type(other): return False
151 if self.xid != other.xid: return False
152 if self.stats_type != other.stats_type: return False
153 if self.flags != other.flags: return False
154 return True
155
156 def pretty_print(self, q):
157 q.text("stats_reply {")
158 with q.group():
159 with q.indent(2):
160 q.breakable()
161 q.text("xid = ");
162 if self.xid != None:
163 q.text("%#x" % self.xid)
164 else:
165 q.text('None')
166 q.text(","); q.breakable()
167 q.text("flags = ");
168 q.text("%#x" % self.flags)
169 q.breakable()
170 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -0800171
172message.subtypes[17] = stats_reply
173
174class aggregate_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -0700175 version = 1
176 type = 17
177 stats_type = 2
Rich Laneb658ddd2013-03-12 10:15:10 -0700178
Rich Lanec2ee4b82013-04-24 17:12:38 -0700179 def __init__(self, xid=None, flags=None, packet_count=None, byte_count=None, flow_count=None):
Rich Lane7dcdf022013-12-11 14:45:27 -0800180 if xid != None:
181 self.xid = xid
182 else:
183 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -0700184 if flags != None:
185 self.flags = flags
186 else:
187 self.flags = 0
188 if packet_count != None:
189 self.packet_count = packet_count
190 else:
191 self.packet_count = 0
192 if byte_count != None:
193 self.byte_count = byte_count
194 else:
195 self.byte_count = 0
196 if flow_count != None:
197 self.flow_count = flow_count
198 else:
199 self.flow_count = 0
Rich Lane7dcdf022013-12-11 14:45:27 -0800200 return
Rich Laneb658ddd2013-03-12 10:15:10 -0700201
202 def pack(self):
203 packed = []
204 packed.append(struct.pack("!B", self.version))
205 packed.append(struct.pack("!B", self.type))
206 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
207 packed.append(struct.pack("!L", self.xid))
208 packed.append(struct.pack("!H", self.stats_type))
209 packed.append(struct.pack("!H", self.flags))
210 packed.append(struct.pack("!Q", self.packet_count))
211 packed.append(struct.pack("!Q", self.byte_count))
212 packed.append(struct.pack("!L", self.flow_count))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700213 packed.append('\x00' * 4)
Rich Laneb658ddd2013-03-12 10:15:10 -0700214 length = sum([len(x) for x in packed])
215 packed[2] = struct.pack("!H", length)
216 return ''.join(packed)
217
218 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800219 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -0700220 obj = aggregate_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -0700221 _version = reader.read("!B")[0]
222 assert(_version == 1)
223 _type = reader.read("!B")[0]
224 assert(_type == 17)
225 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800226 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800227 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -0700228 obj.xid = reader.read("!L")[0]
229 _stats_type = reader.read("!H")[0]
230 assert(_stats_type == 2)
231 obj.flags = reader.read("!H")[0]
232 obj.packet_count = reader.read("!Q")[0]
233 obj.byte_count = reader.read("!Q")[0]
234 obj.flow_count = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700235 reader.skip(4)
Rich Laneb658ddd2013-03-12 10:15:10 -0700236 return obj
237
238 def __eq__(self, other):
239 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -0700240 if self.xid != other.xid: return False
241 if self.flags != other.flags: return False
242 if self.packet_count != other.packet_count: return False
243 if self.byte_count != other.byte_count: return False
244 if self.flow_count != other.flow_count: return False
Rich Laneb658ddd2013-03-12 10:15:10 -0700245 return True
246
Rich Laneb658ddd2013-03-12 10:15:10 -0700247 def pretty_print(self, q):
248 q.text("aggregate_stats_reply {")
249 with q.group():
250 with q.indent(2):
251 q.breakable()
252 q.text("xid = ");
253 if self.xid != None:
254 q.text("%#x" % self.xid)
255 else:
256 q.text('None')
257 q.text(","); q.breakable()
258 q.text("flags = ");
259 q.text("%#x" % self.flags)
260 q.text(","); q.breakable()
261 q.text("packet_count = ");
262 q.text("%#x" % self.packet_count)
263 q.text(","); q.breakable()
264 q.text("byte_count = ");
265 q.text("%#x" % self.byte_count)
266 q.text(","); q.breakable()
267 q.text("flow_count = ");
268 q.text("%#x" % self.flow_count)
Rich Laneb658ddd2013-03-12 10:15:10 -0700269 q.breakable()
270 q.text('}')
271
Rich Lane7dcdf022013-12-11 14:45:27 -0800272stats_reply.subtypes[2] = aggregate_stats_reply
273
274class stats_request(message):
275 subtypes = {}
276
Rich Lane95f7fc92014-01-27 17:08:16 -0800277 version = 1
278 type = 16
279
280 def __init__(self, xid=None, stats_type=None, flags=None):
281 if xid != None:
282 self.xid = xid
283 else:
284 self.xid = None
285 if stats_type != None:
286 self.stats_type = stats_type
287 else:
288 self.stats_type = 0
289 if flags != None:
290 self.flags = flags
291 else:
292 self.flags = 0
293 return
294
295 def pack(self):
296 packed = []
297 packed.append(struct.pack("!B", self.version))
298 packed.append(struct.pack("!B", self.type))
299 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
300 packed.append(struct.pack("!L", self.xid))
301 packed.append(struct.pack("!H", self.stats_type))
302 packed.append(struct.pack("!H", self.flags))
303 length = sum([len(x) for x in packed])
304 packed[2] = struct.pack("!H", length)
305 return ''.join(packed)
306
Rich Lane7dcdf022013-12-11 14:45:27 -0800307 @staticmethod
308 def unpack(reader):
309 subtype, = reader.peek('!H', 8)
Rich Lane95f7fc92014-01-27 17:08:16 -0800310 subclass = stats_request.subtypes.get(subtype)
311 if subclass:
312 return subclass.unpack(reader)
313
314 obj = stats_request()
315 _version = reader.read("!B")[0]
316 assert(_version == 1)
317 _type = reader.read("!B")[0]
318 assert(_type == 16)
319 _length = reader.read("!H")[0]
320 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800321 reader = orig_reader.slice(_length, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -0800322 obj.xid = reader.read("!L")[0]
323 obj.stats_type = reader.read("!H")[0]
324 obj.flags = reader.read("!H")[0]
325 return obj
326
327 def __eq__(self, other):
328 if type(self) != type(other): return False
329 if self.xid != other.xid: return False
330 if self.stats_type != other.stats_type: return False
331 if self.flags != other.flags: return False
332 return True
333
334 def pretty_print(self, q):
335 q.text("stats_request {")
336 with q.group():
337 with q.indent(2):
338 q.breakable()
339 q.text("xid = ");
340 if self.xid != None:
341 q.text("%#x" % self.xid)
342 else:
343 q.text('None')
344 q.text(","); q.breakable()
345 q.text("flags = ");
346 q.text("%#x" % self.flags)
347 q.breakable()
348 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -0800349
350message.subtypes[16] = stats_request
351
352class aggregate_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -0700353 version = 1
354 type = 16
355 stats_type = 2
Rich Laneb658ddd2013-03-12 10:15:10 -0700356
Rich Lanec2ee4b82013-04-24 17:12:38 -0700357 def __init__(self, xid=None, flags=None, match=None, table_id=None, out_port=None):
Rich Lane7dcdf022013-12-11 14:45:27 -0800358 if xid != None:
359 self.xid = xid
360 else:
361 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -0700362 if flags != None:
363 self.flags = flags
364 else:
365 self.flags = 0
366 if match != None:
367 self.match = match
368 else:
Rich Lanee2567702015-01-26 15:04:35 -0800369 self.match = ofp.match()
Rich Laneb658ddd2013-03-12 10:15:10 -0700370 if table_id != None:
371 self.table_id = table_id
372 else:
373 self.table_id = 0
Rich Laneb658ddd2013-03-12 10:15:10 -0700374 if out_port != None:
375 self.out_port = out_port
376 else:
377 self.out_port = 0
Rich Lane7dcdf022013-12-11 14:45:27 -0800378 return
Rich Laneb658ddd2013-03-12 10:15:10 -0700379
380 def pack(self):
381 packed = []
382 packed.append(struct.pack("!B", self.version))
383 packed.append(struct.pack("!B", self.type))
384 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
385 packed.append(struct.pack("!L", self.xid))
386 packed.append(struct.pack("!H", self.stats_type))
387 packed.append(struct.pack("!H", self.flags))
388 packed.append(self.match.pack())
389 packed.append(struct.pack("!B", self.table_id))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700390 packed.append('\x00' * 1)
Dan Talaycof6202252013-07-02 01:00:29 -0700391 packed.append(util.pack_port_no(self.out_port))
Rich Laneb658ddd2013-03-12 10:15:10 -0700392 length = sum([len(x) for x in packed])
393 packed[2] = struct.pack("!H", length)
394 return ''.join(packed)
395
396 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800397 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -0700398 obj = aggregate_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -0700399 _version = reader.read("!B")[0]
400 assert(_version == 1)
401 _type = reader.read("!B")[0]
402 assert(_type == 16)
403 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800404 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800405 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -0700406 obj.xid = reader.read("!L")[0]
407 _stats_type = reader.read("!H")[0]
408 assert(_stats_type == 2)
409 obj.flags = reader.read("!H")[0]
Rich Lanee2567702015-01-26 15:04:35 -0800410 obj.match = ofp.match.unpack(reader)
Dan Talaycof6202252013-07-02 01:00:29 -0700411 obj.table_id = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700412 reader.skip(1)
Dan Talaycof6202252013-07-02 01:00:29 -0700413 obj.out_port = util.unpack_port_no(reader)
Rich Laneb658ddd2013-03-12 10:15:10 -0700414 return obj
415
416 def __eq__(self, other):
417 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -0700418 if self.xid != other.xid: return False
419 if self.flags != other.flags: return False
420 if self.match != other.match: return False
421 if self.table_id != other.table_id: return False
Rich Laneb658ddd2013-03-12 10:15:10 -0700422 if self.out_port != other.out_port: return False
423 return True
424
Rich Laneb658ddd2013-03-12 10:15:10 -0700425 def pretty_print(self, q):
426 q.text("aggregate_stats_request {")
427 with q.group():
428 with q.indent(2):
429 q.breakable()
430 q.text("xid = ");
431 if self.xid != None:
432 q.text("%#x" % self.xid)
433 else:
434 q.text('None')
435 q.text(","); q.breakable()
436 q.text("flags = ");
437 q.text("%#x" % self.flags)
438 q.text(","); q.breakable()
439 q.text("match = ");
440 q.pp(self.match)
441 q.text(","); q.breakable()
442 q.text("table_id = ");
443 q.text("%#x" % self.table_id)
444 q.text(","); q.breakable()
Rich Laneb658ddd2013-03-12 10:15:10 -0700445 q.text("out_port = ");
446 q.text(util.pretty_port(self.out_port))
447 q.breakable()
448 q.text('}')
449
Rich Lane7dcdf022013-12-11 14:45:27 -0800450stats_request.subtypes[2] = aggregate_stats_request
451
452class error_msg(message):
453 subtypes = {}
454
Rich Lane95f7fc92014-01-27 17:08:16 -0800455 version = 1
456 type = 1
457
458 def __init__(self, xid=None, err_type=None):
459 if xid != None:
460 self.xid = xid
461 else:
462 self.xid = None
463 if err_type != None:
464 self.err_type = err_type
465 else:
466 self.err_type = 0
467 return
468
469 def pack(self):
470 packed = []
471 packed.append(struct.pack("!B", self.version))
472 packed.append(struct.pack("!B", self.type))
473 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
474 packed.append(struct.pack("!L", self.xid))
475 packed.append(struct.pack("!H", self.err_type))
476 length = sum([len(x) for x in packed])
477 packed[2] = struct.pack("!H", length)
478 return ''.join(packed)
479
Rich Lane7dcdf022013-12-11 14:45:27 -0800480 @staticmethod
481 def unpack(reader):
482 subtype, = reader.peek('!H', 8)
Rich Lane95f7fc92014-01-27 17:08:16 -0800483 subclass = error_msg.subtypes.get(subtype)
484 if subclass:
485 return subclass.unpack(reader)
486
487 obj = error_msg()
488 _version = reader.read("!B")[0]
489 assert(_version == 1)
490 _type = reader.read("!B")[0]
491 assert(_type == 1)
492 _length = reader.read("!H")[0]
493 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800494 reader = orig_reader.slice(_length, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -0800495 obj.xid = reader.read("!L")[0]
496 obj.err_type = reader.read("!H")[0]
497 return obj
498
499 def __eq__(self, other):
500 if type(self) != type(other): return False
501 if self.xid != other.xid: return False
502 if self.err_type != other.err_type: return False
503 return True
504
505 def pretty_print(self, q):
506 q.text("error_msg {")
507 with q.group():
508 with q.indent(2):
509 q.breakable()
510 q.text("xid = ");
511 if self.xid != None:
512 q.text("%#x" % self.xid)
513 else:
514 q.text('None')
515 q.breakable()
516 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -0800517
518message.subtypes[1] = error_msg
519
520class bad_action_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -0700521 version = 1
522 type = 1
523 err_type = 2
524
525 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -0800526 if xid != None:
527 self.xid = xid
528 else:
529 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -0700530 if code != None:
531 self.code = code
532 else:
533 self.code = 0
534 if data != None:
535 self.data = data
536 else:
537 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -0800538 return
Rich Lane6f4978c2013-10-20 21:33:52 -0700539
540 def pack(self):
541 packed = []
542 packed.append(struct.pack("!B", self.version))
543 packed.append(struct.pack("!B", self.type))
544 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
545 packed.append(struct.pack("!L", self.xid))
546 packed.append(struct.pack("!H", self.err_type))
547 packed.append(struct.pack("!H", self.code))
548 packed.append(self.data)
549 length = sum([len(x) for x in packed])
550 packed[2] = struct.pack("!H", length)
551 return ''.join(packed)
552
553 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800554 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -0700555 obj = bad_action_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -0700556 _version = reader.read("!B")[0]
557 assert(_version == 1)
558 _type = reader.read("!B")[0]
559 assert(_type == 1)
560 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800561 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800562 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -0700563 obj.xid = reader.read("!L")[0]
564 _err_type = reader.read("!H")[0]
565 assert(_err_type == 2)
566 obj.code = reader.read("!H")[0]
567 obj.data = str(reader.read_all())
568 return obj
569
570 def __eq__(self, other):
571 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -0700572 if self.xid != other.xid: return False
573 if self.code != other.code: return False
574 if self.data != other.data: return False
575 return True
576
Rich Lane6f4978c2013-10-20 21:33:52 -0700577 def pretty_print(self, q):
578 q.text("bad_action_error_msg {")
579 with q.group():
580 with q.indent(2):
581 q.breakable()
582 q.text("xid = ");
583 if self.xid != None:
584 q.text("%#x" % self.xid)
585 else:
586 q.text('None')
587 q.text(","); q.breakable()
588 q.text("code = ");
589 q.text("%#x" % self.code)
590 q.text(","); q.breakable()
591 q.text("data = ");
592 q.pp(self.data)
593 q.breakable()
594 q.text('}')
595
Rich Lane7dcdf022013-12-11 14:45:27 -0800596error_msg.subtypes[2] = bad_action_error_msg
597
598class bad_request_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -0700599 version = 1
600 type = 1
601 err_type = 1
602
603 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -0800604 if xid != None:
605 self.xid = xid
606 else:
607 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -0700608 if code != None:
609 self.code = code
610 else:
611 self.code = 0
612 if data != None:
613 self.data = data
614 else:
615 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -0800616 return
Rich Lane6f4978c2013-10-20 21:33:52 -0700617
618 def pack(self):
619 packed = []
620 packed.append(struct.pack("!B", self.version))
621 packed.append(struct.pack("!B", self.type))
622 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
623 packed.append(struct.pack("!L", self.xid))
624 packed.append(struct.pack("!H", self.err_type))
625 packed.append(struct.pack("!H", self.code))
626 packed.append(self.data)
627 length = sum([len(x) for x in packed])
628 packed[2] = struct.pack("!H", length)
629 return ''.join(packed)
630
631 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800632 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -0700633 obj = bad_request_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -0700634 _version = reader.read("!B")[0]
635 assert(_version == 1)
636 _type = reader.read("!B")[0]
637 assert(_type == 1)
638 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800639 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800640 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -0700641 obj.xid = reader.read("!L")[0]
642 _err_type = reader.read("!H")[0]
643 assert(_err_type == 1)
644 obj.code = reader.read("!H")[0]
645 obj.data = str(reader.read_all())
646 return obj
647
648 def __eq__(self, other):
649 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -0700650 if self.xid != other.xid: return False
651 if self.code != other.code: return False
652 if self.data != other.data: return False
653 return True
654
Rich Lane6f4978c2013-10-20 21:33:52 -0700655 def pretty_print(self, q):
656 q.text("bad_request_error_msg {")
657 with q.group():
658 with q.indent(2):
659 q.breakable()
660 q.text("xid = ");
661 if self.xid != None:
662 q.text("%#x" % self.xid)
663 else:
664 q.text('None')
665 q.text(","); q.breakable()
666 q.text("code = ");
667 q.text("%#x" % self.code)
668 q.text(","); q.breakable()
669 q.text("data = ");
670 q.pp(self.data)
671 q.breakable()
672 q.text('}')
673
Rich Lane7dcdf022013-12-11 14:45:27 -0800674error_msg.subtypes[1] = bad_request_error_msg
675
676class barrier_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -0700677 version = 1
678 type = 19
Rich Laneb658ddd2013-03-12 10:15:10 -0700679
680 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -0800681 if xid != None:
682 self.xid = xid
683 else:
684 self.xid = None
685 return
Rich Laneb658ddd2013-03-12 10:15:10 -0700686
687 def pack(self):
688 packed = []
689 packed.append(struct.pack("!B", self.version))
690 packed.append(struct.pack("!B", self.type))
691 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
692 packed.append(struct.pack("!L", self.xid))
693 length = sum([len(x) for x in packed])
694 packed[2] = struct.pack("!H", length)
695 return ''.join(packed)
696
697 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800698 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -0700699 obj = barrier_reply()
Dan Talaycof6202252013-07-02 01:00:29 -0700700 _version = reader.read("!B")[0]
701 assert(_version == 1)
702 _type = reader.read("!B")[0]
703 assert(_type == 19)
704 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800705 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800706 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -0700707 obj.xid = reader.read("!L")[0]
Rich Laneb658ddd2013-03-12 10:15:10 -0700708 return obj
709
710 def __eq__(self, other):
711 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -0700712 if self.xid != other.xid: return False
713 return True
714
Rich Laneb658ddd2013-03-12 10:15:10 -0700715 def pretty_print(self, q):
716 q.text("barrier_reply {")
717 with q.group():
718 with q.indent(2):
719 q.breakable()
720 q.text("xid = ");
721 if self.xid != None:
722 q.text("%#x" % self.xid)
723 else:
724 q.text('None')
725 q.breakable()
726 q.text('}')
727
Rich Lane7dcdf022013-12-11 14:45:27 -0800728message.subtypes[19] = barrier_reply
729
730class barrier_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -0700731 version = 1
732 type = 18
Rich Laneb658ddd2013-03-12 10:15:10 -0700733
734 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -0800735 if xid != None:
736 self.xid = xid
737 else:
738 self.xid = None
739 return
Rich Laneb658ddd2013-03-12 10:15:10 -0700740
741 def pack(self):
742 packed = []
743 packed.append(struct.pack("!B", self.version))
744 packed.append(struct.pack("!B", self.type))
745 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
746 packed.append(struct.pack("!L", self.xid))
747 length = sum([len(x) for x in packed])
748 packed[2] = struct.pack("!H", length)
749 return ''.join(packed)
750
751 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800752 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -0700753 obj = barrier_request()
Dan Talaycof6202252013-07-02 01:00:29 -0700754 _version = reader.read("!B")[0]
755 assert(_version == 1)
756 _type = reader.read("!B")[0]
757 assert(_type == 18)
758 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800759 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800760 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -0700761 obj.xid = reader.read("!L")[0]
Rich Laneb658ddd2013-03-12 10:15:10 -0700762 return obj
763
764 def __eq__(self, other):
765 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -0700766 if self.xid != other.xid: return False
767 return True
768
Rich Laneb658ddd2013-03-12 10:15:10 -0700769 def pretty_print(self, q):
770 q.text("barrier_request {")
771 with q.group():
772 with q.indent(2):
773 q.breakable()
774 q.text("xid = ");
775 if self.xid != None:
776 q.text("%#x" % self.xid)
777 else:
778 q.text('None')
779 q.breakable()
780 q.text('}')
781
Rich Lane7dcdf022013-12-11 14:45:27 -0800782message.subtypes[18] = barrier_request
783
784class experimenter(message):
785 subtypes = {}
786
Rich Lane95f7fc92014-01-27 17:08:16 -0800787 version = 1
788 type = 4
789
Harshmeet Singhc0378a92014-07-22 17:09:36 -0700790 def __init__(self, xid=None, experimenter=None, data=None):
Rich Lane95f7fc92014-01-27 17:08:16 -0800791 if xid != None:
792 self.xid = xid
793 else:
794 self.xid = None
795 if experimenter != None:
796 self.experimenter = experimenter
797 else:
798 self.experimenter = 0
Rich Lane95f7fc92014-01-27 17:08:16 -0800799 if data != None:
800 self.data = data
801 else:
802 self.data = ''
803 return
804
805 def pack(self):
806 packed = []
807 packed.append(struct.pack("!B", self.version))
808 packed.append(struct.pack("!B", self.type))
809 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
810 packed.append(struct.pack("!L", self.xid))
811 packed.append(struct.pack("!L", self.experimenter))
Rich Lane95f7fc92014-01-27 17:08:16 -0800812 packed.append(self.data)
813 length = sum([len(x) for x in packed])
814 packed[2] = struct.pack("!H", length)
815 return ''.join(packed)
816
Rich Lane7dcdf022013-12-11 14:45:27 -0800817 @staticmethod
818 def unpack(reader):
819 subtype, = reader.peek('!L', 8)
Rich Lane95f7fc92014-01-27 17:08:16 -0800820 subclass = experimenter.subtypes.get(subtype)
821 if subclass:
822 return subclass.unpack(reader)
823
824 obj = experimenter()
825 _version = reader.read("!B")[0]
826 assert(_version == 1)
827 _type = reader.read("!B")[0]
828 assert(_type == 4)
829 _length = reader.read("!H")[0]
830 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800831 reader = orig_reader.slice(_length, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -0800832 obj.xid = reader.read("!L")[0]
833 obj.experimenter = reader.read("!L")[0]
Rich Lane95f7fc92014-01-27 17:08:16 -0800834 obj.data = str(reader.read_all())
835 return obj
836
837 def __eq__(self, other):
838 if type(self) != type(other): return False
839 if self.xid != other.xid: return False
840 if self.experimenter != other.experimenter: return False
Rich Lane95f7fc92014-01-27 17:08:16 -0800841 if self.data != other.data: return False
842 return True
843
844 def pretty_print(self, q):
845 q.text("experimenter {")
846 with q.group():
847 with q.indent(2):
848 q.breakable()
849 q.text("xid = ");
850 if self.xid != None:
851 q.text("%#x" % self.xid)
852 else:
853 q.text('None')
854 q.text(","); q.breakable()
Rich Lane95f7fc92014-01-27 17:08:16 -0800855 q.text("data = ");
856 q.pp(self.data)
857 q.breakable()
858 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -0800859
860message.subtypes[4] = experimenter
861
862class bsn_header(experimenter):
863 subtypes = {}
864
Rich Lane95f7fc92014-01-27 17:08:16 -0800865 version = 1
866 type = 4
867 experimenter = 6035143
868
869 def __init__(self, xid=None, subtype=None):
870 if xid != None:
871 self.xid = xid
872 else:
873 self.xid = None
874 if subtype != None:
875 self.subtype = subtype
876 else:
877 self.subtype = 0
878 return
879
880 def pack(self):
881 packed = []
882 packed.append(struct.pack("!B", self.version))
883 packed.append(struct.pack("!B", self.type))
884 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
885 packed.append(struct.pack("!L", self.xid))
886 packed.append(struct.pack("!L", self.experimenter))
887 packed.append(struct.pack("!L", self.subtype))
888 length = sum([len(x) for x in packed])
889 packed[2] = struct.pack("!H", length)
890 return ''.join(packed)
891
Rich Lane7dcdf022013-12-11 14:45:27 -0800892 @staticmethod
893 def unpack(reader):
894 subtype, = reader.peek('!L', 12)
Rich Lane95f7fc92014-01-27 17:08:16 -0800895 subclass = bsn_header.subtypes.get(subtype)
896 if subclass:
897 return subclass.unpack(reader)
898
899 obj = bsn_header()
900 _version = reader.read("!B")[0]
901 assert(_version == 1)
902 _type = reader.read("!B")[0]
903 assert(_type == 4)
904 _length = reader.read("!H")[0]
905 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800906 reader = orig_reader.slice(_length, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -0800907 obj.xid = reader.read("!L")[0]
908 _experimenter = reader.read("!L")[0]
909 assert(_experimenter == 6035143)
910 obj.subtype = reader.read("!L")[0]
911 return obj
912
913 def __eq__(self, other):
914 if type(self) != type(other): return False
915 if self.xid != other.xid: return False
916 if self.subtype != other.subtype: return False
917 return True
918
919 def pretty_print(self, q):
920 q.text("bsn_header {")
921 with q.group():
922 with q.indent(2):
923 q.breakable()
924 q.text("xid = ");
925 if self.xid != None:
926 q.text("%#x" % self.xid)
927 else:
928 q.text('None')
929 q.breakable()
930 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -0800931
932experimenter.subtypes[6035143] = bsn_header
933
934class bsn_bw_clear_data_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -0700935 version = 1
936 type = 4
937 experimenter = 6035143
938 subtype = 22
939
940 def __init__(self, xid=None, status=None):
Rich Lane7dcdf022013-12-11 14:45:27 -0800941 if xid != None:
942 self.xid = xid
943 else:
944 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -0700945 if status != None:
946 self.status = status
947 else:
948 self.status = 0
Rich Lane7dcdf022013-12-11 14:45:27 -0800949 return
Dan Talaycof6202252013-07-02 01:00:29 -0700950
951 def pack(self):
952 packed = []
953 packed.append(struct.pack("!B", self.version))
954 packed.append(struct.pack("!B", self.type))
955 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
956 packed.append(struct.pack("!L", self.xid))
957 packed.append(struct.pack("!L", self.experimenter))
958 packed.append(struct.pack("!L", self.subtype))
959 packed.append(struct.pack("!L", self.status))
960 length = sum([len(x) for x in packed])
961 packed[2] = struct.pack("!H", length)
962 return ''.join(packed)
963
964 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800965 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -0700966 obj = bsn_bw_clear_data_reply()
Dan Talaycof6202252013-07-02 01:00:29 -0700967 _version = reader.read("!B")[0]
968 assert(_version == 1)
969 _type = reader.read("!B")[0]
970 assert(_type == 4)
971 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800972 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800973 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -0700974 obj.xid = reader.read("!L")[0]
975 _experimenter = reader.read("!L")[0]
976 assert(_experimenter == 6035143)
977 _subtype = reader.read("!L")[0]
978 assert(_subtype == 22)
979 obj.status = reader.read("!L")[0]
980 return obj
981
982 def __eq__(self, other):
983 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -0700984 if self.xid != other.xid: return False
985 if self.status != other.status: return False
986 return True
987
Dan Talaycof6202252013-07-02 01:00:29 -0700988 def pretty_print(self, q):
989 q.text("bsn_bw_clear_data_reply {")
990 with q.group():
991 with q.indent(2):
992 q.breakable()
993 q.text("xid = ");
994 if self.xid != None:
995 q.text("%#x" % self.xid)
996 else:
997 q.text('None')
998 q.text(","); q.breakable()
999 q.text("status = ");
1000 q.text("%#x" % self.status)
1001 q.breakable()
1002 q.text('}')
1003
Rich Lane7dcdf022013-12-11 14:45:27 -08001004bsn_header.subtypes[22] = bsn_bw_clear_data_reply
1005
1006class bsn_bw_clear_data_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001007 version = 1
1008 type = 4
1009 experimenter = 6035143
1010 subtype = 21
1011
1012 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001013 if xid != None:
1014 self.xid = xid
1015 else:
1016 self.xid = None
1017 return
Dan Talaycof6202252013-07-02 01:00:29 -07001018
1019 def pack(self):
1020 packed = []
1021 packed.append(struct.pack("!B", self.version))
1022 packed.append(struct.pack("!B", self.type))
1023 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1024 packed.append(struct.pack("!L", self.xid))
1025 packed.append(struct.pack("!L", self.experimenter))
1026 packed.append(struct.pack("!L", self.subtype))
1027 length = sum([len(x) for x in packed])
1028 packed[2] = struct.pack("!H", length)
1029 return ''.join(packed)
1030
1031 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001032 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07001033 obj = bsn_bw_clear_data_request()
Dan Talaycof6202252013-07-02 01:00:29 -07001034 _version = reader.read("!B")[0]
1035 assert(_version == 1)
1036 _type = reader.read("!B")[0]
1037 assert(_type == 4)
1038 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001039 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001040 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07001041 obj.xid = reader.read("!L")[0]
1042 _experimenter = reader.read("!L")[0]
1043 assert(_experimenter == 6035143)
1044 _subtype = reader.read("!L")[0]
1045 assert(_subtype == 21)
1046 return obj
1047
1048 def __eq__(self, other):
1049 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07001050 if self.xid != other.xid: return False
1051 return True
1052
Dan Talaycof6202252013-07-02 01:00:29 -07001053 def pretty_print(self, q):
1054 q.text("bsn_bw_clear_data_request {")
1055 with q.group():
1056 with q.indent(2):
1057 q.breakable()
1058 q.text("xid = ");
1059 if self.xid != None:
1060 q.text("%#x" % self.xid)
1061 else:
1062 q.text('None')
1063 q.breakable()
1064 q.text('}')
1065
Rich Lane7dcdf022013-12-11 14:45:27 -08001066bsn_header.subtypes[21] = bsn_bw_clear_data_request
1067
1068class bsn_bw_enable_get_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001069 version = 1
1070 type = 4
1071 experimenter = 6035143
1072 subtype = 20
1073
1074 def __init__(self, xid=None, enabled=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001075 if xid != None:
1076 self.xid = xid
1077 else:
1078 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07001079 if enabled != None:
1080 self.enabled = enabled
1081 else:
1082 self.enabled = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08001083 return
Dan Talaycof6202252013-07-02 01:00:29 -07001084
1085 def pack(self):
1086 packed = []
1087 packed.append(struct.pack("!B", self.version))
1088 packed.append(struct.pack("!B", self.type))
1089 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1090 packed.append(struct.pack("!L", self.xid))
1091 packed.append(struct.pack("!L", self.experimenter))
1092 packed.append(struct.pack("!L", self.subtype))
1093 packed.append(struct.pack("!L", self.enabled))
1094 length = sum([len(x) for x in packed])
1095 packed[2] = struct.pack("!H", length)
1096 return ''.join(packed)
1097
1098 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001099 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07001100 obj = bsn_bw_enable_get_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07001101 _version = reader.read("!B")[0]
1102 assert(_version == 1)
1103 _type = reader.read("!B")[0]
1104 assert(_type == 4)
1105 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001106 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001107 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07001108 obj.xid = reader.read("!L")[0]
1109 _experimenter = reader.read("!L")[0]
1110 assert(_experimenter == 6035143)
1111 _subtype = reader.read("!L")[0]
1112 assert(_subtype == 20)
1113 obj.enabled = reader.read("!L")[0]
1114 return obj
1115
1116 def __eq__(self, other):
1117 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07001118 if self.xid != other.xid: return False
1119 if self.enabled != other.enabled: return False
1120 return True
1121
Dan Talaycof6202252013-07-02 01:00:29 -07001122 def pretty_print(self, q):
1123 q.text("bsn_bw_enable_get_reply {")
1124 with q.group():
1125 with q.indent(2):
1126 q.breakable()
1127 q.text("xid = ");
1128 if self.xid != None:
1129 q.text("%#x" % self.xid)
1130 else:
1131 q.text('None')
1132 q.text(","); q.breakable()
1133 q.text("enabled = ");
1134 q.text("%#x" % self.enabled)
1135 q.breakable()
1136 q.text('}')
1137
Rich Lane7dcdf022013-12-11 14:45:27 -08001138bsn_header.subtypes[20] = bsn_bw_enable_get_reply
1139
1140class bsn_bw_enable_get_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001141 version = 1
1142 type = 4
1143 experimenter = 6035143
1144 subtype = 19
1145
1146 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001147 if xid != None:
1148 self.xid = xid
1149 else:
1150 self.xid = None
1151 return
Dan Talaycof6202252013-07-02 01:00:29 -07001152
1153 def pack(self):
1154 packed = []
1155 packed.append(struct.pack("!B", self.version))
1156 packed.append(struct.pack("!B", self.type))
1157 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1158 packed.append(struct.pack("!L", self.xid))
1159 packed.append(struct.pack("!L", self.experimenter))
1160 packed.append(struct.pack("!L", self.subtype))
1161 length = sum([len(x) for x in packed])
1162 packed[2] = struct.pack("!H", length)
1163 return ''.join(packed)
1164
1165 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001166 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07001167 obj = bsn_bw_enable_get_request()
Dan Talaycof6202252013-07-02 01:00:29 -07001168 _version = reader.read("!B")[0]
1169 assert(_version == 1)
1170 _type = reader.read("!B")[0]
1171 assert(_type == 4)
1172 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001173 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001174 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07001175 obj.xid = reader.read("!L")[0]
1176 _experimenter = reader.read("!L")[0]
1177 assert(_experimenter == 6035143)
1178 _subtype = reader.read("!L")[0]
1179 assert(_subtype == 19)
1180 return obj
1181
1182 def __eq__(self, other):
1183 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07001184 if self.xid != other.xid: return False
1185 return True
1186
Dan Talaycof6202252013-07-02 01:00:29 -07001187 def pretty_print(self, q):
1188 q.text("bsn_bw_enable_get_request {")
1189 with q.group():
1190 with q.indent(2):
1191 q.breakable()
1192 q.text("xid = ");
1193 if self.xid != None:
1194 q.text("%#x" % self.xid)
1195 else:
1196 q.text('None')
1197 q.breakable()
1198 q.text('}')
1199
Rich Lane7dcdf022013-12-11 14:45:27 -08001200bsn_header.subtypes[19] = bsn_bw_enable_get_request
1201
1202class bsn_bw_enable_set_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001203 version = 1
1204 type = 4
1205 experimenter = 6035143
1206 subtype = 23
1207
1208 def __init__(self, xid=None, enable=None, status=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001209 if xid != None:
1210 self.xid = xid
1211 else:
1212 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07001213 if enable != None:
1214 self.enable = enable
1215 else:
1216 self.enable = 0
1217 if status != None:
1218 self.status = status
1219 else:
1220 self.status = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08001221 return
Dan Talaycof6202252013-07-02 01:00:29 -07001222
1223 def pack(self):
1224 packed = []
1225 packed.append(struct.pack("!B", self.version))
1226 packed.append(struct.pack("!B", self.type))
1227 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1228 packed.append(struct.pack("!L", self.xid))
1229 packed.append(struct.pack("!L", self.experimenter))
1230 packed.append(struct.pack("!L", self.subtype))
1231 packed.append(struct.pack("!L", self.enable))
1232 packed.append(struct.pack("!L", self.status))
1233 length = sum([len(x) for x in packed])
1234 packed[2] = struct.pack("!H", length)
1235 return ''.join(packed)
1236
1237 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001238 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07001239 obj = bsn_bw_enable_set_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07001240 _version = reader.read("!B")[0]
1241 assert(_version == 1)
1242 _type = reader.read("!B")[0]
1243 assert(_type == 4)
1244 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001245 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001246 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07001247 obj.xid = reader.read("!L")[0]
1248 _experimenter = reader.read("!L")[0]
1249 assert(_experimenter == 6035143)
1250 _subtype = reader.read("!L")[0]
1251 assert(_subtype == 23)
1252 obj.enable = reader.read("!L")[0]
1253 obj.status = reader.read("!L")[0]
1254 return obj
1255
1256 def __eq__(self, other):
1257 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07001258 if self.xid != other.xid: return False
1259 if self.enable != other.enable: return False
1260 if self.status != other.status: return False
1261 return True
1262
Dan Talaycof6202252013-07-02 01:00:29 -07001263 def pretty_print(self, q):
1264 q.text("bsn_bw_enable_set_reply {")
1265 with q.group():
1266 with q.indent(2):
1267 q.breakable()
1268 q.text("xid = ");
1269 if self.xid != None:
1270 q.text("%#x" % self.xid)
1271 else:
1272 q.text('None')
1273 q.text(","); q.breakable()
1274 q.text("enable = ");
1275 q.text("%#x" % self.enable)
1276 q.text(","); q.breakable()
1277 q.text("status = ");
1278 q.text("%#x" % self.status)
1279 q.breakable()
1280 q.text('}')
1281
Rich Lane7dcdf022013-12-11 14:45:27 -08001282bsn_header.subtypes[23] = bsn_bw_enable_set_reply
1283
1284class bsn_bw_enable_set_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001285 version = 1
1286 type = 4
1287 experimenter = 6035143
1288 subtype = 18
1289
1290 def __init__(self, xid=None, enable=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001291 if xid != None:
1292 self.xid = xid
1293 else:
1294 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07001295 if enable != None:
1296 self.enable = enable
1297 else:
1298 self.enable = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08001299 return
Dan Talaycof6202252013-07-02 01:00:29 -07001300
1301 def pack(self):
1302 packed = []
1303 packed.append(struct.pack("!B", self.version))
1304 packed.append(struct.pack("!B", self.type))
1305 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1306 packed.append(struct.pack("!L", self.xid))
1307 packed.append(struct.pack("!L", self.experimenter))
1308 packed.append(struct.pack("!L", self.subtype))
1309 packed.append(struct.pack("!L", self.enable))
1310 length = sum([len(x) for x in packed])
1311 packed[2] = struct.pack("!H", length)
1312 return ''.join(packed)
1313
1314 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001315 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07001316 obj = bsn_bw_enable_set_request()
Dan Talaycof6202252013-07-02 01:00:29 -07001317 _version = reader.read("!B")[0]
1318 assert(_version == 1)
1319 _type = reader.read("!B")[0]
1320 assert(_type == 4)
1321 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001322 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001323 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07001324 obj.xid = reader.read("!L")[0]
1325 _experimenter = reader.read("!L")[0]
1326 assert(_experimenter == 6035143)
1327 _subtype = reader.read("!L")[0]
1328 assert(_subtype == 18)
1329 obj.enable = reader.read("!L")[0]
1330 return obj
1331
1332 def __eq__(self, other):
1333 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07001334 if self.xid != other.xid: return False
1335 if self.enable != other.enable: return False
1336 return True
1337
Dan Talaycof6202252013-07-02 01:00:29 -07001338 def pretty_print(self, q):
1339 q.text("bsn_bw_enable_set_request {")
1340 with q.group():
1341 with q.indent(2):
1342 q.breakable()
1343 q.text("xid = ");
1344 if self.xid != None:
1345 q.text("%#x" % self.xid)
1346 else:
1347 q.text('None')
1348 q.text(","); q.breakable()
1349 q.text("enable = ");
1350 q.text("%#x" % self.enable)
1351 q.breakable()
1352 q.text('}')
1353
Rich Lane7dcdf022013-12-11 14:45:27 -08001354bsn_header.subtypes[18] = bsn_bw_enable_set_request
1355
1356class bsn_get_interfaces_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001357 version = 1
1358 type = 4
1359 experimenter = 6035143
Rich Laneb658ddd2013-03-12 10:15:10 -07001360 subtype = 10
1361
1362 def __init__(self, xid=None, interfaces=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001363 if xid != None:
1364 self.xid = xid
1365 else:
1366 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07001367 if interfaces != None:
1368 self.interfaces = interfaces
1369 else:
1370 self.interfaces = []
Rich Lane7dcdf022013-12-11 14:45:27 -08001371 return
Rich Laneb658ddd2013-03-12 10:15:10 -07001372
1373 def pack(self):
1374 packed = []
1375 packed.append(struct.pack("!B", self.version))
1376 packed.append(struct.pack("!B", self.type))
1377 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1378 packed.append(struct.pack("!L", self.xid))
1379 packed.append(struct.pack("!L", self.experimenter))
1380 packed.append(struct.pack("!L", self.subtype))
Rich Lane7dcdf022013-12-11 14:45:27 -08001381 packed.append(loxi.generic_util.pack_list(self.interfaces))
Rich Laneb658ddd2013-03-12 10:15:10 -07001382 length = sum([len(x) for x in packed])
1383 packed[2] = struct.pack("!H", length)
1384 return ''.join(packed)
1385
1386 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001387 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07001388 obj = bsn_get_interfaces_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07001389 _version = reader.read("!B")[0]
1390 assert(_version == 1)
1391 _type = reader.read("!B")[0]
1392 assert(_type == 4)
1393 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001394 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001395 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07001396 obj.xid = reader.read("!L")[0]
1397 _experimenter = reader.read("!L")[0]
1398 assert(_experimenter == 6035143)
1399 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001400 assert(_subtype == 10)
Rich Lanee2567702015-01-26 15:04:35 -08001401 obj.interfaces = loxi.generic_util.unpack_list(reader, ofp.common.bsn_interface.unpack)
Rich Laneb658ddd2013-03-12 10:15:10 -07001402 return obj
1403
1404 def __eq__(self, other):
1405 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07001406 if self.xid != other.xid: return False
1407 if self.interfaces != other.interfaces: return False
1408 return True
1409
Rich Laneb658ddd2013-03-12 10:15:10 -07001410 def pretty_print(self, q):
1411 q.text("bsn_get_interfaces_reply {")
1412 with q.group():
1413 with q.indent(2):
1414 q.breakable()
1415 q.text("xid = ");
1416 if self.xid != None:
1417 q.text("%#x" % self.xid)
1418 else:
1419 q.text('None')
1420 q.text(","); q.breakable()
1421 q.text("interfaces = ");
1422 q.pp(self.interfaces)
1423 q.breakable()
1424 q.text('}')
1425
Rich Lane7dcdf022013-12-11 14:45:27 -08001426bsn_header.subtypes[10] = bsn_get_interfaces_reply
1427
1428class bsn_get_interfaces_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001429 version = 1
1430 type = 4
1431 experimenter = 6035143
Rich Laneb658ddd2013-03-12 10:15:10 -07001432 subtype = 9
1433
1434 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001435 if xid != None:
1436 self.xid = xid
1437 else:
1438 self.xid = None
1439 return
Rich Laneb658ddd2013-03-12 10:15:10 -07001440
1441 def pack(self):
1442 packed = []
1443 packed.append(struct.pack("!B", self.version))
1444 packed.append(struct.pack("!B", self.type))
1445 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1446 packed.append(struct.pack("!L", self.xid))
1447 packed.append(struct.pack("!L", self.experimenter))
1448 packed.append(struct.pack("!L", self.subtype))
1449 length = sum([len(x) for x in packed])
1450 packed[2] = struct.pack("!H", length)
1451 return ''.join(packed)
1452
1453 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001454 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07001455 obj = bsn_get_interfaces_request()
Dan Talaycof6202252013-07-02 01:00:29 -07001456 _version = reader.read("!B")[0]
1457 assert(_version == 1)
1458 _type = reader.read("!B")[0]
1459 assert(_type == 4)
1460 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001461 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001462 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07001463 obj.xid = reader.read("!L")[0]
1464 _experimenter = reader.read("!L")[0]
1465 assert(_experimenter == 6035143)
1466 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001467 assert(_subtype == 9)
Rich Laneb658ddd2013-03-12 10:15:10 -07001468 return obj
1469
1470 def __eq__(self, other):
1471 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07001472 if self.xid != other.xid: return False
1473 return True
1474
Rich Laneb658ddd2013-03-12 10:15:10 -07001475 def pretty_print(self, q):
1476 q.text("bsn_get_interfaces_request {")
1477 with q.group():
1478 with q.indent(2):
1479 q.breakable()
1480 q.text("xid = ");
1481 if self.xid != None:
1482 q.text("%#x" % self.xid)
1483 else:
1484 q.text('None')
1485 q.breakable()
1486 q.text('}')
1487
Rich Lane7dcdf022013-12-11 14:45:27 -08001488bsn_header.subtypes[9] = bsn_get_interfaces_request
1489
1490class bsn_get_ip_mask_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001491 version = 1
1492 type = 4
1493 experimenter = 6035143
Rich Laneb658ddd2013-03-12 10:15:10 -07001494 subtype = 2
1495
Rich Lanec2ee4b82013-04-24 17:12:38 -07001496 def __init__(self, xid=None, index=None, mask=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001497 if xid != None:
1498 self.xid = xid
1499 else:
1500 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07001501 if index != None:
1502 self.index = index
1503 else:
1504 self.index = 0
Rich Laneb658ddd2013-03-12 10:15:10 -07001505 if mask != None:
1506 self.mask = mask
1507 else:
1508 self.mask = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08001509 return
Rich Laneb658ddd2013-03-12 10:15:10 -07001510
1511 def pack(self):
1512 packed = []
1513 packed.append(struct.pack("!B", self.version))
1514 packed.append(struct.pack("!B", self.type))
1515 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1516 packed.append(struct.pack("!L", self.xid))
1517 packed.append(struct.pack("!L", self.experimenter))
1518 packed.append(struct.pack("!L", self.subtype))
1519 packed.append(struct.pack("!B", self.index))
Rich Lanec2ee4b82013-04-24 17:12:38 -07001520 packed.append('\x00' * 3)
Rich Laneb658ddd2013-03-12 10:15:10 -07001521 packed.append(struct.pack("!L", self.mask))
1522 length = sum([len(x) for x in packed])
1523 packed[2] = struct.pack("!H", length)
1524 return ''.join(packed)
1525
1526 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001527 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07001528 obj = bsn_get_ip_mask_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07001529 _version = reader.read("!B")[0]
1530 assert(_version == 1)
1531 _type = reader.read("!B")[0]
1532 assert(_type == 4)
1533 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001534 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001535 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07001536 obj.xid = reader.read("!L")[0]
1537 _experimenter = reader.read("!L")[0]
1538 assert(_experimenter == 6035143)
1539 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001540 assert(_subtype == 2)
Dan Talaycof6202252013-07-02 01:00:29 -07001541 obj.index = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001542 reader.skip(3)
Dan Talaycof6202252013-07-02 01:00:29 -07001543 obj.mask = reader.read("!L")[0]
Rich Laneb658ddd2013-03-12 10:15:10 -07001544 return obj
1545
1546 def __eq__(self, other):
1547 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07001548 if self.xid != other.xid: return False
1549 if self.index != other.index: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07001550 if self.mask != other.mask: return False
1551 return True
1552
Rich Laneb658ddd2013-03-12 10:15:10 -07001553 def pretty_print(self, q):
1554 q.text("bsn_get_ip_mask_reply {")
1555 with q.group():
1556 with q.indent(2):
1557 q.breakable()
1558 q.text("xid = ");
1559 if self.xid != None:
1560 q.text("%#x" % self.xid)
1561 else:
1562 q.text('None')
1563 q.text(","); q.breakable()
1564 q.text("index = ");
1565 q.text("%#x" % self.index)
1566 q.text(","); q.breakable()
Rich Laneb658ddd2013-03-12 10:15:10 -07001567 q.text("mask = ");
1568 q.text("%#x" % self.mask)
1569 q.breakable()
1570 q.text('}')
1571
Rich Lane7dcdf022013-12-11 14:45:27 -08001572bsn_header.subtypes[2] = bsn_get_ip_mask_reply
1573
1574class bsn_get_ip_mask_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001575 version = 1
1576 type = 4
1577 experimenter = 6035143
Rich Laneb658ddd2013-03-12 10:15:10 -07001578 subtype = 1
1579
Rich Lanec2ee4b82013-04-24 17:12:38 -07001580 def __init__(self, xid=None, index=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001581 if xid != None:
1582 self.xid = xid
1583 else:
1584 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07001585 if index != None:
1586 self.index = index
1587 else:
1588 self.index = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08001589 return
Rich Laneb658ddd2013-03-12 10:15:10 -07001590
1591 def pack(self):
1592 packed = []
1593 packed.append(struct.pack("!B", self.version))
1594 packed.append(struct.pack("!B", self.type))
1595 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1596 packed.append(struct.pack("!L", self.xid))
1597 packed.append(struct.pack("!L", self.experimenter))
1598 packed.append(struct.pack("!L", self.subtype))
1599 packed.append(struct.pack("!B", self.index))
Rich Lanec2ee4b82013-04-24 17:12:38 -07001600 packed.append('\x00' * 7)
Rich Laneb658ddd2013-03-12 10:15:10 -07001601 length = sum([len(x) for x in packed])
1602 packed[2] = struct.pack("!H", length)
1603 return ''.join(packed)
1604
1605 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001606 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07001607 obj = bsn_get_ip_mask_request()
Dan Talaycof6202252013-07-02 01:00:29 -07001608 _version = reader.read("!B")[0]
1609 assert(_version == 1)
1610 _type = reader.read("!B")[0]
1611 assert(_type == 4)
1612 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001613 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001614 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07001615 obj.xid = reader.read("!L")[0]
1616 _experimenter = reader.read("!L")[0]
1617 assert(_experimenter == 6035143)
1618 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001619 assert(_subtype == 1)
Dan Talaycof6202252013-07-02 01:00:29 -07001620 obj.index = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001621 reader.skip(7)
Rich Laneb658ddd2013-03-12 10:15:10 -07001622 return obj
1623
1624 def __eq__(self, other):
1625 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07001626 if self.xid != other.xid: return False
1627 if self.index != other.index: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07001628 return True
1629
Rich Laneb658ddd2013-03-12 10:15:10 -07001630 def pretty_print(self, q):
1631 q.text("bsn_get_ip_mask_request {")
1632 with q.group():
1633 with q.indent(2):
1634 q.breakable()
1635 q.text("xid = ");
1636 if self.xid != None:
1637 q.text("%#x" % self.xid)
1638 else:
1639 q.text('None')
1640 q.text(","); q.breakable()
1641 q.text("index = ");
1642 q.text("%#x" % self.index)
Rich Laneb658ddd2013-03-12 10:15:10 -07001643 q.breakable()
1644 q.text('}')
1645
Rich Lane7dcdf022013-12-11 14:45:27 -08001646bsn_header.subtypes[1] = bsn_get_ip_mask_request
1647
1648class bsn_get_l2_table_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001649 version = 1
1650 type = 4
1651 experimenter = 6035143
Rich Lane90c961c2013-05-14 09:26:50 -07001652 subtype = 14
1653
1654 def __init__(self, xid=None, l2_table_enable=None, l2_table_priority=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001655 if xid != None:
1656 self.xid = xid
1657 else:
1658 self.xid = None
Rich Lane90c961c2013-05-14 09:26:50 -07001659 if l2_table_enable != None:
1660 self.l2_table_enable = l2_table_enable
1661 else:
1662 self.l2_table_enable = 0
1663 if l2_table_priority != None:
1664 self.l2_table_priority = l2_table_priority
1665 else:
1666 self.l2_table_priority = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08001667 return
Rich Lane90c961c2013-05-14 09:26:50 -07001668
1669 def pack(self):
1670 packed = []
1671 packed.append(struct.pack("!B", self.version))
1672 packed.append(struct.pack("!B", self.type))
1673 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1674 packed.append(struct.pack("!L", self.xid))
1675 packed.append(struct.pack("!L", self.experimenter))
1676 packed.append(struct.pack("!L", self.subtype))
1677 packed.append(struct.pack("!B", self.l2_table_enable))
1678 packed.append('\x00' * 1)
1679 packed.append(struct.pack("!H", self.l2_table_priority))
1680 packed.append('\x00' * 4)
1681 length = sum([len(x) for x in packed])
1682 packed[2] = struct.pack("!H", length)
1683 return ''.join(packed)
1684
1685 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001686 def unpack(reader):
Rich Lane90c961c2013-05-14 09:26:50 -07001687 obj = bsn_get_l2_table_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07001688 _version = reader.read("!B")[0]
1689 assert(_version == 1)
1690 _type = reader.read("!B")[0]
1691 assert(_type == 4)
1692 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001693 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001694 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07001695 obj.xid = reader.read("!L")[0]
1696 _experimenter = reader.read("!L")[0]
1697 assert(_experimenter == 6035143)
1698 _subtype = reader.read("!L")[0]
Rich Lane90c961c2013-05-14 09:26:50 -07001699 assert(_subtype == 14)
Dan Talaycof6202252013-07-02 01:00:29 -07001700 obj.l2_table_enable = reader.read("!B")[0]
Rich Lane90c961c2013-05-14 09:26:50 -07001701 reader.skip(1)
Dan Talaycof6202252013-07-02 01:00:29 -07001702 obj.l2_table_priority = reader.read("!H")[0]
Rich Lane90c961c2013-05-14 09:26:50 -07001703 reader.skip(4)
1704 return obj
1705
1706 def __eq__(self, other):
1707 if type(self) != type(other): return False
Rich Lane90c961c2013-05-14 09:26:50 -07001708 if self.xid != other.xid: return False
1709 if self.l2_table_enable != other.l2_table_enable: return False
1710 if self.l2_table_priority != other.l2_table_priority: return False
1711 return True
1712
Rich Lane90c961c2013-05-14 09:26:50 -07001713 def pretty_print(self, q):
1714 q.text("bsn_get_l2_table_reply {")
1715 with q.group():
1716 with q.indent(2):
1717 q.breakable()
1718 q.text("xid = ");
1719 if self.xid != None:
1720 q.text("%#x" % self.xid)
1721 else:
1722 q.text('None')
1723 q.text(","); q.breakable()
1724 q.text("l2_table_enable = ");
1725 q.text("%#x" % self.l2_table_enable)
1726 q.text(","); q.breakable()
1727 q.text("l2_table_priority = ");
1728 q.text("%#x" % self.l2_table_priority)
1729 q.breakable()
1730 q.text('}')
1731
Rich Lane7dcdf022013-12-11 14:45:27 -08001732bsn_header.subtypes[14] = bsn_get_l2_table_reply
1733
1734class bsn_get_l2_table_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001735 version = 1
1736 type = 4
1737 experimenter = 6035143
Rich Lane90c961c2013-05-14 09:26:50 -07001738 subtype = 13
1739
1740 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001741 if xid != None:
1742 self.xid = xid
1743 else:
1744 self.xid = None
1745 return
Rich Lane90c961c2013-05-14 09:26:50 -07001746
1747 def pack(self):
1748 packed = []
1749 packed.append(struct.pack("!B", self.version))
1750 packed.append(struct.pack("!B", self.type))
1751 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1752 packed.append(struct.pack("!L", self.xid))
1753 packed.append(struct.pack("!L", self.experimenter))
1754 packed.append(struct.pack("!L", self.subtype))
1755 length = sum([len(x) for x in packed])
1756 packed[2] = struct.pack("!H", length)
1757 return ''.join(packed)
1758
1759 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001760 def unpack(reader):
Rich Lane90c961c2013-05-14 09:26:50 -07001761 obj = bsn_get_l2_table_request()
Dan Talaycof6202252013-07-02 01:00:29 -07001762 _version = reader.read("!B")[0]
1763 assert(_version == 1)
1764 _type = reader.read("!B")[0]
1765 assert(_type == 4)
1766 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001767 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001768 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07001769 obj.xid = reader.read("!L")[0]
1770 _experimenter = reader.read("!L")[0]
1771 assert(_experimenter == 6035143)
1772 _subtype = reader.read("!L")[0]
Rich Lane90c961c2013-05-14 09:26:50 -07001773 assert(_subtype == 13)
1774 return obj
1775
1776 def __eq__(self, other):
1777 if type(self) != type(other): return False
Rich Lane90c961c2013-05-14 09:26:50 -07001778 if self.xid != other.xid: return False
1779 return True
1780
Rich Lane90c961c2013-05-14 09:26:50 -07001781 def pretty_print(self, q):
1782 q.text("bsn_get_l2_table_request {")
1783 with q.group():
1784 with q.indent(2):
1785 q.breakable()
1786 q.text("xid = ");
1787 if self.xid != None:
1788 q.text("%#x" % self.xid)
1789 else:
1790 q.text('None')
1791 q.breakable()
1792 q.text('}')
1793
Rich Lane7dcdf022013-12-11 14:45:27 -08001794bsn_header.subtypes[13] = bsn_get_l2_table_request
1795
1796class bsn_get_mirroring_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001797 version = 1
1798 type = 4
1799 experimenter = 6035143
Rich Laneb658ddd2013-03-12 10:15:10 -07001800 subtype = 5
1801
Rich Lanec2ee4b82013-04-24 17:12:38 -07001802 def __init__(self, xid=None, report_mirror_ports=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001803 if xid != None:
1804 self.xid = xid
1805 else:
1806 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07001807 if report_mirror_ports != None:
1808 self.report_mirror_ports = report_mirror_ports
1809 else:
1810 self.report_mirror_ports = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08001811 return
Rich Laneb658ddd2013-03-12 10:15:10 -07001812
1813 def pack(self):
1814 packed = []
1815 packed.append(struct.pack("!B", self.version))
1816 packed.append(struct.pack("!B", self.type))
1817 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1818 packed.append(struct.pack("!L", self.xid))
1819 packed.append(struct.pack("!L", self.experimenter))
1820 packed.append(struct.pack("!L", self.subtype))
1821 packed.append(struct.pack("!B", self.report_mirror_ports))
Rich Lanec2ee4b82013-04-24 17:12:38 -07001822 packed.append('\x00' * 3)
Rich Laneb658ddd2013-03-12 10:15:10 -07001823 length = sum([len(x) for x in packed])
1824 packed[2] = struct.pack("!H", length)
1825 return ''.join(packed)
1826
1827 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001828 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07001829 obj = bsn_get_mirroring_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07001830 _version = reader.read("!B")[0]
1831 assert(_version == 1)
1832 _type = reader.read("!B")[0]
1833 assert(_type == 4)
1834 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001835 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001836 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07001837 obj.xid = reader.read("!L")[0]
1838 _experimenter = reader.read("!L")[0]
1839 assert(_experimenter == 6035143)
1840 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001841 assert(_subtype == 5)
Dan Talaycof6202252013-07-02 01:00:29 -07001842 obj.report_mirror_ports = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001843 reader.skip(3)
Rich Laneb658ddd2013-03-12 10:15:10 -07001844 return obj
1845
1846 def __eq__(self, other):
1847 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07001848 if self.xid != other.xid: return False
1849 if self.report_mirror_ports != other.report_mirror_ports: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07001850 return True
1851
Rich Laneb658ddd2013-03-12 10:15:10 -07001852 def pretty_print(self, q):
1853 q.text("bsn_get_mirroring_reply {")
1854 with q.group():
1855 with q.indent(2):
1856 q.breakable()
1857 q.text("xid = ");
1858 if self.xid != None:
1859 q.text("%#x" % self.xid)
1860 else:
1861 q.text('None')
1862 q.text(","); q.breakable()
1863 q.text("report_mirror_ports = ");
1864 q.text("%#x" % self.report_mirror_ports)
Rich Laneb658ddd2013-03-12 10:15:10 -07001865 q.breakable()
1866 q.text('}')
1867
Rich Lane7dcdf022013-12-11 14:45:27 -08001868bsn_header.subtypes[5] = bsn_get_mirroring_reply
1869
1870class bsn_get_mirroring_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07001871 version = 1
1872 type = 4
1873 experimenter = 6035143
Rich Laneb658ddd2013-03-12 10:15:10 -07001874 subtype = 4
1875
Rich Lanec2ee4b82013-04-24 17:12:38 -07001876 def __init__(self, xid=None, report_mirror_ports=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001877 if xid != None:
1878 self.xid = xid
1879 else:
1880 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07001881 if report_mirror_ports != None:
1882 self.report_mirror_ports = report_mirror_ports
1883 else:
1884 self.report_mirror_ports = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08001885 return
Rich Laneb658ddd2013-03-12 10:15:10 -07001886
1887 def pack(self):
1888 packed = []
1889 packed.append(struct.pack("!B", self.version))
1890 packed.append(struct.pack("!B", self.type))
1891 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1892 packed.append(struct.pack("!L", self.xid))
1893 packed.append(struct.pack("!L", self.experimenter))
1894 packed.append(struct.pack("!L", self.subtype))
1895 packed.append(struct.pack("!B", self.report_mirror_ports))
Rich Lanec2ee4b82013-04-24 17:12:38 -07001896 packed.append('\x00' * 3)
Rich Laneb658ddd2013-03-12 10:15:10 -07001897 length = sum([len(x) for x in packed])
1898 packed[2] = struct.pack("!H", length)
1899 return ''.join(packed)
1900
1901 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001902 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07001903 obj = bsn_get_mirroring_request()
Dan Talaycof6202252013-07-02 01:00:29 -07001904 _version = reader.read("!B")[0]
1905 assert(_version == 1)
1906 _type = reader.read("!B")[0]
1907 assert(_type == 4)
1908 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001909 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001910 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07001911 obj.xid = reader.read("!L")[0]
1912 _experimenter = reader.read("!L")[0]
1913 assert(_experimenter == 6035143)
1914 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001915 assert(_subtype == 4)
Dan Talaycof6202252013-07-02 01:00:29 -07001916 obj.report_mirror_ports = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001917 reader.skip(3)
Rich Laneb658ddd2013-03-12 10:15:10 -07001918 return obj
1919
1920 def __eq__(self, other):
1921 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07001922 if self.xid != other.xid: return False
1923 if self.report_mirror_ports != other.report_mirror_ports: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07001924 return True
1925
Rich Laneb658ddd2013-03-12 10:15:10 -07001926 def pretty_print(self, q):
1927 q.text("bsn_get_mirroring_request {")
1928 with q.group():
1929 with q.indent(2):
1930 q.breakable()
1931 q.text("xid = ");
1932 if self.xid != None:
1933 q.text("%#x" % self.xid)
1934 else:
1935 q.text('None')
1936 q.text(","); q.breakable()
1937 q.text("report_mirror_ports = ");
1938 q.text("%#x" % self.report_mirror_ports)
Rich Laneb658ddd2013-03-12 10:15:10 -07001939 q.breakable()
1940 q.text('}')
1941
Rich Lane7dcdf022013-12-11 14:45:27 -08001942bsn_header.subtypes[4] = bsn_get_mirroring_request
1943
1944class bsn_hybrid_get_reply(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07001945 version = 1
1946 type = 4
1947 experimenter = 6035143
1948 subtype = 28
1949
1950 def __init__(self, xid=None, hybrid_enable=None, hybrid_version=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08001951 if xid != None:
1952 self.xid = xid
1953 else:
1954 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07001955 if hybrid_enable != None:
1956 self.hybrid_enable = hybrid_enable
1957 else:
1958 self.hybrid_enable = 0
1959 if hybrid_version != None:
1960 self.hybrid_version = hybrid_version
1961 else:
1962 self.hybrid_version = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08001963 return
Rich Lane6f4978c2013-10-20 21:33:52 -07001964
1965 def pack(self):
1966 packed = []
1967 packed.append(struct.pack("!B", self.version))
1968 packed.append(struct.pack("!B", self.type))
1969 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1970 packed.append(struct.pack("!L", self.xid))
1971 packed.append(struct.pack("!L", self.experimenter))
1972 packed.append(struct.pack("!L", self.subtype))
1973 packed.append(struct.pack("!B", self.hybrid_enable))
1974 packed.append('\x00' * 1)
1975 packed.append(struct.pack("!H", self.hybrid_version))
1976 packed.append('\x00' * 4)
1977 length = sum([len(x) for x in packed])
1978 packed[2] = struct.pack("!H", length)
1979 return ''.join(packed)
1980
1981 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001982 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07001983 obj = bsn_hybrid_get_reply()
Rich Lane6f4978c2013-10-20 21:33:52 -07001984 _version = reader.read("!B")[0]
1985 assert(_version == 1)
1986 _type = reader.read("!B")[0]
1987 assert(_type == 4)
1988 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001989 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001990 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -07001991 obj.xid = reader.read("!L")[0]
1992 _experimenter = reader.read("!L")[0]
1993 assert(_experimenter == 6035143)
1994 _subtype = reader.read("!L")[0]
1995 assert(_subtype == 28)
1996 obj.hybrid_enable = reader.read("!B")[0]
1997 reader.skip(1)
1998 obj.hybrid_version = reader.read("!H")[0]
1999 reader.skip(4)
2000 return obj
2001
2002 def __eq__(self, other):
2003 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07002004 if self.xid != other.xid: return False
2005 if self.hybrid_enable != other.hybrid_enable: return False
2006 if self.hybrid_version != other.hybrid_version: return False
2007 return True
2008
Rich Lane6f4978c2013-10-20 21:33:52 -07002009 def pretty_print(self, q):
2010 q.text("bsn_hybrid_get_reply {")
2011 with q.group():
2012 with q.indent(2):
2013 q.breakable()
2014 q.text("xid = ");
2015 if self.xid != None:
2016 q.text("%#x" % self.xid)
2017 else:
2018 q.text('None')
2019 q.text(","); q.breakable()
2020 q.text("hybrid_enable = ");
2021 q.text("%#x" % self.hybrid_enable)
2022 q.text(","); q.breakable()
2023 q.text("hybrid_version = ");
2024 q.text("%#x" % self.hybrid_version)
2025 q.breakable()
2026 q.text('}')
2027
Rich Lane7dcdf022013-12-11 14:45:27 -08002028bsn_header.subtypes[28] = bsn_hybrid_get_reply
2029
2030class bsn_hybrid_get_request(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07002031 version = 1
2032 type = 4
2033 experimenter = 6035143
2034 subtype = 27
2035
2036 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002037 if xid != None:
2038 self.xid = xid
2039 else:
2040 self.xid = None
2041 return
Rich Lane6f4978c2013-10-20 21:33:52 -07002042
2043 def pack(self):
2044 packed = []
2045 packed.append(struct.pack("!B", self.version))
2046 packed.append(struct.pack("!B", self.type))
2047 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2048 packed.append(struct.pack("!L", self.xid))
2049 packed.append(struct.pack("!L", self.experimenter))
2050 packed.append(struct.pack("!L", self.subtype))
2051 length = sum([len(x) for x in packed])
2052 packed[2] = struct.pack("!H", length)
2053 return ''.join(packed)
2054
2055 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002056 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07002057 obj = bsn_hybrid_get_request()
Rich Lane6f4978c2013-10-20 21:33:52 -07002058 _version = reader.read("!B")[0]
2059 assert(_version == 1)
2060 _type = reader.read("!B")[0]
2061 assert(_type == 4)
2062 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002063 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002064 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -07002065 obj.xid = reader.read("!L")[0]
2066 _experimenter = reader.read("!L")[0]
2067 assert(_experimenter == 6035143)
2068 _subtype = reader.read("!L")[0]
2069 assert(_subtype == 27)
2070 return obj
2071
2072 def __eq__(self, other):
2073 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07002074 if self.xid != other.xid: return False
2075 return True
2076
Rich Lane6f4978c2013-10-20 21:33:52 -07002077 def pretty_print(self, q):
2078 q.text("bsn_hybrid_get_request {")
2079 with q.group():
2080 with q.indent(2):
2081 q.breakable()
2082 q.text("xid = ");
2083 if self.xid != None:
2084 q.text("%#x" % self.xid)
2085 else:
2086 q.text('None')
2087 q.breakable()
2088 q.text('}')
2089
Rich Lane7dcdf022013-12-11 14:45:27 -08002090bsn_header.subtypes[27] = bsn_hybrid_get_request
2091
2092class bsn_pdu_rx_reply(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07002093 version = 1
2094 type = 4
2095 experimenter = 6035143
2096 subtype = 34
2097
Rich Lane7b0f2012013-11-22 14:15:26 -08002098 def __init__(self, xid=None, status=None, port_no=None, slot_num=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002099 if xid != None:
2100 self.xid = xid
2101 else:
2102 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07002103 if status != None:
2104 self.status = status
2105 else:
2106 self.status = 0
Rich Lane7b0f2012013-11-22 14:15:26 -08002107 if port_no != None:
2108 self.port_no = port_no
2109 else:
2110 self.port_no = 0
2111 if slot_num != None:
2112 self.slot_num = slot_num
2113 else:
2114 self.slot_num = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08002115 return
Rich Lane6f4978c2013-10-20 21:33:52 -07002116
2117 def pack(self):
2118 packed = []
2119 packed.append(struct.pack("!B", self.version))
2120 packed.append(struct.pack("!B", self.type))
2121 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2122 packed.append(struct.pack("!L", self.xid))
2123 packed.append(struct.pack("!L", self.experimenter))
2124 packed.append(struct.pack("!L", self.subtype))
2125 packed.append(struct.pack("!L", self.status))
Rich Lane7b0f2012013-11-22 14:15:26 -08002126 packed.append(util.pack_port_no(self.port_no))
2127 packed.append(struct.pack("!B", self.slot_num))
Rich Lane6f4978c2013-10-20 21:33:52 -07002128 length = sum([len(x) for x in packed])
2129 packed[2] = struct.pack("!H", length)
2130 return ''.join(packed)
2131
2132 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002133 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07002134 obj = bsn_pdu_rx_reply()
Rich Lane6f4978c2013-10-20 21:33:52 -07002135 _version = reader.read("!B")[0]
2136 assert(_version == 1)
2137 _type = reader.read("!B")[0]
2138 assert(_type == 4)
2139 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002140 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002141 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -07002142 obj.xid = reader.read("!L")[0]
2143 _experimenter = reader.read("!L")[0]
2144 assert(_experimenter == 6035143)
2145 _subtype = reader.read("!L")[0]
2146 assert(_subtype == 34)
2147 obj.status = reader.read("!L")[0]
Rich Lane7b0f2012013-11-22 14:15:26 -08002148 obj.port_no = util.unpack_port_no(reader)
2149 obj.slot_num = reader.read("!B")[0]
Rich Lane6f4978c2013-10-20 21:33:52 -07002150 return obj
2151
2152 def __eq__(self, other):
2153 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07002154 if self.xid != other.xid: return False
2155 if self.status != other.status: return False
Rich Lane7b0f2012013-11-22 14:15:26 -08002156 if self.port_no != other.port_no: return False
2157 if self.slot_num != other.slot_num: return False
Rich Lane6f4978c2013-10-20 21:33:52 -07002158 return True
2159
Rich Lane6f4978c2013-10-20 21:33:52 -07002160 def pretty_print(self, q):
2161 q.text("bsn_pdu_rx_reply {")
2162 with q.group():
2163 with q.indent(2):
2164 q.breakable()
2165 q.text("xid = ");
2166 if self.xid != None:
2167 q.text("%#x" % self.xid)
2168 else:
2169 q.text('None')
2170 q.text(","); q.breakable()
2171 q.text("status = ");
2172 q.text("%#x" % self.status)
Rich Lane7b0f2012013-11-22 14:15:26 -08002173 q.text(","); q.breakable()
2174 q.text("port_no = ");
2175 q.text(util.pretty_port(self.port_no))
2176 q.text(","); q.breakable()
2177 q.text("slot_num = ");
2178 q.text("%#x" % self.slot_num)
Rich Lane6f4978c2013-10-20 21:33:52 -07002179 q.breakable()
2180 q.text('}')
2181
Rich Lane7dcdf022013-12-11 14:45:27 -08002182bsn_header.subtypes[34] = bsn_pdu_rx_reply
2183
2184class bsn_pdu_rx_request(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07002185 version = 1
2186 type = 4
2187 experimenter = 6035143
2188 subtype = 33
2189
2190 def __init__(self, xid=None, timeout_ms=None, port_no=None, slot_num=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002191 if xid != None:
2192 self.xid = xid
2193 else:
2194 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07002195 if timeout_ms != None:
2196 self.timeout_ms = timeout_ms
2197 else:
2198 self.timeout_ms = 0
2199 if port_no != None:
2200 self.port_no = port_no
2201 else:
2202 self.port_no = 0
2203 if slot_num != None:
2204 self.slot_num = slot_num
2205 else:
2206 self.slot_num = 0
2207 if data != None:
2208 self.data = data
2209 else:
2210 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08002211 return
Rich Lane6f4978c2013-10-20 21:33:52 -07002212
2213 def pack(self):
2214 packed = []
2215 packed.append(struct.pack("!B", self.version))
2216 packed.append(struct.pack("!B", self.type))
2217 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2218 packed.append(struct.pack("!L", self.xid))
2219 packed.append(struct.pack("!L", self.experimenter))
2220 packed.append(struct.pack("!L", self.subtype))
2221 packed.append(struct.pack("!L", self.timeout_ms))
2222 packed.append(util.pack_port_no(self.port_no))
2223 packed.append(struct.pack("!B", self.slot_num))
2224 packed.append('\x00' * 3)
2225 packed.append(self.data)
2226 length = sum([len(x) for x in packed])
2227 packed[2] = struct.pack("!H", length)
2228 return ''.join(packed)
2229
2230 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002231 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07002232 obj = bsn_pdu_rx_request()
Rich Lane6f4978c2013-10-20 21:33:52 -07002233 _version = reader.read("!B")[0]
2234 assert(_version == 1)
2235 _type = reader.read("!B")[0]
2236 assert(_type == 4)
2237 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002238 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002239 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -07002240 obj.xid = reader.read("!L")[0]
2241 _experimenter = reader.read("!L")[0]
2242 assert(_experimenter == 6035143)
2243 _subtype = reader.read("!L")[0]
2244 assert(_subtype == 33)
2245 obj.timeout_ms = reader.read("!L")[0]
2246 obj.port_no = util.unpack_port_no(reader)
2247 obj.slot_num = reader.read("!B")[0]
2248 reader.skip(3)
2249 obj.data = str(reader.read_all())
2250 return obj
2251
2252 def __eq__(self, other):
2253 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07002254 if self.xid != other.xid: return False
2255 if self.timeout_ms != other.timeout_ms: return False
2256 if self.port_no != other.port_no: return False
2257 if self.slot_num != other.slot_num: return False
2258 if self.data != other.data: return False
2259 return True
2260
Rich Lane6f4978c2013-10-20 21:33:52 -07002261 def pretty_print(self, q):
2262 q.text("bsn_pdu_rx_request {")
2263 with q.group():
2264 with q.indent(2):
2265 q.breakable()
2266 q.text("xid = ");
2267 if self.xid != None:
2268 q.text("%#x" % self.xid)
2269 else:
2270 q.text('None')
2271 q.text(","); q.breakable()
2272 q.text("timeout_ms = ");
2273 q.text("%#x" % self.timeout_ms)
2274 q.text(","); q.breakable()
2275 q.text("port_no = ");
2276 q.text(util.pretty_port(self.port_no))
2277 q.text(","); q.breakable()
2278 q.text("slot_num = ");
2279 q.text("%#x" % self.slot_num)
2280 q.text(","); q.breakable()
2281 q.text("data = ");
2282 q.pp(self.data)
2283 q.breakable()
2284 q.text('}')
2285
Rich Lane7dcdf022013-12-11 14:45:27 -08002286bsn_header.subtypes[33] = bsn_pdu_rx_request
2287
2288class bsn_pdu_rx_timeout(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07002289 version = 1
2290 type = 4
2291 experimenter = 6035143
2292 subtype = 35
2293
2294 def __init__(self, xid=None, port_no=None, slot_num=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002295 if xid != None:
2296 self.xid = xid
2297 else:
2298 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07002299 if port_no != None:
2300 self.port_no = port_no
2301 else:
2302 self.port_no = 0
2303 if slot_num != None:
2304 self.slot_num = slot_num
2305 else:
2306 self.slot_num = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08002307 return
Rich Lane6f4978c2013-10-20 21:33:52 -07002308
2309 def pack(self):
2310 packed = []
2311 packed.append(struct.pack("!B", self.version))
2312 packed.append(struct.pack("!B", self.type))
2313 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2314 packed.append(struct.pack("!L", self.xid))
2315 packed.append(struct.pack("!L", self.experimenter))
2316 packed.append(struct.pack("!L", self.subtype))
2317 packed.append(util.pack_port_no(self.port_no))
2318 packed.append(struct.pack("!B", self.slot_num))
2319 length = sum([len(x) for x in packed])
2320 packed[2] = struct.pack("!H", length)
2321 return ''.join(packed)
2322
2323 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002324 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07002325 obj = bsn_pdu_rx_timeout()
Rich Lane6f4978c2013-10-20 21:33:52 -07002326 _version = reader.read("!B")[0]
2327 assert(_version == 1)
2328 _type = reader.read("!B")[0]
2329 assert(_type == 4)
2330 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002331 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002332 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -07002333 obj.xid = reader.read("!L")[0]
2334 _experimenter = reader.read("!L")[0]
2335 assert(_experimenter == 6035143)
2336 _subtype = reader.read("!L")[0]
2337 assert(_subtype == 35)
2338 obj.port_no = util.unpack_port_no(reader)
2339 obj.slot_num = reader.read("!B")[0]
2340 return obj
2341
2342 def __eq__(self, other):
2343 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07002344 if self.xid != other.xid: return False
2345 if self.port_no != other.port_no: return False
2346 if self.slot_num != other.slot_num: return False
2347 return True
2348
Rich Lane6f4978c2013-10-20 21:33:52 -07002349 def pretty_print(self, q):
2350 q.text("bsn_pdu_rx_timeout {")
2351 with q.group():
2352 with q.indent(2):
2353 q.breakable()
2354 q.text("xid = ");
2355 if self.xid != None:
2356 q.text("%#x" % self.xid)
2357 else:
2358 q.text('None')
2359 q.text(","); q.breakable()
2360 q.text("port_no = ");
2361 q.text(util.pretty_port(self.port_no))
2362 q.text(","); q.breakable()
2363 q.text("slot_num = ");
2364 q.text("%#x" % self.slot_num)
2365 q.breakable()
2366 q.text('}')
2367
Rich Lane7dcdf022013-12-11 14:45:27 -08002368bsn_header.subtypes[35] = bsn_pdu_rx_timeout
2369
2370class bsn_pdu_tx_reply(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07002371 version = 1
2372 type = 4
2373 experimenter = 6035143
2374 subtype = 32
2375
Rich Lane7b0f2012013-11-22 14:15:26 -08002376 def __init__(self, xid=None, status=None, port_no=None, slot_num=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002377 if xid != None:
2378 self.xid = xid
2379 else:
2380 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07002381 if status != None:
2382 self.status = status
2383 else:
2384 self.status = 0
Rich Lane7b0f2012013-11-22 14:15:26 -08002385 if port_no != None:
2386 self.port_no = port_no
2387 else:
2388 self.port_no = 0
2389 if slot_num != None:
2390 self.slot_num = slot_num
2391 else:
2392 self.slot_num = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08002393 return
Rich Lane6f4978c2013-10-20 21:33:52 -07002394
2395 def pack(self):
2396 packed = []
2397 packed.append(struct.pack("!B", self.version))
2398 packed.append(struct.pack("!B", self.type))
2399 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2400 packed.append(struct.pack("!L", self.xid))
2401 packed.append(struct.pack("!L", self.experimenter))
2402 packed.append(struct.pack("!L", self.subtype))
2403 packed.append(struct.pack("!L", self.status))
Rich Lane7b0f2012013-11-22 14:15:26 -08002404 packed.append(util.pack_port_no(self.port_no))
2405 packed.append(struct.pack("!B", self.slot_num))
Rich Lane6f4978c2013-10-20 21:33:52 -07002406 length = sum([len(x) for x in packed])
2407 packed[2] = struct.pack("!H", length)
2408 return ''.join(packed)
2409
2410 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002411 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07002412 obj = bsn_pdu_tx_reply()
Rich Lane6f4978c2013-10-20 21:33:52 -07002413 _version = reader.read("!B")[0]
2414 assert(_version == 1)
2415 _type = reader.read("!B")[0]
2416 assert(_type == 4)
2417 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002418 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002419 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -07002420 obj.xid = reader.read("!L")[0]
2421 _experimenter = reader.read("!L")[0]
2422 assert(_experimenter == 6035143)
2423 _subtype = reader.read("!L")[0]
2424 assert(_subtype == 32)
2425 obj.status = reader.read("!L")[0]
Rich Lane7b0f2012013-11-22 14:15:26 -08002426 obj.port_no = util.unpack_port_no(reader)
2427 obj.slot_num = reader.read("!B")[0]
Rich Lane6f4978c2013-10-20 21:33:52 -07002428 return obj
2429
2430 def __eq__(self, other):
2431 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07002432 if self.xid != other.xid: return False
2433 if self.status != other.status: return False
Rich Lane7b0f2012013-11-22 14:15:26 -08002434 if self.port_no != other.port_no: return False
2435 if self.slot_num != other.slot_num: return False
Rich Lane6f4978c2013-10-20 21:33:52 -07002436 return True
2437
Rich Lane6f4978c2013-10-20 21:33:52 -07002438 def pretty_print(self, q):
2439 q.text("bsn_pdu_tx_reply {")
2440 with q.group():
2441 with q.indent(2):
2442 q.breakable()
2443 q.text("xid = ");
2444 if self.xid != None:
2445 q.text("%#x" % self.xid)
2446 else:
2447 q.text('None')
2448 q.text(","); q.breakable()
2449 q.text("status = ");
2450 q.text("%#x" % self.status)
Rich Lane7b0f2012013-11-22 14:15:26 -08002451 q.text(","); q.breakable()
2452 q.text("port_no = ");
2453 q.text(util.pretty_port(self.port_no))
2454 q.text(","); q.breakable()
2455 q.text("slot_num = ");
2456 q.text("%#x" % self.slot_num)
Rich Lane6f4978c2013-10-20 21:33:52 -07002457 q.breakable()
2458 q.text('}')
2459
Rich Lane7dcdf022013-12-11 14:45:27 -08002460bsn_header.subtypes[32] = bsn_pdu_tx_reply
2461
2462class bsn_pdu_tx_request(bsn_header):
Rich Lane6f4978c2013-10-20 21:33:52 -07002463 version = 1
2464 type = 4
2465 experimenter = 6035143
2466 subtype = 31
2467
2468 def __init__(self, xid=None, tx_interval_ms=None, port_no=None, slot_num=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002469 if xid != None:
2470 self.xid = xid
2471 else:
2472 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07002473 if tx_interval_ms != None:
2474 self.tx_interval_ms = tx_interval_ms
2475 else:
2476 self.tx_interval_ms = 0
2477 if port_no != None:
2478 self.port_no = port_no
2479 else:
2480 self.port_no = 0
2481 if slot_num != None:
2482 self.slot_num = slot_num
2483 else:
2484 self.slot_num = 0
2485 if data != None:
2486 self.data = data
2487 else:
2488 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08002489 return
Rich Lane6f4978c2013-10-20 21:33:52 -07002490
2491 def pack(self):
2492 packed = []
2493 packed.append(struct.pack("!B", self.version))
2494 packed.append(struct.pack("!B", self.type))
2495 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2496 packed.append(struct.pack("!L", self.xid))
2497 packed.append(struct.pack("!L", self.experimenter))
2498 packed.append(struct.pack("!L", self.subtype))
2499 packed.append(struct.pack("!L", self.tx_interval_ms))
2500 packed.append(util.pack_port_no(self.port_no))
2501 packed.append(struct.pack("!B", self.slot_num))
2502 packed.append('\x00' * 3)
2503 packed.append(self.data)
2504 length = sum([len(x) for x in packed])
2505 packed[2] = struct.pack("!H", length)
2506 return ''.join(packed)
2507
2508 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002509 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07002510 obj = bsn_pdu_tx_request()
Rich Lane6f4978c2013-10-20 21:33:52 -07002511 _version = reader.read("!B")[0]
2512 assert(_version == 1)
2513 _type = reader.read("!B")[0]
2514 assert(_type == 4)
2515 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002516 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002517 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -07002518 obj.xid = reader.read("!L")[0]
2519 _experimenter = reader.read("!L")[0]
2520 assert(_experimenter == 6035143)
2521 _subtype = reader.read("!L")[0]
2522 assert(_subtype == 31)
2523 obj.tx_interval_ms = reader.read("!L")[0]
2524 obj.port_no = util.unpack_port_no(reader)
2525 obj.slot_num = reader.read("!B")[0]
2526 reader.skip(3)
2527 obj.data = str(reader.read_all())
2528 return obj
2529
2530 def __eq__(self, other):
2531 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07002532 if self.xid != other.xid: return False
2533 if self.tx_interval_ms != other.tx_interval_ms: return False
2534 if self.port_no != other.port_no: return False
2535 if self.slot_num != other.slot_num: return False
2536 if self.data != other.data: return False
2537 return True
2538
Rich Lane6f4978c2013-10-20 21:33:52 -07002539 def pretty_print(self, q):
2540 q.text("bsn_pdu_tx_request {")
2541 with q.group():
2542 with q.indent(2):
2543 q.breakable()
2544 q.text("xid = ");
2545 if self.xid != None:
2546 q.text("%#x" % self.xid)
2547 else:
2548 q.text('None')
2549 q.text(","); q.breakable()
2550 q.text("tx_interval_ms = ");
2551 q.text("%#x" % self.tx_interval_ms)
2552 q.text(","); q.breakable()
2553 q.text("port_no = ");
2554 q.text(util.pretty_port(self.port_no))
2555 q.text(","); q.breakable()
2556 q.text("slot_num = ");
2557 q.text("%#x" % self.slot_num)
2558 q.text(","); q.breakable()
2559 q.text("data = ");
2560 q.pp(self.data)
2561 q.breakable()
2562 q.text('}')
2563
Rich Lane7dcdf022013-12-11 14:45:27 -08002564bsn_header.subtypes[31] = bsn_pdu_tx_request
2565
2566class bsn_set_ip_mask(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07002567 version = 1
2568 type = 4
2569 experimenter = 6035143
Rich Laneb658ddd2013-03-12 10:15:10 -07002570 subtype = 0
2571
Rich Lanec2ee4b82013-04-24 17:12:38 -07002572 def __init__(self, xid=None, index=None, mask=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002573 if xid != None:
2574 self.xid = xid
2575 else:
2576 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07002577 if index != None:
2578 self.index = index
2579 else:
2580 self.index = 0
Rich Laneb658ddd2013-03-12 10:15:10 -07002581 if mask != None:
2582 self.mask = mask
2583 else:
2584 self.mask = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08002585 return
Rich Laneb658ddd2013-03-12 10:15:10 -07002586
2587 def pack(self):
2588 packed = []
2589 packed.append(struct.pack("!B", self.version))
2590 packed.append(struct.pack("!B", self.type))
2591 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2592 packed.append(struct.pack("!L", self.xid))
2593 packed.append(struct.pack("!L", self.experimenter))
2594 packed.append(struct.pack("!L", self.subtype))
2595 packed.append(struct.pack("!B", self.index))
Rich Lanec2ee4b82013-04-24 17:12:38 -07002596 packed.append('\x00' * 3)
Rich Laneb658ddd2013-03-12 10:15:10 -07002597 packed.append(struct.pack("!L", self.mask))
2598 length = sum([len(x) for x in packed])
2599 packed[2] = struct.pack("!H", length)
2600 return ''.join(packed)
2601
2602 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002603 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07002604 obj = bsn_set_ip_mask()
Dan Talaycof6202252013-07-02 01:00:29 -07002605 _version = reader.read("!B")[0]
2606 assert(_version == 1)
2607 _type = reader.read("!B")[0]
2608 assert(_type == 4)
2609 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002610 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002611 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07002612 obj.xid = reader.read("!L")[0]
2613 _experimenter = reader.read("!L")[0]
2614 assert(_experimenter == 6035143)
2615 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07002616 assert(_subtype == 0)
Dan Talaycof6202252013-07-02 01:00:29 -07002617 obj.index = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07002618 reader.skip(3)
Dan Talaycof6202252013-07-02 01:00:29 -07002619 obj.mask = reader.read("!L")[0]
Rich Laneb658ddd2013-03-12 10:15:10 -07002620 return obj
2621
2622 def __eq__(self, other):
2623 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07002624 if self.xid != other.xid: return False
2625 if self.index != other.index: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07002626 if self.mask != other.mask: return False
2627 return True
2628
Rich Laneb658ddd2013-03-12 10:15:10 -07002629 def pretty_print(self, q):
2630 q.text("bsn_set_ip_mask {")
2631 with q.group():
2632 with q.indent(2):
2633 q.breakable()
2634 q.text("xid = ");
2635 if self.xid != None:
2636 q.text("%#x" % self.xid)
2637 else:
2638 q.text('None')
2639 q.text(","); q.breakable()
2640 q.text("index = ");
2641 q.text("%#x" % self.index)
2642 q.text(","); q.breakable()
Rich Laneb658ddd2013-03-12 10:15:10 -07002643 q.text("mask = ");
2644 q.text("%#x" % self.mask)
2645 q.breakable()
2646 q.text('}')
2647
Rich Lane7dcdf022013-12-11 14:45:27 -08002648bsn_header.subtypes[0] = bsn_set_ip_mask
2649
2650class bsn_set_l2_table_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07002651 version = 1
2652 type = 4
2653 experimenter = 6035143
2654 subtype = 24
2655
2656 def __init__(self, xid=None, l2_table_enable=None, l2_table_priority=None, status=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002657 if xid != None:
2658 self.xid = xid
2659 else:
2660 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07002661 if l2_table_enable != None:
2662 self.l2_table_enable = l2_table_enable
2663 else:
2664 self.l2_table_enable = 0
2665 if l2_table_priority != None:
2666 self.l2_table_priority = l2_table_priority
2667 else:
2668 self.l2_table_priority = 0
2669 if status != None:
2670 self.status = status
2671 else:
2672 self.status = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08002673 return
Dan Talaycof6202252013-07-02 01:00:29 -07002674
2675 def pack(self):
2676 packed = []
2677 packed.append(struct.pack("!B", self.version))
2678 packed.append(struct.pack("!B", self.type))
2679 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2680 packed.append(struct.pack("!L", self.xid))
2681 packed.append(struct.pack("!L", self.experimenter))
2682 packed.append(struct.pack("!L", self.subtype))
2683 packed.append(struct.pack("!B", self.l2_table_enable))
2684 packed.append('\x00' * 1)
2685 packed.append(struct.pack("!H", self.l2_table_priority))
2686 packed.append(struct.pack("!L", self.status))
2687 length = sum([len(x) for x in packed])
2688 packed[2] = struct.pack("!H", length)
2689 return ''.join(packed)
2690
2691 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002692 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07002693 obj = bsn_set_l2_table_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07002694 _version = reader.read("!B")[0]
2695 assert(_version == 1)
2696 _type = reader.read("!B")[0]
2697 assert(_type == 4)
2698 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002699 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002700 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07002701 obj.xid = reader.read("!L")[0]
2702 _experimenter = reader.read("!L")[0]
2703 assert(_experimenter == 6035143)
2704 _subtype = reader.read("!L")[0]
2705 assert(_subtype == 24)
2706 obj.l2_table_enable = reader.read("!B")[0]
2707 reader.skip(1)
2708 obj.l2_table_priority = reader.read("!H")[0]
2709 obj.status = reader.read("!L")[0]
2710 return obj
2711
2712 def __eq__(self, other):
2713 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07002714 if self.xid != other.xid: return False
2715 if self.l2_table_enable != other.l2_table_enable: return False
2716 if self.l2_table_priority != other.l2_table_priority: return False
2717 if self.status != other.status: return False
2718 return True
2719
Dan Talaycof6202252013-07-02 01:00:29 -07002720 def pretty_print(self, q):
2721 q.text("bsn_set_l2_table_reply {")
2722 with q.group():
2723 with q.indent(2):
2724 q.breakable()
2725 q.text("xid = ");
2726 if self.xid != None:
2727 q.text("%#x" % self.xid)
2728 else:
2729 q.text('None')
2730 q.text(","); q.breakable()
2731 q.text("l2_table_enable = ");
2732 q.text("%#x" % self.l2_table_enable)
2733 q.text(","); q.breakable()
2734 q.text("l2_table_priority = ");
2735 q.text("%#x" % self.l2_table_priority)
2736 q.text(","); q.breakable()
2737 q.text("status = ");
2738 q.text("%#x" % self.status)
2739 q.breakable()
2740 q.text('}')
2741
Rich Lane7dcdf022013-12-11 14:45:27 -08002742bsn_header.subtypes[24] = bsn_set_l2_table_reply
2743
2744class bsn_set_l2_table_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07002745 version = 1
2746 type = 4
2747 experimenter = 6035143
Rich Lane90c961c2013-05-14 09:26:50 -07002748 subtype = 12
2749
2750 def __init__(self, xid=None, l2_table_enable=None, l2_table_priority=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002751 if xid != None:
2752 self.xid = xid
2753 else:
2754 self.xid = None
Rich Lane90c961c2013-05-14 09:26:50 -07002755 if l2_table_enable != None:
2756 self.l2_table_enable = l2_table_enable
2757 else:
2758 self.l2_table_enable = 0
2759 if l2_table_priority != None:
2760 self.l2_table_priority = l2_table_priority
2761 else:
2762 self.l2_table_priority = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08002763 return
Rich Lane90c961c2013-05-14 09:26:50 -07002764
2765 def pack(self):
2766 packed = []
2767 packed.append(struct.pack("!B", self.version))
2768 packed.append(struct.pack("!B", self.type))
2769 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2770 packed.append(struct.pack("!L", self.xid))
2771 packed.append(struct.pack("!L", self.experimenter))
2772 packed.append(struct.pack("!L", self.subtype))
2773 packed.append(struct.pack("!B", self.l2_table_enable))
2774 packed.append('\x00' * 1)
2775 packed.append(struct.pack("!H", self.l2_table_priority))
2776 packed.append('\x00' * 4)
2777 length = sum([len(x) for x in packed])
2778 packed[2] = struct.pack("!H", length)
2779 return ''.join(packed)
2780
2781 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002782 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07002783 obj = bsn_set_l2_table_request()
Dan Talaycof6202252013-07-02 01:00:29 -07002784 _version = reader.read("!B")[0]
2785 assert(_version == 1)
2786 _type = reader.read("!B")[0]
2787 assert(_type == 4)
2788 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002789 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002790 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07002791 obj.xid = reader.read("!L")[0]
2792 _experimenter = reader.read("!L")[0]
2793 assert(_experimenter == 6035143)
2794 _subtype = reader.read("!L")[0]
Rich Lane90c961c2013-05-14 09:26:50 -07002795 assert(_subtype == 12)
Dan Talaycof6202252013-07-02 01:00:29 -07002796 obj.l2_table_enable = reader.read("!B")[0]
Rich Lane90c961c2013-05-14 09:26:50 -07002797 reader.skip(1)
Dan Talaycof6202252013-07-02 01:00:29 -07002798 obj.l2_table_priority = reader.read("!H")[0]
Rich Lane90c961c2013-05-14 09:26:50 -07002799 reader.skip(4)
2800 return obj
2801
2802 def __eq__(self, other):
2803 if type(self) != type(other): return False
Rich Lane90c961c2013-05-14 09:26:50 -07002804 if self.xid != other.xid: return False
2805 if self.l2_table_enable != other.l2_table_enable: return False
2806 if self.l2_table_priority != other.l2_table_priority: return False
2807 return True
2808
Rich Lane90c961c2013-05-14 09:26:50 -07002809 def pretty_print(self, q):
Dan Talaycof6202252013-07-02 01:00:29 -07002810 q.text("bsn_set_l2_table_request {")
Rich Lane90c961c2013-05-14 09:26:50 -07002811 with q.group():
2812 with q.indent(2):
2813 q.breakable()
2814 q.text("xid = ");
2815 if self.xid != None:
2816 q.text("%#x" % self.xid)
2817 else:
2818 q.text('None')
2819 q.text(","); q.breakable()
2820 q.text("l2_table_enable = ");
2821 q.text("%#x" % self.l2_table_enable)
2822 q.text(","); q.breakable()
2823 q.text("l2_table_priority = ");
2824 q.text("%#x" % self.l2_table_priority)
2825 q.breakable()
2826 q.text('}')
2827
Rich Lane7dcdf022013-12-11 14:45:27 -08002828bsn_header.subtypes[12] = bsn_set_l2_table_request
2829
2830class bsn_set_mirroring(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07002831 version = 1
2832 type = 4
2833 experimenter = 6035143
Rich Laneb658ddd2013-03-12 10:15:10 -07002834 subtype = 3
2835
Rich Lanec2ee4b82013-04-24 17:12:38 -07002836 def __init__(self, xid=None, report_mirror_ports=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002837 if xid != None:
2838 self.xid = xid
2839 else:
2840 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07002841 if report_mirror_ports != None:
2842 self.report_mirror_ports = report_mirror_ports
2843 else:
2844 self.report_mirror_ports = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08002845 return
Rich Laneb658ddd2013-03-12 10:15:10 -07002846
2847 def pack(self):
2848 packed = []
2849 packed.append(struct.pack("!B", self.version))
2850 packed.append(struct.pack("!B", self.type))
2851 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2852 packed.append(struct.pack("!L", self.xid))
2853 packed.append(struct.pack("!L", self.experimenter))
2854 packed.append(struct.pack("!L", self.subtype))
2855 packed.append(struct.pack("!B", self.report_mirror_ports))
Rich Lanec2ee4b82013-04-24 17:12:38 -07002856 packed.append('\x00' * 3)
Rich Laneb658ddd2013-03-12 10:15:10 -07002857 length = sum([len(x) for x in packed])
2858 packed[2] = struct.pack("!H", length)
2859 return ''.join(packed)
2860
2861 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002862 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07002863 obj = bsn_set_mirroring()
Dan Talaycof6202252013-07-02 01:00:29 -07002864 _version = reader.read("!B")[0]
2865 assert(_version == 1)
2866 _type = reader.read("!B")[0]
2867 assert(_type == 4)
2868 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002869 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002870 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07002871 obj.xid = reader.read("!L")[0]
2872 _experimenter = reader.read("!L")[0]
2873 assert(_experimenter == 6035143)
2874 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07002875 assert(_subtype == 3)
Dan Talaycof6202252013-07-02 01:00:29 -07002876 obj.report_mirror_ports = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07002877 reader.skip(3)
Rich Laneb658ddd2013-03-12 10:15:10 -07002878 return obj
2879
2880 def __eq__(self, other):
2881 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07002882 if self.xid != other.xid: return False
2883 if self.report_mirror_ports != other.report_mirror_ports: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07002884 return True
2885
Rich Laneb658ddd2013-03-12 10:15:10 -07002886 def pretty_print(self, q):
2887 q.text("bsn_set_mirroring {")
2888 with q.group():
2889 with q.indent(2):
2890 q.breakable()
2891 q.text("xid = ");
2892 if self.xid != None:
2893 q.text("%#x" % self.xid)
2894 else:
2895 q.text('None')
2896 q.text(","); q.breakable()
2897 q.text("report_mirror_ports = ");
2898 q.text("%#x" % self.report_mirror_ports)
Rich Lanec2ee4b82013-04-24 17:12:38 -07002899 q.breakable()
2900 q.text('}')
2901
Rich Lane7dcdf022013-12-11 14:45:27 -08002902bsn_header.subtypes[3] = bsn_set_mirroring
2903
2904class bsn_set_pktin_suppression_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07002905 version = 1
2906 type = 4
2907 experimenter = 6035143
2908 subtype = 25
2909
2910 def __init__(self, xid=None, status=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002911 if xid != None:
2912 self.xid = xid
2913 else:
2914 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07002915 if status != None:
2916 self.status = status
2917 else:
2918 self.status = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08002919 return
Dan Talaycof6202252013-07-02 01:00:29 -07002920
2921 def pack(self):
2922 packed = []
2923 packed.append(struct.pack("!B", self.version))
2924 packed.append(struct.pack("!B", self.type))
2925 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2926 packed.append(struct.pack("!L", self.xid))
2927 packed.append(struct.pack("!L", self.experimenter))
2928 packed.append(struct.pack("!L", self.subtype))
2929 packed.append(struct.pack("!L", self.status))
2930 length = sum([len(x) for x in packed])
2931 packed[2] = struct.pack("!H", length)
2932 return ''.join(packed)
2933
2934 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002935 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07002936 obj = bsn_set_pktin_suppression_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07002937 _version = reader.read("!B")[0]
2938 assert(_version == 1)
2939 _type = reader.read("!B")[0]
2940 assert(_type == 4)
2941 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002942 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002943 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07002944 obj.xid = reader.read("!L")[0]
2945 _experimenter = reader.read("!L")[0]
2946 assert(_experimenter == 6035143)
2947 _subtype = reader.read("!L")[0]
2948 assert(_subtype == 25)
2949 obj.status = reader.read("!L")[0]
2950 return obj
2951
2952 def __eq__(self, other):
2953 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07002954 if self.xid != other.xid: return False
2955 if self.status != other.status: return False
2956 return True
2957
Dan Talaycof6202252013-07-02 01:00:29 -07002958 def pretty_print(self, q):
2959 q.text("bsn_set_pktin_suppression_reply {")
2960 with q.group():
2961 with q.indent(2):
2962 q.breakable()
2963 q.text("xid = ");
2964 if self.xid != None:
2965 q.text("%#x" % self.xid)
2966 else:
2967 q.text('None')
2968 q.text(","); q.breakable()
2969 q.text("status = ");
2970 q.text("%#x" % self.status)
2971 q.breakable()
2972 q.text('}')
2973
Rich Lane7dcdf022013-12-11 14:45:27 -08002974bsn_header.subtypes[25] = bsn_set_pktin_suppression_reply
2975
2976class bsn_set_pktin_suppression_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07002977 version = 1
2978 type = 4
2979 experimenter = 6035143
Rich Lanec2ee4b82013-04-24 17:12:38 -07002980 subtype = 11
2981
2982 def __init__(self, xid=None, enabled=None, idle_timeout=None, hard_timeout=None, priority=None, cookie=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08002983 if xid != None:
2984 self.xid = xid
2985 else:
2986 self.xid = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07002987 if enabled != None:
2988 self.enabled = enabled
2989 else:
2990 self.enabled = 0
2991 if idle_timeout != None:
2992 self.idle_timeout = idle_timeout
2993 else:
2994 self.idle_timeout = 0
2995 if hard_timeout != None:
2996 self.hard_timeout = hard_timeout
2997 else:
2998 self.hard_timeout = 0
2999 if priority != None:
3000 self.priority = priority
3001 else:
3002 self.priority = 0
3003 if cookie != None:
3004 self.cookie = cookie
3005 else:
3006 self.cookie = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08003007 return
Rich Lanec2ee4b82013-04-24 17:12:38 -07003008
3009 def pack(self):
3010 packed = []
3011 packed.append(struct.pack("!B", self.version))
3012 packed.append(struct.pack("!B", self.type))
3013 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3014 packed.append(struct.pack("!L", self.xid))
3015 packed.append(struct.pack("!L", self.experimenter))
3016 packed.append(struct.pack("!L", self.subtype))
3017 packed.append(struct.pack("!B", self.enabled))
3018 packed.append('\x00' * 1)
3019 packed.append(struct.pack("!H", self.idle_timeout))
3020 packed.append(struct.pack("!H", self.hard_timeout))
3021 packed.append(struct.pack("!H", self.priority))
3022 packed.append(struct.pack("!Q", self.cookie))
3023 length = sum([len(x) for x in packed])
3024 packed[2] = struct.pack("!H", length)
3025 return ''.join(packed)
3026
3027 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003028 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07003029 obj = bsn_set_pktin_suppression_request()
Dan Talaycof6202252013-07-02 01:00:29 -07003030 _version = reader.read("!B")[0]
3031 assert(_version == 1)
3032 _type = reader.read("!B")[0]
3033 assert(_type == 4)
3034 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003035 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003036 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07003037 obj.xid = reader.read("!L")[0]
3038 _experimenter = reader.read("!L")[0]
3039 assert(_experimenter == 6035143)
3040 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07003041 assert(_subtype == 11)
Dan Talaycof6202252013-07-02 01:00:29 -07003042 obj.enabled = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07003043 reader.skip(1)
Dan Talaycof6202252013-07-02 01:00:29 -07003044 obj.idle_timeout = reader.read("!H")[0]
3045 obj.hard_timeout = reader.read("!H")[0]
3046 obj.priority = reader.read("!H")[0]
3047 obj.cookie = reader.read("!Q")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07003048 return obj
3049
3050 def __eq__(self, other):
3051 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07003052 if self.xid != other.xid: return False
3053 if self.enabled != other.enabled: return False
3054 if self.idle_timeout != other.idle_timeout: return False
3055 if self.hard_timeout != other.hard_timeout: return False
3056 if self.priority != other.priority: return False
3057 if self.cookie != other.cookie: return False
3058 return True
3059
Rich Lanec2ee4b82013-04-24 17:12:38 -07003060 def pretty_print(self, q):
Dan Talaycof6202252013-07-02 01:00:29 -07003061 q.text("bsn_set_pktin_suppression_request {")
Rich Lanec2ee4b82013-04-24 17:12:38 -07003062 with q.group():
3063 with q.indent(2):
3064 q.breakable()
3065 q.text("xid = ");
3066 if self.xid != None:
3067 q.text("%#x" % self.xid)
3068 else:
3069 q.text('None')
Rich Laneb658ddd2013-03-12 10:15:10 -07003070 q.text(","); q.breakable()
Rich Lanec2ee4b82013-04-24 17:12:38 -07003071 q.text("enabled = ");
3072 q.text("%#x" % self.enabled)
3073 q.text(","); q.breakable()
3074 q.text("idle_timeout = ");
3075 q.text("%#x" % self.idle_timeout)
3076 q.text(","); q.breakable()
3077 q.text("hard_timeout = ");
3078 q.text("%#x" % self.hard_timeout)
3079 q.text(","); q.breakable()
3080 q.text("priority = ");
3081 q.text("%#x" % self.priority)
3082 q.text(","); q.breakable()
3083 q.text("cookie = ");
3084 q.text("%#x" % self.cookie)
Rich Laneb658ddd2013-03-12 10:15:10 -07003085 q.breakable()
3086 q.text('}')
3087
Rich Lane7dcdf022013-12-11 14:45:27 -08003088bsn_header.subtypes[11] = bsn_set_pktin_suppression_request
3089
3090class bsn_shell_command(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07003091 version = 1
3092 type = 4
3093 experimenter = 6035143
Rich Laneb658ddd2013-03-12 10:15:10 -07003094 subtype = 6
3095
3096 def __init__(self, xid=None, service=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08003097 if xid != None:
3098 self.xid = xid
3099 else:
3100 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07003101 if service != None:
3102 self.service = service
3103 else:
3104 self.service = 0
3105 if data != None:
3106 self.data = data
3107 else:
Dan Talaycof6202252013-07-02 01:00:29 -07003108 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08003109 return
Rich Laneb658ddd2013-03-12 10:15:10 -07003110
3111 def pack(self):
3112 packed = []
3113 packed.append(struct.pack("!B", self.version))
3114 packed.append(struct.pack("!B", self.type))
3115 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3116 packed.append(struct.pack("!L", self.xid))
3117 packed.append(struct.pack("!L", self.experimenter))
3118 packed.append(struct.pack("!L", self.subtype))
3119 packed.append(struct.pack("!L", self.service))
3120 packed.append(self.data)
3121 length = sum([len(x) for x in packed])
3122 packed[2] = struct.pack("!H", length)
3123 return ''.join(packed)
3124
3125 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003126 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07003127 obj = bsn_shell_command()
Dan Talaycof6202252013-07-02 01:00:29 -07003128 _version = reader.read("!B")[0]
3129 assert(_version == 1)
3130 _type = reader.read("!B")[0]
3131 assert(_type == 4)
3132 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003133 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003134 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07003135 obj.xid = reader.read("!L")[0]
3136 _experimenter = reader.read("!L")[0]
3137 assert(_experimenter == 6035143)
3138 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07003139 assert(_subtype == 6)
Dan Talaycof6202252013-07-02 01:00:29 -07003140 obj.service = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07003141 obj.data = str(reader.read_all())
Rich Laneb658ddd2013-03-12 10:15:10 -07003142 return obj
3143
3144 def __eq__(self, other):
3145 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07003146 if self.xid != other.xid: return False
3147 if self.service != other.service: return False
3148 if self.data != other.data: return False
3149 return True
3150
Rich Laneb658ddd2013-03-12 10:15:10 -07003151 def pretty_print(self, q):
3152 q.text("bsn_shell_command {")
3153 with q.group():
3154 with q.indent(2):
3155 q.breakable()
3156 q.text("xid = ");
3157 if self.xid != None:
3158 q.text("%#x" % self.xid)
3159 else:
3160 q.text('None')
3161 q.text(","); q.breakable()
3162 q.text("service = ");
3163 q.text("%#x" % self.service)
3164 q.text(","); q.breakable()
3165 q.text("data = ");
3166 q.pp(self.data)
3167 q.breakable()
3168 q.text('}')
3169
Rich Lane7dcdf022013-12-11 14:45:27 -08003170bsn_header.subtypes[6] = bsn_shell_command
3171
3172class bsn_shell_output(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07003173 version = 1
3174 type = 4
3175 experimenter = 6035143
Rich Laneb658ddd2013-03-12 10:15:10 -07003176 subtype = 7
3177
3178 def __init__(self, xid=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08003179 if xid != None:
3180 self.xid = xid
3181 else:
3182 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07003183 if data != None:
3184 self.data = data
3185 else:
Dan Talaycof6202252013-07-02 01:00:29 -07003186 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08003187 return
Rich Laneb658ddd2013-03-12 10:15:10 -07003188
3189 def pack(self):
3190 packed = []
3191 packed.append(struct.pack("!B", self.version))
3192 packed.append(struct.pack("!B", self.type))
3193 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3194 packed.append(struct.pack("!L", self.xid))
3195 packed.append(struct.pack("!L", self.experimenter))
3196 packed.append(struct.pack("!L", self.subtype))
3197 packed.append(self.data)
3198 length = sum([len(x) for x in packed])
3199 packed[2] = struct.pack("!H", length)
3200 return ''.join(packed)
3201
3202 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003203 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07003204 obj = bsn_shell_output()
Dan Talaycof6202252013-07-02 01:00:29 -07003205 _version = reader.read("!B")[0]
3206 assert(_version == 1)
3207 _type = reader.read("!B")[0]
3208 assert(_type == 4)
3209 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003210 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003211 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07003212 obj.xid = reader.read("!L")[0]
3213 _experimenter = reader.read("!L")[0]
3214 assert(_experimenter == 6035143)
3215 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07003216 assert(_subtype == 7)
3217 obj.data = str(reader.read_all())
Rich Laneb658ddd2013-03-12 10:15:10 -07003218 return obj
3219
3220 def __eq__(self, other):
3221 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07003222 if self.xid != other.xid: return False
3223 if self.data != other.data: return False
3224 return True
3225
Rich Laneb658ddd2013-03-12 10:15:10 -07003226 def pretty_print(self, q):
3227 q.text("bsn_shell_output {")
3228 with q.group():
3229 with q.indent(2):
3230 q.breakable()
3231 q.text("xid = ");
3232 if self.xid != None:
3233 q.text("%#x" % self.xid)
3234 else:
3235 q.text('None')
3236 q.text(","); q.breakable()
3237 q.text("data = ");
3238 q.pp(self.data)
3239 q.breakable()
3240 q.text('}')
3241
Rich Lane7dcdf022013-12-11 14:45:27 -08003242bsn_header.subtypes[7] = bsn_shell_output
3243
3244class bsn_shell_status(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07003245 version = 1
3246 type = 4
3247 experimenter = 6035143
Rich Laneb658ddd2013-03-12 10:15:10 -07003248 subtype = 8
3249
3250 def __init__(self, xid=None, status=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08003251 if xid != None:
3252 self.xid = xid
3253 else:
3254 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07003255 if status != None:
3256 self.status = status
3257 else:
3258 self.status = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08003259 return
Rich Laneb658ddd2013-03-12 10:15:10 -07003260
3261 def pack(self):
3262 packed = []
3263 packed.append(struct.pack("!B", self.version))
3264 packed.append(struct.pack("!B", self.type))
3265 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3266 packed.append(struct.pack("!L", self.xid))
3267 packed.append(struct.pack("!L", self.experimenter))
3268 packed.append(struct.pack("!L", self.subtype))
3269 packed.append(struct.pack("!L", self.status))
3270 length = sum([len(x) for x in packed])
3271 packed[2] = struct.pack("!H", length)
3272 return ''.join(packed)
3273
3274 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003275 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07003276 obj = bsn_shell_status()
Dan Talaycof6202252013-07-02 01:00:29 -07003277 _version = reader.read("!B")[0]
3278 assert(_version == 1)
3279 _type = reader.read("!B")[0]
3280 assert(_type == 4)
3281 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003282 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003283 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07003284 obj.xid = reader.read("!L")[0]
3285 _experimenter = reader.read("!L")[0]
3286 assert(_experimenter == 6035143)
3287 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07003288 assert(_subtype == 8)
Dan Talaycof6202252013-07-02 01:00:29 -07003289 obj.status = reader.read("!L")[0]
Rich Laneb658ddd2013-03-12 10:15:10 -07003290 return obj
3291
3292 def __eq__(self, other):
3293 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07003294 if self.xid != other.xid: return False
3295 if self.status != other.status: return False
3296 return True
3297
Rich Laneb658ddd2013-03-12 10:15:10 -07003298 def pretty_print(self, q):
3299 q.text("bsn_shell_status {")
3300 with q.group():
3301 with q.indent(2):
3302 q.breakable()
3303 q.text("xid = ");
3304 if self.xid != None:
3305 q.text("%#x" % self.xid)
3306 else:
3307 q.text('None')
3308 q.text(","); q.breakable()
3309 q.text("status = ");
3310 q.text("%#x" % self.status)
3311 q.breakable()
3312 q.text('}')
3313
Rich Lane7dcdf022013-12-11 14:45:27 -08003314bsn_header.subtypes[8] = bsn_shell_status
3315
3316class experimenter_stats_reply(stats_reply):
3317 subtypes = {}
3318
Rich Lane95f7fc92014-01-27 17:08:16 -08003319 version = 1
3320 type = 17
3321 stats_type = 65535
3322
3323 def __init__(self, xid=None, flags=None, experimenter=None, data=None):
3324 if xid != None:
3325 self.xid = xid
3326 else:
3327 self.xid = None
3328 if flags != None:
3329 self.flags = flags
3330 else:
3331 self.flags = 0
3332 if experimenter != None:
3333 self.experimenter = experimenter
3334 else:
3335 self.experimenter = 0
3336 if data != None:
3337 self.data = data
3338 else:
3339 self.data = ''
3340 return
3341
3342 def pack(self):
3343 packed = []
3344 packed.append(struct.pack("!B", self.version))
3345 packed.append(struct.pack("!B", self.type))
3346 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3347 packed.append(struct.pack("!L", self.xid))
3348 packed.append(struct.pack("!H", self.stats_type))
3349 packed.append(struct.pack("!H", self.flags))
3350 packed.append(struct.pack("!L", self.experimenter))
3351 packed.append(self.data)
3352 length = sum([len(x) for x in packed])
3353 packed[2] = struct.pack("!H", length)
3354 return ''.join(packed)
3355
Rich Lane7dcdf022013-12-11 14:45:27 -08003356 @staticmethod
3357 def unpack(reader):
3358 subtype, = reader.peek('!L', 12)
Rich Lane95f7fc92014-01-27 17:08:16 -08003359 subclass = experimenter_stats_reply.subtypes.get(subtype)
3360 if subclass:
3361 return subclass.unpack(reader)
3362
3363 obj = experimenter_stats_reply()
3364 _version = reader.read("!B")[0]
3365 assert(_version == 1)
3366 _type = reader.read("!B")[0]
3367 assert(_type == 17)
3368 _length = reader.read("!H")[0]
3369 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003370 reader = orig_reader.slice(_length, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -08003371 obj.xid = reader.read("!L")[0]
3372 _stats_type = reader.read("!H")[0]
3373 assert(_stats_type == 65535)
3374 obj.flags = reader.read("!H")[0]
3375 obj.experimenter = reader.read("!L")[0]
3376 obj.data = str(reader.read_all())
3377 return obj
3378
3379 def __eq__(self, other):
3380 if type(self) != type(other): return False
3381 if self.xid != other.xid: return False
3382 if self.flags != other.flags: return False
3383 if self.experimenter != other.experimenter: return False
3384 if self.data != other.data: return False
3385 return True
3386
3387 def pretty_print(self, q):
3388 q.text("experimenter_stats_reply {")
3389 with q.group():
3390 with q.indent(2):
3391 q.breakable()
3392 q.text("xid = ");
3393 if self.xid != None:
3394 q.text("%#x" % self.xid)
3395 else:
3396 q.text('None')
3397 q.text(","); q.breakable()
3398 q.text("flags = ");
3399 q.text("%#x" % self.flags)
3400 q.text(","); q.breakable()
3401 q.text("data = ");
3402 q.pp(self.data)
3403 q.breakable()
3404 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -08003405
3406stats_reply.subtypes[65535] = experimenter_stats_reply
3407
3408class bsn_stats_reply(experimenter_stats_reply):
3409 subtypes = {}
3410
Rich Lane95f7fc92014-01-27 17:08:16 -08003411 version = 1
3412 type = 19
3413 stats_type = 65535
3414 experimenter = 6035143
3415
3416 def __init__(self, xid=None, flags=None, subtype=None):
3417 if xid != None:
3418 self.xid = xid
3419 else:
3420 self.xid = None
3421 if flags != None:
3422 self.flags = flags
3423 else:
3424 self.flags = 0
3425 if subtype != None:
3426 self.subtype = subtype
3427 else:
3428 self.subtype = 0
3429 return
3430
3431 def pack(self):
3432 packed = []
3433 packed.append(struct.pack("!B", self.version))
3434 packed.append(struct.pack("!B", self.type))
3435 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3436 packed.append(struct.pack("!L", self.xid))
3437 packed.append(struct.pack("!H", self.stats_type))
3438 packed.append(struct.pack("!H", self.flags))
3439 packed.append('\x00' * 4)
3440 packed.append(struct.pack("!L", self.experimenter))
3441 packed.append(struct.pack("!L", self.subtype))
3442 length = sum([len(x) for x in packed])
3443 packed[2] = struct.pack("!H", length)
3444 return ''.join(packed)
3445
Rich Lane7dcdf022013-12-11 14:45:27 -08003446 @staticmethod
3447 def unpack(reader):
3448 subtype, = reader.peek('!L', 20)
Rich Lane95f7fc92014-01-27 17:08:16 -08003449 subclass = bsn_stats_reply.subtypes.get(subtype)
3450 if subclass:
3451 return subclass.unpack(reader)
3452
3453 obj = bsn_stats_reply()
3454 _version = reader.read("!B")[0]
3455 assert(_version == 1)
3456 _type = reader.read("!B")[0]
3457 assert(_type == 19)
3458 _length = reader.read("!H")[0]
3459 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003460 reader = orig_reader.slice(_length, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -08003461 obj.xid = reader.read("!L")[0]
3462 _stats_type = reader.read("!H")[0]
3463 assert(_stats_type == 65535)
3464 obj.flags = reader.read("!H")[0]
3465 reader.skip(4)
3466 _experimenter = reader.read("!L")[0]
3467 assert(_experimenter == 6035143)
3468 obj.subtype = reader.read("!L")[0]
3469 return obj
3470
3471 def __eq__(self, other):
3472 if type(self) != type(other): return False
3473 if self.xid != other.xid: return False
3474 if self.flags != other.flags: return False
3475 if self.subtype != other.subtype: return False
3476 return True
3477
3478 def pretty_print(self, q):
3479 q.text("bsn_stats_reply {")
3480 with q.group():
3481 with q.indent(2):
3482 q.breakable()
3483 q.text("xid = ");
3484 if self.xid != None:
3485 q.text("%#x" % self.xid)
3486 else:
3487 q.text('None')
3488 q.text(","); q.breakable()
3489 q.text("flags = ");
3490 q.text("%#x" % self.flags)
3491 q.breakable()
3492 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -08003493
3494experimenter_stats_reply.subtypes[6035143] = bsn_stats_reply
3495
3496class experimenter_stats_request(stats_request):
3497 subtypes = {}
3498
Rich Lane95f7fc92014-01-27 17:08:16 -08003499 version = 1
3500 type = 16
3501 stats_type = 65535
3502
3503 def __init__(self, xid=None, flags=None, experimenter=None, data=None):
3504 if xid != None:
3505 self.xid = xid
3506 else:
3507 self.xid = None
3508 if flags != None:
3509 self.flags = flags
3510 else:
3511 self.flags = 0
3512 if experimenter != None:
3513 self.experimenter = experimenter
3514 else:
3515 self.experimenter = 0
3516 if data != None:
3517 self.data = data
3518 else:
3519 self.data = ''
3520 return
3521
3522 def pack(self):
3523 packed = []
3524 packed.append(struct.pack("!B", self.version))
3525 packed.append(struct.pack("!B", self.type))
3526 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3527 packed.append(struct.pack("!L", self.xid))
3528 packed.append(struct.pack("!H", self.stats_type))
3529 packed.append(struct.pack("!H", self.flags))
3530 packed.append(struct.pack("!L", self.experimenter))
3531 packed.append(self.data)
3532 length = sum([len(x) for x in packed])
3533 packed[2] = struct.pack("!H", length)
3534 return ''.join(packed)
3535
Rich Lane7dcdf022013-12-11 14:45:27 -08003536 @staticmethod
3537 def unpack(reader):
3538 subtype, = reader.peek('!L', 12)
Rich Lane95f7fc92014-01-27 17:08:16 -08003539 subclass = experimenter_stats_request.subtypes.get(subtype)
3540 if subclass:
3541 return subclass.unpack(reader)
3542
3543 obj = experimenter_stats_request()
3544 _version = reader.read("!B")[0]
3545 assert(_version == 1)
3546 _type = reader.read("!B")[0]
3547 assert(_type == 16)
3548 _length = reader.read("!H")[0]
3549 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003550 reader = orig_reader.slice(_length, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -08003551 obj.xid = reader.read("!L")[0]
3552 _stats_type = reader.read("!H")[0]
3553 assert(_stats_type == 65535)
3554 obj.flags = reader.read("!H")[0]
3555 obj.experimenter = reader.read("!L")[0]
3556 obj.data = str(reader.read_all())
3557 return obj
3558
3559 def __eq__(self, other):
3560 if type(self) != type(other): return False
3561 if self.xid != other.xid: return False
3562 if self.flags != other.flags: return False
3563 if self.experimenter != other.experimenter: return False
3564 if self.data != other.data: return False
3565 return True
3566
3567 def pretty_print(self, q):
3568 q.text("experimenter_stats_request {")
3569 with q.group():
3570 with q.indent(2):
3571 q.breakable()
3572 q.text("xid = ");
3573 if self.xid != None:
3574 q.text("%#x" % self.xid)
3575 else:
3576 q.text('None')
3577 q.text(","); q.breakable()
3578 q.text("flags = ");
3579 q.text("%#x" % self.flags)
3580 q.text(","); q.breakable()
3581 q.text("data = ");
3582 q.pp(self.data)
3583 q.breakable()
3584 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -08003585
3586stats_request.subtypes[65535] = experimenter_stats_request
3587
3588class bsn_stats_request(experimenter_stats_request):
3589 subtypes = {}
3590
Rich Lane95f7fc92014-01-27 17:08:16 -08003591 version = 1
3592 type = 18
3593 stats_type = 65535
3594 experimenter = 6035143
3595
3596 def __init__(self, xid=None, flags=None, subtype=None):
3597 if xid != None:
3598 self.xid = xid
3599 else:
3600 self.xid = None
3601 if flags != None:
3602 self.flags = flags
3603 else:
3604 self.flags = 0
3605 if subtype != None:
3606 self.subtype = subtype
3607 else:
3608 self.subtype = 0
3609 return
3610
3611 def pack(self):
3612 packed = []
3613 packed.append(struct.pack("!B", self.version))
3614 packed.append(struct.pack("!B", self.type))
3615 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3616 packed.append(struct.pack("!L", self.xid))
3617 packed.append(struct.pack("!H", self.stats_type))
3618 packed.append(struct.pack("!H", self.flags))
3619 packed.append('\x00' * 4)
3620 packed.append(struct.pack("!L", self.experimenter))
3621 packed.append(struct.pack("!L", self.subtype))
3622 length = sum([len(x) for x in packed])
3623 packed[2] = struct.pack("!H", length)
3624 return ''.join(packed)
3625
Rich Lane7dcdf022013-12-11 14:45:27 -08003626 @staticmethod
3627 def unpack(reader):
3628 subtype, = reader.peek('!L', 20)
Rich Lane95f7fc92014-01-27 17:08:16 -08003629 subclass = bsn_stats_request.subtypes.get(subtype)
3630 if subclass:
3631 return subclass.unpack(reader)
3632
3633 obj = bsn_stats_request()
3634 _version = reader.read("!B")[0]
3635 assert(_version == 1)
3636 _type = reader.read("!B")[0]
3637 assert(_type == 18)
3638 _length = reader.read("!H")[0]
3639 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003640 reader = orig_reader.slice(_length, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -08003641 obj.xid = reader.read("!L")[0]
3642 _stats_type = reader.read("!H")[0]
3643 assert(_stats_type == 65535)
3644 obj.flags = reader.read("!H")[0]
3645 reader.skip(4)
3646 _experimenter = reader.read("!L")[0]
3647 assert(_experimenter == 6035143)
3648 obj.subtype = reader.read("!L")[0]
3649 return obj
3650
3651 def __eq__(self, other):
3652 if type(self) != type(other): return False
3653 if self.xid != other.xid: return False
3654 if self.flags != other.flags: return False
3655 if self.subtype != other.subtype: return False
3656 return True
3657
3658 def pretty_print(self, q):
3659 q.text("bsn_stats_request {")
3660 with q.group():
3661 with q.indent(2):
3662 q.breakable()
3663 q.text("xid = ");
3664 if self.xid != None:
3665 q.text("%#x" % self.xid)
3666 else:
3667 q.text('None')
3668 q.text(","); q.breakable()
3669 q.text("flags = ");
3670 q.text("%#x" % self.flags)
3671 q.breakable()
3672 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -08003673
3674experimenter_stats_request.subtypes[6035143] = bsn_stats_request
3675
3676class bsn_virtual_port_create_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07003677 version = 1
3678 type = 4
3679 experimenter = 6035143
3680 subtype = 16
3681
3682 def __init__(self, xid=None, status=None, vport_no=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08003683 if xid != None:
3684 self.xid = xid
3685 else:
3686 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07003687 if status != None:
3688 self.status = status
3689 else:
3690 self.status = 0
3691 if vport_no != None:
3692 self.vport_no = vport_no
3693 else:
3694 self.vport_no = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08003695 return
Dan Talaycof6202252013-07-02 01:00:29 -07003696
3697 def pack(self):
3698 packed = []
3699 packed.append(struct.pack("!B", self.version))
3700 packed.append(struct.pack("!B", self.type))
3701 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3702 packed.append(struct.pack("!L", self.xid))
3703 packed.append(struct.pack("!L", self.experimenter))
3704 packed.append(struct.pack("!L", self.subtype))
3705 packed.append(struct.pack("!L", self.status))
3706 packed.append(struct.pack("!L", self.vport_no))
3707 length = sum([len(x) for x in packed])
3708 packed[2] = struct.pack("!H", length)
3709 return ''.join(packed)
3710
3711 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003712 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07003713 obj = bsn_virtual_port_create_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07003714 _version = reader.read("!B")[0]
3715 assert(_version == 1)
3716 _type = reader.read("!B")[0]
3717 assert(_type == 4)
3718 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003719 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003720 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07003721 obj.xid = reader.read("!L")[0]
3722 _experimenter = reader.read("!L")[0]
3723 assert(_experimenter == 6035143)
3724 _subtype = reader.read("!L")[0]
3725 assert(_subtype == 16)
3726 obj.status = reader.read("!L")[0]
3727 obj.vport_no = reader.read("!L")[0]
3728 return obj
3729
3730 def __eq__(self, other):
3731 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07003732 if self.xid != other.xid: return False
3733 if self.status != other.status: return False
3734 if self.vport_no != other.vport_no: return False
3735 return True
3736
Dan Talaycof6202252013-07-02 01:00:29 -07003737 def pretty_print(self, q):
3738 q.text("bsn_virtual_port_create_reply {")
3739 with q.group():
3740 with q.indent(2):
3741 q.breakable()
3742 q.text("xid = ");
3743 if self.xid != None:
3744 q.text("%#x" % self.xid)
3745 else:
3746 q.text('None')
3747 q.text(","); q.breakable()
3748 q.text("status = ");
3749 q.text("%#x" % self.status)
3750 q.text(","); q.breakable()
3751 q.text("vport_no = ");
3752 q.text("%#x" % self.vport_no)
3753 q.breakable()
3754 q.text('}')
3755
Rich Lane7dcdf022013-12-11 14:45:27 -08003756bsn_header.subtypes[16] = bsn_virtual_port_create_reply
3757
3758class bsn_virtual_port_create_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07003759 version = 1
3760 type = 4
3761 experimenter = 6035143
3762 subtype = 15
3763
3764 def __init__(self, xid=None, vport=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08003765 if xid != None:
3766 self.xid = xid
3767 else:
3768 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07003769 if vport != None:
3770 self.vport = vport
3771 else:
Rich Lanee2567702015-01-26 15:04:35 -08003772 self.vport = ofp.bsn_vport()
Rich Lane7dcdf022013-12-11 14:45:27 -08003773 return
Dan Talaycof6202252013-07-02 01:00:29 -07003774
3775 def pack(self):
3776 packed = []
3777 packed.append(struct.pack("!B", self.version))
3778 packed.append(struct.pack("!B", self.type))
3779 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3780 packed.append(struct.pack("!L", self.xid))
3781 packed.append(struct.pack("!L", self.experimenter))
3782 packed.append(struct.pack("!L", self.subtype))
3783 packed.append(self.vport.pack())
3784 length = sum([len(x) for x in packed])
3785 packed[2] = struct.pack("!H", length)
3786 return ''.join(packed)
3787
3788 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003789 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07003790 obj = bsn_virtual_port_create_request()
Dan Talaycof6202252013-07-02 01:00:29 -07003791 _version = reader.read("!B")[0]
3792 assert(_version == 1)
3793 _type = reader.read("!B")[0]
3794 assert(_type == 4)
3795 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003796 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003797 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07003798 obj.xid = reader.read("!L")[0]
3799 _experimenter = reader.read("!L")[0]
3800 assert(_experimenter == 6035143)
3801 _subtype = reader.read("!L")[0]
3802 assert(_subtype == 15)
Rich Lanee2567702015-01-26 15:04:35 -08003803 obj.vport = ofp.bsn_vport.unpack(reader)
Dan Talaycof6202252013-07-02 01:00:29 -07003804 return obj
3805
3806 def __eq__(self, other):
3807 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07003808 if self.xid != other.xid: return False
3809 if self.vport != other.vport: return False
3810 return True
3811
Dan Talaycof6202252013-07-02 01:00:29 -07003812 def pretty_print(self, q):
3813 q.text("bsn_virtual_port_create_request {")
3814 with q.group():
3815 with q.indent(2):
3816 q.breakable()
3817 q.text("xid = ");
3818 if self.xid != None:
3819 q.text("%#x" % self.xid)
3820 else:
3821 q.text('None')
3822 q.text(","); q.breakable()
3823 q.text("vport = ");
3824 q.pp(self.vport)
3825 q.breakable()
3826 q.text('}')
3827
Rich Lane7dcdf022013-12-11 14:45:27 -08003828bsn_header.subtypes[15] = bsn_virtual_port_create_request
3829
3830class bsn_virtual_port_remove_reply(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07003831 version = 1
3832 type = 4
3833 experimenter = 6035143
3834 subtype = 26
3835
3836 def __init__(self, xid=None, status=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08003837 if xid != None:
3838 self.xid = xid
3839 else:
3840 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07003841 if status != None:
3842 self.status = status
3843 else:
3844 self.status = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08003845 return
Dan Talaycof6202252013-07-02 01:00:29 -07003846
3847 def pack(self):
3848 packed = []
3849 packed.append(struct.pack("!B", self.version))
3850 packed.append(struct.pack("!B", self.type))
3851 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3852 packed.append(struct.pack("!L", self.xid))
3853 packed.append(struct.pack("!L", self.experimenter))
3854 packed.append(struct.pack("!L", self.subtype))
3855 packed.append(struct.pack("!L", self.status))
3856 length = sum([len(x) for x in packed])
3857 packed[2] = struct.pack("!H", length)
3858 return ''.join(packed)
3859
3860 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003861 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07003862 obj = bsn_virtual_port_remove_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07003863 _version = reader.read("!B")[0]
3864 assert(_version == 1)
3865 _type = reader.read("!B")[0]
3866 assert(_type == 4)
3867 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003868 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003869 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07003870 obj.xid = reader.read("!L")[0]
3871 _experimenter = reader.read("!L")[0]
3872 assert(_experimenter == 6035143)
3873 _subtype = reader.read("!L")[0]
3874 assert(_subtype == 26)
3875 obj.status = reader.read("!L")[0]
3876 return obj
3877
3878 def __eq__(self, other):
3879 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07003880 if self.xid != other.xid: return False
3881 if self.status != other.status: return False
3882 return True
3883
Dan Talaycof6202252013-07-02 01:00:29 -07003884 def pretty_print(self, q):
3885 q.text("bsn_virtual_port_remove_reply {")
3886 with q.group():
3887 with q.indent(2):
3888 q.breakable()
3889 q.text("xid = ");
3890 if self.xid != None:
3891 q.text("%#x" % self.xid)
3892 else:
3893 q.text('None')
3894 q.text(","); q.breakable()
3895 q.text("status = ");
3896 q.text("%#x" % self.status)
3897 q.breakable()
3898 q.text('}')
3899
Rich Lane7dcdf022013-12-11 14:45:27 -08003900bsn_header.subtypes[26] = bsn_virtual_port_remove_reply
3901
3902class bsn_virtual_port_remove_request(bsn_header):
Dan Talaycof6202252013-07-02 01:00:29 -07003903 version = 1
3904 type = 4
3905 experimenter = 6035143
3906 subtype = 17
3907
3908 def __init__(self, xid=None, vport_no=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08003909 if xid != None:
3910 self.xid = xid
3911 else:
3912 self.xid = None
Dan Talaycof6202252013-07-02 01:00:29 -07003913 if vport_no != None:
3914 self.vport_no = vport_no
3915 else:
3916 self.vport_no = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08003917 return
Dan Talaycof6202252013-07-02 01:00:29 -07003918
3919 def pack(self):
3920 packed = []
3921 packed.append(struct.pack("!B", self.version))
3922 packed.append(struct.pack("!B", self.type))
3923 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3924 packed.append(struct.pack("!L", self.xid))
3925 packed.append(struct.pack("!L", self.experimenter))
3926 packed.append(struct.pack("!L", self.subtype))
3927 packed.append(struct.pack("!L", self.vport_no))
3928 length = sum([len(x) for x in packed])
3929 packed[2] = struct.pack("!H", length)
3930 return ''.join(packed)
3931
3932 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003933 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07003934 obj = bsn_virtual_port_remove_request()
Dan Talaycof6202252013-07-02 01:00:29 -07003935 _version = reader.read("!B")[0]
3936 assert(_version == 1)
3937 _type = reader.read("!B")[0]
3938 assert(_type == 4)
3939 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003940 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003941 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07003942 obj.xid = reader.read("!L")[0]
3943 _experimenter = reader.read("!L")[0]
3944 assert(_experimenter == 6035143)
3945 _subtype = reader.read("!L")[0]
3946 assert(_subtype == 17)
3947 obj.vport_no = reader.read("!L")[0]
3948 return obj
3949
3950 def __eq__(self, other):
3951 if type(self) != type(other): return False
Dan Talaycof6202252013-07-02 01:00:29 -07003952 if self.xid != other.xid: return False
3953 if self.vport_no != other.vport_no: return False
3954 return True
3955
Dan Talaycof6202252013-07-02 01:00:29 -07003956 def pretty_print(self, q):
3957 q.text("bsn_virtual_port_remove_request {")
3958 with q.group():
3959 with q.indent(2):
3960 q.breakable()
3961 q.text("xid = ");
3962 if self.xid != None:
3963 q.text("%#x" % self.xid)
3964 else:
3965 q.text('None')
3966 q.text(","); q.breakable()
3967 q.text("vport_no = ");
3968 q.text("%#x" % self.vport_no)
3969 q.breakable()
3970 q.text('}')
3971
Rich Lane7dcdf022013-12-11 14:45:27 -08003972bsn_header.subtypes[17] = bsn_virtual_port_remove_request
3973
3974class desc_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -07003975 version = 1
3976 type = 17
3977 stats_type = 0
Rich Laneb658ddd2013-03-12 10:15:10 -07003978
3979 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 -08003980 if xid != None:
3981 self.xid = xid
3982 else:
3983 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07003984 if flags != None:
3985 self.flags = flags
3986 else:
3987 self.flags = 0
3988 if mfr_desc != None:
3989 self.mfr_desc = mfr_desc
3990 else:
3991 self.mfr_desc = ""
3992 if hw_desc != None:
3993 self.hw_desc = hw_desc
3994 else:
3995 self.hw_desc = ""
3996 if sw_desc != None:
3997 self.sw_desc = sw_desc
3998 else:
3999 self.sw_desc = ""
4000 if serial_num != None:
4001 self.serial_num = serial_num
4002 else:
4003 self.serial_num = ""
4004 if dp_desc != None:
4005 self.dp_desc = dp_desc
4006 else:
4007 self.dp_desc = ""
Rich Lane7dcdf022013-12-11 14:45:27 -08004008 return
Rich Laneb658ddd2013-03-12 10:15:10 -07004009
4010 def pack(self):
4011 packed = []
4012 packed.append(struct.pack("!B", self.version))
4013 packed.append(struct.pack("!B", self.type))
4014 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4015 packed.append(struct.pack("!L", self.xid))
4016 packed.append(struct.pack("!H", self.stats_type))
4017 packed.append(struct.pack("!H", self.flags))
4018 packed.append(struct.pack("!256s", self.mfr_desc))
4019 packed.append(struct.pack("!256s", self.hw_desc))
4020 packed.append(struct.pack("!256s", self.sw_desc))
4021 packed.append(struct.pack("!32s", self.serial_num))
4022 packed.append(struct.pack("!256s", self.dp_desc))
4023 length = sum([len(x) for x in packed])
4024 packed[2] = struct.pack("!H", length)
4025 return ''.join(packed)
4026
4027 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004028 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07004029 obj = desc_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07004030 _version = reader.read("!B")[0]
4031 assert(_version == 1)
4032 _type = reader.read("!B")[0]
4033 assert(_type == 17)
4034 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004035 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08004036 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07004037 obj.xid = reader.read("!L")[0]
4038 _stats_type = reader.read("!H")[0]
4039 assert(_stats_type == 0)
4040 obj.flags = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07004041 obj.mfr_desc = reader.read("!256s")[0].rstrip("\x00")
4042 obj.hw_desc = reader.read("!256s")[0].rstrip("\x00")
4043 obj.sw_desc = reader.read("!256s")[0].rstrip("\x00")
4044 obj.serial_num = reader.read("!32s")[0].rstrip("\x00")
4045 obj.dp_desc = reader.read("!256s")[0].rstrip("\x00")
Rich Laneb658ddd2013-03-12 10:15:10 -07004046 return obj
4047
4048 def __eq__(self, other):
4049 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07004050 if self.xid != other.xid: return False
4051 if self.flags != other.flags: return False
4052 if self.mfr_desc != other.mfr_desc: return False
4053 if self.hw_desc != other.hw_desc: return False
4054 if self.sw_desc != other.sw_desc: return False
4055 if self.serial_num != other.serial_num: return False
4056 if self.dp_desc != other.dp_desc: return False
4057 return True
4058
Rich Laneb658ddd2013-03-12 10:15:10 -07004059 def pretty_print(self, q):
4060 q.text("desc_stats_reply {")
4061 with q.group():
4062 with q.indent(2):
4063 q.breakable()
4064 q.text("xid = ");
4065 if self.xid != None:
4066 q.text("%#x" % self.xid)
4067 else:
4068 q.text('None')
4069 q.text(","); q.breakable()
4070 q.text("flags = ");
4071 q.text("%#x" % self.flags)
4072 q.text(","); q.breakable()
4073 q.text("mfr_desc = ");
4074 q.pp(self.mfr_desc)
4075 q.text(","); q.breakable()
4076 q.text("hw_desc = ");
4077 q.pp(self.hw_desc)
4078 q.text(","); q.breakable()
4079 q.text("sw_desc = ");
4080 q.pp(self.sw_desc)
4081 q.text(","); q.breakable()
4082 q.text("serial_num = ");
4083 q.pp(self.serial_num)
4084 q.text(","); q.breakable()
4085 q.text("dp_desc = ");
4086 q.pp(self.dp_desc)
4087 q.breakable()
4088 q.text('}')
4089
Rich Lane7dcdf022013-12-11 14:45:27 -08004090stats_reply.subtypes[0] = desc_stats_reply
4091
4092class desc_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -07004093 version = 1
4094 type = 16
4095 stats_type = 0
Rich Laneb658ddd2013-03-12 10:15:10 -07004096
4097 def __init__(self, xid=None, flags=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08004098 if xid != None:
4099 self.xid = xid
4100 else:
4101 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07004102 if flags != None:
4103 self.flags = flags
4104 else:
4105 self.flags = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08004106 return
Rich Laneb658ddd2013-03-12 10:15:10 -07004107
4108 def pack(self):
4109 packed = []
4110 packed.append(struct.pack("!B", self.version))
4111 packed.append(struct.pack("!B", self.type))
4112 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4113 packed.append(struct.pack("!L", self.xid))
4114 packed.append(struct.pack("!H", self.stats_type))
4115 packed.append(struct.pack("!H", self.flags))
4116 length = sum([len(x) for x in packed])
4117 packed[2] = struct.pack("!H", length)
4118 return ''.join(packed)
4119
4120 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004121 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07004122 obj = desc_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -07004123 _version = reader.read("!B")[0]
4124 assert(_version == 1)
4125 _type = reader.read("!B")[0]
4126 assert(_type == 16)
4127 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004128 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08004129 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07004130 obj.xid = reader.read("!L")[0]
4131 _stats_type = reader.read("!H")[0]
4132 assert(_stats_type == 0)
4133 obj.flags = reader.read("!H")[0]
Rich Laneb658ddd2013-03-12 10:15:10 -07004134 return obj
4135
4136 def __eq__(self, other):
4137 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07004138 if self.xid != other.xid: return False
4139 if self.flags != other.flags: return False
4140 return True
4141
Rich Laneb658ddd2013-03-12 10:15:10 -07004142 def pretty_print(self, q):
4143 q.text("desc_stats_request {")
4144 with q.group():
4145 with q.indent(2):
4146 q.breakable()
4147 q.text("xid = ");
4148 if self.xid != None:
4149 q.text("%#x" % self.xid)
4150 else:
4151 q.text('None')
4152 q.text(","); q.breakable()
4153 q.text("flags = ");
4154 q.text("%#x" % self.flags)
4155 q.breakable()
4156 q.text('}')
4157
Rich Lane7dcdf022013-12-11 14:45:27 -08004158stats_request.subtypes[0] = desc_stats_request
4159
4160class echo_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -07004161 version = 1
4162 type = 3
Rich Laneb658ddd2013-03-12 10:15:10 -07004163
4164 def __init__(self, xid=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08004165 if xid != None:
4166 self.xid = xid
4167 else:
4168 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07004169 if data != None:
4170 self.data = data
4171 else:
Dan Talaycof6202252013-07-02 01:00:29 -07004172 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08004173 return
Rich Laneb658ddd2013-03-12 10:15:10 -07004174
4175 def pack(self):
4176 packed = []
4177 packed.append(struct.pack("!B", self.version))
4178 packed.append(struct.pack("!B", self.type))
4179 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4180 packed.append(struct.pack("!L", self.xid))
4181 packed.append(self.data)
4182 length = sum([len(x) for x in packed])
4183 packed[2] = struct.pack("!H", length)
4184 return ''.join(packed)
4185
4186 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004187 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07004188 obj = echo_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07004189 _version = reader.read("!B")[0]
4190 assert(_version == 1)
4191 _type = reader.read("!B")[0]
4192 assert(_type == 3)
4193 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004194 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08004195 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07004196 obj.xid = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07004197 obj.data = str(reader.read_all())
Rich Laneb658ddd2013-03-12 10:15:10 -07004198 return obj
4199
4200 def __eq__(self, other):
4201 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07004202 if self.xid != other.xid: return False
4203 if self.data != other.data: return False
4204 return True
4205
Rich Laneb658ddd2013-03-12 10:15:10 -07004206 def pretty_print(self, q):
4207 q.text("echo_reply {")
4208 with q.group():
4209 with q.indent(2):
4210 q.breakable()
4211 q.text("xid = ");
4212 if self.xid != None:
4213 q.text("%#x" % self.xid)
4214 else:
4215 q.text('None')
4216 q.text(","); q.breakable()
4217 q.text("data = ");
4218 q.pp(self.data)
4219 q.breakable()
4220 q.text('}')
4221
Rich Lane7dcdf022013-12-11 14:45:27 -08004222message.subtypes[3] = echo_reply
4223
4224class echo_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -07004225 version = 1
4226 type = 2
Rich Laneb658ddd2013-03-12 10:15:10 -07004227
4228 def __init__(self, xid=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08004229 if xid != None:
4230 self.xid = xid
4231 else:
4232 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07004233 if data != None:
4234 self.data = data
4235 else:
Dan Talaycof6202252013-07-02 01:00:29 -07004236 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08004237 return
Rich Laneb658ddd2013-03-12 10:15:10 -07004238
4239 def pack(self):
4240 packed = []
4241 packed.append(struct.pack("!B", self.version))
4242 packed.append(struct.pack("!B", self.type))
4243 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4244 packed.append(struct.pack("!L", self.xid))
4245 packed.append(self.data)
4246 length = sum([len(x) for x in packed])
4247 packed[2] = struct.pack("!H", length)
4248 return ''.join(packed)
4249
4250 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004251 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07004252 obj = echo_request()
Dan Talaycof6202252013-07-02 01:00:29 -07004253 _version = reader.read("!B")[0]
4254 assert(_version == 1)
4255 _type = reader.read("!B")[0]
4256 assert(_type == 2)
4257 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004258 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08004259 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07004260 obj.xid = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07004261 obj.data = str(reader.read_all())
Rich Laneb658ddd2013-03-12 10:15:10 -07004262 return obj
4263
4264 def __eq__(self, other):
4265 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07004266 if self.xid != other.xid: return False
4267 if self.data != other.data: return False
4268 return True
4269
Rich Laneb658ddd2013-03-12 10:15:10 -07004270 def pretty_print(self, q):
4271 q.text("echo_request {")
4272 with q.group():
4273 with q.indent(2):
4274 q.breakable()
4275 q.text("xid = ");
4276 if self.xid != None:
4277 q.text("%#x" % self.xid)
4278 else:
4279 q.text('None')
4280 q.text(","); q.breakable()
4281 q.text("data = ");
4282 q.pp(self.data)
4283 q.breakable()
4284 q.text('}')
4285
Rich Lane7dcdf022013-12-11 14:45:27 -08004286message.subtypes[2] = echo_request
4287
4288class features_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -07004289 version = 1
4290 type = 6
Rich Laneb658ddd2013-03-12 10:15:10 -07004291
Rich Lanec2ee4b82013-04-24 17:12:38 -07004292 def __init__(self, xid=None, datapath_id=None, n_buffers=None, n_tables=None, capabilities=None, actions=None, ports=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08004293 if xid != None:
4294 self.xid = xid
4295 else:
4296 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07004297 if datapath_id != None:
4298 self.datapath_id = datapath_id
4299 else:
4300 self.datapath_id = 0
4301 if n_buffers != None:
4302 self.n_buffers = n_buffers
4303 else:
4304 self.n_buffers = 0
4305 if n_tables != None:
4306 self.n_tables = n_tables
4307 else:
4308 self.n_tables = 0
Rich Laneb658ddd2013-03-12 10:15:10 -07004309 if capabilities != None:
4310 self.capabilities = capabilities
4311 else:
4312 self.capabilities = 0
4313 if actions != None:
4314 self.actions = actions
4315 else:
4316 self.actions = 0
4317 if ports != None:
4318 self.ports = ports
4319 else:
4320 self.ports = []
Rich Lane7dcdf022013-12-11 14:45:27 -08004321 return
Rich Laneb658ddd2013-03-12 10:15:10 -07004322
4323 def pack(self):
4324 packed = []
4325 packed.append(struct.pack("!B", self.version))
4326 packed.append(struct.pack("!B", self.type))
4327 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4328 packed.append(struct.pack("!L", self.xid))
4329 packed.append(struct.pack("!Q", self.datapath_id))
4330 packed.append(struct.pack("!L", self.n_buffers))
4331 packed.append(struct.pack("!B", self.n_tables))
Rich Lanec2ee4b82013-04-24 17:12:38 -07004332 packed.append('\x00' * 3)
Rich Laneb658ddd2013-03-12 10:15:10 -07004333 packed.append(struct.pack("!L", self.capabilities))
4334 packed.append(struct.pack("!L", self.actions))
Rich Lane7dcdf022013-12-11 14:45:27 -08004335 packed.append(loxi.generic_util.pack_list(self.ports))
Rich Laneb658ddd2013-03-12 10:15:10 -07004336 length = sum([len(x) for x in packed])
4337 packed[2] = struct.pack("!H", length)
4338 return ''.join(packed)
4339
4340 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004341 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07004342 obj = features_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07004343 _version = reader.read("!B")[0]
4344 assert(_version == 1)
4345 _type = reader.read("!B")[0]
4346 assert(_type == 6)
4347 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004348 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08004349 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07004350 obj.xid = reader.read("!L")[0]
4351 obj.datapath_id = reader.read("!Q")[0]
4352 obj.n_buffers = reader.read("!L")[0]
4353 obj.n_tables = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07004354 reader.skip(3)
Dan Talaycof6202252013-07-02 01:00:29 -07004355 obj.capabilities = reader.read("!L")[0]
4356 obj.actions = reader.read("!L")[0]
Rich Lanee2567702015-01-26 15:04:35 -08004357 obj.ports = loxi.generic_util.unpack_list(reader, ofp.common.port_desc.unpack)
Rich Laneb658ddd2013-03-12 10:15:10 -07004358 return obj
4359
4360 def __eq__(self, other):
4361 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07004362 if self.xid != other.xid: return False
4363 if self.datapath_id != other.datapath_id: return False
4364 if self.n_buffers != other.n_buffers: return False
4365 if self.n_tables != other.n_tables: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07004366 if self.capabilities != other.capabilities: return False
4367 if self.actions != other.actions: return False
4368 if self.ports != other.ports: return False
4369 return True
4370
Rich Laneb658ddd2013-03-12 10:15:10 -07004371 def pretty_print(self, q):
4372 q.text("features_reply {")
4373 with q.group():
4374 with q.indent(2):
4375 q.breakable()
4376 q.text("xid = ");
4377 if self.xid != None:
4378 q.text("%#x" % self.xid)
4379 else:
4380 q.text('None')
4381 q.text(","); q.breakable()
4382 q.text("datapath_id = ");
4383 q.text("%#x" % self.datapath_id)
4384 q.text(","); q.breakable()
4385 q.text("n_buffers = ");
4386 q.text("%#x" % self.n_buffers)
4387 q.text(","); q.breakable()
4388 q.text("n_tables = ");
4389 q.text("%#x" % self.n_tables)
4390 q.text(","); q.breakable()
Rich Laneb658ddd2013-03-12 10:15:10 -07004391 q.text("capabilities = ");
4392 q.text("%#x" % self.capabilities)
4393 q.text(","); q.breakable()
4394 q.text("actions = ");
4395 q.text("%#x" % self.actions)
4396 q.text(","); q.breakable()
4397 q.text("ports = ");
4398 q.pp(self.ports)
4399 q.breakable()
4400 q.text('}')
4401
Rich Lane7dcdf022013-12-11 14:45:27 -08004402message.subtypes[6] = features_reply
4403
4404class features_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -07004405 version = 1
4406 type = 5
Rich Laneb658ddd2013-03-12 10:15:10 -07004407
4408 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08004409 if xid != None:
4410 self.xid = xid
4411 else:
4412 self.xid = None
4413 return
Rich Laneb658ddd2013-03-12 10:15:10 -07004414
4415 def pack(self):
4416 packed = []
4417 packed.append(struct.pack("!B", self.version))
4418 packed.append(struct.pack("!B", self.type))
4419 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4420 packed.append(struct.pack("!L", self.xid))
4421 length = sum([len(x) for x in packed])
4422 packed[2] = struct.pack("!H", length)
4423 return ''.join(packed)
4424
4425 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004426 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07004427 obj = features_request()
Dan Talaycof6202252013-07-02 01:00:29 -07004428 _version = reader.read("!B")[0]
4429 assert(_version == 1)
4430 _type = reader.read("!B")[0]
4431 assert(_type == 5)
4432 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004433 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08004434 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07004435 obj.xid = reader.read("!L")[0]
Rich Laneb658ddd2013-03-12 10:15:10 -07004436 return obj
4437
4438 def __eq__(self, other):
4439 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07004440 if self.xid != other.xid: return False
4441 return True
4442
Rich Laneb658ddd2013-03-12 10:15:10 -07004443 def pretty_print(self, q):
4444 q.text("features_request {")
4445 with q.group():
4446 with q.indent(2):
4447 q.breakable()
4448 q.text("xid = ");
4449 if self.xid != None:
4450 q.text("%#x" % self.xid)
4451 else:
4452 q.text('None')
4453 q.breakable()
4454 q.text('}')
4455
Rich Lane7dcdf022013-12-11 14:45:27 -08004456message.subtypes[5] = features_request
4457
4458class flow_mod(message):
4459 subtypes = {}
4460
Rich Lane95f7fc92014-01-27 17:08:16 -08004461 version = 1
4462 type = 14
4463
4464 def __init__(self, xid=None, match=None, cookie=None, _command=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, flags=None, actions=None):
4465 if xid != None:
4466 self.xid = xid
4467 else:
4468 self.xid = None
4469 if match != None:
4470 self.match = match
4471 else:
Rich Lanee2567702015-01-26 15:04:35 -08004472 self.match = ofp.match()
Rich Lane95f7fc92014-01-27 17:08:16 -08004473 if cookie != None:
4474 self.cookie = cookie
4475 else:
4476 self.cookie = 0
4477 if _command != None:
4478 self._command = _command
4479 else:
4480 self._command = 0
4481 if idle_timeout != None:
4482 self.idle_timeout = idle_timeout
4483 else:
4484 self.idle_timeout = 0
4485 if hard_timeout != None:
4486 self.hard_timeout = hard_timeout
4487 else:
4488 self.hard_timeout = 0
4489 if priority != None:
4490 self.priority = priority
4491 else:
4492 self.priority = 0
4493 if buffer_id != None:
4494 self.buffer_id = buffer_id
4495 else:
4496 self.buffer_id = 0
4497 if out_port != None:
4498 self.out_port = out_port
4499 else:
4500 self.out_port = 0
4501 if flags != None:
4502 self.flags = flags
4503 else:
4504 self.flags = 0
4505 if actions != None:
4506 self.actions = actions
4507 else:
4508 self.actions = []
4509 return
4510
4511 def pack(self):
4512 packed = []
4513 packed.append(struct.pack("!B", self.version))
4514 packed.append(struct.pack("!B", self.type))
4515 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4516 packed.append(struct.pack("!L", self.xid))
4517 packed.append(self.match.pack())
4518 packed.append(struct.pack("!Q", self.cookie))
4519 packed.append(util.pack_fm_cmd(self._command))
4520 packed.append(struct.pack("!H", self.idle_timeout))
4521 packed.append(struct.pack("!H", self.hard_timeout))
4522 packed.append(struct.pack("!H", self.priority))
4523 packed.append(struct.pack("!L", self.buffer_id))
4524 packed.append(util.pack_port_no(self.out_port))
4525 packed.append(struct.pack("!H", self.flags))
4526 packed.append(loxi.generic_util.pack_list(self.actions))
4527 length = sum([len(x) for x in packed])
4528 packed[2] = struct.pack("!H", length)
4529 return ''.join(packed)
4530
Rich Lane7dcdf022013-12-11 14:45:27 -08004531 @staticmethod
4532 def unpack(reader):
4533 subtype, = reader.peek('!H', 56)
Rich Lane95f7fc92014-01-27 17:08:16 -08004534 subclass = flow_mod.subtypes.get(subtype)
4535 if subclass:
4536 return subclass.unpack(reader)
4537
4538 obj = flow_mod()
4539 _version = reader.read("!B")[0]
4540 assert(_version == 1)
4541 _type = reader.read("!B")[0]
4542 assert(_type == 14)
4543 _length = reader.read("!H")[0]
4544 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08004545 reader = orig_reader.slice(_length, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -08004546 obj.xid = reader.read("!L")[0]
Rich Lanee2567702015-01-26 15:04:35 -08004547 obj.match = ofp.match.unpack(reader)
Rich Lane95f7fc92014-01-27 17:08:16 -08004548 obj.cookie = reader.read("!Q")[0]
4549 obj._command = util.unpack_fm_cmd(reader)
4550 obj.idle_timeout = reader.read("!H")[0]
4551 obj.hard_timeout = reader.read("!H")[0]
4552 obj.priority = reader.read("!H")[0]
4553 obj.buffer_id = reader.read("!L")[0]
4554 obj.out_port = util.unpack_port_no(reader)
4555 obj.flags = reader.read("!H")[0]
Rich Lanee2567702015-01-26 15:04:35 -08004556 obj.actions = loxi.generic_util.unpack_list(reader, ofp.action.action.unpack)
Rich Lane95f7fc92014-01-27 17:08:16 -08004557 return obj
4558
4559 def __eq__(self, other):
4560 if type(self) != type(other): return False
4561 if self.xid != other.xid: return False
4562 if self.match != other.match: return False
4563 if self.cookie != other.cookie: return False
4564 if self._command != other._command: return False
4565 if self.idle_timeout != other.idle_timeout: return False
4566 if self.hard_timeout != other.hard_timeout: return False
4567 if self.priority != other.priority: return False
4568 if self.buffer_id != other.buffer_id: return False
4569 if self.out_port != other.out_port: return False
4570 if self.flags != other.flags: return False
4571 if self.actions != other.actions: return False
4572 return True
4573
4574 def pretty_print(self, q):
4575 q.text("flow_mod {")
4576 with q.group():
4577 with q.indent(2):
4578 q.breakable()
4579 q.text("xid = ");
4580 if self.xid != None:
4581 q.text("%#x" % self.xid)
4582 else:
4583 q.text('None')
4584 q.text(","); q.breakable()
4585 q.text("match = ");
4586 q.pp(self.match)
4587 q.text(","); q.breakable()
4588 q.text("cookie = ");
4589 q.text("%#x" % self.cookie)
4590 q.text(","); q.breakable()
4591 q.text("idle_timeout = ");
4592 q.text("%#x" % self.idle_timeout)
4593 q.text(","); q.breakable()
4594 q.text("hard_timeout = ");
4595 q.text("%#x" % self.hard_timeout)
4596 q.text(","); q.breakable()
4597 q.text("priority = ");
4598 q.text("%#x" % self.priority)
4599 q.text(","); q.breakable()
4600 q.text("buffer_id = ");
4601 q.text("%#x" % self.buffer_id)
4602 q.text(","); q.breakable()
4603 q.text("out_port = ");
4604 q.text(util.pretty_port(self.out_port))
4605 q.text(","); q.breakable()
4606 q.text("flags = ");
4607 q.text("%#x" % self.flags)
4608 q.text(","); q.breakable()
4609 q.text("actions = ");
4610 q.pp(self.actions)
4611 q.breakable()
4612 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -08004613
4614message.subtypes[14] = flow_mod
4615
4616class flow_add(flow_mod):
Dan Talaycof6202252013-07-02 01:00:29 -07004617 version = 1
4618 type = 14
4619 _command = 0
Rich Laneb658ddd2013-03-12 10:15:10 -07004620
4621 def __init__(self, xid=None, match=None, cookie=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, flags=None, actions=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08004622 if xid != None:
4623 self.xid = xid
4624 else:
4625 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07004626 if match != None:
4627 self.match = match
4628 else:
Rich Lanee2567702015-01-26 15:04:35 -08004629 self.match = ofp.match()
Rich Laneb658ddd2013-03-12 10:15:10 -07004630 if cookie != None:
4631 self.cookie = cookie
4632 else:
4633 self.cookie = 0
4634 if idle_timeout != None:
4635 self.idle_timeout = idle_timeout
4636 else:
4637 self.idle_timeout = 0
4638 if hard_timeout != None:
4639 self.hard_timeout = hard_timeout
4640 else:
4641 self.hard_timeout = 0
4642 if priority != None:
4643 self.priority = priority
4644 else:
4645 self.priority = 0
4646 if buffer_id != None:
4647 self.buffer_id = buffer_id
4648 else:
4649 self.buffer_id = 0
4650 if out_port != None:
4651 self.out_port = out_port
4652 else:
4653 self.out_port = 0
4654 if flags != None:
4655 self.flags = flags
4656 else:
4657 self.flags = 0
4658 if actions != None:
4659 self.actions = actions
4660 else:
4661 self.actions = []
Rich Lane7dcdf022013-12-11 14:45:27 -08004662 return
Rich Laneb658ddd2013-03-12 10:15:10 -07004663
4664 def pack(self):
4665 packed = []
4666 packed.append(struct.pack("!B", self.version))
4667 packed.append(struct.pack("!B", self.type))
4668 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4669 packed.append(struct.pack("!L", self.xid))
4670 packed.append(self.match.pack())
4671 packed.append(struct.pack("!Q", self.cookie))
Dan Talaycof6202252013-07-02 01:00:29 -07004672 packed.append(util.pack_fm_cmd(self._command))
Rich Laneb658ddd2013-03-12 10:15:10 -07004673 packed.append(struct.pack("!H", self.idle_timeout))
4674 packed.append(struct.pack("!H", self.hard_timeout))
4675 packed.append(struct.pack("!H", self.priority))
4676 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -07004677 packed.append(util.pack_port_no(self.out_port))
Rich Laneb658ddd2013-03-12 10:15:10 -07004678 packed.append(struct.pack("!H", self.flags))
Rich Lane7dcdf022013-12-11 14:45:27 -08004679 packed.append(loxi.generic_util.pack_list(self.actions))
Rich Laneb658ddd2013-03-12 10:15:10 -07004680 length = sum([len(x) for x in packed])
4681 packed[2] = struct.pack("!H", length)
4682 return ''.join(packed)
4683
4684 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004685 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07004686 obj = flow_add()
Dan Talaycof6202252013-07-02 01:00:29 -07004687 _version = reader.read("!B")[0]
4688 assert(_version == 1)
4689 _type = reader.read("!B")[0]
4690 assert(_type == 14)
4691 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004692 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08004693 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07004694 obj.xid = reader.read("!L")[0]
Rich Lanee2567702015-01-26 15:04:35 -08004695 obj.match = ofp.match.unpack(reader)
Dan Talaycof6202252013-07-02 01:00:29 -07004696 obj.cookie = reader.read("!Q")[0]
4697 __command = util.unpack_fm_cmd(reader)
4698 assert(__command == 0)
4699 obj.idle_timeout = reader.read("!H")[0]
4700 obj.hard_timeout = reader.read("!H")[0]
4701 obj.priority = reader.read("!H")[0]
4702 obj.buffer_id = reader.read("!L")[0]
4703 obj.out_port = util.unpack_port_no(reader)
4704 obj.flags = reader.read("!H")[0]
Rich Lanee2567702015-01-26 15:04:35 -08004705 obj.actions = loxi.generic_util.unpack_list(reader, ofp.action.action.unpack)
Rich Laneb658ddd2013-03-12 10:15:10 -07004706 return obj
4707
4708 def __eq__(self, other):
4709 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07004710 if self.xid != other.xid: return False
4711 if self.match != other.match: return False
4712 if self.cookie != other.cookie: return False
4713 if self.idle_timeout != other.idle_timeout: return False
4714 if self.hard_timeout != other.hard_timeout: return False
4715 if self.priority != other.priority: return False
4716 if self.buffer_id != other.buffer_id: return False
4717 if self.out_port != other.out_port: return False
4718 if self.flags != other.flags: return False
4719 if self.actions != other.actions: return False
4720 return True
4721
Rich Laneb658ddd2013-03-12 10:15:10 -07004722 def pretty_print(self, q):
4723 q.text("flow_add {")
4724 with q.group():
4725 with q.indent(2):
4726 q.breakable()
4727 q.text("xid = ");
4728 if self.xid != None:
4729 q.text("%#x" % self.xid)
4730 else:
4731 q.text('None')
4732 q.text(","); q.breakable()
4733 q.text("match = ");
4734 q.pp(self.match)
4735 q.text(","); q.breakable()
4736 q.text("cookie = ");
4737 q.text("%#x" % self.cookie)
4738 q.text(","); q.breakable()
4739 q.text("idle_timeout = ");
4740 q.text("%#x" % self.idle_timeout)
4741 q.text(","); q.breakable()
4742 q.text("hard_timeout = ");
4743 q.text("%#x" % self.hard_timeout)
4744 q.text(","); q.breakable()
4745 q.text("priority = ");
4746 q.text("%#x" % self.priority)
4747 q.text(","); q.breakable()
4748 q.text("buffer_id = ");
4749 q.text("%#x" % self.buffer_id)
4750 q.text(","); q.breakable()
4751 q.text("out_port = ");
4752 q.text(util.pretty_port(self.out_port))
4753 q.text(","); q.breakable()
4754 q.text("flags = ");
4755 q.text("%#x" % self.flags)
4756 q.text(","); q.breakable()
4757 q.text("actions = ");
4758 q.pp(self.actions)
4759 q.breakable()
4760 q.text('}')
4761
Rich Lane7dcdf022013-12-11 14:45:27 -08004762flow_mod.subtypes[0] = flow_add
4763
4764class flow_delete(flow_mod):
Dan Talaycof6202252013-07-02 01:00:29 -07004765 version = 1
4766 type = 14
4767 _command = 3
Rich Laneb658ddd2013-03-12 10:15:10 -07004768
4769 def __init__(self, xid=None, match=None, cookie=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, flags=None, actions=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08004770 if xid != None:
4771 self.xid = xid
4772 else:
4773 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07004774 if match != None:
4775 self.match = match
4776 else:
Rich Lanee2567702015-01-26 15:04:35 -08004777 self.match = ofp.match()
Rich Laneb658ddd2013-03-12 10:15:10 -07004778 if cookie != None:
4779 self.cookie = cookie
4780 else:
4781 self.cookie = 0
4782 if idle_timeout != None:
4783 self.idle_timeout = idle_timeout
4784 else:
4785 self.idle_timeout = 0
4786 if hard_timeout != None:
4787 self.hard_timeout = hard_timeout
4788 else:
4789 self.hard_timeout = 0
4790 if priority != None:
4791 self.priority = priority
4792 else:
4793 self.priority = 0
4794 if buffer_id != None:
4795 self.buffer_id = buffer_id
4796 else:
4797 self.buffer_id = 0
4798 if out_port != None:
4799 self.out_port = out_port
4800 else:
4801 self.out_port = 0
4802 if flags != None:
4803 self.flags = flags
4804 else:
4805 self.flags = 0
4806 if actions != None:
4807 self.actions = actions
4808 else:
4809 self.actions = []
Rich Lane7dcdf022013-12-11 14:45:27 -08004810 return
Rich Laneb658ddd2013-03-12 10:15:10 -07004811
4812 def pack(self):
4813 packed = []
4814 packed.append(struct.pack("!B", self.version))
4815 packed.append(struct.pack("!B", self.type))
4816 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4817 packed.append(struct.pack("!L", self.xid))
4818 packed.append(self.match.pack())
4819 packed.append(struct.pack("!Q", self.cookie))
Dan Talaycof6202252013-07-02 01:00:29 -07004820 packed.append(util.pack_fm_cmd(self._command))
Rich Laneb658ddd2013-03-12 10:15:10 -07004821 packed.append(struct.pack("!H", self.idle_timeout))
4822 packed.append(struct.pack("!H", self.hard_timeout))
4823 packed.append(struct.pack("!H", self.priority))
4824 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -07004825 packed.append(util.pack_port_no(self.out_port))
Rich Laneb658ddd2013-03-12 10:15:10 -07004826 packed.append(struct.pack("!H", self.flags))
Rich Lane7dcdf022013-12-11 14:45:27 -08004827 packed.append(loxi.generic_util.pack_list(self.actions))
Rich Laneb658ddd2013-03-12 10:15:10 -07004828 length = sum([len(x) for x in packed])
4829 packed[2] = struct.pack("!H", length)
4830 return ''.join(packed)
4831
4832 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004833 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07004834 obj = flow_delete()
Dan Talaycof6202252013-07-02 01:00:29 -07004835 _version = reader.read("!B")[0]
4836 assert(_version == 1)
4837 _type = reader.read("!B")[0]
4838 assert(_type == 14)
4839 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004840 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08004841 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07004842 obj.xid = reader.read("!L")[0]
Rich Lanee2567702015-01-26 15:04:35 -08004843 obj.match = ofp.match.unpack(reader)
Dan Talaycof6202252013-07-02 01:00:29 -07004844 obj.cookie = reader.read("!Q")[0]
4845 __command = util.unpack_fm_cmd(reader)
4846 assert(__command == 3)
4847 obj.idle_timeout = reader.read("!H")[0]
4848 obj.hard_timeout = reader.read("!H")[0]
4849 obj.priority = reader.read("!H")[0]
4850 obj.buffer_id = reader.read("!L")[0]
4851 obj.out_port = util.unpack_port_no(reader)
4852 obj.flags = reader.read("!H")[0]
Rich Lanee2567702015-01-26 15:04:35 -08004853 obj.actions = loxi.generic_util.unpack_list(reader, ofp.action.action.unpack)
Rich Laneb658ddd2013-03-12 10:15:10 -07004854 return obj
4855
4856 def __eq__(self, other):
4857 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07004858 if self.xid != other.xid: return False
4859 if self.match != other.match: return False
4860 if self.cookie != other.cookie: return False
4861 if self.idle_timeout != other.idle_timeout: return False
4862 if self.hard_timeout != other.hard_timeout: return False
4863 if self.priority != other.priority: return False
4864 if self.buffer_id != other.buffer_id: return False
4865 if self.out_port != other.out_port: return False
4866 if self.flags != other.flags: return False
4867 if self.actions != other.actions: return False
4868 return True
4869
Rich Laneb658ddd2013-03-12 10:15:10 -07004870 def pretty_print(self, q):
4871 q.text("flow_delete {")
4872 with q.group():
4873 with q.indent(2):
4874 q.breakable()
4875 q.text("xid = ");
4876 if self.xid != None:
4877 q.text("%#x" % self.xid)
4878 else:
4879 q.text('None')
4880 q.text(","); q.breakable()
4881 q.text("match = ");
4882 q.pp(self.match)
4883 q.text(","); q.breakable()
4884 q.text("cookie = ");
4885 q.text("%#x" % self.cookie)
4886 q.text(","); q.breakable()
4887 q.text("idle_timeout = ");
4888 q.text("%#x" % self.idle_timeout)
4889 q.text(","); q.breakable()
4890 q.text("hard_timeout = ");
4891 q.text("%#x" % self.hard_timeout)
4892 q.text(","); q.breakable()
4893 q.text("priority = ");
4894 q.text("%#x" % self.priority)
4895 q.text(","); q.breakable()
4896 q.text("buffer_id = ");
4897 q.text("%#x" % self.buffer_id)
4898 q.text(","); q.breakable()
4899 q.text("out_port = ");
4900 q.text(util.pretty_port(self.out_port))
4901 q.text(","); q.breakable()
4902 q.text("flags = ");
4903 q.text("%#x" % self.flags)
4904 q.text(","); q.breakable()
4905 q.text("actions = ");
4906 q.pp(self.actions)
4907 q.breakable()
4908 q.text('}')
4909
Rich Lane7dcdf022013-12-11 14:45:27 -08004910flow_mod.subtypes[3] = flow_delete
4911
4912class flow_delete_strict(flow_mod):
Dan Talaycof6202252013-07-02 01:00:29 -07004913 version = 1
4914 type = 14
4915 _command = 4
Rich Laneb658ddd2013-03-12 10:15:10 -07004916
4917 def __init__(self, xid=None, match=None, cookie=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, flags=None, actions=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08004918 if xid != None:
4919 self.xid = xid
4920 else:
4921 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07004922 if match != None:
4923 self.match = match
4924 else:
Rich Lanee2567702015-01-26 15:04:35 -08004925 self.match = ofp.match()
Rich Laneb658ddd2013-03-12 10:15:10 -07004926 if cookie != None:
4927 self.cookie = cookie
4928 else:
4929 self.cookie = 0
4930 if idle_timeout != None:
4931 self.idle_timeout = idle_timeout
4932 else:
4933 self.idle_timeout = 0
4934 if hard_timeout != None:
4935 self.hard_timeout = hard_timeout
4936 else:
4937 self.hard_timeout = 0
4938 if priority != None:
4939 self.priority = priority
4940 else:
4941 self.priority = 0
4942 if buffer_id != None:
4943 self.buffer_id = buffer_id
4944 else:
4945 self.buffer_id = 0
4946 if out_port != None:
4947 self.out_port = out_port
4948 else:
4949 self.out_port = 0
4950 if flags != None:
4951 self.flags = flags
4952 else:
4953 self.flags = 0
4954 if actions != None:
4955 self.actions = actions
4956 else:
4957 self.actions = []
Rich Lane7dcdf022013-12-11 14:45:27 -08004958 return
Rich Laneb658ddd2013-03-12 10:15:10 -07004959
4960 def pack(self):
4961 packed = []
4962 packed.append(struct.pack("!B", self.version))
4963 packed.append(struct.pack("!B", self.type))
4964 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4965 packed.append(struct.pack("!L", self.xid))
4966 packed.append(self.match.pack())
4967 packed.append(struct.pack("!Q", self.cookie))
Dan Talaycof6202252013-07-02 01:00:29 -07004968 packed.append(util.pack_fm_cmd(self._command))
Rich Laneb658ddd2013-03-12 10:15:10 -07004969 packed.append(struct.pack("!H", self.idle_timeout))
4970 packed.append(struct.pack("!H", self.hard_timeout))
4971 packed.append(struct.pack("!H", self.priority))
4972 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -07004973 packed.append(util.pack_port_no(self.out_port))
Rich Laneb658ddd2013-03-12 10:15:10 -07004974 packed.append(struct.pack("!H", self.flags))
Rich Lane7dcdf022013-12-11 14:45:27 -08004975 packed.append(loxi.generic_util.pack_list(self.actions))
Rich Laneb658ddd2013-03-12 10:15:10 -07004976 length = sum([len(x) for x in packed])
4977 packed[2] = struct.pack("!H", length)
4978 return ''.join(packed)
4979
4980 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08004981 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07004982 obj = flow_delete_strict()
Dan Talaycof6202252013-07-02 01:00:29 -07004983 _version = reader.read("!B")[0]
4984 assert(_version == 1)
4985 _type = reader.read("!B")[0]
4986 assert(_type == 14)
4987 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08004988 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08004989 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07004990 obj.xid = reader.read("!L")[0]
Rich Lanee2567702015-01-26 15:04:35 -08004991 obj.match = ofp.match.unpack(reader)
Dan Talaycof6202252013-07-02 01:00:29 -07004992 obj.cookie = reader.read("!Q")[0]
4993 __command = util.unpack_fm_cmd(reader)
4994 assert(__command == 4)
4995 obj.idle_timeout = reader.read("!H")[0]
4996 obj.hard_timeout = reader.read("!H")[0]
4997 obj.priority = reader.read("!H")[0]
4998 obj.buffer_id = reader.read("!L")[0]
4999 obj.out_port = util.unpack_port_no(reader)
5000 obj.flags = reader.read("!H")[0]
Rich Lanee2567702015-01-26 15:04:35 -08005001 obj.actions = loxi.generic_util.unpack_list(reader, ofp.action.action.unpack)
Rich Laneb658ddd2013-03-12 10:15:10 -07005002 return obj
5003
5004 def __eq__(self, other):
5005 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07005006 if self.xid != other.xid: return False
5007 if self.match != other.match: return False
5008 if self.cookie != other.cookie: return False
5009 if self.idle_timeout != other.idle_timeout: return False
5010 if self.hard_timeout != other.hard_timeout: return False
5011 if self.priority != other.priority: return False
5012 if self.buffer_id != other.buffer_id: return False
5013 if self.out_port != other.out_port: return False
5014 if self.flags != other.flags: return False
5015 if self.actions != other.actions: return False
5016 return True
5017
Rich Laneb658ddd2013-03-12 10:15:10 -07005018 def pretty_print(self, q):
5019 q.text("flow_delete_strict {")
5020 with q.group():
5021 with q.indent(2):
5022 q.breakable()
5023 q.text("xid = ");
5024 if self.xid != None:
5025 q.text("%#x" % self.xid)
5026 else:
5027 q.text('None')
5028 q.text(","); q.breakable()
5029 q.text("match = ");
5030 q.pp(self.match)
5031 q.text(","); q.breakable()
5032 q.text("cookie = ");
5033 q.text("%#x" % self.cookie)
5034 q.text(","); q.breakable()
5035 q.text("idle_timeout = ");
5036 q.text("%#x" % self.idle_timeout)
5037 q.text(","); q.breakable()
5038 q.text("hard_timeout = ");
5039 q.text("%#x" % self.hard_timeout)
5040 q.text(","); q.breakable()
5041 q.text("priority = ");
5042 q.text("%#x" % self.priority)
5043 q.text(","); q.breakable()
5044 q.text("buffer_id = ");
5045 q.text("%#x" % self.buffer_id)
5046 q.text(","); q.breakable()
5047 q.text("out_port = ");
5048 q.text(util.pretty_port(self.out_port))
5049 q.text(","); q.breakable()
5050 q.text("flags = ");
5051 q.text("%#x" % self.flags)
5052 q.text(","); q.breakable()
5053 q.text("actions = ");
5054 q.pp(self.actions)
5055 q.breakable()
5056 q.text('}')
5057
Rich Lane7dcdf022013-12-11 14:45:27 -08005058flow_mod.subtypes[4] = flow_delete_strict
5059
5060class flow_mod_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -07005061 version = 1
5062 type = 1
5063 err_type = 3
5064
5065 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005066 if xid != None:
5067 self.xid = xid
5068 else:
5069 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07005070 if code != None:
5071 self.code = code
5072 else:
5073 self.code = 0
5074 if data != None:
5075 self.data = data
5076 else:
5077 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08005078 return
Rich Lane6f4978c2013-10-20 21:33:52 -07005079
5080 def pack(self):
5081 packed = []
5082 packed.append(struct.pack("!B", self.version))
5083 packed.append(struct.pack("!B", self.type))
5084 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5085 packed.append(struct.pack("!L", self.xid))
5086 packed.append(struct.pack("!H", self.err_type))
5087 packed.append(struct.pack("!H", self.code))
5088 packed.append(self.data)
5089 length = sum([len(x) for x in packed])
5090 packed[2] = struct.pack("!H", length)
5091 return ''.join(packed)
5092
5093 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005094 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07005095 obj = flow_mod_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -07005096 _version = reader.read("!B")[0]
5097 assert(_version == 1)
5098 _type = reader.read("!B")[0]
5099 assert(_type == 1)
5100 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005101 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08005102 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -07005103 obj.xid = reader.read("!L")[0]
5104 _err_type = reader.read("!H")[0]
5105 assert(_err_type == 3)
5106 obj.code = reader.read("!H")[0]
5107 obj.data = str(reader.read_all())
5108 return obj
5109
5110 def __eq__(self, other):
5111 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07005112 if self.xid != other.xid: return False
5113 if self.code != other.code: return False
5114 if self.data != other.data: return False
5115 return True
5116
Rich Lane6f4978c2013-10-20 21:33:52 -07005117 def pretty_print(self, q):
5118 q.text("flow_mod_failed_error_msg {")
5119 with q.group():
5120 with q.indent(2):
5121 q.breakable()
5122 q.text("xid = ");
5123 if self.xid != None:
5124 q.text("%#x" % self.xid)
5125 else:
5126 q.text('None')
5127 q.text(","); q.breakable()
5128 q.text("code = ");
5129 q.text("%#x" % self.code)
5130 q.text(","); q.breakable()
5131 q.text("data = ");
5132 q.pp(self.data)
5133 q.breakable()
5134 q.text('}')
5135
Rich Lane7dcdf022013-12-11 14:45:27 -08005136error_msg.subtypes[3] = flow_mod_failed_error_msg
5137
5138class flow_modify(flow_mod):
Dan Talaycof6202252013-07-02 01:00:29 -07005139 version = 1
5140 type = 14
5141 _command = 1
Rich Laneb658ddd2013-03-12 10:15:10 -07005142
5143 def __init__(self, xid=None, match=None, cookie=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, flags=None, actions=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005144 if xid != None:
5145 self.xid = xid
5146 else:
5147 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07005148 if match != None:
5149 self.match = match
5150 else:
Rich Lanee2567702015-01-26 15:04:35 -08005151 self.match = ofp.match()
Rich Laneb658ddd2013-03-12 10:15:10 -07005152 if cookie != None:
5153 self.cookie = cookie
5154 else:
5155 self.cookie = 0
5156 if idle_timeout != None:
5157 self.idle_timeout = idle_timeout
5158 else:
5159 self.idle_timeout = 0
5160 if hard_timeout != None:
5161 self.hard_timeout = hard_timeout
5162 else:
5163 self.hard_timeout = 0
5164 if priority != None:
5165 self.priority = priority
5166 else:
5167 self.priority = 0
5168 if buffer_id != None:
5169 self.buffer_id = buffer_id
5170 else:
5171 self.buffer_id = 0
5172 if out_port != None:
5173 self.out_port = out_port
5174 else:
5175 self.out_port = 0
5176 if flags != None:
5177 self.flags = flags
5178 else:
5179 self.flags = 0
5180 if actions != None:
5181 self.actions = actions
5182 else:
5183 self.actions = []
Rich Lane7dcdf022013-12-11 14:45:27 -08005184 return
Rich Laneb658ddd2013-03-12 10:15:10 -07005185
5186 def pack(self):
5187 packed = []
5188 packed.append(struct.pack("!B", self.version))
5189 packed.append(struct.pack("!B", self.type))
5190 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5191 packed.append(struct.pack("!L", self.xid))
5192 packed.append(self.match.pack())
5193 packed.append(struct.pack("!Q", self.cookie))
Dan Talaycof6202252013-07-02 01:00:29 -07005194 packed.append(util.pack_fm_cmd(self._command))
Rich Laneb658ddd2013-03-12 10:15:10 -07005195 packed.append(struct.pack("!H", self.idle_timeout))
5196 packed.append(struct.pack("!H", self.hard_timeout))
5197 packed.append(struct.pack("!H", self.priority))
5198 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -07005199 packed.append(util.pack_port_no(self.out_port))
Rich Laneb658ddd2013-03-12 10:15:10 -07005200 packed.append(struct.pack("!H", self.flags))
Rich Lane7dcdf022013-12-11 14:45:27 -08005201 packed.append(loxi.generic_util.pack_list(self.actions))
Rich Laneb658ddd2013-03-12 10:15:10 -07005202 length = sum([len(x) for x in packed])
5203 packed[2] = struct.pack("!H", length)
5204 return ''.join(packed)
5205
5206 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005207 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07005208 obj = flow_modify()
Dan Talaycof6202252013-07-02 01:00:29 -07005209 _version = reader.read("!B")[0]
5210 assert(_version == 1)
5211 _type = reader.read("!B")[0]
5212 assert(_type == 14)
5213 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005214 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08005215 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07005216 obj.xid = reader.read("!L")[0]
Rich Lanee2567702015-01-26 15:04:35 -08005217 obj.match = ofp.match.unpack(reader)
Dan Talaycof6202252013-07-02 01:00:29 -07005218 obj.cookie = reader.read("!Q")[0]
5219 __command = util.unpack_fm_cmd(reader)
5220 assert(__command == 1)
5221 obj.idle_timeout = reader.read("!H")[0]
5222 obj.hard_timeout = reader.read("!H")[0]
5223 obj.priority = reader.read("!H")[0]
5224 obj.buffer_id = reader.read("!L")[0]
5225 obj.out_port = util.unpack_port_no(reader)
5226 obj.flags = reader.read("!H")[0]
Rich Lanee2567702015-01-26 15:04:35 -08005227 obj.actions = loxi.generic_util.unpack_list(reader, ofp.action.action.unpack)
Rich Laneb658ddd2013-03-12 10:15:10 -07005228 return obj
5229
5230 def __eq__(self, other):
5231 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07005232 if self.xid != other.xid: return False
5233 if self.match != other.match: return False
5234 if self.cookie != other.cookie: return False
5235 if self.idle_timeout != other.idle_timeout: return False
5236 if self.hard_timeout != other.hard_timeout: return False
5237 if self.priority != other.priority: return False
5238 if self.buffer_id != other.buffer_id: return False
5239 if self.out_port != other.out_port: return False
5240 if self.flags != other.flags: return False
5241 if self.actions != other.actions: return False
5242 return True
5243
Rich Laneb658ddd2013-03-12 10:15:10 -07005244 def pretty_print(self, q):
5245 q.text("flow_modify {")
5246 with q.group():
5247 with q.indent(2):
5248 q.breakable()
5249 q.text("xid = ");
5250 if self.xid != None:
5251 q.text("%#x" % self.xid)
5252 else:
5253 q.text('None')
5254 q.text(","); q.breakable()
5255 q.text("match = ");
5256 q.pp(self.match)
5257 q.text(","); q.breakable()
5258 q.text("cookie = ");
5259 q.text("%#x" % self.cookie)
5260 q.text(","); q.breakable()
5261 q.text("idle_timeout = ");
5262 q.text("%#x" % self.idle_timeout)
5263 q.text(","); q.breakable()
5264 q.text("hard_timeout = ");
5265 q.text("%#x" % self.hard_timeout)
5266 q.text(","); q.breakable()
5267 q.text("priority = ");
5268 q.text("%#x" % self.priority)
5269 q.text(","); q.breakable()
5270 q.text("buffer_id = ");
5271 q.text("%#x" % self.buffer_id)
5272 q.text(","); q.breakable()
5273 q.text("out_port = ");
5274 q.text(util.pretty_port(self.out_port))
5275 q.text(","); q.breakable()
5276 q.text("flags = ");
5277 q.text("%#x" % self.flags)
5278 q.text(","); q.breakable()
5279 q.text("actions = ");
5280 q.pp(self.actions)
5281 q.breakable()
5282 q.text('}')
5283
Rich Lane7dcdf022013-12-11 14:45:27 -08005284flow_mod.subtypes[1] = flow_modify
5285
5286class flow_modify_strict(flow_mod):
Dan Talaycof6202252013-07-02 01:00:29 -07005287 version = 1
5288 type = 14
5289 _command = 2
Rich Laneb658ddd2013-03-12 10:15:10 -07005290
5291 def __init__(self, xid=None, match=None, cookie=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, flags=None, actions=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005292 if xid != None:
5293 self.xid = xid
5294 else:
5295 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07005296 if match != None:
5297 self.match = match
5298 else:
Rich Lanee2567702015-01-26 15:04:35 -08005299 self.match = ofp.match()
Rich Laneb658ddd2013-03-12 10:15:10 -07005300 if cookie != None:
5301 self.cookie = cookie
5302 else:
5303 self.cookie = 0
5304 if idle_timeout != None:
5305 self.idle_timeout = idle_timeout
5306 else:
5307 self.idle_timeout = 0
5308 if hard_timeout != None:
5309 self.hard_timeout = hard_timeout
5310 else:
5311 self.hard_timeout = 0
5312 if priority != None:
5313 self.priority = priority
5314 else:
5315 self.priority = 0
5316 if buffer_id != None:
5317 self.buffer_id = buffer_id
5318 else:
5319 self.buffer_id = 0
5320 if out_port != None:
5321 self.out_port = out_port
5322 else:
5323 self.out_port = 0
5324 if flags != None:
5325 self.flags = flags
5326 else:
5327 self.flags = 0
5328 if actions != None:
5329 self.actions = actions
5330 else:
5331 self.actions = []
Rich Lane7dcdf022013-12-11 14:45:27 -08005332 return
Rich Laneb658ddd2013-03-12 10:15:10 -07005333
5334 def pack(self):
5335 packed = []
5336 packed.append(struct.pack("!B", self.version))
5337 packed.append(struct.pack("!B", self.type))
5338 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5339 packed.append(struct.pack("!L", self.xid))
5340 packed.append(self.match.pack())
5341 packed.append(struct.pack("!Q", self.cookie))
Dan Talaycof6202252013-07-02 01:00:29 -07005342 packed.append(util.pack_fm_cmd(self._command))
Rich Laneb658ddd2013-03-12 10:15:10 -07005343 packed.append(struct.pack("!H", self.idle_timeout))
5344 packed.append(struct.pack("!H", self.hard_timeout))
5345 packed.append(struct.pack("!H", self.priority))
5346 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -07005347 packed.append(util.pack_port_no(self.out_port))
Rich Laneb658ddd2013-03-12 10:15:10 -07005348 packed.append(struct.pack("!H", self.flags))
Rich Lane7dcdf022013-12-11 14:45:27 -08005349 packed.append(loxi.generic_util.pack_list(self.actions))
Rich Laneb658ddd2013-03-12 10:15:10 -07005350 length = sum([len(x) for x in packed])
5351 packed[2] = struct.pack("!H", length)
5352 return ''.join(packed)
5353
5354 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005355 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07005356 obj = flow_modify_strict()
Dan Talaycof6202252013-07-02 01:00:29 -07005357 _version = reader.read("!B")[0]
5358 assert(_version == 1)
5359 _type = reader.read("!B")[0]
5360 assert(_type == 14)
5361 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005362 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08005363 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07005364 obj.xid = reader.read("!L")[0]
Rich Lanee2567702015-01-26 15:04:35 -08005365 obj.match = ofp.match.unpack(reader)
Dan Talaycof6202252013-07-02 01:00:29 -07005366 obj.cookie = reader.read("!Q")[0]
5367 __command = util.unpack_fm_cmd(reader)
5368 assert(__command == 2)
5369 obj.idle_timeout = reader.read("!H")[0]
5370 obj.hard_timeout = reader.read("!H")[0]
5371 obj.priority = reader.read("!H")[0]
5372 obj.buffer_id = reader.read("!L")[0]
5373 obj.out_port = util.unpack_port_no(reader)
5374 obj.flags = reader.read("!H")[0]
Rich Lanee2567702015-01-26 15:04:35 -08005375 obj.actions = loxi.generic_util.unpack_list(reader, ofp.action.action.unpack)
Rich Laneb658ddd2013-03-12 10:15:10 -07005376 return obj
5377
5378 def __eq__(self, other):
5379 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07005380 if self.xid != other.xid: return False
5381 if self.match != other.match: return False
5382 if self.cookie != other.cookie: return False
5383 if self.idle_timeout != other.idle_timeout: return False
5384 if self.hard_timeout != other.hard_timeout: return False
5385 if self.priority != other.priority: return False
5386 if self.buffer_id != other.buffer_id: return False
5387 if self.out_port != other.out_port: return False
5388 if self.flags != other.flags: return False
5389 if self.actions != other.actions: return False
5390 return True
5391
Rich Laneb658ddd2013-03-12 10:15:10 -07005392 def pretty_print(self, q):
5393 q.text("flow_modify_strict {")
5394 with q.group():
5395 with q.indent(2):
5396 q.breakable()
5397 q.text("xid = ");
5398 if self.xid != None:
5399 q.text("%#x" % self.xid)
5400 else:
5401 q.text('None')
5402 q.text(","); q.breakable()
5403 q.text("match = ");
5404 q.pp(self.match)
5405 q.text(","); q.breakable()
5406 q.text("cookie = ");
5407 q.text("%#x" % self.cookie)
5408 q.text(","); q.breakable()
5409 q.text("idle_timeout = ");
5410 q.text("%#x" % self.idle_timeout)
5411 q.text(","); q.breakable()
5412 q.text("hard_timeout = ");
5413 q.text("%#x" % self.hard_timeout)
5414 q.text(","); q.breakable()
5415 q.text("priority = ");
5416 q.text("%#x" % self.priority)
5417 q.text(","); q.breakable()
5418 q.text("buffer_id = ");
5419 q.text("%#x" % self.buffer_id)
5420 q.text(","); q.breakable()
5421 q.text("out_port = ");
5422 q.text(util.pretty_port(self.out_port))
5423 q.text(","); q.breakable()
5424 q.text("flags = ");
5425 q.text("%#x" % self.flags)
5426 q.text(","); q.breakable()
5427 q.text("actions = ");
5428 q.pp(self.actions)
5429 q.breakable()
5430 q.text('}')
5431
Rich Lane7dcdf022013-12-11 14:45:27 -08005432flow_mod.subtypes[2] = flow_modify_strict
5433
5434class flow_removed(message):
Dan Talaycof6202252013-07-02 01:00:29 -07005435 version = 1
5436 type = 11
Rich Laneb658ddd2013-03-12 10:15:10 -07005437
Rich Lanec2ee4b82013-04-24 17:12:38 -07005438 def __init__(self, xid=None, match=None, cookie=None, priority=None, reason=None, duration_sec=None, duration_nsec=None, idle_timeout=None, packet_count=None, byte_count=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005439 if xid != None:
5440 self.xid = xid
5441 else:
5442 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07005443 if match != None:
5444 self.match = match
5445 else:
Rich Lanee2567702015-01-26 15:04:35 -08005446 self.match = ofp.match()
Rich Laneb658ddd2013-03-12 10:15:10 -07005447 if cookie != None:
5448 self.cookie = cookie
5449 else:
5450 self.cookie = 0
5451 if priority != None:
5452 self.priority = priority
5453 else:
5454 self.priority = 0
5455 if reason != None:
5456 self.reason = reason
5457 else:
5458 self.reason = 0
Rich Laneb658ddd2013-03-12 10:15:10 -07005459 if duration_sec != None:
5460 self.duration_sec = duration_sec
5461 else:
5462 self.duration_sec = 0
5463 if duration_nsec != None:
5464 self.duration_nsec = duration_nsec
5465 else:
5466 self.duration_nsec = 0
5467 if idle_timeout != None:
5468 self.idle_timeout = idle_timeout
5469 else:
5470 self.idle_timeout = 0
Rich Laneb658ddd2013-03-12 10:15:10 -07005471 if packet_count != None:
5472 self.packet_count = packet_count
5473 else:
5474 self.packet_count = 0
5475 if byte_count != None:
5476 self.byte_count = byte_count
5477 else:
5478 self.byte_count = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08005479 return
Rich Laneb658ddd2013-03-12 10:15:10 -07005480
5481 def pack(self):
5482 packed = []
5483 packed.append(struct.pack("!B", self.version))
5484 packed.append(struct.pack("!B", self.type))
5485 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5486 packed.append(struct.pack("!L", self.xid))
5487 packed.append(self.match.pack())
5488 packed.append(struct.pack("!Q", self.cookie))
5489 packed.append(struct.pack("!H", self.priority))
5490 packed.append(struct.pack("!B", self.reason))
Rich Lanec2ee4b82013-04-24 17:12:38 -07005491 packed.append('\x00' * 1)
Rich Laneb658ddd2013-03-12 10:15:10 -07005492 packed.append(struct.pack("!L", self.duration_sec))
5493 packed.append(struct.pack("!L", self.duration_nsec))
5494 packed.append(struct.pack("!H", self.idle_timeout))
Rich Lanec2ee4b82013-04-24 17:12:38 -07005495 packed.append('\x00' * 2)
Rich Laneb658ddd2013-03-12 10:15:10 -07005496 packed.append(struct.pack("!Q", self.packet_count))
5497 packed.append(struct.pack("!Q", self.byte_count))
5498 length = sum([len(x) for x in packed])
5499 packed[2] = struct.pack("!H", length)
5500 return ''.join(packed)
5501
5502 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005503 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07005504 obj = flow_removed()
Dan Talaycof6202252013-07-02 01:00:29 -07005505 _version = reader.read("!B")[0]
5506 assert(_version == 1)
5507 _type = reader.read("!B")[0]
5508 assert(_type == 11)
5509 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005510 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08005511 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07005512 obj.xid = reader.read("!L")[0]
Rich Lanee2567702015-01-26 15:04:35 -08005513 obj.match = ofp.match.unpack(reader)
Dan Talaycof6202252013-07-02 01:00:29 -07005514 obj.cookie = reader.read("!Q")[0]
5515 obj.priority = reader.read("!H")[0]
5516 obj.reason = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07005517 reader.skip(1)
Dan Talaycof6202252013-07-02 01:00:29 -07005518 obj.duration_sec = reader.read("!L")[0]
5519 obj.duration_nsec = reader.read("!L")[0]
5520 obj.idle_timeout = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07005521 reader.skip(2)
Dan Talaycof6202252013-07-02 01:00:29 -07005522 obj.packet_count = reader.read("!Q")[0]
5523 obj.byte_count = reader.read("!Q")[0]
Rich Laneb658ddd2013-03-12 10:15:10 -07005524 return obj
5525
5526 def __eq__(self, other):
5527 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07005528 if self.xid != other.xid: return False
5529 if self.match != other.match: return False
5530 if self.cookie != other.cookie: return False
5531 if self.priority != other.priority: return False
5532 if self.reason != other.reason: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07005533 if self.duration_sec != other.duration_sec: return False
5534 if self.duration_nsec != other.duration_nsec: return False
5535 if self.idle_timeout != other.idle_timeout: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07005536 if self.packet_count != other.packet_count: return False
5537 if self.byte_count != other.byte_count: return False
5538 return True
5539
Rich Laneb658ddd2013-03-12 10:15:10 -07005540 def pretty_print(self, q):
5541 q.text("flow_removed {")
5542 with q.group():
5543 with q.indent(2):
5544 q.breakable()
5545 q.text("xid = ");
5546 if self.xid != None:
5547 q.text("%#x" % self.xid)
5548 else:
5549 q.text('None')
5550 q.text(","); q.breakable()
5551 q.text("match = ");
5552 q.pp(self.match)
5553 q.text(","); q.breakable()
5554 q.text("cookie = ");
5555 q.text("%#x" % self.cookie)
5556 q.text(","); q.breakable()
5557 q.text("priority = ");
5558 q.text("%#x" % self.priority)
5559 q.text(","); q.breakable()
5560 q.text("reason = ");
5561 q.text("%#x" % self.reason)
5562 q.text(","); q.breakable()
Rich Laneb658ddd2013-03-12 10:15:10 -07005563 q.text("duration_sec = ");
5564 q.text("%#x" % self.duration_sec)
5565 q.text(","); q.breakable()
5566 q.text("duration_nsec = ");
5567 q.text("%#x" % self.duration_nsec)
5568 q.text(","); q.breakable()
5569 q.text("idle_timeout = ");
5570 q.text("%#x" % self.idle_timeout)
5571 q.text(","); q.breakable()
Rich Laneb658ddd2013-03-12 10:15:10 -07005572 q.text("packet_count = ");
5573 q.text("%#x" % self.packet_count)
5574 q.text(","); q.breakable()
5575 q.text("byte_count = ");
5576 q.text("%#x" % self.byte_count)
5577 q.breakable()
5578 q.text('}')
5579
Rich Lane7dcdf022013-12-11 14:45:27 -08005580message.subtypes[11] = flow_removed
5581
5582class flow_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -07005583 version = 1
5584 type = 17
5585 stats_type = 1
Rich Laneb658ddd2013-03-12 10:15:10 -07005586
5587 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005588 if xid != None:
5589 self.xid = xid
5590 else:
5591 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07005592 if flags != None:
5593 self.flags = flags
5594 else:
5595 self.flags = 0
5596 if entries != None:
5597 self.entries = entries
5598 else:
5599 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -08005600 return
Rich Laneb658ddd2013-03-12 10:15:10 -07005601
5602 def pack(self):
5603 packed = []
5604 packed.append(struct.pack("!B", self.version))
5605 packed.append(struct.pack("!B", self.type))
5606 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5607 packed.append(struct.pack("!L", self.xid))
5608 packed.append(struct.pack("!H", self.stats_type))
5609 packed.append(struct.pack("!H", self.flags))
Rich Lane7dcdf022013-12-11 14:45:27 -08005610 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Laneb658ddd2013-03-12 10:15:10 -07005611 length = sum([len(x) for x in packed])
5612 packed[2] = struct.pack("!H", length)
5613 return ''.join(packed)
5614
5615 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005616 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07005617 obj = flow_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07005618 _version = reader.read("!B")[0]
5619 assert(_version == 1)
5620 _type = reader.read("!B")[0]
5621 assert(_type == 17)
5622 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005623 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08005624 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07005625 obj.xid = reader.read("!L")[0]
5626 _stats_type = reader.read("!H")[0]
5627 assert(_stats_type == 1)
5628 obj.flags = reader.read("!H")[0]
Rich Lanee2567702015-01-26 15:04:35 -08005629 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.flow_stats_entry.unpack)
Rich Laneb658ddd2013-03-12 10:15:10 -07005630 return obj
5631
5632 def __eq__(self, other):
5633 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07005634 if self.xid != other.xid: return False
5635 if self.flags != other.flags: return False
5636 if self.entries != other.entries: return False
5637 return True
5638
Rich Laneb658ddd2013-03-12 10:15:10 -07005639 def pretty_print(self, q):
5640 q.text("flow_stats_reply {")
5641 with q.group():
5642 with q.indent(2):
5643 q.breakable()
5644 q.text("xid = ");
5645 if self.xid != None:
5646 q.text("%#x" % self.xid)
5647 else:
5648 q.text('None')
5649 q.text(","); q.breakable()
5650 q.text("flags = ");
5651 q.text("%#x" % self.flags)
5652 q.text(","); q.breakable()
5653 q.text("entries = ");
5654 q.pp(self.entries)
5655 q.breakable()
5656 q.text('}')
5657
Rich Lane7dcdf022013-12-11 14:45:27 -08005658stats_reply.subtypes[1] = flow_stats_reply
5659
5660class flow_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -07005661 version = 1
5662 type = 16
5663 stats_type = 1
Rich Laneb658ddd2013-03-12 10:15:10 -07005664
Rich Lanec2ee4b82013-04-24 17:12:38 -07005665 def __init__(self, xid=None, flags=None, match=None, table_id=None, out_port=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005666 if xid != None:
5667 self.xid = xid
5668 else:
5669 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07005670 if flags != None:
5671 self.flags = flags
5672 else:
5673 self.flags = 0
5674 if match != None:
5675 self.match = match
5676 else:
Rich Lanee2567702015-01-26 15:04:35 -08005677 self.match = ofp.match()
Rich Laneb658ddd2013-03-12 10:15:10 -07005678 if table_id != None:
5679 self.table_id = table_id
5680 else:
5681 self.table_id = 0
Rich Laneb658ddd2013-03-12 10:15:10 -07005682 if out_port != None:
5683 self.out_port = out_port
5684 else:
5685 self.out_port = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08005686 return
Rich Laneb658ddd2013-03-12 10:15:10 -07005687
5688 def pack(self):
5689 packed = []
5690 packed.append(struct.pack("!B", self.version))
5691 packed.append(struct.pack("!B", self.type))
5692 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5693 packed.append(struct.pack("!L", self.xid))
5694 packed.append(struct.pack("!H", self.stats_type))
5695 packed.append(struct.pack("!H", self.flags))
5696 packed.append(self.match.pack())
5697 packed.append(struct.pack("!B", self.table_id))
Rich Lanec2ee4b82013-04-24 17:12:38 -07005698 packed.append('\x00' * 1)
Dan Talaycof6202252013-07-02 01:00:29 -07005699 packed.append(util.pack_port_no(self.out_port))
Rich Laneb658ddd2013-03-12 10:15:10 -07005700 length = sum([len(x) for x in packed])
5701 packed[2] = struct.pack("!H", length)
5702 return ''.join(packed)
5703
5704 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005705 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07005706 obj = flow_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -07005707 _version = reader.read("!B")[0]
5708 assert(_version == 1)
5709 _type = reader.read("!B")[0]
5710 assert(_type == 16)
5711 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005712 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08005713 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07005714 obj.xid = reader.read("!L")[0]
5715 _stats_type = reader.read("!H")[0]
5716 assert(_stats_type == 1)
5717 obj.flags = reader.read("!H")[0]
Rich Lanee2567702015-01-26 15:04:35 -08005718 obj.match = ofp.match.unpack(reader)
Dan Talaycof6202252013-07-02 01:00:29 -07005719 obj.table_id = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07005720 reader.skip(1)
Dan Talaycof6202252013-07-02 01:00:29 -07005721 obj.out_port = util.unpack_port_no(reader)
Rich Laneb658ddd2013-03-12 10:15:10 -07005722 return obj
5723
5724 def __eq__(self, other):
5725 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07005726 if self.xid != other.xid: return False
5727 if self.flags != other.flags: return False
5728 if self.match != other.match: return False
5729 if self.table_id != other.table_id: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07005730 if self.out_port != other.out_port: return False
5731 return True
5732
Rich Laneb658ddd2013-03-12 10:15:10 -07005733 def pretty_print(self, q):
5734 q.text("flow_stats_request {")
5735 with q.group():
5736 with q.indent(2):
5737 q.breakable()
5738 q.text("xid = ");
5739 if self.xid != None:
5740 q.text("%#x" % self.xid)
5741 else:
5742 q.text('None')
5743 q.text(","); q.breakable()
5744 q.text("flags = ");
5745 q.text("%#x" % self.flags)
5746 q.text(","); q.breakable()
5747 q.text("match = ");
5748 q.pp(self.match)
5749 q.text(","); q.breakable()
5750 q.text("table_id = ");
5751 q.text("%#x" % self.table_id)
5752 q.text(","); q.breakable()
Rich Laneb658ddd2013-03-12 10:15:10 -07005753 q.text("out_port = ");
5754 q.text(util.pretty_port(self.out_port))
5755 q.breakable()
5756 q.text('}')
5757
Rich Lane7dcdf022013-12-11 14:45:27 -08005758stats_request.subtypes[1] = flow_stats_request
5759
5760class get_config_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -07005761 version = 1
5762 type = 8
Rich Laneb658ddd2013-03-12 10:15:10 -07005763
5764 def __init__(self, xid=None, flags=None, miss_send_len=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005765 if xid != None:
5766 self.xid = xid
5767 else:
5768 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07005769 if flags != None:
5770 self.flags = flags
5771 else:
5772 self.flags = 0
5773 if miss_send_len != None:
5774 self.miss_send_len = miss_send_len
5775 else:
5776 self.miss_send_len = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08005777 return
Rich Laneb658ddd2013-03-12 10:15:10 -07005778
5779 def pack(self):
5780 packed = []
5781 packed.append(struct.pack("!B", self.version))
5782 packed.append(struct.pack("!B", self.type))
5783 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5784 packed.append(struct.pack("!L", self.xid))
5785 packed.append(struct.pack("!H", self.flags))
5786 packed.append(struct.pack("!H", self.miss_send_len))
5787 length = sum([len(x) for x in packed])
5788 packed[2] = struct.pack("!H", length)
5789 return ''.join(packed)
5790
5791 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005792 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07005793 obj = get_config_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07005794 _version = reader.read("!B")[0]
5795 assert(_version == 1)
5796 _type = reader.read("!B")[0]
5797 assert(_type == 8)
5798 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005799 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08005800 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07005801 obj.xid = reader.read("!L")[0]
5802 obj.flags = reader.read("!H")[0]
5803 obj.miss_send_len = reader.read("!H")[0]
Rich Laneb658ddd2013-03-12 10:15:10 -07005804 return obj
5805
5806 def __eq__(self, other):
5807 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07005808 if self.xid != other.xid: return False
5809 if self.flags != other.flags: return False
5810 if self.miss_send_len != other.miss_send_len: return False
5811 return True
5812
Rich Laneb658ddd2013-03-12 10:15:10 -07005813 def pretty_print(self, q):
5814 q.text("get_config_reply {")
5815 with q.group():
5816 with q.indent(2):
5817 q.breakable()
5818 q.text("xid = ");
5819 if self.xid != None:
5820 q.text("%#x" % self.xid)
5821 else:
5822 q.text('None')
5823 q.text(","); q.breakable()
5824 q.text("flags = ");
5825 q.text("%#x" % self.flags)
5826 q.text(","); q.breakable()
5827 q.text("miss_send_len = ");
5828 q.text("%#x" % self.miss_send_len)
5829 q.breakable()
5830 q.text('}')
5831
Rich Lane7dcdf022013-12-11 14:45:27 -08005832message.subtypes[8] = get_config_reply
5833
5834class get_config_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -07005835 version = 1
5836 type = 7
Rich Laneb658ddd2013-03-12 10:15:10 -07005837
5838 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005839 if xid != None:
5840 self.xid = xid
5841 else:
5842 self.xid = None
5843 return
Rich Laneb658ddd2013-03-12 10:15:10 -07005844
5845 def pack(self):
5846 packed = []
5847 packed.append(struct.pack("!B", self.version))
5848 packed.append(struct.pack("!B", self.type))
5849 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5850 packed.append(struct.pack("!L", self.xid))
5851 length = sum([len(x) for x in packed])
5852 packed[2] = struct.pack("!H", length)
5853 return ''.join(packed)
5854
5855 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005856 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07005857 obj = get_config_request()
Dan Talaycof6202252013-07-02 01:00:29 -07005858 _version = reader.read("!B")[0]
5859 assert(_version == 1)
5860 _type = reader.read("!B")[0]
5861 assert(_type == 7)
5862 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005863 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08005864 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07005865 obj.xid = reader.read("!L")[0]
Rich Laneb658ddd2013-03-12 10:15:10 -07005866 return obj
5867
5868 def __eq__(self, other):
5869 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07005870 if self.xid != other.xid: return False
5871 return True
5872
Rich Laneb658ddd2013-03-12 10:15:10 -07005873 def pretty_print(self, q):
5874 q.text("get_config_request {")
5875 with q.group():
5876 with q.indent(2):
5877 q.breakable()
5878 q.text("xid = ");
5879 if self.xid != None:
5880 q.text("%#x" % self.xid)
5881 else:
5882 q.text('None')
5883 q.breakable()
5884 q.text('}')
5885
Rich Lane7dcdf022013-12-11 14:45:27 -08005886message.subtypes[7] = get_config_request
5887
5888class hello(message):
Dan Talaycof6202252013-07-02 01:00:29 -07005889 version = 1
5890 type = 0
Rich Laneb658ddd2013-03-12 10:15:10 -07005891
5892 def __init__(self, xid=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005893 if xid != None:
5894 self.xid = xid
5895 else:
5896 self.xid = None
5897 return
Rich Laneb658ddd2013-03-12 10:15:10 -07005898
5899 def pack(self):
5900 packed = []
5901 packed.append(struct.pack("!B", self.version))
5902 packed.append(struct.pack("!B", self.type))
5903 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5904 packed.append(struct.pack("!L", self.xid))
5905 length = sum([len(x) for x in packed])
5906 packed[2] = struct.pack("!H", length)
5907 return ''.join(packed)
5908
5909 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005910 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07005911 obj = hello()
Dan Talaycof6202252013-07-02 01:00:29 -07005912 _version = reader.read("!B")[0]
5913 assert(_version == 1)
5914 _type = reader.read("!B")[0]
5915 assert(_type == 0)
5916 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005917 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08005918 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07005919 obj.xid = reader.read("!L")[0]
Rich Laneb658ddd2013-03-12 10:15:10 -07005920 return obj
5921
5922 def __eq__(self, other):
5923 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07005924 if self.xid != other.xid: return False
5925 return True
5926
Rich Laneb658ddd2013-03-12 10:15:10 -07005927 def pretty_print(self, q):
5928 q.text("hello {")
5929 with q.group():
5930 with q.indent(2):
5931 q.breakable()
5932 q.text("xid = ");
5933 if self.xid != None:
5934 q.text("%#x" % self.xid)
5935 else:
5936 q.text('None')
5937 q.breakable()
5938 q.text('}')
5939
Rich Lane7dcdf022013-12-11 14:45:27 -08005940message.subtypes[0] = hello
5941
5942class hello_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -07005943 version = 1
5944 type = 1
5945 err_type = 0
5946
5947 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08005948 if xid != None:
5949 self.xid = xid
5950 else:
5951 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07005952 if code != None:
5953 self.code = code
5954 else:
5955 self.code = 0
5956 if data != None:
5957 self.data = data
5958 else:
5959 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08005960 return
Rich Lane6f4978c2013-10-20 21:33:52 -07005961
5962 def pack(self):
5963 packed = []
5964 packed.append(struct.pack("!B", self.version))
5965 packed.append(struct.pack("!B", self.type))
5966 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5967 packed.append(struct.pack("!L", self.xid))
5968 packed.append(struct.pack("!H", self.err_type))
5969 packed.append(struct.pack("!H", self.code))
5970 packed.append(self.data)
5971 length = sum([len(x) for x in packed])
5972 packed[2] = struct.pack("!H", length)
5973 return ''.join(packed)
5974
5975 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08005976 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07005977 obj = hello_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -07005978 _version = reader.read("!B")[0]
5979 assert(_version == 1)
5980 _type = reader.read("!B")[0]
5981 assert(_type == 1)
5982 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08005983 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08005984 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -07005985 obj.xid = reader.read("!L")[0]
5986 _err_type = reader.read("!H")[0]
5987 assert(_err_type == 0)
5988 obj.code = reader.read("!H")[0]
5989 obj.data = str(reader.read_all())
5990 return obj
5991
5992 def __eq__(self, other):
5993 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07005994 if self.xid != other.xid: return False
5995 if self.code != other.code: return False
5996 if self.data != other.data: return False
5997 return True
5998
Rich Lane6f4978c2013-10-20 21:33:52 -07005999 def pretty_print(self, q):
6000 q.text("hello_failed_error_msg {")
6001 with q.group():
6002 with q.indent(2):
6003 q.breakable()
6004 q.text("xid = ");
6005 if self.xid != None:
6006 q.text("%#x" % self.xid)
6007 else:
6008 q.text('None')
6009 q.text(","); q.breakable()
6010 q.text("code = ");
6011 q.text("%#x" % self.code)
6012 q.text(","); q.breakable()
6013 q.text("data = ");
6014 q.pp(self.data)
6015 q.breakable()
6016 q.text('}')
6017
Rich Lane7dcdf022013-12-11 14:45:27 -08006018error_msg.subtypes[0] = hello_failed_error_msg
6019
6020class nicira_header(experimenter):
6021 subtypes = {}
6022
Rich Lane95f7fc92014-01-27 17:08:16 -08006023 version = 1
6024 type = 4
6025 experimenter = 8992
6026
6027 def __init__(self, xid=None, subtype=None):
6028 if xid != None:
6029 self.xid = xid
6030 else:
6031 self.xid = None
6032 if subtype != None:
6033 self.subtype = subtype
6034 else:
6035 self.subtype = 0
6036 return
6037
6038 def pack(self):
6039 packed = []
6040 packed.append(struct.pack("!B", self.version))
6041 packed.append(struct.pack("!B", self.type))
6042 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6043 packed.append(struct.pack("!L", self.xid))
6044 packed.append(struct.pack("!L", self.experimenter))
6045 packed.append(struct.pack("!L", self.subtype))
6046 length = sum([len(x) for x in packed])
6047 packed[2] = struct.pack("!H", length)
6048 return ''.join(packed)
6049
Rich Lane7dcdf022013-12-11 14:45:27 -08006050 @staticmethod
6051 def unpack(reader):
6052 subtype, = reader.peek('!L', 12)
Rich Lane95f7fc92014-01-27 17:08:16 -08006053 subclass = nicira_header.subtypes.get(subtype)
6054 if subclass:
6055 return subclass.unpack(reader)
6056
6057 obj = nicira_header()
6058 _version = reader.read("!B")[0]
6059 assert(_version == 1)
6060 _type = reader.read("!B")[0]
6061 assert(_type == 4)
6062 _length = reader.read("!H")[0]
6063 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006064 reader = orig_reader.slice(_length, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -08006065 obj.xid = reader.read("!L")[0]
6066 _experimenter = reader.read("!L")[0]
6067 assert(_experimenter == 8992)
6068 obj.subtype = reader.read("!L")[0]
6069 return obj
6070
6071 def __eq__(self, other):
6072 if type(self) != type(other): return False
6073 if self.xid != other.xid: return False
6074 if self.subtype != other.subtype: return False
6075 return True
6076
6077 def pretty_print(self, q):
6078 q.text("nicira_header {")
6079 with q.group():
6080 with q.indent(2):
6081 q.breakable()
6082 q.text("xid = ");
6083 if self.xid != None:
6084 q.text("%#x" % self.xid)
6085 else:
6086 q.text('None')
6087 q.breakable()
6088 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -08006089
6090experimenter.subtypes[8992] = nicira_header
6091
6092class nicira_controller_role_reply(nicira_header):
Dan Talaycof6202252013-07-02 01:00:29 -07006093 version = 1
6094 type = 4
6095 experimenter = 8992
Rich Laneb658ddd2013-03-12 10:15:10 -07006096 subtype = 11
6097
6098 def __init__(self, xid=None, role=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006099 if xid != None:
6100 self.xid = xid
6101 else:
6102 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07006103 if role != None:
6104 self.role = role
6105 else:
6106 self.role = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08006107 return
Rich Laneb658ddd2013-03-12 10:15:10 -07006108
6109 def pack(self):
6110 packed = []
6111 packed.append(struct.pack("!B", self.version))
6112 packed.append(struct.pack("!B", self.type))
6113 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6114 packed.append(struct.pack("!L", self.xid))
6115 packed.append(struct.pack("!L", self.experimenter))
6116 packed.append(struct.pack("!L", self.subtype))
6117 packed.append(struct.pack("!L", self.role))
6118 length = sum([len(x) for x in packed])
6119 packed[2] = struct.pack("!H", length)
6120 return ''.join(packed)
6121
6122 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006123 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07006124 obj = nicira_controller_role_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07006125 _version = reader.read("!B")[0]
6126 assert(_version == 1)
6127 _type = reader.read("!B")[0]
6128 assert(_type == 4)
6129 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006130 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006131 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07006132 obj.xid = reader.read("!L")[0]
6133 _experimenter = reader.read("!L")[0]
6134 assert(_experimenter == 8992)
6135 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07006136 assert(_subtype == 11)
Dan Talaycof6202252013-07-02 01:00:29 -07006137 obj.role = reader.read("!L")[0]
Rich Laneb658ddd2013-03-12 10:15:10 -07006138 return obj
6139
6140 def __eq__(self, other):
6141 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07006142 if self.xid != other.xid: return False
6143 if self.role != other.role: return False
6144 return True
6145
Rich Laneb658ddd2013-03-12 10:15:10 -07006146 def pretty_print(self, q):
6147 q.text("nicira_controller_role_reply {")
6148 with q.group():
6149 with q.indent(2):
6150 q.breakable()
6151 q.text("xid = ");
6152 if self.xid != None:
6153 q.text("%#x" % self.xid)
6154 else:
6155 q.text('None')
6156 q.text(","); q.breakable()
6157 q.text("role = ");
6158 q.text("%#x" % self.role)
6159 q.breakable()
6160 q.text('}')
6161
Rich Lane7dcdf022013-12-11 14:45:27 -08006162nicira_header.subtypes[11] = nicira_controller_role_reply
6163
6164class nicira_controller_role_request(nicira_header):
Dan Talaycof6202252013-07-02 01:00:29 -07006165 version = 1
6166 type = 4
6167 experimenter = 8992
Rich Laneb658ddd2013-03-12 10:15:10 -07006168 subtype = 10
6169
6170 def __init__(self, xid=None, role=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006171 if xid != None:
6172 self.xid = xid
6173 else:
6174 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07006175 if role != None:
6176 self.role = role
6177 else:
6178 self.role = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08006179 return
Rich Laneb658ddd2013-03-12 10:15:10 -07006180
6181 def pack(self):
6182 packed = []
6183 packed.append(struct.pack("!B", self.version))
6184 packed.append(struct.pack("!B", self.type))
6185 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6186 packed.append(struct.pack("!L", self.xid))
6187 packed.append(struct.pack("!L", self.experimenter))
6188 packed.append(struct.pack("!L", self.subtype))
6189 packed.append(struct.pack("!L", self.role))
6190 length = sum([len(x) for x in packed])
6191 packed[2] = struct.pack("!H", length)
6192 return ''.join(packed)
6193
6194 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006195 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07006196 obj = nicira_controller_role_request()
Dan Talaycof6202252013-07-02 01:00:29 -07006197 _version = reader.read("!B")[0]
6198 assert(_version == 1)
6199 _type = reader.read("!B")[0]
6200 assert(_type == 4)
6201 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006202 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006203 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07006204 obj.xid = reader.read("!L")[0]
6205 _experimenter = reader.read("!L")[0]
6206 assert(_experimenter == 8992)
6207 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07006208 assert(_subtype == 10)
Dan Talaycof6202252013-07-02 01:00:29 -07006209 obj.role = reader.read("!L")[0]
Rich Laneb658ddd2013-03-12 10:15:10 -07006210 return obj
6211
6212 def __eq__(self, other):
6213 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07006214 if self.xid != other.xid: return False
6215 if self.role != other.role: return False
6216 return True
6217
Rich Laneb658ddd2013-03-12 10:15:10 -07006218 def pretty_print(self, q):
6219 q.text("nicira_controller_role_request {")
6220 with q.group():
6221 with q.indent(2):
6222 q.breakable()
6223 q.text("xid = ");
6224 if self.xid != None:
6225 q.text("%#x" % self.xid)
6226 else:
6227 q.text('None')
6228 q.text(","); q.breakable()
6229 q.text("role = ");
6230 q.text("%#x" % self.role)
6231 q.breakable()
6232 q.text('}')
6233
Rich Lane7dcdf022013-12-11 14:45:27 -08006234nicira_header.subtypes[10] = nicira_controller_role_request
6235
6236class packet_in(message):
Dan Talaycof6202252013-07-02 01:00:29 -07006237 version = 1
6238 type = 10
Rich Laneb658ddd2013-03-12 10:15:10 -07006239
Rich Lanec2ee4b82013-04-24 17:12:38 -07006240 def __init__(self, xid=None, buffer_id=None, total_len=None, in_port=None, reason=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006241 if xid != None:
6242 self.xid = xid
6243 else:
6244 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07006245 if buffer_id != None:
6246 self.buffer_id = buffer_id
6247 else:
6248 self.buffer_id = 0
6249 if total_len != None:
6250 self.total_len = total_len
6251 else:
6252 self.total_len = 0
6253 if in_port != None:
6254 self.in_port = in_port
6255 else:
6256 self.in_port = 0
6257 if reason != None:
6258 self.reason = reason
6259 else:
6260 self.reason = 0
Rich Laneb658ddd2013-03-12 10:15:10 -07006261 if data != None:
6262 self.data = data
6263 else:
Dan Talaycof6202252013-07-02 01:00:29 -07006264 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08006265 return
Rich Laneb658ddd2013-03-12 10:15:10 -07006266
6267 def pack(self):
6268 packed = []
6269 packed.append(struct.pack("!B", self.version))
6270 packed.append(struct.pack("!B", self.type))
6271 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6272 packed.append(struct.pack("!L", self.xid))
6273 packed.append(struct.pack("!L", self.buffer_id))
6274 packed.append(struct.pack("!H", self.total_len))
Dan Talaycof6202252013-07-02 01:00:29 -07006275 packed.append(util.pack_port_no(self.in_port))
Rich Laneb658ddd2013-03-12 10:15:10 -07006276 packed.append(struct.pack("!B", self.reason))
Rich Lanec2ee4b82013-04-24 17:12:38 -07006277 packed.append('\x00' * 1)
Rich Laneb658ddd2013-03-12 10:15:10 -07006278 packed.append(self.data)
6279 length = sum([len(x) for x in packed])
6280 packed[2] = struct.pack("!H", length)
6281 return ''.join(packed)
6282
6283 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006284 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07006285 obj = packet_in()
Dan Talaycof6202252013-07-02 01:00:29 -07006286 _version = reader.read("!B")[0]
6287 assert(_version == 1)
6288 _type = reader.read("!B")[0]
6289 assert(_type == 10)
6290 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006291 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006292 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07006293 obj.xid = reader.read("!L")[0]
6294 obj.buffer_id = reader.read("!L")[0]
6295 obj.total_len = reader.read("!H")[0]
6296 obj.in_port = util.unpack_port_no(reader)
6297 obj.reason = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07006298 reader.skip(1)
6299 obj.data = str(reader.read_all())
Rich Laneb658ddd2013-03-12 10:15:10 -07006300 return obj
6301
6302 def __eq__(self, other):
6303 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07006304 if self.xid != other.xid: return False
6305 if self.buffer_id != other.buffer_id: return False
6306 if self.total_len != other.total_len: return False
6307 if self.in_port != other.in_port: return False
6308 if self.reason != other.reason: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07006309 if self.data != other.data: return False
6310 return True
6311
Rich Laneb658ddd2013-03-12 10:15:10 -07006312 def pretty_print(self, q):
6313 q.text("packet_in {")
6314 with q.group():
6315 with q.indent(2):
6316 q.breakable()
6317 q.text("xid = ");
6318 if self.xid != None:
6319 q.text("%#x" % self.xid)
6320 else:
6321 q.text('None')
6322 q.text(","); q.breakable()
6323 q.text("buffer_id = ");
6324 q.text("%#x" % self.buffer_id)
6325 q.text(","); q.breakable()
6326 q.text("total_len = ");
6327 q.text("%#x" % self.total_len)
6328 q.text(","); q.breakable()
6329 q.text("in_port = ");
6330 q.text(util.pretty_port(self.in_port))
6331 q.text(","); q.breakable()
6332 q.text("reason = ");
6333 q.text("%#x" % self.reason)
6334 q.text(","); q.breakable()
Rich Laneb658ddd2013-03-12 10:15:10 -07006335 q.text("data = ");
6336 q.pp(self.data)
6337 q.breakable()
6338 q.text('}')
6339
Rich Lane7dcdf022013-12-11 14:45:27 -08006340message.subtypes[10] = packet_in
6341
6342class packet_out(message):
Dan Talaycof6202252013-07-02 01:00:29 -07006343 version = 1
6344 type = 13
Rich Laneb658ddd2013-03-12 10:15:10 -07006345
6346 def __init__(self, xid=None, buffer_id=None, in_port=None, actions=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006347 if xid != None:
6348 self.xid = xid
6349 else:
6350 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07006351 if buffer_id != None:
6352 self.buffer_id = buffer_id
6353 else:
Rich Laneff637c92013-04-04 13:57:09 -07006354 self.buffer_id = 0
Rich Laneb658ddd2013-03-12 10:15:10 -07006355 if in_port != None:
6356 self.in_port = in_port
6357 else:
6358 self.in_port = 0
6359 if actions != None:
6360 self.actions = actions
6361 else:
6362 self.actions = []
6363 if data != None:
6364 self.data = data
6365 else:
Dan Talaycof6202252013-07-02 01:00:29 -07006366 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08006367 return
Rich Laneb658ddd2013-03-12 10:15:10 -07006368
6369 def pack(self):
6370 packed = []
6371 packed.append(struct.pack("!B", self.version))
6372 packed.append(struct.pack("!B", self.type))
Rich Lanec2ee4b82013-04-24 17:12:38 -07006373 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
Rich Laneb658ddd2013-03-12 10:15:10 -07006374 packed.append(struct.pack("!L", self.xid))
6375 packed.append(struct.pack("!L", self.buffer_id))
Dan Talaycof6202252013-07-02 01:00:29 -07006376 packed.append(util.pack_port_no(self.in_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -07006377 packed.append(struct.pack("!H", 0)) # placeholder for actions_len at index 6
Rich Lane7dcdf022013-12-11 14:45:27 -08006378 packed.append(loxi.generic_util.pack_list(self.actions))
Rich Lanec2ee4b82013-04-24 17:12:38 -07006379 packed[6] = struct.pack("!H", len(packed[-1]))
Rich Laneb658ddd2013-03-12 10:15:10 -07006380 packed.append(self.data)
6381 length = sum([len(x) for x in packed])
6382 packed[2] = struct.pack("!H", length)
6383 return ''.join(packed)
6384
6385 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006386 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07006387 obj = packet_out()
Dan Talaycof6202252013-07-02 01:00:29 -07006388 _version = reader.read("!B")[0]
6389 assert(_version == 1)
6390 _type = reader.read("!B")[0]
6391 assert(_type == 13)
6392 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006393 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006394 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07006395 obj.xid = reader.read("!L")[0]
6396 obj.buffer_id = reader.read("!L")[0]
6397 obj.in_port = util.unpack_port_no(reader)
6398 _actions_len = reader.read("!H")[0]
Rich Lanee2567702015-01-26 15:04:35 -08006399 obj.actions = loxi.generic_util.unpack_list(reader.slice(_actions_len), ofp.action.action.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -07006400 obj.data = str(reader.read_all())
Rich Laneb658ddd2013-03-12 10:15:10 -07006401 return obj
6402
6403 def __eq__(self, other):
6404 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07006405 if self.xid != other.xid: return False
6406 if self.buffer_id != other.buffer_id: return False
6407 if self.in_port != other.in_port: return False
6408 if self.actions != other.actions: return False
6409 if self.data != other.data: return False
6410 return True
6411
Rich Laneb658ddd2013-03-12 10:15:10 -07006412 def pretty_print(self, q):
6413 q.text("packet_out {")
6414 with q.group():
6415 with q.indent(2):
6416 q.breakable()
6417 q.text("xid = ");
6418 if self.xid != None:
6419 q.text("%#x" % self.xid)
6420 else:
6421 q.text('None')
6422 q.text(","); q.breakable()
6423 q.text("buffer_id = ");
6424 q.text("%#x" % self.buffer_id)
6425 q.text(","); q.breakable()
6426 q.text("in_port = ");
6427 q.text(util.pretty_port(self.in_port))
6428 q.text(","); q.breakable()
6429 q.text("actions = ");
6430 q.pp(self.actions)
6431 q.text(","); q.breakable()
6432 q.text("data = ");
6433 q.pp(self.data)
6434 q.breakable()
6435 q.text('}')
6436
Rich Lane7dcdf022013-12-11 14:45:27 -08006437message.subtypes[13] = packet_out
6438
6439class port_mod(message):
Dan Talaycof6202252013-07-02 01:00:29 -07006440 version = 1
6441 type = 15
Rich Laneb658ddd2013-03-12 10:15:10 -07006442
Rich Lanec2ee4b82013-04-24 17:12:38 -07006443 def __init__(self, xid=None, port_no=None, hw_addr=None, config=None, mask=None, advertise=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006444 if xid != None:
6445 self.xid = xid
6446 else:
6447 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07006448 if port_no != None:
6449 self.port_no = port_no
6450 else:
6451 self.port_no = 0
6452 if hw_addr != None:
6453 self.hw_addr = hw_addr
6454 else:
6455 self.hw_addr = [0,0,0,0,0,0]
6456 if config != None:
6457 self.config = config
6458 else:
6459 self.config = 0
6460 if mask != None:
6461 self.mask = mask
6462 else:
6463 self.mask = 0
6464 if advertise != None:
6465 self.advertise = advertise
6466 else:
6467 self.advertise = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08006468 return
Rich Laneb658ddd2013-03-12 10:15:10 -07006469
6470 def pack(self):
6471 packed = []
6472 packed.append(struct.pack("!B", self.version))
6473 packed.append(struct.pack("!B", self.type))
6474 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6475 packed.append(struct.pack("!L", self.xid))
Dan Talaycof6202252013-07-02 01:00:29 -07006476 packed.append(util.pack_port_no(self.port_no))
Rich Laneb658ddd2013-03-12 10:15:10 -07006477 packed.append(struct.pack("!6B", *self.hw_addr))
6478 packed.append(struct.pack("!L", self.config))
6479 packed.append(struct.pack("!L", self.mask))
6480 packed.append(struct.pack("!L", self.advertise))
Rich Lanec2ee4b82013-04-24 17:12:38 -07006481 packed.append('\x00' * 4)
Rich Laneb658ddd2013-03-12 10:15:10 -07006482 length = sum([len(x) for x in packed])
6483 packed[2] = struct.pack("!H", length)
6484 return ''.join(packed)
6485
6486 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006487 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07006488 obj = port_mod()
Dan Talaycof6202252013-07-02 01:00:29 -07006489 _version = reader.read("!B")[0]
6490 assert(_version == 1)
6491 _type = reader.read("!B")[0]
6492 assert(_type == 15)
6493 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006494 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006495 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07006496 obj.xid = reader.read("!L")[0]
6497 obj.port_no = util.unpack_port_no(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -07006498 obj.hw_addr = list(reader.read('!6B'))
Dan Talaycof6202252013-07-02 01:00:29 -07006499 obj.config = reader.read("!L")[0]
6500 obj.mask = reader.read("!L")[0]
6501 obj.advertise = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07006502 reader.skip(4)
Rich Laneb658ddd2013-03-12 10:15:10 -07006503 return obj
6504
6505 def __eq__(self, other):
6506 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07006507 if self.xid != other.xid: return False
6508 if self.port_no != other.port_no: return False
6509 if self.hw_addr != other.hw_addr: return False
6510 if self.config != other.config: return False
6511 if self.mask != other.mask: return False
6512 if self.advertise != other.advertise: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07006513 return True
6514
Rich Laneb658ddd2013-03-12 10:15:10 -07006515 def pretty_print(self, q):
6516 q.text("port_mod {")
6517 with q.group():
6518 with q.indent(2):
6519 q.breakable()
6520 q.text("xid = ");
6521 if self.xid != None:
6522 q.text("%#x" % self.xid)
6523 else:
6524 q.text('None')
6525 q.text(","); q.breakable()
6526 q.text("port_no = ");
6527 q.text(util.pretty_port(self.port_no))
6528 q.text(","); q.breakable()
6529 q.text("hw_addr = ");
6530 q.text(util.pretty_mac(self.hw_addr))
6531 q.text(","); q.breakable()
6532 q.text("config = ");
6533 q.text("%#x" % self.config)
6534 q.text(","); q.breakable()
6535 q.text("mask = ");
6536 q.text("%#x" % self.mask)
6537 q.text(","); q.breakable()
6538 q.text("advertise = ");
6539 q.text("%#x" % self.advertise)
Rich Laneb658ddd2013-03-12 10:15:10 -07006540 q.breakable()
6541 q.text('}')
6542
Rich Lane7dcdf022013-12-11 14:45:27 -08006543message.subtypes[15] = port_mod
6544
6545class port_mod_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -07006546 version = 1
6547 type = 1
6548 err_type = 4
6549
6550 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006551 if xid != None:
6552 self.xid = xid
6553 else:
6554 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07006555 if code != None:
6556 self.code = code
6557 else:
6558 self.code = 0
6559 if data != None:
6560 self.data = data
6561 else:
6562 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08006563 return
Rich Lane6f4978c2013-10-20 21:33:52 -07006564
6565 def pack(self):
6566 packed = []
6567 packed.append(struct.pack("!B", self.version))
6568 packed.append(struct.pack("!B", self.type))
6569 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6570 packed.append(struct.pack("!L", self.xid))
6571 packed.append(struct.pack("!H", self.err_type))
6572 packed.append(struct.pack("!H", self.code))
6573 packed.append(self.data)
6574 length = sum([len(x) for x in packed])
6575 packed[2] = struct.pack("!H", length)
6576 return ''.join(packed)
6577
6578 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006579 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07006580 obj = port_mod_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -07006581 _version = reader.read("!B")[0]
6582 assert(_version == 1)
6583 _type = reader.read("!B")[0]
6584 assert(_type == 1)
6585 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006586 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006587 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -07006588 obj.xid = reader.read("!L")[0]
6589 _err_type = reader.read("!H")[0]
6590 assert(_err_type == 4)
6591 obj.code = reader.read("!H")[0]
6592 obj.data = str(reader.read_all())
6593 return obj
6594
6595 def __eq__(self, other):
6596 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07006597 if self.xid != other.xid: return False
6598 if self.code != other.code: return False
6599 if self.data != other.data: return False
6600 return True
6601
Rich Lane6f4978c2013-10-20 21:33:52 -07006602 def pretty_print(self, q):
6603 q.text("port_mod_failed_error_msg {")
6604 with q.group():
6605 with q.indent(2):
6606 q.breakable()
6607 q.text("xid = ");
6608 if self.xid != None:
6609 q.text("%#x" % self.xid)
6610 else:
6611 q.text('None')
6612 q.text(","); q.breakable()
6613 q.text("code = ");
6614 q.text("%#x" % self.code)
6615 q.text(","); q.breakable()
6616 q.text("data = ");
6617 q.pp(self.data)
6618 q.breakable()
6619 q.text('}')
6620
Rich Lane7dcdf022013-12-11 14:45:27 -08006621error_msg.subtypes[4] = port_mod_failed_error_msg
6622
6623class port_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -07006624 version = 1
6625 type = 17
6626 stats_type = 4
Rich Laneb658ddd2013-03-12 10:15:10 -07006627
6628 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006629 if xid != None:
6630 self.xid = xid
6631 else:
6632 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07006633 if flags != None:
6634 self.flags = flags
6635 else:
6636 self.flags = 0
6637 if entries != None:
6638 self.entries = entries
6639 else:
6640 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -08006641 return
Rich Laneb658ddd2013-03-12 10:15:10 -07006642
6643 def pack(self):
6644 packed = []
6645 packed.append(struct.pack("!B", self.version))
6646 packed.append(struct.pack("!B", self.type))
6647 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6648 packed.append(struct.pack("!L", self.xid))
6649 packed.append(struct.pack("!H", self.stats_type))
6650 packed.append(struct.pack("!H", self.flags))
Rich Lane7dcdf022013-12-11 14:45:27 -08006651 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Laneb658ddd2013-03-12 10:15:10 -07006652 length = sum([len(x) for x in packed])
6653 packed[2] = struct.pack("!H", length)
6654 return ''.join(packed)
6655
6656 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006657 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07006658 obj = port_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07006659 _version = reader.read("!B")[0]
6660 assert(_version == 1)
6661 _type = reader.read("!B")[0]
6662 assert(_type == 17)
6663 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006664 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006665 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07006666 obj.xid = reader.read("!L")[0]
6667 _stats_type = reader.read("!H")[0]
6668 assert(_stats_type == 4)
6669 obj.flags = reader.read("!H")[0]
Rich Lanee2567702015-01-26 15:04:35 -08006670 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.port_stats_entry.unpack)
Rich Laneb658ddd2013-03-12 10:15:10 -07006671 return obj
6672
6673 def __eq__(self, other):
6674 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07006675 if self.xid != other.xid: return False
6676 if self.flags != other.flags: return False
6677 if self.entries != other.entries: return False
6678 return True
6679
Rich Laneb658ddd2013-03-12 10:15:10 -07006680 def pretty_print(self, q):
6681 q.text("port_stats_reply {")
6682 with q.group():
6683 with q.indent(2):
6684 q.breakable()
6685 q.text("xid = ");
6686 if self.xid != None:
6687 q.text("%#x" % self.xid)
6688 else:
6689 q.text('None')
6690 q.text(","); q.breakable()
6691 q.text("flags = ");
6692 q.text("%#x" % self.flags)
6693 q.text(","); q.breakable()
6694 q.text("entries = ");
6695 q.pp(self.entries)
6696 q.breakable()
6697 q.text('}')
6698
Rich Lane7dcdf022013-12-11 14:45:27 -08006699stats_reply.subtypes[4] = port_stats_reply
6700
6701class port_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -07006702 version = 1
6703 type = 16
6704 stats_type = 4
Rich Laneb658ddd2013-03-12 10:15:10 -07006705
Rich Lanec2ee4b82013-04-24 17:12:38 -07006706 def __init__(self, xid=None, flags=None, port_no=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006707 if xid != None:
6708 self.xid = xid
6709 else:
6710 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07006711 if flags != None:
6712 self.flags = flags
6713 else:
6714 self.flags = 0
6715 if port_no != None:
6716 self.port_no = port_no
6717 else:
6718 self.port_no = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08006719 return
Rich Laneb658ddd2013-03-12 10:15:10 -07006720
6721 def pack(self):
6722 packed = []
6723 packed.append(struct.pack("!B", self.version))
6724 packed.append(struct.pack("!B", self.type))
6725 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6726 packed.append(struct.pack("!L", self.xid))
6727 packed.append(struct.pack("!H", self.stats_type))
6728 packed.append(struct.pack("!H", self.flags))
Dan Talaycof6202252013-07-02 01:00:29 -07006729 packed.append(util.pack_port_no(self.port_no))
Rich Lanec2ee4b82013-04-24 17:12:38 -07006730 packed.append('\x00' * 6)
Rich Laneb658ddd2013-03-12 10:15:10 -07006731 length = sum([len(x) for x in packed])
6732 packed[2] = struct.pack("!H", length)
6733 return ''.join(packed)
6734
6735 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006736 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07006737 obj = port_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -07006738 _version = reader.read("!B")[0]
6739 assert(_version == 1)
6740 _type = reader.read("!B")[0]
6741 assert(_type == 16)
6742 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006743 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006744 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07006745 obj.xid = reader.read("!L")[0]
6746 _stats_type = reader.read("!H")[0]
6747 assert(_stats_type == 4)
6748 obj.flags = reader.read("!H")[0]
6749 obj.port_no = util.unpack_port_no(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -07006750 reader.skip(6)
Rich Laneb658ddd2013-03-12 10:15:10 -07006751 return obj
6752
6753 def __eq__(self, other):
6754 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07006755 if self.xid != other.xid: return False
6756 if self.flags != other.flags: return False
6757 if self.port_no != other.port_no: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07006758 return True
6759
Rich Laneb658ddd2013-03-12 10:15:10 -07006760 def pretty_print(self, q):
6761 q.text("port_stats_request {")
6762 with q.group():
6763 with q.indent(2):
6764 q.breakable()
6765 q.text("xid = ");
6766 if self.xid != None:
6767 q.text("%#x" % self.xid)
6768 else:
6769 q.text('None')
6770 q.text(","); q.breakable()
6771 q.text("flags = ");
6772 q.text("%#x" % self.flags)
6773 q.text(","); q.breakable()
6774 q.text("port_no = ");
6775 q.text(util.pretty_port(self.port_no))
Rich Laneb658ddd2013-03-12 10:15:10 -07006776 q.breakable()
6777 q.text('}')
6778
Rich Lane7dcdf022013-12-11 14:45:27 -08006779stats_request.subtypes[4] = port_stats_request
6780
6781class port_status(message):
Dan Talaycof6202252013-07-02 01:00:29 -07006782 version = 1
6783 type = 12
Rich Laneb658ddd2013-03-12 10:15:10 -07006784
Rich Lanec2ee4b82013-04-24 17:12:38 -07006785 def __init__(self, xid=None, reason=None, desc=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006786 if xid != None:
6787 self.xid = xid
6788 else:
6789 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07006790 if reason != None:
6791 self.reason = reason
6792 else:
6793 self.reason = 0
Rich Laneb658ddd2013-03-12 10:15:10 -07006794 if desc != None:
6795 self.desc = desc
6796 else:
Rich Lanee2567702015-01-26 15:04:35 -08006797 self.desc = ofp.port_desc()
Rich Lane7dcdf022013-12-11 14:45:27 -08006798 return
Rich Laneb658ddd2013-03-12 10:15:10 -07006799
6800 def pack(self):
6801 packed = []
6802 packed.append(struct.pack("!B", self.version))
6803 packed.append(struct.pack("!B", self.type))
6804 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6805 packed.append(struct.pack("!L", self.xid))
6806 packed.append(struct.pack("!B", self.reason))
Rich Lanec2ee4b82013-04-24 17:12:38 -07006807 packed.append('\x00' * 7)
Rich Laneb658ddd2013-03-12 10:15:10 -07006808 packed.append(self.desc.pack())
6809 length = sum([len(x) for x in packed])
6810 packed[2] = struct.pack("!H", length)
6811 return ''.join(packed)
6812
6813 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006814 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07006815 obj = port_status()
Dan Talaycof6202252013-07-02 01:00:29 -07006816 _version = reader.read("!B")[0]
6817 assert(_version == 1)
6818 _type = reader.read("!B")[0]
6819 assert(_type == 12)
6820 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006821 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006822 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07006823 obj.xid = reader.read("!L")[0]
6824 obj.reason = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07006825 reader.skip(7)
Rich Lanee2567702015-01-26 15:04:35 -08006826 obj.desc = ofp.port_desc.unpack(reader)
Rich Laneb658ddd2013-03-12 10:15:10 -07006827 return obj
6828
6829 def __eq__(self, other):
6830 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07006831 if self.xid != other.xid: return False
6832 if self.reason != other.reason: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07006833 if self.desc != other.desc: return False
6834 return True
6835
Rich Laneb658ddd2013-03-12 10:15:10 -07006836 def pretty_print(self, q):
6837 q.text("port_status {")
6838 with q.group():
6839 with q.indent(2):
6840 q.breakable()
6841 q.text("xid = ");
6842 if self.xid != None:
6843 q.text("%#x" % self.xid)
6844 else:
6845 q.text('None')
6846 q.text(","); q.breakable()
6847 q.text("reason = ");
6848 q.text("%#x" % self.reason)
6849 q.text(","); q.breakable()
Rich Laneb658ddd2013-03-12 10:15:10 -07006850 q.text("desc = ");
6851 q.pp(self.desc)
6852 q.breakable()
6853 q.text('}')
6854
Rich Lane7dcdf022013-12-11 14:45:27 -08006855message.subtypes[12] = port_status
6856
6857class queue_get_config_reply(message):
Dan Talaycof6202252013-07-02 01:00:29 -07006858 version = 1
6859 type = 21
Rich Laneb658ddd2013-03-12 10:15:10 -07006860
Rich Lanec2ee4b82013-04-24 17:12:38 -07006861 def __init__(self, xid=None, port=None, queues=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006862 if xid != None:
6863 self.xid = xid
6864 else:
6865 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07006866 if port != None:
6867 self.port = port
6868 else:
6869 self.port = 0
Rich Laneb658ddd2013-03-12 10:15:10 -07006870 if queues != None:
6871 self.queues = queues
6872 else:
6873 self.queues = []
Rich Lane7dcdf022013-12-11 14:45:27 -08006874 return
Rich Laneb658ddd2013-03-12 10:15:10 -07006875
6876 def pack(self):
6877 packed = []
6878 packed.append(struct.pack("!B", self.version))
6879 packed.append(struct.pack("!B", self.type))
6880 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6881 packed.append(struct.pack("!L", self.xid))
Dan Talaycof6202252013-07-02 01:00:29 -07006882 packed.append(util.pack_port_no(self.port))
Rich Lanec2ee4b82013-04-24 17:12:38 -07006883 packed.append('\x00' * 6)
Rich Lane7dcdf022013-12-11 14:45:27 -08006884 packed.append(loxi.generic_util.pack_list(self.queues))
Rich Laneb658ddd2013-03-12 10:15:10 -07006885 length = sum([len(x) for x in packed])
6886 packed[2] = struct.pack("!H", length)
6887 return ''.join(packed)
6888
6889 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006890 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07006891 obj = queue_get_config_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07006892 _version = reader.read("!B")[0]
6893 assert(_version == 1)
6894 _type = reader.read("!B")[0]
6895 assert(_type == 21)
6896 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006897 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006898 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07006899 obj.xid = reader.read("!L")[0]
6900 obj.port = util.unpack_port_no(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -07006901 reader.skip(6)
Rich Lanee2567702015-01-26 15:04:35 -08006902 obj.queues = loxi.generic_util.unpack_list(reader, ofp.common.packet_queue.unpack)
Rich Laneb658ddd2013-03-12 10:15:10 -07006903 return obj
6904
6905 def __eq__(self, other):
6906 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07006907 if self.xid != other.xid: return False
6908 if self.port != other.port: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07006909 if self.queues != other.queues: return False
6910 return True
6911
Rich Laneb658ddd2013-03-12 10:15:10 -07006912 def pretty_print(self, q):
6913 q.text("queue_get_config_reply {")
6914 with q.group():
6915 with q.indent(2):
6916 q.breakable()
6917 q.text("xid = ");
6918 if self.xid != None:
6919 q.text("%#x" % self.xid)
6920 else:
6921 q.text('None')
6922 q.text(","); q.breakable()
6923 q.text("port = ");
6924 q.text(util.pretty_port(self.port))
6925 q.text(","); q.breakable()
Rich Laneb658ddd2013-03-12 10:15:10 -07006926 q.text("queues = ");
6927 q.pp(self.queues)
6928 q.breakable()
6929 q.text('}')
6930
Rich Lane7dcdf022013-12-11 14:45:27 -08006931message.subtypes[21] = queue_get_config_reply
6932
6933class queue_get_config_request(message):
Dan Talaycof6202252013-07-02 01:00:29 -07006934 version = 1
6935 type = 20
Rich Laneb658ddd2013-03-12 10:15:10 -07006936
Rich Lanec2ee4b82013-04-24 17:12:38 -07006937 def __init__(self, xid=None, port=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08006938 if xid != None:
6939 self.xid = xid
6940 else:
6941 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07006942 if port != None:
6943 self.port = port
6944 else:
6945 self.port = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08006946 return
Rich Laneb658ddd2013-03-12 10:15:10 -07006947
6948 def pack(self):
6949 packed = []
6950 packed.append(struct.pack("!B", self.version))
6951 packed.append(struct.pack("!B", self.type))
6952 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6953 packed.append(struct.pack("!L", self.xid))
Dan Talaycof6202252013-07-02 01:00:29 -07006954 packed.append(util.pack_port_no(self.port))
Rich Lanec2ee4b82013-04-24 17:12:38 -07006955 packed.append('\x00' * 2)
Rich Laneb658ddd2013-03-12 10:15:10 -07006956 length = sum([len(x) for x in packed])
6957 packed[2] = struct.pack("!H", length)
6958 return ''.join(packed)
6959
6960 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08006961 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07006962 obj = queue_get_config_request()
Dan Talaycof6202252013-07-02 01:00:29 -07006963 _version = reader.read("!B")[0]
6964 assert(_version == 1)
6965 _type = reader.read("!B")[0]
6966 assert(_type == 20)
6967 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08006968 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08006969 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07006970 obj.xid = reader.read("!L")[0]
6971 obj.port = util.unpack_port_no(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -07006972 reader.skip(2)
Rich Laneb658ddd2013-03-12 10:15:10 -07006973 return obj
6974
6975 def __eq__(self, other):
6976 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07006977 if self.xid != other.xid: return False
6978 if self.port != other.port: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07006979 return True
6980
Rich Laneb658ddd2013-03-12 10:15:10 -07006981 def pretty_print(self, q):
6982 q.text("queue_get_config_request {")
6983 with q.group():
6984 with q.indent(2):
6985 q.breakable()
6986 q.text("xid = ");
6987 if self.xid != None:
6988 q.text("%#x" % self.xid)
6989 else:
6990 q.text('None')
6991 q.text(","); q.breakable()
6992 q.text("port = ");
6993 q.text(util.pretty_port(self.port))
Rich Laneb658ddd2013-03-12 10:15:10 -07006994 q.breakable()
6995 q.text('}')
6996
Rich Lane7dcdf022013-12-11 14:45:27 -08006997message.subtypes[20] = queue_get_config_request
6998
6999class queue_op_failed_error_msg(error_msg):
Rich Lane6f4978c2013-10-20 21:33:52 -07007000 version = 1
7001 type = 1
7002 err_type = 5
7003
7004 def __init__(self, xid=None, code=None, data=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007005 if xid != None:
7006 self.xid = xid
7007 else:
7008 self.xid = None
Rich Lane6f4978c2013-10-20 21:33:52 -07007009 if code != None:
7010 self.code = code
7011 else:
7012 self.code = 0
7013 if data != None:
7014 self.data = data
7015 else:
7016 self.data = ''
Rich Lane7dcdf022013-12-11 14:45:27 -08007017 return
Rich Lane6f4978c2013-10-20 21:33:52 -07007018
7019 def pack(self):
7020 packed = []
7021 packed.append(struct.pack("!B", self.version))
7022 packed.append(struct.pack("!B", self.type))
7023 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7024 packed.append(struct.pack("!L", self.xid))
7025 packed.append(struct.pack("!H", self.err_type))
7026 packed.append(struct.pack("!H", self.code))
7027 packed.append(self.data)
7028 length = sum([len(x) for x in packed])
7029 packed[2] = struct.pack("!H", length)
7030 return ''.join(packed)
7031
7032 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007033 def unpack(reader):
Rich Lane6f4978c2013-10-20 21:33:52 -07007034 obj = queue_op_failed_error_msg()
Rich Lane6f4978c2013-10-20 21:33:52 -07007035 _version = reader.read("!B")[0]
7036 assert(_version == 1)
7037 _type = reader.read("!B")[0]
7038 assert(_type == 1)
7039 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007040 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007041 reader = orig_reader.slice(_length, 4)
Rich Lane6f4978c2013-10-20 21:33:52 -07007042 obj.xid = reader.read("!L")[0]
7043 _err_type = reader.read("!H")[0]
7044 assert(_err_type == 5)
7045 obj.code = reader.read("!H")[0]
7046 obj.data = str(reader.read_all())
7047 return obj
7048
7049 def __eq__(self, other):
7050 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07007051 if self.xid != other.xid: return False
7052 if self.code != other.code: return False
7053 if self.data != other.data: return False
7054 return True
7055
Rich Lane6f4978c2013-10-20 21:33:52 -07007056 def pretty_print(self, q):
7057 q.text("queue_op_failed_error_msg {")
7058 with q.group():
7059 with q.indent(2):
7060 q.breakable()
7061 q.text("xid = ");
7062 if self.xid != None:
7063 q.text("%#x" % self.xid)
7064 else:
7065 q.text('None')
7066 q.text(","); q.breakable()
7067 q.text("code = ");
7068 q.text("%#x" % self.code)
7069 q.text(","); q.breakable()
7070 q.text("data = ");
7071 q.pp(self.data)
7072 q.breakable()
7073 q.text('}')
7074
Rich Lane7dcdf022013-12-11 14:45:27 -08007075error_msg.subtypes[5] = queue_op_failed_error_msg
7076
7077class queue_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -07007078 version = 1
7079 type = 17
7080 stats_type = 5
Rich Laneb658ddd2013-03-12 10:15:10 -07007081
7082 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007083 if xid != None:
7084 self.xid = xid
7085 else:
7086 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07007087 if flags != None:
7088 self.flags = flags
7089 else:
7090 self.flags = 0
7091 if entries != None:
7092 self.entries = entries
7093 else:
7094 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -08007095 return
Rich Laneb658ddd2013-03-12 10:15:10 -07007096
7097 def pack(self):
7098 packed = []
7099 packed.append(struct.pack("!B", self.version))
7100 packed.append(struct.pack("!B", self.type))
7101 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7102 packed.append(struct.pack("!L", self.xid))
7103 packed.append(struct.pack("!H", self.stats_type))
7104 packed.append(struct.pack("!H", self.flags))
Rich Lane7dcdf022013-12-11 14:45:27 -08007105 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Laneb658ddd2013-03-12 10:15:10 -07007106 length = sum([len(x) for x in packed])
7107 packed[2] = struct.pack("!H", length)
7108 return ''.join(packed)
7109
7110 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007111 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07007112 obj = queue_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07007113 _version = reader.read("!B")[0]
7114 assert(_version == 1)
7115 _type = reader.read("!B")[0]
7116 assert(_type == 17)
7117 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007118 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007119 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07007120 obj.xid = reader.read("!L")[0]
7121 _stats_type = reader.read("!H")[0]
7122 assert(_stats_type == 5)
7123 obj.flags = reader.read("!H")[0]
Rich Lanee2567702015-01-26 15:04:35 -08007124 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.queue_stats_entry.unpack)
Rich Laneb658ddd2013-03-12 10:15:10 -07007125 return obj
7126
7127 def __eq__(self, other):
7128 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07007129 if self.xid != other.xid: return False
7130 if self.flags != other.flags: return False
7131 if self.entries != other.entries: return False
7132 return True
7133
Rich Laneb658ddd2013-03-12 10:15:10 -07007134 def pretty_print(self, q):
7135 q.text("queue_stats_reply {")
7136 with q.group():
7137 with q.indent(2):
7138 q.breakable()
7139 q.text("xid = ");
7140 if self.xid != None:
7141 q.text("%#x" % self.xid)
7142 else:
7143 q.text('None')
7144 q.text(","); q.breakable()
7145 q.text("flags = ");
7146 q.text("%#x" % self.flags)
7147 q.text(","); q.breakable()
7148 q.text("entries = ");
7149 q.pp(self.entries)
7150 q.breakable()
7151 q.text('}')
7152
Rich Lane7dcdf022013-12-11 14:45:27 -08007153stats_reply.subtypes[5] = queue_stats_reply
7154
7155class queue_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -07007156 version = 1
7157 type = 16
7158 stats_type = 5
Rich Laneb658ddd2013-03-12 10:15:10 -07007159
Rich Lanec2ee4b82013-04-24 17:12:38 -07007160 def __init__(self, xid=None, flags=None, port_no=None, queue_id=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007161 if xid != None:
7162 self.xid = xid
7163 else:
7164 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07007165 if flags != None:
7166 self.flags = flags
7167 else:
7168 self.flags = 0
7169 if port_no != None:
7170 self.port_no = port_no
7171 else:
7172 self.port_no = 0
Rich Laneb658ddd2013-03-12 10:15:10 -07007173 if queue_id != None:
7174 self.queue_id = queue_id
7175 else:
7176 self.queue_id = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08007177 return
Rich Laneb658ddd2013-03-12 10:15:10 -07007178
7179 def pack(self):
7180 packed = []
7181 packed.append(struct.pack("!B", self.version))
7182 packed.append(struct.pack("!B", self.type))
7183 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7184 packed.append(struct.pack("!L", self.xid))
7185 packed.append(struct.pack("!H", self.stats_type))
7186 packed.append(struct.pack("!H", self.flags))
Dan Talaycof6202252013-07-02 01:00:29 -07007187 packed.append(util.pack_port_no(self.port_no))
Rich Lanec2ee4b82013-04-24 17:12:38 -07007188 packed.append('\x00' * 2)
Rich Laneb658ddd2013-03-12 10:15:10 -07007189 packed.append(struct.pack("!L", self.queue_id))
7190 length = sum([len(x) for x in packed])
7191 packed[2] = struct.pack("!H", length)
7192 return ''.join(packed)
7193
7194 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007195 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07007196 obj = queue_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -07007197 _version = reader.read("!B")[0]
7198 assert(_version == 1)
7199 _type = reader.read("!B")[0]
7200 assert(_type == 16)
7201 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007202 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007203 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07007204 obj.xid = reader.read("!L")[0]
7205 _stats_type = reader.read("!H")[0]
7206 assert(_stats_type == 5)
7207 obj.flags = reader.read("!H")[0]
7208 obj.port_no = util.unpack_port_no(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -07007209 reader.skip(2)
Dan Talaycof6202252013-07-02 01:00:29 -07007210 obj.queue_id = reader.read("!L")[0]
Rich Laneb658ddd2013-03-12 10:15:10 -07007211 return obj
7212
7213 def __eq__(self, other):
7214 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07007215 if self.xid != other.xid: return False
7216 if self.flags != other.flags: return False
7217 if self.port_no != other.port_no: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07007218 if self.queue_id != other.queue_id: return False
7219 return True
7220
Rich Laneb658ddd2013-03-12 10:15:10 -07007221 def pretty_print(self, q):
7222 q.text("queue_stats_request {")
7223 with q.group():
7224 with q.indent(2):
7225 q.breakable()
7226 q.text("xid = ");
7227 if self.xid != None:
7228 q.text("%#x" % self.xid)
7229 else:
7230 q.text('None')
7231 q.text(","); q.breakable()
7232 q.text("flags = ");
7233 q.text("%#x" % self.flags)
7234 q.text(","); q.breakable()
7235 q.text("port_no = ");
7236 q.text(util.pretty_port(self.port_no))
7237 q.text(","); q.breakable()
Rich Laneb658ddd2013-03-12 10:15:10 -07007238 q.text("queue_id = ");
7239 q.text("%#x" % self.queue_id)
7240 q.breakable()
7241 q.text('}')
7242
Rich Lane7dcdf022013-12-11 14:45:27 -08007243stats_request.subtypes[5] = queue_stats_request
7244
7245class set_config(message):
Dan Talaycof6202252013-07-02 01:00:29 -07007246 version = 1
7247 type = 9
Rich Laneb658ddd2013-03-12 10:15:10 -07007248
7249 def __init__(self, xid=None, flags=None, miss_send_len=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007250 if xid != None:
7251 self.xid = xid
7252 else:
7253 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07007254 if flags != None:
7255 self.flags = flags
7256 else:
7257 self.flags = 0
7258 if miss_send_len != None:
7259 self.miss_send_len = miss_send_len
7260 else:
7261 self.miss_send_len = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08007262 return
Rich Laneb658ddd2013-03-12 10:15:10 -07007263
7264 def pack(self):
7265 packed = []
7266 packed.append(struct.pack("!B", self.version))
7267 packed.append(struct.pack("!B", self.type))
7268 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7269 packed.append(struct.pack("!L", self.xid))
7270 packed.append(struct.pack("!H", self.flags))
7271 packed.append(struct.pack("!H", self.miss_send_len))
7272 length = sum([len(x) for x in packed])
7273 packed[2] = struct.pack("!H", length)
7274 return ''.join(packed)
7275
7276 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007277 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07007278 obj = set_config()
Dan Talaycof6202252013-07-02 01:00:29 -07007279 _version = reader.read("!B")[0]
7280 assert(_version == 1)
7281 _type = reader.read("!B")[0]
7282 assert(_type == 9)
7283 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007284 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007285 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07007286 obj.xid = reader.read("!L")[0]
7287 obj.flags = reader.read("!H")[0]
7288 obj.miss_send_len = reader.read("!H")[0]
Rich Laneb658ddd2013-03-12 10:15:10 -07007289 return obj
7290
7291 def __eq__(self, other):
7292 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07007293 if self.xid != other.xid: return False
7294 if self.flags != other.flags: return False
7295 if self.miss_send_len != other.miss_send_len: return False
7296 return True
7297
Rich Laneb658ddd2013-03-12 10:15:10 -07007298 def pretty_print(self, q):
7299 q.text("set_config {")
7300 with q.group():
7301 with q.indent(2):
7302 q.breakable()
7303 q.text("xid = ");
7304 if self.xid != None:
7305 q.text("%#x" % self.xid)
7306 else:
7307 q.text('None')
7308 q.text(","); q.breakable()
7309 q.text("flags = ");
7310 q.text("%#x" % self.flags)
7311 q.text(","); q.breakable()
7312 q.text("miss_send_len = ");
7313 q.text("%#x" % self.miss_send_len)
7314 q.breakable()
7315 q.text('}')
7316
Rich Lane7dcdf022013-12-11 14:45:27 -08007317message.subtypes[9] = set_config
7318
7319class table_mod(message):
Dan Talaycof6202252013-07-02 01:00:29 -07007320 version = 1
Rich Laneb658ddd2013-03-12 10:15:10 -07007321 type = 22
7322
Rich Lanec2ee4b82013-04-24 17:12:38 -07007323 def __init__(self, xid=None, table_id=None, config=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007324 if xid != None:
7325 self.xid = xid
7326 else:
7327 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07007328 if table_id != None:
7329 self.table_id = table_id
7330 else:
7331 self.table_id = 0
Rich Laneb658ddd2013-03-12 10:15:10 -07007332 if config != None:
7333 self.config = config
7334 else:
7335 self.config = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08007336 return
Rich Laneb658ddd2013-03-12 10:15:10 -07007337
7338 def pack(self):
7339 packed = []
7340 packed.append(struct.pack("!B", self.version))
7341 packed.append(struct.pack("!B", self.type))
7342 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7343 packed.append(struct.pack("!L", self.xid))
7344 packed.append(struct.pack("!B", self.table_id))
Rich Lanec2ee4b82013-04-24 17:12:38 -07007345 packed.append('\x00' * 3)
Rich Laneb658ddd2013-03-12 10:15:10 -07007346 packed.append(struct.pack("!L", self.config))
7347 length = sum([len(x) for x in packed])
7348 packed[2] = struct.pack("!H", length)
7349 return ''.join(packed)
7350
7351 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007352 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07007353 obj = table_mod()
Dan Talaycof6202252013-07-02 01:00:29 -07007354 _version = reader.read("!B")[0]
7355 assert(_version == 1)
7356 _type = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007357 assert(_type == 22)
Dan Talaycof6202252013-07-02 01:00:29 -07007358 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007359 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007360 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07007361 obj.xid = reader.read("!L")[0]
7362 obj.table_id = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07007363 reader.skip(3)
Dan Talaycof6202252013-07-02 01:00:29 -07007364 obj.config = reader.read("!L")[0]
Rich Laneb658ddd2013-03-12 10:15:10 -07007365 return obj
7366
7367 def __eq__(self, other):
7368 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07007369 if self.xid != other.xid: return False
7370 if self.table_id != other.table_id: return False
Rich Laneb658ddd2013-03-12 10:15:10 -07007371 if self.config != other.config: return False
7372 return True
7373
Rich Laneb658ddd2013-03-12 10:15:10 -07007374 def pretty_print(self, q):
7375 q.text("table_mod {")
7376 with q.group():
7377 with q.indent(2):
7378 q.breakable()
7379 q.text("xid = ");
7380 if self.xid != None:
7381 q.text("%#x" % self.xid)
7382 else:
7383 q.text('None')
7384 q.text(","); q.breakable()
7385 q.text("table_id = ");
7386 q.text("%#x" % self.table_id)
7387 q.text(","); q.breakable()
Rich Laneb658ddd2013-03-12 10:15:10 -07007388 q.text("config = ");
7389 q.text("%#x" % self.config)
7390 q.breakable()
7391 q.text('}')
7392
Rich Lane7dcdf022013-12-11 14:45:27 -08007393message.subtypes[22] = table_mod
7394
7395class table_stats_reply(stats_reply):
Dan Talaycof6202252013-07-02 01:00:29 -07007396 version = 1
7397 type = 17
7398 stats_type = 3
Rich Laneb658ddd2013-03-12 10:15:10 -07007399
7400 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007401 if xid != None:
7402 self.xid = xid
7403 else:
7404 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07007405 if flags != None:
7406 self.flags = flags
7407 else:
7408 self.flags = 0
7409 if entries != None:
7410 self.entries = entries
7411 else:
7412 self.entries = []
Rich Lane7dcdf022013-12-11 14:45:27 -08007413 return
Rich Laneb658ddd2013-03-12 10:15:10 -07007414
7415 def pack(self):
7416 packed = []
7417 packed.append(struct.pack("!B", self.version))
7418 packed.append(struct.pack("!B", self.type))
7419 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7420 packed.append(struct.pack("!L", self.xid))
7421 packed.append(struct.pack("!H", self.stats_type))
7422 packed.append(struct.pack("!H", self.flags))
Rich Lane7dcdf022013-12-11 14:45:27 -08007423 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Laneb658ddd2013-03-12 10:15:10 -07007424 length = sum([len(x) for x in packed])
7425 packed[2] = struct.pack("!H", length)
7426 return ''.join(packed)
7427
7428 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007429 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07007430 obj = table_stats_reply()
Dan Talaycof6202252013-07-02 01:00:29 -07007431 _version = reader.read("!B")[0]
7432 assert(_version == 1)
7433 _type = reader.read("!B")[0]
7434 assert(_type == 17)
7435 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007436 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007437 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07007438 obj.xid = reader.read("!L")[0]
7439 _stats_type = reader.read("!H")[0]
7440 assert(_stats_type == 3)
7441 obj.flags = reader.read("!H")[0]
Rich Lanee2567702015-01-26 15:04:35 -08007442 obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.table_stats_entry.unpack)
Rich Laneb658ddd2013-03-12 10:15:10 -07007443 return obj
7444
7445 def __eq__(self, other):
7446 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07007447 if self.xid != other.xid: return False
7448 if self.flags != other.flags: return False
7449 if self.entries != other.entries: return False
7450 return True
7451
Rich Laneb658ddd2013-03-12 10:15:10 -07007452 def pretty_print(self, q):
7453 q.text("table_stats_reply {")
7454 with q.group():
7455 with q.indent(2):
7456 q.breakable()
7457 q.text("xid = ");
7458 if self.xid != None:
7459 q.text("%#x" % self.xid)
7460 else:
7461 q.text('None')
7462 q.text(","); q.breakable()
7463 q.text("flags = ");
7464 q.text("%#x" % self.flags)
7465 q.text(","); q.breakable()
7466 q.text("entries = ");
7467 q.pp(self.entries)
7468 q.breakable()
7469 q.text('}')
7470
Rich Lane7dcdf022013-12-11 14:45:27 -08007471stats_reply.subtypes[3] = table_stats_reply
7472
7473class table_stats_request(stats_request):
Dan Talaycof6202252013-07-02 01:00:29 -07007474 version = 1
7475 type = 16
7476 stats_type = 3
Rich Laneb658ddd2013-03-12 10:15:10 -07007477
7478 def __init__(self, xid=None, flags=None):
Rich Lane7dcdf022013-12-11 14:45:27 -08007479 if xid != None:
7480 self.xid = xid
7481 else:
7482 self.xid = None
Rich Laneb658ddd2013-03-12 10:15:10 -07007483 if flags != None:
7484 self.flags = flags
7485 else:
7486 self.flags = 0
Rich Lane7dcdf022013-12-11 14:45:27 -08007487 return
Rich Laneb658ddd2013-03-12 10:15:10 -07007488
7489 def pack(self):
7490 packed = []
7491 packed.append(struct.pack("!B", self.version))
7492 packed.append(struct.pack("!B", self.type))
7493 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7494 packed.append(struct.pack("!L", self.xid))
7495 packed.append(struct.pack("!H", self.stats_type))
7496 packed.append(struct.pack("!H", self.flags))
7497 length = sum([len(x) for x in packed])
7498 packed[2] = struct.pack("!H", length)
7499 return ''.join(packed)
7500
7501 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08007502 def unpack(reader):
Rich Laneb658ddd2013-03-12 10:15:10 -07007503 obj = table_stats_request()
Dan Talaycof6202252013-07-02 01:00:29 -07007504 _version = reader.read("!B")[0]
7505 assert(_version == 1)
7506 _type = reader.read("!B")[0]
7507 assert(_type == 16)
7508 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08007509 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08007510 reader = orig_reader.slice(_length, 4)
Dan Talaycof6202252013-07-02 01:00:29 -07007511 obj.xid = reader.read("!L")[0]
7512 _stats_type = reader.read("!H")[0]
7513 assert(_stats_type == 3)
7514 obj.flags = reader.read("!H")[0]
Rich Laneb658ddd2013-03-12 10:15:10 -07007515 return obj
7516
7517 def __eq__(self, other):
7518 if type(self) != type(other): return False
Rich Laneb658ddd2013-03-12 10:15:10 -07007519 if self.xid != other.xid: return False
7520 if self.flags != other.flags: return False
7521 return True
7522
Rich Laneb658ddd2013-03-12 10:15:10 -07007523 def pretty_print(self, q):
7524 q.text("table_stats_request {")
7525 with q.group():
7526 with q.indent(2):
7527 q.breakable()
7528 q.text("xid = ");
7529 if self.xid != None:
7530 q.text("%#x" % self.xid)
7531 else:
7532 q.text('None')
7533 q.text(","); q.breakable()
7534 q.text("flags = ");
7535 q.text("%#x" % self.flags)
7536 q.breakable()
7537 q.text('}')
7538
Rich Lane7dcdf022013-12-11 14:45:27 -08007539stats_request.subtypes[3] = table_stats_request
7540
Rich Laneb658ddd2013-03-12 10:15:10 -07007541
7542def parse_header(buf):
7543 if len(buf) < 8:
7544 raise loxi.ProtocolError("too short to be an OpenFlow message")
7545 return struct.unpack_from("!BBHL", buf)
7546
7547def parse_message(buf):
7548 msg_ver, msg_type, msg_len, msg_xid = parse_header(buf)
Rich Lanee2567702015-01-26 15:04:35 -08007549 if msg_ver != ofp.OFP_VERSION and msg_type != ofp.OFPT_HELLO:
7550 raise loxi.ProtocolError("wrong OpenFlow version (expected %d, got %d)" % (ofp.OFP_VERSION, msg_ver))
Rich Laneb658ddd2013-03-12 10:15:10 -07007551 if len(buf) != msg_len:
7552 raise loxi.ProtocolError("incorrect message size")
Rich Lane7dcdf022013-12-11 14:45:27 -08007553 return message.unpack(loxi.generic_util.OFReader(buf))