blob: 06f9ac9be98af461c61801cfec322908a6a200b6 [file] [log] [blame]
Rich Lane629393f2013-01-10 15:37:33 -08001import struct
2
3# Structure definitions
4class ofp_hello(object):
5 """Automatically generated Python class for ofp_hello
6
7 Date 2012-06-25
8 Created by of.pythonize.pythonizer
9 Core structure: Messages do not include ofp_header
10 Does not include var-length arrays
11 """
12 def __init__(self):
13 """Initialize
14 Declare members and default values
15 """
16
17 def __assert(self):
18 """Sanity check
19 """
20 return (True, None)
21
22 def pack(self, assertstruct=True):
23 """Pack message
24 Packs empty array used as placeholder
25 """
26 if(assertstruct):
27 if(not self.__assert()[0]):
28 return None
29 packed = ""
30 return packed
31
32 def unpack(self, binaryString):
33 """Unpack message
34 Do not unpack empty array used as placeholder
35 since they can contain heterogeneous type
36 """
37 if (len(binaryString) < 0):
38 return binaryString
39 return binaryString[0:]
40
41 def __len__(self):
42 """Return length of message
43 """
44 l = 0
45 return l
46
47 def __eq__(self, other):
48 """Return True if self and other have same values
49 """
50 if type(self) != type(other): return False
51 return True
52
53 def __ne__(self, other): return not self.__eq__(other)
54
55 def show(self, prefix=''):
56 """Generate string showing basic members of structure
57 """
58 outstr = ''
59 return outstr
60
61
62class ofp_aggregate_stats_reply(object):
63 """Automatically generated Python class for ofp_aggregate_stats_reply
64
65 Date 2012-06-25
66 Created by of.pythonize.pythonizer
67 Core structure: Messages do not include ofp_header
68 Does not include var-length arrays
69 """
70 def __init__(self):
71 """Initialize
72 Declare members and default values
73 """
74 self.packet_count = 0
75 self.byte_count = 0
76 self.flow_count = 0
77 self.pad= [0,0,0,0]
78
79 def __assert(self):
80 """Sanity check
81 """
82 if(not isinstance(self.pad, list)):
83 return (False, "self.pad is not list as expected.")
84 if(len(self.pad) != 4):
85 return (False, "self.pad is not of size 4 as expected.")
86 return (True, None)
87
88 def pack(self, assertstruct=True):
89 """Pack message
90 Packs empty array used as placeholder
91 """
92 if(assertstruct):
93 if(not self.__assert()[0]):
94 return None
95 packed = ""
96 packed += struct.pack("!QQL", self.packet_count, self.byte_count, self.flow_count)
97 packed += struct.pack("!BBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3])
98 return packed
99
100 def unpack(self, binaryString):
101 """Unpack message
102 Do not unpack empty array used as placeholder
103 since they can contain heterogeneous type
104 """
105 if (len(binaryString) < 24):
106 return binaryString
107 fmt = '!QQL'
108 start = 0
109 end = start + struct.calcsize(fmt)
110 (self.packet_count, self.byte_count, self.flow_count) = struct.unpack(fmt, binaryString[start:end])
111 fmt = '!BBBB'
112 start = 20
113 end = start + struct.calcsize(fmt)
114 (self.pad[0], self.pad[1], self.pad[2], self.pad[3]) = struct.unpack(fmt, binaryString[start:end])
115 return binaryString[24:]
116
117 def __len__(self):
118 """Return length of message
119 """
120 l = 24
121 return l
122
123 def __eq__(self, other):
124 """Return True if self and other have same values
125 """
126 if type(self) != type(other): return False
127 if self.packet_count != other.packet_count: return False
128 if self.byte_count != other.byte_count: return False
129 if self.flow_count != other.flow_count: return False
130 if self.pad != other.pad: return False
131 return True
132
133 def __ne__(self, other): return not self.__eq__(other)
134
135 def show(self, prefix=''):
136 """Generate string showing basic members of structure
137 """
138 outstr = ''
139 outstr += prefix + 'packet_count: ' + str(self.packet_count) + '\n'
140 outstr += prefix + 'byte_count: ' + str(self.byte_count) + '\n'
141 outstr += prefix + 'flow_count: ' + str(self.flow_count) + '\n'
142 return outstr
143
144
145class ofp_role_request(object):
146 """Automatically generated Python class for ofp_role_request
147
148 Date 2012-06-25
149 Created by of.pythonize.pythonizer
150 Core structure: Messages do not include ofp_header
151 Does not include var-length arrays
152 """
153 def __init__(self):
154 """Initialize
155 Declare members and default values
156 """
157 self.role = 0
158 self.pad= [0,0,0,0]
159 self.generation_id = 0
160
161 def __assert(self):
162 """Sanity check
163 """
164 if(not isinstance(self.pad, list)):
165 return (False, "self.pad is not list as expected.")
166 if(len(self.pad) != 4):
167 return (False, "self.pad is not of size 4 as expected.")
168 return (True, None)
169
170 def pack(self, assertstruct=True):
171 """Pack message
172 Packs empty array used as placeholder
173 """
174 if(assertstruct):
175 if(not self.__assert()[0]):
176 return None
177 packed = ""
178 packed += struct.pack("!L", self.role)
179 packed += struct.pack("!BBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3])
180 packed += struct.pack("!Q", self.generation_id)
181 return packed
182
183 def unpack(self, binaryString):
184 """Unpack message
185 Do not unpack empty array used as placeholder
186 since they can contain heterogeneous type
187 """
188 if (len(binaryString) < 16):
189 return binaryString
190 fmt = '!L'
191 start = 0
192 end = start + struct.calcsize(fmt)
193 (self.role,) = struct.unpack(fmt, binaryString[start:end])
194 fmt = '!BBBB'
195 start = 4
196 end = start + struct.calcsize(fmt)
197 (self.pad[0], self.pad[1], self.pad[2], self.pad[3]) = struct.unpack(fmt, binaryString[start:end])
198 fmt = '!Q'
199 start = 8
200 end = start + struct.calcsize(fmt)
201 (self.generation_id,) = struct.unpack(fmt, binaryString[start:end])
202 return binaryString[16:]
203
204 def __len__(self):
205 """Return length of message
206 """
207 l = 16
208 return l
209
210 def __eq__(self, other):
211 """Return True if self and other have same values
212 """
213 if type(self) != type(other): return False
214 if self.role != other.role: return False
215 if self.pad != other.pad: return False
216 if self.generation_id != other.generation_id: return False
217 return True
218
219 def __ne__(self, other): return not self.__eq__(other)
220
221 def show(self, prefix=''):
222 """Generate string showing basic members of structure
223 """
224 outstr = ''
225 outstr += prefix + 'role: ' + str(self.role) + '\n'
226 outstr += prefix + 'generation_id: ' + str(self.generation_id) + '\n'
227 return outstr
228
229
230class ofp_table_stats(object):
231 """Automatically generated Python class for ofp_table_stats
232
233 Date 2012-06-25
234 Created by of.pythonize.pythonizer
235 Core structure: Messages do not include ofp_header
236 Does not include var-length arrays
237 """
238 def __init__(self):
239 """Initialize
240 Declare members and default values
241 """
242 self.table_id = 0
243 self.pad= [0,0,0,0,0,0,0]
244 self.name= ""
245 self.match = 0
246 self.wildcards = 0
247 self.write_actions = 0
248 self.apply_actions = 0
249 self.write_setfields = 0
250 self.apply_setfields = 0
251 self.metadata_match = 0
252 self.metadata_write = 0
253 self.instructions = 0
254 self.config = 0
255 self.max_entries = 0
256 self.active_count = 0
257 self.lookup_count = 0
258 self.matched_count = 0
259
260 def __assert(self):
261 """Sanity check
262 """
263 if(not isinstance(self.pad, list)):
264 return (False, "self.pad is not list as expected.")
265 if(len(self.pad) != 7):
266 return (False, "self.pad is not of size 7 as expected.")
267 if(not isinstance(self.name, str)):
268 return (False, "self.name is not string as expected.")
269 if(len(self.name) > 32):
270 return (False, "self.name is not of size 32 as expected.")
271 return (True, None)
272
273 def pack(self, assertstruct=True):
274 """Pack message
275 Packs empty array used as placeholder
276 """
277 if(assertstruct):
278 if(not self.__assert()[0]):
279 return None
280 packed = ""
281 packed += struct.pack("!B", self.table_id)
282 packed += struct.pack("!BBBBBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3], self.pad[4], self.pad[5], self.pad[6])
283 packed += self.name.ljust(32,'\0')
284 packed += struct.pack("!QQLLQQQQLLLLQQ", self.match, self.wildcards, self.write_actions, self.apply_actions, self.write_setfields, self.apply_setfields, self.metadata_match, self.metadata_write, self.instructions, self.config, self.max_entries, self.active_count, self.lookup_count, self.matched_count)
285 return packed
286
287 def unpack(self, binaryString):
288 """Unpack message
289 Do not unpack empty array used as placeholder
290 since they can contain heterogeneous type
291 """
292 if (len(binaryString) < 128):
293 return binaryString
294 fmt = '!B'
295 start = 0
296 end = start + struct.calcsize(fmt)
297 (self.table_id,) = struct.unpack(fmt, binaryString[start:end])
298 fmt = '!BBBBBBB'
299 start = 1
300 end = start + struct.calcsize(fmt)
301 (self.pad[0], self.pad[1], self.pad[2], self.pad[3], self.pad[4], self.pad[5], self.pad[6]) = struct.unpack(fmt, binaryString[start:end])
302 self.name = binaryString[8:40].replace("\0","")
303 fmt = '!QQLLQQQQLLLLQQ'
304 start = 40
305 end = start + struct.calcsize(fmt)
306 (self.match, self.wildcards, self.write_actions, self.apply_actions, self.write_setfields, self.apply_setfields, self.metadata_match, self.metadata_write, self.instructions, self.config, self.max_entries, self.active_count, self.lookup_count, self.matched_count) = struct.unpack(fmt, binaryString[start:end])
307 return binaryString[128:]
308
309 def __len__(self):
310 """Return length of message
311 """
312 l = 128
313 return l
314
315 def __eq__(self, other):
316 """Return True if self and other have same values
317 """
318 if type(self) != type(other): return False
319 if self.table_id != other.table_id: return False
320 if self.pad != other.pad: return False
321 if self.name != other.name: return False
322 if self.match != other.match: return False
323 if self.wildcards != other.wildcards: return False
324 if self.write_actions != other.write_actions: return False
325 if self.apply_actions != other.apply_actions: return False
326 if self.write_setfields != other.write_setfields: return False
327 if self.apply_setfields != other.apply_setfields: return False
328 if self.metadata_write != other.metadata_match: return False
329 if self.metadata_write != other.metadata_write: return False
330 if self.instructions != other.instructions: return False
331 if self.config != other.config: return False
332 if self.max_entries != other.max_entries: return False
333 if self.active_count != other.active_count: return False
334 if self.lookup_count != other.lookup_count: return False
335 if self.matched_count != other.matched_count: return False
336 return True
337
338 def __ne__(self, other): return not self.__eq__(other)
339
340 def show(self, prefix=''):
341 """Generate string showing basic members of structure
342 """
343 outstr = ''
344 outstr += prefix + 'table_id: ' + str(self.table_id) + '\n'
345 outstr += prefix + 'name: ' + str(self.name) + '\n'
346 outstr += prefix + 'match: ' + str(self.match) + '\n'
347 outstr += prefix + 'wildcards: ' + str(self.wildcards) + '\n'
348 outstr += prefix + 'write_actions: ' + str(self.write_actions) + '\n'
349 outstr += prefix + 'apply_actions: ' + str(self.apply_actions) + '\n'
350 outstr += prefix + 'write_setfields: ' + str(self.write_setfields) + '\n'
351 outstr += prefix + 'apply_setfields: ' + str(self.apply_setfields) + '\n'
352 outstr += prefix + 'metadata_match: ' + str(self.metadata_match) + '\n'
353 outstr += prefix + 'metadata_write: ' + str(self.metadata_write) + '\n'
354 outstr += prefix + 'instructions: ' + str(self.instructions) + '\n'
355 outstr += prefix + 'config: ' + str(self.config) + '\n'
356 outstr += prefix + 'max_entries: ' + str(self.max_entries) + '\n'
357 outstr += prefix + 'active_count: ' + str(self.active_count) + '\n'
358 outstr += prefix + 'lookup_count: ' + str(self.lookup_count) + '\n'
359 outstr += prefix + 'matched_count: ' + str(self.matched_count) + '\n'
360 return outstr
361
362
363class ofp_table_mod(object):
364 """Automatically generated Python class for ofp_table_mod
365
366 Date 2012-06-25
367 Created by of.pythonize.pythonizer
368 Core structure: Messages do not include ofp_header
369 Does not include var-length arrays
370 """
371 def __init__(self):
372 """Initialize
373 Declare members and default values
374 """
375 self.table_id = 0
376 self.pad= [0,0,0]
377 self.config = 0
378
379 def __assert(self):
380 """Sanity check
381 """
382 if(not isinstance(self.pad, list)):
383 return (False, "self.pad is not list as expected.")
384 if(len(self.pad) != 3):
385 return (False, "self.pad is not of size 3 as expected.")
386 return (True, None)
387
388 def pack(self, assertstruct=True):
389 """Pack message
390 Packs empty array used as placeholder
391 """
392 if(assertstruct):
393 if(not self.__assert()[0]):
394 return None
395 packed = ""
396 packed += struct.pack("!B", self.table_id)
397 packed += struct.pack("!BBB", self.pad[0], self.pad[1], self.pad[2])
398 packed += struct.pack("!L", self.config)
399 return packed
400
401 def unpack(self, binaryString):
402 """Unpack message
403 Do not unpack empty array used as placeholder
404 since they can contain heterogeneous type
405 """
406 if (len(binaryString) < 8):
407 return binaryString
408 fmt = '!B'
409 start = 0
410 end = start + struct.calcsize(fmt)
411 (self.table_id,) = struct.unpack(fmt, binaryString[start:end])
412 fmt = '!BBB'
413 start = 1
414 end = start + struct.calcsize(fmt)
415 (self.pad[0], self.pad[1], self.pad[2]) = struct.unpack(fmt, binaryString[start:end])
416 fmt = '!L'
417 start = 4
418 end = start + struct.calcsize(fmt)
419 (self.config,) = struct.unpack(fmt, binaryString[start:end])
420 return binaryString[8:]
421
422 def __len__(self):
423 """Return length of message
424 """
425 l = 8
426 return l
427
428 def __eq__(self, other):
429 """Return True if self and other have same values
430 """
431 if type(self) != type(other): return False
432 if self.table_id != other.table_id: return False
433 if self.pad != other.pad: return False
434 if self.config != other.config: return False
435 return True
436
437 def __ne__(self, other): return not self.__eq__(other)
438
439 def show(self, prefix=''):
440 """Generate string showing basic members of structure
441 """
442 outstr = ''
443 outstr += prefix + 'table_id: ' + str(self.table_id) + '\n'
444 outstr += prefix + 'config: ' + str(self.config) + '\n'
445 return outstr
446
447
448class ofp_group_stats(object):
449 """Automatically generated Python class for ofp_group_stats
450
451 Date 2012-06-25
452 Created by of.pythonize.pythonizer
453 Core structure: Messages do not include ofp_header
454 Does not include var-length arrays
455 """
456 def __init__(self):
457 """Initialize
458 Declare members and default values
459 """
460 self.length = 0
461 self.pad= [0,0]
462 self.group_id = 0
463 self.ref_count = 0
464 self.pad2= [0,0,0,0]
465 self.packet_count = 0
466 self.byte_count = 0
467
468 def __assert(self):
469 """Sanity check
470 """
471 if(not isinstance(self.pad, list)):
472 return (False, "self.pad is not list as expected.")
473 if(len(self.pad) != 2):
474 return (False, "self.pad is not of size 2 as expected.")
475 if(not isinstance(self.pad2, list)):
476 return (False, "self.pad2 is not list as expected.")
477 if(len(self.pad2) != 4):
478 return (False, "self.pad2 is not of size 4 as expected.")
479 return (True, None)
480
481 def pack(self, assertstruct=True):
482 """Pack message
483 Packs empty array used as placeholder
484 """
485 if(assertstruct):
486 if(not self.__assert()[0]):
487 return None
488 packed = ""
489 packed += struct.pack("!H", self.length)
490 packed += struct.pack("!BB", self.pad[0], self.pad[1])
491 packed += struct.pack("!LL", self.group_id, self.ref_count)
492 packed += struct.pack("!BBBB", self.pad2[0], self.pad2[1], self.pad2[2], self.pad2[3])
493 packed += struct.pack("!QQ", self.packet_count, self.byte_count)
494 return packed
495
496 def unpack(self, binaryString):
497 """Unpack message
498 Do not unpack empty array used as placeholder
499 since they can contain heterogeneous type
500 """
501 if (len(binaryString) < 32):
502 return binaryString
503 fmt = '!H'
504 start = 0
505 end = start + struct.calcsize(fmt)
506 (self.length,) = struct.unpack(fmt, binaryString[start:end])
507 fmt = '!BB'
508 start = 2
509 end = start + struct.calcsize(fmt)
510 (self.pad[0], self.pad[1]) = struct.unpack(fmt, binaryString[start:end])
511 fmt = '!LL'
512 start = 4
513 end = start + struct.calcsize(fmt)
514 (self.group_id, self.ref_count) = struct.unpack(fmt, binaryString[start:end])
515 fmt = '!BBBB'
516 start = 12
517 end = start + struct.calcsize(fmt)
518 (self.pad2[0], self.pad2[1], self.pad2[2], self.pad2[3]) = struct.unpack(fmt, binaryString[start:end])
519 fmt = '!QQ'
520 start = 16
521 end = start + struct.calcsize(fmt)
522 (self.packet_count, self.byte_count) = struct.unpack(fmt, binaryString[start:end])
523 return binaryString[32:]
524
525 def __len__(self):
526 """Return length of message
527 """
528 l = 32
529 return l
530
531 def __eq__(self, other):
532 """Return True if self and other have same values
533 """
534 if type(self) != type(other): return False
535 if self.length != other.length: return False
536 if self.pad != other.pad: return False
537 if self.group_id != other.group_id: return False
538 if self.ref_count != other.ref_count: return False
539 if self.pad2 != other.pad2: return False
540 if self.packet_count != other.packet_count: return False
541 if self.byte_count != other.byte_count: return False
542 return True
543
544 def __ne__(self, other): return not self.__eq__(other)
545
546 def show(self, prefix=''):
547 """Generate string showing basic members of structure
548 """
549 outstr = ''
550 outstr += prefix + 'length: ' + str(self.length) + '\n'
551 outstr += prefix + 'group_id: ' + str(self.group_id) + '\n'
552 outstr += prefix + 'ref_count: ' + str(self.ref_count) + '\n'
553 outstr += prefix + 'packet_count: ' + str(self.packet_count) + '\n'
554 outstr += prefix + 'byte_count: ' + str(self.byte_count) + '\n'
555 return outstr
556
557
558class ofp_instruction_actions(object):
559 """Automatically generated Python class for ofp_instruction_actions
560
561 Date 2012-06-25
562 Created by of.pythonize.pythonizer
563 Core structure: Messages do not include ofp_header
564 Does not include var-length arrays
565 """
566 def __init__(self):
567 """Initialize
568 Declare members and default values
569 """
570 self.type = 0
571 self.len = 0
572 self.pad= [0,0,0,0]
573
574 def __assert(self):
575 """Sanity check
576 """
577 if(not isinstance(self.pad, list)):
578 return (False, "self.pad is not list as expected.")
579 if(len(self.pad) != 4):
580 return (False, "self.pad is not of size 4 as expected.")
581 return (True, None)
582
583 def pack(self, assertstruct=True):
584 """Pack message
585 Packs empty array used as placeholder
586 """
587 if(assertstruct):
588 if(not self.__assert()[0]):
589 return None
590 packed = ""
591 packed += struct.pack("!HH", self.type, self.len)
592 packed += struct.pack("!BBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3])
593 return packed
594
595 def unpack(self, binaryString):
596 """Unpack message
597 Do not unpack empty array used as placeholder
598 since they can contain heterogeneous type
599 """
600 if (len(binaryString) < 8):
601 return binaryString
602 fmt = '!HH'
603 start = 0
604 end = start + struct.calcsize(fmt)
605 (self.type, self.len) = struct.unpack(fmt, binaryString[start:end])
606 fmt = '!BBBB'
607 start = 4
608 end = start + struct.calcsize(fmt)
609 (self.pad[0], self.pad[1], self.pad[2], self.pad[3]) = struct.unpack(fmt, binaryString[start:end])
610 return binaryString[8:]
611
612 def __len__(self):
613 """Return length of message
614 """
615 l = 8
616 return l
617
618 def __eq__(self, other):
619 """Return True if self and other have same values
620 """
621 if type(self) != type(other): return False
622 if self.type != other.type: return False
623 if self.len != other.len: return False
624 if self.pad != other.pad: return False
625 return True
626
627 def __ne__(self, other): return not self.__eq__(other)
628
629 def show(self, prefix=''):
630 """Generate string showing basic members of structure
631 """
632 outstr = ''
633 outstr += prefix + 'type: ' + str(self.type) + '\n'
634 outstr += prefix + 'len: ' + str(self.len) + '\n'
635 return outstr
636
637
638class ofp_queue_stats(object):
639 """Automatically generated Python class for ofp_queue_stats
640
641 Date 2012-06-25
642 Created by of.pythonize.pythonizer
643 Core structure: Messages do not include ofp_header
644 Does not include var-length arrays
645 """
646 def __init__(self):
647 """Initialize
648 Declare members and default values
649 """
650 self.port_no = 0
651 self.queue_id = 0
652 self.tx_bytes = 0
653 self.tx_packets = 0
654 self.tx_errors = 0
655
656 def __assert(self):
657 """Sanity check
658 """
659 return (True, None)
660
661 def pack(self, assertstruct=True):
662 """Pack message
663 Packs empty array used as placeholder
664 """
665 if(assertstruct):
666 if(not self.__assert()[0]):
667 return None
668 packed = ""
669 packed += struct.pack("!LLQQQ", self.port_no, self.queue_id, self.tx_bytes, self.tx_packets, self.tx_errors)
670 return packed
671
672 def unpack(self, binaryString):
673 """Unpack message
674 Do not unpack empty array used as placeholder
675 since they can contain heterogeneous type
676 """
677 if (len(binaryString) < 32):
678 return binaryString
679 fmt = '!LLQQQ'
680 start = 0
681 end = start + struct.calcsize(fmt)
682 (self.port_no, self.queue_id, self.tx_bytes, self.tx_packets, self.tx_errors) = struct.unpack(fmt, binaryString[start:end])
683 return binaryString[32:]
684
685 def __len__(self):
686 """Return length of message
687 """
688 l = 32
689 return l
690
691 def __eq__(self, other):
692 """Return True if self and other have same values
693 """
694 if type(self) != type(other): return False
695 if self.port_no != other.port_no: return False
696 if self.queue_id != other.queue_id: return False
697 if self.tx_bytes != other.tx_bytes: return False
698 if self.tx_packets != other.tx_packets: return False
699 if self.tx_errors != other.tx_errors: return False
700 return True
701
702 def __ne__(self, other): return not self.__eq__(other)
703
704 def show(self, prefix=''):
705 """Generate string showing basic members of structure
706 """
707 outstr = ''
708 outstr += prefix + 'port_no: ' + str(self.port_no) + '\n'
709 outstr += prefix + 'queue_id: ' + str(self.queue_id) + '\n'
710 outstr += prefix + 'tx_bytes: ' + str(self.tx_bytes) + '\n'
711 outstr += prefix + 'tx_packets: ' + str(self.tx_packets) + '\n'
712 outstr += prefix + 'tx_errors: ' + str(self.tx_errors) + '\n'
713 return outstr
714
715
716class ofp_packet_in(object):
717 """Automatically generated Python class for ofp_packet_in
718
719 Date 2012-06-25
720 Created by of.pythonize.pythonizer
721 Core structure: Messages do not include ofp_header
722 Does not include var-length arrays
723 """
724 def __init__(self):
725 """Initialize
726 Declare members and default values
727 """
728 self.buffer_id = 0
729 self.total_len = 0
730 self.reason = 0
731 self.table_id = 0
732 self.match = ofp_match()
733
734 def __assert(self):
735 """Sanity check
736 """
737 if(not isinstance(self.match, ofp_match)):
738 return (False, "self.match is not class ofp_match as expected.")
739 return (True, None)
740
741 def pack(self, assertstruct=True):
742 """Pack message
743 Packs empty array used as placeholder
744 """
745 if(assertstruct):
746 if(not self.__assert()[0]):
747 return None
748 packed = ""
749 packed += struct.pack("!LHBB", self.buffer_id, self.total_len, self.reason, self.table_id)
750 packed += self.match.pack()
751 return packed
752
753 def unpack(self, binaryString):
754 """Unpack message
755 Do not unpack empty array used as placeholder
756 since they can contain heterogeneous type
757 """
758 if (len(binaryString) < 12):
759 return binaryString
760 fmt = '!LHBB'
761 start = 0
762 end = start + struct.calcsize(fmt)
763 (self.buffer_id, self.total_len, self.reason, self.table_id) = struct.unpack(fmt, binaryString[start:end])
764 self.match.unpack(binaryString[8:])
765 return binaryString[12:]
766
767 def __len__(self):
768 """Return length of message
769 """
770 l = 12
771 return l
772
773 def __eq__(self, other):
774 """Return True if self and other have same values
775 """
776 if type(self) != type(other): return False
777 if self.buffer_id != other.buffer_id: return False
778 if self.total_len != other.total_len: return False
779 if self.reason != other.reason: return False
780 if self.table_id != other.table_id: return False
781 if self.match != other.match: return False
782 return True
783
784 def __ne__(self, other): return not self.__eq__(other)
785
786 def show(self, prefix=''):
787 """Generate string showing basic members of structure
788 """
789 outstr = ''
790 outstr += prefix + 'buffer_id: ' + str(self.buffer_id) + '\n'
791 outstr += prefix + 'total_len: ' + str(self.total_len) + '\n'
792 outstr += prefix + 'reason: ' + str(self.reason) + '\n'
793 outstr += prefix + 'table_id: ' + str(self.table_id) + '\n'
794 outstr += prefix + 'match: \n'
795 outstr += self.match.show(prefix + ' ')
796 return outstr
797
798
799class ofp_error_experimenter_msg(object):
800 """Automatically generated Python class for ofp_error_experimenter_msg
801
802 Date 2012-06-25
803 Created by of.pythonize.pythonizer
804 Core structure: Messages do not include ofp_header
805 Does not include var-length arrays
806 """
807 def __init__(self):
808 """Initialize
809 Declare members and default values
810 """
811 self.type = 0
812 self.exp_type = 0
813 self.experimenter = 0
814
815 def __assert(self):
816 """Sanity check
817 """
818 return (True, None)
819
820 def pack(self, assertstruct=True):
821 """Pack message
822 Packs empty array used as placeholder
823 """
824 if(assertstruct):
825 if(not self.__assert()[0]):
826 return None
827 packed = ""
828 packed += struct.pack("!HHL", self.type, self.exp_type, self.experimenter)
829 return packed
830
831 def unpack(self, binaryString):
832 """Unpack message
833 Do not unpack empty array used as placeholder
834 since they can contain heterogeneous type
835 """
836 if (len(binaryString) < 8):
837 return binaryString
838 fmt = '!HHL'
839 start = 0
840 end = start + struct.calcsize(fmt)
841 (self.type, self.exp_type, self.experimenter) = struct.unpack(fmt, binaryString[start:end])
842 return binaryString[8:]
843
844 def __len__(self):
845 """Return length of message
846 """
847 l = 8
848 return l
849
850 def __eq__(self, other):
851 """Return True if self and other have same values
852 """
853 if type(self) != type(other): return False
854 if self.type != other.type: return False
855 if self.exp_type != other.exp_type: return False
856 if self.experimenter != other.experimenter: return False
857 return True
858
859 def __ne__(self, other): return not self.__eq__(other)
860
861 def show(self, prefix=''):
862 """Generate string showing basic members of structure
863 """
864 outstr = ''
865 outstr += prefix + 'type: ' + str(self.type) + '\n'
866 outstr += prefix + 'exp_type: ' + str(self.exp_type) + '\n'
867 outstr += prefix + 'experimenter: ' + str(self.experimenter) + '\n'
868 return outstr
869
870
871class ofp_bucket_counter(object):
872 """Automatically generated Python class for ofp_bucket_counter
873
874 Date 2012-06-25
875 Created by of.pythonize.pythonizer
876 Core structure: Messages do not include ofp_header
877 Does not include var-length arrays
878 """
879 def __init__(self):
880 """Initialize
881 Declare members and default values
882 """
883 self.packet_count = 0
884 self.byte_count = 0
885
886 def __assert(self):
887 """Sanity check
888 """
889 return (True, None)
890
891 def pack(self, assertstruct=True):
892 """Pack message
893 Packs empty array used as placeholder
894 """
895 if(assertstruct):
896 if(not self.__assert()[0]):
897 return None
898 packed = ""
899 packed += struct.pack("!QQ", self.packet_count, self.byte_count)
900 return packed
901
902 def unpack(self, binaryString):
903 """Unpack message
904 Do not unpack empty array used as placeholder
905 since they can contain heterogeneous type
906 """
907 if (len(binaryString) < 16):
908 return binaryString
909 fmt = '!QQ'
910 start = 0
911 end = start + struct.calcsize(fmt)
912 (self.packet_count, self.byte_count) = struct.unpack(fmt, binaryString[start:end])
913 return binaryString[16:]
914
915 def __len__(self):
916 """Return length of message
917 """
918 l = 16
919 return l
920
921 def __eq__(self, other):
922 """Return True if self and other have same values
923 """
924 if type(self) != type(other): return False
925 if self.packet_count != other.packet_count: return False
926 if self.byte_count != other.byte_count: return False
927 return True
928
929 def __ne__(self, other): return not self.__eq__(other)
930
931 def show(self, prefix=''):
932 """Generate string showing basic members of structure
933 """
934 outstr = ''
935 outstr += prefix + 'packet_count: ' + str(self.packet_count) + '\n'
936 outstr += prefix + 'byte_count: ' + str(self.byte_count) + '\n'
937 return outstr
938
939
940class ofp_port_stats_request(object):
941 """Automatically generated Python class for ofp_port_stats_request
942
943 Date 2012-06-25
944 Created by of.pythonize.pythonizer
945 Core structure: Messages do not include ofp_header
946 Does not include var-length arrays
947 """
948 def __init__(self):
949 """Initialize
950 Declare members and default values
951 """
952 self.port_no = 0
953 self.pad= [0,0,0,0]
954
955 def __assert(self):
956 """Sanity check
957 """
958 if(not isinstance(self.pad, list)):
959 return (False, "self.pad is not list as expected.")
960 if(len(self.pad) != 4):
961 return (False, "self.pad is not of size 4 as expected.")
962 return (True, None)
963
964 def pack(self, assertstruct=True):
965 """Pack message
966 Packs empty array used as placeholder
967 """
968 if(assertstruct):
969 if(not self.__assert()[0]):
970 return None
971 packed = ""
972 packed += struct.pack("!L", self.port_no)
973 packed += struct.pack("!BBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3])
974 return packed
975
976 def unpack(self, binaryString):
977 """Unpack message
978 Do not unpack empty array used as placeholder
979 since they can contain heterogeneous type
980 """
981 if (len(binaryString) < 8):
982 return binaryString
983 fmt = '!L'
984 start = 0
985 end = start + struct.calcsize(fmt)
986 (self.port_no,) = struct.unpack(fmt, binaryString[start:end])
987 fmt = '!BBBB'
988 start = 4
989 end = start + struct.calcsize(fmt)
990 (self.pad[0], self.pad[1], self.pad[2], self.pad[3]) = struct.unpack(fmt, binaryString[start:end])
991 return binaryString[8:]
992
993 def __len__(self):
994 """Return length of message
995 """
996 l = 8
997 return l
998
999 def __eq__(self, other):
1000 """Return True if self and other have same values
1001 """
1002 if type(self) != type(other): return False
1003 if self.port_no != other.port_no: return False
1004 if self.pad != other.pad: return False
1005 return True
1006
1007 def __ne__(self, other): return not self.__eq__(other)
1008
1009 def show(self, prefix=''):
1010 """Generate string showing basic members of structure
1011 """
1012 outstr = ''
1013 outstr += prefix + 'port_no: ' + str(self.port_no) + '\n'
1014 return outstr
1015
1016
1017class ofp_stats_request(object):
1018 """Automatically generated Python class for ofp_stats_request
1019
1020 Date 2012-06-25
1021 Created by of.pythonize.pythonizer
1022 Core structure: Messages do not include ofp_header
1023 Does not include var-length arrays
1024 """
1025 def __init__(self):
1026 """Initialize
1027 Declare members and default values
1028 """
1029 self.type = 0
1030 self.flags = 0
1031 self.pad= [0,0,0,0]
1032
1033 def __assert(self):
1034 """Sanity check
1035 """
1036
1037 if(not isinstance(self.pad, list)):
1038 return (False, "self.pad is not list as expected.")
1039 if(len(self.pad) != 4):
1040 return (False, "self.pad is not of size 4 as expected.")
1041 return (True, None)
1042
1043 def pack(self, assertstruct=True):
1044 """Pack message
1045 Packs empty array used as placeholder
1046 """
1047 if(assertstruct):
1048 if(not self.__assert()[0]):
1049 return None
1050 packed = ""
1051 packed += struct.pack("!HH", self.type, self.flags)
1052 packed += struct.pack("!BBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3])
1053 return packed
1054
1055 def unpack(self, binaryString):
1056 """Unpack message
1057 Do not unpack empty array used as placeholder
1058 since they can contain heterogeneous type
1059 """
1060 if (len(binaryString) < 8):
1061 return binaryString
1062 fmt = '!HH'
1063 start = 0
1064 end = start + struct.calcsize(fmt)
1065 (self.type, self.flags) = struct.unpack(fmt, binaryString[start:end])
1066 fmt = '!BBBB'
1067 start = 4
1068 end = start + struct.calcsize(fmt)
1069 (self.pad[0], self.pad[1], self.pad[2], self.pad[3]) = struct.unpack(fmt, binaryString[start:end])
1070 return binaryString[8:]
1071
1072 def __len__(self):
1073 """Return length of message
1074 """
1075 l = 8
1076 return l
1077
1078 def __eq__(self, other):
1079 """Return True if self and other have same values
1080 """
1081 if type(self) != type(other): return False
1082 if self.type != other.type: return False
1083 if self.flags != other.flags: return False
1084 if self.pad != other.pad: return False
1085 return True
1086
1087 def __ne__(self, other): return not self.__eq__(other)
1088
1089 def show(self, prefix=''):
1090 """Generate string showing basic members of structure
1091 """
1092 outstr = ''
1093 outstr += prefix + 'type: ' + str(self.type) + '\n'
1094 outstr += prefix + 'flags: ' + str(self.flags) + '\n'
1095 return outstr
1096
1097
1098class ofp_instruction(object):
1099 """Automatically generated Python class for ofp_instruction
1100
1101 Date 2012-06-25
1102 Created by of.pythonize.pythonizer
1103 Core structure: Messages do not include ofp_header
1104 Does not include var-length arrays
1105 """
1106 def __init__(self):
1107 """Initialize
1108 Declare members and default values
1109 """
1110 self.type = 0
1111 self.len = 0
1112 self.pad= [0,0,0,0]
1113
1114 def __assert(self):
1115 """Sanity check
1116 """
1117 if(not isinstance(self.pad, list)):
1118 return (False, "self.pad is not list as expected.")
1119 if(len(self.pad) != 4):
1120 return (False, "self.pad is not of size 4 as expected.")
1121 return (True, None)
1122
1123 def pack(self, assertstruct=True):
1124 """Pack message
1125 Packs empty array used as placeholder
1126 """
1127 if(assertstruct):
1128 if(not self.__assert()[0]):
1129 return None
1130 packed = ""
1131 packed += struct.pack("!HH", self.type, self.len)
1132 packed += struct.pack("!BBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3])
1133 return packed
1134
1135 def unpack(self, binaryString):
1136 """Unpack message
1137 Do not unpack empty array used as placeholder
1138 since they can contain heterogeneous type
1139 """
1140 if (len(binaryString) < 8):
1141 return binaryString
1142 fmt = '!HH'
1143 start = 0
1144 end = start + struct.calcsize(fmt)
1145 (self.type, self.len) = struct.unpack(fmt, binaryString[start:end])
1146 fmt = '!BBBB'
1147 start = 4
1148 end = start + struct.calcsize(fmt)
1149 (self.pad[0], self.pad[1], self.pad[2], self.pad[3]) = struct.unpack(fmt, binaryString[start:end])
1150 return binaryString[8:]
1151
1152 def __len__(self):
1153 """Return length of message
1154 """
1155 l = 8
1156 return l
1157
1158 def __eq__(self, other):
1159 """Return True if self and other have same values
1160 """
1161 if type(self) != type(other): return False
1162 if self.type != other.type: return False
1163 if self.len != other.len: return False
1164 if self.pad != other.pad: return False
1165 return True
1166
1167 def __ne__(self, other): return not self.__eq__(other)
1168
1169 def show(self, prefix=''):
1170 """Generate string showing basic members of structure
1171 """
1172 outstr = ''
1173 outstr += prefix + 'type: ' + str(self.type) + '\n'
1174 outstr += prefix + 'len: ' + str(self.len) + '\n'
1175 return outstr
1176
1177
1178class ofp_group_stats_request(object):
1179 """Automatically generated Python class for ofp_group_stats_request
1180
1181 Date 2012-06-25
1182 Created by of.pythonize.pythonizer
1183 Core structure: Messages do not include ofp_header
1184 Does not include var-length arrays
1185 """
1186 def __init__(self):
1187 """Initialize
1188 Declare members and default values
1189 """
1190 self.group_id = 0
1191 self.pad= [0,0,0,0]
1192
1193 def __assert(self):
1194 """Sanity check
1195 """
1196 if(not isinstance(self.pad, list)):
1197 return (False, "self.pad is not list as expected.")
1198 if(len(self.pad) != 4):
1199 return (False, "self.pad is not of size 4 as expected.")
1200 return (True, None)
1201
1202 def pack(self, assertstruct=True):
1203 """Pack message
1204 Packs empty array used as placeholder
1205 """
1206 if(assertstruct):
1207 if(not self.__assert()[0]):
1208 return None
1209 packed = ""
1210 packed += struct.pack("!L", self.group_id)
1211 packed += struct.pack("!BBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3])
1212 return packed
1213
1214 def unpack(self, binaryString):
1215 """Unpack message
1216 Do not unpack empty array used as placeholder
1217 since they can contain heterogeneous type
1218 """
1219 if (len(binaryString) < 8):
1220 return binaryString
1221 fmt = '!L'
1222 start = 0
1223 end = start + struct.calcsize(fmt)
1224 (self.group_id,) = struct.unpack(fmt, binaryString[start:end])
1225 fmt = '!BBBB'
1226 start = 4
1227 end = start + struct.calcsize(fmt)
1228 (self.pad[0], self.pad[1], self.pad[2], self.pad[3]) = struct.unpack(fmt, binaryString[start:end])
1229 return binaryString[8:]
1230
1231 def __len__(self):
1232 """Return length of message
1233 """
1234 l = 8
1235 return l
1236
1237 def __eq__(self, other):
1238 """Return True if self and other have same values
1239 """
1240 if type(self) != type(other): return False
1241 if self.group_id != other.group_id: return False
1242 if self.pad != other.pad: return False
1243 return True
1244
1245 def __ne__(self, other): return not self.__eq__(other)
1246
1247 def show(self, prefix=''):
1248 """Generate string showing basic members of structure
1249 """
1250 outstr = ''
1251 outstr += prefix + 'group_id: ' + str(self.group_id) + '\n'
1252 return outstr
1253
1254
1255class ofp_experimenter_header(object):
1256 """Automatically generated Python class for ofp_experimenter_header
1257
1258 Date 2012-06-25
1259 Created by of.pythonize.pythonizer
1260 Core structure: Messages do not include ofp_header
1261 Does not include var-length arrays
1262 """
1263 def __init__(self):
1264 """Initialize
1265 Declare members and default values
1266 """
1267 self.experimenter = 0
1268 self.exp_type = 0
1269
1270 def __assert(self):
1271 """Sanity check
1272 """
1273 return (True, None)
1274
1275 def pack(self, assertstruct=True):
1276 """Pack message
1277 Packs empty array used as placeholder
1278 """
1279 if(assertstruct):
1280 if(not self.__assert()[0]):
1281 return None
1282 packed = ""
1283 packed += struct.pack("!LL", self.experimenter, self.exp_type)
1284 return packed
1285
1286 def unpack(self, binaryString):
1287 """Unpack message
1288 Do not unpack empty array used as placeholder
1289 since they can contain heterogeneous type
1290 """
1291 if (len(binaryString) < 8):
1292 return binaryString
1293 fmt = '!LL'
1294 start = 0
1295 end = start + struct.calcsize(fmt)
1296 (self.experimenter, self.exp_type) = struct.unpack(fmt, binaryString[start:end])
1297 return binaryString[8:]
1298
1299 def __len__(self):
1300 """Return length of message
1301 """
1302 l = 8
1303 return l
1304
1305 def __eq__(self, other):
1306 """Return True if self and other have same values
1307 """
1308 if type(self) != type(other): return False
1309 if self.experimenter != other.experimenter: return False
1310 if self.exp_type != other.exp_type: return False
1311 return True
1312
1313 def __ne__(self, other): return not self.__eq__(other)
1314
1315 def show(self, prefix=''):
1316 """Generate string showing basic members of structure
1317 """
1318 outstr = ''
1319 outstr += prefix + 'experimenter: ' + str(self.experimenter) + '\n'
1320 outstr += prefix + 'exp_type: ' + str(self.exp_type) + '\n'
1321 return outstr
1322
1323
1324class ofp_aggregate_stats_request(object):
1325 """Automatically generated Python class for ofp_aggregate_stats_request
1326
1327 Date 2012-06-25
1328 Created by of.pythonize.pythonizer
1329 Core structure: Messages do not include ofp_header
1330 Does not include var-length arrays
1331 """
1332 def __init__(self):
1333 """Initialize
1334 Declare members and default values
1335 """
1336 self.table_id = 0
1337 self.pad_asr= [0,0,0]
1338 self.out_port = 0
1339 self.out_group = 0
1340 self.pad_asr2= [0,0,0,0]
1341 self.cookie = 0
1342 self.cookie_mask = 0
1343 self.match = ofp_match()
1344
1345 def __assert(self):
1346 """Sanity check
1347 """
1348 if(not isinstance(self.pad_asr, list)):
1349 return (False, "self.pad_asr is not list as expected.")
1350 if(len(self.pad_asr) != 3):
1351 return (False, "self.pad_asr is not of size 3 as expected.")
1352 if(not isinstance(self.pad_asr2, list)):
1353 return (False, "self.pad_asr2 is not list as expected.")
1354 if(len(self.pad_asr2) != 4):
1355 return (False, "self.pad_asr2 is not of size 4 as expected.")
1356 if(not isinstance(self.match, ofp_match)):
1357 return (False, "self.match is not class ofp_match as expected.")
1358 return (True, None)
1359
1360 def pack(self, assertstruct=True):
1361 """Pack message
1362 Packs empty array used as placeholder
1363 """
1364 if(assertstruct):
1365 if(not self.__assert()[0]):
1366 return None
1367 packed = ""
1368 packed += struct.pack("!B", self.table_id)
1369 packed += struct.pack("!BBB", self.pad_asr[0], self.pad_asr[1], self.pad_asr[2])
1370 packed += struct.pack("!LL", self.out_port, self.out_group)
1371 packed += struct.pack("!BBBB", self.pad_asr2[0], self.pad_asr2[1], self.pad_asr2[2], self.pad_asr2[3])
1372 packed += struct.pack("!QQ", self.cookie, self.cookie_mask)
1373 packed += self.match.pack()
1374 return packed
1375
1376 def unpack(self, binaryString):
1377 """Unpack message
1378 Do not unpack empty array used as placeholder
1379 since they can contain heterogeneous type
1380 """
1381 if (len(binaryString) < 36):
1382 return binaryString
1383 fmt = '!B'
1384 start = 0
1385 end = start + struct.calcsize(fmt)
1386 (self.table_id,) = struct.unpack(fmt, binaryString[start:end])
1387 fmt = '!BBB'
1388 start = 1
1389 end = start + struct.calcsize(fmt)
1390 (self.pad[0], self.pad_asr[1], self.pad_asr[2]) = struct.unpack(fmt, binaryString[start:end])
1391 fmt = '!LL'
1392 start = 4
1393 end = start + struct.calcsize(fmt)
1394 (self.out_port, self.out_group) = struct.unpack(fmt, binaryString[start:end])
1395 fmt = '!BBBB'
1396 start = 12
1397 end = start + struct.calcsize(fmt)
1398 (self.pad2[0], self.pad_asr2[1], self.pad_asr2[2], self.pad_asr2[3]) = struct.unpack(fmt, binaryString[start:end])
1399 fmt = '!QQ'
1400 start = 16
1401 end = start + struct.calcsize(fmt)
1402 (self.cookie, self.cookie_mask) = struct.unpack(fmt, binaryString[start:end])
1403 self.match.unpack(binaryString[32:])
1404 return binaryString[36:]
1405
1406 def __len__(self):
1407 """Return length of message
1408 """
1409 l = 36
1410 return l
1411
1412 def __eq__(self, other):
1413 """Return True if self and other have same values
1414 """
1415 if type(self) != type(other): return False
1416 if self.table_id != other.table_id: return False
1417 if self.pad != other.pad: return False
1418 if self.out_port != other.out_port: return False
1419 if self.out_group != other.out_group: return False
1420 if self.pad2 != other.pad2: return False
1421 if self.cookie != other.cookie: return False
1422 if self.cookie_mask != other.cookie_mask: return False
1423 if self.match != other.match: return False
1424 return True
1425
1426 def __ne__(self, other): return not self.__eq__(other)
1427
1428 def show(self, prefix=''):
1429 """Generate string showing basic members of structure
1430 """
1431 outstr = ''
1432 outstr += prefix + 'table_id: ' + str(self.table_id) + '\n'
1433 outstr += prefix + 'out_port: ' + str(self.out_port) + '\n'
1434 outstr += prefix + 'out_group: ' + str(self.out_group) + '\n'
1435 outstr += prefix + 'cookie: ' + str(self.cookie) + '\n'
1436 outstr += prefix + 'cookie_mask: ' + str(self.cookie_mask) + '\n'
1437 outstr += prefix + 'match: \n'
1438 outstr += self.match.show(prefix + ' ')
1439 return outstr
1440
1441
1442class ofp_queue_get_config_request(object):
1443 """Automatically generated Python class for ofp_queue_get_config_request
1444
1445 Date 2012-06-25
1446 Created by of.pythonize.pythonizer
1447 Core structure: Messages do not include ofp_header
1448 Does not include var-length arrays
1449 """
1450 def __init__(self):
1451 """Initialize
1452 Declare members and default values
1453 """
1454 self.port = 0
1455 self.pad= [0,0,0,0]
1456
1457 def __assert(self):
1458 """Sanity check
1459 """
1460 if(not isinstance(self.pad, list)):
1461 return (False, "self.pad is not list as expected.")
1462 if(len(self.pad) != 4):
1463 return (False, "self.pad is not of size 4 as expected.")
1464 return (True, None)
1465
1466 def pack(self, assertstruct=True):
1467 """Pack message
1468 Packs empty array used as placeholder
1469 """
1470 if(assertstruct):
1471 if(not self.__assert()[0]):
1472 return None
1473 packed = ""
1474 packed += struct.pack("!L", self.port)
1475 packed += struct.pack("!BBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3])
1476 return packed
1477
1478 def unpack(self, binaryString):
1479 """Unpack message
1480 Do not unpack empty array used as placeholder
1481 since they can contain heterogeneous type
1482 """
1483 if (len(binaryString) < 8):
1484 return binaryString
1485 fmt = '!L'
1486 start = 0
1487 end = start + struct.calcsize(fmt)
1488 (self.port,) = struct.unpack(fmt, binaryString[start:end])
1489 fmt = '!BBBB'
1490 start = 4
1491 end = start + struct.calcsize(fmt)
1492 (self.pad[0], self.pad[1], self.pad[2], self.pad[3]) = struct.unpack(fmt, binaryString[start:end])
1493 return binaryString[8:]
1494
1495 def __len__(self):
1496 """Return length of message
1497 """
1498 l = 8
1499 return l
1500
1501 def __eq__(self, other):
1502 """Return True if self and other have same values
1503 """
1504 if type(self) != type(other): return False
1505 if self.port != other.port: return False
1506 if self.pad != other.pad: return False
1507 return True
1508
1509 def __ne__(self, other): return not self.__eq__(other)
1510
1511 def show(self, prefix=''):
1512 """Generate string showing basic members of structure
1513 """
1514 outstr = ''
1515 outstr += prefix + 'port: ' + str(self.port) + '\n'
1516 return outstr
1517
1518
1519class ofp_action_nw_ttl(object):
1520 """Automatically generated Python class for ofp_action_nw_ttl
1521
1522 Date 2012-06-25
1523 Created by of.pythonize.pythonizer
1524 Core structure: Messages do not include ofp_header
1525 Does not include var-length arrays
1526 """
1527 def __init__(self):
1528 """Initialize
1529 Declare members and default values
1530 """
1531 self.type = 0
1532 self.len = 0
1533 self.nw_ttl = 0
1534 self.pad= [0,0,0]
1535
1536 def __assert(self):
1537 """Sanity check
1538 """
1539 if(not isinstance(self.pad, list)):
1540 return (False, "self.pad is not list as expected.")
1541 if(len(self.pad) != 3):
1542 return (False, "self.pad is not of size 3 as expected.")
1543 return (True, None)
1544
1545 def pack(self, assertstruct=True):
1546 """Pack message
1547 Packs empty array used as placeholder
1548 """
1549 if(assertstruct):
1550 if(not self.__assert()[0]):
1551 return None
1552 packed = ""
1553 packed += struct.pack("!HHB", self.type, self.len, self.nw_ttl)
1554 packed += struct.pack("!BBB", self.pad[0], self.pad[1], self.pad[2])
1555 return packed
1556
1557 def unpack(self, binaryString):
1558 """Unpack message
1559 Do not unpack empty array used as placeholder
1560 since they can contain heterogeneous type
1561 """
1562 if (len(binaryString) < 8):
1563 return binaryString
1564 fmt = '!HHB'
1565 start = 0
1566 end = start + struct.calcsize(fmt)
1567 (self.type, self.len, self.nw_ttl) = struct.unpack(fmt, binaryString[start:end])
1568 fmt = '!BBB'
1569 start = 5
1570 end = start + struct.calcsize(fmt)
1571 (self.pad[0], self.pad[1], self.pad[2]) = struct.unpack(fmt, binaryString[start:end])
1572 return binaryString[8:]
1573
1574 def __len__(self):
1575 """Return length of message
1576 """
1577 l = 8
1578 return l
1579
1580 def __eq__(self, other):
1581 """Return True if self and other have same values
1582 """
1583 if type(self) != type(other): return False
1584 if self.type != other.type: return False
1585 if self.len != other.len: return False
1586 if self.nw_ttl != other.nw_ttl: return False
1587 if self.pad != other.pad: return False
1588 return True
1589
1590 def __ne__(self, other): return not self.__eq__(other)
1591
1592 def show(self, prefix=''):
1593 """Generate string showing basic members of structure
1594 """
1595 outstr = ''
1596 outstr += prefix + 'type: ' + str(self.type) + '\n'
1597 outstr += prefix + 'len: ' + str(self.len) + '\n'
1598 outstr += prefix + 'nw_ttl: ' + str(self.nw_ttl) + '\n'
1599 return outstr
1600
1601
1602class ofp_port_status(object):
1603 """Automatically generated Python class for ofp_port_status
1604
1605 Date 2012-06-25
1606 Created by of.pythonize.pythonizer
1607 Core structure: Messages do not include ofp_header
1608 Does not include var-length arrays
1609 """
1610 def __init__(self):
1611 """Initialize
1612 Declare members and default values
1613 """
1614 self.reason = 0
1615 self.pad= [0,0,0,0,0,0,0]
1616 self.desc = ofp_port()
1617
1618 def __assert(self):
1619 """Sanity check
1620 """
1621 if(not isinstance(self.pad, list)):
1622 return (False, "self.pad is not list as expected.")
1623 if(len(self.pad) != 7):
1624 return (False, "self.pad is not of size 7 as expected.")
1625 if(not isinstance(self.desc, ofp_port)):
1626 return (False, "self.desc is not class ofp_port as expected.")
1627 return (True, None)
1628
1629 def pack(self, assertstruct=True):
1630 """Pack message
1631 Packs empty array used as placeholder
1632 """
1633 if(assertstruct):
1634 if(not self.__assert()[0]):
1635 return None
1636 packed = ""
1637 packed += struct.pack("!B", self.reason)
1638 packed += struct.pack("!BBBBBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3], self.pad[4], self.pad[5], self.pad[6])
1639 packed += self.desc.pack()
1640 return packed
1641
1642 def unpack(self, binaryString):
1643 """Unpack message
1644 Do not unpack empty array used as placeholder
1645 since they can contain heterogeneous type
1646 """
1647 if (len(binaryString) < 72):
1648 return binaryString
1649 fmt = '!B'
1650 start = 0
1651 end = start + struct.calcsize(fmt)
1652 (self.reason,) = struct.unpack(fmt, binaryString[start:end])
1653 fmt = '!BBBBBBB'
1654 start = 1
1655 end = start + struct.calcsize(fmt)
1656 (self.pad[0], self.pad[1], self.pad[2], self.pad[3], self.pad[4], self.pad[5], self.pad[6]) = struct.unpack(fmt, binaryString[start:end])
1657 self.desc.unpack(binaryString[8:])
1658 return binaryString[72:]
1659
1660 def __len__(self):
1661 """Return length of message
1662 """
1663 l = 72
1664 return l
1665
1666 def __eq__(self, other):
1667 """Return True if self and other have same values
1668 """
1669 if type(self) != type(other): return False
1670 if self.reason != other.reason: return False
1671 if self.pad != other.pad: return False
1672 if self.desc != other.desc: return False
1673 return True
1674
1675 def __ne__(self, other): return not self.__eq__(other)
1676
1677 def show(self, prefix=''):
1678 """Generate string showing basic members of structure
1679 """
1680 outstr = ''
1681 outstr += prefix + 'reason: ' + str(self.reason) + '\n'
1682 outstr += prefix + 'desc: \n'
1683 outstr += self.desc.show(prefix + ' ')
1684 return outstr
1685
1686
1687class ofp_action_header(object):
1688 """Automatically generated Python class for ofp_action_header
1689
1690 Date 2012-06-25
1691 Created by of.pythonize.pythonizer
1692 Core structure: Messages do not include ofp_header
1693 Does not include var-length arrays
1694 """
1695 def __init__(self):
1696 """Initialize
1697 Declare members and default values
1698 """
1699 self.type = 0
1700 self.len = 0
1701 self.pad= [0,0,0,0]
1702
1703 def __assert(self):
1704 """Sanity check
1705 """
1706 if(not isinstance(self.pad, list)):
1707 return (False, "self.pad is not list as expected.")
1708 if(len(self.pad) != 4):
1709 return (False, "self.pad is not of size 4 as expected.")
1710 return (True, None)
1711
1712 def pack(self, assertstruct=True):
1713 """Pack message
1714 Packs empty array used as placeholder
1715 """
1716 if(assertstruct):
1717 if(not self.__assert()[0]):
1718 return None
1719 packed = ""
1720 packed += struct.pack("!HH", self.type, self.len)
1721 packed += struct.pack("!BBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3])
1722 return packed
1723
1724 def unpack(self, binaryString):
1725 """Unpack message
1726 Do not unpack empty array used as placeholder
1727 since they can contain heterogeneous type
1728 """
1729 if (len(binaryString) < 8):
1730 return binaryString
1731 fmt = '!HH'
1732 start = 0
1733 end = start + struct.calcsize(fmt)
1734 (self.type, self.len) = struct.unpack(fmt, binaryString[start:end])
1735 fmt = '!BBBB'
1736 start = 4
1737 end = start + struct.calcsize(fmt)
1738 (self.pad[0], self.pad[1], self.pad[2], self.pad[3]) = struct.unpack(fmt, binaryString[start:end])
1739 return binaryString[8:]
1740
1741 def __len__(self):
1742 """Return length of message
1743 """
1744 l = 8
1745 return l
1746
1747 def __eq__(self, other):
1748 """Return True if self and other have same values
1749 """
1750 if type(self) != type(other): return False
1751 if self.type != other.type: return False
1752 if self.len != other.len: return False
1753 if self.pad != other.pad: return False
1754 return True
1755
1756 def __ne__(self, other): return not self.__eq__(other)
1757
1758 def show(self, prefix=''):
1759 """Generate string showing basic members of structure
1760 """
1761 outstr = ''
1762 outstr += prefix + 'type: ' + str(self.type) + '\n'
1763 outstr += prefix + 'len: ' + str(self.len) + '\n'
1764 return outstr
1765
1766
1767class ofp_port_mod(object):
1768 """Automatically generated Python class for ofp_port_mod
1769
1770 Date 2012-06-25
1771 Created by of.pythonize.pythonizer
1772 Core structure: Messages do not include ofp_header
1773 Does not include var-length arrays
1774 """
1775 def __init__(self):
1776 """Initialize
1777 Declare members and default values
1778 """
1779 self.port_no = 0
1780 self.pad= [0,0,0,0]
1781 self.hw_addr= [0,0,0,0,0,0]
1782 self.pad2= [0,0]
1783 self.config = 0
1784 self.mask = 0
1785 self.advertise = 0
1786 self.pad3= [0,0,0,0]
1787
1788 def __assert(self):
1789 """Sanity check
1790 """
1791 if(not isinstance(self.pad, list)):
1792 return (False, "self.pad is not list as expected.")
1793 if(len(self.pad) != 4):
1794 return (False, "self.pad is not of size 4 as expected.")
1795 if(not isinstance(self.hw_addr, list)):
1796 return (False, "self.hw_addr is not list as expected.")
1797 if(len(self.hw_addr) != 6):
1798 return (False, "self.hw_addr is not of size 6 as expected.")
1799 if(not isinstance(self.pad2, list)):
1800 return (False, "self.pad2 is not list as expected.")
1801 if(len(self.pad2) != 2):
1802 return (False, "self.pad2 is not of size 2 as expected.")
1803 if(not isinstance(self.pad3, list)):
1804 return (False, "self.pad3 is not list as expected.")
1805 if(len(self.pad3) != 4):
1806 return (False, "self.pad3 is not of size 4 as expected.")
1807 return (True, None)
1808
1809 def pack(self, assertstruct=True):
1810 """Pack message
1811 Packs empty array used as placeholder
1812 """
1813 if(assertstruct):
1814 if(not self.__assert()[0]):
1815 return None
1816 packed = ""
1817 packed += struct.pack("!L", self.port_no)
1818 packed += struct.pack("!BBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3])
1819 packed += struct.pack("!BBBBBB", self.hw_addr[0], self.hw_addr[1], self.hw_addr[2], self.hw_addr[3], self.hw_addr[4], self.hw_addr[5])
1820 packed += struct.pack("!BB", self.pad2[0], self.pad2[1])
1821 packed += struct.pack("!LLL", self.config, self.mask, self.advertise)
1822 packed += struct.pack("!BBBB", self.pad3[0], self.pad3[1], self.pad3[2], self.pad3[3])
1823 return packed
1824
1825 def unpack(self, binaryString):
1826 """Unpack message
1827 Do not unpack empty array used as placeholder
1828 since they can contain heterogeneous type
1829 """
1830 if (len(binaryString) < 32):
1831 return binaryString
1832 fmt = '!L'
1833 start = 0
1834 end = start + struct.calcsize(fmt)
1835 (self.port_no,) = struct.unpack(fmt, binaryString[start:end])
1836 fmt = '!BBBB'
1837 start = 4
1838 end = start + struct.calcsize(fmt)
1839 (self.pad[0], self.pad[1], self.pad[2], self.pad[3]) = struct.unpack(fmt, binaryString[start:end])
1840 fmt = '!BBBBBB'
1841 start = 8
1842 end = start + struct.calcsize(fmt)
1843 (self.hw_addr[0], self.hw_addr[1], self.hw_addr[2], self.hw_addr[3], self.hw_addr[4], self.hw_addr[5]) = struct.unpack(fmt, binaryString[start:end])
1844 fmt = '!BB'
1845 start = 14
1846 end = start + struct.calcsize(fmt)
1847 (self.pad2[0], self.pad2[1]) = struct.unpack(fmt, binaryString[start:end])
1848 fmt = '!LLL'
1849 start = 16
1850 end = start + struct.calcsize(fmt)
1851 (self.config, self.mask, self.advertise) = struct.unpack(fmt, binaryString[start:end])
1852 fmt = '!BBBB'
1853 start = 28
1854 end = start + struct.calcsize(fmt)
1855 (self.pad3[0], self.pad3[1], self.pad3[2], self.pad3[3]) = struct.unpack(fmt, binaryString[start:end])
1856 return binaryString[32:]
1857
1858 def __len__(self):
1859 """Return length of message
1860 """
1861 l = 32
1862 return l
1863
1864 def __eq__(self, other):
1865 """Return True if self and other have same values
1866 """
1867 if type(self) != type(other): return False
1868 if self.port_no != other.port_no: return False
1869 if self.pad != other.pad: return False
1870 if self.hw_addr != other.hw_addr: return False
1871 if self.pad2 != other.pad2: return False
1872 if self.config != other.config: return False
1873 if self.mask != other.mask: return False
1874 if self.advertise != other.advertise: return False
1875 if self.pad3 != other.pad3: return False
1876 return True
1877
1878 def __ne__(self, other): return not self.__eq__(other)
1879
1880 def show(self, prefix=''):
1881 """Generate string showing basic members of structure
1882 """
1883 outstr = ''
1884 outstr += prefix + 'port_no: ' + str(self.port_no) + '\n'
1885 outstr += prefix + 'hw_addr: ' + str(self.hw_addr) + '\n'
1886 outstr += prefix + 'config: ' + str(self.config) + '\n'
1887 outstr += prefix + 'mask: ' + str(self.mask) + '\n'
1888 outstr += prefix + 'advertise: ' + str(self.advertise) + '\n'
1889 return outstr
1890
1891
1892class ofp_action_output(object):
1893 """Automatically generated Python class for ofp_action_output
1894
1895 Date 2012-06-25
1896 Created by of.pythonize.pythonizer
1897 Core structure: Messages do not include ofp_header
1898 Does not include var-length arrays
1899 """
1900 def __init__(self):
1901 """Initialize
1902 Declare members and default values
1903 """
1904 self.type = 0
1905 self.len = 0
1906 self.port = 0
1907 self.max_len = 0
1908 self.pad= [0,0,0,0,0,0]
1909
1910 def __assert(self):
1911 """Sanity check
1912 """
1913 if(not isinstance(self.pad, list)):
1914 return (False, "self.pad is not list as expected.")
1915 if(len(self.pad) != 6):
1916 return (False, "self.pad is not of size 6 as expected.")
1917 return (True, None)
1918
1919 def pack(self, assertstruct=True):
1920 """Pack message
1921 Packs empty array used as placeholder
1922 """
1923 if(assertstruct):
1924 if(not self.__assert()[0]):
1925 return None
1926 packed = ""
1927 packed += struct.pack("!HHLH", self.type, self.len, self.port, self.max_len)
1928 packed += struct.pack("!BBBBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3], self.pad[4], self.pad[5])
1929 return packed
1930
1931 def unpack(self, binaryString):
1932 """Unpack message
1933 Do not unpack empty array used as placeholder
1934 since they can contain heterogeneous type
1935 """
1936 if (len(binaryString) < 16):
1937 return binaryString
1938 fmt = '!HHLH'
1939 start = 0
1940 end = start + struct.calcsize(fmt)
1941 (self.type, self.len, self.port, self.max_len) = struct.unpack(fmt, binaryString[start:end])
1942 fmt = '!BBBBBB'
1943 start = 10
1944 end = start + struct.calcsize(fmt)
1945 (self.pad[0], self.pad[1], self.pad[2], self.pad[3], self.pad[4], self.pad[5]) = struct.unpack(fmt, binaryString[start:end])
1946 return binaryString[16:]
1947
1948 def __len__(self):
1949 """Return length of message
1950 """
1951 l = 16
1952 return l
1953
1954 def __eq__(self, other):
1955 """Return True if self and other have same values
1956 """
1957 if type(self) != type(other): return False
1958 if self.type != other.type: return False
1959 if self.len != other.len: return False
1960 if self.port != other.port: return False
1961 if self.max_len != other.max_len: return False
1962 if self.pad != other.pad: return False
1963 return True
1964
1965 def __ne__(self, other): return not self.__eq__(other)
1966
1967 def show(self, prefix=''):
1968 """Generate string showing basic members of structure
1969 """
1970 outstr = ''
1971 outstr += prefix + 'type: ' + str(self.type) + '\n'
1972 outstr += prefix + 'len: ' + str(self.len) + '\n'
1973 outstr += prefix + 'port: ' + str(self.port) + '\n'
1974 outstr += prefix + 'max_len: ' + str(self.max_len) + '\n'
1975 return outstr
1976
1977
1978class ofp_switch_config(object):
1979 """Automatically generated Python class for ofp_switch_config
1980
1981 Date 2012-06-25
1982 Created by of.pythonize.pythonizer
1983 Core structure: Messages do not include ofp_header
1984 Does not include var-length arrays
1985 """
1986 def __init__(self):
1987 """Initialize
1988 Declare members and default values
1989 """
1990 self.flags = 0
1991 self.miss_send_len = 128
1992
1993 def __assert(self):
1994 """Sanity check
1995 """
1996 return (True, None)
1997
1998 def pack(self, assertstruct=True):
1999 """Pack message
2000 Packs empty array used as placeholder
2001 """
2002 if(assertstruct):
2003 if(not self.__assert()[0]):
2004 return None
2005 packed = ""
2006 packed += struct.pack("!HH", self.flags, self.miss_send_len)
2007 return packed
2008
2009 def unpack(self, binaryString):
2010 """Unpack message
2011 Do not unpack empty array used as placeholder
2012 since they can contain heterogeneous type
2013 """
2014 if (len(binaryString) < 4):
2015 return binaryString
2016 fmt = '!HH'
2017 start = 0
2018 end = start + struct.calcsize(fmt)
2019 (self.flags, self.miss_send_len) = struct.unpack(fmt, binaryString[start:end])
2020 return binaryString[4:]
2021
2022 def __len__(self):
2023 """Return length of message
2024 """
2025 l = 4
2026 return l
2027
2028 def __eq__(self, other):
2029 """Return True if self and other have same values
2030 """
2031 if type(self) != type(other): return False
2032 if self.flags != other.flags: return False
2033 if self.miss_send_len != other.miss_send_len: return False
2034 return True
2035
2036 def __ne__(self, other): return not self.__eq__(other)
2037
2038 def show(self, prefix=''):
2039 """Generate string showing basic members of structure
2040 """
2041 outstr = ''
2042 outstr += prefix + 'flags: ' + str(self.flags) + '\n'
2043 outstr += prefix + 'miss_send_len: ' + str(self.miss_send_len) + '\n'
2044 return outstr
2045
2046
2047class ofp_queue_prop_experimenter(object):
2048 """Automatically generated Python class for ofp_queue_prop_experimenter
2049
2050 Date 2012-06-25
2051 Created by of.pythonize.pythonizer
2052 Core structure: Messages do not include ofp_header
2053 Does not include var-length arrays
2054 """
2055 def __init__(self):
2056 """Initialize
2057 Declare members and default values
2058 """
2059 self.prop_header = ofp_queue_prop_header()
2060 self.experimenter = 0
2061 self.pad= [0,0,0,0]
2062
2063 def __assert(self):
2064 """Sanity check
2065 """
2066 if(not isinstance(self.prop_header, ofp_queue_prop_header)):
2067 return (False, "self.prop_header is not class ofp_queue_prop_header as expected.")
2068 if(not isinstance(self.pad, list)):
2069 return (False, "self.pad is not list as expected.")
2070 if(len(self.pad) != 4):
2071 return (False, "self.pad is not of size 4 as expected.")
2072 return (True, None)
2073
2074 def pack(self, assertstruct=True):
2075 """Pack message
2076 Packs empty array used as placeholder
2077 """
2078 if(assertstruct):
2079 if(not self.__assert()[0]):
2080 return None
2081 packed = ""
2082 packed += self.prop_header.pack()
2083 packed += struct.pack("!L", self.experimenter)
2084 packed += struct.pack("!BBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3])
2085 return packed
2086
2087 def unpack(self, binaryString):
2088 """Unpack message
2089 Do not unpack empty array used as placeholder
2090 since they can contain heterogeneous type
2091 """
2092 if (len(binaryString) < 16):
2093 return binaryString
2094 self.prop_header.unpack(binaryString[0:])
2095 fmt = '!L'
2096 start = 8
2097 end = start + struct.calcsize(fmt)
2098 (self.experimenter,) = struct.unpack(fmt, binaryString[start:end])
2099 fmt = '!BBBB'
2100 start = 12
2101 end = start + struct.calcsize(fmt)
2102 (self.pad[0], self.pad[1], self.pad[2], self.pad[3]) = struct.unpack(fmt, binaryString[start:end])
2103 return binaryString[16:]
2104
2105 def __len__(self):
2106 """Return length of message
2107 """
2108 l = 16
2109 return l
2110
2111 def __eq__(self, other):
2112 """Return True if self and other have same values
2113 """
2114 if type(self) != type(other): return False
2115 if self.prop_header != other.prop_header: return False
2116 if self.experimenter != other.experimenter: return False
2117 if self.pad != other.pad: return False
2118 return True
2119
2120 def __ne__(self, other): return not self.__eq__(other)
2121
2122 def show(self, prefix=''):
2123 """Generate string showing basic members of structure
2124 """
2125 outstr = ''
2126 outstr += prefix + 'prop_header: \n'
2127 outstr += self.prop_header.show(prefix + ' ')
2128 outstr += prefix + 'experimenter: ' + str(self.experimenter) + '\n'
2129 return outstr
2130
2131
2132class ofp_instruction_write_metadata(object):
2133 """Automatically generated Python class for ofp_instruction_write_metadata
2134
2135 Date 2012-06-25
2136 Created by of.pythonize.pythonizer
2137 Core structure: Messages do not include ofp_header
2138 Does not include var-length arrays
2139 """
2140 def __init__(self):
2141 """Initialize
2142 Declare members and default values
2143 """
2144 self.type = 0
2145 self.len = 0
2146 self.pad= [0,0,0,0]
2147 self.metadata = 0
2148 self.metadata_mask = 0
2149
2150 def __assert(self):
2151 """Sanity check
2152 """
2153 if(not isinstance(self.pad, list)):
2154 return (False, "self.pad is not list as expected.")
2155 if(len(self.pad) != 4):
2156 return (False, "self.pad is not of size 4 as expected.")
2157 return (True, None)
2158
2159 def pack(self, assertstruct=True):
2160 """Pack message
2161 Packs empty array used as placeholder
2162 """
2163 if(assertstruct):
2164 if(not self.__assert()[0]):
2165 return None
2166 packed = ""
2167 packed += struct.pack("!HH", self.type, self.len)
2168 packed += struct.pack("!BBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3])
2169 packed += struct.pack("!QQ", self.metadata, self.metadata_mask)
2170 return packed
2171
2172 def unpack(self, binaryString):
2173 """Unpack message
2174 Do not unpack empty array used as placeholder
2175 since they can contain heterogeneous type
2176 """
2177 if (len(binaryString) < 24):
2178 return binaryString
2179 fmt = '!HH'
2180 start = 0
2181 end = start + struct.calcsize(fmt)
2182 (self.type, self.len) = struct.unpack(fmt, binaryString[start:end])
2183 fmt = '!BBBB'
2184 start = 4
2185 end = start + struct.calcsize(fmt)
2186 (self.pad[0], self.pad[1], self.pad[2], self.pad[3]) = struct.unpack(fmt, binaryString[start:end])
2187 fmt = '!QQ'
2188 start = 8
2189 end = start + struct.calcsize(fmt)
2190 (self.metadata, self.metadata_mask) = struct.unpack(fmt, binaryString[start:end])
2191 return binaryString[24:]
2192
2193 def __len__(self):
2194 """Return length of message
2195 """
2196 l = 24
2197 return l
2198
2199 def __eq__(self, other):
2200 """Return True if self and other have same values
2201 """
2202 if type(self) != type(other): return False
2203 if self.type != other.type: return False
2204 if self.len != other.len: return False
2205 if self.pad != other.pad: return False
2206 if self.metadata != other.metadata: return False
2207 if self.metadata_mask != other.metadata_mask: return False
2208 return True
2209
2210 def __ne__(self, other): return not self.__eq__(other)
2211
2212 def show(self, prefix=''):
2213 """Generate string showing basic members of structure
2214 """
2215 outstr = ''
2216 outstr += prefix + 'type: ' + str(self.type) + '\n'
2217 outstr += prefix + 'len: ' + str(self.len) + '\n'
2218 outstr += prefix + 'metadata: ' + str(self.metadata) + '\n'
2219 outstr += prefix + 'metadata_mask: ' + str(self.metadata_mask) + '\n'
2220 return outstr
2221
2222
2223class ofp_action_experimenter_header(object):
2224 """Automatically generated Python class for ofp_action_experimenter_header
2225
2226 Date 2012-06-25
2227 Created by of.pythonize.pythonizer
2228 Core structure: Messages do not include ofp_header
2229 Does not include var-length arrays
2230 """
2231 def __init__(self):
2232 """Initialize
2233 Declare members and default values
2234 """
2235 self.type = 0
2236 self.len = 0
2237 self.experimenter = 0
2238
2239 def __assert(self):
2240 """Sanity check
2241 """
2242 return (True, None)
2243
2244 def pack(self, assertstruct=True):
2245 """Pack message
2246 Packs empty array used as placeholder
2247 """
2248 if(assertstruct):
2249 if(not self.__assert()[0]):
2250 return None
2251 packed = ""
2252 packed += struct.pack("!HHL", self.type, self.len, self.experimenter)
2253 return packed
2254
2255 def unpack(self, binaryString):
2256 """Unpack message
2257 Do not unpack empty array used as placeholder
2258 since they can contain heterogeneous type
2259 """
2260 if (len(binaryString) < 8):
2261 return binaryString
2262 fmt = '!HHL'
2263 start = 0
2264 end = start + struct.calcsize(fmt)
2265 (self.type, self.len, self.experimenter) = struct.unpack(fmt, binaryString[start:end])
2266 return binaryString[8:]
2267
2268 def __len__(self):
2269 """Return length of message
2270 """
2271 l = 8
2272 return l
2273
2274 def __eq__(self, other):
2275 """Return True if self and other have same values
2276 """
2277 if type(self) != type(other): return False
2278 if self.type != other.type: return False
2279 if self.len != other.len: return False
2280 if self.experimenter != other.experimenter: return False
2281 return True
2282
2283 def __ne__(self, other): return not self.__eq__(other)
2284
2285 def show(self, prefix=''):
2286 """Generate string showing basic members of structure
2287 """
2288 outstr = ''
2289 outstr += prefix + 'type: ' + str(self.type) + '\n'
2290 outstr += prefix + 'len: ' + str(self.len) + '\n'
2291 outstr += prefix + 'experimenter: ' + str(self.experimenter) + '\n'
2292 return outstr
2293
2294
2295class ofp_queue_get_config_reply(object):
2296 """Automatically generated Python class for ofp_queue_get_config_reply
2297
2298 Date 2012-06-25
2299 Created by of.pythonize.pythonizer
2300 Core structure: Messages do not include ofp_header
2301 Does not include var-length arrays
2302 """
2303 def __init__(self):
2304 """Initialize
2305 Declare members and default values
2306 """
2307 self.port = 0
2308 self.pad= [0,0,0,0]
2309
2310 def __assert(self):
2311 """Sanity check
2312 """
2313 if(not isinstance(self.pad, list)):
2314 return (False, "self.pad is not list as expected.")
2315 if(len(self.pad) != 4):
2316 return (False, "self.pad is not of size 4 as expected.")
2317 return (True, None)
2318
2319 def pack(self, assertstruct=True):
2320 """Pack message
2321 Packs empty array used as placeholder
2322 """
2323 if(assertstruct):
2324 if(not self.__assert()[0]):
2325 return None
2326 packed = ""
2327 packed += struct.pack("!L", self.port)
2328 packed += struct.pack("!BBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3])
2329 return packed
2330
2331 def unpack(self, binaryString):
2332 """Unpack message
2333 Do not unpack empty array used as placeholder
2334 since they can contain heterogeneous type
2335 """
2336 if (len(binaryString) < 8):
2337 return binaryString
2338 fmt = '!L'
2339 start = 0
2340 end = start + struct.calcsize(fmt)
2341 (self.port,) = struct.unpack(fmt, binaryString[start:end])
2342 fmt = '!BBBB'
2343 start = 4
2344 end = start + struct.calcsize(fmt)
2345 (self.pad[0], self.pad[1], self.pad[2], self.pad[3]) = struct.unpack(fmt, binaryString[start:end])
2346 return binaryString[8:]
2347
2348 def __len__(self):
2349 """Return length of message
2350 """
2351 l = 8
2352 return l
2353
2354 def __eq__(self, other):
2355 """Return True if self and other have same values
2356 """
2357 if type(self) != type(other): return False
2358 if self.port != other.port: return False
2359 if self.pad != other.pad: return False
2360 return True
2361
2362 def __ne__(self, other): return not self.__eq__(other)
2363
2364 def show(self, prefix=''):
2365 """Generate string showing basic members of structure
2366 """
2367 outstr = ''
2368 outstr += prefix + 'port: ' + str(self.port) + '\n'
2369 return outstr
2370
2371
2372class ofp_oxm_experimenter_header(object):
2373 """Automatically generated Python class for ofp_oxm_experimenter_header
2374
2375 Date 2012-06-25
2376 Created by of.pythonize.pythonizer
2377 Core structure: Messages do not include ofp_header
2378 Does not include var-length arrays
2379 """
2380 def __init__(self):
2381 """Initialize
2382 Declare members and default values
2383 """
2384 self.oxm_header = 0
2385 self.experimenter = 0
2386
2387 def __assert(self):
2388 """Sanity check
2389 """
2390 return (True, None)
2391
2392 def pack(self, assertstruct=True):
2393 """Pack message
2394 Packs empty array used as placeholder
2395 """
2396 if(assertstruct):
2397 if(not self.__assert()[0]):
2398 return None
2399 packed = ""
2400 packed += struct.pack("!LL", self.oxm_header, self.experimenter)
2401 return packed
2402
2403 def unpack(self, binaryString):
2404 """Unpack message
2405 Do not unpack empty array used as placeholder
2406 since they can contain heterogeneous type
2407 """
2408 if (len(binaryString) < 8):
2409 return binaryString
2410 fmt = '!LL'
2411 start = 0
2412 end = start + struct.calcsize(fmt)
2413 (self.oxm_header, self.experimenter) = struct.unpack(fmt, binaryString[start:end])
2414 return binaryString[8:]
2415
2416 def __len__(self):
2417 """Return length of message
2418 """
2419 l = 8
2420 return l
2421
2422 def __eq__(self, other):
2423 """Return True if self and other have same values
2424 """
2425 if type(self) != type(other): return False
2426 if self.oxm_header != other.oxm_header: return False
2427 if self.experimenter != other.experimenter: return False
2428 return True
2429
2430 def __ne__(self, other): return not self.__eq__(other)
2431
2432 def show(self, prefix=''):
2433 """Generate string showing basic members of structure
2434 """
2435 outstr = ''
2436 outstr += prefix + 'oxm_header: ' + str(self.oxm_header) + '\n'
2437 outstr += prefix + 'experimenter: ' + str(self.experimenter) + '\n'
2438 return outstr
2439
2440
2441class ofp_action_set_queue(object):
2442 """Automatically generated Python class for ofp_action_set_queue
2443
2444 Date 2012-06-25
2445 Created by of.pythonize.pythonizer
2446 Core structure: Messages do not include ofp_header
2447 Does not include var-length arrays
2448 """
2449 def __init__(self):
2450 """Initialize
2451 Declare members and default values
2452 """
2453 self.type = 0
2454 self.len = 0
2455 self.queue_id = 0
2456
2457 def __assert(self):
2458 """Sanity check
2459 """
2460 return (True, None)
2461
2462 def pack(self, assertstruct=True):
2463 """Pack message
2464 Packs empty array used as placeholder
2465 """
2466 if(assertstruct):
2467 if(not self.__assert()[0]):
2468 return None
2469 packed = ""
2470 packed += struct.pack("!HHL", self.type, self.len, self.queue_id)
2471 return packed
2472
2473 def unpack(self, binaryString):
2474 """Unpack message
2475 Do not unpack empty array used as placeholder
2476 since they can contain heterogeneous type
2477 """
2478 if (len(binaryString) < 8):
2479 return binaryString
2480 fmt = '!HHL'
2481 start = 0
2482 end = start + struct.calcsize(fmt)
2483 (self.type, self.len, self.queue_id) = struct.unpack(fmt, binaryString[start:end])
2484 return binaryString[8:]
2485
2486 def __len__(self):
2487 """Return length of message
2488 """
2489 l = 8
2490 return l
2491
2492 def __eq__(self, other):
2493 """Return True if self and other have same values
2494 """
2495 if type(self) != type(other): return False
2496 if self.type != other.type: return False
2497 if self.len != other.len: return False
2498 if self.queue_id != other.queue_id: return False
2499 return True
2500
2501 def __ne__(self, other): return not self.__eq__(other)
2502
2503 def show(self, prefix=''):
2504 """Generate string showing basic members of structure
2505 """
2506 outstr = ''
2507 outstr += prefix + 'type: ' + str(self.type) + '\n'
2508 outstr += prefix + 'len: ' + str(self.len) + '\n'
2509 outstr += prefix + 'queue_id: ' + str(self.queue_id) + '\n'
2510 return outstr
2511
2512
2513class ofp_action_set_field(object):
2514 """Automatically generated Python class for ofp_action_set_field
2515
2516 Date 2012-06-25
2517 Created by of.pythonize.pythonizer
2518 Core structure: Messages do not include ofp_header
2519 Does not include var-length arrays
2520 """
2521 def __init__(self):
2522 """Initialize
2523 Declare members and default values
2524 """
2525 self.type = 0
2526 self.len = 0
2527 self.field= [0,0,0,0]
2528
2529 def __assert(self):
2530 """Sanity check
2531 """
2532 if(not isinstance(self.field, list)):
2533 return (False, "self.field is not list as expected.")
2534 if(len(self.field) != 4):
2535 return (False, "self.field is not of size 4 as expected.")
2536 return (True, None)
2537
2538 def pack(self, assertstruct=True):
2539 """Pack message
2540 Packs empty array used as placeholder
2541 """
2542 if(assertstruct):
2543 if(not self.__assert()[0]):
2544 return None
2545 packed = ""
2546 packed += struct.pack("!HH", self.type, self.len)
2547 packed += struct.pack("!BBBB", self.field[0], self.field[1], self.field[2], self.field[3])
2548 return packed
2549
2550 def unpack(self, binaryString):
2551 """Unpack message
2552 Do not unpack empty array used as placeholder
2553 since they can contain heterogeneous type
2554 """
2555 if (len(binaryString) < 8):
2556 return binaryString
2557 fmt = '!HH'
2558 start = 0
2559 end = start + struct.calcsize(fmt)
2560 (self.type, self.len) = struct.unpack(fmt, binaryString[start:end])
2561 fmt = '!BBBB'
2562 start = 4
2563 end = start + struct.calcsize(fmt)
2564 (self.field[0], self.field[1], self.field[2], self.field[3]) = struct.unpack(fmt, binaryString[start:end])
2565 return binaryString[8:]
2566
2567 def __len__(self):
2568 """Return length of message
2569 """
2570 l = 8
2571 return l
2572
2573 def __eq__(self, other):
2574 """Return True if self and other have same values
2575 """
2576 if type(self) != type(other): return False
2577 if self.type != other.type: return False
2578 if self.len != other.len: return False
2579 if self.field != other.field: return False
2580 return True
2581
2582 def __ne__(self, other): return not self.__eq__(other)
2583
2584 def show(self, prefix=''):
2585 """Generate string showing basic members of structure
2586 """
2587 outstr = ''
2588 outstr += prefix + 'type: ' + str(self.type) + '\n'
2589 outstr += prefix + 'len: ' + str(self.len) + '\n'
2590 outstr += prefix + 'field: ' + str(self.field) + '\n'
2591 return outstr
2592
2593
2594class ofp_flow_stats(object):
2595 """Automatically generated Python class for ofp_flow_stats
2596
2597 Date 2012-06-25
2598 Created by of.pythonize.pythonizer
2599 Core structure: Messages do not include ofp_header
2600 Does not include var-length arrays
2601 """
2602 def __init__(self):
2603 """Initialize
2604 Declare members and default values
2605 """
2606 self.length = 0
2607 self.table_id = 0
2608 self.pad = 0
2609 self.duration_sec = 0
2610 self.duration_nsec = 0
2611 self.priority = 0x8000
2612 self.idle_timeout = 0
2613 self.hard_timeout = 0
2614 self.pad2= [0,0,0,0,0,0]
2615 self.cookie = 0
2616 self.packet_count = 0
2617 self.byte_count = 0
2618 self.match = ofp_match()
2619
2620 def __assert(self):
2621 """Sanity check
2622 """
2623 if(not isinstance(self.pad2, list)):
2624 return (False, "self.pad2 is not list as expected.")
2625 if(len(self.pad2) != 6):
2626 return (False, "self.pad2 is not of size 6 as expected.")
2627 if(not isinstance(self.match, ofp_match)):
2628 return (False, "self.match is not class ofp_match as expected.")
2629 return (True, None)
2630
2631 def pack(self, assertstruct=True):
2632 """Pack message
2633 Packs empty array used as placeholder
2634 """
2635 if(assertstruct):
2636 if(not self.__assert()[0]):
2637 return None
2638 packed = ""
2639 packed += struct.pack("!HBBLLHHH", self.length, self.table_id, self.pad, self.duration_sec, self.duration_nsec, self.priority, self.idle_timeout, self.hard_timeout)
2640 packed += struct.pack("!BBBBBB", self.pad2[0], self.pad2[1], self.pad2[2], self.pad2[3], self.pad2[4], self.pad2[5])
2641 packed += struct.pack("!QQQ", self.cookie, self.packet_count, self.byte_count)
2642 packed += self.match.pack()
2643 return packed
2644
2645 def unpack(self, binaryString):
2646 """Unpack message
2647 Do not unpack empty array used as placeholder
2648 since they can contain heterogeneous type
2649 """
2650 if (len(binaryString) < 52):
2651 return binaryString
2652 fmt = '!HBBLLHHH'
2653 start = 0
2654 end = start + struct.calcsize(fmt)
2655 (self.length, self.table_id, self.pad, self.duration_sec, self.duration_nsec, self.priority, self.idle_timeout, self.hard_timeout) = struct.unpack(fmt, binaryString[start:end])
2656 fmt = '!BBBBBB'
2657 start = 18
2658 end = start + struct.calcsize(fmt)
2659 (self.pad2[0], self.pad2[1], self.pad2[2], self.pad2[3], self.pad2[4], self.pad2[5]) = struct.unpack(fmt, binaryString[start:end])
2660 fmt = '!QQQ'
2661 start = 24
2662 end = start + struct.calcsize(fmt)
2663 (self.cookie, self.packet_count, self.byte_count) = struct.unpack(fmt, binaryString[start:end])
2664 self.match.unpack(binaryString[48:])
2665 return binaryString[52:]
2666
2667 def __len__(self):
2668 """Return length of message
2669 """
2670 l = 52
2671 return l
2672
2673 def __eq__(self, other):
2674 """Return True if self and other have same values
2675 """
2676 if type(self) != type(other): return False
2677 if self.length != other.length: return False
2678 if self.table_id != other.table_id: return False
2679 if self.pad != other.pad: return False
2680 if self.duration_sec != other.duration_sec: return False
2681 if self.duration_nsec != other.duration_nsec: return False
2682 if self.priority != other.priority: return False
2683 if self.idle_timeout != other.idle_timeout: return False
2684 if self.hard_timeout != other.hard_timeout: return False
2685 if self.pad2 != other.pad2: return False
2686 if self.cookie != other.cookie: return False
2687 if self.packet_count != other.packet_count: return False
2688 if self.byte_count != other.byte_count: return False
2689 if self.match != other.match: return False
2690 return True
2691
2692 def __ne__(self, other): return not self.__eq__(other)
2693
2694 def show(self, prefix=''):
2695 """Generate string showing basic members of structure
2696 """
2697 outstr = ''
2698 outstr += prefix + 'length: ' + str(self.length) + '\n'
2699 outstr += prefix + 'table_id: ' + str(self.table_id) + '\n'
2700 outstr += prefix + 'duration_sec: ' + str(self.duration_sec) + '\n'
2701 outstr += prefix + 'duration_nsec: ' + str(self.duration_nsec) + '\n'
2702 outstr += prefix + 'priority: ' + str(self.priority) + '\n'
2703 outstr += prefix + 'idle_timeout: ' + str(self.idle_timeout) + '\n'
2704 outstr += prefix + 'hard_timeout: ' + str(self.hard_timeout) + '\n'
2705 outstr += prefix + 'cookie: ' + str(self.cookie) + '\n'
2706 outstr += prefix + 'packet_count: ' + str(self.packet_count) + '\n'
2707 outstr += prefix + 'byte_count: ' + str(self.byte_count) + '\n'
2708 outstr += prefix + 'match: \n'
2709 outstr += self.match.show(prefix + ' ')
2710 return outstr
2711
2712
2713class ofp_flow_removed(object):
2714 """Automatically generated Python class for ofp_flow_removed
2715
2716 Date 2012-06-25
2717 Created by of.pythonize.pythonizer
2718 Core structure: Messages do not include ofp_header
2719 Does not include var-length arrays
2720 """
2721 def __init__(self):
2722 """Initialize
2723 Declare members and default values
2724 """
2725 self.cookie = 0
2726 self.priority = 0
2727 self.reason = 0
2728 self.table_id = 0
2729 self.duration_sec = 0
2730 self.duration_nsec = 0
2731 self.idle_timeout = 0
2732 self.hard_timeout = 0
2733 self.packet_count = 0
2734 self.byte_count = 0
2735 self.match = ofp_match()
2736
2737 def __assert(self):
2738 """Sanity check
2739 """
2740 if(not isinstance(self.match, ofp_match)):
2741 return (False, "self.match is not class ofp_match as expected.")
2742 return (True, None)
2743
2744 def pack(self, assertstruct=True):
2745 """Pack message
2746 Packs empty array used as placeholder
2747 """
2748 if(assertstruct):
2749 if(not self.__assert()[0]):
2750 return None
2751 packed = ""
2752 packed += struct.pack("!QHBBLLHHQQ", self.cookie, self.priority, self.reason, self.table_id, self.duration_sec, self.duration_nsec, self.idle_timeout, self.hard_timeout, self.packet_count, self.byte_count)
2753 packed += self.match.pack()
2754 return packed
2755
2756 def unpack(self, binaryString):
2757 """Unpack message
2758 Do not unpack empty array used as placeholder
2759 since they can contain heterogeneous type
2760 """
2761 if (len(binaryString) < 44):
2762 return binaryString
2763 fmt = '!QHBBLLHHQQ'
2764 start = 0
2765 end = start + struct.calcsize(fmt)
2766 (self.cookie, self.priority, self.reason, self.table_id, self.duration_sec, self.duration_nsec, self.idle_timeout, self.hard_timeout, self.packet_count, self.byte_count) = struct.unpack(fmt, binaryString[start:end])
2767 self.match.unpack(binaryString[40:])
2768 return binaryString[44:]
2769
2770 def __len__(self):
2771 """Return length of message
2772 """
2773 l = 44
2774 return l
2775
2776 def __eq__(self, other):
2777 """Return True if self and other have same values
2778 """
2779 if type(self) != type(other): return False
2780 if self.cookie != other.cookie: return False
2781 if self.priority != other.priority: return False
2782 if self.reason != other.reason: return False
2783 if self.table_id != other.table_id: return False
2784 if self.duration_sec != other.duration_sec: return False
2785 if self.duration_nsec != other.duration_nsec: return False
2786 if self.idle_timeout != other.idle_timeout: return False
2787 if self.hard_timeout != other.hard_timeout: return False
2788 if self.packet_count != other.packet_count: return False
2789 if self.byte_count != other.byte_count: return False
2790 if self.match != other.match: return False
2791 return True
2792
2793 def __ne__(self, other): return not self.__eq__(other)
2794
2795 def show(self, prefix=''):
2796 """Generate string showing basic members of structure
2797 """
2798 outstr = ''
2799 outstr += prefix + 'cookie: ' + str(self.cookie) + '\n'
2800 outstr += prefix + 'priority: ' + str(self.priority) + '\n'
2801 outstr += prefix + 'reason: ' + str(self.reason) + '\n'
2802 outstr += prefix + 'table_id: ' + str(self.table_id) + '\n'
2803 outstr += prefix + 'duration_sec: ' + str(self.duration_sec) + '\n'
2804 outstr += prefix + 'duration_nsec: ' + str(self.duration_nsec) + '\n'
2805 outstr += prefix + 'idle_timeout: ' + str(self.idle_timeout) + '\n'
2806 outstr += prefix + 'hard_timeout: ' + str(self.hard_timeout) + '\n'
2807 outstr += prefix + 'packet_count: ' + str(self.packet_count) + '\n'
2808 outstr += prefix + 'byte_count: ' + str(self.byte_count) + '\n'
2809 outstr += prefix + 'match: \n'
2810 outstr += self.match.show(prefix + ' ')
2811 return outstr
2812
2813
2814class ofp_queue_prop_min_rate(object):
2815 """Automatically generated Python class for ofp_queue_prop_min_rate
2816
2817 Date 2012-06-25
2818 Created by of.pythonize.pythonizer
2819 Core structure: Messages do not include ofp_header
2820 Does not include var-length arrays
2821 """
2822 def __init__(self):
2823 """Initialize
2824 Declare members and default values
2825 """
2826 self.prop_header = ofp_queue_prop_header()
2827 self.rate = 0
2828 self.pad= [0,0,0,0,0,0]
2829
2830 def __assert(self):
2831 """Sanity check
2832 """
2833 if(not isinstance(self.prop_header, ofp_queue_prop_header)):
2834 return (False, "self.prop_header is not class ofp_queue_prop_header as expected.")
2835 if(not isinstance(self.pad, list)):
2836 return (False, "self.pad is not list as expected.")
2837 if(len(self.pad) != 6):
2838 return (False, "self.pad is not of size 6 as expected.")
2839 return (True, None)
2840
2841 def pack(self, assertstruct=True):
2842 """Pack message
2843 Packs empty array used as placeholder
2844 """
2845 if(assertstruct):
2846 if(not self.__assert()[0]):
2847 return None
2848 packed = ""
2849 packed += self.prop_header.pack()
2850 packed += struct.pack("!H", self.rate)
2851 packed += struct.pack("!BBBBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3], self.pad[4], self.pad[5])
2852 return packed
2853
2854 def unpack(self, binaryString):
2855 """Unpack message
2856 Do not unpack empty array used as placeholder
2857 since they can contain heterogeneous type
2858 """
2859 if (len(binaryString) < 16):
2860 return binaryString
2861 self.prop_header.unpack(binaryString[0:])
2862 fmt = '!H'
2863 start = 8
2864 end = start + struct.calcsize(fmt)
2865 (self.rate,) = struct.unpack(fmt, binaryString[start:end])
2866 fmt = '!BBBBBB'
2867 start = 10
2868 end = start + struct.calcsize(fmt)
2869 (self.pad[0], self.pad[1], self.pad[2], self.pad[3], self.pad[4], self.pad[5]) = struct.unpack(fmt, binaryString[start:end])
2870 return binaryString[16:]
2871
2872 def __len__(self):
2873 """Return length of message
2874 """
2875 l = 16
2876 return l
2877
2878 def __eq__(self, other):
2879 """Return True if self and other have same values
2880 """
2881 if type(self) != type(other): return False
2882 if self.prop_header != other.prop_header: return False
2883 if self.rate != other.rate: return False
2884 if self.pad != other.pad: return False
2885 return True
2886
2887 def __ne__(self, other): return not self.__eq__(other)
2888
2889 def show(self, prefix=''):
2890 """Generate string showing basic members of structure
2891 """
2892 outstr = ''
2893 outstr += prefix + 'prop_header: \n'
2894 outstr += self.prop_header.show(prefix + ' ')
2895 outstr += prefix + 'rate: ' + str(self.rate) + '\n'
2896 return outstr
2897
2898
2899class ofp_header(object):
2900 """Automatically generated Python class for ofp_header
2901
2902 Date 2012-06-25
2903 Created by of.pythonize.pythonizer
2904 Core structure: Messages do not include ofp_header
2905 Does not include var-length arrays
2906 """
2907 def __init__(self):
2908 """Initialize
2909 Declare members and default values
2910 """
2911 self.version = 0x03
2912 self.type = 0
2913 self.length = 0
2914 self.xid = 0
2915
2916 def __assert(self):
2917 """Sanity check
2918 """
2919 if (not (self.type in ofp_type_map.keys())):
2920 return (False, "type must have values from ofp_type_map.keys()")
2921 return (True, None)
2922
2923 def pack(self, assertstruct=True):
2924 """Pack message
2925 Packs empty array used as placeholder
2926 """
2927 if(assertstruct):
2928 if(not self.__assert()[0]):
2929 return None
2930 packed = ""
2931 packed += struct.pack("!BBHL", self.version, self.type, self.length, self.xid)
2932 return packed
2933
2934 def unpack(self, binaryString):
2935 """Unpack message
2936 Do not unpack empty array used as placeholder
2937 since they can contain heterogeneous type
2938 """
2939 if (len(binaryString) < 8):
2940 return binaryString
2941 fmt = '!BBHL'
2942 start = 0
2943 end = start + struct.calcsize(fmt)
2944 (self.version, self.type, self.length, self.xid) = struct.unpack(fmt, binaryString[start:end])
2945 return binaryString[8:]
2946
2947 def __len__(self):
2948 """Return length of message
2949 """
2950 l = 8
2951 return l
2952
2953 def __eq__(self, other):
2954 """Return True if self and other have same values
2955 """
2956 if type(self) != type(other): return False
2957 if self.version != other.version: return False
2958 if self.type != other.type: return False
2959 if self.length != other.length: return False
2960 if self.xid != other.xid: return False
2961 return True
2962
2963 def __ne__(self, other): return not self.__eq__(other)
2964
2965 def show(self, prefix=''):
2966 """Generate string showing basic members of structure
2967 """
2968 outstr = ''
2969 outstr += prefix + 'version: ' + str(self.version) + '\n'
2970 outstr += prefix + 'type: ' + str(self.type) + '\n'
2971 outstr += prefix + 'length: ' + str(self.length) + '\n'
2972 outstr += prefix + 'xid: ' + str(self.xid) + '\n'
2973 return outstr
2974
2975
2976class ofp_stats_reply(object):
2977 """Automatically generated Python class for ofp_stats_reply
2978
2979 Date 2012-06-25
2980 Created by of.pythonize.pythonizer
2981 Core structure: Messages do not include ofp_header
2982 Does not include var-length arrays
2983 """
2984 def __init__(self):
2985 """Initialize
2986 Declare members and default values
2987 """
2988 self.type = 0
2989 self.flags = 0
2990 self.pad= [0,0,0,0]
2991
2992 def __assert(self):
2993 """Sanity check
2994 """
2995 if(not isinstance(self.pad, list)):
2996 return (False, "self.pad is not list as expected.")
2997 if(len(self.pad) != 4):
2998 return (False, "self.pad is not of size 4 as expected.")
2999 return (True, None)
3000
3001 def pack(self, assertstruct=True):
3002 """Pack message
3003 Packs empty array used as placeholder
3004 """
3005 if(assertstruct):
3006 if(not self.__assert()[0]):
3007 return None
3008 packed = ""
3009 packed += struct.pack("!HH", self.type, self.flags)
3010 packed += struct.pack("!BBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3])
3011 return packed
3012
3013 def unpack(self, binaryString):
3014 """Unpack message
3015 Do not unpack empty array used as placeholder
3016 since they can contain heterogeneous type
3017 """
3018 if (len(binaryString) < 8):
3019 return binaryString
3020 fmt = '!HH'
3021 start = 0
3022 end = start + struct.calcsize(fmt)
3023 (self.type, self.flags) = struct.unpack(fmt, binaryString[start:end])
3024 fmt = '!BBBB'
3025 start = 4
3026 end = start + struct.calcsize(fmt)
3027 (self.pad[0], self.pad[1], self.pad[2], self.pad[3]) = struct.unpack(fmt, binaryString[start:end])
3028 return binaryString[8:]
3029
3030 def __len__(self):
3031 """Return length of message
3032 """
3033 l = 8
3034 return l
3035
3036 def __eq__(self, other):
3037 """Return True if self and other have same values
3038 """
3039 if type(self) != type(other): return False
3040 if self.type != other.type: return False
3041 if self.flags != other.flags: return False
3042 if self.pad != other.pad: return False
3043 return True
3044
3045 def __ne__(self, other): return not self.__eq__(other)
3046
3047 def show(self, prefix=''):
3048 """Generate string showing basic members of structure
3049 """
3050 outstr = ''
3051 outstr += prefix + 'type: ' + str(self.type) + '\n'
3052 outstr += prefix + 'flags: ' + str(self.flags) + '\n'
3053 return outstr
3054
3055
3056class ofp_queue_stats_request(object):
3057 """Automatically generated Python class for ofp_queue_stats_request
3058
3059 Date 2012-06-25
3060 Created by of.pythonize.pythonizer
3061 Core structure: Messages do not include ofp_header
3062 Does not include var-length arrays
3063 """
3064 def __init__(self):
3065 """Initialize
3066 Declare members and default values
3067 """
3068 self.port_no = 0
3069 self.queue_id = 0
3070
3071 def __assert(self):
3072 """Sanity check
3073 """
3074 return (True, None)
3075
3076 def pack(self, assertstruct=True):
3077 """Pack message
3078 Packs empty array used as placeholder
3079 """
3080 if(assertstruct):
3081 if(not self.__assert()[0]):
3082 return None
3083 packed = ""
3084 packed += struct.pack("!LL", self.port_no, self.queue_id)
3085 return packed
3086
3087 def unpack(self, binaryString):
3088 """Unpack message
3089 Do not unpack empty array used as placeholder
3090 since they can contain heterogeneous type
3091 """
3092 if (len(binaryString) < 8):
3093 return binaryString
3094 fmt = '!LL'
3095 start = 0
3096 end = start + struct.calcsize(fmt)
3097 (self.port_no, self.queue_id) = struct.unpack(fmt, binaryString[start:end])
3098 return binaryString[8:]
3099
3100 def __len__(self):
3101 """Return length of message
3102 """
3103 l = 8
3104 return l
3105
3106 def __eq__(self, other):
3107 """Return True if self and other have same values
3108 """
3109 if type(self) != type(other): return False
3110 if self.port_no != other.port_no: return False
3111 if self.queue_id != other.queue_id: return False
3112 return True
3113
3114 def __ne__(self, other): return not self.__eq__(other)
3115
3116 def show(self, prefix=''):
3117 """Generate string showing basic members of structure
3118 """
3119 outstr = ''
3120 outstr += prefix + 'port_no: ' + str(self.port_no) + '\n'
3121 outstr += prefix + 'queue_id: ' + str(self.queue_id) + '\n'
3122 return outstr
3123
3124
3125class ofp_group_features_stats(object):
3126 """Automatically generated Python class for ofp_group_features_stats
3127
3128 Date 2012-06-25
3129 Created by of.pythonize.pythonizer
3130 Core structure: Messages do not include ofp_header
3131 Does not include var-length arrays
3132 """
3133 def __init__(self):
3134 """Initialize
3135 Declare members and default values
3136 """
3137 self.types = 0
3138 self.capabilities = 0
3139 self.max_groups= [0,0,0,0]
3140 self.actions= [0,0,0,0]
3141
3142 def __assert(self):
3143 """Sanity check
3144 """
3145 if(not isinstance(self.max_groups, list)):
3146 return (False, "self.max_groups is not list as expected.")
3147 if(len(self.max_groups) != 4):
3148 return (False, "self.max_groups is not of size 4 as expected.")
3149 if(not isinstance(self.actions, list)):
3150 return (False, "self.actions is not list as expected.")
3151 if(len(self.actions) != 4):
3152 return (False, "self.actions is not of size 4 as expected.")
3153 return (True, None)
3154
3155 def pack(self, assertstruct=True):
3156 """Pack message
3157 Packs empty array used as placeholder
3158 """
3159 if(assertstruct):
3160 if(not self.__assert()[0]):
3161 return None
3162 packed = ""
3163 packed += struct.pack("!LL", self.types, self.capabilities)
3164 packed += struct.pack("!LLLL", self.max_groups[0], self.max_groups[1], self.max_groups[2], self.max_groups[3])
3165 packed += struct.pack("!LLLL", self.actions[0], self.actions[1], self.actions[2], self.actions[3])
3166 return packed
3167
3168 def unpack(self, binaryString):
3169 """Unpack message
3170 Do not unpack empty array used as placeholder
3171 since they can contain heterogeneous type
3172 """
3173 if (len(binaryString) < 40):
3174 return binaryString
3175 fmt = '!LL'
3176 start = 0
3177 end = start + struct.calcsize(fmt)
3178 (self.types, self.capabilities) = struct.unpack(fmt, binaryString[start:end])
3179 fmt = '!LLLL'
3180 start = 8
3181 end = start + struct.calcsize(fmt)
3182 (self.max_groups[0], self.max_groups[1], self.max_groups[2], self.max_groups[3]) = struct.unpack(fmt, binaryString[start:end])
3183 fmt = '!LLLL'
3184 start = 24
3185 end = start + struct.calcsize(fmt)
3186 (self.actions[0], self.actions[1], self.actions[2], self.actions[3]) = struct.unpack(fmt, binaryString[start:end])
3187 return binaryString[40:]
3188
3189 def __len__(self):
3190 """Return length of message
3191 """
3192 l = 40
3193 return l
3194
3195 def __eq__(self, other):
3196 """Return True if self and other have same values
3197 """
3198 if type(self) != type(other): return False
3199 if self.types != other.types: return False
3200 if self.capabilities != other.capabilities: return False
3201 if self.max_groups != other.max_groups: return False
3202 if self.actions != other.actions: return False
3203 return True
3204
3205 def __ne__(self, other): return not self.__eq__(other)
3206
3207 def show(self, prefix=''):
3208 """Generate string showing basic members of structure
3209 """
3210 outstr = ''
3211 outstr += prefix + 'types: ' + str(self.types) + '\n'
3212 outstr += prefix + 'capabilities: ' + str(self.capabilities) + '\n'
3213 outstr += prefix + 'max_groups: ' + str(self.max_groups) + '\n'
3214 outstr += prefix + 'actions: ' + str(self.actions) + '\n'
3215 return outstr
3216
3217
3218class ofp_group_mod(object):
3219 """Automatically generated Python class for ofp_group_mod
3220
3221 Date 2012-06-25
3222 Created by of.pythonize.pythonizer
3223 Core structure: Messages do not include ofp_header
3224 Does not include var-length arrays
3225 """
3226 def __init__(self):
3227 """Initialize
3228 Declare members and default values
3229 """
3230 self.command = 0
3231 self.type = 0
3232 self.pad = 0
3233 self.group_id = 0
3234
3235 def __assert(self):
3236 """Sanity check
3237 """
3238 return (True, None)
3239
3240 def pack(self, assertstruct=True):
3241 """Pack message
3242 Packs empty array used as placeholder
3243 """
3244 if(assertstruct):
3245 if(not self.__assert()[0]):
3246 return None
3247 packed = ""
3248 packed += struct.pack("!HBBL", self.command, self.type, self.pad, self.group_id)
3249 return packed
3250
3251 def unpack(self, binaryString):
3252 """Unpack message
3253 Do not unpack empty array used as placeholder
3254 since they can contain heterogeneous type
3255 """
3256 if (len(binaryString) < 8):
3257 return binaryString
3258 fmt = '!HBBL'
3259 start = 0
3260 end = start + struct.calcsize(fmt)
3261 (self.command, self.type, self.pad, self.group_id) = struct.unpack(fmt, binaryString[start:end])
3262 return binaryString[8:]
3263
3264 def __len__(self):
3265 """Return length of message
3266 """
3267 l = 8
3268 return l
3269
3270 def __eq__(self, other):
3271 """Return True if self and other have same values
3272 """
3273 if type(self) != type(other): return False
3274 if self.command != other.command: return False
3275 if self.type != other.type: return False
3276 if self.pad != other.pad: return False
3277 if self.group_id != other.group_id: return False
3278 return True
3279
3280 def __ne__(self, other): return not self.__eq__(other)
3281
3282 def show(self, prefix=''):
3283 """Generate string showing basic members of structure
3284 """
3285 outstr = ''
3286 outstr += prefix + 'command: ' + str(self.command) + '\n'
3287 outstr += prefix + 'type: ' + str(self.type) + '\n'
3288 outstr += prefix + 'group_id: ' + str(self.group_id) + '\n'
3289 return outstr
3290
3291
3292class ofp_port_stats(object):
3293 """Automatically generated Python class for ofp_port_stats
3294
3295 Date 2012-06-25
3296 Created by of.pythonize.pythonizer
3297 Core structure: Messages do not include ofp_header
3298 Does not include var-length arrays
3299 """
3300 def __init__(self):
3301 """Initialize
3302 Declare members and default values
3303 """
3304 self.port_no = 0
3305 self.pad= [0,0,0,0]
3306 self.rx_packets = 0
3307 self.tx_packets = 0
3308 self.rx_bytes = 0
3309 self.tx_bytes = 0
3310 self.rx_dropped = 0
3311 self.tx_dropped = 0
3312 self.rx_errors = 0
3313 self.tx_errors = 0
3314 self.rx_frame_err = 0
3315 self.rx_over_err = 0
3316 self.rx_crc_err = 0
3317 self.collisions = 0
3318
3319 def __assert(self):
3320 """Sanity check
3321 """
3322 if(not isinstance(self.pad, list)):
3323 return (False, "self.pad is not list as expected.")
3324 if(len(self.pad) != 4):
3325 return (False, "self.pad is not of size 4 as expected.")
3326 return (True, None)
3327
3328 def pack(self, assertstruct=True):
3329 """Pack message
3330 Packs empty array used as placeholder
3331 """
3332 if(assertstruct):
3333 if(not self.__assert()[0]):
3334 return None
3335 packed = ""
3336 packed += struct.pack("!L", self.port_no)
3337 packed += struct.pack("!BBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3])
3338 packed += struct.pack("!QQQQQQQQQQQQ", self.rx_packets, self.tx_packets, self.rx_bytes, self.tx_bytes, self.rx_dropped, self.tx_dropped, self.rx_errors, self.tx_errors, self.rx_frame_err, self.rx_over_err, self.rx_crc_err, self.collisions)
3339 return packed
3340
3341 def unpack(self, binaryString):
3342 """Unpack message
3343 Do not unpack empty array used as placeholder
3344 since they can contain heterogeneous type
3345 """
3346 if (len(binaryString) < 104):
3347 return binaryString
3348 fmt = '!L'
3349 start = 0
3350 end = start + struct.calcsize(fmt)
3351 (self.port_no,) = struct.unpack(fmt, binaryString[start:end])
3352 fmt = '!BBBB'
3353 start = 4
3354 end = start + struct.calcsize(fmt)
3355 (self.pad[0], self.pad[1], self.pad[2], self.pad[3]) = struct.unpack(fmt, binaryString[start:end])
3356 fmt = '!QQQQQQQQQQQQ'
3357 start = 8
3358 end = start + struct.calcsize(fmt)
3359 (self.rx_packets, self.tx_packets, self.rx_bytes, self.tx_bytes, self.rx_dropped, self.tx_dropped, self.rx_errors, self.tx_errors, self.rx_frame_err, self.rx_over_err, self.rx_crc_err, self.collisions) = struct.unpack(fmt, binaryString[start:end])
3360 return binaryString[104:]
3361
3362 def __len__(self):
3363 """Return length of message
3364 """
3365 l = 104
3366 return l
3367
3368 def __eq__(self, other):
3369 """Return True if self and other have same values
3370 """
3371 if type(self) != type(other): return False
3372 if self.port_no != other.port_no: return False
3373 if self.pad != other.pad: return False
3374 if self.rx_packets != other.rx_packets: return False
3375 if self.tx_packets != other.tx_packets: return False
3376 if self.rx_bytes != other.rx_bytes: return False
3377 if self.tx_bytes != other.tx_bytes: return False
3378 if self.rx_dropped != other.rx_dropped: return False
3379 if self.tx_dropped != other.tx_dropped: return False
3380 if self.rx_errors != other.rx_errors: return False
3381 if self.tx_errors != other.tx_errors: return False
3382 if self.rx_frame_err != other.rx_frame_err: return False
3383 if self.rx_over_err != other.rx_over_err: return False
3384 if self.rx_crc_err != other.rx_crc_err: return False
3385 if self.collisions != other.collisions: return False
3386 return True
3387
3388 def __ne__(self, other): return not self.__eq__(other)
3389
3390 def show(self, prefix=''):
3391 """Generate string showing basic members of structure
3392 """
3393 outstr = ''
3394 outstr += prefix + 'port_no: ' + str(self.port_no) + '\n'
3395 outstr += prefix + 'rx_packets: ' + str(self.rx_packets) + '\n'
3396 outstr += prefix + 'tx_packets: ' + str(self.tx_packets) + '\n'
3397 outstr += prefix + 'rx_bytes: ' + str(self.rx_bytes) + '\n'
3398 outstr += prefix + 'tx_bytes: ' + str(self.tx_bytes) + '\n'
3399 outstr += prefix + 'rx_dropped: ' + str(self.rx_dropped) + '\n'
3400 outstr += prefix + 'tx_dropped: ' + str(self.tx_dropped) + '\n'
3401 outstr += prefix + 'rx_errors: ' + str(self.rx_errors) + '\n'
3402 outstr += prefix + 'tx_errors: ' + str(self.tx_errors) + '\n'
3403 outstr += prefix + 'rx_frame_err: ' + str(self.rx_frame_err) + '\n'
3404 outstr += prefix + 'rx_over_err: ' + str(self.rx_over_err) + '\n'
3405 outstr += prefix + 'rx_crc_err: ' + str(self.rx_crc_err) + '\n'
3406 outstr += prefix + 'collisions: ' + str(self.collisions) + '\n'
3407 return outstr
3408
3409
3410class ofp_packet_queue(object):
3411 """Automatically generated Python class for ofp_packet_queue
3412
3413 Date 2012-06-25
3414 Created by of.pythonize.pythonizer
3415 Core structure: Messages do not include ofp_header
3416 Does not include var-length arrays
3417 """
3418 def __init__(self):
3419 """Initialize
3420 Declare members and default values
3421 """
3422 self.queue_id = 0
3423 self.port = 0
3424 self.len = 0
3425 self.pad= [0,0,0,0,0,0]
3426
3427 def __assert(self):
3428 """Sanity check
3429 """
3430 if(not isinstance(self.pad, list)):
3431 return (False, "self.pad is not list as expected.")
3432 if(len(self.pad) != 6):
3433 return (False, "self.pad is not of size 6 as expected.")
3434 return (True, None)
3435
3436 def pack(self, assertstruct=True):
3437 """Pack message
3438 Packs empty array used as placeholder
3439 """
3440 if(assertstruct):
3441 if(not self.__assert()[0]):
3442 return None
3443 packed = ""
3444 packed += struct.pack("!LLH", self.queue_id, self.port, self.len)
3445 packed += struct.pack("!BBBBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3], self.pad[4], self.pad[5])
3446 return packed
3447
3448 def unpack(self, binaryString):
3449 """Unpack message
3450 Do not unpack empty array used as placeholder
3451 since they can contain heterogeneous type
3452 """
3453 if (len(binaryString) < 16):
3454 return binaryString
3455 fmt = '!LLH'
3456 start = 0
3457 end = start + struct.calcsize(fmt)
3458 (self.queue_id, self.port, self.len) = struct.unpack(fmt, binaryString[start:end])
3459 fmt = '!BBBBBB'
3460 start = 10
3461 end = start + struct.calcsize(fmt)
3462 (self.pad[0], self.pad[1], self.pad[2], self.pad[3], self.pad[4], self.pad[5]) = struct.unpack(fmt, binaryString[start:end])
3463 return binaryString[16:]
3464
3465 def __len__(self):
3466 """Return length of message
3467 """
3468 l = 16
3469 return l
3470
3471 def __eq__(self, other):
3472 """Return True if self and other have same values
3473 """
3474 if type(self) != type(other): return False
3475 if self.queue_id != other.queue_id: return False
3476 if self.port != other.port: return False
3477 if self.len != other.len: return False
3478 if self.pad != other.pad: return False
3479 return True
3480
3481 def __ne__(self, other): return not self.__eq__(other)
3482
3483 def show(self, prefix=''):
3484 """Generate string showing basic members of structure
3485 """
3486 outstr = ''
3487 outstr += prefix + 'queue_id: ' + str(self.queue_id) + '\n'
3488 outstr += prefix + 'port: ' + str(self.port) + '\n'
3489 outstr += prefix + 'len: ' + str(self.len) + '\n'
3490 return outstr
3491
3492
3493class ofp_port(object):
3494 """Automatically generated Python class for ofp_port
3495
3496 Date 2012-06-25
3497 Created by of.pythonize.pythonizer
3498 Core structure: Messages do not include ofp_header
3499 Does not include var-length arrays
3500 """
3501 def __init__(self):
3502 """Initialize
3503 Declare members and default values
3504 """
3505 self.port_no = 0
3506 self.pad= [0,0,0,0]
3507 self.hw_addr= [0,0,0,0,0,0]
3508 self.pad2= [0,0]
3509 self.name= ""
3510 self.config = 0
3511 self.state = 0
3512 self.curr = 0
3513 self.advertised = 0
3514 self.supported = 0
3515 self.peer = 0
3516 self.curr_speed = 0
3517 self.max_speed = 0
3518
3519 def __assert(self):
3520 """Sanity check
3521 """
3522 if(not isinstance(self.pad, list)):
3523 return (False, "self.pad is not list as expected.")
3524 if(len(self.pad) != 4):
3525 return (False, "self.pad is not of size 4 as expected.")
3526 if(not isinstance(self.hw_addr, list)):
3527 return (False, "self.hw_addr is not list as expected.")
3528 if(len(self.hw_addr) != 6):
3529 return (False, "self.hw_addr is not of size 6 as expected.")
3530 if(not isinstance(self.pad2, list)):
3531 return (False, "self.pad2 is not list as expected.")
3532 if(len(self.pad2) != 2):
3533 return (False, "self.pad2 is not of size 2 as expected.")
3534 if(not isinstance(self.name, str)):
3535 return (False, "self.name is not string as expected.")
3536 if(len(self.name) > 16):
3537 return (False, "self.name is not of size 16 as expected.")
3538 return (True, None)
3539
3540 def pack(self, assertstruct=True):
3541 """Pack message
3542 Packs empty array used as placeholder
3543 """
3544 if(assertstruct):
3545 if(not self.__assert()[0]):
3546 return None
3547 packed = ""
3548 packed += struct.pack("!L", self.port_no)
3549 packed += struct.pack("!BBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3])
3550 packed += struct.pack("!BBBBBB", self.hw_addr[0], self.hw_addr[1], self.hw_addr[2], self.hw_addr[3], self.hw_addr[4], self.hw_addr[5])
3551 packed += struct.pack("!BB", self.pad2[0], self.pad2[1])
3552 packed += self.name.ljust(16,'\0')
3553 packed += struct.pack("!LLLLLLLL", self.config, self.state, self.curr, self.advertised, self.supported, self.peer, self.curr_speed, self.max_speed)
3554 return packed
3555
3556 def unpack(self, binaryString):
3557 """Unpack message
3558 Do not unpack empty array used as placeholder
3559 since they can contain heterogeneous type
3560 """
3561 if (len(binaryString) < 64):
3562 return binaryString
3563 fmt = '!L'
3564 start = 0
3565 end = start + struct.calcsize(fmt)
3566 (self.port_no,) = struct.unpack(fmt, binaryString[start:end])
3567 fmt = '!BBBB'
3568 start = 4
3569 end = start + struct.calcsize(fmt)
3570 (self.pad[0], self.pad[1], self.pad[2], self.pad[3]) = struct.unpack(fmt, binaryString[start:end])
3571 fmt = '!BBBBBB'
3572 start = 8
3573 end = start + struct.calcsize(fmt)
3574 (self.hw_addr[0], self.hw_addr[1], self.hw_addr[2], self.hw_addr[3], self.hw_addr[4], self.hw_addr[5]) = struct.unpack(fmt, binaryString[start:end])
3575 fmt = '!BB'
3576 start = 14
3577 end = start + struct.calcsize(fmt)
3578 (self.pad2[0], self.pad2[1]) = struct.unpack(fmt, binaryString[start:end])
3579 self.name = binaryString[16:32].replace("\0","")
3580 fmt = '!LLLLLLLL'
3581 start = 32
3582 end = start + struct.calcsize(fmt)
3583 (self.config, self.state, self.curr, self.advertised, self.supported, self.peer, self.curr_speed, self.max_speed) = struct.unpack(fmt, binaryString[start:end])
3584 return binaryString[64:]
3585
3586 def __len__(self):
3587 """Return length of message
3588 """
3589 l = 64
3590 return l
3591
3592 def __eq__(self, other):
3593 """Return True if self and other have same values
3594 """
3595 if type(self) != type(other): return False
3596 if self.port_no != other.port_no: return False
3597 if self.pad != other.pad: return False
3598 if self.hw_addr != other.hw_addr: return False
3599 if self.pad2 != other.pad2: return False
3600 if self.name != other.name: return False
3601 if self.config != other.config: return False
3602 if self.state != other.state: return False
3603 if self.curr != other.curr: return False
3604 if self.advertised != other.advertised: return False
3605 if self.supported != other.supported: return False
3606 if self.peer != other.peer: return False
3607 if self.curr_speed != other.curr_speed: return False
3608 if self.max_speed != other.max_speed: return False
3609 return True
3610
3611 def __ne__(self, other): return not self.__eq__(other)
3612
3613 def show(self, prefix=''):
3614 """Generate string showing basic members of structure
3615 """
3616 outstr = ''
3617 outstr += prefix + 'port_no: ' + str(self.port_no) + '\n'
3618 outstr += prefix + 'hw_addr: ' + str(self.hw_addr) + '\n'
3619 outstr += prefix + 'name: ' + str(self.name) + '\n'
3620 outstr += prefix + 'config: ' + str(self.config) + '\n'
3621 outstr += prefix + 'state: ' + str(self.state) + '\n'
3622 outstr += prefix + 'curr: ' + str(self.curr) + '\n'
3623 outstr += prefix + 'advertised: ' + str(self.advertised) + '\n'
3624 outstr += prefix + 'supported: ' + str(self.supported) + '\n'
3625 outstr += prefix + 'peer: ' + str(self.peer) + '\n'
3626 outstr += prefix + 'curr_speed: ' + str(self.curr_speed) + '\n'
3627 outstr += prefix + 'max_speed: ' + str(self.max_speed) + '\n'
3628 return outstr
3629
3630
3631class ofp_switch_features(object):
3632 """Automatically generated Python class for ofp_switch_features
3633
3634 Date 2012-06-25
3635 Created by of.pythonize.pythonizer
3636 Core structure: Messages do not include ofp_header
3637 Does not include var-length arrays
3638 """
3639 def __init__(self):
3640 """Initialize
3641 Declare members and default values
3642 """
3643 self.datapath_id = 0
3644 self.n_buffers = 0
3645 self.n_tables = 0
3646 self.pad= [0,0,0]
3647 self.capabilities = 0
3648 self.reserved = 0
3649
3650 def __assert(self):
3651 """Sanity check
3652 """
3653 if(not isinstance(self.pad, list)):
3654 return (False, "self.pad is not list as expected.")
3655 if(len(self.pad) != 3):
3656 return (False, "self.pad is not of size 3 as expected.")
3657 return (True, None)
3658
3659 def pack(self, assertstruct=True):
3660 """Pack message
3661 Packs empty array used as placeholder
3662 """
3663 if(assertstruct):
3664 if(not self.__assert()[0]):
3665 return None
3666 packed = ""
3667 packed += struct.pack("!QLB", self.datapath_id, self.n_buffers, self.n_tables)
3668 packed += struct.pack("!BBB", self.pad[0], self.pad[1], self.pad[2])
3669 packed += struct.pack("!LL", self.capabilities, self.reserved)
3670 return packed
3671
3672 def unpack(self, binaryString):
3673 """Unpack message
3674 Do not unpack empty array used as placeholder
3675 since they can contain heterogeneous type
3676 """
3677 if (len(binaryString) < 24):
3678 return binaryString
3679 fmt = '!QLB'
3680 start = 0
3681 end = start + struct.calcsize(fmt)
3682 (self.datapath_id, self.n_buffers, self.n_tables) = struct.unpack(fmt, binaryString[start:end])
3683 fmt = '!BBB'
3684 start = 13
3685 end = start + struct.calcsize(fmt)
3686 (self.pad[0], self.pad[1], self.pad[2]) = struct.unpack(fmt, binaryString[start:end])
3687 fmt = '!LL'
3688 start = 16
3689 end = start + struct.calcsize(fmt)
3690 (self.capabilities, self.reserved) = struct.unpack(fmt, binaryString[start:end])
3691 return binaryString[24:]
3692
3693 def __len__(self):
3694 """Return length of message
3695 """
3696 l = 24
3697 return l
3698
3699 def __eq__(self, other):
3700 """Return True if self and other have same values
3701 """
3702 if type(self) != type(other): return False
3703 if self.datapath_id != other.datapath_id: return False
3704 if self.n_buffers != other.n_buffers: return False
3705 if self.n_tables != other.n_tables: return False
3706 if self.pad != other.pad: return False
3707 if self.capabilities != other.capabilities: return False
3708 if self.reserved != other.reserved: return False
3709 return True
3710
3711 def __ne__(self, other): return not self.__eq__(other)
3712
3713 def show(self, prefix=''):
3714 """Generate string showing basic members of structure
3715 """
3716 outstr = ''
3717 outstr += prefix + 'datapath_id: ' + str(self.datapath_id) + '\n'
3718 outstr += prefix + 'n_buffers: ' + str(self.n_buffers) + '\n'
3719 outstr += prefix + 'n_tables: ' + str(self.n_tables) + '\n'
3720 outstr += prefix + 'capabilities: ' + str(self.capabilities) + '\n'
3721 outstr += prefix + 'reserved: ' + str(self.reserved) + '\n'
3722 return outstr
3723
3724
3725class ofp_queue_prop_header(object):
3726 """Automatically generated Python class for ofp_queue_prop_header
3727
3728 Date 2012-06-25
3729 Created by of.pythonize.pythonizer
3730 Core structure: Messages do not include ofp_header
3731 Does not include var-length arrays
3732 """
3733 def __init__(self):
3734 """Initialize
3735 Declare members and default values
3736 """
3737 self.property = 0
3738 self.len = 0
3739 self.pad= [0,0,0,0]
3740
3741 def __assert(self):
3742 """Sanity check
3743 """
3744 if(not isinstance(self.pad, list)):
3745 return (False, "self.pad is not list as expected.")
3746 if(len(self.pad) != 4):
3747 return (False, "self.pad is not of size 4 as expected.")
3748 return (True, None)
3749
3750 def pack(self, assertstruct=True):
3751 """Pack message
3752 Packs empty array used as placeholder
3753 """
3754 if(assertstruct):
3755 if(not self.__assert()[0]):
3756 return None
3757 packed = ""
3758 packed += struct.pack("!HH", self.property, self.len)
3759 packed += struct.pack("!BBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3])
3760 return packed
3761
3762 def unpack(self, binaryString):
3763 """Unpack message
3764 Do not unpack empty array used as placeholder
3765 since they can contain heterogeneous type
3766 """
3767 if (len(binaryString) < 8):
3768 return binaryString
3769 fmt = '!HH'
3770 start = 0
3771 end = start + struct.calcsize(fmt)
3772 (self.property, self.len) = struct.unpack(fmt, binaryString[start:end])
3773 fmt = '!BBBB'
3774 start = 4
3775 end = start + struct.calcsize(fmt)
3776 (self.pad[0], self.pad[1], self.pad[2], self.pad[3]) = struct.unpack(fmt, binaryString[start:end])
3777 return binaryString[8:]
3778
3779 def __len__(self):
3780 """Return length of message
3781 """
3782 l = 8
3783 return l
3784
3785 def __eq__(self, other):
3786 """Return True if self and other have same values
3787 """
3788 if type(self) != type(other): return False
3789 if self.property != other.property: return False
3790 if self.len != other.len: return False
3791 if self.pad != other.pad: return False
3792 return True
3793
3794 def __ne__(self, other): return not self.__eq__(other)
3795
3796 def show(self, prefix=''):
3797 """Generate string showing basic members of structure
3798 """
3799 outstr = ''
3800 outstr += prefix + 'property: ' + str(self.property) + '\n'
3801 outstr += prefix + 'len: ' + str(self.len) + '\n'
3802 return outstr
3803
3804
3805class ofp_flow_stats_request(object):
3806 """Automatically generated Python class for ofp_flow_stats_request
3807
3808 Date 2012-06-25
3809 Created by of.pythonize.pythonizer
3810 Core structure: Messages do not include ofp_header
3811 Does not include var-length arrays
3812 """
3813 def __init__(self):
3814 """Initialize
3815 Declare members and default values
3816 """
3817 self.table_id = 0
3818 self.pad_fstat= [0,0,0]
3819 self.out_port = 0
3820 self.out_group = 0
3821 self.pad_fstat2= [0,0,0,0]
3822 self.cookie = 0
3823 self.cookie_mask = 0
3824 self.match = ofp_match()
3825
3826 def __assert(self):
3827 """Sanity check
3828 """
3829 if(not isinstance(self.pad, list)):
3830 return (False, "self.pad_fstat is not list as expected.")
3831 if(len(self.pad_fstat) != 3):
3832 return (False, "self.pad_fstat is not of size 3 as expected.")
3833 if(not isinstance(self.pad_fstat2, list)):
3834 return (False, "self.pad_fstat2 is not list as expected.")
3835 if(len(self.pad_fstat2) != 4):
3836 return (False, "self.pad_ftsat2 is not of size 4 as expected.")
3837 if(not isinstance(self.match, ofp_match)):
3838 return (False, "self.match is not class ofp_match as expected.")
3839 return (True, None)
3840
3841 def pack(self, assertstruct=True):
3842 """Pack message
3843 Packs empty array used as placeholder
3844 """
3845 if(assertstruct):
3846 if(not self.__assert()[0]):
3847 return None
3848 packed = ""
3849 packed += struct.pack("!B", self.table_id)
3850 packed += struct.pack("!BBB", self.pad_fstat[0], self.pad_fstat[1], self.pad_fstat[2])
3851 packed += struct.pack("!LL", self.out_port, self.out_group)
3852 packed += struct.pack("!BBBB", self.pad_fstat2[0], self.pad_fstat2[1], self.pad_fstat2[2], self.pad_fstat2[3])
3853 packed += struct.pack("!QQ", self.cookie, self.cookie_mask)
3854 packed += self.match.pack()
3855 return packed
3856
3857 def unpack(self, binaryString):
3858 """Unpack message
3859 Do not unpack empty array used as placeholder
3860 since they can contain heterogeneous type
3861 """
3862 if (len(binaryString) < 36):
3863 return binaryString
3864 fmt = '!B'
3865 start = 0
3866 end = start + struct.calcsize(fmt)
3867 (self.table_id,) = struct.unpack(fmt, binaryString[start:end])
3868 fmt = '!BBB'
3869 start = 1
3870 end = start + struct.calcsize(fmt)
3871 (self.pad_fstat[0], self.pad_fstat[1], self.pad_fstat[2]) = struct.unpack(fmt, binaryString[start:end])
3872 fmt = '!LL'
3873 start = 4
3874 end = start + struct.calcsize(fmt)
3875 (self.out_port, self.out_group) = struct.unpack(fmt, binaryString[start:end])
3876 fmt = '!BBBB'
3877 start = 12
3878 end = start + struct.calcsize(fmt)
3879 (self.pad_fstat2[0], self.pad_fstat2[1], self.pad_fstat2[2], self.pad_fstat2[3]) = struct.unpack(fmt, binaryString[start:end])
3880 fmt = '!QQ'
3881 start = 16
3882 end = start + struct.calcsize(fmt)
3883 (self.cookie, self.cookie_mask) = struct.unpack(fmt, binaryString[start:end])
3884 self.match.unpack(binaryString[32:])
3885 return binaryString[36:]
3886
3887 def __len__(self):
3888 """Return length of message
3889 """
3890 l = 36
3891 return l
3892
3893 def __eq__(self, other):
3894 """Return True if self and other have same values
3895 """
3896 if type(self) != type(other): return False
3897 if self.table_id != other.table_id: return False
3898 if self.pad_fstat != other.pad_fstat: return False
3899 if self.out_port != other.out_port: return False
3900 if self.out_group != other.out_group: return False
3901 if self.pad_fstat2 != other.pad_fstat2: return False
3902 if self.cookie != other.cookie: return False
3903 if self.cookie_mask != other.cookie_mask: return False
3904 if self.match != other.match: return False
3905 return True
3906
3907 def __ne__(self, other): return not self.__eq__(other)
3908
3909 def show(self, prefix=''):
3910 """Generate string showing basic members of structure
3911 """
3912 outstr = ''
3913 outstr += prefix + 'table_id: ' + str(self.table_id) + '\n'
3914 outstr += prefix + 'out_port: ' + str(self.out_port) + '\n'
3915 outstr += prefix + 'out_group: ' + str(self.out_group) + '\n'
3916 outstr += prefix + 'cookie: ' + str(self.cookie) + '\n'
3917 outstr += prefix + 'cookie_mask: ' + str(self.cookie_mask) + '\n'
3918 outstr += prefix + 'match: \n'
3919 outstr += self.match.show(prefix + ' ')
3920 return outstr
3921
3922
3923class ofp_bucket(object):
3924 """Automatically generated Python class for ofp_bucket
3925
3926 Date 2012-06-25
3927 Created by of.pythonize.pythonizer
3928 Core structure: Messages do not include ofp_header
3929 Does not include var-length arrays
3930 """
3931 def __init__(self):
3932 """Initialize
3933 Declare members and default values
3934 """
3935 self.len = 0
3936 self.weight = 0
3937 self.watch_port = 0
3938 self.watch_group = 0
3939 self.pad= [0,0,0,0]
3940
3941 def __assert(self):
3942 """Sanity check
3943 """
3944 if(not isinstance(self.pad, list)):
3945 return (False, "self.pad is not list as expected.")
3946 if(len(self.pad) != 4):
3947 return (False, "self.pad is not of size 4 as expected.")
3948 return (True, None)
3949
3950 def pack(self, assertstruct=True):
3951 """Pack message
3952 Packs empty array used as placeholder
3953 """
3954 if(assertstruct):
3955 if(not self.__assert()[0]):
3956 return None
3957 packed = ""
3958 packed += struct.pack("!HHLL", self.len, self.weight, self.watch_port, self.watch_group)
3959 packed += struct.pack("!BBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3])
3960 return packed
3961
3962 def unpack(self, binaryString):
3963 """Unpack message
3964 Do not unpack empty array used as placeholder
3965 since they can contain heterogeneous type
3966 """
3967 if (len(binaryString) < 16):
3968 return binaryString
3969 fmt = '!HHLL'
3970 start = 0
3971 end = start + struct.calcsize(fmt)
3972 (self.len, self.weight, self.watch_port, self.watch_group) = struct.unpack(fmt, binaryString[start:end])
3973 fmt = '!BBBB'
3974 start = 12
3975 end = start + struct.calcsize(fmt)
3976 (self.pad[0], self.pad[1], self.pad[2], self.pad[3]) = struct.unpack(fmt, binaryString[start:end])
3977 return binaryString[16:]
3978
3979 def __len__(self):
3980 """Return length of message
3981 """
3982 l = 16
3983 return l
3984
3985 def __eq__(self, other):
3986 """Return True if self and other have same values
3987 """
3988 if type(self) != type(other): return False
3989 if self.len != other.len: return False
3990 if self.weight != other.weight: return False
3991 if self.watch_port != other.watch_port: return False
3992 if self.watch_group != other.watch_group: return False
3993 if self.pad != other.pad: return False
3994 return True
3995
3996 def __ne__(self, other): return not self.__eq__(other)
3997
3998 def show(self, prefix=''):
3999 """Generate string showing basic members of structure
4000 """
4001 outstr = ''
4002 outstr += prefix + 'len: ' + str(self.len) + '\n'
4003 outstr += prefix + 'weight: ' + str(self.weight) + '\n'
4004 outstr += prefix + 'watch_port: ' + str(self.watch_port) + '\n'
4005 outstr += prefix + 'watch_group: ' + str(self.watch_group) + '\n'
4006 return outstr
4007
4008
4009class ofp_action_pop_mpls(object):
4010 """Automatically generated Python class for ofp_action_pop_mpls
4011
4012 Date 2012-06-25
4013 Created by of.pythonize.pythonizer
4014 Core structure: Messages do not include ofp_header
4015 Does not include var-length arrays
4016 """
4017 def __init__(self):
4018 """Initialize
4019 Declare members and default values
4020 """
4021 self.type = 0
4022 self.len = 0
4023 self.ethertype = 0
4024 self.pad= [0,0]
4025
4026 def __assert(self):
4027 """Sanity check
4028 """
4029 if(not isinstance(self.pad, list)):
4030 return (False, "self.pad is not list as expected.")
4031 if(len(self.pad) != 2):
4032 return (False, "self.pad is not of size 2 as expected.")
4033 return (True, None)
4034
4035 def pack(self, assertstruct=True):
4036 """Pack message
4037 Packs empty array used as placeholder
4038 """
4039 if(assertstruct):
4040 if(not self.__assert()[0]):
4041 return None
4042 packed = ""
4043 packed += struct.pack("!HHH", self.type, self.len, self.ethertype)
4044 packed += struct.pack("!BB", self.pad[0], self.pad[1])
4045 return packed
4046
4047 def unpack(self, binaryString):
4048 """Unpack message
4049 Do not unpack empty array used as placeholder
4050 since they can contain heterogeneous type
4051 """
4052 if (len(binaryString) < 8):
4053 return binaryString
4054 fmt = '!HHH'
4055 start = 0
4056 end = start + struct.calcsize(fmt)
4057 (self.type, self.len, self.ethertype) = struct.unpack(fmt, binaryString[start:end])
4058 fmt = '!BB'
4059 start = 6
4060 end = start + struct.calcsize(fmt)
4061 (self.pad[0], self.pad[1]) = struct.unpack(fmt, binaryString[start:end])
4062 return binaryString[8:]
4063
4064 def __len__(self):
4065 """Return length of message
4066 """
4067 l = 8
4068 return l
4069
4070 def __eq__(self, other):
4071 """Return True if self and other have same values
4072 """
4073 if type(self) != type(other): return False
4074 if self.type != other.type: return False
4075 if self.len != other.len: return False
4076 if self.ethertype != other.ethertype: return False
4077 if self.pad != other.pad: return False
4078 return True
4079
4080 def __ne__(self, other): return not self.__eq__(other)
4081
4082 def show(self, prefix=''):
4083 """Generate string showing basic members of structure
4084 """
4085 outstr = ''
4086 outstr += prefix + 'type: ' + str(self.type) + '\n'
4087 outstr += prefix + 'len: ' + str(self.len) + '\n'
4088 outstr += prefix + 'ethertype: ' + str(self.ethertype) + '\n'
4089 return outstr
4090
4091
4092class ofp_match(object):
4093 """Automatically generated Python class for ofp_match
4094
4095 Date 2012-06-25
4096 Created by of.pythonize.pythonizer
4097 Core structure: Messages do not include ofp_header
4098 Does not include var-length arrays
4099 """
4100 def __init__(self):
4101 """Initialize
4102 Declare members and default values
4103 """
4104 self.type = OFPMT_OXM
4105 #exclude padding bytes
4106 self.length = OFP_MATCH_BYTES
4107
4108 def __assert(self):
4109 """Sanity check
4110 """
4111 return (True, None)
4112
4113 def pack(self, assertstruct=True):
4114 """Pack message
4115 Packs empty array used as placeholder
4116 """
4117 if(assertstruct):
4118 if(not self.__assert()[0]):
4119 return None
4120 packed = ""
4121 packed += struct.pack("!HH", self.type, self.length)
4122 return packed
4123
4124 def unpack(self, binaryString):
4125 """Unpack message
4126 Do not unpack empty array used as placeholder
4127 since they can contain heterogeneous type
4128 """
4129 if (len(binaryString) < 4):
4130 return binaryString
4131 fmt = '!HH'
4132 start = 0
4133 end = start + struct.calcsize(fmt)
4134 (self.type, self.length) = struct.unpack(fmt, binaryString[start:end])
4135 return binaryString[4:]
4136
4137 def __len__(self):
4138 """Return length of message
4139 """
4140 l = 4
4141 return l
4142
4143 def __eq__(self, other):
4144 """Return True if self and other have same values
4145 """
4146 if type(self) != type(other): return False
4147 if self.type != other.type: return False
4148 if self.length != other.length: return False
4149 return True
4150
4151 def __ne__(self, other): return not self.__eq__(other)
4152
4153 def show(self, prefix=''):
4154 """Generate string showing basic members of structure
4155 """
4156 outstr = ''
4157 outstr += prefix + 'type: ' + str(self.type) + '\n'
4158 outstr += prefix + 'length: ' + str(self.length) + '\n'
4159 return outstr
4160
4161
4162class ofp_flow_mod(object):
4163 """Automatically generated Python class for ofp_flow_mod
4164
4165 Date 2012-06-25
4166 Created by of.pythonize.pythonizer
4167 Core structure: Messages do not include ofp_header
4168 Does not include var-length arrays
4169 """
4170 def __init__(self):
4171 """Initialize
4172 Declare members and default values
4173 """
4174 self.cookie = 0
4175 self.cookie_mask = 0
4176 self.table_id = 0
4177 self.command = 0
4178 self.idle_timeout = 0
4179 self.hard_timeout = 0
4180 self.priority = 0x8000
4181 self.buffer_id = 0
4182 self.out_port = 0
4183 self.out_group = 0
4184 self.flags = 0
4185 self.pad= [0,0]
4186 self.match = ofp_match()
4187
4188 def __assert(self):
4189 """Sanity check
4190 """
4191 if(not isinstance(self.pad, list)):
4192 return (False, "self.pad is not list as expected.")
4193 if(len(self.pad) != 2):
4194 return (False, "self.pad is not of size 2 as expected.")
4195 if(not isinstance(self.match, ofp_match)):
4196 return (False, "self.match is not class ofp_match as expected.")
4197 return (True, None)
4198
4199 def pack(self, assertstruct=True):
4200 """Pack message
4201 Packs empty array used as placeholder
4202 """
4203 if(assertstruct):
4204 if(not self.__assert()[0]):
4205 return None
4206 packed = ""
4207 packed += struct.pack("!QQBBHHHLLLH", self.cookie, self.cookie_mask, self.table_id, self.command, self.idle_timeout, self.hard_timeout, self.priority, self.buffer_id, self.out_port, self.out_group, self.flags)
4208 packed += struct.pack("!BB", self.pad[0], self.pad[1])
4209 packed += self.match.pack()
4210 return packed
4211
4212 def unpack(self, binaryString):
4213 """Unpack message
4214 Do not unpack empty array used as placeholder
4215 since they can contain heterogeneous type
4216 """
4217 if (len(binaryString) < 44):
4218 return binaryString
4219 fmt = '!QQBBHHHLLLH'
4220 start = 0
4221 end = start + struct.calcsize(fmt)
4222 (self.cookie, self.cookie_mask, self.table_id, self.command, self.idle_timeout, self.hard_timeout, self.priority, self.buffer_id, self.out_port, self.out_group, self.flags) = struct.unpack(fmt, binaryString[start:end])
4223 fmt = '!BB'
4224 start = 38
4225 end = start + struct.calcsize(fmt)
4226 (self.pad[0], self.pad[1]) = struct.unpack(fmt, binaryString[start:end])
4227 self.match.unpack(binaryString[40:])
4228 return binaryString[44:]
4229
4230 def __len__(self):
4231 """Return length of message
4232 """
4233 l = 44
4234 return l
4235
4236 def __eq__(self, other):
4237 """Return True if self and other have same values
4238 """
4239 if type(self) != type(other): return False
4240 if self.cookie != other.cookie: return False
4241 if self.cookie_mask != other.cookie_mask: return False
4242 if self.table_id != other.table_id: return False
4243 if self.command != other.command: return False
4244 if self.idle_timeout != other.idle_timeout: return False
4245 if self.hard_timeout != other.hard_timeout: return False
4246 if self.priority != other.priority: return False
4247 if self.buffer_id != other.buffer_id: return False
4248 if self.out_port != other.out_port: return False
4249 if self.out_group != other.out_group: return False
4250 if self.flags != other.flags: return False
4251 if self.pad != other.pad: return False
4252 if self.match != other.match: return False
4253 return True
4254
4255 def __ne__(self, other): return not self.__eq__(other)
4256
4257 def show(self, prefix=''):
4258 """Generate string showing basic members of structure
4259 """
4260 outstr = ''
4261 outstr += prefix + 'cookie: ' + str(self.cookie) + '\n'
4262 outstr += prefix + 'cookie_mask: ' + str(self.cookie_mask) + '\n'
4263 outstr += prefix + 'table_id: ' + str(self.table_id) + '\n'
4264 outstr += prefix + 'command: ' + str(self.command) + '\n'
4265 outstr += prefix + 'idle_timeout: ' + str(self.idle_timeout) + '\n'
4266 outstr += prefix + 'hard_timeout: ' + str(self.hard_timeout) + '\n'
4267 outstr += prefix + 'priority: ' + str(self.priority) + '\n'
4268 outstr += prefix + 'buffer_id: ' + str(self.buffer_id) + '\n'
4269 outstr += prefix + 'out_port: ' + str(self.out_port) + '\n'
4270 outstr += prefix + 'out_group: ' + str(self.out_group) + '\n'
4271 outstr += prefix + 'flags: ' + str(self.flags) + '\n'
4272 outstr += prefix + 'match: \n'
4273 outstr += self.match.show(prefix + ' ')
4274 return outstr
4275
4276
4277class ofp_packet_out(object):
4278 """Automatically generated Python class for ofp_packet_out
4279
4280 Date 2012-06-25
4281 Created by of.pythonize.pythonizer
4282 Core structure: Messages do not include ofp_header
4283 Does not include var-length arrays
4284 """
4285 def __init__(self):
4286 """Initialize
4287 Declare members and default values
4288 """
4289 self.buffer_id = 4294967295
4290 self.in_port = 0
4291 self.actions_len = 0
4292 self.pad= [0,0,0,0,0,0]
4293
4294 def __assert(self):
4295 """Sanity check
4296 """
4297 if(not isinstance(self.pad, list)):
4298 return (False, "self.pad is not list as expected.")
4299 if(len(self.pad) != 6):
4300 return (False, "self.pad is not of size 6 as expected.")
4301 return (True, None)
4302
4303 def pack(self, assertstruct=True):
4304 """Pack message
4305 Packs empty array used as placeholder
4306 """
4307 if(assertstruct):
4308 if(not self.__assert()[0]):
4309 return None
4310 packed = ""
4311 packed += struct.pack("!LLH", self.buffer_id, self.in_port, self.actions_len)
4312 packed += struct.pack("!BBBBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3], self.pad[4], self.pad[5])
4313 return packed
4314
4315 def unpack(self, binaryString):
4316 """Unpack message
4317 Do not unpack empty array used as placeholder
4318 since they can contain heterogeneous type
4319 """
4320 if (len(binaryString) < 16):
4321 return binaryString
4322 fmt = '!LLH'
4323 start = 0
4324 end = start + struct.calcsize(fmt)
4325 (self.buffer_id, self.in_port, self.actions_len) = struct.unpack(fmt, binaryString[start:end])
4326 fmt = '!BBBBBB'
4327 start = 10
4328 end = start + struct.calcsize(fmt)
4329 (self.pad[0], self.pad[1], self.pad[2], self.pad[3], self.pad[4], self.pad[5]) = struct.unpack(fmt, binaryString[start:end])
4330 return binaryString[16:]
4331
4332 def __len__(self):
4333 """Return length of message
4334 """
4335 l = 16
4336 return l
4337
4338 def __eq__(self, other):
4339 """Return True if self and other have same values
4340 """
4341 if type(self) != type(other): return False
4342 if self.buffer_id != other.buffer_id: return False
4343 if self.in_port != other.in_port: return False
4344 if self.actions_len != other.actions_len: return False
4345 if self.pad != other.pad: return False
4346 return True
4347
4348 def __ne__(self, other): return not self.__eq__(other)
4349
4350 def show(self, prefix=''):
4351 """Generate string showing basic members of structure
4352 """
4353 outstr = ''
4354 outstr += prefix + 'buffer_id: ' + str(self.buffer_id) + '\n'
4355 outstr += prefix + 'in_port: ' + str(self.in_port) + '\n'
4356 outstr += prefix + 'actions_len: ' + str(self.actions_len) + '\n'
4357 return outstr
4358
4359
4360class ofp_instruction_goto_table(object):
4361 """Automatically generated Python class for ofp_instruction_goto_table
4362
4363 Date 2012-06-25
4364 Created by of.pythonize.pythonizer
4365 Core structure: Messages do not include ofp_header
4366 Does not include var-length arrays
4367 """
4368 def __init__(self):
4369 """Initialize
4370 Declare members and default values
4371 """
4372 self.type = 0
4373 self.len = 0
4374 self.table_id = 0
4375 self.pad= [0,0,0]
4376
4377 def __assert(self):
4378 """Sanity check
4379 """
4380 if(not isinstance(self.pad, list)):
4381 return (False, "self.pad is not list as expected.")
4382 if(len(self.pad) != 3):
4383 return (False, "self.pad is not of size 3 as expected.")
4384 return (True, None)
4385
4386 def pack(self, assertstruct=True):
4387 """Pack message
4388 Packs empty array used as placeholder
4389 """
4390 if(assertstruct):
4391 if(not self.__assert()[0]):
4392 return None
4393 packed = ""
4394 packed += struct.pack("!HHB", self.type, self.len, self.table_id)
4395 packed += struct.pack("!BBB", self.pad[0], self.pad[1], self.pad[2])
4396 return packed
4397
4398 def unpack(self, binaryString):
4399 """Unpack message
4400 Do not unpack empty array used as placeholder
4401 since they can contain heterogeneous type
4402 """
4403 if (len(binaryString) < 8):
4404 return binaryString
4405 fmt = '!HHB'
4406 start = 0
4407 end = start + struct.calcsize(fmt)
4408 (self.type, self.len, self.table_id) = struct.unpack(fmt, binaryString[start:end])
4409 fmt = '!BBB'
4410 start = 5
4411 end = start + struct.calcsize(fmt)
4412 (self.pad[0], self.pad[1], self.pad[2]) = struct.unpack(fmt, binaryString[start:end])
4413 return binaryString[8:]
4414
4415 def __len__(self):
4416 """Return length of message
4417 """
4418 l = 8
4419 return l
4420
4421 def __eq__(self, other):
4422 """Return True if self and other have same values
4423 """
4424 if type(self) != type(other): return False
4425 if self.type != other.type: return False
4426 if self.len != other.len: return False
4427 if self.table_id != other.table_id: return False
4428 if self.pad != other.pad: return False
4429 return True
4430
4431 def __ne__(self, other): return not self.__eq__(other)
4432
4433 def show(self, prefix=''):
4434 """Generate string showing basic members of structure
4435 """
4436 outstr = ''
4437 outstr += prefix + 'type: ' + str(self.type) + '\n'
4438 outstr += prefix + 'len: ' + str(self.len) + '\n'
4439 outstr += prefix + 'table_id: ' + str(self.table_id) + '\n'
4440 return outstr
4441
4442
4443class ofp_queue_prop_max_rate(object):
4444 """Automatically generated Python class for ofp_queue_prop_max_rate
4445
4446 Date 2012-06-25
4447 Created by of.pythonize.pythonizer
4448 Core structure: Messages do not include ofp_header
4449 Does not include var-length arrays
4450 """
4451 def __init__(self):
4452 """Initialize
4453 Declare members and default values
4454 """
4455 self.prop_header = ofp_queue_prop_header()
4456 self.rate = 0
4457 self.pad= [0,0,0,0,0,0]
4458
4459 def __assert(self):
4460 """Sanity check
4461 """
4462 if(not isinstance(self.prop_header, ofp_queue_prop_header)):
4463 return (False, "self.prop_header is not class ofp_queue_prop_header as expected.")
4464 if(not isinstance(self.pad, list)):
4465 return (False, "self.pad is not list as expected.")
4466 if(len(self.pad) != 6):
4467 return (False, "self.pad is not of size 6 as expected.")
4468 return (True, None)
4469
4470 def pack(self, assertstruct=True):
4471 """Pack message
4472 Packs empty array used as placeholder
4473 """
4474 if(assertstruct):
4475 if(not self.__assert()[0]):
4476 return None
4477 packed = ""
4478 packed += self.prop_header.pack()
4479 packed += struct.pack("!H", self.rate)
4480 packed += struct.pack("!BBBBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3], self.pad[4], self.pad[5])
4481 return packed
4482
4483 def unpack(self, binaryString):
4484 """Unpack message
4485 Do not unpack empty array used as placeholder
4486 since they can contain heterogeneous type
4487 """
4488 if (len(binaryString) < 16):
4489 return binaryString
4490 self.prop_header.unpack(binaryString[0:])
4491 fmt = '!H'
4492 start = 8
4493 end = start + struct.calcsize(fmt)
4494 (self.rate,) = struct.unpack(fmt, binaryString[start:end])
4495 fmt = '!BBBBBB'
4496 start = 10
4497 end = start + struct.calcsize(fmt)
4498 (self.pad[0], self.pad[1], self.pad[2], self.pad[3], self.pad[4], self.pad[5]) = struct.unpack(fmt, binaryString[start:end])
4499 return binaryString[16:]
4500
4501 def __len__(self):
4502 """Return length of message
4503 """
4504 l = 16
4505 return l
4506
4507 def __eq__(self, other):
4508 """Return True if self and other have same values
4509 """
4510 if type(self) != type(other): return False
4511 if self.prop_header != other.prop_header: return False
4512 if self.rate != other.rate: return False
4513 if self.pad != other.pad: return False
4514 return True
4515
4516 def __ne__(self, other): return not self.__eq__(other)
4517
4518 def show(self, prefix=''):
4519 """Generate string showing basic members of structure
4520 """
4521 outstr = ''
4522 outstr += prefix + 'prop_header: \n'
4523 outstr += self.prop_header.show(prefix + ' ')
4524 outstr += prefix + 'rate: ' + str(self.rate) + '\n'
4525 return outstr
4526
4527
4528class ofp_experimenter_stats_header(object):
4529 """Automatically generated Python class for ofp_experimenter_stats_header
4530
4531 Date 2012-06-25
4532 Created by of.pythonize.pythonizer
4533 Core structure: Messages do not include ofp_header
4534 Does not include var-length arrays
4535 """
4536 def __init__(self):
4537 """Initialize
4538 Declare members and default values
4539 """
4540 self.experimenter = 0
4541 self.exp_type = 0
4542
4543 def __assert(self):
4544 """Sanity check
4545 """
4546 return (True, None)
4547
4548 def pack(self, assertstruct=True):
4549 """Pack message
4550 Packs empty array used as placeholder
4551 """
4552 if(assertstruct):
4553 if(not self.__assert()[0]):
4554 return None
4555 packed = ""
4556 packed += struct.pack("!LL", self.experimenter, self.exp_type)
4557 return packed
4558
4559 def unpack(self, binaryString):
4560 """Unpack message
4561 Do not unpack empty array used as placeholder
4562 since they can contain heterogeneous type
4563 """
4564 if (len(binaryString) < 8):
4565 return binaryString
4566 fmt = '!LL'
4567 start = 0
4568 end = start + struct.calcsize(fmt)
4569 (self.experimenter, self.exp_type) = struct.unpack(fmt, binaryString[start:end])
4570 return binaryString[8:]
4571
4572 def __len__(self):
4573 """Return length of message
4574 """
4575 l = 8
4576 return l
4577
4578 def __eq__(self, other):
4579 """Return True if self and other have same values
4580 """
4581 if type(self) != type(other): return False
4582 if self.experimenter != other.experimenter: return False
4583 if self.exp_type != other.exp_type: return False
4584 return True
4585
4586 def __ne__(self, other): return not self.__eq__(other)
4587
4588 def show(self, prefix=''):
4589 """Generate string showing basic members of structure
4590 """
4591 outstr = ''
4592 outstr += prefix + 'experimenter: ' + str(self.experimenter) + '\n'
4593 outstr += prefix + 'exp_type: ' + str(self.exp_type) + '\n'
4594 return outstr
4595
4596
4597class ofp_action_group(object):
4598 """Automatically generated Python class for ofp_action_group
4599
4600 Date 2012-06-25
4601 Created by of.pythonize.pythonizer
4602 Core structure: Messages do not include ofp_header
4603 Does not include var-length arrays
4604 """
4605 def __init__(self):
4606 """Initialize
4607 Declare members and default values
4608 """
4609 self.type = 0
4610 self.len = 0
4611 self.group_id = 0
4612
4613 def __assert(self):
4614 """Sanity check
4615 """
4616 return (True, None)
4617
4618 def pack(self, assertstruct=True):
4619 """Pack message
4620 Packs empty array used as placeholder
4621 """
4622 if(assertstruct):
4623 if(not self.__assert()[0]):
4624 return None
4625 packed = ""
4626 packed += struct.pack("!HHL", self.type, self.len, self.group_id)
4627 return packed
4628
4629 def unpack(self, binaryString):
4630 """Unpack message
4631 Do not unpack empty array used as placeholder
4632 since they can contain heterogeneous type
4633 """
4634 if (len(binaryString) < 8):
4635 return binaryString
4636 fmt = '!HHL'
4637 start = 0
4638 end = start + struct.calcsize(fmt)
4639 (self.type, self.len, self.group_id) = struct.unpack(fmt, binaryString[start:end])
4640 return binaryString[8:]
4641
4642 def __len__(self):
4643 """Return length of message
4644 """
4645 l = 8
4646 return l
4647
4648 def __eq__(self, other):
4649 """Return True if self and other have same values
4650 """
4651 if type(self) != type(other): return False
4652 if self.type != other.type: return False
4653 if self.len != other.len: return False
4654 if self.group_id != other.group_id: return False
4655 return True
4656
4657 def __ne__(self, other): return not self.__eq__(other)
4658
4659 def show(self, prefix=''):
4660 """Generate string showing basic members of structure
4661 """
4662 outstr = ''
4663 outstr += prefix + 'type: ' + str(self.type) + '\n'
4664 outstr += prefix + 'len: ' + str(self.len) + '\n'
4665 outstr += prefix + 'group_id: ' + str(self.group_id) + '\n'
4666 return outstr
4667
4668
4669class ofp_desc_stats(object):
4670 """Automatically generated Python class for ofp_desc_stats
4671
4672 Date 2012-06-25
4673 Created by of.pythonize.pythonizer
4674 Core structure: Messages do not include ofp_header
4675 Does not include var-length arrays
4676 """
4677 def __init__(self):
4678 """Initialize
4679 Declare members and default values
4680 """
4681 self.mfr_desc= ""
4682 self.hw_desc= ""
4683 self.sw_desc= ""
4684 self.serial_num= ""
4685 self.dp_desc= ""
4686
4687 def __assert(self):
4688 """Sanity check
4689 """
4690 if(not isinstance(self.mfr_desc, str)):
4691 return (False, "self.mfr_desc is not string as expected.")
4692 if(len(self.mfr_desc) > 256):
4693 return (False, "self.mfr_desc is not of size 256 as expected.")
4694 if(not isinstance(self.hw_desc, str)):
4695 return (False, "self.hw_desc is not string as expected.")
4696 if(len(self.hw_desc) > 256):
4697 return (False, "self.hw_desc is not of size 256 as expected.")
4698 if(not isinstance(self.sw_desc, str)):
4699 return (False, "self.sw_desc is not string as expected.")
4700 if(len(self.sw_desc) > 256):
4701 return (False, "self.sw_desc is not of size 256 as expected.")
4702 if(not isinstance(self.serial_num, str)):
4703 return (False, "self.serial_num is not string as expected.")
4704 if(len(self.serial_num) > 32):
4705 return (False, "self.serial_num is not of size 32 as expected.")
4706 if(not isinstance(self.dp_desc, str)):
4707 return (False, "self.dp_desc is not string as expected.")
4708 if(len(self.dp_desc) > 256):
4709 return (False, "self.dp_desc is not of size 256 as expected.")
4710 return (True, None)
4711
4712 def pack(self, assertstruct=True):
4713 """Pack message
4714 Packs empty array used as placeholder
4715 """
4716 if(assertstruct):
4717 if(not self.__assert()[0]):
4718 return None
4719 packed = ""
4720 packed += self.mfr_desc.ljust(256,'\0')
4721 packed += self.hw_desc.ljust(256,'\0')
4722 packed += self.sw_desc.ljust(256,'\0')
4723 packed += self.serial_num.ljust(32,'\0')
4724 packed += self.dp_desc.ljust(256,'\0')
4725 return packed
4726
4727 def unpack(self, binaryString):
4728 """Unpack message
4729 Do not unpack empty array used as placeholder
4730 since they can contain heterogeneous type
4731 """
4732 if (len(binaryString) < 1056):
4733 return binaryString
4734 self.mfr_desc = binaryString[0:256].replace("\0","")
4735 self.hw_desc = binaryString[256:512].replace("\0","")
4736 self.sw_desc = binaryString[512:768].replace("\0","")
4737 self.serial_num = binaryString[768:800].replace("\0","")
4738 self.dp_desc = binaryString[800:1056].replace("\0","")
4739 return binaryString[1056:]
4740
4741 def __len__(self):
4742 """Return length of message
4743 """
4744 l = 1056
4745 return l
4746
4747 def __eq__(self, other):
4748 """Return True if self and other have same values
4749 """
4750 if type(self) != type(other): return False
4751 if self.mfr_desc != other.mfr_desc: return False
4752 if self.hw_desc != other.hw_desc: return False
4753 if self.sw_desc != other.sw_desc: return False
4754 if self.serial_num != other.serial_num: return False
4755 if self.dp_desc != other.dp_desc: return False
4756 return True
4757
4758 def __ne__(self, other): return not self.__eq__(other)
4759
4760 def show(self, prefix=''):
4761 """Generate string showing basic members of structure
4762 """
4763 outstr = ''
4764 outstr += prefix + 'mfr_desc: ' + str(self.mfr_desc) + '\n'
4765 outstr += prefix + 'hw_desc: ' + str(self.hw_desc) + '\n'
4766 outstr += prefix + 'sw_desc: ' + str(self.sw_desc) + '\n'
4767 outstr += prefix + 'serial_num: ' + str(self.serial_num) + '\n'
4768 outstr += prefix + 'dp_desc: ' + str(self.dp_desc) + '\n'
4769 return outstr
4770
4771
4772class ofp_action_push(object):
4773 """Automatically generated Python class for ofp_action_push
4774
4775 Date 2012-06-25
4776 Created by of.pythonize.pythonizer
4777 Core structure: Messages do not include ofp_header
4778 Does not include var-length arrays
4779 """
4780 def __init__(self):
4781 """Initialize
4782 Declare members and default values
4783 """
4784 self.type = 0
4785 self.len = 0
4786 self.ethertype = 0
4787 self.pad= [0,0]
4788
4789 def __assert(self):
4790 """Sanity check
4791 """
4792 if(not isinstance(self.pad, list)):
4793 return (False, "self.pad is not list as expected.")
4794 if(len(self.pad) != 2):
4795 return (False, "self.pad is not of size 2 as expected.")
4796 return (True, None)
4797
4798 def pack(self, assertstruct=True):
4799 """Pack message
4800 Packs empty array used as placeholder
4801 """
4802 if(assertstruct):
4803 if(not self.__assert()[0]):
4804 return None
4805 packed = ""
4806 packed += struct.pack("!HHH", self.type, self.len, self.ethertype)
4807 packed += struct.pack("!BB", self.pad[0], self.pad[1])
4808 return packed
4809
4810 def unpack(self, binaryString):
4811 """Unpack message
4812 Do not unpack empty array used as placeholder
4813 since they can contain heterogeneous type
4814 """
4815 if (len(binaryString) < 8):
4816 return binaryString
4817 fmt = '!HHH'
4818 start = 0
4819 end = start + struct.calcsize(fmt)
4820 (self.type, self.len, self.ethertype) = struct.unpack(fmt, binaryString[start:end])
4821 fmt = '!BB'
4822 start = 6
4823 end = start + struct.calcsize(fmt)
4824 (self.pad[0], self.pad[1]) = struct.unpack(fmt, binaryString[start:end])
4825 return binaryString[8:]
4826
4827 def __len__(self):
4828 """Return length of message
4829 """
4830 l = 8
4831 return l
4832
4833 def __eq__(self, other):
4834 """Return True if self and other have same values
4835 """
4836 if type(self) != type(other): return False
4837 if self.type != other.type: return False
4838 if self.len != other.len: return False
4839 if self.ethertype != other.ethertype: return False
4840 if self.pad != other.pad: return False
4841 return True
4842
4843 def __ne__(self, other): return not self.__eq__(other)
4844
4845 def show(self, prefix=''):
4846 """Generate string showing basic members of structure
4847 """
4848 outstr = ''
4849 outstr += prefix + 'type: ' + str(self.type) + '\n'
4850 outstr += prefix + 'len: ' + str(self.len) + '\n'
4851 outstr += prefix + 'ethertype: ' + str(self.ethertype) + '\n'
4852 return outstr
4853
4854
4855class ofp_group_desc_stats(object):
4856 """Automatically generated Python class for ofp_group_desc_stats
4857
4858 Date 2012-06-25
4859 Created by of.pythonize.pythonizer
4860 Core structure: Messages do not include ofp_header
4861 Does not include var-length arrays
4862 """
4863 def __init__(self):
4864 """Initialize
4865 Declare members and default values
4866 """
4867 self.length = 0
4868 self.type = 0
4869 self.pad = 0
4870 self.group_id = 0
4871
4872 def __assert(self):
4873 """Sanity check
4874 """
4875 return (True, None)
4876
4877 def pack(self, assertstruct=True):
4878 """Pack message
4879 Packs empty array used as placeholder
4880 """
4881 if(assertstruct):
4882 if(not self.__assert()[0]):
4883 return None
4884 packed = ""
4885 packed += struct.pack("!HBBL", self.length, self.type, self.pad, self.group_id)
4886 return packed
4887
4888 def unpack(self, binaryString):
4889 """Unpack message
4890 Do not unpack empty array used as placeholder
4891 since they can contain heterogeneous type
4892 """
4893 if (len(binaryString) < 8):
4894 return binaryString
4895 fmt = '!HBBL'
4896 start = 0
4897 end = start + struct.calcsize(fmt)
4898 (self.length, self.type, self.pad, self.group_id) = struct.unpack(fmt, binaryString[start:end])
4899 return binaryString[8:]
4900
4901 def __len__(self):
4902 """Return length of message
4903 """
4904 l = 8
4905 return l
4906
4907 def __eq__(self, other):
4908 """Return True if self and other have same values
4909 """
4910 if type(self) != type(other): return False
4911 if self.length != other.length: return False
4912 if self.type != other.type: return False
4913 if self.pad != other.pad: return False
4914 if self.group_id != other.group_id: return False
4915 return True
4916
4917 def __ne__(self, other): return not self.__eq__(other)
4918
4919 def show(self, prefix=''):
4920 """Generate string showing basic members of structure
4921 """
4922 outstr = ''
4923 outstr += prefix + 'length: ' + str(self.length) + '\n'
4924 outstr += prefix + 'type: ' + str(self.type) + '\n'
4925 outstr += prefix + 'group_id: ' + str(self.group_id) + '\n'
4926 return outstr
4927
4928
4929class ofp_error_msg(object):
4930 """Automatically generated Python class for ofp_error_msg
4931
4932 Date 2012-06-25
4933 Created by of.pythonize.pythonizer
4934 Core structure: Messages do not include ofp_header
4935 Does not include var-length arrays
4936 """
4937 def __init__(self):
4938 """Initialize
4939 Declare members and default values
4940 """
4941 self.type = 0
4942 self.code = 0
4943
4944 def __assert(self):
4945 """Sanity check
4946 """
4947 return (True, None)
4948
4949 def pack(self, assertstruct=True):
4950 """Pack message
4951 Packs empty array used as placeholder
4952 """
4953 if(assertstruct):
4954 if(not self.__assert()[0]):
4955 return None
4956 packed = ""
4957 packed += struct.pack("!HH", self.type, self.code)
4958 return packed
4959
4960 def unpack(self, binaryString):
4961 """Unpack message
4962 Do not unpack empty array used as placeholder
4963 since they can contain heterogeneous type
4964 """
4965 if (len(binaryString) < 4):
4966 return binaryString
4967 fmt = '!HH'
4968 start = 0
4969 end = start + struct.calcsize(fmt)
4970 (self.type, self.code) = struct.unpack(fmt, binaryString[start:end])
4971 return binaryString[4:]
4972
4973 def __len__(self):
4974 """Return length of message
4975 """
4976 l = 4
4977 return l
4978
4979 def __eq__(self, other):
4980 """Return True if self and other have same values
4981 """
4982 if type(self) != type(other): return False
4983 if self.type != other.type: return False
4984 if self.code != other.code: return False
4985 return True
4986
4987 def __ne__(self, other): return not self.__eq__(other)
4988
4989 def show(self, prefix=''):
4990 """Generate string showing basic members of structure
4991 """
4992 outstr = ''
4993 outstr += prefix + 'type: ' + str(self.type) + '\n'
4994 outstr += prefix + 'code: ' + str(self.code) + '\n'
4995 return outstr
4996
4997
4998class ofp_action_mpls_ttl(object):
4999 """Automatically generated Python class for ofp_action_mpls_ttl
5000
5001 Date 2012-06-25
5002 Created by of.pythonize.pythonizer
5003 Core structure: Messages do not include ofp_header
5004 Does not include var-length arrays
5005 """
5006 def __init__(self):
5007 """Initialize
5008 Declare members and default values
5009 """
5010 self.type = 0
5011 self.len = 0
5012 self.mpls_ttl = 0
5013 self.pad= [0,0,0]
5014
5015 def __assert(self):
5016 """Sanity check
5017 """
5018 if(not isinstance(self.pad, list)):
5019 return (False, "self.pad is not list as expected.")
5020 if(len(self.pad) != 3):
5021 return (False, "self.pad is not of size 3 as expected.")
5022 return (True, None)
5023
5024 def pack(self, assertstruct=True):
5025 """Pack message
5026 Packs empty array used as placeholder
5027 """
5028 if(assertstruct):
5029 if(not self.__assert()[0]):
5030 return None
5031 packed = ""
5032 packed += struct.pack("!HHB", self.type, self.len, self.mpls_ttl)
5033 packed += struct.pack("!BBB", self.pad[0], self.pad[1], self.pad[2])
5034 return packed
5035
5036 def unpack(self, binaryString):
5037 """Unpack message
5038 Do not unpack empty array used as placeholder
5039 since they can contain heterogeneous type
5040 """
5041 if (len(binaryString) < 8):
5042 return binaryString
5043 fmt = '!HHB'
5044 start = 0
5045 end = start + struct.calcsize(fmt)
5046 (self.type, self.len, self.mpls_ttl) = struct.unpack(fmt, binaryString[start:end])
5047 fmt = '!BBB'
5048 start = 5
5049 end = start + struct.calcsize(fmt)
5050 (self.pad[0], self.pad[1], self.pad[2]) = struct.unpack(fmt, binaryString[start:end])
5051 return binaryString[8:]
5052
5053 def __len__(self):
5054 """Return length of message
5055 """
5056 l = 8
5057 return l
5058
5059 def __eq__(self, other):
5060 """Return True if self and other have same values
5061 """
5062 if type(self) != type(other): return False
5063 if self.type != other.type: return False
5064 if self.len != other.len: return False
5065 if self.mpls_ttl != other.mpls_ttl: return False
5066 if self.pad != other.pad: return False
5067 return True
5068
5069 def __ne__(self, other): return not self.__eq__(other)
5070
5071 def show(self, prefix=''):
5072 """Generate string showing basic members of structure
5073 """
5074 outstr = ''
5075 outstr += prefix + 'type: ' + str(self.type) + '\n'
5076 outstr += prefix + 'len: ' + str(self.len) + '\n'
5077 outstr += prefix + 'mpls_ttl: ' + str(self.mpls_ttl) + '\n'
5078 return outstr
5079
5080
5081# Enumerated type definitions
5082ofp_error_type = ['OFPET_HELLO_FAILED', 'OFPET_BAD_REQUEST', 'OFPET_BAD_ACTION', 'OFPET_BAD_INSTRUCTION', 'OFPET_BAD_MATCH', 'OFPET_FLOW_MOD_FAILED', 'OFPET_GROUP_MOD_FAILED', 'OFPET_PORT_MOD_FAILED', 'OFPET_TABLE_MOD_FAILED', 'OFPET_QUEUE_OP_FAILED', 'OFPET_SWITCH_CONFIG_FAILED', 'OFPET_ROLE_REQUEST_FAILED', 'OFPET_EXPERIMENTER']
5083OFPET_HELLO_FAILED = 0
5084OFPET_BAD_REQUEST = 1
5085OFPET_BAD_ACTION = 2
5086OFPET_BAD_INSTRUCTION = 3
5087OFPET_BAD_MATCH = 4
5088OFPET_FLOW_MOD_FAILED = 5
5089OFPET_GROUP_MOD_FAILED = 6
5090OFPET_PORT_MOD_FAILED = 7
5091OFPET_TABLE_MOD_FAILED = 8
5092OFPET_QUEUE_OP_FAILED = 9
5093OFPET_SWITCH_CONFIG_FAILED = 10
5094OFPET_ROLE_REQUEST_FAILED = 11
5095OFPET_EXPERIMENTER = 65535
5096ofp_error_type_map = {
5097 0 : 'OFPET_HELLO_FAILED',
5098 1 : 'OFPET_BAD_REQUEST',
5099 2 : 'OFPET_BAD_ACTION',
5100 3 : 'OFPET_BAD_INSTRUCTION',
5101 4 : 'OFPET_BAD_MATCH',
5102 5 : 'OFPET_FLOW_MOD_FAILED',
5103 6 : 'OFPET_GROUP_MOD_FAILED',
5104 7 : 'OFPET_PORT_MOD_FAILED',
5105 8 : 'OFPET_TABLE_MOD_FAILED',
5106 9 : 'OFPET_QUEUE_OP_FAILED',
5107 10 : 'OFPET_SWITCH_CONFIG_FAILED',
5108 11 : 'OFPET_ROLE_REQUEST_FAILED',
5109 65535 : 'OFPET_EXPERIMENTER'
5110}
5111
5112ofp_flow_mod_flags = ['OFPFF_SEND_FLOW_REM', 'OFPFF_CHECK_OVERLAP', 'OFPFF_RESET_COUNTS']
5113OFPFF_SEND_FLOW_REM = 1
5114OFPFF_CHECK_OVERLAP = 2
5115OFPFF_RESET_COUNTS = 4
5116ofp_flow_mod_flags_map = {
5117 1 : 'OFPFF_SEND_FLOW_REM',
5118 2 : 'OFPFF_CHECK_OVERLAP',
5119 4 : 'OFPFF_RESET_COUNTS'
5120}
5121
5122ofp_controller_role = ['OFPCR_ROLE_NOCHANGE', 'OFPCR_ROLE_EQUAL', 'OFPCR_ROLE_MASTER', 'OFPCR_ROLE_SLAVE']
5123OFPCR_ROLE_NOCHANGE = 0
5124OFPCR_ROLE_EQUAL = 1
5125OFPCR_ROLE_MASTER = 2
5126OFPCR_ROLE_SLAVE = 3
5127ofp_controller_role_map = {
5128 0 : 'OFPCR_ROLE_NOCHANGE',
5129 1 : 'OFPCR_ROLE_EQUAL',
5130 2 : 'OFPCR_ROLE_MASTER',
5131 3 : 'OFPCR_ROLE_SLAVE'
5132}
5133
5134ofp_stats_reply_flags = ['OFPSF_REPLY_MORE']
5135OFPSF_REPLY_MORE = 1
5136ofp_stats_reply_flags_map = {
5137 1 : 'OFPSF_REPLY_MORE'
5138}
5139
5140ofp_port_no = ['OFPP_MAX', 'OFPP_IN_PORT', 'OFPP_TABLE', 'OFPP_NORMAL', 'OFPP_FLOOD', 'OFPP_ALL', 'OFPP_CONTROLLER', 'OFPP_LOCAL', 'OFPP_ANY']
5141OFPP_MAX = 4294967040
5142OFPP_IN_PORT = 4294967288
5143OFPP_TABLE = 4294967289
5144OFPP_NORMAL = 4294967290
5145OFPP_FLOOD = 4294967291
5146OFPP_ALL = 4294967292
5147OFPP_CONTROLLER = 4294967293
5148OFPP_LOCAL = 4294967294
5149OFPP_ANY = 4294967295
5150ofp_port_no_map = {
5151 4294967040 : 'OFPP_MAX',
5152 4294967288 : 'OFPP_IN_PORT',
5153 4294967289 : 'OFPP_TABLE',
5154 4294967290 : 'OFPP_NORMAL',
5155 4294967291 : 'OFPP_FLOOD',
5156 4294967292 : 'OFPP_ALL',
5157 4294967293 : 'OFPP_CONTROLLER',
5158 4294967294 : 'OFPP_LOCAL',
5159 4294967295 : 'OFPP_ANY'
5160}
5161
5162ofp_bad_request_code = ['OFPBRC_BAD_VERSION', 'OFPBRC_BAD_TYPE', 'OFPBRC_BAD_STAT', 'OFPBRC_BAD_EXPERIMENTER', 'OFPBRC_BAD_EXP_TYPE', 'OFPBRC_EPERM', 'OFPBRC_BAD_LEN', 'OFPBRC_BUFFER_EMPTY', 'OFPBRC_BUFFER_UNKNOWN', 'OFPBRC_BAD_TABLE_ID', 'OFPBRC_IS_SLAVE', 'OFPBRC_BAD_PORT', 'OFPBRC_BAD_PACKET']
5163OFPBRC_BAD_VERSION = 0
5164OFPBRC_BAD_TYPE = 1
5165OFPBRC_BAD_STAT = 2
5166OFPBRC_BAD_EXPERIMENTER = 3
5167OFPBRC_BAD_EXP_TYPE = 4
5168OFPBRC_EPERM = 5
5169OFPBRC_BAD_LEN = 6
5170OFPBRC_BUFFER_EMPTY = 7
5171OFPBRC_BUFFER_UNKNOWN = 8
5172OFPBRC_BAD_TABLE_ID = 9
5173OFPBRC_IS_SLAVE = 10
5174OFPBRC_BAD_PORT = 11
5175OFPBRC_BAD_PACKET = 12
5176ofp_bad_request_code_map = {
5177 0 : 'OFPBRC_BAD_VERSION',
5178 1 : 'OFPBRC_BAD_TYPE',
5179 2 : 'OFPBRC_BAD_STAT',
5180 3 : 'OFPBRC_BAD_EXPERIMENTER',
5181 4 : 'OFPBRC_BAD_EXP_TYPE',
5182 5 : 'OFPBRC_EPERM',
5183 6 : 'OFPBRC_BAD_LEN',
5184 7 : 'OFPBRC_BUFFER_EMPTY',
5185 8 : 'OFPBRC_BUFFER_UNKNOWN',
5186 9 : 'OFPBRC_BAD_TABLE_ID',
5187 10 : 'OFPBRC_IS_SLAVE',
5188 11 : 'OFPBRC_BAD_PORT',
5189 12 : 'OFPBRC_BAD_PACKET'
5190}
5191
5192ofp_bad_instruction_code = ['OFPBIC_UNKNOWN_INST', 'OFPBIC_UNSUP_INST', 'OFPBIC_BAD_TABLE_ID', 'OFPBIC_UNSUP_METADATA', 'OFPBIC_UNSUP_METADATA_MASK', 'OFPBIC_BAD_EXPERIMENTER', 'OFPBIC_BAD_EXP_TYPE', 'OFPBIC_BAD_LEN', 'OFPBIC_EPERM']
5193OFPBIC_UNKNOWN_INST = 0
5194OFPBIC_UNSUP_INST = 1
5195OFPBIC_BAD_TABLE_ID = 2
5196OFPBIC_UNSUP_METADATA = 3
5197OFPBIC_UNSUP_METADATA_MASK = 4
5198OFPBIC_BAD_EXPERIMENTER = 5
5199OFPBIC_BAD_EXP_TYPE = 6
5200OFPBIC_BAD_LEN = 7
5201OFPBIC_EPERM = 8
5202ofp_bad_instruction_code_map = {
5203 0 : 'OFPBIC_UNKNOWN_INST',
5204 1 : 'OFPBIC_UNSUP_INST',
5205 2 : 'OFPBIC_BAD_TABLE_ID',
5206 3 : 'OFPBIC_UNSUP_METADATA',
5207 4 : 'OFPBIC_UNSUP_METADATA_MASK',
5208 5 : 'OFPBIC_BAD_EXPERIMENTER',
5209 6 : 'OFPBIC_BAD_EXP_TYPE',
5210 7 : 'OFPBIC_BAD_LEN',
5211 8 : 'OFPBIC_EPERM'
5212}
5213
5214ofp_port_config = ['OFPPC_PORT_DOWN', 'OFPPC_NO_RECV', 'OFPPC_NO_FWD', 'OFPPC_NO_PACKET_IN']
5215OFPPC_PORT_DOWN = 1
5216OFPPC_NO_RECV = 4
5217OFPPC_NO_FWD = 32
5218OFPPC_NO_PACKET_IN = 64
5219ofp_port_config_map = {
5220 1 : 'OFPPC_PORT_DOWN',
5221 4 : 'OFPPC_NO_RECV',
5222 32 : 'OFPPC_NO_FWD',
5223 64 : 'OFPPC_NO_PACKET_IN'
5224}
5225
5226ofp_port_state = ['OFPPS_LINK_DOWN', 'OFPPS_BLOCKED', 'OFPPS_LIVE']
5227OFPPS_LINK_DOWN = 1
5228OFPPS_BLOCKED = 2
5229OFPPS_LIVE = 4
5230ofp_port_state_map = {
5231 1 : 'OFPPS_LINK_DOWN',
5232 2 : 'OFPPS_BLOCKED',
5233 4 : 'OFPPS_LIVE'
5234}
5235
5236ofp_config_flags = ['OFPC_FRAG_NORMAL', 'OFPC_FRAG_DROP', 'OFPC_FRAG_REASM', 'OFPC_FRAG_MASK', 'OFPC_INVALID_TTL_TO_CONTROLLER']
5237OFPC_FRAG_NORMAL = 0
5238OFPC_FRAG_DROP = 1
5239OFPC_FRAG_REASM = 2
5240OFPC_FRAG_MASK = 3
5241OFPC_INVALID_TTL_TO_CONTROLLER = 4
5242ofp_config_flags_map = {
5243 0 : 'OFPC_FRAG_NORMAL',
5244 1 : 'OFPC_FRAG_DROP',
5245 2 : 'OFPC_FRAG_REASM',
5246 3 : 'OFPC_FRAG_MASK',
5247 4 : 'OFPC_INVALID_TTL_TO_CONTROLLER'
5248}
5249
5250ofp_switch_config_failed_code = ['OFPSCFC_BAD_FLAGS', 'OFPSCFC_BAD_LEN', 'OFPQCFC_EPERM']
5251OFPSCFC_BAD_FLAGS = 0
5252OFPSCFC_BAD_LEN = 1
5253OFPQCFC_EPERM = 2
5254ofp_switch_config_failed_code_map = {
5255 0 : 'OFPSCFC_BAD_FLAGS',
5256 1 : 'OFPSCFC_BAD_LEN',
5257 2 : 'OFPQCFC_EPERM'
5258}
5259
5260ofp_controller_max_len = ['OFPCML_MAX', 'OFPCML_NO_BUFFER']
5261OFPCML_MAX = 65509
5262OFPCML_NO_BUFFER = 65535
5263ofp_controller_max_len_map = {
5264 65509 : 'OFPCML_MAX',
5265 65535 : 'OFPCML_NO_BUFFER'
5266}
5267
5268ofp_role_request_failed_code = ['OFPRRFC_STALE', 'OFPRRFC_UNSUP', 'OFPRRFC_BAD_ROLE']
5269OFPRRFC_STALE = 0
5270OFPRRFC_UNSUP = 1
5271OFPRRFC_BAD_ROLE = 2
5272ofp_role_request_failed_code_map = {
5273 0 : 'OFPRRFC_STALE',
5274 1 : 'OFPRRFC_UNSUP',
5275 2 : 'OFPRRFC_BAD_ROLE'
5276}
5277
5278ofp_capabilities = ['OFPC_FLOW_STATS', 'OFPC_TABLE_STATS', 'OFPC_PORT_STATS', 'OFPC_GROUP_STATS', 'OFPC_IP_REASM', 'OFPC_QUEUE_STATS', 'OFPC_PORT_BLOCKED']
5279OFPC_FLOW_STATS = 1
5280OFPC_TABLE_STATS = 2
5281OFPC_PORT_STATS = 4
5282OFPC_GROUP_STATS = 8
5283OFPC_IP_REASM = 32
5284OFPC_QUEUE_STATS = 64
5285OFPC_PORT_BLOCKED = 256
5286ofp_capabilities_map = {
5287 1 : 'OFPC_FLOW_STATS',
5288 2 : 'OFPC_TABLE_STATS',
5289 4 : 'OFPC_PORT_STATS',
5290 8 : 'OFPC_GROUP_STATS',
5291 32 : 'OFPC_IP_REASM',
5292 64 : 'OFPC_QUEUE_STATS',
5293 256 : 'OFPC_PORT_BLOCKED'
5294}
5295
5296ofp_bad_match_code = ['OFPBMC_BAD_TYPE', 'OFPBMC_BAD_LEN', 'OFPBMC_BAD_TAG', 'OFPBMC_BAD_DL_ADDR_MASK', 'OFPBMC_BAD_NW_ADDR_MASK', 'OFPBMC_BAD_WILDCARDS', 'OFPBMC_BAD_FIELD', 'OFPBMC_BAD_VALUE', 'OFPBMC_BAD_MASK', 'OFPBMC_BAD_PREREQ', 'OFPBMC_DUP_FIELD', 'OFPBMC_EPERM']
5297OFPBMC_BAD_TYPE = 0
5298OFPBMC_BAD_LEN = 1
5299OFPBMC_BAD_TAG = 2
5300OFPBMC_BAD_DL_ADDR_MASK = 3
5301OFPBMC_BAD_NW_ADDR_MASK = 4
5302OFPBMC_BAD_WILDCARDS = 5
5303OFPBMC_BAD_FIELD = 6
5304OFPBMC_BAD_VALUE = 7
5305OFPBMC_BAD_MASK = 8
5306OFPBMC_BAD_PREREQ = 9
5307OFPBMC_DUP_FIELD = 10
5308OFPBMC_EPERM = 11
5309ofp_bad_match_code_map = {
5310 0 : 'OFPBMC_BAD_TYPE',
5311 1 : 'OFPBMC_BAD_LEN',
5312 2 : 'OFPBMC_BAD_TAG',
5313 3 : 'OFPBMC_BAD_DL_ADDR_MASK',
5314 4 : 'OFPBMC_BAD_NW_ADDR_MASK',
5315 5 : 'OFPBMC_BAD_WILDCARDS',
5316 6 : 'OFPBMC_BAD_FIELD',
5317 7 : 'OFPBMC_BAD_VALUE',
5318 8 : 'OFPBMC_BAD_MASK',
5319 9 : 'OFPBMC_BAD_PREREQ',
5320 10 : 'OFPBMC_DUP_FIELD',
5321 11 : 'OFPBMC_EPERM'
5322}
5323
5324ofp_flow_removed_reason = ['OFPRR_IDLE_TIMEOUT', 'OFPRR_HARD_TIMEOUT', 'OFPRR_DELETE', 'OFPRR_GROUP_DELETE']
5325OFPRR_IDLE_TIMEOUT = 0
5326OFPRR_HARD_TIMEOUT = 1
5327OFPRR_DELETE = 2
5328OFPRR_GROUP_DELETE = 3
5329ofp_flow_removed_reason_map = {
5330 0 : 'OFPRR_IDLE_TIMEOUT',
5331 1 : 'OFPRR_HARD_TIMEOUT',
5332 2 : 'OFPRR_DELETE',
5333 3 : 'OFPRR_GROUP_DELETE'
5334}
5335
5336ofp_table_mod_failed_code = ['OFPTMFC_BAD_TABLE', 'OFPTMFC_BAD_CONFIG', 'OFPTMFC_EPERM']
5337OFPTMFC_BAD_TABLE = 0
5338OFPTMFC_BAD_CONFIG = 1
5339OFPTMFC_EPERM = 2
5340ofp_table_mod_failed_code_map = {
5341 0 : 'OFPTMFC_BAD_TABLE',
5342 1 : 'OFPTMFC_BAD_CONFIG',
5343 2 : 'OFPTMFC_EPERM'
5344}
5345
5346ofp_queue_properties = ['OFPQT_MIN_RATE', 'OFPQT_MAX_RATE', 'OFPQT_EXPERIMENTER']
5347OFPQT_MIN_RATE = 1
5348OFPQT_MAX_RATE = 2
5349OFPQT_EXPERIMENTER = 65535
5350ofp_queue_properties_map = {
5351 1 : 'OFPQT_MIN_RATE',
5352 2 : 'OFPQT_MAX_RATE',
5353 65535 : 'OFPQT_EXPERIMENTER'
5354}
5355
5356ofp_table = ['OFPTT_MAX', 'OFPTT_ALL']
5357OFPTT_MAX = 254
5358OFPTT_ALL = 255
5359ofp_table_map = {
5360 254 : 'OFPTT_MAX',
5361 255 : 'OFPTT_ALL'
5362}
5363
5364ofp_group = ['OFPG_MAX', 'OFPG_ALL', 'OFPG_ANY']
5365OFPG_MAX = 4294967040
5366OFPG_ALL = 4294967292
5367OFPG_ANY = 4294967295
5368ofp_group_map = {
5369 4294967040 : 'OFPG_MAX',
5370 4294967292 : 'OFPG_ALL',
5371 4294967295 : 'OFPG_ANY'
5372}
5373
5374ofp_port_reason = ['OFPPR_ADD', 'OFPPR_DELETE', 'OFPPR_MODIFY']
5375OFPPR_ADD = 0
5376OFPPR_DELETE = 1
5377OFPPR_MODIFY = 2
5378ofp_port_reason_map = {
5379 0 : 'OFPPR_ADD',
5380 1 : 'OFPPR_DELETE',
5381 2 : 'OFPPR_MODIFY'
5382}
5383
5384ofp_group_capabilities = ['OFPGFC_SELECT_WEIGHT', 'OFPGFC_SELECT_LIVENESS', 'OFPGFC_CHAINING', 'OFPGFC_CHAINING_CHECKS']
5385OFPGFC_SELECT_WEIGHT = 1
5386OFPGFC_SELECT_LIVENESS = 2
5387OFPGFC_CHAINING = 4
5388OFPGFC_CHAINING_CHECKS = 8
5389ofp_group_capabilities_map = {
5390 1 : 'OFPGFC_SELECT_WEIGHT',
5391 2 : 'OFPGFC_SELECT_LIVENESS',
5392 4 : 'OFPGFC_CHAINING',
5393 8 : 'OFPGFC_CHAINING_CHECKS'
5394}
5395
5396ofp_table_config = ['OFPTC_TABLE_MISS_CONTROLLER', 'OFPTC_TABLE_MISS_CONTINUE', 'OFPTC_TABLE_MISS_DROP', 'OFPTC_TABLE_MISS_MASK']
5397OFPTC_TABLE_MISS_CONTROLLER = 0
5398OFPTC_TABLE_MISS_CONTINUE = 1
5399OFPTC_TABLE_MISS_DROP = 2
5400OFPTC_TABLE_MISS_MASK = 3
5401ofp_table_config_map = {
5402 0 : 'OFPTC_TABLE_MISS_CONTROLLER',
5403 1 : 'OFPTC_TABLE_MISS_CONTINUE',
5404 2 : 'OFPTC_TABLE_MISS_DROP',
5405 3 : 'OFPTC_TABLE_MISS_MASK'
5406}
5407
5408ofp_action_type = ['OFPAT_OUTPUT', 'OFPAT_COPY_TTL_OUT', 'OFPAT_COPY_TTL_IN', 'OFPAT_SET_MPLS_TTL', 'OFPAT_DEC_MPLS_TTL', 'OFPAT_PUSH_VLAN', 'OFPAT_POP_VLAN', 'OFPAT_PUSH_MPLS', 'OFPAT_POP_MPLS', 'OFPAT_SET_QUEUE', 'OFPAT_GROUP', 'OFPAT_SET_NW_TTL', 'OFPAT_DEC_NW_TTL', 'OFPAT_SET_FIELD', 'OFPAT_EXPERIMENTER']
5409OFPAT_OUTPUT = 0
5410OFPAT_COPY_TTL_OUT = 11
5411OFPAT_COPY_TTL_IN = 12
5412OFPAT_SET_MPLS_TTL = 15
5413OFPAT_DEC_MPLS_TTL = 16
5414OFPAT_PUSH_VLAN = 17
5415OFPAT_POP_VLAN = 18
5416OFPAT_PUSH_MPLS = 19
5417OFPAT_POP_MPLS = 20
5418OFPAT_SET_QUEUE = 21
5419OFPAT_GROUP = 22
5420OFPAT_SET_NW_TTL = 23
5421OFPAT_DEC_NW_TTL = 24
5422OFPAT_SET_FIELD = 25
5423OFPAT_EXPERIMENTER = 65535
5424ofp_action_type_map = {
5425 0 : 'OFPAT_OUTPUT',
5426 11 : 'OFPAT_COPY_TTL_OUT',
5427 12 : 'OFPAT_COPY_TTL_IN',
5428 15 : 'OFPAT_SET_MPLS_TTL',
5429 16 : 'OFPAT_DEC_MPLS_TTL',
5430 17 : 'OFPAT_PUSH_VLAN',
5431 18 : 'OFPAT_POP_VLAN',
5432 19 : 'OFPAT_PUSH_MPLS',
5433 20 : 'OFPAT_POP_MPLS',
5434 21 : 'OFPAT_SET_QUEUE',
5435 22 : 'OFPAT_GROUP',
5436 23 : 'OFPAT_SET_NW_TTL',
5437 24 : 'OFPAT_DEC_NW_TTL',
5438 25 : 'OFPAT_SET_FIELD',
5439 65535 : 'OFPAT_EXPERIMENTER'
5440}
5441
5442ofp_flow_mod_command = ['OFPFC_ADD', 'OFPFC_MODIFY', 'OFPFC_MODIFY_STRICT', 'OFPFC_DELETE', 'OFPFC_DELETE_STRICT']
5443OFPFC_ADD = 0
5444OFPFC_MODIFY = 1
5445OFPFC_MODIFY_STRICT = 2
5446OFPFC_DELETE = 3
5447OFPFC_DELETE_STRICT = 4
5448ofp_flow_mod_command_map = {
5449 0 : 'OFPFC_ADD',
5450 1 : 'OFPFC_MODIFY',
5451 2 : 'OFPFC_MODIFY_STRICT',
5452 3 : 'OFPFC_DELETE',
5453 4 : 'OFPFC_DELETE_STRICT'
5454}
5455
5456ofp_queue_op_failed_code = ['OFPQOFC_BAD_PORT', 'OFPQOFC_BAD_QUEUE', 'OFPQOFC_EPERM']
5457OFPQOFC_BAD_PORT = 0
5458OFPQOFC_BAD_QUEUE = 1
5459OFPQOFC_EPERM = 2
5460ofp_queue_op_failed_code_map = {
5461 0 : 'OFPQOFC_BAD_PORT',
5462 1 : 'OFPQOFC_BAD_QUEUE',
5463 2 : 'OFPQOFC_EPERM'
5464}
5465
5466ofp_hello_failed_code = ['OFPHFC_INCOMPATIBLE', 'OFPHFC_EPERM']
5467OFPHFC_INCOMPATIBLE = 0
5468OFPHFC_EPERM = 1
5469ofp_hello_failed_code_map = {
5470 0 : 'OFPHFC_INCOMPATIBLE',
5471 1 : 'OFPHFC_EPERM'
5472}
5473
5474ofp_match_type = ['OFPMT_STANDARD', 'OFPMT_OXM']
5475OFPMT_STANDARD = 0
5476OFPMT_OXM = 1
5477ofp_match_type_map = {
5478 0 : 'OFPMT_STANDARD',
5479 1 : 'OFPMT_OXM'
5480}
5481
5482ofp_vlan_id = ['OFPVID_PRESENT', 'OFPVID_NONE']
5483OFPVID_PRESENT = 4096
5484OFPVID_NONE = 0
5485ofp_vlan_id_map = {
5486 4096 : 'OFPVID_PRESENT',
5487 0 : 'OFPVID_NONE'
5488}
5489
5490ofp_oxm_class = ['OFPXMC_NXM_0', 'OFPXMC_NXM_1', 'OFPXMC_OPENFLOW_BASIC', 'OFPXMC_EXPERIMENTER']
5491OFPXMC_NXM_0 = 0
5492OFPXMC_NXM_1 = 1
5493OFPXMC_OPENFLOW_BASIC = 32768
5494OFPXMC_EXPERIMENTER = 65535
5495ofp_oxm_class_map = {
5496 0 : 'OFPXMC_NXM_0',
5497 1 : 'OFPXMC_NXM_1',
5498 32768 : 'OFPXMC_OPENFLOW_BASIC',
5499 65535 : 'OFPXMC_EXPERIMENTER'
5500}
5501
5502ofp_group_type = ['OFPGT_ALL', 'OFPGT_SELECT', 'OFPGT_INDIRECT', 'OFPGT_FF']
5503OFPGT_ALL = 0
5504OFPGT_SELECT = 1
5505OFPGT_INDIRECT = 2
5506OFPGT_FF = 3
5507ofp_group_type_map = {
5508 0 : 'OFPGT_ALL',
5509 1 : 'OFPGT_SELECT',
5510 2 : 'OFPGT_INDIRECT',
5511 3 : 'OFPGT_FF'
5512}
5513
5514ofp_instruction_type = ['OFPIT_GOTO_TABLE', 'OFPIT_WRITE_METADATA', 'OFPIT_WRITE_ACTIONS', 'OFPIT_APPLY_ACTIONS', 'OFPIT_CLEAR_ACTIONS', 'OFPIT_EXPERIMENTER']
5515OFPIT_GOTO_TABLE = 1
5516OFPIT_WRITE_METADATA = 2
5517OFPIT_WRITE_ACTIONS = 3
5518OFPIT_APPLY_ACTIONS = 4
5519OFPIT_CLEAR_ACTIONS = 5
5520OFPIT_EXPERIMENTER = 65535
5521ofp_instruction_type_map = {
5522 1 : 'OFPIT_GOTO_TABLE',
5523 2 : 'OFPIT_WRITE_METADATA',
5524 3 : 'OFPIT_WRITE_ACTIONS',
5525 4 : 'OFPIT_APPLY_ACTIONS',
5526 5 : 'OFPIT_CLEAR_ACTIONS',
5527 65535 : 'OFPIT_EXPERIMENTER'
5528}
5529
5530ofp_bad_action_code = ['OFPBAC_BAD_TYPE', 'OFPBAC_BAD_LEN', 'OFPBAC_BAD_EXPERIMENTER', 'OFPBAC_BAD_EXP_TYPE', 'OFPBAC_BAD_OUT_PORT', 'OFPBAC_BAD_ARGUMENT', 'OFPBAC_EPERM', 'OFPBAC_TOO_MANY', 'OFPBAC_BAD_QUEUE', 'OFPBAC_BAD_OUT_GROUP', 'OFPBAC_MATCH_INCONSISTENT', 'OFPBAC_UNSUPPORTED_ORDER', 'OFPBAC_BAD_TAG', 'OFPBAC_BAD_SET_TYPE', 'OFPBAC_BAD_SET_LEN', 'OFPBAC_BAD_SET_ARGUMENT']
5531OFPBAC_BAD_TYPE = 0
5532OFPBAC_BAD_LEN = 1
5533OFPBAC_BAD_EXPERIMENTER = 2
5534OFPBAC_BAD_EXP_TYPE = 3
5535OFPBAC_BAD_OUT_PORT = 4
5536OFPBAC_BAD_ARGUMENT = 5
5537OFPBAC_EPERM = 6
5538OFPBAC_TOO_MANY = 7
5539OFPBAC_BAD_QUEUE = 8
5540OFPBAC_BAD_OUT_GROUP = 9
5541OFPBAC_MATCH_INCONSISTENT = 10
5542OFPBAC_UNSUPPORTED_ORDER = 11
5543OFPBAC_BAD_TAG = 12
5544OFPBAC_BAD_SET_TYPE = 13
5545OFPBAC_BAD_SET_LEN = 14
5546OFPBAC_BAD_SET_ARGUMENT = 15
5547ofp_bad_action_code_map = {
5548 0 : 'OFPBAC_BAD_TYPE',
5549 1 : 'OFPBAC_BAD_LEN',
5550 2 : 'OFPBAC_BAD_EXPERIMENTER',
5551 3 : 'OFPBAC_BAD_EXP_TYPE',
5552 4 : 'OFPBAC_BAD_OUT_PORT',
5553 5 : 'OFPBAC_BAD_ARGUMENT',
5554 6 : 'OFPBAC_EPERM',
5555 7 : 'OFPBAC_TOO_MANY',
5556 8 : 'OFPBAC_BAD_QUEUE',
5557 9 : 'OFPBAC_BAD_OUT_GROUP',
5558 10 : 'OFPBAC_MATCH_INCONSISTENT',
5559 11 : 'OFPBAC_UNSUPPORTED_ORDER',
5560 12 : 'OFPBAC_BAD_TAG',
5561 13 : 'OFPBAC_BAD_SET_TYPE',
5562 14 : 'OFPBAC_BAD_SET_LEN',
5563 15 : 'OFPBAC_BAD_SET_ARGUMENT'
5564}
5565
5566oxm_ofb_match_fields = ['OFPXMT_OFB_IN_PORT', 'OFPXMT_OFB_IN_PHY_PORT', 'OFPXMT_OFB_METADATA', 'OFPXMT_OFB_ETH_DST', 'OFPXMT_OFB_ETH_SRC', 'OFPXMT_OFB_ETH_TYPE', 'OFPXMT_OFB_VLAN_VID', 'OFPXMT_OFB_VLAN_PCP', 'OFPXMT_OFB_IP_DSCP', 'OFPXMT_OFB_IP_ECN', 'OFPXMT_OFB_IP_PROTO', 'OFPXMT_OFB_IPV4_SRC', 'OFPXMT_OFB_IPV4_DST', 'OFPXMT_OFB_TCP_SRC', 'OFPXMT_OFB_TCP_DST', 'OFPXMT_OFB_UDP_SRC', 'OFPXMT_OFB_UDP_DST', 'OFPXMT_OFB_SCTP_SRC', 'OFPXMT_OFB_SCTP_DST', 'OFPXMT_OFB_ICMPV4_TYPE', 'OFPXMT_OFB_ICMPV4_CODE', 'OFPXMT_OFB_ARP_OP', 'OFPXMT_OFB_ARP_SPA', 'OFPXMT_OFB_ARP_TPA', 'OFPXMT_OFB_ARP_SHA', 'OFPXMT_OFB_ARP_THA', 'OFPXMT_OFB_IPV6_SRC', 'OFPXMT_OFB_IPV6_DST', 'OFPXMT_OFB_IPV6_FLABEL', 'OFPXMT_OFB_ICMPV6_TYPE', 'OFPXMT_OFB_ICMPV6_CODE', 'OFPXMT_OFB_IPV6_ND_TARGET', 'OFPXMT_OFB_IPV6_ND_SLL', 'OFPXMT_OFB_IPV6_ND_TLL', 'OFPXMT_OFB_MPLS_LABEL', 'OFPXMT_OFB_MPLS_TC']
5567OFPXMT_OFB_IN_PORT = 0
5568OFPXMT_OFB_IN_PHY_PORT = 1
5569OFPXMT_OFB_METADATA = 2
5570OFPXMT_OFB_ETH_DST = 3
5571OFPXMT_OFB_ETH_SRC = 4
5572OFPXMT_OFB_ETH_TYPE = 5
5573OFPXMT_OFB_VLAN_VID = 6
5574OFPXMT_OFB_VLAN_PCP = 7
5575OFPXMT_OFB_IP_DSCP = 8
5576OFPXMT_OFB_IP_ECN = 9
5577OFPXMT_OFB_IP_PROTO = 10
5578OFPXMT_OFB_IPV4_SRC = 11
5579OFPXMT_OFB_IPV4_DST = 12
5580OFPXMT_OFB_TCP_SRC = 13
5581OFPXMT_OFB_TCP_DST = 14
5582OFPXMT_OFB_UDP_SRC = 15
5583OFPXMT_OFB_UDP_DST = 16
5584OFPXMT_OFB_SCTP_SRC = 17
5585OFPXMT_OFB_SCTP_DST = 18
5586OFPXMT_OFB_ICMPV4_TYPE = 19
5587OFPXMT_OFB_ICMPV4_CODE = 20
5588OFPXMT_OFB_ARP_OP = 21
5589OFPXMT_OFB_ARP_SPA = 22
5590OFPXMT_OFB_ARP_TPA = 23
5591OFPXMT_OFB_ARP_SHA = 24
5592OFPXMT_OFB_ARP_THA = 25
5593OFPXMT_OFB_IPV6_SRC = 26
5594OFPXMT_OFB_IPV6_DST = 27
5595OFPXMT_OFB_IPV6_FLABEL = 28
5596OFPXMT_OFB_ICMPV6_TYPE = 29
5597OFPXMT_OFB_ICMPV6_CODE = 30
5598OFPXMT_OFB_IPV6_ND_TARGET = 31
5599OFPXMT_OFB_IPV6_ND_SLL = 32
5600OFPXMT_OFB_IPV6_ND_TLL = 33
5601OFPXMT_OFB_MPLS_LABEL = 34
5602OFPXMT_OFB_MPLS_TC = 35
5603oxm_ofb_match_fields_map = {
5604 0 : 'OFPXMT_OFB_IN_PORT',
5605 1 : 'OFPXMT_OFB_IN_PHY_PORT',
5606 2 : 'OFPXMT_OFB_METADATA',
5607 3 : 'OFPXMT_OFB_ETH_DST',
5608 4 : 'OFPXMT_OFB_ETH_SRC',
5609 5 : 'OFPXMT_OFB_ETH_TYPE',
5610 6 : 'OFPXMT_OFB_VLAN_VID',
5611 7 : 'OFPXMT_OFB_VLAN_PCP',
5612 8 : 'OFPXMT_OFB_IP_DSCP',
5613 9 : 'OFPXMT_OFB_IP_ECN',
5614 10 : 'OFPXMT_OFB_IP_PROTO',
5615 11 : 'OFPXMT_OFB_IPV4_SRC',
5616 12 : 'OFPXMT_OFB_IPV4_DST',
5617 13 : 'OFPXMT_OFB_TCP_SRC',
5618 14 : 'OFPXMT_OFB_TCP_DST',
5619 15 : 'OFPXMT_OFB_UDP_SRC',
5620 16 : 'OFPXMT_OFB_UDP_DST',
5621 17 : 'OFPXMT_OFB_SCTP_SRC',
5622 18 : 'OFPXMT_OFB_SCTP_DST',
5623 19 : 'OFPXMT_OFB_ICMPV4_TYPE',
5624 20 : 'OFPXMT_OFB_ICMPV4_CODE',
5625 21 : 'OFPXMT_OFB_ARP_OP',
5626 22 : 'OFPXMT_OFB_ARP_SPA',
5627 23 : 'OFPXMT_OFB_ARP_TPA',
5628 24 : 'OFPXMT_OFB_ARP_SHA',
5629 25 : 'OFPXMT_OFB_ARP_THA',
5630 26 : 'OFPXMT_OFB_IPV6_SRC',
5631 27 : 'OFPXMT_OFB_IPV6_DST',
5632 28 : 'OFPXMT_OFB_IPV6_FLABEL',
5633 29 : 'OFPXMT_OFB_ICMPV6_TYPE',
5634 30 : 'OFPXMT_OFB_ICMPV6_CODE',
5635 31 : 'OFPXMT_OFB_IPV6_ND_TARGET',
5636 32 : 'OFPXMT_OFB_IPV6_ND_SLL',
5637 33 : 'OFPXMT_OFB_IPV6_ND_TLL',
5638 34 : 'OFPXMT_OFB_MPLS_LABEL',
5639 35 : 'OFPXMT_OFB_MPLS_TC'
5640}
5641
5642ofp_flow_mod_failed_code = ['OFPFMFC_UNKNOWN', 'OFPFMFC_TABLE_FULL', 'OFPFMFC_BAD_TABLE_ID', 'OFPFMFC_OVERLAP', 'OFPFMFC_EPERM', 'OFPFMFC_BAD_TIMEOUT', 'OFPFMFC_BAD_COMMAND', 'OFPFMFC_BAD_FLAGS']
5643OFPFMFC_UNKNOWN = 0
5644OFPFMFC_TABLE_FULL = 1
5645OFPFMFC_BAD_TABLE_ID = 2
5646OFPFMFC_OVERLAP = 3
5647OFPFMFC_EPERM = 4
5648OFPFMFC_BAD_TIMEOUT = 5
5649OFPFMFC_BAD_COMMAND = 6
5650OFPFMFC_BAD_FLAGS = 7
5651ofp_flow_mod_failed_code_map = {
5652 0 : 'OFPFMFC_UNKNOWN',
5653 1 : 'OFPFMFC_TABLE_FULL',
5654 2 : 'OFPFMFC_BAD_TABLE_ID',
5655 3 : 'OFPFMFC_OVERLAP',
5656 4 : 'OFPFMFC_EPERM',
5657 5 : 'OFPFMFC_BAD_TIMEOUT',
5658 6 : 'OFPFMFC_BAD_COMMAND',
5659 7 : 'OFPFMFC_BAD_FLAGS'
5660}
5661
5662ofp_port_mod_failed_code = ['OFPPMFC_BAD_PORT', 'OFPPMFC_BAD_HW_ADDR', 'OFPPMFC_BAD_CONFIG', 'OFPPMFC_BAD_ADVERTISE', 'OFPPMFC_EPERM']
5663OFPPMFC_BAD_PORT = 0
5664OFPPMFC_BAD_HW_ADDR = 1
5665OFPPMFC_BAD_CONFIG = 2
5666OFPPMFC_BAD_ADVERTISE = 3
5667OFPPMFC_EPERM = 4
5668ofp_port_mod_failed_code_map = {
5669 0 : 'OFPPMFC_BAD_PORT',
5670 1 : 'OFPPMFC_BAD_HW_ADDR',
5671 2 : 'OFPPMFC_BAD_CONFIG',
5672 3 : 'OFPPMFC_BAD_ADVERTISE',
5673 4 : 'OFPPMFC_EPERM'
5674}
5675
5676ofp_type = ['OFPT_HELLO', 'OFPT_ERROR', 'OFPT_ECHO_REQUEST', 'OFPT_ECHO_REPLY', 'OFPT_EXPERIMENTER', 'OFPT_FEATURES_REQUEST', 'OFPT_FEATURES_REPLY', 'OFPT_GET_CONFIG_REQUEST', 'OFPT_GET_CONFIG_REPLY', 'OFPT_SET_CONFIG', 'OFPT_PACKET_IN', 'OFPT_FLOW_REMOVED', 'OFPT_PORT_STATUS', 'OFPT_PACKET_OUT', 'OFPT_FLOW_MOD', 'OFPT_GROUP_MOD', 'OFPT_PORT_MOD', 'OFPT_TABLE_MOD', 'OFPT_STATS_REQUEST', 'OFPT_STATS_REPLY', 'OFPT_BARRIER_REQUEST', 'OFPT_BARRIER_REPLY', 'OFPT_QUEUE_GET_CONFIG_REQUEST', 'OFPT_QUEUE_GET_CONFIG_REPLY', 'OFPT_ROLE_REQUEST', 'OFPT_ROLE_REPLY']
5677OFPT_HELLO = 0
5678OFPT_ERROR = 1
5679OFPT_ECHO_REQUEST = 2
5680OFPT_ECHO_REPLY = 3
5681OFPT_EXPERIMENTER = 4
5682OFPT_FEATURES_REQUEST = 5
5683OFPT_FEATURES_REPLY = 6
5684OFPT_GET_CONFIG_REQUEST = 7
5685OFPT_GET_CONFIG_REPLY = 8
5686OFPT_SET_CONFIG = 9
5687OFPT_PACKET_IN = 10
5688OFPT_FLOW_REMOVED = 11
5689OFPT_PORT_STATUS = 12
5690OFPT_PACKET_OUT = 13
5691OFPT_FLOW_MOD = 14
5692OFPT_GROUP_MOD = 15
5693OFPT_PORT_MOD = 16
5694OFPT_TABLE_MOD = 17
5695OFPT_STATS_REQUEST = 18
5696OFPT_STATS_REPLY = 19
5697OFPT_BARRIER_REQUEST = 20
5698OFPT_BARRIER_REPLY = 21
5699OFPT_QUEUE_GET_CONFIG_REQUEST = 22
5700OFPT_QUEUE_GET_CONFIG_REPLY = 23
5701OFPT_ROLE_REQUEST = 24
5702OFPT_ROLE_REPLY = 25
5703ofp_type_map = {
5704 0 : 'OFPT_HELLO',
5705 1 : 'OFPT_ERROR',
5706 2 : 'OFPT_ECHO_REQUEST',
5707 3 : 'OFPT_ECHO_REPLY',
5708 4 : 'OFPT_EXPERIMENTER',
5709 5 : 'OFPT_FEATURES_REQUEST',
5710 6 : 'OFPT_FEATURES_REPLY',
5711 7 : 'OFPT_GET_CONFIG_REQUEST',
5712 8 : 'OFPT_GET_CONFIG_REPLY',
5713 9 : 'OFPT_SET_CONFIG',
5714 10 : 'OFPT_PACKET_IN',
5715 11 : 'OFPT_FLOW_REMOVED',
5716 12 : 'OFPT_PORT_STATUS',
5717 13 : 'OFPT_PACKET_OUT',
5718 14 : 'OFPT_FLOW_MOD',
5719 15 : 'OFPT_GROUP_MOD',
5720 16 : 'OFPT_PORT_MOD',
5721 17 : 'OFPT_TABLE_MOD',
5722 18 : 'OFPT_STATS_REQUEST',
5723 19 : 'OFPT_STATS_REPLY',
5724 20 : 'OFPT_BARRIER_REQUEST',
5725 21 : 'OFPT_BARRIER_REPLY',
5726 22 : 'OFPT_QUEUE_GET_CONFIG_REQUEST',
5727 23 : 'OFPT_QUEUE_GET_CONFIG_REPLY',
5728 24 : 'OFPT_ROLE_REQUEST',
5729 25 : 'OFPT_ROLE_REPLY'
5730}
5731
5732ofp_packet_in_reason = ['OFPR_NO_MATCH', 'OFPR_ACTION', 'OFPR_INVALID_TTL']
5733OFPR_NO_MATCH = 0
5734OFPR_ACTION = 1
5735OFPR_INVALID_TTL = 2
5736ofp_packet_in_reason_map = {
5737 0 : 'OFPR_NO_MATCH',
5738 1 : 'OFPR_ACTION',
5739 2 : 'OFPR_INVALID_TTL'
5740}
5741
5742ofp_stats_types = ['OFPST_DESC', 'OFPST_FLOW', 'OFPST_AGGREGATE', 'OFPST_TABLE', 'OFPST_PORT', 'OFPST_QUEUE', 'OFPST_GROUP', 'OFPST_GROUP_DESC', 'OFPST_GROUP_FEATURES', 'OFPST_EXPERIMENTER']
5743OFPST_DESC = 0
5744OFPST_FLOW = 1
5745OFPST_AGGREGATE = 2
5746OFPST_TABLE = 3
5747OFPST_PORT = 4
5748OFPST_QUEUE = 5
5749OFPST_GROUP = 6
5750OFPST_GROUP_DESC = 7
5751OFPST_GROUP_FEATURES = 8
5752OFPST_EXPERIMENTER = 65535
5753ofp_stats_types_map = {
5754 0 : 'OFPST_DESC',
5755 1 : 'OFPST_FLOW',
5756 2 : 'OFPST_AGGREGATE',
5757 3 : 'OFPST_TABLE',
5758 4 : 'OFPST_PORT',
5759 5 : 'OFPST_QUEUE',
5760 6 : 'OFPST_GROUP',
5761 7 : 'OFPST_GROUP_DESC',
5762 8 : 'OFPST_GROUP_FEATURES',
5763 65535 : 'OFPST_EXPERIMENTER'
5764}
5765
5766ofp_group_mod_command = ['OFPGC_ADD', 'OFPGC_MODIFY', 'OFPGC_DELETE']
5767OFPGC_ADD = 0
5768OFPGC_MODIFY = 1
5769OFPGC_DELETE = 2
5770ofp_group_mod_command_map = {
5771 0 : 'OFPGC_ADD',
5772 1 : 'OFPGC_MODIFY',
5773 2 : 'OFPGC_DELETE'
5774}
5775
5776ofp_port_features = ['OFPPF_10MB_HD', 'OFPPF_10MB_FD', 'OFPPF_100MB_HD', 'OFPPF_100MB_FD', 'OFPPF_1GB_HD', 'OFPPF_1GB_FD', 'OFPPF_10GB_FD', 'OFPPF_40GB_FD', 'OFPPF_100GB_FD', 'OFPPF_1TB_FD', 'OFPPF_OTHER', 'OFPPF_COPPER', 'OFPPF_FIBER', 'OFPPF_AUTONEG', 'OFPPF_PAUSE', 'OFPPF_PAUSE_ASYM']
5777OFPPF_10MB_HD = 1
5778OFPPF_10MB_FD = 2
5779OFPPF_100MB_HD = 4
5780OFPPF_100MB_FD = 8
5781OFPPF_1GB_HD = 16
5782OFPPF_1GB_FD = 32
5783OFPPF_10GB_FD = 64
5784OFPPF_40GB_FD = 128
5785OFPPF_100GB_FD = 256
5786OFPPF_1TB_FD = 512
5787OFPPF_OTHER = 1024
5788OFPPF_COPPER = 2048
5789OFPPF_FIBER = 4096
5790OFPPF_AUTONEG = 8192
5791OFPPF_PAUSE = 16384
5792OFPPF_PAUSE_ASYM = 32768
5793ofp_port_features_map = {
5794 1 : 'OFPPF_10MB_HD',
5795 2 : 'OFPPF_10MB_FD',
5796 4 : 'OFPPF_100MB_HD',
5797 8 : 'OFPPF_100MB_FD',
5798 16 : 'OFPPF_1GB_HD',
5799 32 : 'OFPPF_1GB_FD',
5800 64 : 'OFPPF_10GB_FD',
5801 128 : 'OFPPF_40GB_FD',
5802 256 : 'OFPPF_100GB_FD',
5803 512 : 'OFPPF_1TB_FD',
5804 1024 : 'OFPPF_OTHER',
5805 2048 : 'OFPPF_COPPER',
5806 4096 : 'OFPPF_FIBER',
5807 8192 : 'OFPPF_AUTONEG',
5808 16384 : 'OFPPF_PAUSE',
5809 32768 : 'OFPPF_PAUSE_ASYM'
5810}
5811
5812ofp_group_mod_failed_code = ['OFPGMFC_GROUP_EXISTS', 'OFPGMFC_INVALID_GROUP', 'OFPGMFC_OUT_OF_GROUPS', 'OFPGMFC_OUT_OF_BUCKETS', 'OFPGMFC_CHAINING_UNSUPPORTED', 'OFPGMFC_WATCH_UNSUPPORTED', 'OFPGMFC_LOOP', 'OFPGMFC_UNKNOWN_GROUP', 'OFPGMFC_CHAINED_GROUP', 'OFPGMFC_BAD_TYPE', 'OFPGMFC_BAD_COMMAND', 'OFPGMFC_BAD_BUCKET', 'OFPGMFC_BAD_WATCH', 'OFPGMFC_EPERM']
5813OFPGMFC_GROUP_EXISTS = 0
5814OFPGMFC_INVALID_GROUP = 1
5815OFPGMFC_OUT_OF_GROUPS = 3
5816OFPGMFC_OUT_OF_BUCKETS = 4
5817OFPGMFC_CHAINING_UNSUPPORTED = 5
5818OFPGMFC_WATCH_UNSUPPORTED = 6
5819OFPGMFC_LOOP = 7
5820OFPGMFC_UNKNOWN_GROUP = 8
5821OFPGMFC_CHAINED_GROUP = 9
5822OFPGMFC_BAD_TYPE = 10
5823OFPGMFC_BAD_COMMAND = 11
5824OFPGMFC_BAD_BUCKET = 12
5825OFPGMFC_BAD_WATCH = 13
5826OFPGMFC_EPERM = 14
5827ofp_group_mod_failed_code_map = {
5828 0 : 'OFPGMFC_GROUP_EXISTS',
5829 1 : 'OFPGMFC_INVALID_GROUP',
5830 3 : 'OFPGMFC_OUT_OF_GROUPS',
5831 4 : 'OFPGMFC_OUT_OF_BUCKETS',
5832 5 : 'OFPGMFC_CHAINING_UNSUPPORTED',
5833 6 : 'OFPGMFC_WATCH_UNSUPPORTED',
5834 7 : 'OFPGMFC_LOOP',
5835 8 : 'OFPGMFC_UNKNOWN_GROUP',
5836 9 : 'OFPGMFC_CHAINED_GROUP',
5837 10 : 'OFPGMFC_BAD_TYPE',
5838 11 : 'OFPGMFC_BAD_COMMAND',
5839 12 : 'OFPGMFC_BAD_BUCKET',
5840 13 : 'OFPGMFC_BAD_WATCH',
5841 14 : 'OFPGMFC_EPERM'
5842}
5843
5844# Values from macro definitions
5845OFP_ETH_ALEN = 6
5846OFP_MAX_PORT_NAME_LEN = 16
5847OFP_TCP_PORT = 6633
5848OFP_FLOW_PERMANENT = 0
5849OFPQ_MIN_RATE_UNCFG = 0xffff
5850OFPQ_ALL = 0xffffffff
5851OFP_VERSION = 0x03
5852OFP_MAX_TABLE_NAME_LEN = 32
5853OFP_DEFAULT_PRIORITY = 0x8000
5854OFP_NO_BUFFER = 0xffffffff
5855OFP_SSL_PORT = 6633
5856OFP_DEFAULT_MISS_SEND_LEN = 128
5857DESC_STR_LEN = 256
5858SERIAL_NUM_LEN = 32
5859
5860# Basic structure size definitions.
5861# Does not include ofp_header members.
5862# Does not include variable length arrays.
5863OFP_ACTION_EXPERIMENTER_HEADER_BYTES = 8
5864OFP_ACTION_GROUP_BYTES = 8
5865OFP_ACTION_HEADER_BYTES = 8
5866OFP_ACTION_MPLS_TTL_BYTES = 8
5867OFP_ACTION_NW_TTL_BYTES = 8
5868OFP_ACTION_OUTPUT_BYTES = 16
5869OFP_ACTION_POP_MPLS_BYTES = 8
5870OFP_ACTION_PUSH_BYTES = 8
5871OFP_ACTION_SET_FIELD_BYTES = 8
5872OFP_ACTION_SET_QUEUE_BYTES = 8
5873OFP_AGGREGATE_STATS_REPLY_BYTES = 24
5874OFP_AGGREGATE_STATS_REQUEST_BYTES = 36
5875OFP_BUCKET_BYTES = 16
5876OFP_BUCKET_COUNTER_BYTES = 16
5877OFP_DESC_STATS_BYTES = 1056
5878OFP_ERROR_EXPERIMENTER_MSG_BYTES = 8
5879OFP_ERROR_MSG_BYTES = 4
5880OFP_EXPERIMENTER_HEADER_BYTES = 8
5881OFP_EXPERIMENTER_STATS_HEADER_BYTES = 8
5882OFP_FLOW_MOD_BYTES = 44
5883OFP_FLOW_REMOVED_BYTES = 44
5884OFP_FLOW_STATS_BYTES = 52
5885OFP_FLOW_STATS_REQUEST_BYTES = 36
5886OFP_GROUP_DESC_STATS_BYTES = 8
5887OFP_GROUP_FEATURES_STATS_BYTES = 40
5888OFP_GROUP_MOD_BYTES = 8
5889OFP_GROUP_STATS_BYTES = 32
5890OFP_GROUP_STATS_REQUEST_BYTES = 8
5891OFP_HEADER_BYTES = 8
5892OFP_HELLO_BYTES = 0
5893OFP_INSTRUCTION_BYTES = 8
5894OFP_INSTRUCTION_ACTIONS_BYTES = 8
5895OFP_INSTRUCTION_GOTO_TABLE_BYTES = 8
5896OFP_INSTRUCTION_WRITE_METADATA_BYTES = 24
5897OFP_MATCH_BYTES = 4
5898OFP_OXM_EXPERIMENTER_HEADER_BYTES = 8
5899OFP_PACKET_IN_BYTES = 12
5900OFP_PACKET_OUT_BYTES = 16
5901OFP_PACKET_QUEUE_BYTES = 16
5902OFP_PORT_BYTES = 64
5903OFP_PORT_MOD_BYTES = 32
5904OFP_PORT_STATS_BYTES = 104
5905OFP_PORT_STATS_REQUEST_BYTES = 8
5906OFP_PORT_STATUS_BYTES = 72
5907OFP_QUEUE_GET_CONFIG_REPLY_BYTES = 8
5908OFP_QUEUE_GET_CONFIG_REQUEST_BYTES = 8
5909OFP_QUEUE_PROP_EXPERIMENTER_BYTES = 16
5910OFP_QUEUE_PROP_HEADER_BYTES = 8
5911OFP_QUEUE_PROP_MAX_RATE_BYTES = 16
5912OFP_QUEUE_PROP_MIN_RATE_BYTES = 16
5913OFP_QUEUE_STATS_BYTES = 32
5914OFP_QUEUE_STATS_REQUEST_BYTES = 8
5915OFP_ROLE_REQUEST_BYTES = 16
5916OFP_STATS_REPLY_BYTES = 8
5917OFP_STATS_REQUEST_BYTES = 8
5918OFP_SWITCH_CONFIG_BYTES = 4
5919OFP_SWITCH_FEATURES_BYTES = 24
5920OFP_TABLE_MOD_BYTES = 8
5921OFP_TABLE_STATS_BYTES = 128
5922