blob: 879b2467f96ce006ae03c6075c6b2a822a0d8b5e [file] [log] [blame]
Rich Laneca3da272013-05-05 09:07:33 -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 Laneca3da272013-05-05 09:07:33 -07005
Rich Lane7dcdf022013-12-11 14:45:27 -08006# Automatically generated by LOXI from template module.py
Rich Laneca3da272013-05-05 09:07:33 -07007# Do not modify
8
9import struct
Rich Lane7dcdf022013-12-11 14:45:27 -080010import loxi
Rich Laneca3da272013-05-05 09:07:33 -070011import util
12import loxi.generic_util
Rich Laneca3da272013-05-05 09:07:33 -070013
Rich Lanee2567702015-01-26 15:04:35 -080014import sys
15ofp = sys.modules['loxi.of13']
16
Rich Lane7dcdf022013-12-11 14:45:27 -080017class instruction(loxi.OFObject):
18 subtypes = {}
Rich Laneca3da272013-05-05 09:07:33 -070019
Rich Lane95f7fc92014-01-27 17:08:16 -080020
21 def __init__(self, type=None):
22 if type != None:
23 self.type = type
24 else:
25 self.type = 0
26 return
27
28 def pack(self):
29 packed = []
30 packed.append(struct.pack("!H", self.type))
31 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
32 length = sum([len(x) for x in packed])
33 packed[1] = struct.pack("!H", length)
34 return ''.join(packed)
35
Rich Lane7dcdf022013-12-11 14:45:27 -080036 @staticmethod
37 def unpack(reader):
38 subtype, = reader.peek('!H', 0)
Rich Lane95f7fc92014-01-27 17:08:16 -080039 subclass = instruction.subtypes.get(subtype)
40 if subclass:
41 return subclass.unpack(reader)
42
43 obj = instruction()
44 obj.type = reader.read("!H")[0]
45 _len = reader.read("!H")[0]
46 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080047 reader = orig_reader.slice(_len, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -080048 return obj
49
50 def __eq__(self, other):
51 if type(self) != type(other): return False
52 if self.type != other.type: return False
53 return True
54
55 def pretty_print(self, q):
56 q.text("instruction {")
57 with q.group():
58 with q.indent(2):
59 q.breakable()
60 q.breakable()
61 q.text('}')
Rich Laneca3da272013-05-05 09:07:33 -070062
Rich Lane7dcdf022013-12-11 14:45:27 -080063
64class apply_actions(instruction):
Dan Talaycof6202252013-07-02 01:00:29 -070065 type = 4
Rich Laneca3da272013-05-05 09:07:33 -070066
67 def __init__(self, actions=None):
68 if actions != None:
69 self.actions = actions
70 else:
71 self.actions = []
72 return
73
74 def pack(self):
75 packed = []
76 packed.append(struct.pack("!H", self.type))
77 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
78 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080079 packed.append(loxi.generic_util.pack_list(self.actions))
Rich Laneca3da272013-05-05 09:07:33 -070080 length = sum([len(x) for x in packed])
81 packed[1] = struct.pack("!H", length)
82 return ''.join(packed)
83
84 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080085 def unpack(reader):
Rich Laneca3da272013-05-05 09:07:33 -070086 obj = apply_actions()
Dan Talaycof6202252013-07-02 01:00:29 -070087 _type = reader.read("!H")[0]
88 assert(_type == 4)
89 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -080090 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080091 reader = orig_reader.slice(_len, 4)
Rich Laneca3da272013-05-05 09:07:33 -070092 reader.skip(4)
Rich Lanee2567702015-01-26 15:04:35 -080093 obj.actions = loxi.generic_util.unpack_list(reader, ofp.action.action.unpack)
Rich Laneca3da272013-05-05 09:07:33 -070094 return obj
95
96 def __eq__(self, other):
97 if type(self) != type(other): return False
98 if self.actions != other.actions: return False
99 return True
100
Rich Laneca3da272013-05-05 09:07:33 -0700101 def pretty_print(self, q):
102 q.text("apply_actions {")
103 with q.group():
104 with q.indent(2):
105 q.breakable()
106 q.text("actions = ");
107 q.pp(self.actions)
108 q.breakable()
109 q.text('}')
110
Rich Lane7dcdf022013-12-11 14:45:27 -0800111instruction.subtypes[4] = apply_actions
112
113class experimenter(instruction):
114 subtypes = {}
115
Rich Lane95f7fc92014-01-27 17:08:16 -0800116 type = 65535
117
118 def __init__(self, experimenter=None, data=None):
119 if experimenter != None:
120 self.experimenter = experimenter
121 else:
122 self.experimenter = 0
123 if data != None:
124 self.data = data
125 else:
126 self.data = ''
127 return
128
129 def pack(self):
130 packed = []
131 packed.append(struct.pack("!H", self.type))
132 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
133 packed.append(struct.pack("!L", self.experimenter))
134 packed.append(self.data)
135 length = sum([len(x) for x in packed])
136 packed[1] = struct.pack("!H", length)
137 return ''.join(packed)
138
Rich Lane7dcdf022013-12-11 14:45:27 -0800139 @staticmethod
140 def unpack(reader):
141 subtype, = reader.peek('!L', 4)
Rich Lane95f7fc92014-01-27 17:08:16 -0800142 subclass = experimenter.subtypes.get(subtype)
143 if subclass:
144 return subclass.unpack(reader)
145
146 obj = experimenter()
147 _type = reader.read("!H")[0]
148 assert(_type == 65535)
149 _len = reader.read("!H")[0]
150 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800151 reader = orig_reader.slice(_len, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -0800152 obj.experimenter = reader.read("!L")[0]
153 obj.data = str(reader.read_all())
154 return obj
155
156 def __eq__(self, other):
157 if type(self) != type(other): return False
158 if self.experimenter != other.experimenter: return False
159 if self.data != other.data: return False
160 return True
161
162 def pretty_print(self, q):
163 q.text("experimenter {")
164 with q.group():
165 with q.indent(2):
166 q.breakable()
167 q.text("data = ");
168 q.pp(self.data)
169 q.breakable()
170 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -0800171
172instruction.subtypes[65535] = experimenter
173
174class bsn(experimenter):
175 subtypes = {}
176
Rich Lane95f7fc92014-01-27 17:08:16 -0800177 type = 65535
178 experimenter = 6035143
179
180 def __init__(self, subtype=None):
181 if subtype != None:
182 self.subtype = subtype
183 else:
184 self.subtype = 0
185 return
186
187 def pack(self):
188 packed = []
189 packed.append(struct.pack("!H", self.type))
190 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
191 packed.append(struct.pack("!L", self.experimenter))
192 packed.append(struct.pack("!L", self.subtype))
193 packed.append('\x00' * 4)
194 length = sum([len(x) for x in packed])
195 packed[1] = struct.pack("!H", length)
196 return ''.join(packed)
197
Rich Lane7dcdf022013-12-11 14:45:27 -0800198 @staticmethod
199 def unpack(reader):
200 subtype, = reader.peek('!L', 8)
Rich Lane95f7fc92014-01-27 17:08:16 -0800201 subclass = bsn.subtypes.get(subtype)
202 if subclass:
203 return subclass.unpack(reader)
204
205 obj = bsn()
206 _type = reader.read("!H")[0]
207 assert(_type == 65535)
208 _len = reader.read("!H")[0]
209 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800210 reader = orig_reader.slice(_len, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -0800211 _experimenter = reader.read("!L")[0]
212 assert(_experimenter == 6035143)
213 obj.subtype = reader.read("!L")[0]
214 reader.skip(4)
215 return obj
216
217 def __eq__(self, other):
218 if type(self) != type(other): return False
219 if self.subtype != other.subtype: return False
220 return True
221
222 def pretty_print(self, q):
223 q.text("bsn {")
224 with q.group():
225 with q.indent(2):
226 q.breakable()
227 q.breakable()
228 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -0800229
230experimenter.subtypes[6035143] = bsn
231
Rich Lane5454b682014-01-14 17:07:36 -0800232class bsn_arp_offload(bsn):
233 type = 65535
234 experimenter = 6035143
235 subtype = 1
236
237 def __init__(self):
238 return
239
240 def pack(self):
241 packed = []
242 packed.append(struct.pack("!H", self.type))
243 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
244 packed.append(struct.pack("!L", self.experimenter))
245 packed.append(struct.pack("!L", self.subtype))
246 packed.append('\x00' * 4)
247 length = sum([len(x) for x in packed])
248 packed[1] = struct.pack("!H", length)
249 return ''.join(packed)
250
251 @staticmethod
252 def unpack(reader):
253 obj = bsn_arp_offload()
254 _type = reader.read("!H")[0]
255 assert(_type == 65535)
256 _len = reader.read("!H")[0]
257 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800258 reader = orig_reader.slice(_len, 4)
Rich Lane5454b682014-01-14 17:07:36 -0800259 _experimenter = reader.read("!L")[0]
260 assert(_experimenter == 6035143)
261 _subtype = reader.read("!L")[0]
262 assert(_subtype == 1)
263 reader.skip(4)
264 return obj
265
266 def __eq__(self, other):
267 if type(self) != type(other): return False
268 return True
269
270 def pretty_print(self, q):
271 q.text("bsn_arp_offload {")
272 with q.group():
273 with q.indent(2):
274 q.breakable()
275 q.breakable()
276 q.text('}')
277
278bsn.subtypes[1] = bsn_arp_offload
279
Harshmeet Singh301f7172014-12-08 13:07:29 -0800280class bsn_auto_negotiation(bsn):
281 type = 65535
282 experimenter = 6035143
283 subtype = 11
284
285 def __init__(self):
286 return
287
288 def pack(self):
289 packed = []
290 packed.append(struct.pack("!H", self.type))
291 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
292 packed.append(struct.pack("!L", self.experimenter))
293 packed.append(struct.pack("!L", self.subtype))
294 packed.append('\x00' * 4)
295 length = sum([len(x) for x in packed])
296 packed[1] = struct.pack("!H", length)
297 return ''.join(packed)
298
299 @staticmethod
300 def unpack(reader):
301 obj = bsn_auto_negotiation()
302 _type = reader.read("!H")[0]
303 assert(_type == 65535)
304 _len = reader.read("!H")[0]
305 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800306 reader = orig_reader.slice(_len, 4)
Harshmeet Singh301f7172014-12-08 13:07:29 -0800307 _experimenter = reader.read("!L")[0]
308 assert(_experimenter == 6035143)
309 _subtype = reader.read("!L")[0]
310 assert(_subtype == 11)
311 reader.skip(4)
312 return obj
313
314 def __eq__(self, other):
315 if type(self) != type(other): return False
316 return True
317
318 def pretty_print(self, q):
319 q.text("bsn_auto_negotiation {")
320 with q.group():
321 with q.indent(2):
322 q.breakable()
323 q.breakable()
324 q.text('}')
325
326bsn.subtypes[11] = bsn_auto_negotiation
327
Rich Lane9ec3fca2014-02-26 16:22:56 -0800328class bsn_deny(bsn):
329 type = 65535
330 experimenter = 6035143
331 subtype = 5
332
333 def __init__(self):
334 return
335
336 def pack(self):
337 packed = []
338 packed.append(struct.pack("!H", self.type))
339 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
340 packed.append(struct.pack("!L", self.experimenter))
341 packed.append(struct.pack("!L", self.subtype))
342 packed.append('\x00' * 4)
343 length = sum([len(x) for x in packed])
344 packed[1] = struct.pack("!H", length)
345 return ''.join(packed)
346
347 @staticmethod
348 def unpack(reader):
349 obj = bsn_deny()
350 _type = reader.read("!H")[0]
351 assert(_type == 65535)
352 _len = reader.read("!H")[0]
353 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800354 reader = orig_reader.slice(_len, 4)
Rich Lane9ec3fca2014-02-26 16:22:56 -0800355 _experimenter = reader.read("!L")[0]
356 assert(_experimenter == 6035143)
357 _subtype = reader.read("!L")[0]
358 assert(_subtype == 5)
359 reader.skip(4)
360 return obj
361
362 def __eq__(self, other):
363 if type(self) != type(other): return False
364 return True
365
366 def pretty_print(self, q):
367 q.text("bsn_deny {")
368 with q.group():
369 with q.indent(2):
370 q.breakable()
371 q.breakable()
372 q.text('}')
373
374bsn.subtypes[5] = bsn_deny
375
Rich Lane1b75abf2014-02-05 11:23:20 -0800376class bsn_dhcp_offload(bsn):
377 type = 65535
378 experimenter = 6035143
379 subtype = 2
380
381 def __init__(self):
382 return
383
384 def pack(self):
385 packed = []
386 packed.append(struct.pack("!H", self.type))
387 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
388 packed.append(struct.pack("!L", self.experimenter))
389 packed.append(struct.pack("!L", self.subtype))
390 packed.append('\x00' * 4)
391 length = sum([len(x) for x in packed])
392 packed[1] = struct.pack("!H", length)
393 return ''.join(packed)
394
395 @staticmethod
396 def unpack(reader):
397 obj = bsn_dhcp_offload()
398 _type = reader.read("!H")[0]
399 assert(_type == 65535)
400 _len = reader.read("!H")[0]
401 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800402 reader = orig_reader.slice(_len, 4)
Rich Lane1b75abf2014-02-05 11:23:20 -0800403 _experimenter = reader.read("!L")[0]
404 assert(_experimenter == 6035143)
405 _subtype = reader.read("!L")[0]
406 assert(_subtype == 2)
407 reader.skip(4)
408 return obj
409
410 def __eq__(self, other):
411 if type(self) != type(other): return False
412 return True
413
414 def pretty_print(self, q):
415 q.text("bsn_dhcp_offload {")
416 with q.group():
417 with q.indent(2):
418 q.breakable()
419 q.breakable()
420 q.text('}')
421
422bsn.subtypes[2] = bsn_dhcp_offload
423
Rich Lane9ec3fca2014-02-26 16:22:56 -0800424class bsn_disable_split_horizon_check(bsn):
425 type = 65535
426 experimenter = 6035143
427 subtype = 3
428
429 def __init__(self):
430 return
431
432 def pack(self):
433 packed = []
434 packed.append(struct.pack("!H", self.type))
435 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
436 packed.append(struct.pack("!L", self.experimenter))
437 packed.append(struct.pack("!L", self.subtype))
438 packed.append('\x00' * 4)
439 length = sum([len(x) for x in packed])
440 packed[1] = struct.pack("!H", length)
441 return ''.join(packed)
442
443 @staticmethod
444 def unpack(reader):
445 obj = bsn_disable_split_horizon_check()
446 _type = reader.read("!H")[0]
447 assert(_type == 65535)
448 _len = reader.read("!H")[0]
449 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800450 reader = orig_reader.slice(_len, 4)
Rich Lane9ec3fca2014-02-26 16:22:56 -0800451 _experimenter = reader.read("!L")[0]
452 assert(_experimenter == 6035143)
453 _subtype = reader.read("!L")[0]
454 assert(_subtype == 3)
455 reader.skip(4)
456 return obj
457
458 def __eq__(self, other):
459 if type(self) != type(other): return False
460 return True
461
462 def pretty_print(self, q):
463 q.text("bsn_disable_split_horizon_check {")
464 with q.group():
465 with q.indent(2):
466 q.breakable()
467 q.breakable()
468 q.text('}')
469
470bsn.subtypes[3] = bsn_disable_split_horizon_check
471
Rich Lane7dcdf022013-12-11 14:45:27 -0800472class bsn_disable_src_mac_check(bsn):
Rich Lane7b0f2012013-11-22 14:15:26 -0800473 type = 65535
474 experimenter = 6035143
475 subtype = 0
476
477 def __init__(self):
478 return
479
480 def pack(self):
481 packed = []
482 packed.append(struct.pack("!H", self.type))
483 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
484 packed.append(struct.pack("!L", self.experimenter))
485 packed.append(struct.pack("!L", self.subtype))
486 packed.append('\x00' * 4)
487 length = sum([len(x) for x in packed])
488 packed[1] = struct.pack("!H", length)
489 return ''.join(packed)
490
491 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800492 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -0800493 obj = bsn_disable_src_mac_check()
Rich Lane7b0f2012013-11-22 14:15:26 -0800494 _type = reader.read("!H")[0]
495 assert(_type == 65535)
496 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800497 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800498 reader = orig_reader.slice(_len, 4)
Rich Lane7b0f2012013-11-22 14:15:26 -0800499 _experimenter = reader.read("!L")[0]
500 assert(_experimenter == 6035143)
501 _subtype = reader.read("!L")[0]
502 assert(_subtype == 0)
503 reader.skip(4)
504 return obj
505
506 def __eq__(self, other):
507 if type(self) != type(other): return False
508 return True
509
Rich Lane7b0f2012013-11-22 14:15:26 -0800510 def pretty_print(self, q):
511 q.text("bsn_disable_src_mac_check {")
512 with q.group():
513 with q.indent(2):
514 q.breakable()
515 q.breakable()
516 q.text('}')
517
Rich Lane7dcdf022013-12-11 14:45:27 -0800518bsn.subtypes[0] = bsn_disable_src_mac_check
519
Harshmeet Singhc0378a92014-07-22 17:09:36 -0700520class bsn_disable_vlan_counters(bsn):
521 type = 65535
522 experimenter = 6035143
523 subtype = 9
524
525 def __init__(self):
526 return
527
528 def pack(self):
529 packed = []
530 packed.append(struct.pack("!H", self.type))
531 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
532 packed.append(struct.pack("!L", self.experimenter))
533 packed.append(struct.pack("!L", self.subtype))
534 packed.append('\x00' * 4)
535 length = sum([len(x) for x in packed])
536 packed[1] = struct.pack("!H", length)
537 return ''.join(packed)
538
539 @staticmethod
540 def unpack(reader):
541 obj = bsn_disable_vlan_counters()
542 _type = reader.read("!H")[0]
543 assert(_type == 65535)
544 _len = reader.read("!H")[0]
545 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800546 reader = orig_reader.slice(_len, 4)
Harshmeet Singhc0378a92014-07-22 17:09:36 -0700547 _experimenter = reader.read("!L")[0]
548 assert(_experimenter == 6035143)
549 _subtype = reader.read("!L")[0]
550 assert(_subtype == 9)
551 reader.skip(4)
552 return obj
553
554 def __eq__(self, other):
555 if type(self) != type(other): return False
556 return True
557
558 def pretty_print(self, q):
559 q.text("bsn_disable_vlan_counters {")
560 with q.group():
561 with q.indent(2):
562 q.breakable()
563 q.breakable()
564 q.text('}')
565
566bsn.subtypes[9] = bsn_disable_vlan_counters
567
Rich Lanef50b7c32014-03-20 11:38:02 -0700568class bsn_packet_of_death(bsn):
569 type = 65535
570 experimenter = 6035143
571 subtype = 6
572
573 def __init__(self):
574 return
575
576 def pack(self):
577 packed = []
578 packed.append(struct.pack("!H", self.type))
579 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
580 packed.append(struct.pack("!L", self.experimenter))
581 packed.append(struct.pack("!L", self.subtype))
582 packed.append('\x00' * 4)
583 length = sum([len(x) for x in packed])
584 packed[1] = struct.pack("!H", length)
585 return ''.join(packed)
586
587 @staticmethod
588 def unpack(reader):
589 obj = bsn_packet_of_death()
590 _type = reader.read("!H")[0]
591 assert(_type == 65535)
592 _len = reader.read("!H")[0]
593 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800594 reader = orig_reader.slice(_len, 4)
Rich Lanef50b7c32014-03-20 11:38:02 -0700595 _experimenter = reader.read("!L")[0]
596 assert(_experimenter == 6035143)
597 _subtype = reader.read("!L")[0]
598 assert(_subtype == 6)
599 reader.skip(4)
600 return obj
601
602 def __eq__(self, other):
603 if type(self) != type(other): return False
604 return True
605
606 def pretty_print(self, q):
607 q.text("bsn_packet_of_death {")
608 with q.group():
609 with q.indent(2):
610 q.breakable()
611 q.breakable()
612 q.text('}')
613
614bsn.subtypes[6] = bsn_packet_of_death
615
Rich Lane9ec3fca2014-02-26 16:22:56 -0800616class bsn_permit(bsn):
617 type = 65535
618 experimenter = 6035143
619 subtype = 4
620
621 def __init__(self):
622 return
623
624 def pack(self):
625 packed = []
626 packed.append(struct.pack("!H", self.type))
627 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
628 packed.append(struct.pack("!L", self.experimenter))
629 packed.append(struct.pack("!L", self.subtype))
630 packed.append('\x00' * 4)
631 length = sum([len(x) for x in packed])
632 packed[1] = struct.pack("!H", length)
633 return ''.join(packed)
634
635 @staticmethod
636 def unpack(reader):
637 obj = bsn_permit()
638 _type = reader.read("!H")[0]
639 assert(_type == 65535)
640 _len = reader.read("!H")[0]
641 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800642 reader = orig_reader.slice(_len, 4)
Rich Lane9ec3fca2014-02-26 16:22:56 -0800643 _experimenter = reader.read("!L")[0]
644 assert(_experimenter == 6035143)
645 _subtype = reader.read("!L")[0]
646 assert(_subtype == 4)
647 reader.skip(4)
648 return obj
649
650 def __eq__(self, other):
651 if type(self) != type(other): return False
652 return True
653
654 def pretty_print(self, q):
655 q.text("bsn_permit {")
656 with q.group():
657 with q.indent(2):
658 q.breakable()
659 q.breakable()
660 q.text('}')
661
662bsn.subtypes[4] = bsn_permit
663
Rich Lane78d9bcb2014-05-12 13:27:44 -0700664class bsn_prioritize_pdus(bsn):
665 type = 65535
666 experimenter = 6035143
667 subtype = 7
668
669 def __init__(self):
670 return
671
672 def pack(self):
673 packed = []
674 packed.append(struct.pack("!H", self.type))
675 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
676 packed.append(struct.pack("!L", self.experimenter))
677 packed.append(struct.pack("!L", self.subtype))
678 packed.append('\x00' * 4)
679 length = sum([len(x) for x in packed])
680 packed[1] = struct.pack("!H", length)
681 return ''.join(packed)
682
683 @staticmethod
684 def unpack(reader):
685 obj = bsn_prioritize_pdus()
686 _type = reader.read("!H")[0]
687 assert(_type == 65535)
688 _len = reader.read("!H")[0]
689 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800690 reader = orig_reader.slice(_len, 4)
Rich Lane78d9bcb2014-05-12 13:27:44 -0700691 _experimenter = reader.read("!L")[0]
692 assert(_experimenter == 6035143)
693 _subtype = reader.read("!L")[0]
694 assert(_subtype == 7)
695 reader.skip(4)
696 return obj
697
698 def __eq__(self, other):
699 if type(self) != type(other): return False
700 return True
701
702 def pretty_print(self, q):
703 q.text("bsn_prioritize_pdus {")
704 with q.group():
705 with q.indent(2):
706 q.breakable()
707 q.breakable()
708 q.text('}')
709
710bsn.subtypes[7] = bsn_prioritize_pdus
711
Rich Lane5587ab12014-06-30 11:19:09 -0700712class bsn_require_vlan_xlate(bsn):
713 type = 65535
714 experimenter = 6035143
715 subtype = 8
716
717 def __init__(self):
718 return
719
720 def pack(self):
721 packed = []
722 packed.append(struct.pack("!H", self.type))
723 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
724 packed.append(struct.pack("!L", self.experimenter))
725 packed.append(struct.pack("!L", self.subtype))
726 packed.append('\x00' * 4)
727 length = sum([len(x) for x in packed])
728 packed[1] = struct.pack("!H", length)
729 return ''.join(packed)
730
731 @staticmethod
732 def unpack(reader):
733 obj = bsn_require_vlan_xlate()
734 _type = reader.read("!H")[0]
735 assert(_type == 65535)
736 _len = reader.read("!H")[0]
737 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800738 reader = orig_reader.slice(_len, 4)
Rich Lane5587ab12014-06-30 11:19:09 -0700739 _experimenter = reader.read("!L")[0]
740 assert(_experimenter == 6035143)
741 _subtype = reader.read("!L")[0]
742 assert(_subtype == 8)
743 reader.skip(4)
744 return obj
745
746 def __eq__(self, other):
747 if type(self) != type(other): return False
748 return True
749
750 def pretty_print(self, q):
751 q.text("bsn_require_vlan_xlate {")
752 with q.group():
753 with q.indent(2):
754 q.breakable()
755 q.breakable()
756 q.text('}')
757
758bsn.subtypes[8] = bsn_require_vlan_xlate
759
Rich Lanef9530c42014-09-15 09:59:43 -0700760class bsn_span_destination(bsn):
761 type = 65535
762 experimenter = 6035143
763 subtype = 10
764
765 def __init__(self):
766 return
767
768 def pack(self):
769 packed = []
770 packed.append(struct.pack("!H", self.type))
771 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
772 packed.append(struct.pack("!L", self.experimenter))
773 packed.append(struct.pack("!L", self.subtype))
774 packed.append('\x00' * 4)
775 length = sum([len(x) for x in packed])
776 packed[1] = struct.pack("!H", length)
777 return ''.join(packed)
778
779 @staticmethod
780 def unpack(reader):
781 obj = bsn_span_destination()
782 _type = reader.read("!H")[0]
783 assert(_type == 65535)
784 _len = reader.read("!H")[0]
785 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800786 reader = orig_reader.slice(_len, 4)
Rich Lanef9530c42014-09-15 09:59:43 -0700787 _experimenter = reader.read("!L")[0]
788 assert(_experimenter == 6035143)
789 _subtype = reader.read("!L")[0]
790 assert(_subtype == 10)
791 reader.skip(4)
792 return obj
793
794 def __eq__(self, other):
795 if type(self) != type(other): return False
796 return True
797
798 def pretty_print(self, q):
799 q.text("bsn_span_destination {")
800 with q.group():
801 with q.indent(2):
802 q.breakable()
803 q.breakable()
804 q.text('}')
805
806bsn.subtypes[10] = bsn_span_destination
807
Rich Lane7dcdf022013-12-11 14:45:27 -0800808class clear_actions(instruction):
Dan Talaycof6202252013-07-02 01:00:29 -0700809 type = 5
Rich Laneca3da272013-05-05 09:07:33 -0700810
811 def __init__(self):
812 return
813
814 def pack(self):
815 packed = []
816 packed.append(struct.pack("!H", self.type))
817 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
818 packed.append('\x00' * 4)
819 length = sum([len(x) for x in packed])
820 packed[1] = struct.pack("!H", length)
821 return ''.join(packed)
822
823 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800824 def unpack(reader):
Rich Laneca3da272013-05-05 09:07:33 -0700825 obj = clear_actions()
Dan Talaycof6202252013-07-02 01:00:29 -0700826 _type = reader.read("!H")[0]
827 assert(_type == 5)
828 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800829 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800830 reader = orig_reader.slice(_len, 4)
Rich Laneca3da272013-05-05 09:07:33 -0700831 reader.skip(4)
832 return obj
833
834 def __eq__(self, other):
835 if type(self) != type(other): return False
836 return True
837
Rich Laneca3da272013-05-05 09:07:33 -0700838 def pretty_print(self, q):
839 q.text("clear_actions {")
840 with q.group():
841 with q.indent(2):
842 q.breakable()
843 q.breakable()
844 q.text('}')
845
Rich Lane7dcdf022013-12-11 14:45:27 -0800846instruction.subtypes[5] = clear_actions
847
848class goto_table(instruction):
Dan Talaycof6202252013-07-02 01:00:29 -0700849 type = 1
Rich Laneca3da272013-05-05 09:07:33 -0700850
851 def __init__(self, table_id=None):
852 if table_id != None:
853 self.table_id = table_id
854 else:
855 self.table_id = 0
856 return
857
858 def pack(self):
859 packed = []
860 packed.append(struct.pack("!H", self.type))
861 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
862 packed.append(struct.pack("!B", self.table_id))
863 packed.append('\x00' * 3)
864 length = sum([len(x) for x in packed])
865 packed[1] = struct.pack("!H", length)
866 return ''.join(packed)
867
868 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800869 def unpack(reader):
Rich Laneca3da272013-05-05 09:07:33 -0700870 obj = goto_table()
Dan Talaycof6202252013-07-02 01:00:29 -0700871 _type = reader.read("!H")[0]
872 assert(_type == 1)
873 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800874 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800875 reader = orig_reader.slice(_len, 4)
Dan Talaycof6202252013-07-02 01:00:29 -0700876 obj.table_id = reader.read("!B")[0]
Rich Laneca3da272013-05-05 09:07:33 -0700877 reader.skip(3)
878 return obj
879
880 def __eq__(self, other):
881 if type(self) != type(other): return False
882 if self.table_id != other.table_id: return False
883 return True
884
Rich Laneca3da272013-05-05 09:07:33 -0700885 def pretty_print(self, q):
886 q.text("goto_table {")
887 with q.group():
888 with q.indent(2):
889 q.breakable()
890 q.text("table_id = ");
891 q.text("%#x" % self.table_id)
892 q.breakable()
893 q.text('}')
894
Rich Lane7dcdf022013-12-11 14:45:27 -0800895instruction.subtypes[1] = goto_table
896
897class meter(instruction):
Dan Talaycof6202252013-07-02 01:00:29 -0700898 type = 6
Rich Laneca3da272013-05-05 09:07:33 -0700899
900 def __init__(self, meter_id=None):
901 if meter_id != None:
902 self.meter_id = meter_id
903 else:
904 self.meter_id = 0
905 return
906
907 def pack(self):
908 packed = []
909 packed.append(struct.pack("!H", self.type))
910 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
911 packed.append(struct.pack("!L", self.meter_id))
912 length = sum([len(x) for x in packed])
913 packed[1] = struct.pack("!H", length)
914 return ''.join(packed)
915
916 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800917 def unpack(reader):
Rich Laneca3da272013-05-05 09:07:33 -0700918 obj = meter()
Dan Talaycof6202252013-07-02 01:00:29 -0700919 _type = reader.read("!H")[0]
920 assert(_type == 6)
921 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800922 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800923 reader = orig_reader.slice(_len, 4)
Dan Talaycof6202252013-07-02 01:00:29 -0700924 obj.meter_id = reader.read("!L")[0]
Rich Laneca3da272013-05-05 09:07:33 -0700925 return obj
926
927 def __eq__(self, other):
928 if type(self) != type(other): return False
929 if self.meter_id != other.meter_id: return False
930 return True
931
Rich Laneca3da272013-05-05 09:07:33 -0700932 def pretty_print(self, q):
933 q.text("meter {")
934 with q.group():
935 with q.indent(2):
936 q.breakable()
937 q.text("meter_id = ");
938 q.text("%#x" % self.meter_id)
939 q.breakable()
940 q.text('}')
941
Rich Lane7dcdf022013-12-11 14:45:27 -0800942instruction.subtypes[6] = meter
943
944class write_actions(instruction):
Dan Talaycof6202252013-07-02 01:00:29 -0700945 type = 3
Rich Laneca3da272013-05-05 09:07:33 -0700946
947 def __init__(self, actions=None):
948 if actions != None:
949 self.actions = actions
950 else:
951 self.actions = []
952 return
953
954 def pack(self):
955 packed = []
956 packed.append(struct.pack("!H", self.type))
957 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
958 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -0800959 packed.append(loxi.generic_util.pack_list(self.actions))
Rich Laneca3da272013-05-05 09:07:33 -0700960 length = sum([len(x) for x in packed])
961 packed[1] = struct.pack("!H", length)
962 return ''.join(packed)
963
964 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800965 def unpack(reader):
Rich Laneca3da272013-05-05 09:07:33 -0700966 obj = write_actions()
Dan Talaycof6202252013-07-02 01:00:29 -0700967 _type = reader.read("!H")[0]
968 assert(_type == 3)
969 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800970 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800971 reader = orig_reader.slice(_len, 4)
Rich Laneca3da272013-05-05 09:07:33 -0700972 reader.skip(4)
Rich Lanee2567702015-01-26 15:04:35 -0800973 obj.actions = loxi.generic_util.unpack_list(reader, ofp.action.action.unpack)
Rich Laneca3da272013-05-05 09:07:33 -0700974 return obj
975
976 def __eq__(self, other):
977 if type(self) != type(other): return False
978 if self.actions != other.actions: return False
979 return True
980
Rich Laneca3da272013-05-05 09:07:33 -0700981 def pretty_print(self, q):
982 q.text("write_actions {")
983 with q.group():
984 with q.indent(2):
985 q.breakable()
986 q.text("actions = ");
987 q.pp(self.actions)
988 q.breakable()
989 q.text('}')
990
Rich Lane7dcdf022013-12-11 14:45:27 -0800991instruction.subtypes[3] = write_actions
992
993class write_metadata(instruction):
Dan Talaycof6202252013-07-02 01:00:29 -0700994 type = 2
Rich Laneca3da272013-05-05 09:07:33 -0700995
996 def __init__(self, metadata=None, metadata_mask=None):
997 if metadata != None:
998 self.metadata = metadata
999 else:
1000 self.metadata = 0
1001 if metadata_mask != None:
1002 self.metadata_mask = metadata_mask
1003 else:
1004 self.metadata_mask = 0
1005 return
1006
1007 def pack(self):
1008 packed = []
1009 packed.append(struct.pack("!H", self.type))
1010 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
1011 packed.append('\x00' * 4)
1012 packed.append(struct.pack("!Q", self.metadata))
1013 packed.append(struct.pack("!Q", self.metadata_mask))
1014 length = sum([len(x) for x in packed])
1015 packed[1] = struct.pack("!H", length)
1016 return ''.join(packed)
1017
1018 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001019 def unpack(reader):
Rich Laneca3da272013-05-05 09:07:33 -07001020 obj = write_metadata()
Dan Talaycof6202252013-07-02 01:00:29 -07001021 _type = reader.read("!H")[0]
1022 assert(_type == 2)
1023 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001024 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001025 reader = orig_reader.slice(_len, 4)
Rich Laneca3da272013-05-05 09:07:33 -07001026 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -07001027 obj.metadata = reader.read("!Q")[0]
1028 obj.metadata_mask = reader.read("!Q")[0]
Rich Laneca3da272013-05-05 09:07:33 -07001029 return obj
1030
1031 def __eq__(self, other):
1032 if type(self) != type(other): return False
1033 if self.metadata != other.metadata: return False
1034 if self.metadata_mask != other.metadata_mask: return False
1035 return True
1036
Rich Laneca3da272013-05-05 09:07:33 -07001037 def pretty_print(self, q):
1038 q.text("write_metadata {")
1039 with q.group():
1040 with q.indent(2):
1041 q.breakable()
1042 q.text("metadata = ");
1043 q.text("%#x" % self.metadata)
1044 q.text(","); q.breakable()
1045 q.text("metadata_mask = ");
1046 q.text("%#x" % self.metadata_mask)
1047 q.breakable()
1048 q.text('}')
1049
Rich Lane7dcdf022013-12-11 14:45:27 -08001050instruction.subtypes[2] = write_metadata
Rich Laneca3da272013-05-05 09:07:33 -07001051
Rich Lane7b0f2012013-11-22 14:15:26 -08001052