blob: b30383ee748fa51bf567937b6e3cc323a6057a72 [file] [log] [blame]
Rich Lane7dcdf022013-12-11 14:45:27 -08001# 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.
4# See the file LICENSE.pyloxi which should have been included in the source distribution
5
6# Automatically generated by LOXI from template module.py
7# Do not modify
8
9import struct
10import loxi
11import 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 Lane7dcdf022013-12-11 14:45:27 -080021import util
22import loxi.generic_util
23
24class action_id(loxi.OFObject):
25 subtypes = {}
26
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
Rich Lane95f7fc92014-01-27 17:08:16 -080039 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_id.subtypes.get(subtype)
47 if subclass:
48 return subclass.unpack(reader)
49
50 obj = action_id()
51 obj.type = reader.read("!H")[0]
52 _len = reader.read("!H")[0]
53 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080054 reader = orig_reader.slice(_len, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -080055 return obj
56
57 def __eq__(self, other):
58 if type(self) != type(other): return False
59 if self.type != other.type: return False
60 return True
61
62 def pretty_print(self, q):
63 q.text("action_id {")
64 with q.group():
65 with q.indent(2):
66 q.breakable()
67 q.breakable()
68 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -080069
70
71class experimenter(action_id):
72 subtypes = {}
73
Rich Lane95f7fc92014-01-27 17:08:16 -080074 type = 65535
75
76 def __init__(self, experimenter=None):
77 if experimenter != None:
78 self.experimenter = experimenter
79 else:
80 self.experimenter = 0
81 return
82
83 def pack(self):
84 packed = []
85 packed.append(struct.pack("!H", self.type))
86 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
87 packed.append(struct.pack("!L", self.experimenter))
88 length = sum([len(x) for x in packed])
89 packed[1] = struct.pack("!H", length)
90 return ''.join(packed)
91
Rich Lane7dcdf022013-12-11 14:45:27 -080092 @staticmethod
93 def unpack(reader):
94 subtype, = reader.peek('!L', 4)
Rich Lane95f7fc92014-01-27 17:08:16 -080095 subclass = experimenter.subtypes.get(subtype)
96 if subclass:
97 return subclass.unpack(reader)
98
99 obj = experimenter()
100 _type = reader.read("!H")[0]
101 assert(_type == 65535)
102 _len = reader.read("!H")[0]
103 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800104 reader = orig_reader.slice(_len, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -0800105 obj.experimenter = reader.read("!L")[0]
106 return obj
107
108 def __eq__(self, other):
109 if type(self) != type(other): return False
110 if self.experimenter != other.experimenter: return False
111 return True
112
113 def pretty_print(self, q):
114 q.text("experimenter {")
115 with q.group():
116 with q.indent(2):
117 q.breakable()
118 q.breakable()
119 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -0800120
121action_id.subtypes[65535] = experimenter
122
123class bsn(experimenter):
124 subtypes = {}
125
Rich Lane95f7fc92014-01-27 17:08:16 -0800126 type = 65535
127 experimenter = 6035143
128
129 def __init__(self, subtype=None):
130 if subtype != None:
131 self.subtype = subtype
132 else:
133 self.subtype = 0
134 return
135
136 def pack(self):
137 packed = []
138 packed.append(struct.pack("!H", self.type))
139 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
140 packed.append(struct.pack("!L", self.experimenter))
141 packed.append(struct.pack("!L", self.subtype))
Rich Lane95f7fc92014-01-27 17:08:16 -0800142 length = sum([len(x) for x in packed])
143 packed[1] = struct.pack("!H", length)
144 return ''.join(packed)
145
Rich Lane7dcdf022013-12-11 14:45:27 -0800146 @staticmethod
147 def unpack(reader):
148 subtype, = reader.peek('!L', 8)
Rich Lane95f7fc92014-01-27 17:08:16 -0800149 subclass = bsn.subtypes.get(subtype)
150 if subclass:
151 return subclass.unpack(reader)
152
153 obj = bsn()
154 _type = reader.read("!H")[0]
155 assert(_type == 65535)
156 _len = reader.read("!H")[0]
157 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800158 reader = orig_reader.slice(_len, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -0800159 _experimenter = reader.read("!L")[0]
160 assert(_experimenter == 6035143)
161 obj.subtype = reader.read("!L")[0]
Rich Lane95f7fc92014-01-27 17:08:16 -0800162 return obj
163
164 def __eq__(self, other):
165 if type(self) != type(other): return False
166 if self.subtype != other.subtype: return False
167 return True
168
169 def pretty_print(self, q):
170 q.text("bsn {")
171 with q.group():
172 with q.indent(2):
173 q.breakable()
174 q.breakable()
175 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -0800176
177experimenter.subtypes[6035143] = bsn
178
Rich Lane5587ab12014-06-30 11:19:09 -0700179class bsn_checksum(bsn):
180 type = 65535
181 experimenter = 6035143
182 subtype = 4
183
184 def __init__(self):
185 return
186
187 def pack(self):
188 packed = []
189 packed.append(struct.pack("!H", self.type))
190 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
191 packed.append(struct.pack("!L", self.experimenter))
192 packed.append(struct.pack("!L", self.subtype))
193 length = sum([len(x) for x in packed])
194 packed[1] = struct.pack("!H", length)
195 return ''.join(packed)
196
197 @staticmethod
198 def unpack(reader):
199 obj = bsn_checksum()
200 _type = reader.read("!H")[0]
201 assert(_type == 65535)
202 _len = reader.read("!H")[0]
203 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800204 reader = orig_reader.slice(_len, 4)
Rich Lane5587ab12014-06-30 11:19:09 -0700205 _experimenter = reader.read("!L")[0]
206 assert(_experimenter == 6035143)
207 _subtype = reader.read("!L")[0]
208 assert(_subtype == 4)
209 return obj
210
211 def __eq__(self, other):
212 if type(self) != type(other): return False
213 return True
214
215 def pretty_print(self, q):
216 q.text("bsn_checksum {")
217 with q.group():
218 with q.indent(2):
219 q.breakable()
220 q.breakable()
221 q.text('}')
222
223bsn.subtypes[4] = bsn_checksum
224
Rich Lane2e079da2014-10-29 15:30:24 -0700225class bsn_gentable(bsn):
226 type = 65535
227 experimenter = 6035143
228 subtype = 5
229
230 def __init__(self):
231 return
232
233 def pack(self):
234 packed = []
235 packed.append(struct.pack("!H", self.type))
236 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
237 packed.append(struct.pack("!L", self.experimenter))
238 packed.append(struct.pack("!L", self.subtype))
239 length = sum([len(x) for x in packed])
240 packed[1] = struct.pack("!H", length)
241 return ''.join(packed)
242
243 @staticmethod
244 def unpack(reader):
245 obj = bsn_gentable()
246 _type = reader.read("!H")[0]
247 assert(_type == 65535)
248 _len = reader.read("!H")[0]
249 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800250 reader = orig_reader.slice(_len, 4)
Rich Lane2e079da2014-10-29 15:30:24 -0700251 _experimenter = reader.read("!L")[0]
252 assert(_experimenter == 6035143)
253 _subtype = reader.read("!L")[0]
254 assert(_subtype == 5)
255 return obj
256
257 def __eq__(self, other):
258 if type(self) != type(other): return False
259 return True
260
261 def pretty_print(self, q):
262 q.text("bsn_gentable {")
263 with q.group():
264 with q.indent(2):
265 q.breakable()
266 q.breakable()
267 q.text('}')
268
269bsn.subtypes[5] = bsn_gentable
270
Rich Lane7dcdf022013-12-11 14:45:27 -0800271class bsn_mirror(bsn):
272 type = 65535
273 experimenter = 6035143
274 subtype = 1
275
276 def __init__(self):
277 return
278
279 def pack(self):
280 packed = []
281 packed.append(struct.pack("!H", self.type))
282 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
283 packed.append(struct.pack("!L", self.experimenter))
284 packed.append(struct.pack("!L", self.subtype))
Rich Lane7dcdf022013-12-11 14:45:27 -0800285 length = sum([len(x) for x in packed])
286 packed[1] = struct.pack("!H", length)
287 return ''.join(packed)
288
289 @staticmethod
290 def unpack(reader):
291 obj = bsn_mirror()
292 _type = reader.read("!H")[0]
293 assert(_type == 65535)
294 _len = reader.read("!H")[0]
295 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800296 reader = orig_reader.slice(_len, 4)
Rich Lane7dcdf022013-12-11 14:45:27 -0800297 _experimenter = reader.read("!L")[0]
298 assert(_experimenter == 6035143)
299 _subtype = reader.read("!L")[0]
300 assert(_subtype == 1)
Rich Lane7dcdf022013-12-11 14:45:27 -0800301 return obj
302
303 def __eq__(self, other):
304 if type(self) != type(other): return False
305 return True
306
307 def pretty_print(self, q):
308 q.text("bsn_mirror {")
309 with q.group():
310 with q.indent(2):
311 q.breakable()
312 q.breakable()
313 q.text('}')
314
315bsn.subtypes[1] = bsn_mirror
316
317class bsn_set_tunnel_dst(bsn):
318 type = 65535
319 experimenter = 6035143
320 subtype = 2
321
322 def __init__(self):
323 return
324
325 def pack(self):
326 packed = []
327 packed.append(struct.pack("!H", self.type))
328 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
329 packed.append(struct.pack("!L", self.experimenter))
330 packed.append(struct.pack("!L", self.subtype))
331 length = sum([len(x) for x in packed])
332 packed[1] = struct.pack("!H", length)
333 return ''.join(packed)
334
335 @staticmethod
336 def unpack(reader):
337 obj = bsn_set_tunnel_dst()
338 _type = reader.read("!H")[0]
339 assert(_type == 65535)
340 _len = reader.read("!H")[0]
341 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800342 reader = orig_reader.slice(_len, 4)
Rich Lane7dcdf022013-12-11 14:45:27 -0800343 _experimenter = reader.read("!L")[0]
344 assert(_experimenter == 6035143)
345 _subtype = reader.read("!L")[0]
346 assert(_subtype == 2)
347 return obj
348
349 def __eq__(self, other):
350 if type(self) != type(other): return False
351 return True
352
353 def pretty_print(self, q):
354 q.text("bsn_set_tunnel_dst {")
355 with q.group():
356 with q.indent(2):
357 q.breakable()
358 q.breakable()
359 q.text('}')
360
361bsn.subtypes[2] = bsn_set_tunnel_dst
362
363class copy_ttl_in(action_id):
364 type = 12
365
366 def __init__(self):
367 return
368
369 def pack(self):
370 packed = []
371 packed.append(struct.pack("!H", self.type))
372 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
Rich Lane7dcdf022013-12-11 14:45:27 -0800373 length = sum([len(x) for x in packed])
374 packed[1] = struct.pack("!H", length)
375 return ''.join(packed)
376
377 @staticmethod
378 def unpack(reader):
379 obj = copy_ttl_in()
380 _type = reader.read("!H")[0]
381 assert(_type == 12)
382 _len = reader.read("!H")[0]
383 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800384 reader = orig_reader.slice(_len, 4)
Rich Lane7dcdf022013-12-11 14:45:27 -0800385 return obj
386
387 def __eq__(self, other):
388 if type(self) != type(other): return False
389 return True
390
391 def pretty_print(self, q):
392 q.text("copy_ttl_in {")
393 with q.group():
394 with q.indent(2):
395 q.breakable()
396 q.breakable()
397 q.text('}')
398
399action_id.subtypes[12] = copy_ttl_in
400
401class copy_ttl_out(action_id):
402 type = 11
403
404 def __init__(self):
405 return
406
407 def pack(self):
408 packed = []
409 packed.append(struct.pack("!H", self.type))
410 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
Rich Lane7dcdf022013-12-11 14:45:27 -0800411 length = sum([len(x) for x in packed])
412 packed[1] = struct.pack("!H", length)
413 return ''.join(packed)
414
415 @staticmethod
416 def unpack(reader):
417 obj = copy_ttl_out()
418 _type = reader.read("!H")[0]
419 assert(_type == 11)
420 _len = reader.read("!H")[0]
421 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800422 reader = orig_reader.slice(_len, 4)
Rich Lane7dcdf022013-12-11 14:45:27 -0800423 return obj
424
425 def __eq__(self, other):
426 if type(self) != type(other): return False
427 return True
428
429 def pretty_print(self, q):
430 q.text("copy_ttl_out {")
431 with q.group():
432 with q.indent(2):
433 q.breakable()
434 q.breakable()
435 q.text('}')
436
437action_id.subtypes[11] = copy_ttl_out
438
439class dec_mpls_ttl(action_id):
440 type = 16
441
442 def __init__(self):
443 return
444
445 def pack(self):
446 packed = []
447 packed.append(struct.pack("!H", self.type))
448 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
Rich Lane7dcdf022013-12-11 14:45:27 -0800449 length = sum([len(x) for x in packed])
450 packed[1] = struct.pack("!H", length)
451 return ''.join(packed)
452
453 @staticmethod
454 def unpack(reader):
455 obj = dec_mpls_ttl()
456 _type = reader.read("!H")[0]
457 assert(_type == 16)
458 _len = reader.read("!H")[0]
459 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800460 reader = orig_reader.slice(_len, 4)
Rich Lane7dcdf022013-12-11 14:45:27 -0800461 return obj
462
463 def __eq__(self, other):
464 if type(self) != type(other): return False
465 return True
466
467 def pretty_print(self, q):
468 q.text("dec_mpls_ttl {")
469 with q.group():
470 with q.indent(2):
471 q.breakable()
472 q.breakable()
473 q.text('}')
474
475action_id.subtypes[16] = dec_mpls_ttl
476
477class dec_nw_ttl(action_id):
478 type = 24
479
480 def __init__(self):
481 return
482
483 def pack(self):
484 packed = []
485 packed.append(struct.pack("!H", self.type))
486 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
Rich Lane7dcdf022013-12-11 14:45:27 -0800487 length = sum([len(x) for x in packed])
488 packed[1] = struct.pack("!H", length)
489 return ''.join(packed)
490
491 @staticmethod
492 def unpack(reader):
493 obj = dec_nw_ttl()
494 _type = reader.read("!H")[0]
495 assert(_type == 24)
496 _len = reader.read("!H")[0]
497 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800498 reader = orig_reader.slice(_len, 4)
Rich Lane7dcdf022013-12-11 14:45:27 -0800499 return obj
500
501 def __eq__(self, other):
502 if type(self) != type(other): return False
503 return True
504
505 def pretty_print(self, q):
506 q.text("dec_nw_ttl {")
507 with q.group():
508 with q.indent(2):
509 q.breakable()
510 q.breakable()
511 q.text('}')
512
513action_id.subtypes[24] = dec_nw_ttl
514
515class group(action_id):
516 type = 22
517
518 def __init__(self):
519 return
520
521 def pack(self):
522 packed = []
523 packed.append(struct.pack("!H", self.type))
524 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
525 length = sum([len(x) for x in packed])
526 packed[1] = struct.pack("!H", length)
527 return ''.join(packed)
528
529 @staticmethod
530 def unpack(reader):
531 obj = group()
532 _type = reader.read("!H")[0]
533 assert(_type == 22)
534 _len = reader.read("!H")[0]
535 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800536 reader = orig_reader.slice(_len, 4)
Rich Lane7dcdf022013-12-11 14:45:27 -0800537 return obj
538
539 def __eq__(self, other):
540 if type(self) != type(other): return False
541 return True
542
543 def pretty_print(self, q):
544 q.text("group {")
545 with q.group():
546 with q.indent(2):
547 q.breakable()
548 q.breakable()
549 q.text('}')
550
551action_id.subtypes[22] = group
552
553class nicira(experimenter):
554 subtypes = {}
555
Rich Lane95f7fc92014-01-27 17:08:16 -0800556 type = 65535
557 experimenter = 8992
558
559 def __init__(self, subtype=None):
560 if subtype != None:
561 self.subtype = subtype
562 else:
563 self.subtype = 0
564 return
565
566 def pack(self):
567 packed = []
568 packed.append(struct.pack("!H", self.type))
569 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
570 packed.append(struct.pack("!L", self.experimenter))
571 packed.append(struct.pack("!H", self.subtype))
Rich Lane95f7fc92014-01-27 17:08:16 -0800572 length = sum([len(x) for x in packed])
573 packed[1] = struct.pack("!H", length)
574 return ''.join(packed)
575
Rich Lane7dcdf022013-12-11 14:45:27 -0800576 @staticmethod
577 def unpack(reader):
578 subtype, = reader.peek('!H', 8)
Rich Lane95f7fc92014-01-27 17:08:16 -0800579 subclass = nicira.subtypes.get(subtype)
580 if subclass:
581 return subclass.unpack(reader)
582
583 obj = nicira()
584 _type = reader.read("!H")[0]
585 assert(_type == 65535)
586 _len = reader.read("!H")[0]
587 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800588 reader = orig_reader.slice(_len, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -0800589 _experimenter = reader.read("!L")[0]
590 assert(_experimenter == 8992)
591 obj.subtype = reader.read("!H")[0]
Rich Lane95f7fc92014-01-27 17:08:16 -0800592 return obj
593
594 def __eq__(self, other):
595 if type(self) != type(other): return False
596 if self.subtype != other.subtype: return False
597 return True
598
599 def pretty_print(self, q):
600 q.text("nicira {")
601 with q.group():
602 with q.indent(2):
603 q.breakable()
604 q.breakable()
605 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -0800606
607experimenter.subtypes[8992] = nicira
608
609class nicira_dec_ttl(nicira):
610 type = 65535
611 experimenter = 8992
612 subtype = 18
613
614 def __init__(self):
615 return
616
617 def pack(self):
618 packed = []
619 packed.append(struct.pack("!H", self.type))
620 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
621 packed.append(struct.pack("!L", self.experimenter))
622 packed.append(struct.pack("!H", self.subtype))
Rich Lane7dcdf022013-12-11 14:45:27 -0800623 length = sum([len(x) for x in packed])
624 packed[1] = struct.pack("!H", length)
625 return ''.join(packed)
626
627 @staticmethod
628 def unpack(reader):
629 obj = nicira_dec_ttl()
630 _type = reader.read("!H")[0]
631 assert(_type == 65535)
632 _len = reader.read("!H")[0]
633 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800634 reader = orig_reader.slice(_len, 4)
Rich Lane7dcdf022013-12-11 14:45:27 -0800635 _experimenter = reader.read("!L")[0]
636 assert(_experimenter == 8992)
637 _subtype = reader.read("!H")[0]
638 assert(_subtype == 18)
Rich Lane7dcdf022013-12-11 14:45:27 -0800639 return obj
640
641 def __eq__(self, other):
642 if type(self) != type(other): return False
643 return True
644
645 def pretty_print(self, q):
646 q.text("nicira_dec_ttl {")
647 with q.group():
648 with q.indent(2):
649 q.breakable()
650 q.breakable()
651 q.text('}')
652
653nicira.subtypes[18] = nicira_dec_ttl
654
655class output(action_id):
656 type = 0
657
658 def __init__(self):
659 return
660
661 def pack(self):
662 packed = []
663 packed.append(struct.pack("!H", self.type))
664 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
Rich Lane7dcdf022013-12-11 14:45:27 -0800665 length = sum([len(x) for x in packed])
666 packed[1] = struct.pack("!H", length)
667 return ''.join(packed)
668
669 @staticmethod
670 def unpack(reader):
671 obj = output()
672 _type = reader.read("!H")[0]
673 assert(_type == 0)
674 _len = reader.read("!H")[0]
675 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800676 reader = orig_reader.slice(_len, 4)
Rich Lane7dcdf022013-12-11 14:45:27 -0800677 return obj
678
679 def __eq__(self, other):
680 if type(self) != type(other): return False
681 return True
682
683 def pretty_print(self, q):
684 q.text("output {")
685 with q.group():
686 with q.indent(2):
687 q.breakable()
688 q.breakable()
689 q.text('}')
690
691action_id.subtypes[0] = output
692
693class pop_mpls(action_id):
694 type = 20
695
696 def __init__(self):
697 return
698
699 def pack(self):
700 packed = []
701 packed.append(struct.pack("!H", self.type))
702 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
Rich Lane7dcdf022013-12-11 14:45:27 -0800703 length = sum([len(x) for x in packed])
704 packed[1] = struct.pack("!H", length)
705 return ''.join(packed)
706
707 @staticmethod
708 def unpack(reader):
709 obj = pop_mpls()
710 _type = reader.read("!H")[0]
711 assert(_type == 20)
712 _len = reader.read("!H")[0]
713 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800714 reader = orig_reader.slice(_len, 4)
Rich Lane7dcdf022013-12-11 14:45:27 -0800715 return obj
716
717 def __eq__(self, other):
718 if type(self) != type(other): return False
719 return True
720
721 def pretty_print(self, q):
722 q.text("pop_mpls {")
723 with q.group():
724 with q.indent(2):
725 q.breakable()
726 q.breakable()
727 q.text('}')
728
729action_id.subtypes[20] = pop_mpls
730
731class pop_pbb(action_id):
732 type = 27
733
734 def __init__(self):
735 return
736
737 def pack(self):
738 packed = []
739 packed.append(struct.pack("!H", self.type))
740 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
Rich Lane7dcdf022013-12-11 14:45:27 -0800741 length = sum([len(x) for x in packed])
742 packed[1] = struct.pack("!H", length)
743 return ''.join(packed)
744
745 @staticmethod
746 def unpack(reader):
747 obj = pop_pbb()
748 _type = reader.read("!H")[0]
749 assert(_type == 27)
750 _len = reader.read("!H")[0]
751 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800752 reader = orig_reader.slice(_len, 4)
Rich Lane7dcdf022013-12-11 14:45:27 -0800753 return obj
754
755 def __eq__(self, other):
756 if type(self) != type(other): return False
757 return True
758
759 def pretty_print(self, q):
760 q.text("pop_pbb {")
761 with q.group():
762 with q.indent(2):
763 q.breakable()
764 q.breakable()
765 q.text('}')
766
767action_id.subtypes[27] = pop_pbb
768
769class pop_vlan(action_id):
770 type = 18
771
772 def __init__(self):
773 return
774
775 def pack(self):
776 packed = []
777 packed.append(struct.pack("!H", self.type))
778 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
Rich Lane7dcdf022013-12-11 14:45:27 -0800779 length = sum([len(x) for x in packed])
780 packed[1] = struct.pack("!H", length)
781 return ''.join(packed)
782
783 @staticmethod
784 def unpack(reader):
785 obj = pop_vlan()
786 _type = reader.read("!H")[0]
787 assert(_type == 18)
788 _len = reader.read("!H")[0]
789 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800790 reader = orig_reader.slice(_len, 4)
Rich Lane7dcdf022013-12-11 14:45:27 -0800791 return obj
792
793 def __eq__(self, other):
794 if type(self) != type(other): return False
795 return True
796
797 def pretty_print(self, q):
798 q.text("pop_vlan {")
799 with q.group():
800 with q.indent(2):
801 q.breakable()
802 q.breakable()
803 q.text('}')
804
805action_id.subtypes[18] = pop_vlan
806
807class push_mpls(action_id):
808 type = 19
809
810 def __init__(self):
811 return
812
813 def pack(self):
814 packed = []
815 packed.append(struct.pack("!H", self.type))
816 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
Rich Lane7dcdf022013-12-11 14:45:27 -0800817 length = sum([len(x) for x in packed])
818 packed[1] = struct.pack("!H", length)
819 return ''.join(packed)
820
821 @staticmethod
822 def unpack(reader):
823 obj = push_mpls()
824 _type = reader.read("!H")[0]
825 assert(_type == 19)
826 _len = reader.read("!H")[0]
827 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800828 reader = orig_reader.slice(_len, 4)
Rich Lane7dcdf022013-12-11 14:45:27 -0800829 return obj
830
831 def __eq__(self, other):
832 if type(self) != type(other): return False
833 return True
834
835 def pretty_print(self, q):
836 q.text("push_mpls {")
837 with q.group():
838 with q.indent(2):
839 q.breakable()
840 q.breakable()
841 q.text('}')
842
843action_id.subtypes[19] = push_mpls
844
845class push_pbb(action_id):
846 type = 26
847
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
Rich Lane7dcdf022013-12-11 14:45:27 -0800855 length = sum([len(x) for x in packed])
856 packed[1] = struct.pack("!H", length)
857 return ''.join(packed)
858
859 @staticmethod
860 def unpack(reader):
861 obj = push_pbb()
862 _type = reader.read("!H")[0]
863 assert(_type == 26)
864 _len = reader.read("!H")[0]
865 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800866 reader = orig_reader.slice(_len, 4)
Rich Lane7dcdf022013-12-11 14:45:27 -0800867 return obj
868
869 def __eq__(self, other):
870 if type(self) != type(other): return False
871 return True
872
873 def pretty_print(self, q):
874 q.text("push_pbb {")
875 with q.group():
876 with q.indent(2):
877 q.breakable()
878 q.breakable()
879 q.text('}')
880
881action_id.subtypes[26] = push_pbb
882
883class push_vlan(action_id):
884 type = 17
885
886 def __init__(self):
887 return
888
889 def pack(self):
890 packed = []
891 packed.append(struct.pack("!H", self.type))
892 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
Rich Lane7dcdf022013-12-11 14:45:27 -0800893 length = sum([len(x) for x in packed])
894 packed[1] = struct.pack("!H", length)
895 return ''.join(packed)
896
897 @staticmethod
898 def unpack(reader):
899 obj = push_vlan()
900 _type = reader.read("!H")[0]
901 assert(_type == 17)
902 _len = reader.read("!H")[0]
903 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800904 reader = orig_reader.slice(_len, 4)
Rich Lane7dcdf022013-12-11 14:45:27 -0800905 return obj
906
907 def __eq__(self, other):
908 if type(self) != type(other): return False
909 return True
910
911 def pretty_print(self, q):
912 q.text("push_vlan {")
913 with q.group():
914 with q.indent(2):
915 q.breakable()
916 q.breakable()
917 q.text('}')
918
919action_id.subtypes[17] = push_vlan
920
921class set_field(action_id):
922 type = 25
923
924 def __init__(self):
925 return
926
927 def pack(self):
928 packed = []
929 packed.append(struct.pack("!H", self.type))
930 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
931 length = sum([len(x) for x in packed])
932 packed[1] = struct.pack("!H", length)
933 return ''.join(packed)
934
935 @staticmethod
936 def unpack(reader):
937 obj = set_field()
938 _type = reader.read("!H")[0]
939 assert(_type == 25)
940 _len = reader.read("!H")[0]
941 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800942 reader = orig_reader.slice(_len, 4)
Rich Lane7dcdf022013-12-11 14:45:27 -0800943 return obj
944
945 def __eq__(self, other):
946 if type(self) != type(other): return False
947 return True
948
949 def pretty_print(self, q):
950 q.text("set_field {")
951 with q.group():
952 with q.indent(2):
953 q.breakable()
954 q.breakable()
955 q.text('}')
956
957action_id.subtypes[25] = set_field
958
959class set_mpls_ttl(action_id):
960 type = 15
961
962 def __init__(self):
963 return
964
965 def pack(self):
966 packed = []
967 packed.append(struct.pack("!H", self.type))
968 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
Rich Lane7dcdf022013-12-11 14:45:27 -0800969 length = sum([len(x) for x in packed])
970 packed[1] = struct.pack("!H", length)
971 return ''.join(packed)
972
973 @staticmethod
974 def unpack(reader):
975 obj = set_mpls_ttl()
976 _type = reader.read("!H")[0]
977 assert(_type == 15)
978 _len = reader.read("!H")[0]
979 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800980 reader = orig_reader.slice(_len, 4)
Rich Lane7dcdf022013-12-11 14:45:27 -0800981 return obj
982
983 def __eq__(self, other):
984 if type(self) != type(other): return False
985 return True
986
987 def pretty_print(self, q):
988 q.text("set_mpls_ttl {")
989 with q.group():
990 with q.indent(2):
991 q.breakable()
992 q.breakable()
993 q.text('}')
994
995action_id.subtypes[15] = set_mpls_ttl
996
997class set_nw_ttl(action_id):
998 type = 23
999
1000 def __init__(self):
1001 return
1002
1003 def pack(self):
1004 packed = []
1005 packed.append(struct.pack("!H", self.type))
1006 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
Rich Lane7dcdf022013-12-11 14:45:27 -08001007 length = sum([len(x) for x in packed])
1008 packed[1] = struct.pack("!H", length)
1009 return ''.join(packed)
1010
1011 @staticmethod
1012 def unpack(reader):
1013 obj = set_nw_ttl()
1014 _type = reader.read("!H")[0]
1015 assert(_type == 23)
1016 _len = reader.read("!H")[0]
1017 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001018 reader = orig_reader.slice(_len, 4)
Rich Lane7dcdf022013-12-11 14:45:27 -08001019 return obj
1020
1021 def __eq__(self, other):
1022 if type(self) != type(other): return False
1023 return True
1024
1025 def pretty_print(self, q):
1026 q.text("set_nw_ttl {")
1027 with q.group():
1028 with q.indent(2):
1029 q.breakable()
1030 q.breakable()
1031 q.text('}')
1032
1033action_id.subtypes[23] = set_nw_ttl
1034
1035class set_queue(action_id):
1036 type = 21
1037
1038 def __init__(self):
1039 return
1040
1041 def pack(self):
1042 packed = []
1043 packed.append(struct.pack("!H", self.type))
1044 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
1045 length = sum([len(x) for x in packed])
1046 packed[1] = struct.pack("!H", length)
1047 return ''.join(packed)
1048
1049 @staticmethod
1050 def unpack(reader):
1051 obj = set_queue()
1052 _type = reader.read("!H")[0]
1053 assert(_type == 21)
1054 _len = reader.read("!H")[0]
1055 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001056 reader = orig_reader.slice(_len, 4)
Rich Lane7dcdf022013-12-11 14:45:27 -08001057 return obj
1058
1059 def __eq__(self, other):
1060 if type(self) != type(other): return False
1061 return True
1062
1063 def pretty_print(self, q):
1064 q.text("set_queue {")
1065 with q.group():
1066 with q.indent(2):
1067 q.breakable()
1068 q.breakable()
1069 q.text('}')
1070
1071action_id.subtypes[21] = set_queue
1072
1073