blob: aebe510009bc8d9f3df2728745f3563d4f666865 [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
193class bsn_mirror(bsn):
Dan Talaycof6202252013-07-02 01:00:29 -0700194 type = 65535
195 experimenter = 6035143
Rich Lanec2ee4b82013-04-24 17:12:38 -0700196 subtype = 1
197
198 def __init__(self, dest_port=None, vlan_tag=None, copy_stage=None):
199 if dest_port != None:
200 self.dest_port = dest_port
201 else:
202 self.dest_port = 0
203 if vlan_tag != None:
204 self.vlan_tag = vlan_tag
205 else:
206 self.vlan_tag = 0
207 if copy_stage != None:
208 self.copy_stage = copy_stage
209 else:
210 self.copy_stage = 0
211 return
212
213 def pack(self):
214 packed = []
215 packed.append(struct.pack("!H", self.type))
216 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
217 packed.append(struct.pack("!L", self.experimenter))
218 packed.append(struct.pack("!L", self.subtype))
219 packed.append(struct.pack("!L", self.dest_port))
220 packed.append(struct.pack("!L", self.vlan_tag))
221 packed.append(struct.pack("!B", self.copy_stage))
222 packed.append('\x00' * 3)
223 length = sum([len(x) for x in packed])
224 packed[1] = struct.pack("!H", length)
225 return ''.join(packed)
226
227 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800228 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700229 obj = bsn_mirror()
Dan Talaycof6202252013-07-02 01:00:29 -0700230 _type = reader.read("!H")[0]
231 assert(_type == 65535)
232 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800233 orig_reader = reader
234 reader = orig_reader.slice(_len - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700235 _experimenter = reader.read("!L")[0]
236 assert(_experimenter == 6035143)
237 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700238 assert(_subtype == 1)
Dan Talaycof6202252013-07-02 01:00:29 -0700239 obj.dest_port = reader.read("!L")[0]
240 obj.vlan_tag = reader.read("!L")[0]
241 obj.copy_stage = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700242 reader.skip(3)
243 return obj
244
245 def __eq__(self, other):
246 if type(self) != type(other): return False
247 if self.dest_port != other.dest_port: return False
248 if self.vlan_tag != other.vlan_tag: return False
249 if self.copy_stage != other.copy_stage: return False
250 return True
251
Rich Lanec2ee4b82013-04-24 17:12:38 -0700252 def pretty_print(self, q):
253 q.text("bsn_mirror {")
254 with q.group():
255 with q.indent(2):
256 q.breakable()
257 q.text("dest_port = ");
258 q.text("%#x" % self.dest_port)
259 q.text(","); q.breakable()
260 q.text("vlan_tag = ");
261 q.text("%#x" % self.vlan_tag)
262 q.text(","); q.breakable()
263 q.text("copy_stage = ");
264 q.text("%#x" % self.copy_stage)
265 q.breakable()
266 q.text('}')
267
Rich Lane7dcdf022013-12-11 14:45:27 -0800268bsn.subtypes[1] = bsn_mirror
269
270class bsn_set_tunnel_dst(bsn):
Dan Talaycof6202252013-07-02 01:00:29 -0700271 type = 65535
272 experimenter = 6035143
Rich Lanec2ee4b82013-04-24 17:12:38 -0700273 subtype = 2
274
275 def __init__(self, dst=None):
276 if dst != None:
277 self.dst = dst
278 else:
279 self.dst = 0
280 return
281
282 def pack(self):
283 packed = []
284 packed.append(struct.pack("!H", self.type))
285 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
286 packed.append(struct.pack("!L", self.experimenter))
287 packed.append(struct.pack("!L", self.subtype))
288 packed.append(struct.pack("!L", self.dst))
289 length = sum([len(x) for x in packed])
290 packed[1] = struct.pack("!H", length)
291 return ''.join(packed)
292
293 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800294 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700295 obj = bsn_set_tunnel_dst()
Dan Talaycof6202252013-07-02 01:00:29 -0700296 _type = reader.read("!H")[0]
297 assert(_type == 65535)
298 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800299 orig_reader = reader
300 reader = orig_reader.slice(_len - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700301 _experimenter = reader.read("!L")[0]
302 assert(_experimenter == 6035143)
303 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700304 assert(_subtype == 2)
Dan Talaycof6202252013-07-02 01:00:29 -0700305 obj.dst = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700306 return obj
307
308 def __eq__(self, other):
309 if type(self) != type(other): return False
310 if self.dst != other.dst: return False
311 return True
312
Rich Lanec2ee4b82013-04-24 17:12:38 -0700313 def pretty_print(self, q):
314 q.text("bsn_set_tunnel_dst {")
315 with q.group():
316 with q.indent(2):
317 q.breakable()
318 q.text("dst = ");
319 q.text("%#x" % self.dst)
320 q.breakable()
321 q.text('}')
322
Rich Lane7dcdf022013-12-11 14:45:27 -0800323bsn.subtypes[2] = bsn_set_tunnel_dst
324
325class copy_ttl_in(action):
Dan Talaycof6202252013-07-02 01:00:29 -0700326 type = 12
Rich Lanec2ee4b82013-04-24 17:12:38 -0700327
328 def __init__(self):
329 return
330
331 def pack(self):
332 packed = []
333 packed.append(struct.pack("!H", self.type))
334 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
335 packed.append('\x00' * 4)
336 length = sum([len(x) for x in packed])
337 packed[1] = struct.pack("!H", length)
338 return ''.join(packed)
339
340 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800341 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700342 obj = copy_ttl_in()
Dan Talaycof6202252013-07-02 01:00:29 -0700343 _type = reader.read("!H")[0]
344 assert(_type == 12)
345 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800346 orig_reader = reader
347 reader = orig_reader.slice(_len - (2 + 2))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700348 reader.skip(4)
349 return obj
350
351 def __eq__(self, other):
352 if type(self) != type(other): return False
353 return True
354
Rich Lanec2ee4b82013-04-24 17:12:38 -0700355 def pretty_print(self, q):
356 q.text("copy_ttl_in {")
357 with q.group():
358 with q.indent(2):
359 q.breakable()
360 q.breakable()
361 q.text('}')
362
Rich Lane7dcdf022013-12-11 14:45:27 -0800363action.subtypes[12] = copy_ttl_in
364
365class copy_ttl_out(action):
Dan Talaycof6202252013-07-02 01:00:29 -0700366 type = 11
Rich Lanec2ee4b82013-04-24 17:12:38 -0700367
368 def __init__(self):
369 return
370
371 def pack(self):
372 packed = []
373 packed.append(struct.pack("!H", self.type))
374 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
375 packed.append('\x00' * 4)
376 length = sum([len(x) for x in packed])
377 packed[1] = struct.pack("!H", length)
378 return ''.join(packed)
379
380 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800381 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700382 obj = copy_ttl_out()
Dan Talaycof6202252013-07-02 01:00:29 -0700383 _type = reader.read("!H")[0]
384 assert(_type == 11)
385 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800386 orig_reader = reader
387 reader = orig_reader.slice(_len - (2 + 2))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700388 reader.skip(4)
389 return obj
390
391 def __eq__(self, other):
392 if type(self) != type(other): return False
393 return True
394
Rich Lanec2ee4b82013-04-24 17:12:38 -0700395 def pretty_print(self, q):
396 q.text("copy_ttl_out {")
397 with q.group():
398 with q.indent(2):
399 q.breakable()
400 q.breakable()
401 q.text('}')
402
Rich Lane7dcdf022013-12-11 14:45:27 -0800403action.subtypes[11] = copy_ttl_out
404
405class dec_mpls_ttl(action):
Dan Talaycof6202252013-07-02 01:00:29 -0700406 type = 16
Rich Lanec2ee4b82013-04-24 17:12:38 -0700407
408 def __init__(self):
409 return
410
411 def pack(self):
412 packed = []
413 packed.append(struct.pack("!H", self.type))
414 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
415 packed.append('\x00' * 4)
416 length = sum([len(x) for x in packed])
417 packed[1] = struct.pack("!H", length)
418 return ''.join(packed)
419
420 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800421 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700422 obj = dec_mpls_ttl()
Dan Talaycof6202252013-07-02 01:00:29 -0700423 _type = reader.read("!H")[0]
424 assert(_type == 16)
425 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800426 orig_reader = reader
427 reader = orig_reader.slice(_len - (2 + 2))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700428 reader.skip(4)
429 return obj
430
431 def __eq__(self, other):
432 if type(self) != type(other): return False
433 return True
434
Rich Lanec2ee4b82013-04-24 17:12:38 -0700435 def pretty_print(self, q):
436 q.text("dec_mpls_ttl {")
437 with q.group():
438 with q.indent(2):
439 q.breakable()
440 q.breakable()
441 q.text('}')
442
Rich Lane7dcdf022013-12-11 14:45:27 -0800443action.subtypes[16] = dec_mpls_ttl
444
445class dec_nw_ttl(action):
Dan Talaycof6202252013-07-02 01:00:29 -0700446 type = 24
Rich Lanec2ee4b82013-04-24 17:12:38 -0700447
448 def __init__(self):
449 return
450
451 def pack(self):
452 packed = []
453 packed.append(struct.pack("!H", self.type))
454 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
455 packed.append('\x00' * 4)
456 length = sum([len(x) for x in packed])
457 packed[1] = struct.pack("!H", length)
458 return ''.join(packed)
459
460 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800461 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700462 obj = dec_nw_ttl()
Dan Talaycof6202252013-07-02 01:00:29 -0700463 _type = reader.read("!H")[0]
464 assert(_type == 24)
465 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800466 orig_reader = reader
467 reader = orig_reader.slice(_len - (2 + 2))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700468 reader.skip(4)
469 return obj
470
471 def __eq__(self, other):
472 if type(self) != type(other): return False
473 return True
474
Rich Lanec2ee4b82013-04-24 17:12:38 -0700475 def pretty_print(self, q):
476 q.text("dec_nw_ttl {")
477 with q.group():
478 with q.indent(2):
479 q.breakable()
480 q.breakable()
481 q.text('}')
482
Rich Lane7dcdf022013-12-11 14:45:27 -0800483action.subtypes[24] = dec_nw_ttl
484
485class group(action):
Dan Talaycof6202252013-07-02 01:00:29 -0700486 type = 22
Rich Lanec2ee4b82013-04-24 17:12:38 -0700487
488 def __init__(self, group_id=None):
489 if group_id != None:
490 self.group_id = group_id
491 else:
492 self.group_id = 0
493 return
494
495 def pack(self):
496 packed = []
497 packed.append(struct.pack("!H", self.type))
498 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
499 packed.append(struct.pack("!L", self.group_id))
500 length = sum([len(x) for x in packed])
501 packed[1] = struct.pack("!H", length)
502 return ''.join(packed)
503
504 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800505 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700506 obj = group()
Dan Talaycof6202252013-07-02 01:00:29 -0700507 _type = reader.read("!H")[0]
508 assert(_type == 22)
509 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800510 orig_reader = reader
511 reader = orig_reader.slice(_len - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700512 obj.group_id = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700513 return obj
514
515 def __eq__(self, other):
516 if type(self) != type(other): return False
517 if self.group_id != other.group_id: return False
518 return True
519
Rich Lanec2ee4b82013-04-24 17:12:38 -0700520 def pretty_print(self, q):
521 q.text("group {")
522 with q.group():
523 with q.indent(2):
524 q.breakable()
525 q.text("group_id = ");
526 q.text("%#x" % self.group_id)
527 q.breakable()
528 q.text('}')
529
Rich Lane7dcdf022013-12-11 14:45:27 -0800530action.subtypes[22] = group
531
532class nicira(experimenter):
533 subtypes = {}
534
Rich Lane95f7fc92014-01-27 17:08:16 -0800535 type = 65535
536 experimenter = 8992
537
538 def __init__(self, subtype=None):
539 if subtype != None:
540 self.subtype = subtype
541 else:
542 self.subtype = 0
543 return
544
545 def pack(self):
546 packed = []
547 packed.append(struct.pack("!H", self.type))
548 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
549 packed.append(struct.pack("!L", self.experimenter))
550 packed.append(struct.pack("!H", self.subtype))
551 packed.append('\x00' * 2)
552 packed.append('\x00' * 4)
553 length = sum([len(x) for x in packed])
554 packed[1] = struct.pack("!H", length)
555 return ''.join(packed)
556
Rich Lane7dcdf022013-12-11 14:45:27 -0800557 @staticmethod
558 def unpack(reader):
559 subtype, = reader.peek('!H', 8)
Rich Lane95f7fc92014-01-27 17:08:16 -0800560 subclass = nicira.subtypes.get(subtype)
561 if subclass:
562 return subclass.unpack(reader)
563
564 obj = nicira()
565 _type = reader.read("!H")[0]
566 assert(_type == 65535)
567 _len = reader.read("!H")[0]
568 orig_reader = reader
569 reader = orig_reader.slice(_len - (2 + 2))
570 _experimenter = reader.read("!L")[0]
571 assert(_experimenter == 8992)
572 obj.subtype = reader.read("!H")[0]
573 reader.skip(2)
574 reader.skip(4)
575 return obj
576
577 def __eq__(self, other):
578 if type(self) != type(other): return False
579 if self.subtype != other.subtype: return False
580 return True
581
582 def pretty_print(self, q):
583 q.text("nicira {")
584 with q.group():
585 with q.indent(2):
586 q.breakable()
587 q.breakable()
588 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -0800589
590experimenter.subtypes[8992] = nicira
591
592class nicira_dec_ttl(nicira):
Dan Talaycof6202252013-07-02 01:00:29 -0700593 type = 65535
594 experimenter = 8992
Rich Lanec2ee4b82013-04-24 17:12:38 -0700595 subtype = 18
596
597 def __init__(self):
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
612 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800613 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700614 obj = nicira_dec_ttl()
Dan Talaycof6202252013-07-02 01:00:29 -0700615 _type = reader.read("!H")[0]
616 assert(_type == 65535)
617 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800618 orig_reader = reader
619 reader = orig_reader.slice(_len - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700620 _experimenter = reader.read("!L")[0]
621 assert(_experimenter == 8992)
622 _subtype = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700623 assert(_subtype == 18)
624 reader.skip(2)
625 reader.skip(4)
626 return obj
627
628 def __eq__(self, other):
629 if type(self) != type(other): return False
630 return True
631
Rich Lanec2ee4b82013-04-24 17:12:38 -0700632 def pretty_print(self, q):
633 q.text("nicira_dec_ttl {")
634 with q.group():
635 with q.indent(2):
636 q.breakable()
637 q.breakable()
638 q.text('}')
639
Rich Lane7dcdf022013-12-11 14:45:27 -0800640nicira.subtypes[18] = nicira_dec_ttl
641
642class output(action):
Dan Talaycof6202252013-07-02 01:00:29 -0700643 type = 0
Rich Lanec2ee4b82013-04-24 17:12:38 -0700644
645 def __init__(self, port=None, max_len=None):
646 if port != None:
647 self.port = port
648 else:
649 self.port = 0
650 if max_len != None:
651 self.max_len = max_len
652 else:
653 self.max_len = 0
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
Dan Talaycof6202252013-07-02 01:00:29 -0700660 packed.append(util.pack_port_no(self.port))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700661 packed.append(struct.pack("!H", self.max_len))
662 packed.append('\x00' * 6)
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 = output()
Dan Talaycof6202252013-07-02 01:00:29 -0700670 _type = reader.read("!H")[0]
671 assert(_type == 0)
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 obj.port = util.unpack_port_no(reader)
676 obj.max_len = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700677 reader.skip(6)
678 return obj
679
680 def __eq__(self, other):
681 if type(self) != type(other): return False
682 if self.port != other.port: return False
683 if self.max_len != other.max_len: return False
684 return True
685
Rich Lanec2ee4b82013-04-24 17:12:38 -0700686 def pretty_print(self, q):
687 q.text("output {")
688 with q.group():
689 with q.indent(2):
690 q.breakable()
691 q.text("port = ");
692 q.text(util.pretty_port(self.port))
693 q.text(","); q.breakable()
694 q.text("max_len = ");
695 q.text("%#x" % self.max_len)
696 q.breakable()
697 q.text('}')
698
Rich Lane7dcdf022013-12-11 14:45:27 -0800699action.subtypes[0] = output
700
701class pop_mpls(action):
Dan Talaycof6202252013-07-02 01:00:29 -0700702 type = 20
Rich Lanec2ee4b82013-04-24 17:12:38 -0700703
704 def __init__(self, ethertype=None):
705 if ethertype != None:
706 self.ethertype = ethertype
707 else:
708 self.ethertype = 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
715 packed.append(struct.pack("!H", self.ethertype))
716 packed.append('\x00' * 2)
717 length = sum([len(x) for x in packed])
718 packed[1] = struct.pack("!H", length)
719 return ''.join(packed)
720
721 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800722 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700723 obj = pop_mpls()
Dan Talaycof6202252013-07-02 01:00:29 -0700724 _type = reader.read("!H")[0]
725 assert(_type == 20)
726 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800727 orig_reader = reader
728 reader = orig_reader.slice(_len - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700729 obj.ethertype = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700730 reader.skip(2)
731 return obj
732
733 def __eq__(self, other):
734 if type(self) != type(other): return False
735 if self.ethertype != other.ethertype: return False
736 return True
737
Rich Lanec2ee4b82013-04-24 17:12:38 -0700738 def pretty_print(self, q):
739 q.text("pop_mpls {")
740 with q.group():
741 with q.indent(2):
742 q.breakable()
743 q.text("ethertype = ");
744 q.text("%#x" % self.ethertype)
745 q.breakable()
746 q.text('}')
747
Rich Lane7dcdf022013-12-11 14:45:27 -0800748action.subtypes[20] = pop_mpls
749
750class pop_pbb(action):
Dan Talaycof6202252013-07-02 01:00:29 -0700751 type = 27
Rich Lanec2ee4b82013-04-24 17:12:38 -0700752
753 def __init__(self):
754 return
755
756 def pack(self):
757 packed = []
758 packed.append(struct.pack("!H", self.type))
759 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
760 packed.append('\x00' * 4)
761 length = sum([len(x) for x in packed])
762 packed[1] = struct.pack("!H", length)
763 return ''.join(packed)
764
765 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800766 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700767 obj = pop_pbb()
Dan Talaycof6202252013-07-02 01:00:29 -0700768 _type = reader.read("!H")[0]
769 assert(_type == 27)
770 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800771 orig_reader = reader
772 reader = orig_reader.slice(_len - (2 + 2))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700773 reader.skip(4)
774 return obj
775
776 def __eq__(self, other):
777 if type(self) != type(other): return False
778 return True
779
Rich Lanec2ee4b82013-04-24 17:12:38 -0700780 def pretty_print(self, q):
781 q.text("pop_pbb {")
782 with q.group():
783 with q.indent(2):
784 q.breakable()
785 q.breakable()
786 q.text('}')
787
Rich Lane7dcdf022013-12-11 14:45:27 -0800788action.subtypes[27] = pop_pbb
789
790class pop_vlan(action):
Dan Talaycof6202252013-07-02 01:00:29 -0700791 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -0700792
793 def __init__(self):
794 return
795
796 def pack(self):
797 packed = []
798 packed.append(struct.pack("!H", self.type))
799 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
800 packed.append('\x00' * 4)
801 length = sum([len(x) for x in packed])
802 packed[1] = struct.pack("!H", length)
803 return ''.join(packed)
804
805 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800806 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700807 obj = pop_vlan()
Dan Talaycof6202252013-07-02 01:00:29 -0700808 _type = reader.read("!H")[0]
809 assert(_type == 18)
810 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800811 orig_reader = reader
812 reader = orig_reader.slice(_len - (2 + 2))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700813 reader.skip(4)
814 return obj
815
816 def __eq__(self, other):
817 if type(self) != type(other): return False
818 return True
819
Rich Lanec2ee4b82013-04-24 17:12:38 -0700820 def pretty_print(self, q):
821 q.text("pop_vlan {")
822 with q.group():
823 with q.indent(2):
824 q.breakable()
825 q.breakable()
826 q.text('}')
827
Rich Lane7dcdf022013-12-11 14:45:27 -0800828action.subtypes[18] = pop_vlan
829
830class push_mpls(action):
Dan Talaycof6202252013-07-02 01:00:29 -0700831 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -0700832
833 def __init__(self, ethertype=None):
834 if ethertype != None:
835 self.ethertype = ethertype
836 else:
837 self.ethertype = 0
838 return
839
840 def pack(self):
841 packed = []
842 packed.append(struct.pack("!H", self.type))
843 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
844 packed.append(struct.pack("!H", self.ethertype))
845 packed.append('\x00' * 2)
846 length = sum([len(x) for x in packed])
847 packed[1] = struct.pack("!H", length)
848 return ''.join(packed)
849
850 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800851 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700852 obj = push_mpls()
Dan Talaycof6202252013-07-02 01:00:29 -0700853 _type = reader.read("!H")[0]
854 assert(_type == 19)
855 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800856 orig_reader = reader
857 reader = orig_reader.slice(_len - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700858 obj.ethertype = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700859 reader.skip(2)
860 return obj
861
862 def __eq__(self, other):
863 if type(self) != type(other): return False
864 if self.ethertype != other.ethertype: return False
865 return True
866
Rich Lanec2ee4b82013-04-24 17:12:38 -0700867 def pretty_print(self, q):
868 q.text("push_mpls {")
869 with q.group():
870 with q.indent(2):
871 q.breakable()
872 q.text("ethertype = ");
873 q.text("%#x" % self.ethertype)
874 q.breakable()
875 q.text('}')
876
Rich Lane7dcdf022013-12-11 14:45:27 -0800877action.subtypes[19] = push_mpls
878
879class push_pbb(action):
Dan Talaycof6202252013-07-02 01:00:29 -0700880 type = 26
Rich Lanec2ee4b82013-04-24 17:12:38 -0700881
882 def __init__(self, ethertype=None):
883 if ethertype != None:
884 self.ethertype = ethertype
885 else:
886 self.ethertype = 0
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
893 packed.append(struct.pack("!H", self.ethertype))
894 packed.append('\x00' * 2)
895 length = sum([len(x) for x in packed])
896 packed[1] = struct.pack("!H", length)
897 return ''.join(packed)
898
899 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800900 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700901 obj = push_pbb()
Dan Talaycof6202252013-07-02 01:00:29 -0700902 _type = reader.read("!H")[0]
903 assert(_type == 26)
904 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800905 orig_reader = reader
906 reader = orig_reader.slice(_len - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700907 obj.ethertype = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700908 reader.skip(2)
909 return obj
910
911 def __eq__(self, other):
912 if type(self) != type(other): return False
913 if self.ethertype != other.ethertype: return False
914 return True
915
Rich Lanec2ee4b82013-04-24 17:12:38 -0700916 def pretty_print(self, q):
917 q.text("push_pbb {")
918 with q.group():
919 with q.indent(2):
920 q.breakable()
921 q.text("ethertype = ");
922 q.text("%#x" % self.ethertype)
923 q.breakable()
924 q.text('}')
925
Rich Lane7dcdf022013-12-11 14:45:27 -0800926action.subtypes[26] = push_pbb
927
928class push_vlan(action):
Dan Talaycof6202252013-07-02 01:00:29 -0700929 type = 17
Rich Lanec2ee4b82013-04-24 17:12:38 -0700930
931 def __init__(self, ethertype=None):
932 if ethertype != None:
933 self.ethertype = ethertype
934 else:
935 self.ethertype = 0
936 return
937
938 def pack(self):
939 packed = []
940 packed.append(struct.pack("!H", self.type))
941 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
942 packed.append(struct.pack("!H", self.ethertype))
943 packed.append('\x00' * 2)
944 length = sum([len(x) for x in packed])
945 packed[1] = struct.pack("!H", length)
946 return ''.join(packed)
947
948 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800949 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700950 obj = push_vlan()
Dan Talaycof6202252013-07-02 01:00:29 -0700951 _type = reader.read("!H")[0]
952 assert(_type == 17)
953 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800954 orig_reader = reader
955 reader = orig_reader.slice(_len - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700956 obj.ethertype = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700957 reader.skip(2)
958 return obj
959
960 def __eq__(self, other):
961 if type(self) != type(other): return False
962 if self.ethertype != other.ethertype: return False
963 return True
964
Rich Lanec2ee4b82013-04-24 17:12:38 -0700965 def pretty_print(self, q):
966 q.text("push_vlan {")
967 with q.group():
968 with q.indent(2):
969 q.breakable()
970 q.text("ethertype = ");
971 q.text("%#x" % self.ethertype)
972 q.breakable()
973 q.text('}')
974
Rich Lane7dcdf022013-12-11 14:45:27 -0800975action.subtypes[17] = push_vlan
976
977class set_field(action):
Dan Talaycof6202252013-07-02 01:00:29 -0700978 type = 25
Rich Lanec2ee4b82013-04-24 17:12:38 -0700979
980 def __init__(self, field=None):
981 if field != None:
982 self.field = field
983 else:
Rich Laned53156a2013-08-05 17:17:33 -0700984 self.field = None
Rich Lanec2ee4b82013-04-24 17:12:38 -0700985 return
986
987 def pack(self):
988 packed = []
989 packed.append(struct.pack("!H", self.type))
990 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
Rich Laned53156a2013-08-05 17:17:33 -0700991 packed.append(self.field.pack())
Rich Lanec2ee4b82013-04-24 17:12:38 -0700992 length = sum([len(x) for x in packed])
Rich Laned53156a2013-08-05 17:17:33 -0700993 packed.append(loxi.generic_util.pad_to(8, length))
994 length += len(packed[-1])
Rich Lanec2ee4b82013-04-24 17:12:38 -0700995 packed[1] = struct.pack("!H", length)
996 return ''.join(packed)
997
998 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800999 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001000 obj = set_field()
Dan Talaycof6202252013-07-02 01:00:29 -07001001 _type = reader.read("!H")[0]
1002 assert(_type == 25)
1003 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001004 orig_reader = reader
1005 reader = orig_reader.slice(_len - (2 + 2))
1006 obj.field = oxm.oxm.unpack(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -07001007 return obj
1008
1009 def __eq__(self, other):
1010 if type(self) != type(other): return False
1011 if self.field != other.field: return False
1012 return True
1013
Rich Lanec2ee4b82013-04-24 17:12:38 -07001014 def pretty_print(self, q):
1015 q.text("set_field {")
1016 with q.group():
1017 with q.indent(2):
1018 q.breakable()
1019 q.text("field = ");
1020 q.pp(self.field)
1021 q.breakable()
1022 q.text('}')
1023
Rich Lane7dcdf022013-12-11 14:45:27 -08001024action.subtypes[25] = set_field
1025
1026class set_mpls_ttl(action):
Dan Talaycof6202252013-07-02 01:00:29 -07001027 type = 15
Rich Lanec2ee4b82013-04-24 17:12:38 -07001028
1029 def __init__(self, mpls_ttl=None):
1030 if mpls_ttl != None:
1031 self.mpls_ttl = mpls_ttl
1032 else:
1033 self.mpls_ttl = 0
1034 return
1035
1036 def pack(self):
1037 packed = []
1038 packed.append(struct.pack("!H", self.type))
1039 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
1040 packed.append(struct.pack("!B", self.mpls_ttl))
1041 packed.append('\x00' * 3)
1042 length = sum([len(x) for x in packed])
1043 packed[1] = struct.pack("!H", length)
1044 return ''.join(packed)
1045
1046 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001047 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001048 obj = set_mpls_ttl()
Dan Talaycof6202252013-07-02 01:00:29 -07001049 _type = reader.read("!H")[0]
1050 assert(_type == 15)
1051 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001052 orig_reader = reader
1053 reader = orig_reader.slice(_len - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001054 obj.mpls_ttl = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001055 reader.skip(3)
1056 return obj
1057
1058 def __eq__(self, other):
1059 if type(self) != type(other): return False
1060 if self.mpls_ttl != other.mpls_ttl: return False
1061 return True
1062
Rich Lanec2ee4b82013-04-24 17:12:38 -07001063 def pretty_print(self, q):
1064 q.text("set_mpls_ttl {")
1065 with q.group():
1066 with q.indent(2):
1067 q.breakable()
1068 q.text("mpls_ttl = ");
1069 q.text("%#x" % self.mpls_ttl)
1070 q.breakable()
1071 q.text('}')
1072
Rich Lane7dcdf022013-12-11 14:45:27 -08001073action.subtypes[15] = set_mpls_ttl
1074
1075class set_nw_ttl(action):
Dan Talaycof6202252013-07-02 01:00:29 -07001076 type = 23
Rich Lanec2ee4b82013-04-24 17:12:38 -07001077
1078 def __init__(self, nw_ttl=None):
1079 if nw_ttl != None:
1080 self.nw_ttl = nw_ttl
1081 else:
1082 self.nw_ttl = 0
1083 return
1084
1085 def pack(self):
1086 packed = []
1087 packed.append(struct.pack("!H", self.type))
1088 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
1089 packed.append(struct.pack("!B", self.nw_ttl))
1090 packed.append('\x00' * 3)
1091 length = sum([len(x) for x in packed])
1092 packed[1] = struct.pack("!H", length)
1093 return ''.join(packed)
1094
1095 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001096 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001097 obj = set_nw_ttl()
Dan Talaycof6202252013-07-02 01:00:29 -07001098 _type = reader.read("!H")[0]
1099 assert(_type == 23)
1100 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001101 orig_reader = reader
1102 reader = orig_reader.slice(_len - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001103 obj.nw_ttl = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001104 reader.skip(3)
1105 return obj
1106
1107 def __eq__(self, other):
1108 if type(self) != type(other): return False
1109 if self.nw_ttl != other.nw_ttl: return False
1110 return True
1111
Rich Lanec2ee4b82013-04-24 17:12:38 -07001112 def pretty_print(self, q):
1113 q.text("set_nw_ttl {")
1114 with q.group():
1115 with q.indent(2):
1116 q.breakable()
1117 q.text("nw_ttl = ");
1118 q.text("%#x" % self.nw_ttl)
1119 q.breakable()
1120 q.text('}')
1121
Rich Lane7dcdf022013-12-11 14:45:27 -08001122action.subtypes[23] = set_nw_ttl
1123
1124class set_queue(action):
Dan Talaycof6202252013-07-02 01:00:29 -07001125 type = 21
Rich Lanec2ee4b82013-04-24 17:12:38 -07001126
1127 def __init__(self, queue_id=None):
1128 if queue_id != None:
1129 self.queue_id = queue_id
1130 else:
1131 self.queue_id = 0
1132 return
1133
1134 def pack(self):
1135 packed = []
1136 packed.append(struct.pack("!H", self.type))
1137 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
1138 packed.append(struct.pack("!L", self.queue_id))
1139 length = sum([len(x) for x in packed])
1140 packed[1] = struct.pack("!H", length)
1141 return ''.join(packed)
1142
1143 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001144 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001145 obj = set_queue()
Dan Talaycof6202252013-07-02 01:00:29 -07001146 _type = reader.read("!H")[0]
1147 assert(_type == 21)
1148 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001149 orig_reader = reader
1150 reader = orig_reader.slice(_len - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001151 obj.queue_id = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001152 return obj
1153
1154 def __eq__(self, other):
1155 if type(self) != type(other): return False
1156 if self.queue_id != other.queue_id: return False
1157 return True
1158
Rich Lanec2ee4b82013-04-24 17:12:38 -07001159 def pretty_print(self, q):
1160 q.text("set_queue {")
1161 with q.group():
1162 with q.indent(2):
1163 q.breakable()
1164 q.text("queue_id = ");
1165 q.text("%#x" % self.queue_id)
1166 q.breakable()
1167 q.text('}')
1168
Rich Lane7dcdf022013-12-11 14:45:27 -08001169action.subtypes[21] = set_queue
Rich Lanec2ee4b82013-04-24 17:12:38 -07001170
Rich Lanec2ee4b82013-04-24 17:12:38 -07001171