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