blob: 278692a2a1e6923d1ea002d09e813c7b9c00c0c8 [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
189class bsn_mirror(bsn):
Dan Talaycof6202252013-07-02 01:00:29 -0700190 type = 65535
191 experimenter = 6035143
Rich Lanec2ee4b82013-04-24 17:12:38 -0700192 subtype = 1
193
194 def __init__(self, dest_port=None, vlan_tag=None, copy_stage=None):
195 if dest_port != None:
196 self.dest_port = dest_port
197 else:
198 self.dest_port = 0
199 if vlan_tag != None:
200 self.vlan_tag = vlan_tag
201 else:
202 self.vlan_tag = 0
203 if copy_stage != None:
204 self.copy_stage = copy_stage
205 else:
206 self.copy_stage = 0
207 return
208
209 def pack(self):
210 packed = []
211 packed.append(struct.pack("!H", self.type))
212 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
213 packed.append(struct.pack("!L", self.experimenter))
214 packed.append(struct.pack("!L", self.subtype))
215 packed.append(struct.pack("!L", self.dest_port))
216 packed.append(struct.pack("!L", self.vlan_tag))
217 packed.append(struct.pack("!B", self.copy_stage))
218 packed.append('\x00' * 3)
219 length = sum([len(x) for x in packed])
220 packed[1] = struct.pack("!H", length)
221 return ''.join(packed)
222
223 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800224 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700225 obj = bsn_mirror()
Dan Talaycof6202252013-07-02 01:00:29 -0700226 _type = reader.read("!H")[0]
227 assert(_type == 65535)
228 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800229 orig_reader = reader
230 reader = orig_reader.slice(_len - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700231 _experimenter = reader.read("!L")[0]
232 assert(_experimenter == 6035143)
233 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700234 assert(_subtype == 1)
Dan Talaycof6202252013-07-02 01:00:29 -0700235 obj.dest_port = reader.read("!L")[0]
236 obj.vlan_tag = reader.read("!L")[0]
237 obj.copy_stage = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700238 reader.skip(3)
239 return obj
240
241 def __eq__(self, other):
242 if type(self) != type(other): return False
243 if self.dest_port != other.dest_port: return False
244 if self.vlan_tag != other.vlan_tag: return False
245 if self.copy_stage != other.copy_stage: return False
246 return True
247
Rich Lanec2ee4b82013-04-24 17:12:38 -0700248 def pretty_print(self, q):
249 q.text("bsn_mirror {")
250 with q.group():
251 with q.indent(2):
252 q.breakable()
253 q.text("dest_port = ");
254 q.text("%#x" % self.dest_port)
255 q.text(","); q.breakable()
256 q.text("vlan_tag = ");
257 q.text("%#x" % self.vlan_tag)
258 q.text(","); q.breakable()
259 q.text("copy_stage = ");
260 q.text("%#x" % self.copy_stage)
261 q.breakable()
262 q.text('}')
263
Rich Lane7dcdf022013-12-11 14:45:27 -0800264bsn.subtypes[1] = bsn_mirror
265
266class bsn_set_tunnel_dst(bsn):
Dan Talaycof6202252013-07-02 01:00:29 -0700267 type = 65535
268 experimenter = 6035143
Rich Lanec2ee4b82013-04-24 17:12:38 -0700269 subtype = 2
270
271 def __init__(self, dst=None):
272 if dst != None:
273 self.dst = dst
274 else:
275 self.dst = 0
276 return
277
278 def pack(self):
279 packed = []
280 packed.append(struct.pack("!H", self.type))
281 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
282 packed.append(struct.pack("!L", self.experimenter))
283 packed.append(struct.pack("!L", self.subtype))
284 packed.append(struct.pack("!L", self.dst))
285 length = sum([len(x) for x in packed])
286 packed[1] = struct.pack("!H", length)
287 return ''.join(packed)
288
289 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800290 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700291 obj = bsn_set_tunnel_dst()
Dan Talaycof6202252013-07-02 01:00:29 -0700292 _type = reader.read("!H")[0]
293 assert(_type == 65535)
294 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800295 orig_reader = reader
296 reader = orig_reader.slice(_len - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700297 _experimenter = reader.read("!L")[0]
298 assert(_experimenter == 6035143)
299 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700300 assert(_subtype == 2)
Dan Talaycof6202252013-07-02 01:00:29 -0700301 obj.dst = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700302 return obj
303
304 def __eq__(self, other):
305 if type(self) != type(other): return False
306 if self.dst != other.dst: return False
307 return True
308
Rich Lanec2ee4b82013-04-24 17:12:38 -0700309 def pretty_print(self, q):
310 q.text("bsn_set_tunnel_dst {")
311 with q.group():
312 with q.indent(2):
313 q.breakable()
314 q.text("dst = ");
315 q.text("%#x" % self.dst)
316 q.breakable()
317 q.text('}')
318
Rich Lane7dcdf022013-12-11 14:45:27 -0800319bsn.subtypes[2] = bsn_set_tunnel_dst
320
321class copy_ttl_in(action):
Dan Talaycof6202252013-07-02 01:00:29 -0700322 type = 12
Rich Lanec2ee4b82013-04-24 17:12:38 -0700323
324 def __init__(self):
325 return
326
327 def pack(self):
328 packed = []
329 packed.append(struct.pack("!H", self.type))
330 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
331 packed.append('\x00' * 4)
332 length = sum([len(x) for x in packed])
333 packed[1] = struct.pack("!H", length)
334 return ''.join(packed)
335
336 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800337 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700338 obj = copy_ttl_in()
Dan Talaycof6202252013-07-02 01:00:29 -0700339 _type = reader.read("!H")[0]
340 assert(_type == 12)
341 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800342 orig_reader = reader
343 reader = orig_reader.slice(_len - (2 + 2))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700344 reader.skip(4)
345 return obj
346
347 def __eq__(self, other):
348 if type(self) != type(other): return False
349 return True
350
Rich Lanec2ee4b82013-04-24 17:12:38 -0700351 def pretty_print(self, q):
352 q.text("copy_ttl_in {")
353 with q.group():
354 with q.indent(2):
355 q.breakable()
356 q.breakable()
357 q.text('}')
358
Rich Lane7dcdf022013-12-11 14:45:27 -0800359action.subtypes[12] = copy_ttl_in
360
361class copy_ttl_out(action):
Dan Talaycof6202252013-07-02 01:00:29 -0700362 type = 11
Rich Lanec2ee4b82013-04-24 17:12:38 -0700363
364 def __init__(self):
365 return
366
367 def pack(self):
368 packed = []
369 packed.append(struct.pack("!H", self.type))
370 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
371 packed.append('\x00' * 4)
372 length = sum([len(x) for x in packed])
373 packed[1] = struct.pack("!H", length)
374 return ''.join(packed)
375
376 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800377 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700378 obj = copy_ttl_out()
Dan Talaycof6202252013-07-02 01:00:29 -0700379 _type = reader.read("!H")[0]
380 assert(_type == 11)
381 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800382 orig_reader = reader
383 reader = orig_reader.slice(_len - (2 + 2))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700384 reader.skip(4)
385 return obj
386
387 def __eq__(self, other):
388 if type(self) != type(other): return False
389 return True
390
Rich Lanec2ee4b82013-04-24 17:12:38 -0700391 def pretty_print(self, q):
392 q.text("copy_ttl_out {")
393 with q.group():
394 with q.indent(2):
395 q.breakable()
396 q.breakable()
397 q.text('}')
398
Rich Lane7dcdf022013-12-11 14:45:27 -0800399action.subtypes[11] = copy_ttl_out
400
401class dec_mpls_ttl(action):
Dan Talaycof6202252013-07-02 01:00:29 -0700402 type = 16
Rich Lanec2ee4b82013-04-24 17:12:38 -0700403
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
411 packed.append('\x00' * 4)
412 length = sum([len(x) for x in packed])
413 packed[1] = struct.pack("!H", length)
414 return ''.join(packed)
415
416 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800417 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700418 obj = dec_mpls_ttl()
Dan Talaycof6202252013-07-02 01:00:29 -0700419 _type = reader.read("!H")[0]
420 assert(_type == 16)
421 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800422 orig_reader = reader
423 reader = orig_reader.slice(_len - (2 + 2))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700424 reader.skip(4)
425 return obj
426
427 def __eq__(self, other):
428 if type(self) != type(other): return False
429 return True
430
Rich Lanec2ee4b82013-04-24 17:12:38 -0700431 def pretty_print(self, q):
432 q.text("dec_mpls_ttl {")
433 with q.group():
434 with q.indent(2):
435 q.breakable()
436 q.breakable()
437 q.text('}')
438
Rich Lane7dcdf022013-12-11 14:45:27 -0800439action.subtypes[16] = dec_mpls_ttl
440
441class dec_nw_ttl(action):
Dan Talaycof6202252013-07-02 01:00:29 -0700442 type = 24
Rich Lanec2ee4b82013-04-24 17:12:38 -0700443
444 def __init__(self):
445 return
446
447 def pack(self):
448 packed = []
449 packed.append(struct.pack("!H", self.type))
450 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
451 packed.append('\x00' * 4)
452 length = sum([len(x) for x in packed])
453 packed[1] = struct.pack("!H", length)
454 return ''.join(packed)
455
456 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800457 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700458 obj = dec_nw_ttl()
Dan Talaycof6202252013-07-02 01:00:29 -0700459 _type = reader.read("!H")[0]
460 assert(_type == 24)
461 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800462 orig_reader = reader
463 reader = orig_reader.slice(_len - (2 + 2))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700464 reader.skip(4)
465 return obj
466
467 def __eq__(self, other):
468 if type(self) != type(other): return False
469 return True
470
Rich Lanec2ee4b82013-04-24 17:12:38 -0700471 def pretty_print(self, q):
472 q.text("dec_nw_ttl {")
473 with q.group():
474 with q.indent(2):
475 q.breakable()
476 q.breakable()
477 q.text('}')
478
Rich Lane7dcdf022013-12-11 14:45:27 -0800479action.subtypes[24] = dec_nw_ttl
480
481class group(action):
Dan Talaycof6202252013-07-02 01:00:29 -0700482 type = 22
Rich Lanec2ee4b82013-04-24 17:12:38 -0700483
484 def __init__(self, group_id=None):
485 if group_id != None:
486 self.group_id = group_id
487 else:
488 self.group_id = 0
489 return
490
491 def pack(self):
492 packed = []
493 packed.append(struct.pack("!H", self.type))
494 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
495 packed.append(struct.pack("!L", self.group_id))
496 length = sum([len(x) for x in packed])
497 packed[1] = struct.pack("!H", length)
498 return ''.join(packed)
499
500 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800501 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700502 obj = group()
Dan Talaycof6202252013-07-02 01:00:29 -0700503 _type = reader.read("!H")[0]
504 assert(_type == 22)
505 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800506 orig_reader = reader
507 reader = orig_reader.slice(_len - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700508 obj.group_id = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700509 return obj
510
511 def __eq__(self, other):
512 if type(self) != type(other): return False
513 if self.group_id != other.group_id: return False
514 return True
515
Rich Lanec2ee4b82013-04-24 17:12:38 -0700516 def pretty_print(self, q):
517 q.text("group {")
518 with q.group():
519 with q.indent(2):
520 q.breakable()
521 q.text("group_id = ");
522 q.text("%#x" % self.group_id)
523 q.breakable()
524 q.text('}')
525
Rich Lane7dcdf022013-12-11 14:45:27 -0800526action.subtypes[22] = group
527
528class nicira(experimenter):
529 subtypes = {}
530
Rich Lane95f7fc92014-01-27 17:08:16 -0800531 type = 65535
532 experimenter = 8992
533
534 def __init__(self, subtype=None):
535 if subtype != None:
536 self.subtype = subtype
537 else:
538 self.subtype = 0
539 return
540
541 def pack(self):
542 packed = []
543 packed.append(struct.pack("!H", self.type))
544 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
545 packed.append(struct.pack("!L", self.experimenter))
546 packed.append(struct.pack("!H", self.subtype))
547 packed.append('\x00' * 2)
548 packed.append('\x00' * 4)
549 length = sum([len(x) for x in packed])
550 packed[1] = struct.pack("!H", length)
551 return ''.join(packed)
552
Rich Lane7dcdf022013-12-11 14:45:27 -0800553 @staticmethod
554 def unpack(reader):
555 subtype, = reader.peek('!H', 8)
Rich Lane95f7fc92014-01-27 17:08:16 -0800556 subclass = nicira.subtypes.get(subtype)
557 if subclass:
558 return subclass.unpack(reader)
559
560 obj = nicira()
561 _type = reader.read("!H")[0]
562 assert(_type == 65535)
563 _len = reader.read("!H")[0]
564 orig_reader = reader
565 reader = orig_reader.slice(_len - (2 + 2))
566 _experimenter = reader.read("!L")[0]
567 assert(_experimenter == 8992)
568 obj.subtype = reader.read("!H")[0]
569 reader.skip(2)
570 reader.skip(4)
571 return obj
572
573 def __eq__(self, other):
574 if type(self) != type(other): return False
575 if self.subtype != other.subtype: return False
576 return True
577
578 def pretty_print(self, q):
579 q.text("nicira {")
580 with q.group():
581 with q.indent(2):
582 q.breakable()
583 q.breakable()
584 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -0800585
586experimenter.subtypes[8992] = nicira
587
588class nicira_dec_ttl(nicira):
Dan Talaycof6202252013-07-02 01:00:29 -0700589 type = 65535
590 experimenter = 8992
Rich Lanec2ee4b82013-04-24 17:12:38 -0700591 subtype = 18
592
593 def __init__(self):
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
608 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800609 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700610 obj = nicira_dec_ttl()
Dan Talaycof6202252013-07-02 01:00:29 -0700611 _type = reader.read("!H")[0]
612 assert(_type == 65535)
613 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800614 orig_reader = reader
615 reader = orig_reader.slice(_len - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700616 _experimenter = reader.read("!L")[0]
617 assert(_experimenter == 8992)
618 _subtype = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700619 assert(_subtype == 18)
620 reader.skip(2)
621 reader.skip(4)
622 return obj
623
624 def __eq__(self, other):
625 if type(self) != type(other): return False
626 return True
627
Rich Lanec2ee4b82013-04-24 17:12:38 -0700628 def pretty_print(self, q):
629 q.text("nicira_dec_ttl {")
630 with q.group():
631 with q.indent(2):
632 q.breakable()
633 q.breakable()
634 q.text('}')
635
Rich Lane7dcdf022013-12-11 14:45:27 -0800636nicira.subtypes[18] = nicira_dec_ttl
637
638class output(action):
Dan Talaycof6202252013-07-02 01:00:29 -0700639 type = 0
Rich Lanec2ee4b82013-04-24 17:12:38 -0700640
641 def __init__(self, port=None, max_len=None):
642 if port != None:
643 self.port = port
644 else:
645 self.port = 0
646 if max_len != None:
647 self.max_len = max_len
648 else:
649 self.max_len = 0
650 return
651
652 def pack(self):
653 packed = []
654 packed.append(struct.pack("!H", self.type))
655 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
Dan Talaycof6202252013-07-02 01:00:29 -0700656 packed.append(util.pack_port_no(self.port))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700657 packed.append(struct.pack("!H", self.max_len))
658 packed.append('\x00' * 6)
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 = output()
Dan Talaycof6202252013-07-02 01:00:29 -0700666 _type = reader.read("!H")[0]
667 assert(_type == 0)
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 obj.port = util.unpack_port_no(reader)
672 obj.max_len = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700673 reader.skip(6)
674 return obj
675
676 def __eq__(self, other):
677 if type(self) != type(other): return False
678 if self.port != other.port: return False
679 if self.max_len != other.max_len: return False
680 return True
681
Rich Lanec2ee4b82013-04-24 17:12:38 -0700682 def pretty_print(self, q):
683 q.text("output {")
684 with q.group():
685 with q.indent(2):
686 q.breakable()
687 q.text("port = ");
688 q.text(util.pretty_port(self.port))
689 q.text(","); q.breakable()
690 q.text("max_len = ");
691 q.text("%#x" % self.max_len)
692 q.breakable()
693 q.text('}')
694
Rich Lane7dcdf022013-12-11 14:45:27 -0800695action.subtypes[0] = output
696
697class pop_mpls(action):
Dan Talaycof6202252013-07-02 01:00:29 -0700698 type = 20
Rich Lanec2ee4b82013-04-24 17:12:38 -0700699
700 def __init__(self, ethertype=None):
701 if ethertype != None:
702 self.ethertype = ethertype
703 else:
704 self.ethertype = 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
711 packed.append(struct.pack("!H", self.ethertype))
712 packed.append('\x00' * 2)
713 length = sum([len(x) for x in packed])
714 packed[1] = struct.pack("!H", length)
715 return ''.join(packed)
716
717 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800718 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700719 obj = pop_mpls()
Dan Talaycof6202252013-07-02 01:00:29 -0700720 _type = reader.read("!H")[0]
721 assert(_type == 20)
722 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800723 orig_reader = reader
724 reader = orig_reader.slice(_len - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700725 obj.ethertype = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700726 reader.skip(2)
727 return obj
728
729 def __eq__(self, other):
730 if type(self) != type(other): return False
731 if self.ethertype != other.ethertype: return False
732 return True
733
Rich Lanec2ee4b82013-04-24 17:12:38 -0700734 def pretty_print(self, q):
735 q.text("pop_mpls {")
736 with q.group():
737 with q.indent(2):
738 q.breakable()
739 q.text("ethertype = ");
740 q.text("%#x" % self.ethertype)
741 q.breakable()
742 q.text('}')
743
Rich Lane7dcdf022013-12-11 14:45:27 -0800744action.subtypes[20] = pop_mpls
745
746class pop_vlan(action):
Dan Talaycof6202252013-07-02 01:00:29 -0700747 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -0700748
749 def __init__(self):
750 return
751
752 def pack(self):
753 packed = []
754 packed.append(struct.pack("!H", self.type))
755 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
756 packed.append('\x00' * 4)
757 length = sum([len(x) for x in packed])
758 packed[1] = struct.pack("!H", length)
759 return ''.join(packed)
760
761 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800762 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700763 obj = pop_vlan()
Dan Talaycof6202252013-07-02 01:00:29 -0700764 _type = reader.read("!H")[0]
765 assert(_type == 18)
766 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800767 orig_reader = reader
768 reader = orig_reader.slice(_len - (2 + 2))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700769 reader.skip(4)
770 return obj
771
772 def __eq__(self, other):
773 if type(self) != type(other): return False
774 return True
775
Rich Lanec2ee4b82013-04-24 17:12:38 -0700776 def pretty_print(self, q):
777 q.text("pop_vlan {")
778 with q.group():
779 with q.indent(2):
780 q.breakable()
781 q.breakable()
782 q.text('}')
783
Rich Lane7dcdf022013-12-11 14:45:27 -0800784action.subtypes[18] = pop_vlan
785
786class push_mpls(action):
Dan Talaycof6202252013-07-02 01:00:29 -0700787 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -0700788
789 def __init__(self, ethertype=None):
790 if ethertype != None:
791 self.ethertype = ethertype
792 else:
793 self.ethertype = 0
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(struct.pack("!H", self.ethertype))
801 packed.append('\x00' * 2)
802 length = sum([len(x) for x in packed])
803 packed[1] = struct.pack("!H", length)
804 return ''.join(packed)
805
806 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800807 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700808 obj = push_mpls()
Dan Talaycof6202252013-07-02 01:00:29 -0700809 _type = reader.read("!H")[0]
810 assert(_type == 19)
811 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800812 orig_reader = reader
813 reader = orig_reader.slice(_len - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700814 obj.ethertype = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700815 reader.skip(2)
816 return obj
817
818 def __eq__(self, other):
819 if type(self) != type(other): return False
820 if self.ethertype != other.ethertype: return False
821 return True
822
Rich Lanec2ee4b82013-04-24 17:12:38 -0700823 def pretty_print(self, q):
824 q.text("push_mpls {")
825 with q.group():
826 with q.indent(2):
827 q.breakable()
828 q.text("ethertype = ");
829 q.text("%#x" % self.ethertype)
830 q.breakable()
831 q.text('}')
832
Rich Lane7dcdf022013-12-11 14:45:27 -0800833action.subtypes[19] = push_mpls
834
835class push_vlan(action):
Dan Talaycof6202252013-07-02 01:00:29 -0700836 type = 17
Rich Lanec2ee4b82013-04-24 17:12:38 -0700837
838 def __init__(self, ethertype=None):
839 if ethertype != None:
840 self.ethertype = ethertype
841 else:
842 self.ethertype = 0
843 return
844
845 def pack(self):
846 packed = []
847 packed.append(struct.pack("!H", self.type))
848 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
849 packed.append(struct.pack("!H", self.ethertype))
850 packed.append('\x00' * 2)
851 length = sum([len(x) for x in packed])
852 packed[1] = struct.pack("!H", length)
853 return ''.join(packed)
854
855 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800856 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700857 obj = push_vlan()
Dan Talaycof6202252013-07-02 01:00:29 -0700858 _type = reader.read("!H")[0]
859 assert(_type == 17)
860 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800861 orig_reader = reader
862 reader = orig_reader.slice(_len - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700863 obj.ethertype = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700864 reader.skip(2)
865 return obj
866
867 def __eq__(self, other):
868 if type(self) != type(other): return False
869 if self.ethertype != other.ethertype: return False
870 return True
871
Rich Lanec2ee4b82013-04-24 17:12:38 -0700872 def pretty_print(self, q):
873 q.text("push_vlan {")
874 with q.group():
875 with q.indent(2):
876 q.breakable()
877 q.text("ethertype = ");
878 q.text("%#x" % self.ethertype)
879 q.breakable()
880 q.text('}')
881
Rich Lane7dcdf022013-12-11 14:45:27 -0800882action.subtypes[17] = push_vlan
883
884class set_field(action):
Dan Talaycof6202252013-07-02 01:00:29 -0700885 type = 25
Rich Lanec2ee4b82013-04-24 17:12:38 -0700886
887 def __init__(self, field=None):
888 if field != None:
889 self.field = field
890 else:
Rich Laned53156a2013-08-05 17:17:33 -0700891 self.field = None
Rich Lanec2ee4b82013-04-24 17:12:38 -0700892 return
893
894 def pack(self):
895 packed = []
896 packed.append(struct.pack("!H", self.type))
897 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
Rich Laned53156a2013-08-05 17:17:33 -0700898 packed.append(self.field.pack())
Rich Lanec2ee4b82013-04-24 17:12:38 -0700899 length = sum([len(x) for x in packed])
Rich Laned53156a2013-08-05 17:17:33 -0700900 packed.append(loxi.generic_util.pad_to(8, length))
901 length += len(packed[-1])
Rich Lanec2ee4b82013-04-24 17:12:38 -0700902 packed[1] = struct.pack("!H", length)
903 return ''.join(packed)
904
905 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800906 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700907 obj = set_field()
Dan Talaycof6202252013-07-02 01:00:29 -0700908 _type = reader.read("!H")[0]
909 assert(_type == 25)
910 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800911 orig_reader = reader
912 reader = orig_reader.slice(_len - (2 + 2))
913 obj.field = oxm.oxm.unpack(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -0700914 return obj
915
916 def __eq__(self, other):
917 if type(self) != type(other): return False
918 if self.field != other.field: return False
919 return True
920
Rich Lanec2ee4b82013-04-24 17:12:38 -0700921 def pretty_print(self, q):
922 q.text("set_field {")
923 with q.group():
924 with q.indent(2):
925 q.breakable()
926 q.text("field = ");
927 q.pp(self.field)
928 q.breakable()
929 q.text('}')
930
Rich Lane7dcdf022013-12-11 14:45:27 -0800931action.subtypes[25] = set_field
932
933class set_mpls_ttl(action):
Dan Talaycof6202252013-07-02 01:00:29 -0700934 type = 15
Rich Lanec2ee4b82013-04-24 17:12:38 -0700935
936 def __init__(self, mpls_ttl=None):
937 if mpls_ttl != None:
938 self.mpls_ttl = mpls_ttl
939 else:
940 self.mpls_ttl = 0
941 return
942
943 def pack(self):
944 packed = []
945 packed.append(struct.pack("!H", self.type))
946 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
947 packed.append(struct.pack("!B", self.mpls_ttl))
948 packed.append('\x00' * 3)
949 length = sum([len(x) for x in packed])
950 packed[1] = struct.pack("!H", length)
951 return ''.join(packed)
952
953 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800954 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700955 obj = set_mpls_ttl()
Dan Talaycof6202252013-07-02 01:00:29 -0700956 _type = reader.read("!H")[0]
957 assert(_type == 15)
958 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800959 orig_reader = reader
960 reader = orig_reader.slice(_len - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700961 obj.mpls_ttl = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700962 reader.skip(3)
963 return obj
964
965 def __eq__(self, other):
966 if type(self) != type(other): return False
967 if self.mpls_ttl != other.mpls_ttl: return False
968 return True
969
Rich Lanec2ee4b82013-04-24 17:12:38 -0700970 def pretty_print(self, q):
971 q.text("set_mpls_ttl {")
972 with q.group():
973 with q.indent(2):
974 q.breakable()
975 q.text("mpls_ttl = ");
976 q.text("%#x" % self.mpls_ttl)
977 q.breakable()
978 q.text('}')
979
Rich Lane7dcdf022013-12-11 14:45:27 -0800980action.subtypes[15] = set_mpls_ttl
981
982class set_nw_ttl(action):
Dan Talaycof6202252013-07-02 01:00:29 -0700983 type = 23
Rich Lanec2ee4b82013-04-24 17:12:38 -0700984
985 def __init__(self, nw_ttl=None):
986 if nw_ttl != None:
987 self.nw_ttl = nw_ttl
988 else:
989 self.nw_ttl = 0
990 return
991
992 def pack(self):
993 packed = []
994 packed.append(struct.pack("!H", self.type))
995 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
996 packed.append(struct.pack("!B", self.nw_ttl))
997 packed.append('\x00' * 3)
998 length = sum([len(x) for x in packed])
999 packed[1] = struct.pack("!H", length)
1000 return ''.join(packed)
1001
1002 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001003 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001004 obj = set_nw_ttl()
Dan Talaycof6202252013-07-02 01:00:29 -07001005 _type = reader.read("!H")[0]
1006 assert(_type == 23)
1007 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001008 orig_reader = reader
1009 reader = orig_reader.slice(_len - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001010 obj.nw_ttl = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001011 reader.skip(3)
1012 return obj
1013
1014 def __eq__(self, other):
1015 if type(self) != type(other): return False
1016 if self.nw_ttl != other.nw_ttl: return False
1017 return True
1018
Rich Lanec2ee4b82013-04-24 17:12:38 -07001019 def pretty_print(self, q):
1020 q.text("set_nw_ttl {")
1021 with q.group():
1022 with q.indent(2):
1023 q.breakable()
1024 q.text("nw_ttl = ");
1025 q.text("%#x" % self.nw_ttl)
1026 q.breakable()
1027 q.text('}')
1028
Rich Lane7dcdf022013-12-11 14:45:27 -08001029action.subtypes[23] = set_nw_ttl
1030
1031class set_queue(action):
Dan Talaycof6202252013-07-02 01:00:29 -07001032 type = 21
Rich Lanec2ee4b82013-04-24 17:12:38 -07001033
1034 def __init__(self, queue_id=None):
1035 if queue_id != None:
1036 self.queue_id = queue_id
1037 else:
1038 self.queue_id = 0
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 packed.append(struct.pack("!L", self.queue_id))
1046 length = sum([len(x) for x in packed])
1047 packed[1] = struct.pack("!H", length)
1048 return ''.join(packed)
1049
1050 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001051 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001052 obj = set_queue()
Dan Talaycof6202252013-07-02 01:00:29 -07001053 _type = reader.read("!H")[0]
1054 assert(_type == 21)
1055 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001056 orig_reader = reader
1057 reader = orig_reader.slice(_len - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001058 obj.queue_id = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001059 return obj
1060
1061 def __eq__(self, other):
1062 if type(self) != type(other): return False
1063 if self.queue_id != other.queue_id: return False
1064 return True
1065
Rich Lanec2ee4b82013-04-24 17:12:38 -07001066 def pretty_print(self, q):
1067 q.text("set_queue {")
1068 with q.group():
1069 with q.indent(2):
1070 q.breakable()
1071 q.text("queue_id = ");
1072 q.text("%#x" % self.queue_id)
1073 q.breakable()
1074 q.text('}')
1075
Rich Lane7dcdf022013-12-11 14:45:27 -08001076action.subtypes[21] = set_queue
Rich Lanec2ee4b82013-04-24 17:12:38 -07001077
Rich Lanec2ee4b82013-04-24 17:12:38 -07001078