blob: d99ff1be0f54ca7cc3bbd5d031fcd9d9393225d1 [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
Rich Lane7dcdf022013-12-11 14:45:27 -080012import common
13import action
14import instruction
15import oxm
16import action_id
17import instruction_id
18import meter_band
Rich Lane5454b682014-01-14 17:07:36 -080019import bsn_tlv
Rich Lanec2ee4b82013-04-24 17:12:38 -070020import util
21import loxi.generic_util
Rich Lanec2ee4b82013-04-24 17:12:38 -070022
Rich Lane7dcdf022013-12-11 14:45:27 -080023class action(loxi.OFObject):
24 subtypes = {}
Rich Lanec2ee4b82013-04-24 17:12:38 -070025
Rich Lane95f7fc92014-01-27 17:08:16 -080026
27 def __init__(self, type=None):
28 if type != None:
29 self.type = type
30 else:
31 self.type = 0
32 return
33
34 def pack(self):
35 packed = []
36 packed.append(struct.pack("!H", self.type))
37 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
38 packed.append('\x00' * 4)
39 length = sum([len(x) for x in packed])
40 packed[1] = struct.pack("!H", length)
41 return ''.join(packed)
42
Rich Lane7dcdf022013-12-11 14:45:27 -080043 @staticmethod
44 def unpack(reader):
45 subtype, = reader.peek('!H', 0)
Rich Lane95f7fc92014-01-27 17:08:16 -080046 subclass = action.subtypes.get(subtype)
47 if subclass:
48 return subclass.unpack(reader)
49
50 obj = action()
51 obj.type = reader.read("!H")[0]
52 _len = reader.read("!H")[0]
53 orig_reader = reader
54 reader = orig_reader.slice(_len - (2 + 2))
55 reader.skip(4)
56 return obj
57
58 def __eq__(self, other):
59 if type(self) != type(other): return False
60 if self.type != other.type: return False
61 return True
62
63 def pretty_print(self, q):
64 q.text("action {")
65 with q.group():
66 with q.indent(2):
67 q.breakable()
68 q.breakable()
69 q.text('}')
Rich Lanec2ee4b82013-04-24 17:12:38 -070070
Rich Lane7dcdf022013-12-11 14:45:27 -080071
72class experimenter(action):
73 subtypes = {}
74
Rich Lane95f7fc92014-01-27 17:08:16 -080075 type = 65535
76
77 def __init__(self, experimenter=None, data=None):
78 if experimenter != None:
79 self.experimenter = experimenter
80 else:
81 self.experimenter = 0
82 if data != None:
83 self.data = data
84 else:
85 self.data = ''
86 return
87
88 def pack(self):
89 packed = []
90 packed.append(struct.pack("!H", self.type))
91 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
92 packed.append(struct.pack("!L", self.experimenter))
93 packed.append(self.data)
94 length = sum([len(x) for x in packed])
95 packed.append(loxi.generic_util.pad_to(8, length))
96 length += len(packed[-1])
97 packed[1] = struct.pack("!H", length)
98 return ''.join(packed)
99
Rich Lane7dcdf022013-12-11 14:45:27 -0800100 @staticmethod
101 def unpack(reader):
102 subtype, = reader.peek('!L', 4)
Rich Lane95f7fc92014-01-27 17:08:16 -0800103 subclass = experimenter.subtypes.get(subtype)
104 if subclass:
105 return subclass.unpack(reader)
106
107 obj = experimenter()
108 _type = reader.read("!H")[0]
109 assert(_type == 65535)
110 _len = reader.read("!H")[0]
111 orig_reader = reader
112 reader = orig_reader.slice(_len - (2 + 2))
113 obj.experimenter = reader.read("!L")[0]
114 obj.data = str(reader.read_all())
115 return obj
116
117 def __eq__(self, other):
118 if type(self) != type(other): return False
119 if self.experimenter != other.experimenter: return False
120 if self.data != other.data: return False
121 return True
122
123 def pretty_print(self, q):
124 q.text("experimenter {")
125 with q.group():
126 with q.indent(2):
127 q.breakable()
128 q.text("data = ");
129 q.pp(self.data)
130 q.breakable()
131 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -0800132
133action.subtypes[65535] = experimenter
134
135class bsn(experimenter):
136 subtypes = {}
137
Rich Lane95f7fc92014-01-27 17:08:16 -0800138 type = 65535
139 experimenter = 6035143
140
141 def __init__(self, subtype=None):
142 if subtype != None:
143 self.subtype = subtype
144 else:
145 self.subtype = 0
146 return
147
148 def pack(self):
149 packed = []
150 packed.append(struct.pack("!H", self.type))
151 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
152 packed.append(struct.pack("!L", self.experimenter))
153 packed.append(struct.pack("!L", self.subtype))
154 packed.append('\x00' * 4)
155 length = sum([len(x) for x in packed])
156 packed[1] = struct.pack("!H", length)
157 return ''.join(packed)
158
Rich Lane7dcdf022013-12-11 14:45:27 -0800159 @staticmethod
160 def unpack(reader):
161 subtype, = reader.peek('!L', 8)
Rich Lane95f7fc92014-01-27 17:08:16 -0800162 subclass = bsn.subtypes.get(subtype)
163 if subclass:
164 return subclass.unpack(reader)
165
166 obj = bsn()
167 _type = reader.read("!H")[0]
168 assert(_type == 65535)
169 _len = reader.read("!H")[0]
170 orig_reader = reader
171 reader = orig_reader.slice(_len - (2 + 2))
172 _experimenter = reader.read("!L")[0]
173 assert(_experimenter == 6035143)
174 obj.subtype = reader.read("!L")[0]
175 reader.skip(4)
176 return obj
177
178 def __eq__(self, other):
179 if type(self) != type(other): return False
180 if self.subtype != other.subtype: return False
181 return True
182
183 def pretty_print(self, q):
184 q.text("bsn {")
185 with q.group():
186 with q.indent(2):
187 q.breakable()
188 q.breakable()
189 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -0800190
191experimenter.subtypes[6035143] = bsn
192
Rich Lane5587ab12014-06-30 11:19:09 -0700193class bsn_checksum(bsn):
194 type = 65535
195 experimenter = 6035143
196 subtype = 4
197
198 def __init__(self, checksum=None):
199 if checksum != None:
200 self.checksum = checksum
201 else:
202 self.checksum = 0
203 return
204
205 def pack(self):
206 packed = []
207 packed.append(struct.pack("!H", self.type))
208 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
209 packed.append(struct.pack("!L", self.experimenter))
210 packed.append(struct.pack("!L", self.subtype))
211 packed.append(util.pack_checksum_128(self.checksum))
212 length = sum([len(x) for x in packed])
213 packed[1] = struct.pack("!H", length)
214 return ''.join(packed)
215
216 @staticmethod
217 def unpack(reader):
218 obj = bsn_checksum()
219 _type = reader.read("!H")[0]
220 assert(_type == 65535)
221 _len = reader.read("!H")[0]
222 orig_reader = reader
223 reader = orig_reader.slice(_len - (2 + 2))
224 _experimenter = reader.read("!L")[0]
225 assert(_experimenter == 6035143)
226 _subtype = reader.read("!L")[0]
227 assert(_subtype == 4)
228 obj.checksum = util.unpack_checksum_128(reader)
229 return obj
230
231 def __eq__(self, other):
232 if type(self) != type(other): return False
233 if self.checksum != other.checksum: return False
234 return True
235
236 def pretty_print(self, q):
237 q.text("bsn_checksum {")
238 with q.group():
239 with q.indent(2):
240 q.breakable()
241 q.text("checksum = ");
242 q.pp(self.checksum)
243 q.breakable()
244 q.text('}')
245
246bsn.subtypes[4] = bsn_checksum
247
Rich Lane7dcdf022013-12-11 14:45:27 -0800248class bsn_mirror(bsn):
Dan Talaycof6202252013-07-02 01:00:29 -0700249 type = 65535
250 experimenter = 6035143
Rich Lanec2ee4b82013-04-24 17:12:38 -0700251 subtype = 1
252
253 def __init__(self, dest_port=None, vlan_tag=None, copy_stage=None):
254 if dest_port != None:
255 self.dest_port = dest_port
256 else:
257 self.dest_port = 0
258 if vlan_tag != None:
259 self.vlan_tag = vlan_tag
260 else:
261 self.vlan_tag = 0
262 if copy_stage != None:
263 self.copy_stage = copy_stage
264 else:
265 self.copy_stage = 0
266 return
267
268 def pack(self):
269 packed = []
270 packed.append(struct.pack("!H", self.type))
271 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
272 packed.append(struct.pack("!L", self.experimenter))
273 packed.append(struct.pack("!L", self.subtype))
274 packed.append(struct.pack("!L", self.dest_port))
275 packed.append(struct.pack("!L", self.vlan_tag))
276 packed.append(struct.pack("!B", self.copy_stage))
277 packed.append('\x00' * 3)
278 length = sum([len(x) for x in packed])
279 packed[1] = struct.pack("!H", length)
280 return ''.join(packed)
281
282 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800283 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700284 obj = bsn_mirror()
Dan Talaycof6202252013-07-02 01:00:29 -0700285 _type = reader.read("!H")[0]
286 assert(_type == 65535)
287 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800288 orig_reader = reader
289 reader = orig_reader.slice(_len - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700290 _experimenter = reader.read("!L")[0]
291 assert(_experimenter == 6035143)
292 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700293 assert(_subtype == 1)
Dan Talaycof6202252013-07-02 01:00:29 -0700294 obj.dest_port = reader.read("!L")[0]
295 obj.vlan_tag = reader.read("!L")[0]
296 obj.copy_stage = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700297 reader.skip(3)
298 return obj
299
300 def __eq__(self, other):
301 if type(self) != type(other): return False
302 if self.dest_port != other.dest_port: return False
303 if self.vlan_tag != other.vlan_tag: return False
304 if self.copy_stage != other.copy_stage: return False
305 return True
306
Rich Lanec2ee4b82013-04-24 17:12:38 -0700307 def pretty_print(self, q):
308 q.text("bsn_mirror {")
309 with q.group():
310 with q.indent(2):
311 q.breakable()
312 q.text("dest_port = ");
313 q.text("%#x" % self.dest_port)
314 q.text(","); q.breakable()
315 q.text("vlan_tag = ");
316 q.text("%#x" % self.vlan_tag)
317 q.text(","); q.breakable()
318 q.text("copy_stage = ");
319 q.text("%#x" % self.copy_stage)
320 q.breakable()
321 q.text('}')
322
Rich Lane7dcdf022013-12-11 14:45:27 -0800323bsn.subtypes[1] = bsn_mirror
324
325class bsn_set_tunnel_dst(bsn):
Dan Talaycof6202252013-07-02 01:00:29 -0700326 type = 65535
327 experimenter = 6035143
Rich Lanec2ee4b82013-04-24 17:12:38 -0700328 subtype = 2
329
330 def __init__(self, dst=None):
331 if dst != None:
332 self.dst = dst
333 else:
334 self.dst = 0
335 return
336
337 def pack(self):
338 packed = []
339 packed.append(struct.pack("!H", self.type))
340 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
341 packed.append(struct.pack("!L", self.experimenter))
342 packed.append(struct.pack("!L", self.subtype))
343 packed.append(struct.pack("!L", self.dst))
344 length = sum([len(x) for x in packed])
345 packed[1] = struct.pack("!H", length)
346 return ''.join(packed)
347
348 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800349 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700350 obj = bsn_set_tunnel_dst()
Dan Talaycof6202252013-07-02 01:00:29 -0700351 _type = reader.read("!H")[0]
352 assert(_type == 65535)
353 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800354 orig_reader = reader
355 reader = orig_reader.slice(_len - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700356 _experimenter = reader.read("!L")[0]
357 assert(_experimenter == 6035143)
358 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700359 assert(_subtype == 2)
Dan Talaycof6202252013-07-02 01:00:29 -0700360 obj.dst = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700361 return obj
362
363 def __eq__(self, other):
364 if type(self) != type(other): return False
365 if self.dst != other.dst: return False
366 return True
367
Rich Lanec2ee4b82013-04-24 17:12:38 -0700368 def pretty_print(self, q):
369 q.text("bsn_set_tunnel_dst {")
370 with q.group():
371 with q.indent(2):
372 q.breakable()
373 q.text("dst = ");
374 q.text("%#x" % self.dst)
375 q.breakable()
376 q.text('}')
377
Rich Lane7dcdf022013-12-11 14:45:27 -0800378bsn.subtypes[2] = bsn_set_tunnel_dst
379
380class copy_ttl_in(action):
Dan Talaycof6202252013-07-02 01:00:29 -0700381 type = 12
Rich Lanec2ee4b82013-04-24 17:12:38 -0700382
383 def __init__(self):
384 return
385
386 def pack(self):
387 packed = []
388 packed.append(struct.pack("!H", self.type))
389 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
390 packed.append('\x00' * 4)
391 length = sum([len(x) for x in packed])
392 packed[1] = struct.pack("!H", length)
393 return ''.join(packed)
394
395 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800396 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700397 obj = copy_ttl_in()
Dan Talaycof6202252013-07-02 01:00:29 -0700398 _type = reader.read("!H")[0]
399 assert(_type == 12)
400 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800401 orig_reader = reader
402 reader = orig_reader.slice(_len - (2 + 2))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700403 reader.skip(4)
404 return obj
405
406 def __eq__(self, other):
407 if type(self) != type(other): return False
408 return True
409
Rich Lanec2ee4b82013-04-24 17:12:38 -0700410 def pretty_print(self, q):
411 q.text("copy_ttl_in {")
412 with q.group():
413 with q.indent(2):
414 q.breakable()
415 q.breakable()
416 q.text('}')
417
Rich Lane7dcdf022013-12-11 14:45:27 -0800418action.subtypes[12] = copy_ttl_in
419
420class copy_ttl_out(action):
Dan Talaycof6202252013-07-02 01:00:29 -0700421 type = 11
Rich Lanec2ee4b82013-04-24 17:12:38 -0700422
423 def __init__(self):
424 return
425
426 def pack(self):
427 packed = []
428 packed.append(struct.pack("!H", self.type))
429 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
430 packed.append('\x00' * 4)
431 length = sum([len(x) for x in packed])
432 packed[1] = struct.pack("!H", length)
433 return ''.join(packed)
434
435 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800436 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700437 obj = copy_ttl_out()
Dan Talaycof6202252013-07-02 01:00:29 -0700438 _type = reader.read("!H")[0]
439 assert(_type == 11)
440 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800441 orig_reader = reader
442 reader = orig_reader.slice(_len - (2 + 2))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700443 reader.skip(4)
444 return obj
445
446 def __eq__(self, other):
447 if type(self) != type(other): return False
448 return True
449
Rich Lanec2ee4b82013-04-24 17:12:38 -0700450 def pretty_print(self, q):
451 q.text("copy_ttl_out {")
452 with q.group():
453 with q.indent(2):
454 q.breakable()
455 q.breakable()
456 q.text('}')
457
Rich Lane7dcdf022013-12-11 14:45:27 -0800458action.subtypes[11] = copy_ttl_out
459
460class dec_mpls_ttl(action):
Dan Talaycof6202252013-07-02 01:00:29 -0700461 type = 16
Rich Lanec2ee4b82013-04-24 17:12:38 -0700462
463 def __init__(self):
464 return
465
466 def pack(self):
467 packed = []
468 packed.append(struct.pack("!H", self.type))
469 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
470 packed.append('\x00' * 4)
471 length = sum([len(x) for x in packed])
472 packed[1] = struct.pack("!H", length)
473 return ''.join(packed)
474
475 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800476 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700477 obj = dec_mpls_ttl()
Dan Talaycof6202252013-07-02 01:00:29 -0700478 _type = reader.read("!H")[0]
479 assert(_type == 16)
480 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800481 orig_reader = reader
482 reader = orig_reader.slice(_len - (2 + 2))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700483 reader.skip(4)
484 return obj
485
486 def __eq__(self, other):
487 if type(self) != type(other): return False
488 return True
489
Rich Lanec2ee4b82013-04-24 17:12:38 -0700490 def pretty_print(self, q):
491 q.text("dec_mpls_ttl {")
492 with q.group():
493 with q.indent(2):
494 q.breakable()
495 q.breakable()
496 q.text('}')
497
Rich Lane7dcdf022013-12-11 14:45:27 -0800498action.subtypes[16] = dec_mpls_ttl
499
500class dec_nw_ttl(action):
Dan Talaycof6202252013-07-02 01:00:29 -0700501 type = 24
Rich Lanec2ee4b82013-04-24 17:12:38 -0700502
503 def __init__(self):
504 return
505
506 def pack(self):
507 packed = []
508 packed.append(struct.pack("!H", self.type))
509 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
510 packed.append('\x00' * 4)
511 length = sum([len(x) for x in packed])
512 packed[1] = struct.pack("!H", length)
513 return ''.join(packed)
514
515 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800516 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700517 obj = dec_nw_ttl()
Dan Talaycof6202252013-07-02 01:00:29 -0700518 _type = reader.read("!H")[0]
519 assert(_type == 24)
520 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800521 orig_reader = reader
522 reader = orig_reader.slice(_len - (2 + 2))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700523 reader.skip(4)
524 return obj
525
526 def __eq__(self, other):
527 if type(self) != type(other): return False
528 return True
529
Rich Lanec2ee4b82013-04-24 17:12:38 -0700530 def pretty_print(self, q):
531 q.text("dec_nw_ttl {")
532 with q.group():
533 with q.indent(2):
534 q.breakable()
535 q.breakable()
536 q.text('}')
537
Rich Lane7dcdf022013-12-11 14:45:27 -0800538action.subtypes[24] = dec_nw_ttl
539
540class group(action):
Dan Talaycof6202252013-07-02 01:00:29 -0700541 type = 22
Rich Lanec2ee4b82013-04-24 17:12:38 -0700542
543 def __init__(self, group_id=None):
544 if group_id != None:
545 self.group_id = group_id
546 else:
547 self.group_id = 0
548 return
549
550 def pack(self):
551 packed = []
552 packed.append(struct.pack("!H", self.type))
553 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
554 packed.append(struct.pack("!L", self.group_id))
555 length = sum([len(x) for x in packed])
556 packed[1] = struct.pack("!H", length)
557 return ''.join(packed)
558
559 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800560 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700561 obj = group()
Dan Talaycof6202252013-07-02 01:00:29 -0700562 _type = reader.read("!H")[0]
563 assert(_type == 22)
564 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800565 orig_reader = reader
566 reader = orig_reader.slice(_len - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700567 obj.group_id = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700568 return obj
569
570 def __eq__(self, other):
571 if type(self) != type(other): return False
572 if self.group_id != other.group_id: return False
573 return True
574
Rich Lanec2ee4b82013-04-24 17:12:38 -0700575 def pretty_print(self, q):
576 q.text("group {")
577 with q.group():
578 with q.indent(2):
579 q.breakable()
580 q.text("group_id = ");
581 q.text("%#x" % self.group_id)
582 q.breakable()
583 q.text('}')
584
Rich Lane7dcdf022013-12-11 14:45:27 -0800585action.subtypes[22] = group
586
587class nicira(experimenter):
588 subtypes = {}
589
Rich Lane95f7fc92014-01-27 17:08:16 -0800590 type = 65535
591 experimenter = 8992
592
593 def __init__(self, subtype=None):
594 if subtype != None:
595 self.subtype = subtype
596 else:
597 self.subtype = 0
598 return
599
600 def pack(self):
601 packed = []
602 packed.append(struct.pack("!H", self.type))
603 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
604 packed.append(struct.pack("!L", self.experimenter))
605 packed.append(struct.pack("!H", self.subtype))
606 packed.append('\x00' * 2)
607 packed.append('\x00' * 4)
608 length = sum([len(x) for x in packed])
609 packed[1] = struct.pack("!H", length)
610 return ''.join(packed)
611
Rich Lane7dcdf022013-12-11 14:45:27 -0800612 @staticmethod
613 def unpack(reader):
614 subtype, = reader.peek('!H', 8)
Rich Lane95f7fc92014-01-27 17:08:16 -0800615 subclass = nicira.subtypes.get(subtype)
616 if subclass:
617 return subclass.unpack(reader)
618
619 obj = nicira()
620 _type = reader.read("!H")[0]
621 assert(_type == 65535)
622 _len = reader.read("!H")[0]
623 orig_reader = reader
624 reader = orig_reader.slice(_len - (2 + 2))
625 _experimenter = reader.read("!L")[0]
626 assert(_experimenter == 8992)
627 obj.subtype = reader.read("!H")[0]
628 reader.skip(2)
629 reader.skip(4)
630 return obj
631
632 def __eq__(self, other):
633 if type(self) != type(other): return False
634 if self.subtype != other.subtype: return False
635 return True
636
637 def pretty_print(self, q):
638 q.text("nicira {")
639 with q.group():
640 with q.indent(2):
641 q.breakable()
642 q.breakable()
643 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -0800644
645experimenter.subtypes[8992] = nicira
646
647class nicira_dec_ttl(nicira):
Dan Talaycof6202252013-07-02 01:00:29 -0700648 type = 65535
649 experimenter = 8992
Rich Lanec2ee4b82013-04-24 17:12:38 -0700650 subtype = 18
651
652 def __init__(self):
653 return
654
655 def pack(self):
656 packed = []
657 packed.append(struct.pack("!H", self.type))
658 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
659 packed.append(struct.pack("!L", self.experimenter))
660 packed.append(struct.pack("!H", self.subtype))
661 packed.append('\x00' * 2)
662 packed.append('\x00' * 4)
663 length = sum([len(x) for x in packed])
664 packed[1] = struct.pack("!H", length)
665 return ''.join(packed)
666
667 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800668 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700669 obj = nicira_dec_ttl()
Dan Talaycof6202252013-07-02 01:00:29 -0700670 _type = reader.read("!H")[0]
671 assert(_type == 65535)
672 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800673 orig_reader = reader
674 reader = orig_reader.slice(_len - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700675 _experimenter = reader.read("!L")[0]
676 assert(_experimenter == 8992)
677 _subtype = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700678 assert(_subtype == 18)
679 reader.skip(2)
680 reader.skip(4)
681 return obj
682
683 def __eq__(self, other):
684 if type(self) != type(other): return False
685 return True
686
Rich Lanec2ee4b82013-04-24 17:12:38 -0700687 def pretty_print(self, q):
688 q.text("nicira_dec_ttl {")
689 with q.group():
690 with q.indent(2):
691 q.breakable()
692 q.breakable()
693 q.text('}')
694
Rich Lane7dcdf022013-12-11 14:45:27 -0800695nicira.subtypes[18] = nicira_dec_ttl
696
697class output(action):
Dan Talaycof6202252013-07-02 01:00:29 -0700698 type = 0
Rich Lanec2ee4b82013-04-24 17:12:38 -0700699
700 def __init__(self, port=None, max_len=None):
701 if port != None:
702 self.port = port
703 else:
704 self.port = 0
705 if max_len != None:
706 self.max_len = max_len
707 else:
708 self.max_len = 0
709 return
710
711 def pack(self):
712 packed = []
713 packed.append(struct.pack("!H", self.type))
714 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
Dan Talaycof6202252013-07-02 01:00:29 -0700715 packed.append(util.pack_port_no(self.port))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700716 packed.append(struct.pack("!H", self.max_len))
717 packed.append('\x00' * 6)
718 length = sum([len(x) for x in packed])
719 packed[1] = struct.pack("!H", length)
720 return ''.join(packed)
721
722 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800723 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700724 obj = output()
Dan Talaycof6202252013-07-02 01:00:29 -0700725 _type = reader.read("!H")[0]
726 assert(_type == 0)
727 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800728 orig_reader = reader
729 reader = orig_reader.slice(_len - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700730 obj.port = util.unpack_port_no(reader)
731 obj.max_len = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700732 reader.skip(6)
733 return obj
734
735 def __eq__(self, other):
736 if type(self) != type(other): return False
737 if self.port != other.port: return False
738 if self.max_len != other.max_len: return False
739 return True
740
Rich Lanec2ee4b82013-04-24 17:12:38 -0700741 def pretty_print(self, q):
742 q.text("output {")
743 with q.group():
744 with q.indent(2):
745 q.breakable()
746 q.text("port = ");
747 q.text(util.pretty_port(self.port))
748 q.text(","); q.breakable()
749 q.text("max_len = ");
750 q.text("%#x" % self.max_len)
751 q.breakable()
752 q.text('}')
753
Rich Lane7dcdf022013-12-11 14:45:27 -0800754action.subtypes[0] = output
755
756class pop_mpls(action):
Dan Talaycof6202252013-07-02 01:00:29 -0700757 type = 20
Rich Lanec2ee4b82013-04-24 17:12:38 -0700758
759 def __init__(self, ethertype=None):
760 if ethertype != None:
761 self.ethertype = ethertype
762 else:
763 self.ethertype = 0
764 return
765
766 def pack(self):
767 packed = []
768 packed.append(struct.pack("!H", self.type))
769 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
770 packed.append(struct.pack("!H", self.ethertype))
771 packed.append('\x00' * 2)
772 length = sum([len(x) for x in packed])
773 packed[1] = struct.pack("!H", length)
774 return ''.join(packed)
775
776 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800777 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700778 obj = pop_mpls()
Dan Talaycof6202252013-07-02 01:00:29 -0700779 _type = reader.read("!H")[0]
780 assert(_type == 20)
781 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800782 orig_reader = reader
783 reader = orig_reader.slice(_len - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700784 obj.ethertype = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700785 reader.skip(2)
786 return obj
787
788 def __eq__(self, other):
789 if type(self) != type(other): return False
790 if self.ethertype != other.ethertype: return False
791 return True
792
Rich Lanec2ee4b82013-04-24 17:12:38 -0700793 def pretty_print(self, q):
794 q.text("pop_mpls {")
795 with q.group():
796 with q.indent(2):
797 q.breakable()
798 q.text("ethertype = ");
799 q.text("%#x" % self.ethertype)
800 q.breakable()
801 q.text('}')
802
Rich Lane7dcdf022013-12-11 14:45:27 -0800803action.subtypes[20] = pop_mpls
804
805class pop_pbb(action):
Dan Talaycof6202252013-07-02 01:00:29 -0700806 type = 27
Rich Lanec2ee4b82013-04-24 17:12:38 -0700807
808 def __init__(self):
809 return
810
811 def pack(self):
812 packed = []
813 packed.append(struct.pack("!H", self.type))
814 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
815 packed.append('\x00' * 4)
816 length = sum([len(x) for x in packed])
817 packed[1] = struct.pack("!H", length)
818 return ''.join(packed)
819
820 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800821 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700822 obj = pop_pbb()
Dan Talaycof6202252013-07-02 01:00:29 -0700823 _type = reader.read("!H")[0]
824 assert(_type == 27)
825 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800826 orig_reader = reader
827 reader = orig_reader.slice(_len - (2 + 2))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700828 reader.skip(4)
829 return obj
830
831 def __eq__(self, other):
832 if type(self) != type(other): return False
833 return True
834
Rich Lanec2ee4b82013-04-24 17:12:38 -0700835 def pretty_print(self, q):
836 q.text("pop_pbb {")
837 with q.group():
838 with q.indent(2):
839 q.breakable()
840 q.breakable()
841 q.text('}')
842
Rich Lane7dcdf022013-12-11 14:45:27 -0800843action.subtypes[27] = pop_pbb
844
845class pop_vlan(action):
Dan Talaycof6202252013-07-02 01:00:29 -0700846 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -0700847
848 def __init__(self):
849 return
850
851 def pack(self):
852 packed = []
853 packed.append(struct.pack("!H", self.type))
854 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
855 packed.append('\x00' * 4)
856 length = sum([len(x) for x in packed])
857 packed[1] = struct.pack("!H", length)
858 return ''.join(packed)
859
860 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800861 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700862 obj = pop_vlan()
Dan Talaycof6202252013-07-02 01:00:29 -0700863 _type = reader.read("!H")[0]
864 assert(_type == 18)
865 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800866 orig_reader = reader
867 reader = orig_reader.slice(_len - (2 + 2))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700868 reader.skip(4)
869 return obj
870
871 def __eq__(self, other):
872 if type(self) != type(other): return False
873 return True
874
Rich Lanec2ee4b82013-04-24 17:12:38 -0700875 def pretty_print(self, q):
876 q.text("pop_vlan {")
877 with q.group():
878 with q.indent(2):
879 q.breakable()
880 q.breakable()
881 q.text('}')
882
Rich Lane7dcdf022013-12-11 14:45:27 -0800883action.subtypes[18] = pop_vlan
884
885class push_mpls(action):
Dan Talaycof6202252013-07-02 01:00:29 -0700886 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -0700887
888 def __init__(self, ethertype=None):
889 if ethertype != None:
890 self.ethertype = ethertype
891 else:
892 self.ethertype = 0
893 return
894
895 def pack(self):
896 packed = []
897 packed.append(struct.pack("!H", self.type))
898 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
899 packed.append(struct.pack("!H", self.ethertype))
900 packed.append('\x00' * 2)
901 length = sum([len(x) for x in packed])
902 packed[1] = struct.pack("!H", length)
903 return ''.join(packed)
904
905 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800906 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700907 obj = push_mpls()
Dan Talaycof6202252013-07-02 01:00:29 -0700908 _type = reader.read("!H")[0]
909 assert(_type == 19)
910 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800911 orig_reader = reader
912 reader = orig_reader.slice(_len - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700913 obj.ethertype = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700914 reader.skip(2)
915 return obj
916
917 def __eq__(self, other):
918 if type(self) != type(other): return False
919 if self.ethertype != other.ethertype: return False
920 return True
921
Rich Lanec2ee4b82013-04-24 17:12:38 -0700922 def pretty_print(self, q):
923 q.text("push_mpls {")
924 with q.group():
925 with q.indent(2):
926 q.breakable()
927 q.text("ethertype = ");
928 q.text("%#x" % self.ethertype)
929 q.breakable()
930 q.text('}')
931
Rich Lane7dcdf022013-12-11 14:45:27 -0800932action.subtypes[19] = push_mpls
933
934class push_pbb(action):
Dan Talaycof6202252013-07-02 01:00:29 -0700935 type = 26
Rich Lanec2ee4b82013-04-24 17:12:38 -0700936
937 def __init__(self, ethertype=None):
938 if ethertype != None:
939 self.ethertype = ethertype
940 else:
941 self.ethertype = 0
942 return
943
944 def pack(self):
945 packed = []
946 packed.append(struct.pack("!H", self.type))
947 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
948 packed.append(struct.pack("!H", self.ethertype))
949 packed.append('\x00' * 2)
950 length = sum([len(x) for x in packed])
951 packed[1] = struct.pack("!H", length)
952 return ''.join(packed)
953
954 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800955 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700956 obj = push_pbb()
Dan Talaycof6202252013-07-02 01:00:29 -0700957 _type = reader.read("!H")[0]
958 assert(_type == 26)
959 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800960 orig_reader = reader
961 reader = orig_reader.slice(_len - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700962 obj.ethertype = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700963 reader.skip(2)
964 return obj
965
966 def __eq__(self, other):
967 if type(self) != type(other): return False
968 if self.ethertype != other.ethertype: return False
969 return True
970
Rich Lanec2ee4b82013-04-24 17:12:38 -0700971 def pretty_print(self, q):
972 q.text("push_pbb {")
973 with q.group():
974 with q.indent(2):
975 q.breakable()
976 q.text("ethertype = ");
977 q.text("%#x" % self.ethertype)
978 q.breakable()
979 q.text('}')
980
Rich Lane7dcdf022013-12-11 14:45:27 -0800981action.subtypes[26] = push_pbb
982
983class push_vlan(action):
Dan Talaycof6202252013-07-02 01:00:29 -0700984 type = 17
Rich Lanec2ee4b82013-04-24 17:12:38 -0700985
986 def __init__(self, ethertype=None):
987 if ethertype != None:
988 self.ethertype = ethertype
989 else:
990 self.ethertype = 0
991 return
992
993 def pack(self):
994 packed = []
995 packed.append(struct.pack("!H", self.type))
996 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
997 packed.append(struct.pack("!H", self.ethertype))
998 packed.append('\x00' * 2)
999 length = sum([len(x) for x in packed])
1000 packed[1] = struct.pack("!H", length)
1001 return ''.join(packed)
1002
1003 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001004 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001005 obj = push_vlan()
Dan Talaycof6202252013-07-02 01:00:29 -07001006 _type = reader.read("!H")[0]
1007 assert(_type == 17)
1008 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001009 orig_reader = reader
1010 reader = orig_reader.slice(_len - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001011 obj.ethertype = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001012 reader.skip(2)
1013 return obj
1014
1015 def __eq__(self, other):
1016 if type(self) != type(other): return False
1017 if self.ethertype != other.ethertype: return False
1018 return True
1019
Rich Lanec2ee4b82013-04-24 17:12:38 -07001020 def pretty_print(self, q):
1021 q.text("push_vlan {")
1022 with q.group():
1023 with q.indent(2):
1024 q.breakable()
1025 q.text("ethertype = ");
1026 q.text("%#x" % self.ethertype)
1027 q.breakable()
1028 q.text('}')
1029
Rich Lane7dcdf022013-12-11 14:45:27 -08001030action.subtypes[17] = push_vlan
1031
1032class set_field(action):
Dan Talaycof6202252013-07-02 01:00:29 -07001033 type = 25
Rich Lanec2ee4b82013-04-24 17:12:38 -07001034
1035 def __init__(self, field=None):
1036 if field != None:
1037 self.field = field
1038 else:
Rich Laned53156a2013-08-05 17:17:33 -07001039 self.field = None
Rich Lanec2ee4b82013-04-24 17:12:38 -07001040 return
1041
1042 def pack(self):
1043 packed = []
1044 packed.append(struct.pack("!H", self.type))
1045 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
Rich Laned53156a2013-08-05 17:17:33 -07001046 packed.append(self.field.pack())
Rich Lanec2ee4b82013-04-24 17:12:38 -07001047 length = sum([len(x) for x in packed])
Rich Laned53156a2013-08-05 17:17:33 -07001048 packed.append(loxi.generic_util.pad_to(8, length))
1049 length += len(packed[-1])
Rich Lanec2ee4b82013-04-24 17:12:38 -07001050 packed[1] = struct.pack("!H", length)
1051 return ''.join(packed)
1052
1053 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001054 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001055 obj = set_field()
Dan Talaycof6202252013-07-02 01:00:29 -07001056 _type = reader.read("!H")[0]
1057 assert(_type == 25)
1058 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001059 orig_reader = reader
1060 reader = orig_reader.slice(_len - (2 + 2))
1061 obj.field = oxm.oxm.unpack(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -07001062 return obj
1063
1064 def __eq__(self, other):
1065 if type(self) != type(other): return False
1066 if self.field != other.field: return False
1067 return True
1068
Rich Lanec2ee4b82013-04-24 17:12:38 -07001069 def pretty_print(self, q):
1070 q.text("set_field {")
1071 with q.group():
1072 with q.indent(2):
1073 q.breakable()
1074 q.text("field = ");
1075 q.pp(self.field)
1076 q.breakable()
1077 q.text('}')
1078
Rich Lane7dcdf022013-12-11 14:45:27 -08001079action.subtypes[25] = set_field
1080
1081class set_mpls_ttl(action):
Dan Talaycof6202252013-07-02 01:00:29 -07001082 type = 15
Rich Lanec2ee4b82013-04-24 17:12:38 -07001083
1084 def __init__(self, mpls_ttl=None):
1085 if mpls_ttl != None:
1086 self.mpls_ttl = mpls_ttl
1087 else:
1088 self.mpls_ttl = 0
1089 return
1090
1091 def pack(self):
1092 packed = []
1093 packed.append(struct.pack("!H", self.type))
1094 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
1095 packed.append(struct.pack("!B", self.mpls_ttl))
1096 packed.append('\x00' * 3)
1097 length = sum([len(x) for x in packed])
1098 packed[1] = struct.pack("!H", length)
1099 return ''.join(packed)
1100
1101 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001102 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001103 obj = set_mpls_ttl()
Dan Talaycof6202252013-07-02 01:00:29 -07001104 _type = reader.read("!H")[0]
1105 assert(_type == 15)
1106 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001107 orig_reader = reader
1108 reader = orig_reader.slice(_len - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001109 obj.mpls_ttl = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001110 reader.skip(3)
1111 return obj
1112
1113 def __eq__(self, other):
1114 if type(self) != type(other): return False
1115 if self.mpls_ttl != other.mpls_ttl: return False
1116 return True
1117
Rich Lanec2ee4b82013-04-24 17:12:38 -07001118 def pretty_print(self, q):
1119 q.text("set_mpls_ttl {")
1120 with q.group():
1121 with q.indent(2):
1122 q.breakable()
1123 q.text("mpls_ttl = ");
1124 q.text("%#x" % self.mpls_ttl)
1125 q.breakable()
1126 q.text('}')
1127
Rich Lane7dcdf022013-12-11 14:45:27 -08001128action.subtypes[15] = set_mpls_ttl
1129
1130class set_nw_ttl(action):
Dan Talaycof6202252013-07-02 01:00:29 -07001131 type = 23
Rich Lanec2ee4b82013-04-24 17:12:38 -07001132
1133 def __init__(self, nw_ttl=None):
1134 if nw_ttl != None:
1135 self.nw_ttl = nw_ttl
1136 else:
1137 self.nw_ttl = 0
1138 return
1139
1140 def pack(self):
1141 packed = []
1142 packed.append(struct.pack("!H", self.type))
1143 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
1144 packed.append(struct.pack("!B", self.nw_ttl))
1145 packed.append('\x00' * 3)
1146 length = sum([len(x) for x in packed])
1147 packed[1] = struct.pack("!H", length)
1148 return ''.join(packed)
1149
1150 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001151 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001152 obj = set_nw_ttl()
Dan Talaycof6202252013-07-02 01:00:29 -07001153 _type = reader.read("!H")[0]
1154 assert(_type == 23)
1155 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001156 orig_reader = reader
1157 reader = orig_reader.slice(_len - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001158 obj.nw_ttl = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001159 reader.skip(3)
1160 return obj
1161
1162 def __eq__(self, other):
1163 if type(self) != type(other): return False
1164 if self.nw_ttl != other.nw_ttl: return False
1165 return True
1166
Rich Lanec2ee4b82013-04-24 17:12:38 -07001167 def pretty_print(self, q):
1168 q.text("set_nw_ttl {")
1169 with q.group():
1170 with q.indent(2):
1171 q.breakable()
1172 q.text("nw_ttl = ");
1173 q.text("%#x" % self.nw_ttl)
1174 q.breakable()
1175 q.text('}')
1176
Rich Lane7dcdf022013-12-11 14:45:27 -08001177action.subtypes[23] = set_nw_ttl
1178
1179class set_queue(action):
Dan Talaycof6202252013-07-02 01:00:29 -07001180 type = 21
Rich Lanec2ee4b82013-04-24 17:12:38 -07001181
1182 def __init__(self, queue_id=None):
1183 if queue_id != None:
1184 self.queue_id = queue_id
1185 else:
1186 self.queue_id = 0
1187 return
1188
1189 def pack(self):
1190 packed = []
1191 packed.append(struct.pack("!H", self.type))
1192 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
1193 packed.append(struct.pack("!L", self.queue_id))
1194 length = sum([len(x) for x in packed])
1195 packed[1] = struct.pack("!H", length)
1196 return ''.join(packed)
1197
1198 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001199 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001200 obj = set_queue()
Dan Talaycof6202252013-07-02 01:00:29 -07001201 _type = reader.read("!H")[0]
1202 assert(_type == 21)
1203 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001204 orig_reader = reader
1205 reader = orig_reader.slice(_len - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001206 obj.queue_id = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001207 return obj
1208
1209 def __eq__(self, other):
1210 if type(self) != type(other): return False
1211 if self.queue_id != other.queue_id: return False
1212 return True
1213
Rich Lanec2ee4b82013-04-24 17:12:38 -07001214 def pretty_print(self, q):
1215 q.text("set_queue {")
1216 with q.group():
1217 with q.indent(2):
1218 q.breakable()
1219 q.text("queue_id = ");
1220 q.text("%#x" % self.queue_id)
1221 q.breakable()
1222 q.text('}')
1223
Rich Lane7dcdf022013-12-11 14:45:27 -08001224action.subtypes[21] = set_queue
Rich Lanec2ee4b82013-04-24 17:12:38 -07001225
Rich Lanec2ee4b82013-04-24 17:12:38 -07001226