blob: 25f1e1fd7e9d14b12bc825d04607d9a53f9d48b5 [file] [log] [blame]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001# Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
2# Copyright (c) 2011, 2012 Open Networking Foundation
3# Copyright (c) 2012, 2013 Big Switch Networks, Inc.
Dan Talaycof6202252013-07-02 01:00:29 -07004# See the file LICENSE.pyloxi which should have been included in the source distribution
Rich Lanec2ee4b82013-04-24 17:12:38 -07005
Rich Lane7dcdf022013-12-11 14:45:27 -08006# Automatically generated by LOXI from template module.py
Rich Lanec2ee4b82013-04-24 17:12:38 -07007# Do not modify
8
9import struct
Rich Lane7dcdf022013-12-11 14:45:27 -080010import loxi
Rich Lanec2ee4b82013-04-24 17:12:38 -070011import const
Harshmeet Singh1db46332014-10-14 16:29:13 -070012import bsn_tlv
13import meter_band
Rich Lane7dcdf022013-12-11 14:45:27 -080014import instruction
15import oxm
Harshmeet Singh1db46332014-10-14 16:29:13 -070016import common
Rich Lane7dcdf022013-12-11 14:45:27 -080017import instruction_id
Harshmeet Singh1db46332014-10-14 16:29:13 -070018import action
19import message
20import action_id
Rich Lanec2ee4b82013-04-24 17:12:38 -070021import util
22import loxi.generic_util
Rich Lanec2ee4b82013-04-24 17:12:38 -070023
Rich Lane7dcdf022013-12-11 14:45:27 -080024class action(loxi.OFObject):
25 subtypes = {}
Rich Lanec2ee4b82013-04-24 17:12:38 -070026
Rich Lane95f7fc92014-01-27 17:08:16 -080027
28 def __init__(self, type=None):
29 if type != None:
30 self.type = type
31 else:
32 self.type = 0
33 return
34
35 def pack(self):
36 packed = []
37 packed.append(struct.pack("!H", self.type))
38 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
39 packed.append('\x00' * 4)
40 length = sum([len(x) for x in packed])
41 packed[1] = struct.pack("!H", length)
42 return ''.join(packed)
43
Rich Lane7dcdf022013-12-11 14:45:27 -080044 @staticmethod
45 def unpack(reader):
46 subtype, = reader.peek('!H', 0)
Rich Lane95f7fc92014-01-27 17:08:16 -080047 subclass = action.subtypes.get(subtype)
48 if subclass:
49 return subclass.unpack(reader)
50
51 obj = action()
52 obj.type = reader.read("!H")[0]
53 _len = reader.read("!H")[0]
54 orig_reader = reader
55 reader = orig_reader.slice(_len - (2 + 2))
56 reader.skip(4)
57 return obj
58
59 def __eq__(self, other):
60 if type(self) != type(other): return False
61 if self.type != other.type: return False
62 return True
63
64 def pretty_print(self, q):
65 q.text("action {")
66 with q.group():
67 with q.indent(2):
68 q.breakable()
69 q.breakable()
70 q.text('}')
Rich Lanec2ee4b82013-04-24 17:12:38 -070071
Rich Lane7dcdf022013-12-11 14:45:27 -080072
73class experimenter(action):
74 subtypes = {}
75
Rich Lane95f7fc92014-01-27 17:08:16 -080076 type = 65535
77
78 def __init__(self, experimenter=None, data=None):
79 if experimenter != None:
80 self.experimenter = experimenter
81 else:
82 self.experimenter = 0
83 if data != None:
84 self.data = data
85 else:
86 self.data = ''
87 return
88
89 def pack(self):
90 packed = []
91 packed.append(struct.pack("!H", self.type))
92 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
93 packed.append(struct.pack("!L", self.experimenter))
94 packed.append(self.data)
95 length = sum([len(x) for x in packed])
96 packed.append(loxi.generic_util.pad_to(8, length))
97 length += len(packed[-1])
98 packed[1] = struct.pack("!H", length)
99 return ''.join(packed)
100
Rich Lane7dcdf022013-12-11 14:45:27 -0800101 @staticmethod
102 def unpack(reader):
103 subtype, = reader.peek('!L', 4)
Rich Lane95f7fc92014-01-27 17:08:16 -0800104 subclass = experimenter.subtypes.get(subtype)
105 if subclass:
106 return subclass.unpack(reader)
107
108 obj = experimenter()
109 _type = reader.read("!H")[0]
110 assert(_type == 65535)
111 _len = reader.read("!H")[0]
112 orig_reader = reader
113 reader = orig_reader.slice(_len - (2 + 2))
114 obj.experimenter = reader.read("!L")[0]
115 obj.data = str(reader.read_all())
116 return obj
117
118 def __eq__(self, other):
119 if type(self) != type(other): return False
120 if self.experimenter != other.experimenter: return False
121 if self.data != other.data: return False
122 return True
123
124 def pretty_print(self, q):
125 q.text("experimenter {")
126 with q.group():
127 with q.indent(2):
128 q.breakable()
129 q.text("data = ");
130 q.pp(self.data)
131 q.breakable()
132 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -0800133
134action.subtypes[65535] = experimenter
135
136class bsn(experimenter):
137 subtypes = {}
138
Rich Lane95f7fc92014-01-27 17:08:16 -0800139 type = 65535
140 experimenter = 6035143
141
142 def __init__(self, subtype=None):
143 if subtype != None:
144 self.subtype = subtype
145 else:
146 self.subtype = 0
147 return
148
149 def pack(self):
150 packed = []
151 packed.append(struct.pack("!H", self.type))
152 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
153 packed.append(struct.pack("!L", self.experimenter))
154 packed.append(struct.pack("!L", self.subtype))
155 packed.append('\x00' * 4)
156 length = sum([len(x) for x in packed])
157 packed[1] = struct.pack("!H", length)
158 return ''.join(packed)
159
Rich Lane7dcdf022013-12-11 14:45:27 -0800160 @staticmethod
161 def unpack(reader):
162 subtype, = reader.peek('!L', 8)
Rich Lane95f7fc92014-01-27 17:08:16 -0800163 subclass = bsn.subtypes.get(subtype)
164 if subclass:
165 return subclass.unpack(reader)
166
167 obj = bsn()
168 _type = reader.read("!H")[0]
169 assert(_type == 65535)
170 _len = reader.read("!H")[0]
171 orig_reader = reader
172 reader = orig_reader.slice(_len - (2 + 2))
173 _experimenter = reader.read("!L")[0]
174 assert(_experimenter == 6035143)
175 obj.subtype = reader.read("!L")[0]
176 reader.skip(4)
177 return obj
178
179 def __eq__(self, other):
180 if type(self) != type(other): return False
181 if self.subtype != other.subtype: return False
182 return True
183
184 def pretty_print(self, q):
185 q.text("bsn {")
186 with q.group():
187 with q.indent(2):
188 q.breakable()
189 q.breakable()
190 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -0800191
192experimenter.subtypes[6035143] = bsn
193
Rich Lane5587ab12014-06-30 11:19:09 -0700194class bsn_checksum(bsn):
195 type = 65535
196 experimenter = 6035143
197 subtype = 4
198
199 def __init__(self, checksum=None):
200 if checksum != None:
201 self.checksum = checksum
202 else:
203 self.checksum = 0
204 return
205
206 def pack(self):
207 packed = []
208 packed.append(struct.pack("!H", self.type))
209 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
210 packed.append(struct.pack("!L", self.experimenter))
211 packed.append(struct.pack("!L", self.subtype))
212 packed.append(util.pack_checksum_128(self.checksum))
213 length = sum([len(x) for x in packed])
214 packed[1] = struct.pack("!H", length)
215 return ''.join(packed)
216
217 @staticmethod
218 def unpack(reader):
219 obj = bsn_checksum()
220 _type = reader.read("!H")[0]
221 assert(_type == 65535)
222 _len = reader.read("!H")[0]
223 orig_reader = reader
224 reader = orig_reader.slice(_len - (2 + 2))
225 _experimenter = reader.read("!L")[0]
226 assert(_experimenter == 6035143)
227 _subtype = reader.read("!L")[0]
228 assert(_subtype == 4)
229 obj.checksum = util.unpack_checksum_128(reader)
230 return obj
231
232 def __eq__(self, other):
233 if type(self) != type(other): return False
234 if self.checksum != other.checksum: return False
235 return True
236
237 def pretty_print(self, q):
238 q.text("bsn_checksum {")
239 with q.group():
240 with q.indent(2):
241 q.breakable()
242 q.text("checksum = ");
243 q.pp(self.checksum)
244 q.breakable()
245 q.text('}')
246
247bsn.subtypes[4] = bsn_checksum
248
Rich Lane7dcdf022013-12-11 14:45:27 -0800249class bsn_mirror(bsn):
Dan Talaycof6202252013-07-02 01:00:29 -0700250 type = 65535
251 experimenter = 6035143
Rich Lanec2ee4b82013-04-24 17:12:38 -0700252 subtype = 1
253
254 def __init__(self, dest_port=None, vlan_tag=None, copy_stage=None):
255 if dest_port != None:
256 self.dest_port = dest_port
257 else:
258 self.dest_port = 0
259 if vlan_tag != None:
260 self.vlan_tag = vlan_tag
261 else:
262 self.vlan_tag = 0
263 if copy_stage != None:
264 self.copy_stage = copy_stage
265 else:
266 self.copy_stage = 0
267 return
268
269 def pack(self):
270 packed = []
271 packed.append(struct.pack("!H", self.type))
272 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
273 packed.append(struct.pack("!L", self.experimenter))
274 packed.append(struct.pack("!L", self.subtype))
275 packed.append(struct.pack("!L", self.dest_port))
276 packed.append(struct.pack("!L", self.vlan_tag))
277 packed.append(struct.pack("!B", self.copy_stage))
278 packed.append('\x00' * 3)
279 length = sum([len(x) for x in packed])
280 packed[1] = struct.pack("!H", length)
281 return ''.join(packed)
282
283 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800284 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700285 obj = bsn_mirror()
Dan Talaycof6202252013-07-02 01:00:29 -0700286 _type = reader.read("!H")[0]
287 assert(_type == 65535)
288 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800289 orig_reader = reader
290 reader = orig_reader.slice(_len - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700291 _experimenter = reader.read("!L")[0]
292 assert(_experimenter == 6035143)
293 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700294 assert(_subtype == 1)
Dan Talaycof6202252013-07-02 01:00:29 -0700295 obj.dest_port = reader.read("!L")[0]
296 obj.vlan_tag = reader.read("!L")[0]
297 obj.copy_stage = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700298 reader.skip(3)
299 return obj
300
301 def __eq__(self, other):
302 if type(self) != type(other): return False
303 if self.dest_port != other.dest_port: return False
304 if self.vlan_tag != other.vlan_tag: return False
305 if self.copy_stage != other.copy_stage: return False
306 return True
307
Rich Lanec2ee4b82013-04-24 17:12:38 -0700308 def pretty_print(self, q):
309 q.text("bsn_mirror {")
310 with q.group():
311 with q.indent(2):
312 q.breakable()
313 q.text("dest_port = ");
314 q.text("%#x" % self.dest_port)
315 q.text(","); q.breakable()
316 q.text("vlan_tag = ");
317 q.text("%#x" % self.vlan_tag)
318 q.text(","); q.breakable()
319 q.text("copy_stage = ");
320 q.text("%#x" % self.copy_stage)
321 q.breakable()
322 q.text('}')
323
Rich Lane7dcdf022013-12-11 14:45:27 -0800324bsn.subtypes[1] = bsn_mirror
325
326class bsn_set_tunnel_dst(bsn):
Dan Talaycof6202252013-07-02 01:00:29 -0700327 type = 65535
328 experimenter = 6035143
Rich Lanec2ee4b82013-04-24 17:12:38 -0700329 subtype = 2
330
331 def __init__(self, dst=None):
332 if dst != None:
333 self.dst = dst
334 else:
335 self.dst = 0
336 return
337
338 def pack(self):
339 packed = []
340 packed.append(struct.pack("!H", self.type))
341 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
342 packed.append(struct.pack("!L", self.experimenter))
343 packed.append(struct.pack("!L", self.subtype))
344 packed.append(struct.pack("!L", self.dst))
345 length = sum([len(x) for x in packed])
346 packed[1] = struct.pack("!H", length)
347 return ''.join(packed)
348
349 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800350 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700351 obj = bsn_set_tunnel_dst()
Dan Talaycof6202252013-07-02 01:00:29 -0700352 _type = reader.read("!H")[0]
353 assert(_type == 65535)
354 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800355 orig_reader = reader
356 reader = orig_reader.slice(_len - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700357 _experimenter = reader.read("!L")[0]
358 assert(_experimenter == 6035143)
359 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700360 assert(_subtype == 2)
Dan Talaycof6202252013-07-02 01:00:29 -0700361 obj.dst = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700362 return obj
363
364 def __eq__(self, other):
365 if type(self) != type(other): return False
366 if self.dst != other.dst: return False
367 return True
368
Rich Lanec2ee4b82013-04-24 17:12:38 -0700369 def pretty_print(self, q):
370 q.text("bsn_set_tunnel_dst {")
371 with q.group():
372 with q.indent(2):
373 q.breakable()
374 q.text("dst = ");
375 q.text("%#x" % self.dst)
376 q.breakable()
377 q.text('}')
378
Rich Lane7dcdf022013-12-11 14:45:27 -0800379bsn.subtypes[2] = bsn_set_tunnel_dst
380
381class copy_ttl_in(action):
Dan Talaycof6202252013-07-02 01:00:29 -0700382 type = 12
Rich Lanec2ee4b82013-04-24 17:12:38 -0700383
384 def __init__(self):
385 return
386
387 def pack(self):
388 packed = []
389 packed.append(struct.pack("!H", self.type))
390 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
391 packed.append('\x00' * 4)
392 length = sum([len(x) for x in packed])
393 packed[1] = struct.pack("!H", length)
394 return ''.join(packed)
395
396 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800397 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700398 obj = copy_ttl_in()
Dan Talaycof6202252013-07-02 01:00:29 -0700399 _type = reader.read("!H")[0]
400 assert(_type == 12)
401 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800402 orig_reader = reader
403 reader = orig_reader.slice(_len - (2 + 2))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700404 reader.skip(4)
405 return obj
406
407 def __eq__(self, other):
408 if type(self) != type(other): return False
409 return True
410
Rich Lanec2ee4b82013-04-24 17:12:38 -0700411 def pretty_print(self, q):
412 q.text("copy_ttl_in {")
413 with q.group():
414 with q.indent(2):
415 q.breakable()
416 q.breakable()
417 q.text('}')
418
Rich Lane7dcdf022013-12-11 14:45:27 -0800419action.subtypes[12] = copy_ttl_in
420
421class copy_ttl_out(action):
Dan Talaycof6202252013-07-02 01:00:29 -0700422 type = 11
Rich Lanec2ee4b82013-04-24 17:12:38 -0700423
424 def __init__(self):
425 return
426
427 def pack(self):
428 packed = []
429 packed.append(struct.pack("!H", self.type))
430 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
431 packed.append('\x00' * 4)
432 length = sum([len(x) for x in packed])
433 packed[1] = struct.pack("!H", length)
434 return ''.join(packed)
435
436 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800437 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700438 obj = copy_ttl_out()
Dan Talaycof6202252013-07-02 01:00:29 -0700439 _type = reader.read("!H")[0]
440 assert(_type == 11)
441 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800442 orig_reader = reader
443 reader = orig_reader.slice(_len - (2 + 2))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700444 reader.skip(4)
445 return obj
446
447 def __eq__(self, other):
448 if type(self) != type(other): return False
449 return True
450
Rich Lanec2ee4b82013-04-24 17:12:38 -0700451 def pretty_print(self, q):
452 q.text("copy_ttl_out {")
453 with q.group():
454 with q.indent(2):
455 q.breakable()
456 q.breakable()
457 q.text('}')
458
Rich Lane7dcdf022013-12-11 14:45:27 -0800459action.subtypes[11] = copy_ttl_out
460
461class dec_mpls_ttl(action):
Dan Talaycof6202252013-07-02 01:00:29 -0700462 type = 16
Rich Lanec2ee4b82013-04-24 17:12:38 -0700463
464 def __init__(self):
465 return
466
467 def pack(self):
468 packed = []
469 packed.append(struct.pack("!H", self.type))
470 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
471 packed.append('\x00' * 4)
472 length = sum([len(x) for x in packed])
473 packed[1] = struct.pack("!H", length)
474 return ''.join(packed)
475
476 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800477 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700478 obj = dec_mpls_ttl()
Dan Talaycof6202252013-07-02 01:00:29 -0700479 _type = reader.read("!H")[0]
480 assert(_type == 16)
481 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800482 orig_reader = reader
483 reader = orig_reader.slice(_len - (2 + 2))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700484 reader.skip(4)
485 return obj
486
487 def __eq__(self, other):
488 if type(self) != type(other): return False
489 return True
490
Rich Lanec2ee4b82013-04-24 17:12:38 -0700491 def pretty_print(self, q):
492 q.text("dec_mpls_ttl {")
493 with q.group():
494 with q.indent(2):
495 q.breakable()
496 q.breakable()
497 q.text('}')
498
Rich Lane7dcdf022013-12-11 14:45:27 -0800499action.subtypes[16] = dec_mpls_ttl
500
501class dec_nw_ttl(action):
Dan Talaycof6202252013-07-02 01:00:29 -0700502 type = 24
Rich Lanec2ee4b82013-04-24 17:12:38 -0700503
504 def __init__(self):
505 return
506
507 def pack(self):
508 packed = []
509 packed.append(struct.pack("!H", self.type))
510 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
511 packed.append('\x00' * 4)
512 length = sum([len(x) for x in packed])
513 packed[1] = struct.pack("!H", length)
514 return ''.join(packed)
515
516 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800517 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700518 obj = dec_nw_ttl()
Dan Talaycof6202252013-07-02 01:00:29 -0700519 _type = reader.read("!H")[0]
520 assert(_type == 24)
521 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800522 orig_reader = reader
523 reader = orig_reader.slice(_len - (2 + 2))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700524 reader.skip(4)
525 return obj
526
527 def __eq__(self, other):
528 if type(self) != type(other): return False
529 return True
530
Rich Lanec2ee4b82013-04-24 17:12:38 -0700531 def pretty_print(self, q):
532 q.text("dec_nw_ttl {")
533 with q.group():
534 with q.indent(2):
535 q.breakable()
536 q.breakable()
537 q.text('}')
538
Rich Lane7dcdf022013-12-11 14:45:27 -0800539action.subtypes[24] = dec_nw_ttl
540
541class group(action):
Dan Talaycof6202252013-07-02 01:00:29 -0700542 type = 22
Rich Lanec2ee4b82013-04-24 17:12:38 -0700543
544 def __init__(self, group_id=None):
545 if group_id != None:
546 self.group_id = group_id
547 else:
548 self.group_id = 0
549 return
550
551 def pack(self):
552 packed = []
553 packed.append(struct.pack("!H", self.type))
554 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
555 packed.append(struct.pack("!L", self.group_id))
556 length = sum([len(x) for x in packed])
557 packed[1] = struct.pack("!H", length)
558 return ''.join(packed)
559
560 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800561 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700562 obj = group()
Dan Talaycof6202252013-07-02 01:00:29 -0700563 _type = reader.read("!H")[0]
564 assert(_type == 22)
565 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800566 orig_reader = reader
567 reader = orig_reader.slice(_len - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700568 obj.group_id = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700569 return obj
570
571 def __eq__(self, other):
572 if type(self) != type(other): return False
573 if self.group_id != other.group_id: return False
574 return True
575
Rich Lanec2ee4b82013-04-24 17:12:38 -0700576 def pretty_print(self, q):
577 q.text("group {")
578 with q.group():
579 with q.indent(2):
580 q.breakable()
581 q.text("group_id = ");
582 q.text("%#x" % self.group_id)
583 q.breakable()
584 q.text('}')
585
Rich Lane7dcdf022013-12-11 14:45:27 -0800586action.subtypes[22] = group
587
588class nicira(experimenter):
589 subtypes = {}
590
Rich Lane95f7fc92014-01-27 17:08:16 -0800591 type = 65535
592 experimenter = 8992
593
594 def __init__(self, subtype=None):
595 if subtype != None:
596 self.subtype = subtype
597 else:
598 self.subtype = 0
599 return
600
601 def pack(self):
602 packed = []
603 packed.append(struct.pack("!H", self.type))
604 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
605 packed.append(struct.pack("!L", self.experimenter))
606 packed.append(struct.pack("!H", self.subtype))
607 packed.append('\x00' * 2)
608 packed.append('\x00' * 4)
609 length = sum([len(x) for x in packed])
610 packed[1] = struct.pack("!H", length)
611 return ''.join(packed)
612
Rich Lane7dcdf022013-12-11 14:45:27 -0800613 @staticmethod
614 def unpack(reader):
615 subtype, = reader.peek('!H', 8)
Rich Lane95f7fc92014-01-27 17:08:16 -0800616 subclass = nicira.subtypes.get(subtype)
617 if subclass:
618 return subclass.unpack(reader)
619
620 obj = nicira()
621 _type = reader.read("!H")[0]
622 assert(_type == 65535)
623 _len = reader.read("!H")[0]
624 orig_reader = reader
625 reader = orig_reader.slice(_len - (2 + 2))
626 _experimenter = reader.read("!L")[0]
627 assert(_experimenter == 8992)
628 obj.subtype = reader.read("!H")[0]
629 reader.skip(2)
630 reader.skip(4)
631 return obj
632
633 def __eq__(self, other):
634 if type(self) != type(other): return False
635 if self.subtype != other.subtype: return False
636 return True
637
638 def pretty_print(self, q):
639 q.text("nicira {")
640 with q.group():
641 with q.indent(2):
642 q.breakable()
643 q.breakable()
644 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -0800645
646experimenter.subtypes[8992] = nicira
647
648class nicira_dec_ttl(nicira):
Dan Talaycof6202252013-07-02 01:00:29 -0700649 type = 65535
650 experimenter = 8992
Rich Lanec2ee4b82013-04-24 17:12:38 -0700651 subtype = 18
652
653 def __init__(self):
654 return
655
656 def pack(self):
657 packed = []
658 packed.append(struct.pack("!H", self.type))
659 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
660 packed.append(struct.pack("!L", self.experimenter))
661 packed.append(struct.pack("!H", self.subtype))
662 packed.append('\x00' * 2)
663 packed.append('\x00' * 4)
664 length = sum([len(x) for x in packed])
665 packed[1] = struct.pack("!H", length)
666 return ''.join(packed)
667
668 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800669 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700670 obj = nicira_dec_ttl()
Dan Talaycof6202252013-07-02 01:00:29 -0700671 _type = reader.read("!H")[0]
672 assert(_type == 65535)
673 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800674 orig_reader = reader
675 reader = orig_reader.slice(_len - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700676 _experimenter = reader.read("!L")[0]
677 assert(_experimenter == 8992)
678 _subtype = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700679 assert(_subtype == 18)
680 reader.skip(2)
681 reader.skip(4)
682 return obj
683
684 def __eq__(self, other):
685 if type(self) != type(other): return False
686 return True
687
Rich Lanec2ee4b82013-04-24 17:12:38 -0700688 def pretty_print(self, q):
689 q.text("nicira_dec_ttl {")
690 with q.group():
691 with q.indent(2):
692 q.breakable()
693 q.breakable()
694 q.text('}')
695
Rich Lane7dcdf022013-12-11 14:45:27 -0800696nicira.subtypes[18] = nicira_dec_ttl
697
698class output(action):
Dan Talaycof6202252013-07-02 01:00:29 -0700699 type = 0
Rich Lanec2ee4b82013-04-24 17:12:38 -0700700
701 def __init__(self, port=None, max_len=None):
702 if port != None:
703 self.port = port
704 else:
705 self.port = 0
706 if max_len != None:
707 self.max_len = max_len
708 else:
709 self.max_len = 0
710 return
711
712 def pack(self):
713 packed = []
714 packed.append(struct.pack("!H", self.type))
715 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
Dan Talaycof6202252013-07-02 01:00:29 -0700716 packed.append(util.pack_port_no(self.port))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700717 packed.append(struct.pack("!H", self.max_len))
718 packed.append('\x00' * 6)
719 length = sum([len(x) for x in packed])
720 packed[1] = struct.pack("!H", length)
721 return ''.join(packed)
722
723 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800724 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700725 obj = output()
Dan Talaycof6202252013-07-02 01:00:29 -0700726 _type = reader.read("!H")[0]
727 assert(_type == 0)
728 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800729 orig_reader = reader
730 reader = orig_reader.slice(_len - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700731 obj.port = util.unpack_port_no(reader)
732 obj.max_len = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700733 reader.skip(6)
734 return obj
735
736 def __eq__(self, other):
737 if type(self) != type(other): return False
738 if self.port != other.port: return False
739 if self.max_len != other.max_len: return False
740 return True
741
Rich Lanec2ee4b82013-04-24 17:12:38 -0700742 def pretty_print(self, q):
743 q.text("output {")
744 with q.group():
745 with q.indent(2):
746 q.breakable()
747 q.text("port = ");
748 q.text(util.pretty_port(self.port))
749 q.text(","); q.breakable()
750 q.text("max_len = ");
751 q.text("%#x" % self.max_len)
752 q.breakable()
753 q.text('}')
754
Rich Lane7dcdf022013-12-11 14:45:27 -0800755action.subtypes[0] = output
756
757class pop_mpls(action):
Dan Talaycof6202252013-07-02 01:00:29 -0700758 type = 20
Rich Lanec2ee4b82013-04-24 17:12:38 -0700759
760 def __init__(self, ethertype=None):
761 if ethertype != None:
762 self.ethertype = ethertype
763 else:
764 self.ethertype = 0
765 return
766
767 def pack(self):
768 packed = []
769 packed.append(struct.pack("!H", self.type))
770 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
771 packed.append(struct.pack("!H", self.ethertype))
772 packed.append('\x00' * 2)
773 length = sum([len(x) for x in packed])
774 packed[1] = struct.pack("!H", length)
775 return ''.join(packed)
776
777 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800778 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700779 obj = pop_mpls()
Dan Talaycof6202252013-07-02 01:00:29 -0700780 _type = reader.read("!H")[0]
781 assert(_type == 20)
782 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800783 orig_reader = reader
784 reader = orig_reader.slice(_len - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700785 obj.ethertype = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700786 reader.skip(2)
787 return obj
788
789 def __eq__(self, other):
790 if type(self) != type(other): return False
791 if self.ethertype != other.ethertype: return False
792 return True
793
Rich Lanec2ee4b82013-04-24 17:12:38 -0700794 def pretty_print(self, q):
795 q.text("pop_mpls {")
796 with q.group():
797 with q.indent(2):
798 q.breakable()
799 q.text("ethertype = ");
800 q.text("%#x" % self.ethertype)
801 q.breakable()
802 q.text('}')
803
Rich Lane7dcdf022013-12-11 14:45:27 -0800804action.subtypes[20] = pop_mpls
805
806class pop_pbb(action):
Dan Talaycof6202252013-07-02 01:00:29 -0700807 type = 27
Rich Lanec2ee4b82013-04-24 17:12:38 -0700808
809 def __init__(self):
810 return
811
812 def pack(self):
813 packed = []
814 packed.append(struct.pack("!H", self.type))
815 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
816 packed.append('\x00' * 4)
817 length = sum([len(x) for x in packed])
818 packed[1] = struct.pack("!H", length)
819 return ''.join(packed)
820
821 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800822 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700823 obj = pop_pbb()
Dan Talaycof6202252013-07-02 01:00:29 -0700824 _type = reader.read("!H")[0]
825 assert(_type == 27)
826 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800827 orig_reader = reader
828 reader = orig_reader.slice(_len - (2 + 2))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700829 reader.skip(4)
830 return obj
831
832 def __eq__(self, other):
833 if type(self) != type(other): return False
834 return True
835
Rich Lanec2ee4b82013-04-24 17:12:38 -0700836 def pretty_print(self, q):
837 q.text("pop_pbb {")
838 with q.group():
839 with q.indent(2):
840 q.breakable()
841 q.breakable()
842 q.text('}')
843
Rich Lane7dcdf022013-12-11 14:45:27 -0800844action.subtypes[27] = pop_pbb
845
846class pop_vlan(action):
Dan Talaycof6202252013-07-02 01:00:29 -0700847 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -0700848
849 def __init__(self):
850 return
851
852 def pack(self):
853 packed = []
854 packed.append(struct.pack("!H", self.type))
855 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
856 packed.append('\x00' * 4)
857 length = sum([len(x) for x in packed])
858 packed[1] = struct.pack("!H", length)
859 return ''.join(packed)
860
861 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800862 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700863 obj = pop_vlan()
Dan Talaycof6202252013-07-02 01:00:29 -0700864 _type = reader.read("!H")[0]
865 assert(_type == 18)
866 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800867 orig_reader = reader
868 reader = orig_reader.slice(_len - (2 + 2))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700869 reader.skip(4)
870 return obj
871
872 def __eq__(self, other):
873 if type(self) != type(other): return False
874 return True
875
Rich Lanec2ee4b82013-04-24 17:12:38 -0700876 def pretty_print(self, q):
877 q.text("pop_vlan {")
878 with q.group():
879 with q.indent(2):
880 q.breakable()
881 q.breakable()
882 q.text('}')
883
Rich Lane7dcdf022013-12-11 14:45:27 -0800884action.subtypes[18] = pop_vlan
885
886class push_mpls(action):
Dan Talaycof6202252013-07-02 01:00:29 -0700887 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -0700888
889 def __init__(self, ethertype=None):
890 if ethertype != None:
891 self.ethertype = ethertype
892 else:
893 self.ethertype = 0
894 return
895
896 def pack(self):
897 packed = []
898 packed.append(struct.pack("!H", self.type))
899 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
900 packed.append(struct.pack("!H", self.ethertype))
901 packed.append('\x00' * 2)
902 length = sum([len(x) for x in packed])
903 packed[1] = struct.pack("!H", length)
904 return ''.join(packed)
905
906 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800907 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700908 obj = push_mpls()
Dan Talaycof6202252013-07-02 01:00:29 -0700909 _type = reader.read("!H")[0]
910 assert(_type == 19)
911 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800912 orig_reader = reader
913 reader = orig_reader.slice(_len - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700914 obj.ethertype = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700915 reader.skip(2)
916 return obj
917
918 def __eq__(self, other):
919 if type(self) != type(other): return False
920 if self.ethertype != other.ethertype: return False
921 return True
922
Rich Lanec2ee4b82013-04-24 17:12:38 -0700923 def pretty_print(self, q):
924 q.text("push_mpls {")
925 with q.group():
926 with q.indent(2):
927 q.breakable()
928 q.text("ethertype = ");
929 q.text("%#x" % self.ethertype)
930 q.breakable()
931 q.text('}')
932
Rich Lane7dcdf022013-12-11 14:45:27 -0800933action.subtypes[19] = push_mpls
934
935class push_pbb(action):
Dan Talaycof6202252013-07-02 01:00:29 -0700936 type = 26
Rich Lanec2ee4b82013-04-24 17:12:38 -0700937
938 def __init__(self, ethertype=None):
939 if ethertype != None:
940 self.ethertype = ethertype
941 else:
942 self.ethertype = 0
943 return
944
945 def pack(self):
946 packed = []
947 packed.append(struct.pack("!H", self.type))
948 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
949 packed.append(struct.pack("!H", self.ethertype))
950 packed.append('\x00' * 2)
951 length = sum([len(x) for x in packed])
952 packed[1] = struct.pack("!H", length)
953 return ''.join(packed)
954
955 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800956 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700957 obj = push_pbb()
Dan Talaycof6202252013-07-02 01:00:29 -0700958 _type = reader.read("!H")[0]
959 assert(_type == 26)
960 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800961 orig_reader = reader
962 reader = orig_reader.slice(_len - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700963 obj.ethertype = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700964 reader.skip(2)
965 return obj
966
967 def __eq__(self, other):
968 if type(self) != type(other): return False
969 if self.ethertype != other.ethertype: return False
970 return True
971
Rich Lanec2ee4b82013-04-24 17:12:38 -0700972 def pretty_print(self, q):
973 q.text("push_pbb {")
974 with q.group():
975 with q.indent(2):
976 q.breakable()
977 q.text("ethertype = ");
978 q.text("%#x" % self.ethertype)
979 q.breakable()
980 q.text('}')
981
Rich Lane7dcdf022013-12-11 14:45:27 -0800982action.subtypes[26] = push_pbb
983
984class push_vlan(action):
Dan Talaycof6202252013-07-02 01:00:29 -0700985 type = 17
Rich Lanec2ee4b82013-04-24 17:12:38 -0700986
987 def __init__(self, ethertype=None):
988 if ethertype != None:
989 self.ethertype = ethertype
990 else:
991 self.ethertype = 0
992 return
993
994 def pack(self):
995 packed = []
996 packed.append(struct.pack("!H", self.type))
997 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
998 packed.append(struct.pack("!H", self.ethertype))
999 packed.append('\x00' * 2)
1000 length = sum([len(x) for x in packed])
1001 packed[1] = struct.pack("!H", length)
1002 return ''.join(packed)
1003
1004 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001005 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001006 obj = push_vlan()
Dan Talaycof6202252013-07-02 01:00:29 -07001007 _type = reader.read("!H")[0]
1008 assert(_type == 17)
1009 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001010 orig_reader = reader
1011 reader = orig_reader.slice(_len - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001012 obj.ethertype = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001013 reader.skip(2)
1014 return obj
1015
1016 def __eq__(self, other):
1017 if type(self) != type(other): return False
1018 if self.ethertype != other.ethertype: return False
1019 return True
1020
Rich Lanec2ee4b82013-04-24 17:12:38 -07001021 def pretty_print(self, q):
1022 q.text("push_vlan {")
1023 with q.group():
1024 with q.indent(2):
1025 q.breakable()
1026 q.text("ethertype = ");
1027 q.text("%#x" % self.ethertype)
1028 q.breakable()
1029 q.text('}')
1030
Rich Lane7dcdf022013-12-11 14:45:27 -08001031action.subtypes[17] = push_vlan
1032
1033class set_field(action):
Dan Talaycof6202252013-07-02 01:00:29 -07001034 type = 25
Rich Lanec2ee4b82013-04-24 17:12:38 -07001035
1036 def __init__(self, field=None):
1037 if field != None:
1038 self.field = field
1039 else:
Rich Laned53156a2013-08-05 17:17:33 -07001040 self.field = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07001041 return
1042
1043 def pack(self):
1044 packed = []
1045 packed.append(struct.pack("!H", self.type))
1046 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
Rich Laned53156a2013-08-05 17:17:33 -07001047 packed.append(self.field.pack())
Rich Lanec2ee4b82013-04-24 17:12:38 -07001048 length = sum([len(x) for x in packed])
Rich Laned53156a2013-08-05 17:17:33 -07001049 packed.append(loxi.generic_util.pad_to(8, length))
1050 length += len(packed[-1])
Rich Lanec2ee4b82013-04-24 17:12:38 -07001051 packed[1] = struct.pack("!H", length)
1052 return ''.join(packed)
1053
1054 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001055 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001056 obj = set_field()
Dan Talaycof6202252013-07-02 01:00:29 -07001057 _type = reader.read("!H")[0]
1058 assert(_type == 25)
1059 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001060 orig_reader = reader
1061 reader = orig_reader.slice(_len - (2 + 2))
1062 obj.field = oxm.oxm.unpack(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -07001063 return obj
1064
1065 def __eq__(self, other):
1066 if type(self) != type(other): return False
1067 if self.field != other.field: return False
1068 return True
1069
Rich Lanec2ee4b82013-04-24 17:12:38 -07001070 def pretty_print(self, q):
1071 q.text("set_field {")
1072 with q.group():
1073 with q.indent(2):
1074 q.breakable()
1075 q.text("field = ");
1076 q.pp(self.field)
1077 q.breakable()
1078 q.text('}')
1079
Rich Lane7dcdf022013-12-11 14:45:27 -08001080action.subtypes[25] = set_field
1081
1082class set_mpls_ttl(action):
Dan Talaycof6202252013-07-02 01:00:29 -07001083 type = 15
Rich Lanec2ee4b82013-04-24 17:12:38 -07001084
1085 def __init__(self, mpls_ttl=None):
1086 if mpls_ttl != None:
1087 self.mpls_ttl = mpls_ttl
1088 else:
1089 self.mpls_ttl = 0
1090 return
1091
1092 def pack(self):
1093 packed = []
1094 packed.append(struct.pack("!H", self.type))
1095 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
1096 packed.append(struct.pack("!B", self.mpls_ttl))
1097 packed.append('\x00' * 3)
1098 length = sum([len(x) for x in packed])
1099 packed[1] = struct.pack("!H", length)
1100 return ''.join(packed)
1101
1102 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001103 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001104 obj = set_mpls_ttl()
Dan Talaycof6202252013-07-02 01:00:29 -07001105 _type = reader.read("!H")[0]
1106 assert(_type == 15)
1107 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001108 orig_reader = reader
1109 reader = orig_reader.slice(_len - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001110 obj.mpls_ttl = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001111 reader.skip(3)
1112 return obj
1113
1114 def __eq__(self, other):
1115 if type(self) != type(other): return False
1116 if self.mpls_ttl != other.mpls_ttl: return False
1117 return True
1118
Rich Lanec2ee4b82013-04-24 17:12:38 -07001119 def pretty_print(self, q):
1120 q.text("set_mpls_ttl {")
1121 with q.group():
1122 with q.indent(2):
1123 q.breakable()
1124 q.text("mpls_ttl = ");
1125 q.text("%#x" % self.mpls_ttl)
1126 q.breakable()
1127 q.text('}')
1128
Rich Lane7dcdf022013-12-11 14:45:27 -08001129action.subtypes[15] = set_mpls_ttl
1130
1131class set_nw_ttl(action):
Dan Talaycof6202252013-07-02 01:00:29 -07001132 type = 23
Rich Lanec2ee4b82013-04-24 17:12:38 -07001133
1134 def __init__(self, nw_ttl=None):
1135 if nw_ttl != None:
1136 self.nw_ttl = nw_ttl
1137 else:
1138 self.nw_ttl = 0
1139 return
1140
1141 def pack(self):
1142 packed = []
1143 packed.append(struct.pack("!H", self.type))
1144 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
1145 packed.append(struct.pack("!B", self.nw_ttl))
1146 packed.append('\x00' * 3)
1147 length = sum([len(x) for x in packed])
1148 packed[1] = struct.pack("!H", length)
1149 return ''.join(packed)
1150
1151 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001152 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001153 obj = set_nw_ttl()
Dan Talaycof6202252013-07-02 01:00:29 -07001154 _type = reader.read("!H")[0]
1155 assert(_type == 23)
1156 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001157 orig_reader = reader
1158 reader = orig_reader.slice(_len - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001159 obj.nw_ttl = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001160 reader.skip(3)
1161 return obj
1162
1163 def __eq__(self, other):
1164 if type(self) != type(other): return False
1165 if self.nw_ttl != other.nw_ttl: return False
1166 return True
1167
Rich Lanec2ee4b82013-04-24 17:12:38 -07001168 def pretty_print(self, q):
1169 q.text("set_nw_ttl {")
1170 with q.group():
1171 with q.indent(2):
1172 q.breakable()
1173 q.text("nw_ttl = ");
1174 q.text("%#x" % self.nw_ttl)
1175 q.breakable()
1176 q.text('}')
1177
Rich Lane7dcdf022013-12-11 14:45:27 -08001178action.subtypes[23] = set_nw_ttl
1179
1180class set_queue(action):
Dan Talaycof6202252013-07-02 01:00:29 -07001181 type = 21
Rich Lanec2ee4b82013-04-24 17:12:38 -07001182
1183 def __init__(self, queue_id=None):
1184 if queue_id != None:
1185 self.queue_id = queue_id
1186 else:
1187 self.queue_id = 0
1188 return
1189
1190 def pack(self):
1191 packed = []
1192 packed.append(struct.pack("!H", self.type))
1193 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
1194 packed.append(struct.pack("!L", self.queue_id))
1195 length = sum([len(x) for x in packed])
1196 packed[1] = struct.pack("!H", length)
1197 return ''.join(packed)
1198
1199 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001200 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001201 obj = set_queue()
Dan Talaycof6202252013-07-02 01:00:29 -07001202 _type = reader.read("!H")[0]
1203 assert(_type == 21)
1204 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001205 orig_reader = reader
1206 reader = orig_reader.slice(_len - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001207 obj.queue_id = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001208 return obj
1209
1210 def __eq__(self, other):
1211 if type(self) != type(other): return False
1212 if self.queue_id != other.queue_id: return False
1213 return True
1214
Rich Lanec2ee4b82013-04-24 17:12:38 -07001215 def pretty_print(self, q):
1216 q.text("set_queue {")
1217 with q.group():
1218 with q.indent(2):
1219 q.breakable()
1220 q.text("queue_id = ");
1221 q.text("%#x" % self.queue_id)
1222 q.breakable()
1223 q.text('}')
1224
Rich Lane7dcdf022013-12-11 14:45:27 -08001225action.subtypes[21] = set_queue
Rich Lanec2ee4b82013-04-24 17:12:38 -07001226
Rich Lanec2ee4b82013-04-24 17:12:38 -07001227