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