blob: 42f8340f0a1e28adb12382451fa1774dd0feded1 [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
Rich Lanec2ee4b82013-04-24 17:12:38 -070015import util
16import loxi.generic_util
Rich Lanec2ee4b82013-04-24 17:12:38 -070017
Rich Lane7dcdf022013-12-11 14:45:27 -080018class action(loxi.OFObject):
19 subtypes = {}
Rich Lanec2ee4b82013-04-24 17:12:38 -070020
Rich Lane95f7fc92014-01-27 17:08:16 -080021
22 def __init__(self, type=None):
23 if type != None:
24 self.type = type
25 else:
26 self.type = 0
27 return
28
29 def pack(self):
30 packed = []
31 packed.append(struct.pack("!H", self.type))
32 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
33 packed.append('\x00' * 4)
34 length = sum([len(x) for x in packed])
35 packed[1] = struct.pack("!H", length)
36 return ''.join(packed)
37
Rich Lane7dcdf022013-12-11 14:45:27 -080038 @staticmethod
39 def unpack(reader):
40 subtype, = reader.peek('!H', 0)
Rich Lane95f7fc92014-01-27 17:08:16 -080041 subclass = action.subtypes.get(subtype)
42 if subclass:
43 return subclass.unpack(reader)
44
45 obj = action()
46 obj.type = reader.read("!H")[0]
47 _len = reader.read("!H")[0]
48 orig_reader = reader
49 reader = orig_reader.slice(_len - (2 + 2))
50 reader.skip(4)
51 return obj
52
53 def __eq__(self, other):
54 if type(self) != type(other): return False
55 if self.type != other.type: return False
56 return True
57
58 def pretty_print(self, q):
59 q.text("action {")
60 with q.group():
61 with q.indent(2):
62 q.breakable()
63 q.breakable()
64 q.text('}')
Rich Lanec2ee4b82013-04-24 17:12:38 -070065
Rich Lane7dcdf022013-12-11 14:45:27 -080066
67class experimenter(action):
68 subtypes = {}
69
Rich Lane95f7fc92014-01-27 17:08:16 -080070 type = 65535
71
72 def __init__(self, experimenter=None, data=None):
73 if experimenter != None:
74 self.experimenter = experimenter
75 else:
76 self.experimenter = 0
77 if data != None:
78 self.data = data
79 else:
80 self.data = ''
81 return
82
83 def pack(self):
84 packed = []
85 packed.append(struct.pack("!H", self.type))
86 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
87 packed.append(struct.pack("!L", self.experimenter))
88 packed.append(self.data)
89 length = sum([len(x) for x in packed])
90 packed[1] = struct.pack("!H", length)
91 return ''.join(packed)
92
Rich Lane7dcdf022013-12-11 14:45:27 -080093 @staticmethod
94 def unpack(reader):
95 subtype, = reader.peek('!L', 4)
Rich Lane95f7fc92014-01-27 17:08:16 -080096 subclass = experimenter.subtypes.get(subtype)
97 if subclass:
98 return subclass.unpack(reader)
99
100 obj = experimenter()
101 _type = reader.read("!H")[0]
102 assert(_type == 65535)
103 _len = reader.read("!H")[0]
104 orig_reader = reader
105 reader = orig_reader.slice(_len - (2 + 2))
106 obj.experimenter = reader.read("!L")[0]
107 obj.data = str(reader.read_all())
108 return obj
109
110 def __eq__(self, other):
111 if type(self) != type(other): return False
112 if self.experimenter != other.experimenter: return False
113 if self.data != other.data: return False
114 return True
115
116 def pretty_print(self, q):
117 q.text("experimenter {")
118 with q.group():
119 with q.indent(2):
120 q.breakable()
121 q.text("data = ");
122 q.pp(self.data)
123 q.breakable()
124 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -0800125
126action.subtypes[65535] = experimenter
127
128class bsn(experimenter):
129 subtypes = {}
130
Rich Lane95f7fc92014-01-27 17:08:16 -0800131 type = 65535
132 experimenter = 6035143
133
134 def __init__(self, subtype=None):
135 if subtype != None:
136 self.subtype = subtype
137 else:
138 self.subtype = 0
139 return
140
141 def pack(self):
142 packed = []
143 packed.append(struct.pack("!H", self.type))
144 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
145 packed.append(struct.pack("!L", self.experimenter))
146 packed.append(struct.pack("!L", self.subtype))
147 packed.append('\x00' * 4)
148 length = sum([len(x) for x in packed])
149 packed[1] = struct.pack("!H", length)
150 return ''.join(packed)
151
Rich Lane7dcdf022013-12-11 14:45:27 -0800152 @staticmethod
153 def unpack(reader):
154 subtype, = reader.peek('!L', 8)
Rich Lane95f7fc92014-01-27 17:08:16 -0800155 subclass = bsn.subtypes.get(subtype)
156 if subclass:
157 return subclass.unpack(reader)
158
159 obj = bsn()
160 _type = reader.read("!H")[0]
161 assert(_type == 65535)
162 _len = reader.read("!H")[0]
163 orig_reader = reader
164 reader = orig_reader.slice(_len - (2 + 2))
165 _experimenter = reader.read("!L")[0]
166 assert(_experimenter == 6035143)
167 obj.subtype = reader.read("!L")[0]
168 reader.skip(4)
169 return obj
170
171 def __eq__(self, other):
172 if type(self) != type(other): return False
173 if self.subtype != other.subtype: return False
174 return True
175
176 def pretty_print(self, q):
177 q.text("bsn {")
178 with q.group():
179 with q.indent(2):
180 q.breakable()
181 q.breakable()
182 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -0800183
184experimenter.subtypes[6035143] = bsn
185
Rich Lane5587ab12014-06-30 11:19:09 -0700186class bsn_checksum(bsn):
187 type = 65535
188 experimenter = 6035143
189 subtype = 4
190
191 def __init__(self, checksum=None):
192 if checksum != None:
193 self.checksum = checksum
194 else:
195 self.checksum = 0
196 return
197
198 def pack(self):
199 packed = []
200 packed.append(struct.pack("!H", self.type))
201 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
202 packed.append(struct.pack("!L", self.experimenter))
203 packed.append(struct.pack("!L", self.subtype))
204 packed.append(util.pack_checksum_128(self.checksum))
205 length = sum([len(x) for x in packed])
206 packed[1] = struct.pack("!H", length)
207 return ''.join(packed)
208
209 @staticmethod
210 def unpack(reader):
211 obj = bsn_checksum()
212 _type = reader.read("!H")[0]
213 assert(_type == 65535)
214 _len = reader.read("!H")[0]
215 orig_reader = reader
216 reader = orig_reader.slice(_len - (2 + 2))
217 _experimenter = reader.read("!L")[0]
218 assert(_experimenter == 6035143)
219 _subtype = reader.read("!L")[0]
220 assert(_subtype == 4)
221 obj.checksum = util.unpack_checksum_128(reader)
222 return obj
223
224 def __eq__(self, other):
225 if type(self) != type(other): return False
226 if self.checksum != other.checksum: return False
227 return True
228
229 def pretty_print(self, q):
230 q.text("bsn_checksum {")
231 with q.group():
232 with q.indent(2):
233 q.breakable()
234 q.text("checksum = ");
235 q.pp(self.checksum)
236 q.breakable()
237 q.text('}')
238
239bsn.subtypes[4] = bsn_checksum
240
Rich Lane7dcdf022013-12-11 14:45:27 -0800241class bsn_mirror(bsn):
Dan Talaycof6202252013-07-02 01:00:29 -0700242 type = 65535
243 experimenter = 6035143
Rich Lanec2ee4b82013-04-24 17:12:38 -0700244 subtype = 1
245
246 def __init__(self, dest_port=None, vlan_tag=None, copy_stage=None):
247 if dest_port != None:
248 self.dest_port = dest_port
249 else:
250 self.dest_port = 0
251 if vlan_tag != None:
252 self.vlan_tag = vlan_tag
253 else:
254 self.vlan_tag = 0
255 if copy_stage != None:
256 self.copy_stage = copy_stage
257 else:
258 self.copy_stage = 0
259 return
260
261 def pack(self):
262 packed = []
263 packed.append(struct.pack("!H", self.type))
264 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
265 packed.append(struct.pack("!L", self.experimenter))
266 packed.append(struct.pack("!L", self.subtype))
267 packed.append(struct.pack("!L", self.dest_port))
268 packed.append(struct.pack("!L", self.vlan_tag))
269 packed.append(struct.pack("!B", self.copy_stage))
270 packed.append('\x00' * 3)
271 length = sum([len(x) for x in packed])
272 packed[1] = struct.pack("!H", length)
273 return ''.join(packed)
274
275 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800276 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700277 obj = bsn_mirror()
Dan Talaycof6202252013-07-02 01:00:29 -0700278 _type = reader.read("!H")[0]
279 assert(_type == 65535)
280 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800281 orig_reader = reader
282 reader = orig_reader.slice(_len - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700283 _experimenter = reader.read("!L")[0]
284 assert(_experimenter == 6035143)
285 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700286 assert(_subtype == 1)
Dan Talaycof6202252013-07-02 01:00:29 -0700287 obj.dest_port = reader.read("!L")[0]
288 obj.vlan_tag = reader.read("!L")[0]
289 obj.copy_stage = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700290 reader.skip(3)
291 return obj
292
293 def __eq__(self, other):
294 if type(self) != type(other): return False
295 if self.dest_port != other.dest_port: return False
296 if self.vlan_tag != other.vlan_tag: return False
297 if self.copy_stage != other.copy_stage: return False
298 return True
299
Rich Lanec2ee4b82013-04-24 17:12:38 -0700300 def pretty_print(self, q):
301 q.text("bsn_mirror {")
302 with q.group():
303 with q.indent(2):
304 q.breakable()
305 q.text("dest_port = ");
306 q.text("%#x" % self.dest_port)
307 q.text(","); q.breakable()
308 q.text("vlan_tag = ");
309 q.text("%#x" % self.vlan_tag)
310 q.text(","); q.breakable()
311 q.text("copy_stage = ");
312 q.text("%#x" % self.copy_stage)
313 q.breakable()
314 q.text('}')
315
Rich Lane7dcdf022013-12-11 14:45:27 -0800316bsn.subtypes[1] = bsn_mirror
317
318class bsn_set_tunnel_dst(bsn):
Dan Talaycof6202252013-07-02 01:00:29 -0700319 type = 65535
320 experimenter = 6035143
Rich Lanec2ee4b82013-04-24 17:12:38 -0700321 subtype = 2
322
323 def __init__(self, dst=None):
324 if dst != None:
325 self.dst = dst
326 else:
327 self.dst = 0
328 return
329
330 def pack(self):
331 packed = []
332 packed.append(struct.pack("!H", self.type))
333 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
334 packed.append(struct.pack("!L", self.experimenter))
335 packed.append(struct.pack("!L", self.subtype))
336 packed.append(struct.pack("!L", self.dst))
337 length = sum([len(x) for x in packed])
338 packed[1] = struct.pack("!H", length)
339 return ''.join(packed)
340
341 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800342 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700343 obj = bsn_set_tunnel_dst()
Dan Talaycof6202252013-07-02 01:00:29 -0700344 _type = reader.read("!H")[0]
345 assert(_type == 65535)
346 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800347 orig_reader = reader
348 reader = orig_reader.slice(_len - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700349 _experimenter = reader.read("!L")[0]
350 assert(_experimenter == 6035143)
351 _subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700352 assert(_subtype == 2)
Dan Talaycof6202252013-07-02 01:00:29 -0700353 obj.dst = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700354 return obj
355
356 def __eq__(self, other):
357 if type(self) != type(other): return False
358 if self.dst != other.dst: return False
359 return True
360
Rich Lanec2ee4b82013-04-24 17:12:38 -0700361 def pretty_print(self, q):
362 q.text("bsn_set_tunnel_dst {")
363 with q.group():
364 with q.indent(2):
365 q.breakable()
366 q.text("dst = ");
367 q.text("%#x" % self.dst)
368 q.breakable()
369 q.text('}')
370
Rich Lane7dcdf022013-12-11 14:45:27 -0800371bsn.subtypes[2] = bsn_set_tunnel_dst
372
373class copy_ttl_in(action):
Dan Talaycof6202252013-07-02 01:00:29 -0700374 type = 12
Rich Lanec2ee4b82013-04-24 17:12:38 -0700375
376 def __init__(self):
377 return
378
379 def pack(self):
380 packed = []
381 packed.append(struct.pack("!H", self.type))
382 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
383 packed.append('\x00' * 4)
384 length = sum([len(x) for x in packed])
385 packed[1] = struct.pack("!H", length)
386 return ''.join(packed)
387
388 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800389 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700390 obj = copy_ttl_in()
Dan Talaycof6202252013-07-02 01:00:29 -0700391 _type = reader.read("!H")[0]
392 assert(_type == 12)
393 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800394 orig_reader = reader
395 reader = orig_reader.slice(_len - (2 + 2))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700396 reader.skip(4)
397 return obj
398
399 def __eq__(self, other):
400 if type(self) != type(other): return False
401 return True
402
Rich Lanec2ee4b82013-04-24 17:12:38 -0700403 def pretty_print(self, q):
404 q.text("copy_ttl_in {")
405 with q.group():
406 with q.indent(2):
407 q.breakable()
408 q.breakable()
409 q.text('}')
410
Rich Lane7dcdf022013-12-11 14:45:27 -0800411action.subtypes[12] = copy_ttl_in
412
413class copy_ttl_out(action):
Dan Talaycof6202252013-07-02 01:00:29 -0700414 type = 11
Rich Lanec2ee4b82013-04-24 17:12:38 -0700415
416 def __init__(self):
417 return
418
419 def pack(self):
420 packed = []
421 packed.append(struct.pack("!H", self.type))
422 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
423 packed.append('\x00' * 4)
424 length = sum([len(x) for x in packed])
425 packed[1] = struct.pack("!H", length)
426 return ''.join(packed)
427
428 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800429 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700430 obj = copy_ttl_out()
Dan Talaycof6202252013-07-02 01:00:29 -0700431 _type = reader.read("!H")[0]
432 assert(_type == 11)
433 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800434 orig_reader = reader
435 reader = orig_reader.slice(_len - (2 + 2))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700436 reader.skip(4)
437 return obj
438
439 def __eq__(self, other):
440 if type(self) != type(other): return False
441 return True
442
Rich Lanec2ee4b82013-04-24 17:12:38 -0700443 def pretty_print(self, q):
444 q.text("copy_ttl_out {")
445 with q.group():
446 with q.indent(2):
447 q.breakable()
448 q.breakable()
449 q.text('}')
450
Rich Lane7dcdf022013-12-11 14:45:27 -0800451action.subtypes[11] = copy_ttl_out
452
453class dec_mpls_ttl(action):
Dan Talaycof6202252013-07-02 01:00:29 -0700454 type = 16
Rich Lanec2ee4b82013-04-24 17:12:38 -0700455
456 def __init__(self):
457 return
458
459 def pack(self):
460 packed = []
461 packed.append(struct.pack("!H", self.type))
462 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
463 packed.append('\x00' * 4)
464 length = sum([len(x) for x in packed])
465 packed[1] = struct.pack("!H", length)
466 return ''.join(packed)
467
468 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800469 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700470 obj = dec_mpls_ttl()
Dan Talaycof6202252013-07-02 01:00:29 -0700471 _type = reader.read("!H")[0]
472 assert(_type == 16)
473 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800474 orig_reader = reader
475 reader = orig_reader.slice(_len - (2 + 2))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700476 reader.skip(4)
477 return obj
478
479 def __eq__(self, other):
480 if type(self) != type(other): return False
481 return True
482
Rich Lanec2ee4b82013-04-24 17:12:38 -0700483 def pretty_print(self, q):
484 q.text("dec_mpls_ttl {")
485 with q.group():
486 with q.indent(2):
487 q.breakable()
488 q.breakable()
489 q.text('}')
490
Rich Lane7dcdf022013-12-11 14:45:27 -0800491action.subtypes[16] = dec_mpls_ttl
492
493class dec_nw_ttl(action):
Dan Talaycof6202252013-07-02 01:00:29 -0700494 type = 24
Rich Lanec2ee4b82013-04-24 17:12:38 -0700495
496 def __init__(self):
497 return
498
499 def pack(self):
500 packed = []
501 packed.append(struct.pack("!H", self.type))
502 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
503 packed.append('\x00' * 4)
504 length = sum([len(x) for x in packed])
505 packed[1] = struct.pack("!H", length)
506 return ''.join(packed)
507
508 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800509 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700510 obj = dec_nw_ttl()
Dan Talaycof6202252013-07-02 01:00:29 -0700511 _type = reader.read("!H")[0]
512 assert(_type == 24)
513 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800514 orig_reader = reader
515 reader = orig_reader.slice(_len - (2 + 2))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700516 reader.skip(4)
517 return obj
518
519 def __eq__(self, other):
520 if type(self) != type(other): return False
521 return True
522
Rich Lanec2ee4b82013-04-24 17:12:38 -0700523 def pretty_print(self, q):
524 q.text("dec_nw_ttl {")
525 with q.group():
526 with q.indent(2):
527 q.breakable()
528 q.breakable()
529 q.text('}')
530
Rich Lane7dcdf022013-12-11 14:45:27 -0800531action.subtypes[24] = dec_nw_ttl
532
533class group(action):
Dan Talaycof6202252013-07-02 01:00:29 -0700534 type = 22
Rich Lanec2ee4b82013-04-24 17:12:38 -0700535
536 def __init__(self, group_id=None):
537 if group_id != None:
538 self.group_id = group_id
539 else:
540 self.group_id = 0
541 return
542
543 def pack(self):
544 packed = []
545 packed.append(struct.pack("!H", self.type))
546 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
547 packed.append(struct.pack("!L", self.group_id))
548 length = sum([len(x) for x in packed])
549 packed[1] = struct.pack("!H", length)
550 return ''.join(packed)
551
552 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800553 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700554 obj = group()
Dan Talaycof6202252013-07-02 01:00:29 -0700555 _type = reader.read("!H")[0]
556 assert(_type == 22)
557 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800558 orig_reader = reader
559 reader = orig_reader.slice(_len - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700560 obj.group_id = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700561 return obj
562
563 def __eq__(self, other):
564 if type(self) != type(other): return False
565 if self.group_id != other.group_id: return False
566 return True
567
Rich Lanec2ee4b82013-04-24 17:12:38 -0700568 def pretty_print(self, q):
569 q.text("group {")
570 with q.group():
571 with q.indent(2):
572 q.breakable()
573 q.text("group_id = ");
574 q.text("%#x" % self.group_id)
575 q.breakable()
576 q.text('}')
577
Rich Lane7dcdf022013-12-11 14:45:27 -0800578action.subtypes[22] = group
579
580class nicira(experimenter):
581 subtypes = {}
582
Rich Lane95f7fc92014-01-27 17:08:16 -0800583 type = 65535
584 experimenter = 8992
585
586 def __init__(self, subtype=None):
587 if subtype != None:
588 self.subtype = subtype
589 else:
590 self.subtype = 0
591 return
592
593 def pack(self):
594 packed = []
595 packed.append(struct.pack("!H", self.type))
596 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
597 packed.append(struct.pack("!L", self.experimenter))
598 packed.append(struct.pack("!H", self.subtype))
599 packed.append('\x00' * 2)
600 packed.append('\x00' * 4)
601 length = sum([len(x) for x in packed])
602 packed[1] = struct.pack("!H", length)
603 return ''.join(packed)
604
Rich Lane7dcdf022013-12-11 14:45:27 -0800605 @staticmethod
606 def unpack(reader):
607 subtype, = reader.peek('!H', 8)
Rich Lane95f7fc92014-01-27 17:08:16 -0800608 subclass = nicira.subtypes.get(subtype)
609 if subclass:
610 return subclass.unpack(reader)
611
612 obj = nicira()
613 _type = reader.read("!H")[0]
614 assert(_type == 65535)
615 _len = reader.read("!H")[0]
616 orig_reader = reader
617 reader = orig_reader.slice(_len - (2 + 2))
618 _experimenter = reader.read("!L")[0]
619 assert(_experimenter == 8992)
620 obj.subtype = reader.read("!H")[0]
621 reader.skip(2)
622 reader.skip(4)
623 return obj
624
625 def __eq__(self, other):
626 if type(self) != type(other): return False
627 if self.subtype != other.subtype: return False
628 return True
629
630 def pretty_print(self, q):
631 q.text("nicira {")
632 with q.group():
633 with q.indent(2):
634 q.breakable()
635 q.breakable()
636 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -0800637
638experimenter.subtypes[8992] = nicira
639
640class nicira_dec_ttl(nicira):
Dan Talaycof6202252013-07-02 01:00:29 -0700641 type = 65535
642 experimenter = 8992
Rich Lanec2ee4b82013-04-24 17:12:38 -0700643 subtype = 18
644
645 def __init__(self):
646 return
647
648 def pack(self):
649 packed = []
650 packed.append(struct.pack("!H", self.type))
651 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
652 packed.append(struct.pack("!L", self.experimenter))
653 packed.append(struct.pack("!H", self.subtype))
654 packed.append('\x00' * 2)
655 packed.append('\x00' * 4)
656 length = sum([len(x) for x in packed])
657 packed[1] = struct.pack("!H", length)
658 return ''.join(packed)
659
660 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800661 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700662 obj = nicira_dec_ttl()
Dan Talaycof6202252013-07-02 01:00:29 -0700663 _type = reader.read("!H")[0]
664 assert(_type == 65535)
665 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800666 orig_reader = reader
667 reader = orig_reader.slice(_len - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700668 _experimenter = reader.read("!L")[0]
669 assert(_experimenter == 8992)
670 _subtype = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700671 assert(_subtype == 18)
672 reader.skip(2)
673 reader.skip(4)
674 return obj
675
676 def __eq__(self, other):
677 if type(self) != type(other): return False
678 return True
679
Rich Lanec2ee4b82013-04-24 17:12:38 -0700680 def pretty_print(self, q):
681 q.text("nicira_dec_ttl {")
682 with q.group():
683 with q.indent(2):
684 q.breakable()
685 q.breakable()
686 q.text('}')
687
Rich Lane7dcdf022013-12-11 14:45:27 -0800688nicira.subtypes[18] = nicira_dec_ttl
689
690class output(action):
Dan Talaycof6202252013-07-02 01:00:29 -0700691 type = 0
Rich Lanec2ee4b82013-04-24 17:12:38 -0700692
693 def __init__(self, port=None, max_len=None):
694 if port != None:
695 self.port = port
696 else:
697 self.port = 0
698 if max_len != None:
699 self.max_len = max_len
700 else:
701 self.max_len = 0
702 return
703
704 def pack(self):
705 packed = []
706 packed.append(struct.pack("!H", self.type))
707 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
Dan Talaycof6202252013-07-02 01:00:29 -0700708 packed.append(util.pack_port_no(self.port))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700709 packed.append(struct.pack("!H", self.max_len))
710 packed.append('\x00' * 6)
711 length = sum([len(x) for x in packed])
712 packed[1] = struct.pack("!H", length)
713 return ''.join(packed)
714
715 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800716 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700717 obj = output()
Dan Talaycof6202252013-07-02 01:00:29 -0700718 _type = reader.read("!H")[0]
719 assert(_type == 0)
720 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800721 orig_reader = reader
722 reader = orig_reader.slice(_len - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700723 obj.port = util.unpack_port_no(reader)
724 obj.max_len = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700725 reader.skip(6)
726 return obj
727
728 def __eq__(self, other):
729 if type(self) != type(other): return False
730 if self.port != other.port: return False
731 if self.max_len != other.max_len: return False
732 return True
733
Rich Lanec2ee4b82013-04-24 17:12:38 -0700734 def pretty_print(self, q):
735 q.text("output {")
736 with q.group():
737 with q.indent(2):
738 q.breakable()
739 q.text("port = ");
740 q.text(util.pretty_port(self.port))
741 q.text(","); q.breakable()
742 q.text("max_len = ");
743 q.text("%#x" % self.max_len)
744 q.breakable()
745 q.text('}')
746
Rich Lane7dcdf022013-12-11 14:45:27 -0800747action.subtypes[0] = output
748
749class pop_mpls(action):
Dan Talaycof6202252013-07-02 01:00:29 -0700750 type = 20
Rich Lanec2ee4b82013-04-24 17:12:38 -0700751
752 def __init__(self, ethertype=None):
753 if ethertype != None:
754 self.ethertype = ethertype
755 else:
756 self.ethertype = 0
757 return
758
759 def pack(self):
760 packed = []
761 packed.append(struct.pack("!H", self.type))
762 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
763 packed.append(struct.pack("!H", self.ethertype))
764 packed.append('\x00' * 2)
765 length = sum([len(x) for x in packed])
766 packed[1] = struct.pack("!H", length)
767 return ''.join(packed)
768
769 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800770 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700771 obj = pop_mpls()
Dan Talaycof6202252013-07-02 01:00:29 -0700772 _type = reader.read("!H")[0]
773 assert(_type == 20)
774 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800775 orig_reader = reader
776 reader = orig_reader.slice(_len - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700777 obj.ethertype = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700778 reader.skip(2)
779 return obj
780
781 def __eq__(self, other):
782 if type(self) != type(other): return False
783 if self.ethertype != other.ethertype: return False
784 return True
785
Rich Lanec2ee4b82013-04-24 17:12:38 -0700786 def pretty_print(self, q):
787 q.text("pop_mpls {")
788 with q.group():
789 with q.indent(2):
790 q.breakable()
791 q.text("ethertype = ");
792 q.text("%#x" % self.ethertype)
793 q.breakable()
794 q.text('}')
795
Rich Lane7dcdf022013-12-11 14:45:27 -0800796action.subtypes[20] = pop_mpls
797
798class pop_vlan(action):
Dan Talaycof6202252013-07-02 01:00:29 -0700799 type = 18
Rich Lanec2ee4b82013-04-24 17:12:38 -0700800
801 def __init__(self):
802 return
803
804 def pack(self):
805 packed = []
806 packed.append(struct.pack("!H", self.type))
807 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
808 packed.append('\x00' * 4)
809 length = sum([len(x) for x in packed])
810 packed[1] = struct.pack("!H", length)
811 return ''.join(packed)
812
813 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800814 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700815 obj = pop_vlan()
Dan Talaycof6202252013-07-02 01:00:29 -0700816 _type = reader.read("!H")[0]
817 assert(_type == 18)
818 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800819 orig_reader = reader
820 reader = orig_reader.slice(_len - (2 + 2))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700821 reader.skip(4)
822 return obj
823
824 def __eq__(self, other):
825 if type(self) != type(other): return False
826 return True
827
Rich Lanec2ee4b82013-04-24 17:12:38 -0700828 def pretty_print(self, q):
829 q.text("pop_vlan {")
830 with q.group():
831 with q.indent(2):
832 q.breakable()
833 q.breakable()
834 q.text('}')
835
Rich Lane7dcdf022013-12-11 14:45:27 -0800836action.subtypes[18] = pop_vlan
837
838class push_mpls(action):
Dan Talaycof6202252013-07-02 01:00:29 -0700839 type = 19
Rich Lanec2ee4b82013-04-24 17:12:38 -0700840
841 def __init__(self, ethertype=None):
842 if ethertype != None:
843 self.ethertype = ethertype
844 else:
845 self.ethertype = 0
846 return
847
848 def pack(self):
849 packed = []
850 packed.append(struct.pack("!H", self.type))
851 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
852 packed.append(struct.pack("!H", self.ethertype))
853 packed.append('\x00' * 2)
854 length = sum([len(x) for x in packed])
855 packed[1] = struct.pack("!H", length)
856 return ''.join(packed)
857
858 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800859 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700860 obj = push_mpls()
Dan Talaycof6202252013-07-02 01:00:29 -0700861 _type = reader.read("!H")[0]
862 assert(_type == 19)
863 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800864 orig_reader = reader
865 reader = orig_reader.slice(_len - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700866 obj.ethertype = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700867 reader.skip(2)
868 return obj
869
870 def __eq__(self, other):
871 if type(self) != type(other): return False
872 if self.ethertype != other.ethertype: return False
873 return True
874
Rich Lanec2ee4b82013-04-24 17:12:38 -0700875 def pretty_print(self, q):
876 q.text("push_mpls {")
877 with q.group():
878 with q.indent(2):
879 q.breakable()
880 q.text("ethertype = ");
881 q.text("%#x" % self.ethertype)
882 q.breakable()
883 q.text('}')
884
Rich Lane7dcdf022013-12-11 14:45:27 -0800885action.subtypes[19] = push_mpls
886
887class push_vlan(action):
Dan Talaycof6202252013-07-02 01:00:29 -0700888 type = 17
Rich Lanec2ee4b82013-04-24 17:12:38 -0700889
890 def __init__(self, ethertype=None):
891 if ethertype != None:
892 self.ethertype = ethertype
893 else:
894 self.ethertype = 0
895 return
896
897 def pack(self):
898 packed = []
899 packed.append(struct.pack("!H", self.type))
900 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
901 packed.append(struct.pack("!H", self.ethertype))
902 packed.append('\x00' * 2)
903 length = sum([len(x) for x in packed])
904 packed[1] = struct.pack("!H", length)
905 return ''.join(packed)
906
907 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800908 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700909 obj = push_vlan()
Dan Talaycof6202252013-07-02 01:00:29 -0700910 _type = reader.read("!H")[0]
911 assert(_type == 17)
912 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800913 orig_reader = reader
914 reader = orig_reader.slice(_len - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700915 obj.ethertype = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700916 reader.skip(2)
917 return obj
918
919 def __eq__(self, other):
920 if type(self) != type(other): return False
921 if self.ethertype != other.ethertype: return False
922 return True
923
Rich Lanec2ee4b82013-04-24 17:12:38 -0700924 def pretty_print(self, q):
925 q.text("push_vlan {")
926 with q.group():
927 with q.indent(2):
928 q.breakable()
929 q.text("ethertype = ");
930 q.text("%#x" % self.ethertype)
931 q.breakable()
932 q.text('}')
933
Rich Lane7dcdf022013-12-11 14:45:27 -0800934action.subtypes[17] = push_vlan
935
936class set_dl_dst(action):
Dan Talaycof6202252013-07-02 01:00:29 -0700937 type = 4
Rich Lanec2ee4b82013-04-24 17:12:38 -0700938
939 def __init__(self, dl_addr=None):
940 if dl_addr != None:
941 self.dl_addr = dl_addr
942 else:
943 self.dl_addr = [0,0,0,0,0,0]
944 return
945
946 def pack(self):
947 packed = []
948 packed.append(struct.pack("!H", self.type))
949 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
950 packed.append(struct.pack("!6B", *self.dl_addr))
951 packed.append('\x00' * 6)
952 length = sum([len(x) for x in packed])
953 packed[1] = struct.pack("!H", length)
954 return ''.join(packed)
955
956 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800957 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700958 obj = set_dl_dst()
Dan Talaycof6202252013-07-02 01:00:29 -0700959 _type = reader.read("!H")[0]
960 assert(_type == 4)
961 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800962 orig_reader = reader
963 reader = orig_reader.slice(_len - (2 + 2))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700964 obj.dl_addr = list(reader.read('!6B'))
965 reader.skip(6)
966 return obj
967
968 def __eq__(self, other):
969 if type(self) != type(other): return False
970 if self.dl_addr != other.dl_addr: return False
971 return True
972
Rich Lanec2ee4b82013-04-24 17:12:38 -0700973 def pretty_print(self, q):
974 q.text("set_dl_dst {")
975 with q.group():
976 with q.indent(2):
977 q.breakable()
978 q.text("dl_addr = ");
979 q.text(util.pretty_mac(self.dl_addr))
980 q.breakable()
981 q.text('}')
982
Rich Lane7dcdf022013-12-11 14:45:27 -0800983action.subtypes[4] = set_dl_dst
984
985class set_dl_src(action):
Dan Talaycof6202252013-07-02 01:00:29 -0700986 type = 3
Rich Lanec2ee4b82013-04-24 17:12:38 -0700987
988 def __init__(self, dl_addr=None):
989 if dl_addr != None:
990 self.dl_addr = dl_addr
991 else:
992 self.dl_addr = [0,0,0,0,0,0]
993 return
994
995 def pack(self):
996 packed = []
997 packed.append(struct.pack("!H", self.type))
998 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
999 packed.append(struct.pack("!6B", *self.dl_addr))
1000 packed.append('\x00' * 6)
1001 length = sum([len(x) for x in packed])
1002 packed[1] = struct.pack("!H", length)
1003 return ''.join(packed)
1004
1005 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001006 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001007 obj = set_dl_src()
Dan Talaycof6202252013-07-02 01:00:29 -07001008 _type = reader.read("!H")[0]
1009 assert(_type == 3)
1010 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001011 orig_reader = reader
1012 reader = orig_reader.slice(_len - (2 + 2))
Rich Lanec2ee4b82013-04-24 17:12:38 -07001013 obj.dl_addr = list(reader.read('!6B'))
1014 reader.skip(6)
1015 return obj
1016
1017 def __eq__(self, other):
1018 if type(self) != type(other): return False
1019 if self.dl_addr != other.dl_addr: return False
1020 return True
1021
Rich Lanec2ee4b82013-04-24 17:12:38 -07001022 def pretty_print(self, q):
1023 q.text("set_dl_src {")
1024 with q.group():
1025 with q.indent(2):
1026 q.breakable()
1027 q.text("dl_addr = ");
1028 q.text(util.pretty_mac(self.dl_addr))
1029 q.breakable()
1030 q.text('}')
1031
Rich Lane7dcdf022013-12-11 14:45:27 -08001032action.subtypes[3] = set_dl_src
1033
1034class set_mpls_label(action):
Dan Talaycof6202252013-07-02 01:00:29 -07001035 type = 13
Rich Lanec2ee4b82013-04-24 17:12:38 -07001036
1037 def __init__(self, mpls_label=None):
1038 if mpls_label != None:
1039 self.mpls_label = mpls_label
1040 else:
1041 self.mpls_label = 0
1042 return
1043
1044 def pack(self):
1045 packed = []
1046 packed.append(struct.pack("!H", self.type))
1047 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
1048 packed.append(struct.pack("!L", self.mpls_label))
1049 length = sum([len(x) for x in packed])
1050 packed[1] = struct.pack("!H", length)
1051 return ''.join(packed)
1052
1053 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001054 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001055 obj = set_mpls_label()
Dan Talaycof6202252013-07-02 01:00:29 -07001056 _type = reader.read("!H")[0]
1057 assert(_type == 13)
1058 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001059 orig_reader = reader
1060 reader = orig_reader.slice(_len - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001061 obj.mpls_label = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001062 return obj
1063
1064 def __eq__(self, other):
1065 if type(self) != type(other): return False
1066 if self.mpls_label != other.mpls_label: return False
1067 return True
1068
Rich Lanec2ee4b82013-04-24 17:12:38 -07001069 def pretty_print(self, q):
1070 q.text("set_mpls_label {")
1071 with q.group():
1072 with q.indent(2):
1073 q.breakable()
1074 q.text("mpls_label = ");
1075 q.text("%#x" % self.mpls_label)
1076 q.breakable()
1077 q.text('}')
1078
Rich Lane7dcdf022013-12-11 14:45:27 -08001079action.subtypes[13] = set_mpls_label
1080
1081class set_mpls_tc(action):
Dan Talaycof6202252013-07-02 01:00:29 -07001082 type = 14
Rich Lanec2ee4b82013-04-24 17:12:38 -07001083
1084 def __init__(self, mpls_tc=None):
1085 if mpls_tc != None:
1086 self.mpls_tc = mpls_tc
1087 else:
1088 self.mpls_tc = 0
1089 return
1090
1091 def pack(self):
1092 packed = []
1093 packed.append(struct.pack("!H", self.type))
1094 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
1095 packed.append(struct.pack("!B", self.mpls_tc))
1096 packed.append('\x00' * 3)
1097 length = sum([len(x) for x in packed])
1098 packed[1] = struct.pack("!H", length)
1099 return ''.join(packed)
1100
1101 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001102 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001103 obj = set_mpls_tc()
Dan Talaycof6202252013-07-02 01:00:29 -07001104 _type = reader.read("!H")[0]
1105 assert(_type == 14)
1106 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001107 orig_reader = reader
1108 reader = orig_reader.slice(_len - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001109 obj.mpls_tc = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001110 reader.skip(3)
1111 return obj
1112
1113 def __eq__(self, other):
1114 if type(self) != type(other): return False
1115 if self.mpls_tc != other.mpls_tc: return False
1116 return True
1117
Rich Lanec2ee4b82013-04-24 17:12:38 -07001118 def pretty_print(self, q):
1119 q.text("set_mpls_tc {")
1120 with q.group():
1121 with q.indent(2):
1122 q.breakable()
1123 q.text("mpls_tc = ");
1124 q.text("%#x" % self.mpls_tc)
1125 q.breakable()
1126 q.text('}')
1127
Rich Lane7dcdf022013-12-11 14:45:27 -08001128action.subtypes[14] = set_mpls_tc
1129
1130class set_mpls_ttl(action):
Dan Talaycof6202252013-07-02 01:00:29 -07001131 type = 15
Rich Lanec2ee4b82013-04-24 17:12:38 -07001132
1133 def __init__(self, mpls_ttl=None):
1134 if mpls_ttl != None:
1135 self.mpls_ttl = mpls_ttl
1136 else:
1137 self.mpls_ttl = 0
1138 return
1139
1140 def pack(self):
1141 packed = []
1142 packed.append(struct.pack("!H", self.type))
1143 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
1144 packed.append(struct.pack("!B", self.mpls_ttl))
1145 packed.append('\x00' * 3)
1146 length = sum([len(x) for x in packed])
1147 packed[1] = struct.pack("!H", length)
1148 return ''.join(packed)
1149
1150 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001151 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001152 obj = set_mpls_ttl()
Dan Talaycof6202252013-07-02 01:00:29 -07001153 _type = reader.read("!H")[0]
1154 assert(_type == 15)
1155 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001156 orig_reader = reader
1157 reader = orig_reader.slice(_len - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001158 obj.mpls_ttl = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001159 reader.skip(3)
1160 return obj
1161
1162 def __eq__(self, other):
1163 if type(self) != type(other): return False
1164 if self.mpls_ttl != other.mpls_ttl: return False
1165 return True
1166
Rich Lanec2ee4b82013-04-24 17:12:38 -07001167 def pretty_print(self, q):
1168 q.text("set_mpls_ttl {")
1169 with q.group():
1170 with q.indent(2):
1171 q.breakable()
1172 q.text("mpls_ttl = ");
1173 q.text("%#x" % self.mpls_ttl)
1174 q.breakable()
1175 q.text('}')
1176
Rich Lane7dcdf022013-12-11 14:45:27 -08001177action.subtypes[15] = set_mpls_ttl
1178
1179class set_nw_dst(action):
Dan Talaycof6202252013-07-02 01:00:29 -07001180 type = 6
Rich Lanec2ee4b82013-04-24 17:12:38 -07001181
1182 def __init__(self, nw_addr=None):
1183 if nw_addr != None:
1184 self.nw_addr = nw_addr
1185 else:
1186 self.nw_addr = 0
1187 return
1188
1189 def pack(self):
1190 packed = []
1191 packed.append(struct.pack("!H", self.type))
1192 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
1193 packed.append(struct.pack("!L", self.nw_addr))
1194 length = sum([len(x) for x in packed])
1195 packed[1] = struct.pack("!H", length)
1196 return ''.join(packed)
1197
1198 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001199 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001200 obj = set_nw_dst()
Dan Talaycof6202252013-07-02 01:00:29 -07001201 _type = reader.read("!H")[0]
1202 assert(_type == 6)
1203 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001204 orig_reader = reader
1205 reader = orig_reader.slice(_len - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001206 obj.nw_addr = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001207 return obj
1208
1209 def __eq__(self, other):
1210 if type(self) != type(other): return False
1211 if self.nw_addr != other.nw_addr: return False
1212 return True
1213
Rich Lanec2ee4b82013-04-24 17:12:38 -07001214 def pretty_print(self, q):
1215 q.text("set_nw_dst {")
1216 with q.group():
1217 with q.indent(2):
1218 q.breakable()
1219 q.text("nw_addr = ");
1220 q.text("%#x" % self.nw_addr)
1221 q.breakable()
1222 q.text('}')
1223
Rich Lane7dcdf022013-12-11 14:45:27 -08001224action.subtypes[6] = set_nw_dst
1225
1226class set_nw_ecn(action):
Dan Talaycof6202252013-07-02 01:00:29 -07001227 type = 8
Rich Lanec2ee4b82013-04-24 17:12:38 -07001228
1229 def __init__(self, nw_ecn=None):
1230 if nw_ecn != None:
1231 self.nw_ecn = nw_ecn
1232 else:
1233 self.nw_ecn = 0
1234 return
1235
1236 def pack(self):
1237 packed = []
1238 packed.append(struct.pack("!H", self.type))
1239 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
1240 packed.append(struct.pack("!B", self.nw_ecn))
1241 packed.append('\x00' * 3)
1242 length = sum([len(x) for x in packed])
1243 packed[1] = struct.pack("!H", length)
1244 return ''.join(packed)
1245
1246 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001247 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001248 obj = set_nw_ecn()
Dan Talaycof6202252013-07-02 01:00:29 -07001249 _type = reader.read("!H")[0]
1250 assert(_type == 8)
1251 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001252 orig_reader = reader
1253 reader = orig_reader.slice(_len - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001254 obj.nw_ecn = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001255 reader.skip(3)
1256 return obj
1257
1258 def __eq__(self, other):
1259 if type(self) != type(other): return False
1260 if self.nw_ecn != other.nw_ecn: return False
1261 return True
1262
Rich Lanec2ee4b82013-04-24 17:12:38 -07001263 def pretty_print(self, q):
1264 q.text("set_nw_ecn {")
1265 with q.group():
1266 with q.indent(2):
1267 q.breakable()
1268 q.text("nw_ecn = ");
1269 q.text("%#x" % self.nw_ecn)
1270 q.breakable()
1271 q.text('}')
1272
Rich Lane7dcdf022013-12-11 14:45:27 -08001273action.subtypes[8] = set_nw_ecn
1274
1275class set_nw_src(action):
Dan Talaycof6202252013-07-02 01:00:29 -07001276 type = 5
Rich Lanec2ee4b82013-04-24 17:12:38 -07001277
1278 def __init__(self, nw_addr=None):
1279 if nw_addr != None:
1280 self.nw_addr = nw_addr
1281 else:
1282 self.nw_addr = 0
1283 return
1284
1285 def pack(self):
1286 packed = []
1287 packed.append(struct.pack("!H", self.type))
1288 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
1289 packed.append(struct.pack("!L", self.nw_addr))
1290 length = sum([len(x) for x in packed])
1291 packed[1] = struct.pack("!H", length)
1292 return ''.join(packed)
1293
1294 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001295 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001296 obj = set_nw_src()
Dan Talaycof6202252013-07-02 01:00:29 -07001297 _type = reader.read("!H")[0]
1298 assert(_type == 5)
1299 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001300 orig_reader = reader
1301 reader = orig_reader.slice(_len - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001302 obj.nw_addr = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001303 return obj
1304
1305 def __eq__(self, other):
1306 if type(self) != type(other): return False
1307 if self.nw_addr != other.nw_addr: return False
1308 return True
1309
Rich Lanec2ee4b82013-04-24 17:12:38 -07001310 def pretty_print(self, q):
1311 q.text("set_nw_src {")
1312 with q.group():
1313 with q.indent(2):
1314 q.breakable()
1315 q.text("nw_addr = ");
1316 q.text("%#x" % self.nw_addr)
1317 q.breakable()
1318 q.text('}')
1319
Rich Lane7dcdf022013-12-11 14:45:27 -08001320action.subtypes[5] = set_nw_src
1321
1322class set_nw_tos(action):
Dan Talaycof6202252013-07-02 01:00:29 -07001323 type = 7
Rich Lanec2ee4b82013-04-24 17:12:38 -07001324
1325 def __init__(self, nw_tos=None):
1326 if nw_tos != None:
1327 self.nw_tos = nw_tos
1328 else:
1329 self.nw_tos = 0
1330 return
1331
1332 def pack(self):
1333 packed = []
1334 packed.append(struct.pack("!H", self.type))
1335 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
1336 packed.append(struct.pack("!B", self.nw_tos))
1337 packed.append('\x00' * 3)
1338 length = sum([len(x) for x in packed])
1339 packed[1] = struct.pack("!H", length)
1340 return ''.join(packed)
1341
1342 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001343 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001344 obj = set_nw_tos()
Dan Talaycof6202252013-07-02 01:00:29 -07001345 _type = reader.read("!H")[0]
1346 assert(_type == 7)
1347 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001348 orig_reader = reader
1349 reader = orig_reader.slice(_len - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001350 obj.nw_tos = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001351 reader.skip(3)
1352 return obj
1353
1354 def __eq__(self, other):
1355 if type(self) != type(other): return False
1356 if self.nw_tos != other.nw_tos: return False
1357 return True
1358
Rich Lanec2ee4b82013-04-24 17:12:38 -07001359 def pretty_print(self, q):
1360 q.text("set_nw_tos {")
1361 with q.group():
1362 with q.indent(2):
1363 q.breakable()
1364 q.text("nw_tos = ");
1365 q.text("%#x" % self.nw_tos)
1366 q.breakable()
1367 q.text('}')
1368
Rich Lane7dcdf022013-12-11 14:45:27 -08001369action.subtypes[7] = set_nw_tos
1370
1371class set_nw_ttl(action):
Dan Talaycof6202252013-07-02 01:00:29 -07001372 type = 23
Rich Lanec2ee4b82013-04-24 17:12:38 -07001373
1374 def __init__(self, nw_ttl=None):
1375 if nw_ttl != None:
1376 self.nw_ttl = nw_ttl
1377 else:
1378 self.nw_ttl = 0
1379 return
1380
1381 def pack(self):
1382 packed = []
1383 packed.append(struct.pack("!H", self.type))
1384 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
1385 packed.append(struct.pack("!B", self.nw_ttl))
1386 packed.append('\x00' * 3)
1387 length = sum([len(x) for x in packed])
1388 packed[1] = struct.pack("!H", length)
1389 return ''.join(packed)
1390
1391 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001392 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001393 obj = set_nw_ttl()
Dan Talaycof6202252013-07-02 01:00:29 -07001394 _type = reader.read("!H")[0]
1395 assert(_type == 23)
1396 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001397 orig_reader = reader
1398 reader = orig_reader.slice(_len - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001399 obj.nw_ttl = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001400 reader.skip(3)
1401 return obj
1402
1403 def __eq__(self, other):
1404 if type(self) != type(other): return False
1405 if self.nw_ttl != other.nw_ttl: return False
1406 return True
1407
Rich Lanec2ee4b82013-04-24 17:12:38 -07001408 def pretty_print(self, q):
1409 q.text("set_nw_ttl {")
1410 with q.group():
1411 with q.indent(2):
1412 q.breakable()
1413 q.text("nw_ttl = ");
1414 q.text("%#x" % self.nw_ttl)
1415 q.breakable()
1416 q.text('}')
1417
Rich Lane7dcdf022013-12-11 14:45:27 -08001418action.subtypes[23] = set_nw_ttl
1419
1420class set_queue(action):
Dan Talaycof6202252013-07-02 01:00:29 -07001421 type = 21
Rich Lanec2ee4b82013-04-24 17:12:38 -07001422
1423 def __init__(self, queue_id=None):
1424 if queue_id != None:
1425 self.queue_id = queue_id
1426 else:
1427 self.queue_id = 0
1428 return
1429
1430 def pack(self):
1431 packed = []
1432 packed.append(struct.pack("!H", self.type))
1433 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
1434 packed.append(struct.pack("!L", self.queue_id))
1435 length = sum([len(x) for x in packed])
1436 packed[1] = struct.pack("!H", length)
1437 return ''.join(packed)
1438
1439 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001440 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001441 obj = set_queue()
Dan Talaycof6202252013-07-02 01:00:29 -07001442 _type = reader.read("!H")[0]
1443 assert(_type == 21)
1444 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001445 orig_reader = reader
1446 reader = orig_reader.slice(_len - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001447 obj.queue_id = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001448 return obj
1449
1450 def __eq__(self, other):
1451 if type(self) != type(other): return False
1452 if self.queue_id != other.queue_id: return False
1453 return True
1454
Rich Lanec2ee4b82013-04-24 17:12:38 -07001455 def pretty_print(self, q):
1456 q.text("set_queue {")
1457 with q.group():
1458 with q.indent(2):
1459 q.breakable()
1460 q.text("queue_id = ");
1461 q.text("%#x" % self.queue_id)
1462 q.breakable()
1463 q.text('}')
1464
Rich Lane7dcdf022013-12-11 14:45:27 -08001465action.subtypes[21] = set_queue
1466
1467class set_tp_dst(action):
Dan Talaycof6202252013-07-02 01:00:29 -07001468 type = 10
Rich Lanec2ee4b82013-04-24 17:12:38 -07001469
1470 def __init__(self, tp_port=None):
1471 if tp_port != None:
1472 self.tp_port = tp_port
1473 else:
1474 self.tp_port = 0
1475 return
1476
1477 def pack(self):
1478 packed = []
1479 packed.append(struct.pack("!H", self.type))
1480 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
1481 packed.append(struct.pack("!H", self.tp_port))
1482 packed.append('\x00' * 2)
1483 length = sum([len(x) for x in packed])
1484 packed[1] = struct.pack("!H", length)
1485 return ''.join(packed)
1486
1487 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001488 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001489 obj = set_tp_dst()
Dan Talaycof6202252013-07-02 01:00:29 -07001490 _type = reader.read("!H")[0]
1491 assert(_type == 10)
1492 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001493 orig_reader = reader
1494 reader = orig_reader.slice(_len - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001495 obj.tp_port = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001496 reader.skip(2)
1497 return obj
1498
1499 def __eq__(self, other):
1500 if type(self) != type(other): return False
1501 if self.tp_port != other.tp_port: return False
1502 return True
1503
Rich Lanec2ee4b82013-04-24 17:12:38 -07001504 def pretty_print(self, q):
1505 q.text("set_tp_dst {")
1506 with q.group():
1507 with q.indent(2):
1508 q.breakable()
1509 q.text("tp_port = ");
1510 q.text("%#x" % self.tp_port)
1511 q.breakable()
1512 q.text('}')
1513
Rich Lane7dcdf022013-12-11 14:45:27 -08001514action.subtypes[10] = set_tp_dst
1515
1516class set_tp_src(action):
Dan Talaycof6202252013-07-02 01:00:29 -07001517 type = 9
Rich Lanec2ee4b82013-04-24 17:12:38 -07001518
1519 def __init__(self, tp_port=None):
1520 if tp_port != None:
1521 self.tp_port = tp_port
1522 else:
1523 self.tp_port = 0
1524 return
1525
1526 def pack(self):
1527 packed = []
1528 packed.append(struct.pack("!H", self.type))
1529 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
1530 packed.append(struct.pack("!H", self.tp_port))
1531 packed.append('\x00' * 2)
1532 length = sum([len(x) for x in packed])
1533 packed[1] = struct.pack("!H", length)
1534 return ''.join(packed)
1535
1536 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001537 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001538 obj = set_tp_src()
Dan Talaycof6202252013-07-02 01:00:29 -07001539 _type = reader.read("!H")[0]
1540 assert(_type == 9)
1541 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001542 orig_reader = reader
1543 reader = orig_reader.slice(_len - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001544 obj.tp_port = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001545 reader.skip(2)
1546 return obj
1547
1548 def __eq__(self, other):
1549 if type(self) != type(other): return False
1550 if self.tp_port != other.tp_port: return False
1551 return True
1552
Rich Lanec2ee4b82013-04-24 17:12:38 -07001553 def pretty_print(self, q):
1554 q.text("set_tp_src {")
1555 with q.group():
1556 with q.indent(2):
1557 q.breakable()
1558 q.text("tp_port = ");
1559 q.text("%#x" % self.tp_port)
1560 q.breakable()
1561 q.text('}')
1562
Rich Lane7dcdf022013-12-11 14:45:27 -08001563action.subtypes[9] = set_tp_src
1564
1565class set_vlan_pcp(action):
Dan Talaycof6202252013-07-02 01:00:29 -07001566 type = 2
Rich Lanec2ee4b82013-04-24 17:12:38 -07001567
1568 def __init__(self, vlan_pcp=None):
1569 if vlan_pcp != None:
1570 self.vlan_pcp = vlan_pcp
1571 else:
1572 self.vlan_pcp = 0
1573 return
1574
1575 def pack(self):
1576 packed = []
1577 packed.append(struct.pack("!H", self.type))
1578 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
1579 packed.append(struct.pack("!B", self.vlan_pcp))
1580 packed.append('\x00' * 3)
1581 length = sum([len(x) for x in packed])
1582 packed[1] = struct.pack("!H", length)
1583 return ''.join(packed)
1584
1585 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001586 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001587 obj = set_vlan_pcp()
Dan Talaycof6202252013-07-02 01:00:29 -07001588 _type = reader.read("!H")[0]
1589 assert(_type == 2)
1590 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001591 orig_reader = reader
1592 reader = orig_reader.slice(_len - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001593 obj.vlan_pcp = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001594 reader.skip(3)
1595 return obj
1596
1597 def __eq__(self, other):
1598 if type(self) != type(other): return False
1599 if self.vlan_pcp != other.vlan_pcp: return False
1600 return True
1601
Rich Lanec2ee4b82013-04-24 17:12:38 -07001602 def pretty_print(self, q):
1603 q.text("set_vlan_pcp {")
1604 with q.group():
1605 with q.indent(2):
1606 q.breakable()
1607 q.text("vlan_pcp = ");
1608 q.text("%#x" % self.vlan_pcp)
1609 q.breakable()
1610 q.text('}')
1611
Rich Lane7dcdf022013-12-11 14:45:27 -08001612action.subtypes[2] = set_vlan_pcp
1613
1614class set_vlan_vid(action):
Dan Talaycof6202252013-07-02 01:00:29 -07001615 type = 1
Rich Lanec2ee4b82013-04-24 17:12:38 -07001616
1617 def __init__(self, vlan_vid=None):
1618 if vlan_vid != None:
1619 self.vlan_vid = vlan_vid
1620 else:
1621 self.vlan_vid = 0
1622 return
1623
1624 def pack(self):
1625 packed = []
1626 packed.append(struct.pack("!H", self.type))
1627 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
1628 packed.append(struct.pack("!H", self.vlan_vid))
1629 packed.append('\x00' * 2)
1630 length = sum([len(x) for x in packed])
1631 packed[1] = struct.pack("!H", length)
1632 return ''.join(packed)
1633
1634 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001635 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001636 obj = set_vlan_vid()
Dan Talaycof6202252013-07-02 01:00:29 -07001637 _type = reader.read("!H")[0]
1638 assert(_type == 1)
1639 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001640 orig_reader = reader
1641 reader = orig_reader.slice(_len - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001642 obj.vlan_vid = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001643 reader.skip(2)
1644 return obj
1645
1646 def __eq__(self, other):
1647 if type(self) != type(other): return False
1648 if self.vlan_vid != other.vlan_vid: return False
1649 return True
1650
Rich Lanec2ee4b82013-04-24 17:12:38 -07001651 def pretty_print(self, q):
1652 q.text("set_vlan_vid {")
1653 with q.group():
1654 with q.indent(2):
1655 q.breakable()
1656 q.text("vlan_vid = ");
1657 q.text("%#x" % self.vlan_vid)
1658 q.breakable()
1659 q.text('}')
1660
Rich Lane7dcdf022013-12-11 14:45:27 -08001661action.subtypes[1] = set_vlan_vid
Rich Lanec2ee4b82013-04-24 17:12:38 -07001662
Rich Lanec2ee4b82013-04-24 17:12:38 -07001663