blob: d33ac62607decc0a3b42afa30ed6ff59af5eaa44 [file] [log] [blame]
Rich Lane2e079da2014-10-29 15:30:24 -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.
4# See the file LICENSE.pyloxi which should have been included in the source distribution
5
6# Automatically generated by LOXI from template module.py
7# Do not modify
8
9import struct
10import loxi
11import const
12import port_desc_prop
13import meter_band
14import table_mod_prop
15import instruction
16import queue_desc_prop
17import oxm
18import bundle_prop
19import common
20import instruction_id
21import action
22import role_prop
23import message
24import queue_stats_prop
25import port_stats_prop
26import port_mod_prop
27import async_config_prop
28import action_id
29import util
30import loxi.generic_util
31
32class async_config_prop(loxi.OFObject):
33 subtypes = {}
34
35
36 def __init__(self, type=None):
37 if type != None:
38 self.type = type
39 else:
40 self.type = 0
41 return
42
43 def pack(self):
44 packed = []
45 packed.append(struct.pack("!H", self.type))
46 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
47 length = sum([len(x) for x in packed])
48 packed[1] = struct.pack("!H", length)
49 return ''.join(packed)
50
51 @staticmethod
52 def unpack(reader):
53 subtype, = reader.peek('!H', 0)
54 subclass = async_config_prop.subtypes.get(subtype)
55 if subclass:
56 return subclass.unpack(reader)
57
58 obj = async_config_prop()
59 obj.type = reader.read("!H")[0]
60 _length = reader.read("!H")[0]
61 orig_reader = reader
62 reader = orig_reader.slice(_length - (2 + 2))
63 return obj
64
65 def __eq__(self, other):
66 if type(self) != type(other): return False
67 if self.type != other.type: return False
68 return True
69
70 def pretty_print(self, q):
71 q.text("async_config_prop {")
72 with q.group():
73 with q.indent(2):
74 q.breakable()
75 q.breakable()
76 q.text('}')
77
78
79class experimenter_master(async_config_prop):
80 type = 65535
81
82 def __init__(self):
83 return
84
85 def pack(self):
86 packed = []
87 packed.append(struct.pack("!H", self.type))
88 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
89 length = sum([len(x) for x in packed])
90 packed[1] = struct.pack("!H", length)
91 return ''.join(packed)
92
93 @staticmethod
94 def unpack(reader):
95 obj = experimenter_master()
96 _type = reader.read("!H")[0]
97 assert(_type == 65535)
98 _length = reader.read("!H")[0]
99 orig_reader = reader
100 reader = orig_reader.slice(_length - (2 + 2))
101 return obj
102
103 def __eq__(self, other):
104 if type(self) != type(other): return False
105 return True
106
107 def pretty_print(self, q):
108 q.text("experimenter_master {")
109 with q.group():
110 with q.indent(2):
111 q.breakable()
112 q.breakable()
113 q.text('}')
114
115async_config_prop.subtypes[65535] = experimenter_master
116
117class experimenter_slave(async_config_prop):
118 type = 65534
119
120 def __init__(self):
121 return
122
123 def pack(self):
124 packed = []
125 packed.append(struct.pack("!H", self.type))
126 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
127 length = sum([len(x) for x in packed])
128 packed[1] = struct.pack("!H", length)
129 return ''.join(packed)
130
131 @staticmethod
132 def unpack(reader):
133 obj = experimenter_slave()
134 _type = reader.read("!H")[0]
135 assert(_type == 65534)
136 _length = reader.read("!H")[0]
137 orig_reader = reader
138 reader = orig_reader.slice(_length - (2 + 2))
139 return obj
140
141 def __eq__(self, other):
142 if type(self) != type(other): return False
143 return True
144
145 def pretty_print(self, q):
146 q.text("experimenter_slave {")
147 with q.group():
148 with q.indent(2):
149 q.breakable()
150 q.breakable()
151 q.text('}')
152
153async_config_prop.subtypes[65534] = experimenter_slave
154
155class flow_removed_master(async_config_prop):
156 type = 5
157
158 def __init__(self, mask=None):
159 if mask != None:
160 self.mask = mask
161 else:
162 self.mask = 0
163 return
164
165 def pack(self):
166 packed = []
167 packed.append(struct.pack("!H", self.type))
168 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
169 packed.append(struct.pack("!L", self.mask))
170 length = sum([len(x) for x in packed])
171 packed[1] = struct.pack("!H", length)
172 return ''.join(packed)
173
174 @staticmethod
175 def unpack(reader):
176 obj = flow_removed_master()
177 _type = reader.read("!H")[0]
178 assert(_type == 5)
179 _length = reader.read("!H")[0]
180 orig_reader = reader
181 reader = orig_reader.slice(_length - (2 + 2))
182 obj.mask = reader.read("!L")[0]
183 return obj
184
185 def __eq__(self, other):
186 if type(self) != type(other): return False
187 if self.mask != other.mask: return False
188 return True
189
190 def pretty_print(self, q):
191 q.text("flow_removed_master {")
192 with q.group():
193 with q.indent(2):
194 q.breakable()
195 q.text("mask = ");
196 q.text("%#x" % self.mask)
197 q.breakable()
198 q.text('}')
199
200async_config_prop.subtypes[5] = flow_removed_master
201
202class flow_removed_slave(async_config_prop):
203 type = 4
204
205 def __init__(self, mask=None):
206 if mask != None:
207 self.mask = mask
208 else:
209 self.mask = 0
210 return
211
212 def pack(self):
213 packed = []
214 packed.append(struct.pack("!H", self.type))
215 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
216 packed.append(struct.pack("!L", self.mask))
217 length = sum([len(x) for x in packed])
218 packed[1] = struct.pack("!H", length)
219 return ''.join(packed)
220
221 @staticmethod
222 def unpack(reader):
223 obj = flow_removed_slave()
224 _type = reader.read("!H")[0]
225 assert(_type == 4)
226 _length = reader.read("!H")[0]
227 orig_reader = reader
228 reader = orig_reader.slice(_length - (2 + 2))
229 obj.mask = reader.read("!L")[0]
230 return obj
231
232 def __eq__(self, other):
233 if type(self) != type(other): return False
234 if self.mask != other.mask: return False
235 return True
236
237 def pretty_print(self, q):
238 q.text("flow_removed_slave {")
239 with q.group():
240 with q.indent(2):
241 q.breakable()
242 q.text("mask = ");
243 q.text("%#x" % self.mask)
244 q.breakable()
245 q.text('}')
246
247async_config_prop.subtypes[4] = flow_removed_slave
248
249class packet_in_master(async_config_prop):
250 type = 1
251
252 def __init__(self, mask=None):
253 if mask != None:
254 self.mask = mask
255 else:
256 self.mask = 0
257 return
258
259 def pack(self):
260 packed = []
261 packed.append(struct.pack("!H", self.type))
262 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
263 packed.append(struct.pack("!L", self.mask))
264 length = sum([len(x) for x in packed])
265 packed[1] = struct.pack("!H", length)
266 return ''.join(packed)
267
268 @staticmethod
269 def unpack(reader):
270 obj = packet_in_master()
271 _type = reader.read("!H")[0]
272 assert(_type == 1)
273 _length = reader.read("!H")[0]
274 orig_reader = reader
275 reader = orig_reader.slice(_length - (2 + 2))
276 obj.mask = reader.read("!L")[0]
277 return obj
278
279 def __eq__(self, other):
280 if type(self) != type(other): return False
281 if self.mask != other.mask: return False
282 return True
283
284 def pretty_print(self, q):
285 q.text("packet_in_master {")
286 with q.group():
287 with q.indent(2):
288 q.breakable()
289 q.text("mask = ");
290 q.text("%#x" % self.mask)
291 q.breakable()
292 q.text('}')
293
294async_config_prop.subtypes[1] = packet_in_master
295
296class packet_in_slave(async_config_prop):
297 type = 0
298
299 def __init__(self, mask=None):
300 if mask != None:
301 self.mask = mask
302 else:
303 self.mask = 0
304 return
305
306 def pack(self):
307 packed = []
308 packed.append(struct.pack("!H", self.type))
309 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
310 packed.append(struct.pack("!L", self.mask))
311 length = sum([len(x) for x in packed])
312 packed[1] = struct.pack("!H", length)
313 return ''.join(packed)
314
315 @staticmethod
316 def unpack(reader):
317 obj = packet_in_slave()
318 _type = reader.read("!H")[0]
319 assert(_type == 0)
320 _length = reader.read("!H")[0]
321 orig_reader = reader
322 reader = orig_reader.slice(_length - (2 + 2))
323 obj.mask = reader.read("!L")[0]
324 return obj
325
326 def __eq__(self, other):
327 if type(self) != type(other): return False
328 if self.mask != other.mask: return False
329 return True
330
331 def pretty_print(self, q):
332 q.text("packet_in_slave {")
333 with q.group():
334 with q.indent(2):
335 q.breakable()
336 q.text("mask = ");
337 q.text("%#x" % self.mask)
338 q.breakable()
339 q.text('}')
340
341async_config_prop.subtypes[0] = packet_in_slave
342
343class port_status_master(async_config_prop):
344 type = 3
345
346 def __init__(self, mask=None):
347 if mask != None:
348 self.mask = mask
349 else:
350 self.mask = 0
351 return
352
353 def pack(self):
354 packed = []
355 packed.append(struct.pack("!H", self.type))
356 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
357 packed.append(struct.pack("!L", self.mask))
358 length = sum([len(x) for x in packed])
359 packed[1] = struct.pack("!H", length)
360 return ''.join(packed)
361
362 @staticmethod
363 def unpack(reader):
364 obj = port_status_master()
365 _type = reader.read("!H")[0]
366 assert(_type == 3)
367 _length = reader.read("!H")[0]
368 orig_reader = reader
369 reader = orig_reader.slice(_length - (2 + 2))
370 obj.mask = reader.read("!L")[0]
371 return obj
372
373 def __eq__(self, other):
374 if type(self) != type(other): return False
375 if self.mask != other.mask: return False
376 return True
377
378 def pretty_print(self, q):
379 q.text("port_status_master {")
380 with q.group():
381 with q.indent(2):
382 q.breakable()
383 q.text("mask = ");
384 q.text("%#x" % self.mask)
385 q.breakable()
386 q.text('}')
387
388async_config_prop.subtypes[3] = port_status_master
389
390class port_status_slave(async_config_prop):
391 type = 2
392
393 def __init__(self, mask=None):
394 if mask != None:
395 self.mask = mask
396 else:
397 self.mask = 0
398 return
399
400 def pack(self):
401 packed = []
402 packed.append(struct.pack("!H", self.type))
403 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
404 packed.append(struct.pack("!L", self.mask))
405 length = sum([len(x) for x in packed])
406 packed[1] = struct.pack("!H", length)
407 return ''.join(packed)
408
409 @staticmethod
410 def unpack(reader):
411 obj = port_status_slave()
412 _type = reader.read("!H")[0]
413 assert(_type == 2)
414 _length = reader.read("!H")[0]
415 orig_reader = reader
416 reader = orig_reader.slice(_length - (2 + 2))
417 obj.mask = reader.read("!L")[0]
418 return obj
419
420 def __eq__(self, other):
421 if type(self) != type(other): return False
422 if self.mask != other.mask: return False
423 return True
424
425 def pretty_print(self, q):
426 q.text("port_status_slave {")
427 with q.group():
428 with q.indent(2):
429 q.breakable()
430 q.text("mask = ");
431 q.text("%#x" % self.mask)
432 q.breakable()
433 q.text('}')
434
435async_config_prop.subtypes[2] = port_status_slave
436
437class requestforward_master(async_config_prop):
438 type = 11
439
440 def __init__(self, mask=None):
441 if mask != None:
442 self.mask = mask
443 else:
444 self.mask = 0
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 length at index 1
451 packed.append(struct.pack("!L", self.mask))
452 length = sum([len(x) for x in packed])
453 packed[1] = struct.pack("!H", length)
454 return ''.join(packed)
455
456 @staticmethod
457 def unpack(reader):
458 obj = requestforward_master()
459 _type = reader.read("!H")[0]
460 assert(_type == 11)
461 _length = reader.read("!H")[0]
462 orig_reader = reader
463 reader = orig_reader.slice(_length - (2 + 2))
464 obj.mask = reader.read("!L")[0]
465 return obj
466
467 def __eq__(self, other):
468 if type(self) != type(other): return False
469 if self.mask != other.mask: return False
470 return True
471
472 def pretty_print(self, q):
473 q.text("requestforward_master {")
474 with q.group():
475 with q.indent(2):
476 q.breakable()
477 q.text("mask = ");
478 q.text("%#x" % self.mask)
479 q.breakable()
480 q.text('}')
481
482async_config_prop.subtypes[11] = requestforward_master
483
484class requestforward_slave(async_config_prop):
485 type = 10
486
487 def __init__(self, mask=None):
488 if mask != None:
489 self.mask = mask
490 else:
491 self.mask = 0
492 return
493
494 def pack(self):
495 packed = []
496 packed.append(struct.pack("!H", self.type))
497 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
498 packed.append(struct.pack("!L", self.mask))
499 length = sum([len(x) for x in packed])
500 packed[1] = struct.pack("!H", length)
501 return ''.join(packed)
502
503 @staticmethod
504 def unpack(reader):
505 obj = requestforward_slave()
506 _type = reader.read("!H")[0]
507 assert(_type == 10)
508 _length = reader.read("!H")[0]
509 orig_reader = reader
510 reader = orig_reader.slice(_length - (2 + 2))
511 obj.mask = reader.read("!L")[0]
512 return obj
513
514 def __eq__(self, other):
515 if type(self) != type(other): return False
516 if self.mask != other.mask: return False
517 return True
518
519 def pretty_print(self, q):
520 q.text("requestforward_slave {")
521 with q.group():
522 with q.indent(2):
523 q.breakable()
524 q.text("mask = ");
525 q.text("%#x" % self.mask)
526 q.breakable()
527 q.text('}')
528
529async_config_prop.subtypes[10] = requestforward_slave
530
531class role_status_master(async_config_prop):
532 type = 7
533
534 def __init__(self, mask=None):
535 if mask != None:
536 self.mask = mask
537 else:
538 self.mask = 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 length at index 1
545 packed.append(struct.pack("!L", self.mask))
546 length = sum([len(x) for x in packed])
547 packed[1] = struct.pack("!H", length)
548 return ''.join(packed)
549
550 @staticmethod
551 def unpack(reader):
552 obj = role_status_master()
553 _type = reader.read("!H")[0]
554 assert(_type == 7)
555 _length = reader.read("!H")[0]
556 orig_reader = reader
557 reader = orig_reader.slice(_length - (2 + 2))
558 obj.mask = reader.read("!L")[0]
559 return obj
560
561 def __eq__(self, other):
562 if type(self) != type(other): return False
563 if self.mask != other.mask: return False
564 return True
565
566 def pretty_print(self, q):
567 q.text("role_status_master {")
568 with q.group():
569 with q.indent(2):
570 q.breakable()
571 q.text("mask = ");
572 q.text("%#x" % self.mask)
573 q.breakable()
574 q.text('}')
575
576async_config_prop.subtypes[7] = role_status_master
577
578class role_status_slave(async_config_prop):
579 type = 6
580
581 def __init__(self, mask=None):
582 if mask != None:
583 self.mask = mask
584 else:
585 self.mask = 0
586 return
587
588 def pack(self):
589 packed = []
590 packed.append(struct.pack("!H", self.type))
591 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
592 packed.append(struct.pack("!L", self.mask))
593 length = sum([len(x) for x in packed])
594 packed[1] = struct.pack("!H", length)
595 return ''.join(packed)
596
597 @staticmethod
598 def unpack(reader):
599 obj = role_status_slave()
600 _type = reader.read("!H")[0]
601 assert(_type == 6)
602 _length = reader.read("!H")[0]
603 orig_reader = reader
604 reader = orig_reader.slice(_length - (2 + 2))
605 obj.mask = reader.read("!L")[0]
606 return obj
607
608 def __eq__(self, other):
609 if type(self) != type(other): return False
610 if self.mask != other.mask: return False
611 return True
612
613 def pretty_print(self, q):
614 q.text("role_status_slave {")
615 with q.group():
616 with q.indent(2):
617 q.breakable()
618 q.text("mask = ");
619 q.text("%#x" % self.mask)
620 q.breakable()
621 q.text('}')
622
623async_config_prop.subtypes[6] = role_status_slave
624
625class table_status_master(async_config_prop):
626 type = 9
627
628 def __init__(self, mask=None):
629 if mask != None:
630 self.mask = mask
631 else:
632 self.mask = 0
633 return
634
635 def pack(self):
636 packed = []
637 packed.append(struct.pack("!H", self.type))
638 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
639 packed.append(struct.pack("!L", self.mask))
640 length = sum([len(x) for x in packed])
641 packed[1] = struct.pack("!H", length)
642 return ''.join(packed)
643
644 @staticmethod
645 def unpack(reader):
646 obj = table_status_master()
647 _type = reader.read("!H")[0]
648 assert(_type == 9)
649 _length = reader.read("!H")[0]
650 orig_reader = reader
651 reader = orig_reader.slice(_length - (2 + 2))
652 obj.mask = reader.read("!L")[0]
653 return obj
654
655 def __eq__(self, other):
656 if type(self) != type(other): return False
657 if self.mask != other.mask: return False
658 return True
659
660 def pretty_print(self, q):
661 q.text("table_status_master {")
662 with q.group():
663 with q.indent(2):
664 q.breakable()
665 q.text("mask = ");
666 q.text("%#x" % self.mask)
667 q.breakable()
668 q.text('}')
669
670async_config_prop.subtypes[9] = table_status_master
671
672class table_status_slave(async_config_prop):
673 type = 8
674
675 def __init__(self, mask=None):
676 if mask != None:
677 self.mask = mask
678 else:
679 self.mask = 0
680 return
681
682 def pack(self):
683 packed = []
684 packed.append(struct.pack("!H", self.type))
685 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
686 packed.append(struct.pack("!L", self.mask))
687 length = sum([len(x) for x in packed])
688 packed[1] = struct.pack("!H", length)
689 return ''.join(packed)
690
691 @staticmethod
692 def unpack(reader):
693 obj = table_status_slave()
694 _type = reader.read("!H")[0]
695 assert(_type == 8)
696 _length = reader.read("!H")[0]
697 orig_reader = reader
698 reader = orig_reader.slice(_length - (2 + 2))
699 obj.mask = reader.read("!L")[0]
700 return obj
701
702 def __eq__(self, other):
703 if type(self) != type(other): return False
704 if self.mask != other.mask: return False
705 return True
706
707 def pretty_print(self, q):
708 q.text("table_status_slave {")
709 with q.group():
710 with q.indent(2):
711 q.breakable()
712 q.text("mask = ");
713 q.text("%#x" % self.mask)
714 q.breakable()
715 q.text('}')
716
717async_config_prop.subtypes[8] = table_status_slave
718
719