blob: c66427c118d6a010973069adec3be19c8095d9f0 [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
Rich Lanec2ee4b82013-04-24 17:12:38 -070016import util
17import loxi.generic_util
Rich Lanec2ee4b82013-04-24 17:12:38 -070018
Rich Lane7dcdf022013-12-11 14:45:27 -080019class action(loxi.OFObject):
20 subtypes = {}
Rich Lanec2ee4b82013-04-24 17:12:38 -070021
Rich Lane95f7fc92014-01-27 17:08:16 -080022
23 def __init__(self, type=None):
24 if type != None:
25 self.type = type
26 else:
27 self.type = 0
28 return
29
30 def pack(self):
31 packed = []
32 packed.append(struct.pack("!H", self.type))
33 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
34 packed.append('\x00' * 4)
35 length = sum([len(x) for x in packed])
36 packed[1] = struct.pack("!H", length)
37 return ''.join(packed)
38
Rich Lane7dcdf022013-12-11 14:45:27 -080039 @staticmethod
40 def unpack(reader):
41 subtype, = reader.peek('!H', 0)
Rich Lane95f7fc92014-01-27 17:08:16 -080042 subclass = action.subtypes.get(subtype)
43 if subclass:
44 return subclass.unpack(reader)
45
46 obj = action()
47 obj.type = reader.read("!H")[0]
48 _len = reader.read("!H")[0]
49 orig_reader = reader
50 reader = orig_reader.slice(_len - (2 + 2))
51 reader.skip(4)
52 return obj
53
54 def __eq__(self, other):
55 if type(self) != type(other): return False
56 if self.type != other.type: return False
57 return True
58
59 def pretty_print(self, q):
60 q.text("action {")
61 with q.group():
62 with q.indent(2):
63 q.breakable()
64 q.breakable()
65 q.text('}')
Rich Lanec2ee4b82013-04-24 17:12:38 -070066
Rich Lane7dcdf022013-12-11 14:45:27 -080067
68class experimenter(action):
69 subtypes = {}
70
Rich Lane95f7fc92014-01-27 17:08:16 -080071 type = 65535
72
73 def __init__(self, experimenter=None, data=None):
74 if experimenter != None:
75 self.experimenter = experimenter
76 else:
77 self.experimenter = 0
78 if data != None:
79 self.data = data
80 else:
81 self.data = ''
82 return
83
84 def pack(self):
85 packed = []
86 packed.append(struct.pack("!H", self.type))
87 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
88 packed.append(struct.pack("!L", self.experimenter))
89 packed.append(self.data)
90 length = sum([len(x) for x in packed])
91 packed.append(loxi.generic_util.pad_to(8, length))
92 length += len(packed[-1])
93 packed[1] = struct.pack("!H", length)
94 return ''.join(packed)
95
Rich Lane7dcdf022013-12-11 14:45:27 -080096 @staticmethod
97 def unpack(reader):
98 subtype, = reader.peek('!L', 4)
Rich Lane95f7fc92014-01-27 17:08:16 -080099 subclass = experimenter.subtypes.get(subtype)
100 if subclass:
101 return subclass.unpack(reader)
102
103 obj = experimenter()
104 _type = reader.read("!H")[0]
105 assert(_type == 65535)
106 _len = reader.read("!H")[0]
107 orig_reader = reader
108 reader = orig_reader.slice(_len - (2 + 2))
109 obj.experimenter = reader.read("!L")[0]
110 obj.data = str(reader.read_all())
111 return obj
112
113 def __eq__(self, other):
114 if type(self) != type(other): return False
115 if self.experimenter != other.experimenter: return False
116 if self.data != other.data: return False
117 return True
118
119 def pretty_print(self, q):
120 q.text("experimenter {")
121 with q.group():
122 with q.indent(2):
123 q.breakable()
124 q.text("data = ");
125 q.pp(self.data)
126 q.breakable()
127 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -0800128
129action.subtypes[65535] = experimenter
130
131class bsn(experimenter):
132 subtypes = {}
133
Rich Lane95f7fc92014-01-27 17:08:16 -0800134 type = 65535
135 experimenter = 6035143
136
137 def __init__(self, subtype=None):
138 if subtype != None:
139 self.subtype = subtype
140 else:
141 self.subtype = 0
142 return
143
144 def pack(self):
145 packed = []
146 packed.append(struct.pack("!H", self.type))
147 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
148 packed.append(struct.pack("!L", self.experimenter))
149 packed.append(struct.pack("!L", self.subtype))
150 packed.append('\x00' * 4)
151 length = sum([len(x) for x in packed])
152 packed[1] = struct.pack("!H", length)
153 return ''.join(packed)
154
Rich Lane7dcdf022013-12-11 14:45:27 -0800155 @staticmethod
156 def unpack(reader):
157 subtype, = reader.peek('!L', 8)
Rich Lane95f7fc92014-01-27 17:08:16 -0800158 subclass = bsn.subtypes.get(subtype)
159 if subclass:
160 return subclass.unpack(reader)
161
162 obj = bsn()
163 _type = reader.read("!H")[0]
164 assert(_type == 65535)
165 _len = reader.read("!H")[0]
166 orig_reader = reader
167 reader = orig_reader.slice(_len - (2 + 2))
168 _experimenter = reader.read("!L")[0]
169 assert(_experimenter == 6035143)
170 obj.subtype = reader.read("!L")[0]
171 reader.skip(4)
172 return obj
173
174 def __eq__(self, other):
175 if type(self) != type(other): return False
176 if self.subtype != other.subtype: return False
177 return True
178
179 def pretty_print(self, q):
180 q.text("bsn {")
181 with q.group():
182 with q.indent(2):
183 q.breakable()
184 q.breakable()
185 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -0800186
187experimenter.subtypes[6035143] = bsn
188
Rich Lane5587ab12014-06-30 11:19:09 -0700189class bsn_checksum(bsn):
190 type = 65535
191 experimenter = 6035143
192 subtype = 4
193
194 def __init__(self, checksum=None):
195 if checksum != None:
196 self.checksum = checksum
197 else:
198 self.checksum = 0
199 return
200
201 def pack(self):
202 packed = []
203 packed.append(struct.pack("!H", self.type))
204 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
205 packed.append(struct.pack("!L", self.experimenter))
206 packed.append(struct.pack("!L", self.subtype))
207 packed.append(util.pack_checksum_128(self.checksum))
208 length = sum([len(x) for x in packed])
209 packed[1] = struct.pack("!H", length)
210 return ''.join(packed)
211
212 @staticmethod
213 def unpack(reader):
214 obj = bsn_checksum()
215 _type = reader.read("!H")[0]
216 assert(_type == 65535)
217 _len = reader.read("!H")[0]
218 orig_reader = reader
219 reader = orig_reader.slice(_len - (2 + 2))
220 _experimenter = reader.read("!L")[0]
221 assert(_experimenter == 6035143)
222 _subtype = reader.read("!L")[0]
223 assert(_subtype == 4)
224 obj.checksum = util.unpack_checksum_128(reader)
225 return obj
226
227 def __eq__(self, other):
228 if type(self) != type(other): return False
229 if self.checksum != other.checksum: return False
230 return True
231
232 def pretty_print(self, q):
233 q.text("bsn_checksum {")
234 with q.group():
235 with q.indent(2):
236 q.breakable()
237 q.text("checksum = ");
238 q.pp(self.checksum)
239 q.breakable()
240 q.text('}')
241
242bsn.subtypes[4] = bsn_checksum
243
Rich Lane7dcdf022013-12-11 14:45:27 -0800244class bsn_mirror(bsn):
Dan Talaycof6202252013-07-02 01:00:29 -0700245 type = 65535
246 experimenter = 6035143
Rich Lanec2ee4b82013-04-24 17:12:38 -0700247 subtype = 1
248
249 def __init__(self, dest_port=None, vlan_tag=None, copy_stage=None):
250 if dest_port != None:
251 self.dest_port = dest_port
252 else:
253 self.dest_port = 0
254 if vlan_tag != None:
255 self.vlan_tag = vlan_tag
256 else:
257 self.vlan_tag = 0
258 if copy_stage != None:
259 self.copy_stage = copy_stage
260 else:
261 self.copy_stage = 0
262 return
263
264 def pack(self):
265 packed = []
266 packed.append(struct.pack("!H", self.type))
267 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
268 packed.append(struct.pack("!L", self.experimenter))
269 packed.append(struct.pack("!L", self.subtype))
270 packed.append(struct.pack("!L", self.dest_port))
271 packed.append(struct.pack("!L", self.vlan_tag))
272 packed.append(struct.pack("!B", self.copy_stage))
273 packed.append('\x00' * 3)
274 length = sum([len(x) for x in packed])
275 packed[1] = struct.pack("!H", length)
276 return ''.join(packed)
277
278 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800279 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700280 obj = bsn_mirror()
Dan Talaycof6202252013-07-02 01:00:29 -0700281 _type = reader.read("!H")[0]
282 assert(_type == 65535)
283 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800284 orig_reader = reader
285 reader = orig_reader.slice(_len - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700286 _experimenter = reader.read("!L")[0]
287 assert(_experimenter == 6035143)
288 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700289 assert(_subtype == 1)
Dan Talaycof6202252013-07-02 01:00:29 -0700290 obj.dest_port = reader.read("!L")[0]
291 obj.vlan_tag = reader.read("!L")[0]
292 obj.copy_stage = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700293 reader.skip(3)
294 return obj
295
296 def __eq__(self, other):
297 if type(self) != type(other): return False
298 if self.dest_port != other.dest_port: return False
299 if self.vlan_tag != other.vlan_tag: return False
300 if self.copy_stage != other.copy_stage: return False
301 return True
302
Rich Lanec2ee4b82013-04-24 17:12:38 -0700303 def pretty_print(self, q):
304 q.text("bsn_mirror {")
305 with q.group():
306 with q.indent(2):
307 q.breakable()
308 q.text("dest_port = ");
309 q.text("%#x" % self.dest_port)
310 q.text(","); q.breakable()
311 q.text("vlan_tag = ");
312 q.text("%#x" % self.vlan_tag)
313 q.text(","); q.breakable()
314 q.text("copy_stage = ");
315 q.text("%#x" % self.copy_stage)
316 q.breakable()
317 q.text('}')
318
Rich Lane7dcdf022013-12-11 14:45:27 -0800319bsn.subtypes[1] = bsn_mirror
320
321class bsn_set_tunnel_dst(bsn):
Dan Talaycof6202252013-07-02 01:00:29 -0700322 type = 65535
323 experimenter = 6035143
Rich Lanec2ee4b82013-04-24 17:12:38 -0700324 subtype = 2
325
326 def __init__(self, dst=None):
327 if dst != None:
328 self.dst = dst
329 else:
330 self.dst = 0
331 return
332
333 def pack(self):
334 packed = []
335 packed.append(struct.pack("!H", self.type))
336 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
337 packed.append(struct.pack("!L", self.experimenter))
338 packed.append(struct.pack("!L", self.subtype))
339 packed.append(struct.pack("!L", self.dst))
340 length = sum([len(x) for x in packed])
341 packed[1] = struct.pack("!H", length)
342 return ''.join(packed)
343
344 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800345 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700346 obj = bsn_set_tunnel_dst()
Dan Talaycof6202252013-07-02 01:00:29 -0700347 _type = reader.read("!H")[0]
348 assert(_type == 65535)
349 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800350 orig_reader = reader
351 reader = orig_reader.slice(_len - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700352 _experimenter = reader.read("!L")[0]
353 assert(_experimenter == 6035143)
354 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700355 assert(_subtype == 2)
Dan Talaycof6202252013-07-02 01:00:29 -0700356 obj.dst = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700357 return obj
358
359 def __eq__(self, other):
360 if type(self) != type(other): return False
361 if self.dst != other.dst: return False
362 return True
363
Rich Lanec2ee4b82013-04-24 17:12:38 -0700364 def pretty_print(self, q):
365 q.text("bsn_set_tunnel_dst {")
366 with q.group():
367 with q.indent(2):
368 q.breakable()
369 q.text("dst = ");
370 q.text("%#x" % self.dst)
371 q.breakable()
372 q.text('}')
373
Rich Lane7dcdf022013-12-11 14:45:27 -0800374bsn.subtypes[2] = bsn_set_tunnel_dst
375
376class copy_ttl_in(action):
Dan Talaycof6202252013-07-02 01:00:29 -0700377 type = 12
Rich Lanec2ee4b82013-04-24 17:12:38 -0700378
379 def __init__(self):
380 return
381
382 def pack(self):
383 packed = []
384 packed.append(struct.pack("!H", self.type))
385 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
386 packed.append('\x00' * 4)
387 length = sum([len(x) for x in packed])
388 packed[1] = struct.pack("!H", length)
389 return ''.join(packed)
390
391 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800392 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700393 obj = copy_ttl_in()
Dan Talaycof6202252013-07-02 01:00:29 -0700394 _type = reader.read("!H")[0]
395 assert(_type == 12)
396 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800397 orig_reader = reader
398 reader = orig_reader.slice(_len - (2 + 2))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700399 reader.skip(4)
400 return obj
401
402 def __eq__(self, other):
403 if type(self) != type(other): return False
404 return True
405
Rich Lanec2ee4b82013-04-24 17:12:38 -0700406 def pretty_print(self, q):
407 q.text("copy_ttl_in {")
408 with q.group():
409 with q.indent(2):
410 q.breakable()
411 q.breakable()
412 q.text('}')
413
Rich Lane7dcdf022013-12-11 14:45:27 -0800414action.subtypes[12] = copy_ttl_in
415
416class copy_ttl_out(action):
Dan Talaycof6202252013-07-02 01:00:29 -0700417 type = 11
Rich Lanec2ee4b82013-04-24 17:12:38 -0700418
419 def __init__(self):
420 return
421
422 def pack(self):
423 packed = []
424 packed.append(struct.pack("!H", self.type))
425 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
426 packed.append('\x00' * 4)
427 length = sum([len(x) for x in packed])
428 packed[1] = struct.pack("!H", length)
429 return ''.join(packed)
430
431 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800432 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700433 obj = copy_ttl_out()
Dan Talaycof6202252013-07-02 01:00:29 -0700434 _type = reader.read("!H")[0]
435 assert(_type == 11)
436 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800437 orig_reader = reader
438 reader = orig_reader.slice(_len - (2 + 2))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700439 reader.skip(4)
440 return obj
441
442 def __eq__(self, other):
443 if type(self) != type(other): return False
444 return True
445
Rich Lanec2ee4b82013-04-24 17:12:38 -0700446 def pretty_print(self, q):
447 q.text("copy_ttl_out {")
448 with q.group():
449 with q.indent(2):
450 q.breakable()
451 q.breakable()
452 q.text('}')
453
Rich Lane7dcdf022013-12-11 14:45:27 -0800454action.subtypes[11] = copy_ttl_out
455
456class dec_mpls_ttl(action):
Dan Talaycof6202252013-07-02 01:00:29 -0700457 type = 16
Rich Lanec2ee4b82013-04-24 17:12:38 -0700458
459 def __init__(self):
460 return
461
462 def pack(self):
463 packed = []
464 packed.append(struct.pack("!H", self.type))
465 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
466 packed.append('\x00' * 4)
467 length = sum([len(x) for x in packed])
468 packed[1] = struct.pack("!H", length)
469 return ''.join(packed)
470
471 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800472 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700473 obj = dec_mpls_ttl()
Dan Talaycof6202252013-07-02 01:00:29 -0700474 _type = reader.read("!H")[0]
475 assert(_type == 16)
476 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800477 orig_reader = reader
478 reader = orig_reader.slice(_len - (2 + 2))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700479 reader.skip(4)
480 return obj
481
482 def __eq__(self, other):
483 if type(self) != type(other): return False
484 return True
485
Rich Lanec2ee4b82013-04-24 17:12:38 -0700486 def pretty_print(self, q):
487 q.text("dec_mpls_ttl {")
488 with q.group():
489 with q.indent(2):
490 q.breakable()
491 q.breakable()
492 q.text('}')
493
Rich Lane7dcdf022013-12-11 14:45:27 -0800494action.subtypes[16] = dec_mpls_ttl
495
496class dec_nw_ttl(action):
Dan Talaycof6202252013-07-02 01:00:29 -0700497 type = 24
Rich Lanec2ee4b82013-04-24 17:12:38 -0700498
499 def __init__(self):
500 return
501
502 def pack(self):
503 packed = []
504 packed.append(struct.pack("!H", self.type))
505 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
506 packed.append('\x00' * 4)
507 length = sum([len(x) for x in packed])
508 packed[1] = struct.pack("!H", length)
509 return ''.join(packed)
510
511 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800512 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700513 obj = dec_nw_ttl()
Dan Talaycof6202252013-07-02 01:00:29 -0700514 _type = reader.read("!H")[0]
515 assert(_type == 24)
516 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800517 orig_reader = reader
518 reader = orig_reader.slice(_len - (2 + 2))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700519 reader.skip(4)
520 return obj
521
522 def __eq__(self, other):
523 if type(self) != type(other): return False
524 return True
525
Rich Lanec2ee4b82013-04-24 17:12:38 -0700526 def pretty_print(self, q):
527 q.text("dec_nw_ttl {")
528 with q.group():
529 with q.indent(2):
530 q.breakable()
531 q.breakable()
532 q.text('}')
533
Rich Lane7dcdf022013-12-11 14:45:27 -0800534action.subtypes[24] = dec_nw_ttl
535
536class group(action):
Dan Talaycof6202252013-07-02 01:00:29 -0700537 type = 22
Rich Lanec2ee4b82013-04-24 17:12:38 -0700538
539 def __init__(self, group_id=None):
540 if group_id != None:
541 self.group_id = group_id
542 else:
543 self.group_id = 0
544 return
545
546 def pack(self):
547 packed = []
548 packed.append(struct.pack("!H", self.type))
549 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
550 packed.append(struct.pack("!L", self.group_id))
551 length = sum([len(x) for x in packed])
552 packed[1] = struct.pack("!H", length)
553 return ''.join(packed)
554
555 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800556 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700557 obj = group()
Dan Talaycof6202252013-07-02 01:00:29 -0700558 _type = reader.read("!H")[0]
559 assert(_type == 22)
560 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800561 orig_reader = reader
562 reader = orig_reader.slice(_len - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700563 obj.group_id = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700564 return obj
565
566 def __eq__(self, other):
567 if type(self) != type(other): return False
568 if self.group_id != other.group_id: return False
569 return True
570
Rich Lanec2ee4b82013-04-24 17:12:38 -0700571 def pretty_print(self, q):
572 q.text("group {")
573 with q.group():
574 with q.indent(2):
575 q.breakable()
576 q.text("group_id = ");
577 q.text("%#x" % self.group_id)
578 q.breakable()
579 q.text('}')
580
Rich Lane7dcdf022013-12-11 14:45:27 -0800581action.subtypes[22] = group
582
583class nicira(experimenter):
584 subtypes = {}
585
Rich Lane95f7fc92014-01-27 17:08:16 -0800586 type = 65535
587 experimenter = 8992
588
589 def __init__(self, subtype=None):
590 if subtype != None:
591 self.subtype = subtype
592 else:
593 self.subtype = 0
594 return
595
596 def pack(self):
597 packed = []
598 packed.append(struct.pack("!H", self.type))
599 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
600 packed.append(struct.pack("!L", self.experimenter))
601 packed.append(struct.pack("!H", self.subtype))
602 packed.append('\x00' * 2)
603 packed.append('\x00' * 4)
604 length = sum([len(x) for x in packed])
605 packed[1] = struct.pack("!H", length)
606 return ''.join(packed)
607
Rich Lane7dcdf022013-12-11 14:45:27 -0800608 @staticmethod
609 def unpack(reader):
610 subtype, = reader.peek('!H', 8)
Rich Lane95f7fc92014-01-27 17:08:16 -0800611 subclass = nicira.subtypes.get(subtype)
612 if subclass:
613 return subclass.unpack(reader)
614
615 obj = nicira()
616 _type = reader.read("!H")[0]
617 assert(_type == 65535)
618 _len = reader.read("!H")[0]
619 orig_reader = reader
620 reader = orig_reader.slice(_len - (2 + 2))
621 _experimenter = reader.read("!L")[0]
622 assert(_experimenter == 8992)
623 obj.subtype = reader.read("!H")[0]
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 if self.subtype != other.subtype: return False
631 return True
632
633 def pretty_print(self, q):
634 q.text("nicira {")
635 with q.group():
636 with q.indent(2):
637 q.breakable()
638 q.breakable()
639 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -0800640
641experimenter.subtypes[8992] = nicira
642
643class nicira_dec_ttl(nicira):
Dan Talaycof6202252013-07-02 01:00:29 -0700644 type = 65535
645 experimenter = 8992
Rich Lanec2ee4b82013-04-24 17:12:38 -0700646 subtype = 18
647
648 def __init__(self):
649 return
650
651 def pack(self):
652 packed = []
653 packed.append(struct.pack("!H", self.type))
654 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
655 packed.append(struct.pack("!L", self.experimenter))
656 packed.append(struct.pack("!H", self.subtype))
657 packed.append('\x00' * 2)
658 packed.append('\x00' * 4)
659 length = sum([len(x) for x in packed])
660 packed[1] = struct.pack("!H", length)
661 return ''.join(packed)
662
663 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800664 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700665 obj = nicira_dec_ttl()
Dan Talaycof6202252013-07-02 01:00:29 -0700666 _type = reader.read("!H")[0]
667 assert(_type == 65535)
668 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800669 orig_reader = reader
670 reader = orig_reader.slice(_len - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700671 _experimenter = reader.read("!L")[0]
672 assert(_experimenter == 8992)
673 _subtype = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700674 assert(_subtype == 18)
675 reader.skip(2)
676 reader.skip(4)
677 return obj
678
679 def __eq__(self, other):
680 if type(self) != type(other): return False
681 return True
682
Rich Lanec2ee4b82013-04-24 17:12:38 -0700683 def pretty_print(self, q):
684 q.text("nicira_dec_ttl {")
685 with q.group():
686 with q.indent(2):
687 q.breakable()
688 q.breakable()
689 q.text('}')
690
Rich Lane7dcdf022013-12-11 14:45:27 -0800691nicira.subtypes[18] = nicira_dec_ttl
692
693class output(action):
Dan Talaycof6202252013-07-02 01:00:29 -0700694 type = 0
Rich Lanec2ee4b82013-04-24 17:12:38 -0700695
696 def __init__(self, port=None, max_len=None):
697 if port != None:
698 self.port = port
699 else:
700 self.port = 0
701 if max_len != None:
702 self.max_len = max_len
703 else:
704 self.max_len = 0
705 return
706
707 def pack(self):
708 packed = []
709 packed.append(struct.pack("!H", self.type))
710 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
Dan Talaycof6202252013-07-02 01:00:29 -0700711 packed.append(util.pack_port_no(self.port))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700712 packed.append(struct.pack("!H", self.max_len))
713 packed.append('\x00' * 6)
714 length = sum([len(x) for x in packed])
715 packed[1] = struct.pack("!H", length)
716 return ''.join(packed)
717
718 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800719 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700720 obj = output()
Dan Talaycof6202252013-07-02 01:00:29 -0700721 _type = reader.read("!H")[0]
722 assert(_type == 0)
723 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800724 orig_reader = reader
725 reader = orig_reader.slice(_len - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700726 obj.port = util.unpack_port_no(reader)
727 obj.max_len = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700728 reader.skip(6)
729 return obj
730
731 def __eq__(self, other):
732 if type(self) != type(other): return False
733 if self.port != other.port: return False
734 if self.max_len != other.max_len: return False
735 return True
736
Rich Lanec2ee4b82013-04-24 17:12:38 -0700737 def pretty_print(self, q):
738 q.text("output {")
739 with q.group():
740 with q.indent(2):
741 q.breakable()
742 q.text("port = ");
743 q.text(util.pretty_port(self.port))
744 q.text(","); q.breakable()
745 q.text("max_len = ");
746 q.text("%#x" % self.max_len)
747 q.breakable()
748 q.text('}')
749
Rich Lane7dcdf022013-12-11 14:45:27 -0800750action.subtypes[0] = output
751
752class pop_mpls(action):
Dan Talaycof6202252013-07-02 01:00:29 -0700753 type = 20
Rich Lanec2ee4b82013-04-24 17:12:38 -0700754
755 def __init__(self, ethertype=None):
756 if ethertype != None:
757 self.ethertype = ethertype
758 else:
759 self.ethertype = 0
760 return
761
762 def pack(self):
763 packed = []
764 packed.append(struct.pack("!H", self.type))
765 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
766 packed.append(struct.pack("!H", self.ethertype))
767 packed.append('\x00' * 2)
768 length = sum([len(x) for x in packed])
769 packed[1] = struct.pack("!H", length)
770 return ''.join(packed)
771
772 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800773 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700774 obj = pop_mpls()
Dan Talaycof6202252013-07-02 01:00:29 -0700775 _type = reader.read("!H")[0]
776 assert(_type == 20)
777 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800778 orig_reader = reader
779 reader = orig_reader.slice(_len - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700780 obj.ethertype = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700781 reader.skip(2)
782 return obj
783
784 def __eq__(self, other):
785 if type(self) != type(other): return False
786 if self.ethertype != other.ethertype: return False
787 return True
788
Rich Lanec2ee4b82013-04-24 17:12:38 -0700789 def pretty_print(self, q):
790 q.text("pop_mpls {")
791 with q.group():
792 with q.indent(2):
793 q.breakable()
794 q.text("ethertype = ");
795 q.text("%#x" % self.ethertype)
796 q.breakable()
797 q.text('}')
798
Rich Lane7dcdf022013-12-11 14:45:27 -0800799action.subtypes[20] = pop_mpls
800
801class pop_vlan(action):
Dan Talaycof6202252013-07-02 01:00:29 -0700802 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -0700803
804 def __init__(self):
805 return
806
807 def pack(self):
808 packed = []
809 packed.append(struct.pack("!H", self.type))
810 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
811 packed.append('\x00' * 4)
812 length = sum([len(x) for x in packed])
813 packed[1] = struct.pack("!H", length)
814 return ''.join(packed)
815
816 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800817 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700818 obj = pop_vlan()
Dan Talaycof6202252013-07-02 01:00:29 -0700819 _type = reader.read("!H")[0]
820 assert(_type == 18)
821 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800822 orig_reader = reader
823 reader = orig_reader.slice(_len - (2 + 2))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700824 reader.skip(4)
825 return obj
826
827 def __eq__(self, other):
828 if type(self) != type(other): return False
829 return True
830
Rich Lanec2ee4b82013-04-24 17:12:38 -0700831 def pretty_print(self, q):
832 q.text("pop_vlan {")
833 with q.group():
834 with q.indent(2):
835 q.breakable()
836 q.breakable()
837 q.text('}')
838
Rich Lane7dcdf022013-12-11 14:45:27 -0800839action.subtypes[18] = pop_vlan
840
841class push_mpls(action):
Dan Talaycof6202252013-07-02 01:00:29 -0700842 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -0700843
844 def __init__(self, ethertype=None):
845 if ethertype != None:
846 self.ethertype = ethertype
847 else:
848 self.ethertype = 0
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(struct.pack("!H", self.ethertype))
856 packed.append('\x00' * 2)
857 length = sum([len(x) for x in packed])
858 packed[1] = struct.pack("!H", length)
859 return ''.join(packed)
860
861 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800862 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700863 obj = push_mpls()
Dan Talaycof6202252013-07-02 01:00:29 -0700864 _type = reader.read("!H")[0]
865 assert(_type == 19)
866 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800867 orig_reader = reader
868 reader = orig_reader.slice(_len - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700869 obj.ethertype = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700870 reader.skip(2)
871 return obj
872
873 def __eq__(self, other):
874 if type(self) != type(other): return False
875 if self.ethertype != other.ethertype: return False
876 return True
877
Rich Lanec2ee4b82013-04-24 17:12:38 -0700878 def pretty_print(self, q):
879 q.text("push_mpls {")
880 with q.group():
881 with q.indent(2):
882 q.breakable()
883 q.text("ethertype = ");
884 q.text("%#x" % self.ethertype)
885 q.breakable()
886 q.text('}')
887
Rich Lane7dcdf022013-12-11 14:45:27 -0800888action.subtypes[19] = push_mpls
889
890class push_vlan(action):
Dan Talaycof6202252013-07-02 01:00:29 -0700891 type = 17
Rich Lanec2ee4b82013-04-24 17:12:38 -0700892
893 def __init__(self, ethertype=None):
894 if ethertype != None:
895 self.ethertype = ethertype
896 else:
897 self.ethertype = 0
898 return
899
900 def pack(self):
901 packed = []
902 packed.append(struct.pack("!H", self.type))
903 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
904 packed.append(struct.pack("!H", self.ethertype))
905 packed.append('\x00' * 2)
906 length = sum([len(x) for x in packed])
907 packed[1] = struct.pack("!H", length)
908 return ''.join(packed)
909
910 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800911 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700912 obj = push_vlan()
Dan Talaycof6202252013-07-02 01:00:29 -0700913 _type = reader.read("!H")[0]
914 assert(_type == 17)
915 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800916 orig_reader = reader
917 reader = orig_reader.slice(_len - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700918 obj.ethertype = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700919 reader.skip(2)
920 return obj
921
922 def __eq__(self, other):
923 if type(self) != type(other): return False
924 if self.ethertype != other.ethertype: return False
925 return True
926
Rich Lanec2ee4b82013-04-24 17:12:38 -0700927 def pretty_print(self, q):
928 q.text("push_vlan {")
929 with q.group():
930 with q.indent(2):
931 q.breakable()
932 q.text("ethertype = ");
933 q.text("%#x" % self.ethertype)
934 q.breakable()
935 q.text('}')
936
Rich Lane7dcdf022013-12-11 14:45:27 -0800937action.subtypes[17] = push_vlan
938
939class set_field(action):
Dan Talaycof6202252013-07-02 01:00:29 -0700940 type = 25
Rich Lanec2ee4b82013-04-24 17:12:38 -0700941
942 def __init__(self, field=None):
943 if field != None:
944 self.field = field
945 else:
Rich Laned53156a2013-08-05 17:17:33 -0700946 self.field = None
Rich Lanec2ee4b82013-04-24 17:12:38 -0700947 return
948
949 def pack(self):
950 packed = []
951 packed.append(struct.pack("!H", self.type))
952 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
Rich Laned53156a2013-08-05 17:17:33 -0700953 packed.append(self.field.pack())
Rich Lanec2ee4b82013-04-24 17:12:38 -0700954 length = sum([len(x) for x in packed])
Rich Laned53156a2013-08-05 17:17:33 -0700955 packed.append(loxi.generic_util.pad_to(8, length))
956 length += len(packed[-1])
Rich Lanec2ee4b82013-04-24 17:12:38 -0700957 packed[1] = struct.pack("!H", length)
958 return ''.join(packed)
959
960 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800961 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700962 obj = set_field()
Dan Talaycof6202252013-07-02 01:00:29 -0700963 _type = reader.read("!H")[0]
964 assert(_type == 25)
965 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800966 orig_reader = reader
967 reader = orig_reader.slice(_len - (2 + 2))
968 obj.field = oxm.oxm.unpack(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -0700969 return obj
970
971 def __eq__(self, other):
972 if type(self) != type(other): return False
973 if self.field != other.field: return False
974 return True
975
Rich Lanec2ee4b82013-04-24 17:12:38 -0700976 def pretty_print(self, q):
977 q.text("set_field {")
978 with q.group():
979 with q.indent(2):
980 q.breakable()
981 q.text("field = ");
982 q.pp(self.field)
983 q.breakable()
984 q.text('}')
985
Rich Lane7dcdf022013-12-11 14:45:27 -0800986action.subtypes[25] = set_field
987
988class set_mpls_ttl(action):
Dan Talaycof6202252013-07-02 01:00:29 -0700989 type = 15
Rich Lanec2ee4b82013-04-24 17:12:38 -0700990
991 def __init__(self, mpls_ttl=None):
992 if mpls_ttl != None:
993 self.mpls_ttl = mpls_ttl
994 else:
995 self.mpls_ttl = 0
996 return
997
998 def pack(self):
999 packed = []
1000 packed.append(struct.pack("!H", self.type))
1001 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
1002 packed.append(struct.pack("!B", self.mpls_ttl))
1003 packed.append('\x00' * 3)
1004 length = sum([len(x) for x in packed])
1005 packed[1] = struct.pack("!H", length)
1006 return ''.join(packed)
1007
1008 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001009 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001010 obj = set_mpls_ttl()
Dan Talaycof6202252013-07-02 01:00:29 -07001011 _type = reader.read("!H")[0]
1012 assert(_type == 15)
1013 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001014 orig_reader = reader
1015 reader = orig_reader.slice(_len - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001016 obj.mpls_ttl = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001017 reader.skip(3)
1018 return obj
1019
1020 def __eq__(self, other):
1021 if type(self) != type(other): return False
1022 if self.mpls_ttl != other.mpls_ttl: return False
1023 return True
1024
Rich Lanec2ee4b82013-04-24 17:12:38 -07001025 def pretty_print(self, q):
1026 q.text("set_mpls_ttl {")
1027 with q.group():
1028 with q.indent(2):
1029 q.breakable()
1030 q.text("mpls_ttl = ");
1031 q.text("%#x" % self.mpls_ttl)
1032 q.breakable()
1033 q.text('}')
1034
Rich Lane7dcdf022013-12-11 14:45:27 -08001035action.subtypes[15] = set_mpls_ttl
1036
1037class set_nw_ttl(action):
Dan Talaycof6202252013-07-02 01:00:29 -07001038 type = 23
Rich Lanec2ee4b82013-04-24 17:12:38 -07001039
1040 def __init__(self, nw_ttl=None):
1041 if nw_ttl != None:
1042 self.nw_ttl = nw_ttl
1043 else:
1044 self.nw_ttl = 0
1045 return
1046
1047 def pack(self):
1048 packed = []
1049 packed.append(struct.pack("!H", self.type))
1050 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
1051 packed.append(struct.pack("!B", self.nw_ttl))
1052 packed.append('\x00' * 3)
1053 length = sum([len(x) for x in packed])
1054 packed[1] = struct.pack("!H", length)
1055 return ''.join(packed)
1056
1057 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001058 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001059 obj = set_nw_ttl()
Dan Talaycof6202252013-07-02 01:00:29 -07001060 _type = reader.read("!H")[0]
1061 assert(_type == 23)
1062 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001063 orig_reader = reader
1064 reader = orig_reader.slice(_len - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001065 obj.nw_ttl = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001066 reader.skip(3)
1067 return obj
1068
1069 def __eq__(self, other):
1070 if type(self) != type(other): return False
1071 if self.nw_ttl != other.nw_ttl: return False
1072 return True
1073
Rich Lanec2ee4b82013-04-24 17:12:38 -07001074 def pretty_print(self, q):
1075 q.text("set_nw_ttl {")
1076 with q.group():
1077 with q.indent(2):
1078 q.breakable()
1079 q.text("nw_ttl = ");
1080 q.text("%#x" % self.nw_ttl)
1081 q.breakable()
1082 q.text('}')
1083
Rich Lane7dcdf022013-12-11 14:45:27 -08001084action.subtypes[23] = set_nw_ttl
1085
1086class set_queue(action):
Dan Talaycof6202252013-07-02 01:00:29 -07001087 type = 21
Rich Lanec2ee4b82013-04-24 17:12:38 -07001088
1089 def __init__(self, queue_id=None):
1090 if queue_id != None:
1091 self.queue_id = queue_id
1092 else:
1093 self.queue_id = 0
1094 return
1095
1096 def pack(self):
1097 packed = []
1098 packed.append(struct.pack("!H", self.type))
1099 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
1100 packed.append(struct.pack("!L", self.queue_id))
1101 length = sum([len(x) for x in packed])
1102 packed[1] = struct.pack("!H", length)
1103 return ''.join(packed)
1104
1105 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001106 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001107 obj = set_queue()
Dan Talaycof6202252013-07-02 01:00:29 -07001108 _type = reader.read("!H")[0]
1109 assert(_type == 21)
1110 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001111 orig_reader = reader
1112 reader = orig_reader.slice(_len - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001113 obj.queue_id = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001114 return obj
1115
1116 def __eq__(self, other):
1117 if type(self) != type(other): return False
1118 if self.queue_id != other.queue_id: return False
1119 return True
1120
Rich Lanec2ee4b82013-04-24 17:12:38 -07001121 def pretty_print(self, q):
1122 q.text("set_queue {")
1123 with q.group():
1124 with q.indent(2):
1125 q.breakable()
1126 q.text("queue_id = ");
1127 q.text("%#x" % self.queue_id)
1128 q.breakable()
1129 q.text('}')
1130
Rich Lane7dcdf022013-12-11 14:45:27 -08001131action.subtypes[21] = set_queue
Rich Lanec2ee4b82013-04-24 17:12:38 -07001132
Rich Lanec2ee4b82013-04-24 17:12:38 -07001133