blob: 06330e11a061b6bad3e3eb9cd38a354455bb9e83 [file] [log] [blame]
Rich Lane6242d9f2013-01-06 17:35:39 -08001import struct
2
3# Structure definitions
4class ofp_phy_port:
5 """Automatically generated Python class for ofp_phy_port
6
Rich Lane5b44ab42013-03-11 12:37:45 -07007 Date 2013-03-11
Rich Lane6242d9f2013-01-06 17:35:39 -08008 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.port_no = 0
17 self.hw_addr= [0,0,0,0,0,0]
18 self.name= ""
19 self.config = 0
20 self.state = 0
21 self.curr = 0
22 self.advertised = 0
23 self.supported = 0
24 self.peer = 0
25
26 def __assert(self):
27 """Sanity check
28 """
29 if(not isinstance(self.hw_addr, list)):
30 return (False, "self.hw_addr is not list as expected.")
31 if(len(self.hw_addr) != 6):
32 return (False, "self.hw_addr is not of size 6 as expected.")
33 if(not isinstance(self.name, str)):
34 return (False, "self.name is not string as expected.")
35 if(len(self.name) > 16):
36 return (False, "self.name is not of size 16 as expected.")
37 return (True, None)
38
39 def pack(self, assertstruct=True):
40 """Pack message
41 Packs empty array used as placeholder
42 """
43 if(assertstruct):
44 if(not self.__assert()[0]):
45 return None
46 packed = ""
47 packed += struct.pack("!H", self.port_no)
48 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])
49 packed += self.name.ljust(16,'\0')
50 packed += struct.pack("!LLLLLL", self.config, self.state, self.curr, self.advertised, self.supported, self.peer)
51 return packed
52
53 def unpack(self, binaryString):
54 """Unpack message
55 Do not unpack empty array used as placeholder
56 since they can contain heterogeneous type
57 """
58 if (len(binaryString) < 48):
59 return binaryString
60 fmt = '!H'
61 start = 0
62 end = start + struct.calcsize(fmt)
63 (self.port_no,) = struct.unpack(fmt, binaryString[start:end])
64 fmt = '!BBBBBB'
65 start = 2
66 end = start + struct.calcsize(fmt)
67 (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])
68 self.name = binaryString[8:24].replace("\0","")
69 fmt = '!LLLLLL'
70 start = 24
71 end = start + struct.calcsize(fmt)
72 (self.config, self.state, self.curr, self.advertised, self.supported, self.peer) = struct.unpack(fmt, binaryString[start:end])
73 return binaryString[48:]
74
75 def __len__(self):
76 """Return length of message
77 """
78 l = 48
79 return l
80
81 def __eq__(self, other):
82 """Return True if self and other have same values
83 """
84 if type(self) != type(other): return False
85 if self.port_no != other.port_no: return False
86 if self.hw_addr != other.hw_addr: return False
87 if self.name != other.name: return False
88 if self.config != other.config: return False
89 if self.state != other.state: return False
90 if self.curr != other.curr: return False
91 if self.advertised != other.advertised: return False
92 if self.supported != other.supported: return False
93 if self.peer != other.peer: return False
94 return True
95
96 def __ne__(self, other): return not self.__eq__(other)
97
98 def show(self, prefix=''):
99 """Generate string showing basic members of structure
100 """
101 outstr = ''
102 outstr += prefix + 'port_no: ' + str(self.port_no) + '\n'
103 outstr += prefix + 'hw_addr: ' + str(self.hw_addr) + '\n'
104 outstr += prefix + 'name: ' + str(self.name) + '\n'
105 outstr += prefix + 'config: ' + str(self.config) + '\n'
106 outstr += prefix + 'state: ' + str(self.state) + '\n'
107 outstr += prefix + 'curr: ' + str(self.curr) + '\n'
108 outstr += prefix + 'advertised: ' + str(self.advertised) + '\n'
109 outstr += prefix + 'supported: ' + str(self.supported) + '\n'
110 outstr += prefix + 'peer: ' + str(self.peer) + '\n'
111 return outstr
112
113
114class ofp_aggregate_stats_reply:
115 """Automatically generated Python class for ofp_aggregate_stats_reply
116
Rich Lane5b44ab42013-03-11 12:37:45 -0700117 Date 2013-03-11
Rich Lane6242d9f2013-01-06 17:35:39 -0800118 Created by of.pythonize.pythonizer
119 Core structure: Messages do not include ofp_header
120 Does not include var-length arrays
121 """
122 def __init__(self):
123 """Initialize
124 Declare members and default values
125 """
126 self.packet_count = 0
127 self.byte_count = 0
128 self.flow_count = 0
129 self.pad= [0,0,0,0]
130
131 def __assert(self):
132 """Sanity check
133 """
134 if(not isinstance(self.pad, list)):
135 return (False, "self.pad is not list as expected.")
136 if(len(self.pad) != 4):
137 return (False, "self.pad is not of size 4 as expected.")
138 return (True, None)
139
140 def pack(self, assertstruct=True):
141 """Pack message
142 Packs empty array used as placeholder
143 """
144 if(assertstruct):
145 if(not self.__assert()[0]):
146 return None
147 packed = ""
148 packed += struct.pack("!QQL", self.packet_count, self.byte_count, self.flow_count)
149 packed += struct.pack("!BBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3])
150 return packed
151
152 def unpack(self, binaryString):
153 """Unpack message
154 Do not unpack empty array used as placeholder
155 since they can contain heterogeneous type
156 """
157 if (len(binaryString) < 24):
158 return binaryString
159 fmt = '!QQL'
160 start = 0
161 end = start + struct.calcsize(fmt)
162 (self.packet_count, self.byte_count, self.flow_count) = struct.unpack(fmt, binaryString[start:end])
163 fmt = '!BBBB'
164 start = 20
165 end = start + struct.calcsize(fmt)
166 (self.pad[0], self.pad[1], self.pad[2], self.pad[3]) = struct.unpack(fmt, binaryString[start:end])
167 return binaryString[24:]
168
169 def __len__(self):
170 """Return length of message
171 """
172 l = 24
173 return l
174
175 def __eq__(self, other):
176 """Return True if self and other have same values
177 """
178 if type(self) != type(other): return False
179 if self.packet_count != other.packet_count: return False
180 if self.byte_count != other.byte_count: return False
181 if self.flow_count != other.flow_count: return False
182 if self.pad != other.pad: return False
183 return True
184
185 def __ne__(self, other): return not self.__eq__(other)
186
187 def show(self, prefix=''):
188 """Generate string showing basic members of structure
189 """
190 outstr = ''
191 outstr += prefix + 'packet_count: ' + str(self.packet_count) + '\n'
192 outstr += prefix + 'byte_count: ' + str(self.byte_count) + '\n'
193 outstr += prefix + 'flow_count: ' + str(self.flow_count) + '\n'
194 return outstr
195
196
197class ofp_table_stats:
198 """Automatically generated Python class for ofp_table_stats
199
Rich Lane5b44ab42013-03-11 12:37:45 -0700200 Date 2013-03-11
Rich Lane6242d9f2013-01-06 17:35:39 -0800201 Created by of.pythonize.pythonizer
202 Core structure: Messages do not include ofp_header
203 Does not include var-length arrays
204 """
205 def __init__(self):
206 """Initialize
207 Declare members and default values
208 """
209 self.table_id = 0
210 self.pad= [0,0,0]
211 self.name= ""
212 self.wildcards = 0
213 self.max_entries = 0
214 self.active_count = 0
215 self.lookup_count = 0
216 self.matched_count = 0
217
218 def __assert(self):
219 """Sanity check
220 """
221 if(not isinstance(self.pad, list)):
222 return (False, "self.pad is not list as expected.")
223 if(len(self.pad) != 3):
224 return (False, "self.pad is not of size 3 as expected.")
225 if(not isinstance(self.name, str)):
226 return (False, "self.name is not string as expected.")
227 if(len(self.name) > 32):
228 return (False, "self.name is not of size 32 as expected.")
229 return (True, None)
230
231 def pack(self, assertstruct=True):
232 """Pack message
233 Packs empty array used as placeholder
234 """
235 if(assertstruct):
236 if(not self.__assert()[0]):
237 return None
238 packed = ""
239 packed += struct.pack("!B", self.table_id)
240 packed += struct.pack("!BBB", self.pad[0], self.pad[1], self.pad[2])
241 packed += self.name.ljust(32,'\0')
242 packed += struct.pack("!LLLQQ", self.wildcards, self.max_entries, self.active_count, self.lookup_count, self.matched_count)
243 return packed
244
245 def unpack(self, binaryString):
246 """Unpack message
247 Do not unpack empty array used as placeholder
248 since they can contain heterogeneous type
249 """
250 if (len(binaryString) < 64):
251 return binaryString
252 fmt = '!B'
253 start = 0
254 end = start + struct.calcsize(fmt)
255 (self.table_id,) = struct.unpack(fmt, binaryString[start:end])
256 fmt = '!BBB'
257 start = 1
258 end = start + struct.calcsize(fmt)
259 (self.pad[0], self.pad[1], self.pad[2]) = struct.unpack(fmt, binaryString[start:end])
260 self.name = binaryString[4:36].replace("\0","")
261 fmt = '!LLLQQ'
262 start = 36
263 end = start + struct.calcsize(fmt)
264 (self.wildcards, self.max_entries, self.active_count, self.lookup_count, self.matched_count) = struct.unpack(fmt, binaryString[start:end])
265 return binaryString[64:]
266
267 def __len__(self):
268 """Return length of message
269 """
270 l = 64
271 return l
272
273 def __eq__(self, other):
274 """Return True if self and other have same values
275 """
276 if type(self) != type(other): return False
277 if self.table_id != other.table_id: return False
278 if self.pad != other.pad: return False
279 if self.name != other.name: return False
280 if self.wildcards != other.wildcards: return False
281 if self.max_entries != other.max_entries: return False
282 if self.active_count != other.active_count: return False
283 if self.lookup_count != other.lookup_count: return False
284 if self.matched_count != other.matched_count: return False
285 return True
286
287 def __ne__(self, other): return not self.__eq__(other)
288
289 def show(self, prefix=''):
290 """Generate string showing basic members of structure
291 """
292 outstr = ''
293 outstr += prefix + 'table_id: ' + str(self.table_id) + '\n'
294 outstr += prefix + 'name: ' + str(self.name) + '\n'
295 outstr += prefix + 'wildcards: ' + str(self.wildcards) + '\n'
296 outstr += prefix + 'max_entries: ' + str(self.max_entries) + '\n'
297 outstr += prefix + 'active_count: ' + str(self.active_count) + '\n'
298 outstr += prefix + 'lookup_count: ' + str(self.lookup_count) + '\n'
299 outstr += prefix + 'matched_count: ' + str(self.matched_count) + '\n'
300 return outstr
301
302
303class ofp_flow_removed:
304 """Automatically generated Python class for ofp_flow_removed
305
Rich Lane5b44ab42013-03-11 12:37:45 -0700306 Date 2013-03-11
Rich Lane6242d9f2013-01-06 17:35:39 -0800307 Created by of.pythonize.pythonizer
308 Core structure: Messages do not include ofp_header
309 Does not include var-length arrays
310 """
311 def __init__(self):
312 """Initialize
313 Declare members and default values
314 """
315 self.match = ofp_match()
316 self.cookie = 0
317 self.priority = 0
318 self.reason = 0
319 self.pad = 0
320 self.duration_sec = 0
321 self.duration_nsec = 0
322 self.idle_timeout = 0
323 self.pad2= [0,0]
324 self.packet_count = 0
325 self.byte_count = 0
326
327 def __assert(self):
328 """Sanity check
329 """
330 if(not isinstance(self.match, ofp_match)):
331 return (False, "self.match is not class ofp_match as expected.")
332 if(not isinstance(self.pad2, list)):
333 return (False, "self.pad2 is not list as expected.")
334 if(len(self.pad2) != 2):
335 return (False, "self.pad2 is not of size 2 as expected.")
336 return (True, None)
337
338 def pack(self, assertstruct=True):
339 """Pack message
340 Packs empty array used as placeholder
341 """
342 if(assertstruct):
343 if(not self.__assert()[0]):
344 return None
345 packed = ""
346 packed += self.match.pack()
347 packed += struct.pack("!QHBBLLH", self.cookie, self.priority, self.reason, self.pad, self.duration_sec, self.duration_nsec, self.idle_timeout)
348 packed += struct.pack("!BB", self.pad2[0], self.pad2[1])
349 packed += struct.pack("!QQ", self.packet_count, self.byte_count)
350 return packed
351
352 def unpack(self, binaryString):
353 """Unpack message
354 Do not unpack empty array used as placeholder
355 since they can contain heterogeneous type
356 """
357 if (len(binaryString) < 80):
358 return binaryString
359 self.match.unpack(binaryString[0:])
360 fmt = '!QHBBLLH'
361 start = 40
362 end = start + struct.calcsize(fmt)
363 (self.cookie, self.priority, self.reason, self.pad, self.duration_sec, self.duration_nsec, self.idle_timeout) = struct.unpack(fmt, binaryString[start:end])
364 fmt = '!BB'
365 start = 62
366 end = start + struct.calcsize(fmt)
367 (self.pad2[0], self.pad2[1]) = struct.unpack(fmt, binaryString[start:end])
368 fmt = '!QQ'
369 start = 64
370 end = start + struct.calcsize(fmt)
371 (self.packet_count, self.byte_count) = struct.unpack(fmt, binaryString[start:end])
372 return binaryString[80:]
373
374 def __len__(self):
375 """Return length of message
376 """
377 l = 80
378 return l
379
380 def __eq__(self, other):
381 """Return True if self and other have same values
382 """
383 if type(self) != type(other): return False
384 if self.match != other.match: return False
385 if self.cookie != other.cookie: return False
386 if self.priority != other.priority: return False
387 if self.reason != other.reason: return False
388 if self.pad != other.pad: return False
389 if self.duration_sec != other.duration_sec: return False
390 if self.duration_nsec != other.duration_nsec: return False
391 if self.idle_timeout != other.idle_timeout: return False
392 if self.pad2 != other.pad2: return False
393 if self.packet_count != other.packet_count: return False
394 if self.byte_count != other.byte_count: return False
395 return True
396
397 def __ne__(self, other): return not self.__eq__(other)
398
399 def show(self, prefix=''):
400 """Generate string showing basic members of structure
401 """
402 outstr = ''
403 outstr += prefix + 'match: \n'
404 outstr += self.match.show(prefix + ' ')
405 outstr += prefix + 'cookie: ' + str(self.cookie) + '\n'
406 outstr += prefix + 'priority: ' + str(self.priority) + '\n'
407 outstr += prefix + 'reason: ' + str(self.reason) + '\n'
408 outstr += prefix + 'duration_sec: ' + str(self.duration_sec) + '\n'
409 outstr += prefix + 'duration_nsec: ' + str(self.duration_nsec) + '\n'
410 outstr += prefix + 'idle_timeout: ' + str(self.idle_timeout) + '\n'
411 outstr += prefix + 'packet_count: ' + str(self.packet_count) + '\n'
412 outstr += prefix + 'byte_count: ' + str(self.byte_count) + '\n'
413 return outstr
414
415
416class ofp_port_stats:
417 """Automatically generated Python class for ofp_port_stats
418
Rich Lane5b44ab42013-03-11 12:37:45 -0700419 Date 2013-03-11
Rich Lane6242d9f2013-01-06 17:35:39 -0800420 Created by of.pythonize.pythonizer
421 Core structure: Messages do not include ofp_header
422 Does not include var-length arrays
423 """
424 def __init__(self):
425 """Initialize
426 Declare members and default values
427 """
428 self.port_no = 0
429 self.pad= [0,0,0,0,0,0]
430 self.rx_packets = 0
431 self.tx_packets = 0
432 self.rx_bytes = 0
433 self.tx_bytes = 0
434 self.rx_dropped = 0
435 self.tx_dropped = 0
436 self.rx_errors = 0
437 self.tx_errors = 0
438 self.rx_frame_err = 0
439 self.rx_over_err = 0
440 self.rx_crc_err = 0
441 self.collisions = 0
442
443 def __assert(self):
444 """Sanity check
445 """
446 if(not isinstance(self.pad, list)):
447 return (False, "self.pad is not list as expected.")
448 if(len(self.pad) != 6):
449 return (False, "self.pad is not of size 6 as expected.")
450 return (True, None)
451
452 def pack(self, assertstruct=True):
453 """Pack message
454 Packs empty array used as placeholder
455 """
456 if(assertstruct):
457 if(not self.__assert()[0]):
458 return None
459 packed = ""
460 packed += struct.pack("!H", self.port_no)
461 packed += struct.pack("!BBBBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3], self.pad[4], self.pad[5])
462 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)
463 return packed
464
465 def unpack(self, binaryString):
466 """Unpack message
467 Do not unpack empty array used as placeholder
468 since they can contain heterogeneous type
469 """
470 if (len(binaryString) < 104):
471 return binaryString
472 fmt = '!H'
473 start = 0
474 end = start + struct.calcsize(fmt)
475 (self.port_no,) = struct.unpack(fmt, binaryString[start:end])
476 fmt = '!BBBBBB'
477 start = 2
478 end = start + struct.calcsize(fmt)
479 (self.pad[0], self.pad[1], self.pad[2], self.pad[3], self.pad[4], self.pad[5]) = struct.unpack(fmt, binaryString[start:end])
480 fmt = '!QQQQQQQQQQQQ'
481 start = 8
482 end = start + struct.calcsize(fmt)
483 (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])
484 return binaryString[104:]
485
486 def __len__(self):
487 """Return length of message
488 """
489 l = 104
490 return l
491
492 def __eq__(self, other):
493 """Return True if self and other have same values
494 """
495 if type(self) != type(other): return False
496 if self.port_no != other.port_no: return False
497 if self.pad != other.pad: return False
498 if self.rx_packets != other.rx_packets: return False
499 if self.tx_packets != other.tx_packets: return False
500 if self.rx_bytes != other.rx_bytes: return False
501 if self.tx_bytes != other.tx_bytes: return False
502 if self.rx_dropped != other.rx_dropped: return False
503 if self.tx_dropped != other.tx_dropped: return False
504 if self.rx_errors != other.rx_errors: return False
505 if self.tx_errors != other.tx_errors: return False
506 if self.rx_frame_err != other.rx_frame_err: return False
507 if self.rx_over_err != other.rx_over_err: return False
508 if self.rx_crc_err != other.rx_crc_err: return False
509 if self.collisions != other.collisions: return False
510 return True
511
512 def __ne__(self, other): return not self.__eq__(other)
513
514 def show(self, prefix=''):
515 """Generate string showing basic members of structure
516 """
517 outstr = ''
518 outstr += prefix + 'port_no: ' + str(self.port_no) + '\n'
519 outstr += prefix + 'rx_packets: ' + str(self.rx_packets) + '\n'
520 outstr += prefix + 'tx_packets: ' + str(self.tx_packets) + '\n'
521 outstr += prefix + 'rx_bytes: ' + str(self.rx_bytes) + '\n'
522 outstr += prefix + 'tx_bytes: ' + str(self.tx_bytes) + '\n'
523 outstr += prefix + 'rx_dropped: ' + str(self.rx_dropped) + '\n'
524 outstr += prefix + 'tx_dropped: ' + str(self.tx_dropped) + '\n'
525 outstr += prefix + 'rx_errors: ' + str(self.rx_errors) + '\n'
526 outstr += prefix + 'tx_errors: ' + str(self.tx_errors) + '\n'
527 outstr += prefix + 'rx_frame_err: ' + str(self.rx_frame_err) + '\n'
528 outstr += prefix + 'rx_over_err: ' + str(self.rx_over_err) + '\n'
529 outstr += prefix + 'rx_crc_err: ' + str(self.rx_crc_err) + '\n'
530 outstr += prefix + 'collisions: ' + str(self.collisions) + '\n'
531 return outstr
532
533
534class ofp_queue_stats:
535 """Automatically generated Python class for ofp_queue_stats
536
Rich Lane5b44ab42013-03-11 12:37:45 -0700537 Date 2013-03-11
Rich Lane6242d9f2013-01-06 17:35:39 -0800538 Created by of.pythonize.pythonizer
539 Core structure: Messages do not include ofp_header
540 Does not include var-length arrays
541 """
542 def __init__(self):
543 """Initialize
544 Declare members and default values
545 """
546 self.port_no = 0
547 self.pad= [0,0]
548 self.queue_id = 0
549 self.tx_bytes = 0
550 self.tx_packets = 0
551 self.tx_errors = 0
552
553 def __assert(self):
554 """Sanity check
555 """
556 if(not isinstance(self.pad, list)):
557 return (False, "self.pad is not list as expected.")
558 if(len(self.pad) != 2):
559 return (False, "self.pad is not of size 2 as expected.")
560 return (True, None)
561
562 def pack(self, assertstruct=True):
563 """Pack message
564 Packs empty array used as placeholder
565 """
566 if(assertstruct):
567 if(not self.__assert()[0]):
568 return None
569 packed = ""
570 packed += struct.pack("!H", self.port_no)
571 packed += struct.pack("!BB", self.pad[0], self.pad[1])
572 packed += struct.pack("!LQQQ", self.queue_id, self.tx_bytes, self.tx_packets, self.tx_errors)
573 return packed
574
575 def unpack(self, binaryString):
576 """Unpack message
577 Do not unpack empty array used as placeholder
578 since they can contain heterogeneous type
579 """
580 if (len(binaryString) < 32):
581 return binaryString
582 fmt = '!H'
583 start = 0
584 end = start + struct.calcsize(fmt)
585 (self.port_no,) = struct.unpack(fmt, binaryString[start:end])
586 fmt = '!BB'
587 start = 2
588 end = start + struct.calcsize(fmt)
589 (self.pad[0], self.pad[1]) = struct.unpack(fmt, binaryString[start:end])
590 fmt = '!LQQQ'
591 start = 4
592 end = start + struct.calcsize(fmt)
593 (self.queue_id, self.tx_bytes, self.tx_packets, self.tx_errors) = struct.unpack(fmt, binaryString[start:end])
594 return binaryString[32:]
595
596 def __len__(self):
597 """Return length of message
598 """
599 l = 32
600 return l
601
602 def __eq__(self, other):
603 """Return True if self and other have same values
604 """
605 if type(self) != type(other): return False
606 if self.port_no != other.port_no: return False
607 if self.pad != other.pad: return False
608 if self.queue_id != other.queue_id: return False
609 if self.tx_bytes != other.tx_bytes: return False
610 if self.tx_packets != other.tx_packets: return False
611 if self.tx_errors != other.tx_errors: return False
612 return True
613
614 def __ne__(self, other): return not self.__eq__(other)
615
616 def show(self, prefix=''):
617 """Generate string showing basic members of structure
618 """
619 outstr = ''
620 outstr += prefix + 'port_no: ' + str(self.port_no) + '\n'
621 outstr += prefix + 'queue_id: ' + str(self.queue_id) + '\n'
622 outstr += prefix + 'tx_bytes: ' + str(self.tx_bytes) + '\n'
623 outstr += prefix + 'tx_packets: ' + str(self.tx_packets) + '\n'
624 outstr += prefix + 'tx_errors: ' + str(self.tx_errors) + '\n'
625 return outstr
626
627
628class ofp_action_tp_port:
629 """Automatically generated Python class for ofp_action_tp_port
630
Rich Lane5b44ab42013-03-11 12:37:45 -0700631 Date 2013-03-11
Rich Lane6242d9f2013-01-06 17:35:39 -0800632 Created by of.pythonize.pythonizer
633 Core structure: Messages do not include ofp_header
634 Does not include var-length arrays
635 """
636 def __init__(self):
637 """Initialize
638 Declare members and default values
639 """
640 self.type = 0
641 self.len = 0
642 self.tp_port = 0
643 self.pad= [0,0]
644
645 def __assert(self):
646 """Sanity check
647 """
648 if(not isinstance(self.pad, list)):
649 return (False, "self.pad is not list as expected.")
650 if(len(self.pad) != 2):
651 return (False, "self.pad is not of size 2 as expected.")
652 return (True, None)
653
654 def pack(self, assertstruct=True):
655 """Pack message
656 Packs empty array used as placeholder
657 """
658 if(assertstruct):
659 if(not self.__assert()[0]):
660 return None
661 packed = ""
662 packed += struct.pack("!HHH", self.type, self.len, self.tp_port)
663 packed += struct.pack("!BB", self.pad[0], self.pad[1])
664 return packed
665
666 def unpack(self, binaryString):
667 """Unpack message
668 Do not unpack empty array used as placeholder
669 since they can contain heterogeneous type
670 """
671 if (len(binaryString) < 8):
672 return binaryString
673 fmt = '!HHH'
674 start = 0
675 end = start + struct.calcsize(fmt)
676 (self.type, self.len, self.tp_port) = struct.unpack(fmt, binaryString[start:end])
677 fmt = '!BB'
678 start = 6
679 end = start + struct.calcsize(fmt)
680 (self.pad[0], self.pad[1]) = struct.unpack(fmt, binaryString[start:end])
681 return binaryString[8:]
682
683 def __len__(self):
684 """Return length of message
685 """
686 l = 8
687 return l
688
689 def __eq__(self, other):
690 """Return True if self and other have same values
691 """
692 if type(self) != type(other): return False
693 if self.type != other.type: return False
694 if self.len != other.len: return False
695 if self.tp_port != other.tp_port: return False
696 if self.pad != other.pad: return False
697 return True
698
699 def __ne__(self, other): return not self.__eq__(other)
700
701 def show(self, prefix=''):
702 """Generate string showing basic members of structure
703 """
704 outstr = ''
705 outstr += prefix + 'type: ' + str(self.type) + '\n'
706 outstr += prefix + 'len: ' + str(self.len) + '\n'
707 outstr += prefix + 'tp_port: ' + str(self.tp_port) + '\n'
708 return outstr
709
710
711class ofp_port_stats_request:
712 """Automatically generated Python class for ofp_port_stats_request
713
Rich Lane5b44ab42013-03-11 12:37:45 -0700714 Date 2013-03-11
Rich Lane6242d9f2013-01-06 17:35:39 -0800715 Created by of.pythonize.pythonizer
716 Core structure: Messages do not include ofp_header
717 Does not include var-length arrays
718 """
719 def __init__(self):
720 """Initialize
721 Declare members and default values
722 """
723 self.port_no = 0
724 self.pad= [0,0,0,0,0,0]
725
726 def __assert(self):
727 """Sanity check
728 """
729 if(not isinstance(self.pad, list)):
730 return (False, "self.pad is not list as expected.")
731 if(len(self.pad) != 6):
732 return (False, "self.pad is not of size 6 as expected.")
733 return (True, None)
734
735 def pack(self, assertstruct=True):
736 """Pack message
737 Packs empty array used as placeholder
738 """
739 if(assertstruct):
740 if(not self.__assert()[0]):
741 return None
742 packed = ""
743 packed += struct.pack("!H", self.port_no)
744 packed += struct.pack("!BBBBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3], self.pad[4], self.pad[5])
745 return packed
746
747 def unpack(self, binaryString):
748 """Unpack message
749 Do not unpack empty array used as placeholder
750 since they can contain heterogeneous type
751 """
752 if (len(binaryString) < 8):
753 return binaryString
754 fmt = '!H'
755 start = 0
756 end = start + struct.calcsize(fmt)
757 (self.port_no,) = struct.unpack(fmt, binaryString[start:end])
758 fmt = '!BBBBBB'
759 start = 2
760 end = start + struct.calcsize(fmt)
761 (self.pad[0], self.pad[1], self.pad[2], self.pad[3], self.pad[4], self.pad[5]) = struct.unpack(fmt, binaryString[start:end])
762 return binaryString[8:]
763
764 def __len__(self):
765 """Return length of message
766 """
767 l = 8
768 return l
769
770 def __eq__(self, other):
771 """Return True if self and other have same values
772 """
773 if type(self) != type(other): return False
774 if self.port_no != other.port_no: return False
775 if self.pad != other.pad: return False
776 return True
777
778 def __ne__(self, other): return not self.__eq__(other)
779
780 def show(self, prefix=''):
781 """Generate string showing basic members of structure
782 """
783 outstr = ''
784 outstr += prefix + 'port_no: ' + str(self.port_no) + '\n'
785 return outstr
786
787
788class ofp_stats_request:
789 """Automatically generated Python class for ofp_stats_request
790
Rich Lane5b44ab42013-03-11 12:37:45 -0700791 Date 2013-03-11
Rich Lane6242d9f2013-01-06 17:35:39 -0800792 Created by of.pythonize.pythonizer
793 Core structure: Messages do not include ofp_header
794 Does not include var-length arrays
795 """
796 def __init__(self):
797 """Initialize
798 Declare members and default values
799 """
800 self.type = 0
801 self.flags = 0
802
803 def __assert(self):
804 """Sanity check
805 """
806 return (True, None)
807
808 def pack(self, assertstruct=True):
809 """Pack message
810 Packs empty array used as placeholder
811 """
812 if(assertstruct):
813 if(not self.__assert()[0]):
814 return None
815 packed = ""
816 packed += struct.pack("!HH", self.type, self.flags)
817 return packed
818
819 def unpack(self, binaryString):
820 """Unpack message
821 Do not unpack empty array used as placeholder
822 since they can contain heterogeneous type
823 """
824 if (len(binaryString) < 4):
825 return binaryString
826 fmt = '!HH'
827 start = 0
828 end = start + struct.calcsize(fmt)
829 (self.type, self.flags) = struct.unpack(fmt, binaryString[start:end])
830 return binaryString[4:]
831
832 def __len__(self):
833 """Return length of message
834 """
835 l = 4
836 return l
837
838 def __eq__(self, other):
839 """Return True if self and other have same values
840 """
841 if type(self) != type(other): return False
842 if self.type != other.type: return False
843 if self.flags != other.flags: return False
844 return True
845
846 def __ne__(self, other): return not self.__eq__(other)
847
848 def show(self, prefix=''):
849 """Generate string showing basic members of structure
850 """
851 outstr = ''
852 outstr += prefix + 'type: ' + str(self.type) + '\n'
853 outstr += prefix + 'flags: ' + str(self.flags) + '\n'
854 return outstr
855
856
857class ofp_hello:
858 """Automatically generated Python class for ofp_hello
859
Rich Lane5b44ab42013-03-11 12:37:45 -0700860 Date 2013-03-11
Rich Lane6242d9f2013-01-06 17:35:39 -0800861 Created by of.pythonize.pythonizer
862 Core structure: Messages do not include ofp_header
863 Does not include var-length arrays
864 """
865 def __init__(self):
866 """Initialize
867 Declare members and default values
868 """
869
870 def __assert(self):
871 """Sanity check
872 """
873 return (True, None)
874
875 def pack(self, assertstruct=True):
876 """Pack message
877 Packs empty array used as placeholder
878 """
879 if(assertstruct):
880 if(not self.__assert()[0]):
881 return None
882 packed = ""
883 return packed
884
885 def unpack(self, binaryString):
886 """Unpack message
887 Do not unpack empty array used as placeholder
888 since they can contain heterogeneous type
889 """
890 if (len(binaryString) < 0):
891 return binaryString
892 return binaryString[0:]
893
894 def __len__(self):
895 """Return length of message
896 """
897 l = 0
898 return l
899
900 def __eq__(self, other):
901 """Return True if self and other have same values
902 """
903 if type(self) != type(other): return False
904 return True
905
906 def __ne__(self, other): return not self.__eq__(other)
907
908 def show(self, prefix=''):
909 """Generate string showing basic members of structure
910 """
911 outstr = ''
912 return outstr
913
914
915class ofp_aggregate_stats_request:
916 """Automatically generated Python class for ofp_aggregate_stats_request
917
Rich Lane5b44ab42013-03-11 12:37:45 -0700918 Date 2013-03-11
Rich Lane6242d9f2013-01-06 17:35:39 -0800919 Created by of.pythonize.pythonizer
920 Core structure: Messages do not include ofp_header
921 Does not include var-length arrays
922 """
923 def __init__(self):
924 """Initialize
925 Declare members and default values
926 """
927 self.match = ofp_match()
928 self.table_id = 0
929 self.pad = 0
930 self.out_port = 0
931
932 def __assert(self):
933 """Sanity check
934 """
935 if(not isinstance(self.match, ofp_match)):
936 return (False, "self.match is not class ofp_match as expected.")
937 return (True, None)
938
939 def pack(self, assertstruct=True):
940 """Pack message
941 Packs empty array used as placeholder
942 """
943 if(assertstruct):
944 if(not self.__assert()[0]):
945 return None
946 packed = ""
947 packed += self.match.pack()
948 packed += struct.pack("!BBH", self.table_id, self.pad, self.out_port)
949 return packed
950
951 def unpack(self, binaryString):
952 """Unpack message
953 Do not unpack empty array used as placeholder
954 since they can contain heterogeneous type
955 """
956 if (len(binaryString) < 44):
957 return binaryString
958 self.match.unpack(binaryString[0:])
959 fmt = '!BBH'
960 start = 40
961 end = start + struct.calcsize(fmt)
962 (self.table_id, self.pad, self.out_port) = struct.unpack(fmt, binaryString[start:end])
963 return binaryString[44:]
964
965 def __len__(self):
966 """Return length of message
967 """
968 l = 44
969 return l
970
971 def __eq__(self, other):
972 """Return True if self and other have same values
973 """
974 if type(self) != type(other): return False
975 if self.match != other.match: return False
976 if self.table_id != other.table_id: return False
977 if self.pad != other.pad: return False
978 if self.out_port != other.out_port: return False
979 return True
980
981 def __ne__(self, other): return not self.__eq__(other)
982
983 def show(self, prefix=''):
984 """Generate string showing basic members of structure
985 """
986 outstr = ''
987 outstr += prefix + 'match: \n'
988 outstr += self.match.show(prefix + ' ')
989 outstr += prefix + 'table_id: ' + str(self.table_id) + '\n'
990 outstr += prefix + 'out_port: ' + str(self.out_port) + '\n'
991 return outstr
992
993
994class ofp_port_status:
995 """Automatically generated Python class for ofp_port_status
996
Rich Lane5b44ab42013-03-11 12:37:45 -0700997 Date 2013-03-11
Rich Lane6242d9f2013-01-06 17:35:39 -0800998 Created by of.pythonize.pythonizer
999 Core structure: Messages do not include ofp_header
1000 Does not include var-length arrays
1001 """
1002 def __init__(self):
1003 """Initialize
1004 Declare members and default values
1005 """
1006 self.reason = 0
1007 self.pad= [0,0,0,0,0,0,0]
1008 self.desc = ofp_phy_port()
1009
1010 def __assert(self):
1011 """Sanity check
1012 """
1013 if(not isinstance(self.pad, list)):
1014 return (False, "self.pad is not list as expected.")
1015 if(len(self.pad) != 7):
1016 return (False, "self.pad is not of size 7 as expected.")
1017 if(not isinstance(self.desc, ofp_phy_port)):
1018 return (False, "self.desc is not class ofp_phy_port as expected.")
1019 return (True, None)
1020
1021 def pack(self, assertstruct=True):
1022 """Pack message
1023 Packs empty array used as placeholder
1024 """
1025 if(assertstruct):
1026 if(not self.__assert()[0]):
1027 return None
1028 packed = ""
1029 packed += struct.pack("!B", self.reason)
1030 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])
1031 packed += self.desc.pack()
1032 return packed
1033
1034 def unpack(self, binaryString):
1035 """Unpack message
1036 Do not unpack empty array used as placeholder
1037 since they can contain heterogeneous type
1038 """
1039 if (len(binaryString) < 56):
1040 return binaryString
1041 fmt = '!B'
1042 start = 0
1043 end = start + struct.calcsize(fmt)
1044 (self.reason,) = struct.unpack(fmt, binaryString[start:end])
1045 fmt = '!BBBBBBB'
1046 start = 1
1047 end = start + struct.calcsize(fmt)
1048 (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])
1049 self.desc.unpack(binaryString[8:])
1050 return binaryString[56:]
1051
1052 def __len__(self):
1053 """Return length of message
1054 """
1055 l = 56
1056 return l
1057
1058 def __eq__(self, other):
1059 """Return True if self and other have same values
1060 """
1061 if type(self) != type(other): return False
1062 if self.reason != other.reason: return False
1063 if self.pad != other.pad: return False
1064 if self.desc != other.desc: return False
1065 return True
1066
1067 def __ne__(self, other): return not self.__eq__(other)
1068
1069 def show(self, prefix=''):
1070 """Generate string showing basic members of structure
1071 """
1072 outstr = ''
1073 outstr += prefix + 'reason: ' + str(self.reason) + '\n'
1074 outstr += prefix + 'desc: \n'
1075 outstr += self.desc.show(prefix + ' ')
1076 return outstr
1077
1078
1079class ofp_action_header:
1080 """Automatically generated Python class for ofp_action_header
1081
Rich Lane5b44ab42013-03-11 12:37:45 -07001082 Date 2013-03-11
Rich Lane6242d9f2013-01-06 17:35:39 -08001083 Created by of.pythonize.pythonizer
1084 Core structure: Messages do not include ofp_header
1085 Does not include var-length arrays
1086 """
1087 def __init__(self):
1088 """Initialize
1089 Declare members and default values
1090 """
1091 self.type = 0
1092 self.len = 0
1093 self.pad= [0,0,0,0]
1094
1095 def __assert(self):
1096 """Sanity check
1097 """
1098 if(not isinstance(self.pad, list)):
1099 return (False, "self.pad is not list as expected.")
1100 if(len(self.pad) != 4):
1101 return (False, "self.pad is not of size 4 as expected.")
1102 return (True, None)
1103
1104 def pack(self, assertstruct=True):
1105 """Pack message
1106 Packs empty array used as placeholder
1107 """
1108 if(assertstruct):
1109 if(not self.__assert()[0]):
1110 return None
1111 packed = ""
1112 packed += struct.pack("!HH", self.type, self.len)
1113 packed += struct.pack("!BBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3])
1114 return packed
1115
1116 def unpack(self, binaryString):
1117 """Unpack message
1118 Do not unpack empty array used as placeholder
1119 since they can contain heterogeneous type
1120 """
1121 if (len(binaryString) < 8):
1122 return binaryString
1123 fmt = '!HH'
1124 start = 0
1125 end = start + struct.calcsize(fmt)
1126 (self.type, self.len) = struct.unpack(fmt, binaryString[start:end])
1127 fmt = '!BBBB'
1128 start = 4
1129 end = start + struct.calcsize(fmt)
1130 (self.pad[0], self.pad[1], self.pad[2], self.pad[3]) = struct.unpack(fmt, binaryString[start:end])
1131 return binaryString[8:]
1132
1133 def __len__(self):
1134 """Return length of message
1135 """
1136 l = 8
1137 return l
1138
1139 def __eq__(self, other):
1140 """Return True if self and other have same values
1141 """
1142 if type(self) != type(other): return False
1143 if self.type != other.type: return False
1144 if self.len != other.len: return False
1145 if self.pad != other.pad: return False
1146 return True
1147
1148 def __ne__(self, other): return not self.__eq__(other)
1149
1150 def show(self, prefix=''):
1151 """Generate string showing basic members of structure
1152 """
1153 outstr = ''
1154 outstr += prefix + 'type: ' + str(self.type) + '\n'
1155 outstr += prefix + 'len: ' + str(self.len) + '\n'
1156 return outstr
1157
1158
1159class ofp_port_mod:
1160 """Automatically generated Python class for ofp_port_mod
1161
Rich Lane5b44ab42013-03-11 12:37:45 -07001162 Date 2013-03-11
Rich Lane6242d9f2013-01-06 17:35:39 -08001163 Created by of.pythonize.pythonizer
1164 Core structure: Messages do not include ofp_header
1165 Does not include var-length arrays
1166 """
1167 def __init__(self):
1168 """Initialize
1169 Declare members and default values
1170 """
1171 self.port_no = 0
1172 self.hw_addr= [0,0,0,0,0,0]
1173 self.config = 0
1174 self.mask = 0
1175 self.advertise = 0
1176 self.pad= [0,0,0,0]
1177
1178 def __assert(self):
1179 """Sanity check
1180 """
1181 if(not isinstance(self.hw_addr, list)):
1182 return (False, "self.hw_addr is not list as expected.")
1183 if(len(self.hw_addr) != 6):
1184 return (False, "self.hw_addr is not of size 6 as expected.")
1185 if(not isinstance(self.pad, list)):
1186 return (False, "self.pad is not list as expected.")
1187 if(len(self.pad) != 4):
1188 return (False, "self.pad is not of size 4 as expected.")
1189 return (True, None)
1190
1191 def pack(self, assertstruct=True):
1192 """Pack message
1193 Packs empty array used as placeholder
1194 """
1195 if(assertstruct):
1196 if(not self.__assert()[0]):
1197 return None
1198 packed = ""
1199 packed += struct.pack("!H", self.port_no)
1200 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])
1201 packed += struct.pack("!LLL", self.config, self.mask, self.advertise)
1202 packed += struct.pack("!BBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3])
1203 return packed
1204
1205 def unpack(self, binaryString):
1206 """Unpack message
1207 Do not unpack empty array used as placeholder
1208 since they can contain heterogeneous type
1209 """
1210 if (len(binaryString) < 24):
1211 return binaryString
1212 fmt = '!H'
1213 start = 0
1214 end = start + struct.calcsize(fmt)
1215 (self.port_no,) = struct.unpack(fmt, binaryString[start:end])
1216 fmt = '!BBBBBB'
1217 start = 2
1218 end = start + struct.calcsize(fmt)
1219 (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])
1220 fmt = '!LLL'
1221 start = 8
1222 end = start + struct.calcsize(fmt)
1223 (self.config, self.mask, self.advertise) = struct.unpack(fmt, binaryString[start:end])
1224 fmt = '!BBBB'
1225 start = 20
1226 end = start + struct.calcsize(fmt)
1227 (self.pad[0], self.pad[1], self.pad[2], self.pad[3]) = struct.unpack(fmt, binaryString[start:end])
1228 return binaryString[24:]
1229
1230 def __len__(self):
1231 """Return length of message
1232 """
1233 l = 24
1234 return l
1235
1236 def __eq__(self, other):
1237 """Return True if self and other have same values
1238 """
1239 if type(self) != type(other): return False
1240 if self.port_no != other.port_no: return False
1241 if self.hw_addr != other.hw_addr: return False
1242 if self.config != other.config: return False
1243 if self.mask != other.mask: return False
1244 if self.advertise != other.advertise: return False
1245 if self.pad != other.pad: return False
1246 return True
1247
1248 def __ne__(self, other): return not self.__eq__(other)
1249
1250 def show(self, prefix=''):
1251 """Generate string showing basic members of structure
1252 """
1253 outstr = ''
1254 outstr += prefix + 'port_no: ' + str(self.port_no) + '\n'
1255 outstr += prefix + 'hw_addr: ' + str(self.hw_addr) + '\n'
1256 outstr += prefix + 'config: ' + str(self.config) + '\n'
1257 outstr += prefix + 'mask: ' + str(self.mask) + '\n'
1258 outstr += prefix + 'advertise: ' + str(self.advertise) + '\n'
1259 return outstr
1260
1261
1262class ofp_action_vlan_vid:
1263 """Automatically generated Python class for ofp_action_vlan_vid
1264
Rich Lane5b44ab42013-03-11 12:37:45 -07001265 Date 2013-03-11
Rich Lane6242d9f2013-01-06 17:35:39 -08001266 Created by of.pythonize.pythonizer
1267 Core structure: Messages do not include ofp_header
1268 Does not include var-length arrays
1269 """
1270 def __init__(self):
1271 """Initialize
1272 Declare members and default values
1273 """
1274 self.type = 0
1275 self.len = 0
1276 self.vlan_vid = 0
1277 self.pad= [0,0]
1278
1279 def __assert(self):
1280 """Sanity check
1281 """
1282 if(not isinstance(self.pad, list)):
1283 return (False, "self.pad is not list as expected.")
1284 if(len(self.pad) != 2):
1285 return (False, "self.pad is not of size 2 as expected.")
1286 return (True, None)
1287
1288 def pack(self, assertstruct=True):
1289 """Pack message
1290 Packs empty array used as placeholder
1291 """
1292 if(assertstruct):
1293 if(not self.__assert()[0]):
1294 return None
1295 packed = ""
1296 packed += struct.pack("!HHH", self.type, self.len, self.vlan_vid)
1297 packed += struct.pack("!BB", self.pad[0], self.pad[1])
1298 return packed
1299
1300 def unpack(self, binaryString):
1301 """Unpack message
1302 Do not unpack empty array used as placeholder
1303 since they can contain heterogeneous type
1304 """
1305 if (len(binaryString) < 8):
1306 return binaryString
1307 fmt = '!HHH'
1308 start = 0
1309 end = start + struct.calcsize(fmt)
1310 (self.type, self.len, self.vlan_vid) = struct.unpack(fmt, binaryString[start:end])
1311 fmt = '!BB'
1312 start = 6
1313 end = start + struct.calcsize(fmt)
1314 (self.pad[0], self.pad[1]) = struct.unpack(fmt, binaryString[start:end])
1315 return binaryString[8:]
1316
1317 def __len__(self):
1318 """Return length of message
1319 """
1320 l = 8
1321 return l
1322
1323 def __eq__(self, other):
1324 """Return True if self and other have same values
1325 """
1326 if type(self) != type(other): return False
1327 if self.type != other.type: return False
1328 if self.len != other.len: return False
1329 if self.vlan_vid != other.vlan_vid: return False
1330 if self.pad != other.pad: return False
1331 return True
1332
1333 def __ne__(self, other): return not self.__eq__(other)
1334
1335 def show(self, prefix=''):
1336 """Generate string showing basic members of structure
1337 """
1338 outstr = ''
1339 outstr += prefix + 'type: ' + str(self.type) + '\n'
1340 outstr += prefix + 'len: ' + str(self.len) + '\n'
1341 outstr += prefix + 'vlan_vid: ' + str(self.vlan_vid) + '\n'
1342 return outstr
1343
1344
1345class ofp_action_output:
1346 """Automatically generated Python class for ofp_action_output
1347
Rich Lane5b44ab42013-03-11 12:37:45 -07001348 Date 2013-03-11
Rich Lane6242d9f2013-01-06 17:35:39 -08001349 Created by of.pythonize.pythonizer
1350 Core structure: Messages do not include ofp_header
1351 Does not include var-length arrays
1352 """
1353 def __init__(self):
1354 """Initialize
1355 Declare members and default values
1356 """
1357 self.type = 0
1358 self.len = 0
1359 self.port = 0
1360 self.max_len = 0
1361
1362 def __assert(self):
1363 """Sanity check
1364 """
1365 return (True, None)
1366
1367 def pack(self, assertstruct=True):
1368 """Pack message
1369 Packs empty array used as placeholder
1370 """
1371 if(assertstruct):
1372 if(not self.__assert()[0]):
1373 return None
1374 packed = ""
1375 packed += struct.pack("!HHHH", self.type, self.len, self.port, self.max_len)
1376 return packed
1377
1378 def unpack(self, binaryString):
1379 """Unpack message
1380 Do not unpack empty array used as placeholder
1381 since they can contain heterogeneous type
1382 """
1383 if (len(binaryString) < 8):
1384 return binaryString
1385 fmt = '!HHHH'
1386 start = 0
1387 end = start + struct.calcsize(fmt)
1388 (self.type, self.len, self.port, self.max_len) = struct.unpack(fmt, binaryString[start:end])
1389 return binaryString[8:]
1390
1391 def __len__(self):
1392 """Return length of message
1393 """
1394 l = 8
1395 return l
1396
1397 def __eq__(self, other):
1398 """Return True if self and other have same values
1399 """
1400 if type(self) != type(other): return False
1401 if self.type != other.type: return False
1402 if self.len != other.len: return False
1403 if self.port != other.port: return False
1404 if self.max_len != other.max_len: return False
1405 return True
1406
1407 def __ne__(self, other): return not self.__eq__(other)
1408
1409 def show(self, prefix=''):
1410 """Generate string showing basic members of structure
1411 """
1412 outstr = ''
1413 outstr += prefix + 'type: ' + str(self.type) + '\n'
1414 outstr += prefix + 'len: ' + str(self.len) + '\n'
1415 outstr += prefix + 'port: ' + str(self.port) + '\n'
1416 outstr += prefix + 'max_len: ' + str(self.max_len) + '\n'
1417 return outstr
1418
1419
1420class ofp_switch_config:
1421 """Automatically generated Python class for ofp_switch_config
1422
Rich Lane5b44ab42013-03-11 12:37:45 -07001423 Date 2013-03-11
Rich Lane6242d9f2013-01-06 17:35:39 -08001424 Created by of.pythonize.pythonizer
1425 Core structure: Messages do not include ofp_header
1426 Does not include var-length arrays
1427 """
1428 def __init__(self):
1429 """Initialize
1430 Declare members and default values
1431 """
1432 self.flags = 0
1433 self.miss_send_len = 128
1434
1435 def __assert(self):
1436 """Sanity check
1437 """
1438 return (True, None)
1439
1440 def pack(self, assertstruct=True):
1441 """Pack message
1442 Packs empty array used as placeholder
1443 """
1444 if(assertstruct):
1445 if(not self.__assert()[0]):
1446 return None
1447 packed = ""
1448 packed += struct.pack("!HH", self.flags, self.miss_send_len)
1449 return packed
1450
1451 def unpack(self, binaryString):
1452 """Unpack message
1453 Do not unpack empty array used as placeholder
1454 since they can contain heterogeneous type
1455 """
1456 if (len(binaryString) < 4):
1457 return binaryString
1458 fmt = '!HH'
1459 start = 0
1460 end = start + struct.calcsize(fmt)
1461 (self.flags, self.miss_send_len) = struct.unpack(fmt, binaryString[start:end])
1462 return binaryString[4:]
1463
1464 def __len__(self):
1465 """Return length of message
1466 """
1467 l = 4
1468 return l
1469
1470 def __eq__(self, other):
1471 """Return True if self and other have same values
1472 """
1473 if type(self) != type(other): return False
1474 if self.flags != other.flags: return False
1475 if self.miss_send_len != other.miss_send_len: return False
1476 return True
1477
1478 def __ne__(self, other): return not self.__eq__(other)
1479
1480 def show(self, prefix=''):
1481 """Generate string showing basic members of structure
1482 """
1483 outstr = ''
1484 outstr += prefix + 'flags: ' + str(self.flags) + '\n'
1485 outstr += prefix + 'miss_send_len: ' + str(self.miss_send_len) + '\n'
1486 return outstr
1487
1488
1489class ofp_action_nw_tos:
1490 """Automatically generated Python class for ofp_action_nw_tos
1491
Rich Lane5b44ab42013-03-11 12:37:45 -07001492 Date 2013-03-11
Rich Lane6242d9f2013-01-06 17:35:39 -08001493 Created by of.pythonize.pythonizer
1494 Core structure: Messages do not include ofp_header
1495 Does not include var-length arrays
1496 """
1497 def __init__(self):
1498 """Initialize
1499 Declare members and default values
1500 """
1501 self.type = 0
1502 self.len = 0
1503 self.nw_tos = 0
1504 self.pad= [0,0,0]
1505
1506 def __assert(self):
1507 """Sanity check
1508 """
1509 if(not isinstance(self.pad, list)):
1510 return (False, "self.pad is not list as expected.")
1511 if(len(self.pad) != 3):
1512 return (False, "self.pad is not of size 3 as expected.")
1513 return (True, None)
1514
1515 def pack(self, assertstruct=True):
1516 """Pack message
1517 Packs empty array used as placeholder
1518 """
1519 if(assertstruct):
1520 if(not self.__assert()[0]):
1521 return None
1522 packed = ""
1523 packed += struct.pack("!HHB", self.type, self.len, self.nw_tos)
1524 packed += struct.pack("!BBB", self.pad[0], self.pad[1], self.pad[2])
1525 return packed
1526
1527 def unpack(self, binaryString):
1528 """Unpack message
1529 Do not unpack empty array used as placeholder
1530 since they can contain heterogeneous type
1531 """
1532 if (len(binaryString) < 8):
1533 return binaryString
1534 fmt = '!HHB'
1535 start = 0
1536 end = start + struct.calcsize(fmt)
1537 (self.type, self.len, self.nw_tos) = struct.unpack(fmt, binaryString[start:end])
1538 fmt = '!BBB'
1539 start = 5
1540 end = start + struct.calcsize(fmt)
1541 (self.pad[0], self.pad[1], self.pad[2]) = struct.unpack(fmt, binaryString[start:end])
1542 return binaryString[8:]
1543
1544 def __len__(self):
1545 """Return length of message
1546 """
1547 l = 8
1548 return l
1549
1550 def __eq__(self, other):
1551 """Return True if self and other have same values
1552 """
1553 if type(self) != type(other): return False
1554 if self.type != other.type: return False
1555 if self.len != other.len: return False
1556 if self.nw_tos != other.nw_tos: return False
1557 if self.pad != other.pad: return False
1558 return True
1559
1560 def __ne__(self, other): return not self.__eq__(other)
1561
1562 def show(self, prefix=''):
1563 """Generate string showing basic members of structure
1564 """
1565 outstr = ''
1566 outstr += prefix + 'type: ' + str(self.type) + '\n'
1567 outstr += prefix + 'len: ' + str(self.len) + '\n'
1568 outstr += prefix + 'nw_tos: ' + str(self.nw_tos) + '\n'
1569 return outstr
1570
1571
1572class ofp_queue_get_config_reply:
1573 """Automatically generated Python class for ofp_queue_get_config_reply
1574
Rich Lane5b44ab42013-03-11 12:37:45 -07001575 Date 2013-03-11
Rich Lane6242d9f2013-01-06 17:35:39 -08001576 Created by of.pythonize.pythonizer
1577 Core structure: Messages do not include ofp_header
1578 Does not include var-length arrays
1579 """
1580 def __init__(self):
1581 """Initialize
1582 Declare members and default values
1583 """
1584 self.port = 0
1585 self.pad= [0,0,0,0,0,0]
1586
1587 def __assert(self):
1588 """Sanity check
1589 """
1590 if(not isinstance(self.pad, list)):
1591 return (False, "self.pad is not list as expected.")
1592 if(len(self.pad) != 6):
1593 return (False, "self.pad is not of size 6 as expected.")
1594 return (True, None)
1595
1596 def pack(self, assertstruct=True):
1597 """Pack message
1598 Packs empty array used as placeholder
1599 """
1600 if(assertstruct):
1601 if(not self.__assert()[0]):
1602 return None
1603 packed = ""
1604 packed += struct.pack("!H", self.port)
1605 packed += struct.pack("!BBBBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3], self.pad[4], self.pad[5])
1606 return packed
1607
1608 def unpack(self, binaryString):
1609 """Unpack message
1610 Do not unpack empty array used as placeholder
1611 since they can contain heterogeneous type
1612 """
1613 if (len(binaryString) < 8):
1614 return binaryString
1615 fmt = '!H'
1616 start = 0
1617 end = start + struct.calcsize(fmt)
1618 (self.port,) = struct.unpack(fmt, binaryString[start:end])
1619 fmt = '!BBBBBB'
1620 start = 2
1621 end = start + struct.calcsize(fmt)
1622 (self.pad[0], self.pad[1], self.pad[2], self.pad[3], self.pad[4], self.pad[5]) = struct.unpack(fmt, binaryString[start:end])
1623 return binaryString[8:]
1624
1625 def __len__(self):
1626 """Return length of message
1627 """
1628 l = 8
1629 return l
1630
1631 def __eq__(self, other):
1632 """Return True if self and other have same values
1633 """
1634 if type(self) != type(other): return False
1635 if self.port != other.port: return False
1636 if self.pad != other.pad: return False
1637 return True
1638
1639 def __ne__(self, other): return not self.__eq__(other)
1640
1641 def show(self, prefix=''):
1642 """Generate string showing basic members of structure
1643 """
1644 outstr = ''
1645 outstr += prefix + 'port: ' + str(self.port) + '\n'
1646 return outstr
1647
1648
1649class ofp_packet_in:
1650 """Automatically generated Python class for ofp_packet_in
1651
Rich Lane5b44ab42013-03-11 12:37:45 -07001652 Date 2013-03-11
Rich Lane6242d9f2013-01-06 17:35:39 -08001653 Created by of.pythonize.pythonizer
1654 Core structure: Messages do not include ofp_header
1655 Does not include var-length arrays
1656 """
1657 def __init__(self):
1658 """Initialize
1659 Declare members and default values
1660 """
1661 self.buffer_id = 0
1662 self.total_len = 0
1663 self.in_port = 0
1664 self.reason = 0
1665 self.pad = 0
1666
1667 def __assert(self):
1668 """Sanity check
1669 """
1670 return (True, None)
1671
1672 def pack(self, assertstruct=True):
1673 """Pack message
1674 Packs empty array used as placeholder
1675 """
1676 if(assertstruct):
1677 if(not self.__assert()[0]):
1678 return None
1679 packed = ""
1680 packed += struct.pack("!LHHBB", self.buffer_id, self.total_len, self.in_port, self.reason, self.pad)
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) < 10):
1689 return binaryString
1690 fmt = '!LHHBB'
1691 start = 0
1692 end = start + struct.calcsize(fmt)
1693 (self.buffer_id, self.total_len, self.in_port, self.reason, self.pad) = struct.unpack(fmt, binaryString[start:end])
1694 return binaryString[10:]
1695
1696 def __len__(self):
1697 """Return length of message
1698 """
1699 l = 10
1700 return l
1701
1702 def __eq__(self, other):
1703 """Return True if self and other have same values
1704 """
1705 if type(self) != type(other): return False
1706 if self.buffer_id != other.buffer_id: return False
1707 if self.total_len != other.total_len: return False
1708 if self.in_port != other.in_port: return False
1709 if self.reason != other.reason: return False
1710 if self.pad != other.pad: return False
1711 return True
1712
1713 def __ne__(self, other): return not self.__eq__(other)
1714
1715 def show(self, prefix=''):
1716 """Generate string showing basic members of structure
1717 """
1718 outstr = ''
1719 outstr += prefix + 'buffer_id: ' + str(self.buffer_id) + '\n'
1720 outstr += prefix + 'total_len: ' + str(self.total_len) + '\n'
1721 outstr += prefix + 'in_port: ' + str(self.in_port) + '\n'
1722 outstr += prefix + 'reason: ' + str(self.reason) + '\n'
1723 return outstr
1724
1725
1726class ofp_flow_stats:
1727 """Automatically generated Python class for ofp_flow_stats
1728
Rich Lane5b44ab42013-03-11 12:37:45 -07001729 Date 2013-03-11
Rich Lane6242d9f2013-01-06 17:35:39 -08001730 Created by of.pythonize.pythonizer
1731 Core structure: Messages do not include ofp_header
1732 Does not include var-length arrays
1733 """
1734 def __init__(self):
1735 """Initialize
1736 Declare members and default values
1737 """
1738 self.length = 0
1739 self.table_id = 0
1740 self.pad = 0
1741 self.match = ofp_match()
1742 self.duration_sec = 0
1743 self.duration_nsec = 0
1744 self.priority = 0x8000
1745 self.idle_timeout = 0
1746 self.hard_timeout = 0
1747 self.pad2= [0,0,0,0,0,0]
1748 self.cookie = 0
1749 self.packet_count = 0
1750 self.byte_count = 0
1751
1752 def __assert(self):
1753 """Sanity check
1754 """
1755 if(not isinstance(self.match, ofp_match)):
1756 return (False, "self.match is not class ofp_match as expected.")
1757 if(not isinstance(self.pad2, list)):
1758 return (False, "self.pad2 is not list as expected.")
1759 if(len(self.pad2) != 6):
1760 return (False, "self.pad2 is not of size 6 as expected.")
1761 return (True, None)
1762
1763 def pack(self, assertstruct=True):
1764 """Pack message
1765 Packs empty array used as placeholder
1766 """
1767 if(assertstruct):
1768 if(not self.__assert()[0]):
1769 return None
1770 packed = ""
1771 packed += struct.pack("!HBB", self.length, self.table_id, self.pad)
1772 packed += self.match.pack()
1773 packed += struct.pack("!LLHHH", self.duration_sec, self.duration_nsec, self.priority, self.idle_timeout, self.hard_timeout)
1774 packed += struct.pack("!BBBBBB", self.pad2[0], self.pad2[1], self.pad2[2], self.pad2[3], self.pad2[4], self.pad2[5])
1775 packed += struct.pack("!QQQ", self.cookie, self.packet_count, self.byte_count)
1776 return packed
1777
1778 def unpack(self, binaryString):
1779 """Unpack message
1780 Do not unpack empty array used as placeholder
1781 since they can contain heterogeneous type
1782 """
1783 if (len(binaryString) < 88):
1784 return binaryString
1785 fmt = '!HBB'
1786 start = 0
1787 end = start + struct.calcsize(fmt)
1788 (self.length, self.table_id, self.pad) = struct.unpack(fmt, binaryString[start:end])
1789 self.match.unpack(binaryString[4:])
1790 fmt = '!LLHHH'
1791 start = 44
1792 end = start + struct.calcsize(fmt)
1793 (self.duration_sec, self.duration_nsec, self.priority, self.idle_timeout, self.hard_timeout) = struct.unpack(fmt, binaryString[start:end])
1794 fmt = '!BBBBBB'
1795 start = 58
1796 end = start + struct.calcsize(fmt)
1797 (self.pad2[0], self.pad2[1], self.pad2[2], self.pad2[3], self.pad2[4], self.pad2[5]) = struct.unpack(fmt, binaryString[start:end])
1798 fmt = '!QQQ'
1799 start = 64
1800 end = start + struct.calcsize(fmt)
1801 (self.cookie, self.packet_count, self.byte_count) = struct.unpack(fmt, binaryString[start:end])
1802 return binaryString[88:]
1803
1804 def __len__(self):
1805 """Return length of message
1806 """
1807 l = 88
1808 return l
1809
1810 def __eq__(self, other):
1811 """Return True if self and other have same values
1812 """
1813 if type(self) != type(other): return False
1814 if self.length != other.length: return False
1815 if self.table_id != other.table_id: return False
1816 if self.pad != other.pad: return False
1817 if self.match != other.match: return False
1818 if self.duration_sec != other.duration_sec: return False
1819 if self.duration_nsec != other.duration_nsec: return False
1820 if self.priority != other.priority: return False
1821 if self.idle_timeout != other.idle_timeout: return False
1822 if self.hard_timeout != other.hard_timeout: return False
1823 if self.pad2 != other.pad2: return False
1824 if self.cookie != other.cookie: return False
1825 if self.packet_count != other.packet_count: return False
1826 if self.byte_count != other.byte_count: return False
1827 return True
1828
1829 def __ne__(self, other): return not self.__eq__(other)
1830
1831 def show(self, prefix=''):
1832 """Generate string showing basic members of structure
1833 """
1834 outstr = ''
1835 outstr += prefix + 'length: ' + str(self.length) + '\n'
1836 outstr += prefix + 'table_id: ' + str(self.table_id) + '\n'
1837 outstr += prefix + 'match: \n'
1838 outstr += self.match.show(prefix + ' ')
1839 outstr += prefix + 'duration_sec: ' + str(self.duration_sec) + '\n'
1840 outstr += prefix + 'duration_nsec: ' + str(self.duration_nsec) + '\n'
1841 outstr += prefix + 'priority: ' + str(self.priority) + '\n'
1842 outstr += prefix + 'idle_timeout: ' + str(self.idle_timeout) + '\n'
1843 outstr += prefix + 'hard_timeout: ' + str(self.hard_timeout) + '\n'
1844 outstr += prefix + 'cookie: ' + str(self.cookie) + '\n'
1845 outstr += prefix + 'packet_count: ' + str(self.packet_count) + '\n'
1846 outstr += prefix + 'byte_count: ' + str(self.byte_count) + '\n'
1847 return outstr
1848
1849
1850class ofp_flow_stats_request:
1851 """Automatically generated Python class for ofp_flow_stats_request
1852
Rich Lane5b44ab42013-03-11 12:37:45 -07001853 Date 2013-03-11
Rich Lane6242d9f2013-01-06 17:35:39 -08001854 Created by of.pythonize.pythonizer
1855 Core structure: Messages do not include ofp_header
1856 Does not include var-length arrays
1857 """
1858 def __init__(self):
1859 """Initialize
1860 Declare members and default values
1861 """
1862 self.match = ofp_match()
1863 self.table_id = 0
1864 self.pad = 0
1865 self.out_port = 0
1866
1867 def __assert(self):
1868 """Sanity check
1869 """
1870 if(not isinstance(self.match, ofp_match)):
1871 return (False, "self.match is not class ofp_match as expected.")
1872 return (True, None)
1873
1874 def pack(self, assertstruct=True):
1875 """Pack message
1876 Packs empty array used as placeholder
1877 """
1878 if(assertstruct):
1879 if(not self.__assert()[0]):
1880 return None
1881 packed = ""
1882 packed += self.match.pack()
1883 packed += struct.pack("!BBH", self.table_id, self.pad, self.out_port)
1884 return packed
1885
1886 def unpack(self, binaryString):
1887 """Unpack message
1888 Do not unpack empty array used as placeholder
1889 since they can contain heterogeneous type
1890 """
1891 if (len(binaryString) < 44):
1892 return binaryString
1893 self.match.unpack(binaryString[0:])
1894 fmt = '!BBH'
1895 start = 40
1896 end = start + struct.calcsize(fmt)
1897 (self.table_id, self.pad, self.out_port) = struct.unpack(fmt, binaryString[start:end])
1898 return binaryString[44:]
1899
1900 def __len__(self):
1901 """Return length of message
1902 """
1903 l = 44
1904 return l
1905
1906 def __eq__(self, other):
1907 """Return True if self and other have same values
1908 """
1909 if type(self) != type(other): return False
1910 if self.match != other.match: return False
1911 if self.table_id != other.table_id: return False
1912 if self.pad != other.pad: return False
1913 if self.out_port != other.out_port: return False
1914 return True
1915
1916 def __ne__(self, other): return not self.__eq__(other)
1917
1918 def show(self, prefix=''):
1919 """Generate string showing basic members of structure
1920 """
1921 outstr = ''
1922 outstr += prefix + 'match: \n'
1923 outstr += self.match.show(prefix + ' ')
1924 outstr += prefix + 'table_id: ' + str(self.table_id) + '\n'
1925 outstr += prefix + 'out_port: ' + str(self.out_port) + '\n'
1926 return outstr
1927
1928
1929class ofp_action_vendor_header:
1930 """Automatically generated Python class for ofp_action_vendor_header
1931
Rich Lane5b44ab42013-03-11 12:37:45 -07001932 Date 2013-03-11
Rich Lane6242d9f2013-01-06 17:35:39 -08001933 Created by of.pythonize.pythonizer
1934 Core structure: Messages do not include ofp_header
1935 Does not include var-length arrays
1936 """
1937 def __init__(self):
1938 """Initialize
1939 Declare members and default values
1940 """
1941 self.type = 0
1942 self.len = 0
1943 self.vendor = 0
1944
1945 def __assert(self):
1946 """Sanity check
1947 """
1948 return (True, None)
1949
1950 def pack(self, assertstruct=True):
1951 """Pack message
1952 Packs empty array used as placeholder
1953 """
1954 if(assertstruct):
1955 if(not self.__assert()[0]):
1956 return None
1957 packed = ""
1958 packed += struct.pack("!HHL", self.type, self.len, self.vendor)
1959 return packed
1960
1961 def unpack(self, binaryString):
1962 """Unpack message
1963 Do not unpack empty array used as placeholder
1964 since they can contain heterogeneous type
1965 """
1966 if (len(binaryString) < 8):
1967 return binaryString
1968 fmt = '!HHL'
1969 start = 0
1970 end = start + struct.calcsize(fmt)
1971 (self.type, self.len, self.vendor) = struct.unpack(fmt, binaryString[start:end])
1972 return binaryString[8:]
1973
1974 def __len__(self):
1975 """Return length of message
1976 """
1977 l = 8
1978 return l
1979
1980 def __eq__(self, other):
1981 """Return True if self and other have same values
1982 """
1983 if type(self) != type(other): return False
1984 if self.type != other.type: return False
1985 if self.len != other.len: return False
1986 if self.vendor != other.vendor: return False
1987 return True
1988
1989 def __ne__(self, other): return not self.__eq__(other)
1990
1991 def show(self, prefix=''):
1992 """Generate string showing basic members of structure
1993 """
1994 outstr = ''
1995 outstr += prefix + 'type: ' + str(self.type) + '\n'
1996 outstr += prefix + 'len: ' + str(self.len) + '\n'
1997 outstr += prefix + 'vendor: ' + str(self.vendor) + '\n'
1998 return outstr
1999
2000
2001class ofp_stats_reply:
2002 """Automatically generated Python class for ofp_stats_reply
2003
Rich Lane5b44ab42013-03-11 12:37:45 -07002004 Date 2013-03-11
Rich Lane6242d9f2013-01-06 17:35:39 -08002005 Created by of.pythonize.pythonizer
2006 Core structure: Messages do not include ofp_header
2007 Does not include var-length arrays
2008 """
2009 def __init__(self):
2010 """Initialize
2011 Declare members and default values
2012 """
2013 self.type = 0
2014 self.flags = 0
2015
2016 def __assert(self):
2017 """Sanity check
2018 """
2019 return (True, None)
2020
2021 def pack(self, assertstruct=True):
2022 """Pack message
2023 Packs empty array used as placeholder
2024 """
2025 if(assertstruct):
2026 if(not self.__assert()[0]):
2027 return None
2028 packed = ""
2029 packed += struct.pack("!HH", self.type, self.flags)
2030 return packed
2031
2032 def unpack(self, binaryString):
2033 """Unpack message
2034 Do not unpack empty array used as placeholder
2035 since they can contain heterogeneous type
2036 """
2037 if (len(binaryString) < 4):
2038 return binaryString
2039 fmt = '!HH'
2040 start = 0
2041 end = start + struct.calcsize(fmt)
2042 (self.type, self.flags) = struct.unpack(fmt, binaryString[start:end])
2043 return binaryString[4:]
2044
2045 def __len__(self):
2046 """Return length of message
2047 """
2048 l = 4
2049 return l
2050
2051 def __eq__(self, other):
2052 """Return True if self and other have same values
2053 """
2054 if type(self) != type(other): return False
2055 if self.type != other.type: return False
2056 if self.flags != other.flags: return False
2057 return True
2058
2059 def __ne__(self, other): return not self.__eq__(other)
2060
2061 def show(self, prefix=''):
2062 """Generate string showing basic members of structure
2063 """
2064 outstr = ''
2065 outstr += prefix + 'type: ' + str(self.type) + '\n'
2066 outstr += prefix + 'flags: ' + str(self.flags) + '\n'
2067 return outstr
2068
2069
2070class ofp_queue_stats_request:
2071 """Automatically generated Python class for ofp_queue_stats_request
2072
Rich Lane5b44ab42013-03-11 12:37:45 -07002073 Date 2013-03-11
Rich Lane6242d9f2013-01-06 17:35:39 -08002074 Created by of.pythonize.pythonizer
2075 Core structure: Messages do not include ofp_header
2076 Does not include var-length arrays
2077 """
2078 def __init__(self):
2079 """Initialize
2080 Declare members and default values
2081 """
2082 self.port_no = 0
2083 self.pad= [0,0]
2084 self.queue_id = 0
2085
2086 def __assert(self):
2087 """Sanity check
2088 """
2089 if(not isinstance(self.pad, list)):
2090 return (False, "self.pad is not list as expected.")
2091 if(len(self.pad) != 2):
2092 return (False, "self.pad is not of size 2 as expected.")
2093 return (True, None)
2094
2095 def pack(self, assertstruct=True):
2096 """Pack message
2097 Packs empty array used as placeholder
2098 """
2099 if(assertstruct):
2100 if(not self.__assert()[0]):
2101 return None
2102 packed = ""
2103 packed += struct.pack("!H", self.port_no)
2104 packed += struct.pack("!BB", self.pad[0], self.pad[1])
2105 packed += struct.pack("!L", self.queue_id)
2106 return packed
2107
2108 def unpack(self, binaryString):
2109 """Unpack message
2110 Do not unpack empty array used as placeholder
2111 since they can contain heterogeneous type
2112 """
2113 if (len(binaryString) < 8):
2114 return binaryString
2115 fmt = '!H'
2116 start = 0
2117 end = start + struct.calcsize(fmt)
2118 (self.port_no,) = struct.unpack(fmt, binaryString[start:end])
2119 fmt = '!BB'
2120 start = 2
2121 end = start + struct.calcsize(fmt)
2122 (self.pad[0], self.pad[1]) = struct.unpack(fmt, binaryString[start:end])
2123 fmt = '!L'
2124 start = 4
2125 end = start + struct.calcsize(fmt)
2126 (self.queue_id,) = struct.unpack(fmt, binaryString[start:end])
2127 return binaryString[8:]
2128
2129 def __len__(self):
2130 """Return length of message
2131 """
2132 l = 8
2133 return l
2134
2135 def __eq__(self, other):
2136 """Return True if self and other have same values
2137 """
2138 if type(self) != type(other): return False
2139 if self.port_no != other.port_no: return False
2140 if self.pad != other.pad: return False
2141 if self.queue_id != other.queue_id: return False
2142 return True
2143
2144 def __ne__(self, other): return not self.__eq__(other)
2145
2146 def show(self, prefix=''):
2147 """Generate string showing basic members of structure
2148 """
2149 outstr = ''
2150 outstr += prefix + 'port_no: ' + str(self.port_no) + '\n'
2151 outstr += prefix + 'queue_id: ' + str(self.queue_id) + '\n'
2152 return outstr
2153
2154
2155class ofp_desc_stats:
2156 """Automatically generated Python class for ofp_desc_stats
2157
Rich Lane5b44ab42013-03-11 12:37:45 -07002158 Date 2013-03-11
Rich Lane6242d9f2013-01-06 17:35:39 -08002159 Created by of.pythonize.pythonizer
2160 Core structure: Messages do not include ofp_header
2161 Does not include var-length arrays
2162 """
2163 def __init__(self):
2164 """Initialize
2165 Declare members and default values
2166 """
2167 self.mfr_desc= ""
2168 self.hw_desc= ""
2169 self.sw_desc= ""
2170 self.serial_num= ""
2171 self.dp_desc= ""
2172
2173 def __assert(self):
2174 """Sanity check
2175 """
2176 if(not isinstance(self.mfr_desc, str)):
2177 return (False, "self.mfr_desc is not string as expected.")
2178 if(len(self.mfr_desc) > 256):
2179 return (False, "self.mfr_desc is not of size 256 as expected.")
2180 if(not isinstance(self.hw_desc, str)):
2181 return (False, "self.hw_desc is not string as expected.")
2182 if(len(self.hw_desc) > 256):
2183 return (False, "self.hw_desc is not of size 256 as expected.")
2184 if(not isinstance(self.sw_desc, str)):
2185 return (False, "self.sw_desc is not string as expected.")
2186 if(len(self.sw_desc) > 256):
2187 return (False, "self.sw_desc is not of size 256 as expected.")
2188 if(not isinstance(self.serial_num, str)):
2189 return (False, "self.serial_num is not string as expected.")
2190 if(len(self.serial_num) > 32):
2191 return (False, "self.serial_num is not of size 32 as expected.")
2192 if(not isinstance(self.dp_desc, str)):
2193 return (False, "self.dp_desc is not string as expected.")
2194 if(len(self.dp_desc) > 256):
2195 return (False, "self.dp_desc is not of size 256 as expected.")
2196 return (True, None)
2197
2198 def pack(self, assertstruct=True):
2199 """Pack message
2200 Packs empty array used as placeholder
2201 """
2202 if(assertstruct):
2203 if(not self.__assert()[0]):
2204 return None
2205 packed = ""
2206 packed += self.mfr_desc.ljust(256,'\0')
2207 packed += self.hw_desc.ljust(256,'\0')
2208 packed += self.sw_desc.ljust(256,'\0')
2209 packed += self.serial_num.ljust(32,'\0')
2210 packed += self.dp_desc.ljust(256,'\0')
2211 return packed
2212
2213 def unpack(self, binaryString):
2214 """Unpack message
2215 Do not unpack empty array used as placeholder
2216 since they can contain heterogeneous type
2217 """
2218 if (len(binaryString) < 1056):
2219 return binaryString
2220 self.mfr_desc = binaryString[0:256].replace("\0","")
2221 self.hw_desc = binaryString[256:512].replace("\0","")
2222 self.sw_desc = binaryString[512:768].replace("\0","")
2223 self.serial_num = binaryString[768:800].replace("\0","")
2224 self.dp_desc = binaryString[800:1056].replace("\0","")
2225 return binaryString[1056:]
2226
2227 def __len__(self):
2228 """Return length of message
2229 """
2230 l = 1056
2231 return l
2232
2233 def __eq__(self, other):
2234 """Return True if self and other have same values
2235 """
2236 if type(self) != type(other): return False
2237 if self.mfr_desc != other.mfr_desc: return False
2238 if self.hw_desc != other.hw_desc: return False
2239 if self.sw_desc != other.sw_desc: return False
2240 if self.serial_num != other.serial_num: return False
2241 if self.dp_desc != other.dp_desc: return False
2242 return True
2243
2244 def __ne__(self, other): return not self.__eq__(other)
2245
2246 def show(self, prefix=''):
2247 """Generate string showing basic members of structure
2248 """
2249 outstr = ''
2250 outstr += prefix + 'mfr_desc: ' + str(self.mfr_desc) + '\n'
2251 outstr += prefix + 'hw_desc: ' + str(self.hw_desc) + '\n'
2252 outstr += prefix + 'sw_desc: ' + str(self.sw_desc) + '\n'
2253 outstr += prefix + 'serial_num: ' + str(self.serial_num) + '\n'
2254 outstr += prefix + 'dp_desc: ' + str(self.dp_desc) + '\n'
2255 return outstr
2256
2257
2258class ofp_queue_get_config_request:
2259 """Automatically generated Python class for ofp_queue_get_config_request
2260
Rich Lane5b44ab42013-03-11 12:37:45 -07002261 Date 2013-03-11
Rich Lane6242d9f2013-01-06 17:35:39 -08002262 Created by of.pythonize.pythonizer
2263 Core structure: Messages do not include ofp_header
2264 Does not include var-length arrays
2265 """
2266 def __init__(self):
2267 """Initialize
2268 Declare members and default values
2269 """
2270 self.port = 0
2271 self.pad= [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) != 2):
2279 return (False, "self.pad is not of size 2 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("!H", self.port)
2291 packed += struct.pack("!BB", self.pad[0], self.pad[1])
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) < 4):
2300 return binaryString
2301 fmt = '!H'
2302 start = 0
2303 end = start + struct.calcsize(fmt)
2304 (self.port,) = struct.unpack(fmt, binaryString[start:end])
2305 fmt = '!BB'
2306 start = 2
2307 end = start + struct.calcsize(fmt)
2308 (self.pad[0], self.pad[1]) = struct.unpack(fmt, binaryString[start:end])
2309 return binaryString[4:]
2310
2311 def __len__(self):
2312 """Return length of message
2313 """
2314 l = 4
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.port != other.port: return False
2322 if self.pad != other.pad: return False
2323 return True
2324
2325 def __ne__(self, other): return not self.__eq__(other)
2326
2327 def show(self, prefix=''):
2328 """Generate string showing basic members of structure
2329 """
2330 outstr = ''
2331 outstr += prefix + 'port: ' + str(self.port) + '\n'
2332 return outstr
2333
2334
2335class ofp_packet_queue:
2336 """Automatically generated Python class for ofp_packet_queue
2337
Rich Lane5b44ab42013-03-11 12:37:45 -07002338 Date 2013-03-11
Rich Lane6242d9f2013-01-06 17:35:39 -08002339 Created by of.pythonize.pythonizer
2340 Core structure: Messages do not include ofp_header
2341 Does not include var-length arrays
2342 """
2343 def __init__(self):
2344 """Initialize
2345 Declare members and default values
2346 """
2347 self.queue_id = 0
2348 self.len = 0
2349 self.pad= [0,0]
2350
2351 def __assert(self):
2352 """Sanity check
2353 """
2354 if(not isinstance(self.pad, list)):
2355 return (False, "self.pad is not list as expected.")
2356 if(len(self.pad) != 2):
2357 return (False, "self.pad is not of size 2 as expected.")
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("!LH", self.queue_id, self.len)
2369 packed += struct.pack("!BB", self.pad[0], self.pad[1])
2370 return packed
2371
2372 def unpack(self, binaryString):
2373 """Unpack message
2374 Do not unpack empty array used as placeholder
2375 since they can contain heterogeneous type
2376 """
2377 if (len(binaryString) < 8):
2378 return binaryString
2379 fmt = '!LH'
2380 start = 0
2381 end = start + struct.calcsize(fmt)
2382 (self.queue_id, self.len) = struct.unpack(fmt, binaryString[start:end])
2383 fmt = '!BB'
2384 start = 6
2385 end = start + struct.calcsize(fmt)
2386 (self.pad[0], self.pad[1]) = struct.unpack(fmt, binaryString[start:end])
2387 return binaryString[8:]
2388
2389 def __len__(self):
2390 """Return length of message
2391 """
2392 l = 8
2393 return l
2394
2395 def __eq__(self, other):
2396 """Return True if self and other have same values
2397 """
2398 if type(self) != type(other): return False
2399 if self.queue_id != other.queue_id: return False
2400 if self.len != other.len: return False
2401 if self.pad != other.pad: return False
2402 return True
2403
2404 def __ne__(self, other): return not self.__eq__(other)
2405
2406 def show(self, prefix=''):
2407 """Generate string showing basic members of structure
2408 """
2409 outstr = ''
2410 outstr += prefix + 'queue_id: ' + str(self.queue_id) + '\n'
2411 outstr += prefix + 'len: ' + str(self.len) + '\n'
2412 return outstr
2413
2414
2415class ofp_action_dl_addr:
2416 """Automatically generated Python class for ofp_action_dl_addr
2417
Rich Lane5b44ab42013-03-11 12:37:45 -07002418 Date 2013-03-11
Rich Lane6242d9f2013-01-06 17:35:39 -08002419 Created by of.pythonize.pythonizer
2420 Core structure: Messages do not include ofp_header
2421 Does not include var-length arrays
2422 """
2423 def __init__(self):
2424 """Initialize
2425 Declare members and default values
2426 """
2427 self.type = 0
2428 self.len = 0
2429 self.dl_addr= [0,0,0,0,0,0]
2430 self.pad= [0,0,0,0,0,0]
2431
2432 def __assert(self):
2433 """Sanity check
2434 """
2435 if(not isinstance(self.dl_addr, list)):
2436 return (False, "self.dl_addr is not list as expected.")
2437 if(len(self.dl_addr) != 6):
2438 return (False, "self.dl_addr is not of size 6 as expected.")
2439 if(not isinstance(self.pad, list)):
2440 return (False, "self.pad is not list as expected.")
2441 if(len(self.pad) != 6):
2442 return (False, "self.pad is not of size 6 as expected.")
2443 return (True, None)
2444
2445 def pack(self, assertstruct=True):
2446 """Pack message
2447 Packs empty array used as placeholder
2448 """
2449 if(assertstruct):
2450 if(not self.__assert()[0]):
2451 return None
2452 packed = ""
2453 packed += struct.pack("!HH", self.type, self.len)
2454 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])
2455 packed += struct.pack("!BBBBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3], self.pad[4], self.pad[5])
2456 return packed
2457
2458 def unpack(self, binaryString):
2459 """Unpack message
2460 Do not unpack empty array used as placeholder
2461 since they can contain heterogeneous type
2462 """
2463 if (len(binaryString) < 16):
2464 return binaryString
2465 fmt = '!HH'
2466 start = 0
2467 end = start + struct.calcsize(fmt)
2468 (self.type, self.len) = struct.unpack(fmt, binaryString[start:end])
2469 fmt = '!BBBBBB'
2470 start = 4
2471 end = start + struct.calcsize(fmt)
2472 (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])
2473 fmt = '!BBBBBB'
2474 start = 10
2475 end = start + struct.calcsize(fmt)
2476 (self.pad[0], self.pad[1], self.pad[2], self.pad[3], self.pad[4], self.pad[5]) = struct.unpack(fmt, binaryString[start:end])
2477 return binaryString[16:]
2478
2479 def __len__(self):
2480 """Return length of message
2481 """
2482 l = 16
2483 return l
2484
2485 def __eq__(self, other):
2486 """Return True if self and other have same values
2487 """
2488 if type(self) != type(other): return False
2489 if self.type != other.type: return False
2490 if self.len != other.len: return False
2491 if self.dl_addr != other.dl_addr: return False
2492 if self.pad != other.pad: return False
2493 return True
2494
2495 def __ne__(self, other): return not self.__eq__(other)
2496
2497 def show(self, prefix=''):
2498 """Generate string showing basic members of structure
2499 """
2500 outstr = ''
2501 outstr += prefix + 'type: ' + str(self.type) + '\n'
2502 outstr += prefix + 'len: ' + str(self.len) + '\n'
2503 outstr += prefix + 'dl_addr: ' + str(self.dl_addr) + '\n'
2504 return outstr
2505
2506
2507class ofp_queue_prop_header:
2508 """Automatically generated Python class for ofp_queue_prop_header
2509
Rich Lane5b44ab42013-03-11 12:37:45 -07002510 Date 2013-03-11
Rich Lane6242d9f2013-01-06 17:35:39 -08002511 Created by of.pythonize.pythonizer
2512 Core structure: Messages do not include ofp_header
2513 Does not include var-length arrays
2514 """
2515 def __init__(self):
2516 """Initialize
2517 Declare members and default values
2518 """
2519 self.property = 0
2520 self.len = 0
2521 self.pad= [0,0,0,0]
2522
2523 def __assert(self):
2524 """Sanity check
2525 """
2526 if(not isinstance(self.pad, list)):
2527 return (False, "self.pad is not list as expected.")
2528 if(len(self.pad) != 4):
2529 return (False, "self.pad is not of size 4 as expected.")
2530 return (True, None)
2531
2532 def pack(self, assertstruct=True):
2533 """Pack message
2534 Packs empty array used as placeholder
2535 """
2536 if(assertstruct):
2537 if(not self.__assert()[0]):
2538 return None
2539 packed = ""
2540 packed += struct.pack("!HH", self.property, self.len)
2541 packed += struct.pack("!BBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3])
2542 return packed
2543
2544 def unpack(self, binaryString):
2545 """Unpack message
2546 Do not unpack empty array used as placeholder
2547 since they can contain heterogeneous type
2548 """
2549 if (len(binaryString) < 8):
2550 return binaryString
2551 fmt = '!HH'
2552 start = 0
2553 end = start + struct.calcsize(fmt)
2554 (self.property, self.len) = struct.unpack(fmt, binaryString[start:end])
2555 fmt = '!BBBB'
2556 start = 4
2557 end = start + struct.calcsize(fmt)
2558 (self.pad[0], self.pad[1], self.pad[2], self.pad[3]) = struct.unpack(fmt, binaryString[start:end])
2559 return binaryString[8:]
2560
2561 def __len__(self):
2562 """Return length of message
2563 """
2564 l = 8
2565 return l
2566
2567 def __eq__(self, other):
2568 """Return True if self and other have same values
2569 """
2570 if type(self) != type(other): return False
2571 if self.property != other.property: return False
2572 if self.len != other.len: return False
2573 if self.pad != other.pad: return False
2574 return True
2575
2576 def __ne__(self, other): return not self.__eq__(other)
2577
2578 def show(self, prefix=''):
2579 """Generate string showing basic members of structure
2580 """
2581 outstr = ''
2582 outstr += prefix + 'property: ' + str(self.property) + '\n'
2583 outstr += prefix + 'len: ' + str(self.len) + '\n'
2584 return outstr
2585
2586
2587class ofp_queue_prop_min_rate:
2588 """Automatically generated Python class for ofp_queue_prop_min_rate
2589
Rich Lane5b44ab42013-03-11 12:37:45 -07002590 Date 2013-03-11
Rich Lane6242d9f2013-01-06 17:35:39 -08002591 Created by of.pythonize.pythonizer
2592 Core structure: Messages do not include ofp_header
2593 Does not include var-length arrays
2594 """
2595 def __init__(self):
2596 """Initialize
2597 Declare members and default values
2598 """
2599 self.prop_header = ofp_queue_prop_header()
2600 self.rate = 0
2601 self.pad= [0,0,0,0,0,0]
2602
2603 def __assert(self):
2604 """Sanity check
2605 """
2606 if(not isinstance(self.prop_header, ofp_queue_prop_header)):
2607 return (False, "self.prop_header is not class ofp_queue_prop_header as expected.")
2608 if(not isinstance(self.pad, list)):
2609 return (False, "self.pad is not list as expected.")
2610 if(len(self.pad) != 6):
2611 return (False, "self.pad is not of size 6 as expected.")
2612 return (True, None)
2613
2614 def pack(self, assertstruct=True):
2615 """Pack message
2616 Packs empty array used as placeholder
2617 """
2618 if(assertstruct):
2619 if(not self.__assert()[0]):
2620 return None
2621 packed = ""
2622 packed += self.prop_header.pack()
2623 packed += struct.pack("!H", self.rate)
2624 packed += struct.pack("!BBBBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3], self.pad[4], self.pad[5])
2625 return packed
2626
2627 def unpack(self, binaryString):
2628 """Unpack message
2629 Do not unpack empty array used as placeholder
2630 since they can contain heterogeneous type
2631 """
2632 if (len(binaryString) < 16):
2633 return binaryString
2634 self.prop_header.unpack(binaryString[0:])
2635 fmt = '!H'
2636 start = 8
2637 end = start + struct.calcsize(fmt)
2638 (self.rate,) = struct.unpack(fmt, binaryString[start:end])
2639 fmt = '!BBBBBB'
2640 start = 10
2641 end = start + struct.calcsize(fmt)
2642 (self.pad[0], self.pad[1], self.pad[2], self.pad[3], self.pad[4], self.pad[5]) = struct.unpack(fmt, binaryString[start:end])
2643 return binaryString[16:]
2644
2645 def __len__(self):
2646 """Return length of message
2647 """
2648 l = 16
2649 return l
2650
2651 def __eq__(self, other):
2652 """Return True if self and other have same values
2653 """
2654 if type(self) != type(other): return False
2655 if self.prop_header != other.prop_header: return False
2656 if self.rate != other.rate: return False
2657 if self.pad != other.pad: return False
2658 return True
2659
2660 def __ne__(self, other): return not self.__eq__(other)
2661
2662 def show(self, prefix=''):
2663 """Generate string showing basic members of structure
2664 """
2665 outstr = ''
2666 outstr += prefix + 'prop_header: \n'
2667 outstr += self.prop_header.show(prefix + ' ')
2668 outstr += prefix + 'rate: ' + str(self.rate) + '\n'
2669 return outstr
2670
2671
2672class ofp_action_enqueue:
2673 """Automatically generated Python class for ofp_action_enqueue
2674
Rich Lane5b44ab42013-03-11 12:37:45 -07002675 Date 2013-03-11
Rich Lane6242d9f2013-01-06 17:35:39 -08002676 Created by of.pythonize.pythonizer
2677 Core structure: Messages do not include ofp_header
2678 Does not include var-length arrays
2679 """
2680 def __init__(self):
2681 """Initialize
2682 Declare members and default values
2683 """
2684 self.type = 0
2685 self.len = 0
2686 self.port = 0
2687 self.pad= [0,0,0,0,0,0]
2688 self.queue_id = 0
2689
2690 def __assert(self):
2691 """Sanity check
2692 """
2693 if(not isinstance(self.pad, list)):
2694 return (False, "self.pad is not list as expected.")
2695 if(len(self.pad) != 6):
2696 return (False, "self.pad is not of size 6 as expected.")
2697 return (True, None)
2698
2699 def pack(self, assertstruct=True):
2700 """Pack message
2701 Packs empty array used as placeholder
2702 """
2703 if(assertstruct):
2704 if(not self.__assert()[0]):
2705 return None
2706 packed = ""
2707 packed += struct.pack("!HHH", self.type, self.len, self.port)
2708 packed += struct.pack("!BBBBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3], self.pad[4], self.pad[5])
2709 packed += struct.pack("!L", self.queue_id)
2710 return packed
2711
2712 def unpack(self, binaryString):
2713 """Unpack message
2714 Do not unpack empty array used as placeholder
2715 since they can contain heterogeneous type
2716 """
2717 if (len(binaryString) < 16):
2718 return binaryString
2719 fmt = '!HHH'
2720 start = 0
2721 end = start + struct.calcsize(fmt)
2722 (self.type, self.len, self.port) = struct.unpack(fmt, binaryString[start:end])
2723 fmt = '!BBBBBB'
2724 start = 6
2725 end = start + struct.calcsize(fmt)
2726 (self.pad[0], self.pad[1], self.pad[2], self.pad[3], self.pad[4], self.pad[5]) = struct.unpack(fmt, binaryString[start:end])
2727 fmt = '!L'
2728 start = 12
2729 end = start + struct.calcsize(fmt)
2730 (self.queue_id,) = struct.unpack(fmt, binaryString[start:end])
2731 return binaryString[16:]
2732
2733 def __len__(self):
2734 """Return length of message
2735 """
2736 l = 16
2737 return l
2738
2739 def __eq__(self, other):
2740 """Return True if self and other have same values
2741 """
2742 if type(self) != type(other): return False
2743 if self.type != other.type: return False
2744 if self.len != other.len: return False
2745 if self.port != other.port: return False
2746 if self.pad != other.pad: return False
2747 if self.queue_id != other.queue_id: return False
2748 return True
2749
2750 def __ne__(self, other): return not self.__eq__(other)
2751
2752 def show(self, prefix=''):
2753 """Generate string showing basic members of structure
2754 """
2755 outstr = ''
2756 outstr += prefix + 'type: ' + str(self.type) + '\n'
2757 outstr += prefix + 'len: ' + str(self.len) + '\n'
2758 outstr += prefix + 'port: ' + str(self.port) + '\n'
2759 outstr += prefix + 'queue_id: ' + str(self.queue_id) + '\n'
2760 return outstr
2761
2762
2763class ofp_switch_features:
2764 """Automatically generated Python class for ofp_switch_features
2765
Rich Lane5b44ab42013-03-11 12:37:45 -07002766 Date 2013-03-11
Rich Lane6242d9f2013-01-06 17:35:39 -08002767 Created by of.pythonize.pythonizer
2768 Core structure: Messages do not include ofp_header
2769 Does not include var-length arrays
2770 """
2771 def __init__(self):
2772 """Initialize
2773 Declare members and default values
2774 """
2775 self.datapath_id = 0
2776 self.n_buffers = 0
2777 self.n_tables = 0
2778 self.pad= [0,0,0]
2779 self.capabilities = 0
2780 self.actions = 0
2781
2782 def __assert(self):
2783 """Sanity check
2784 """
2785 if(not isinstance(self.pad, list)):
2786 return (False, "self.pad is not list as expected.")
2787 if(len(self.pad) != 3):
2788 return (False, "self.pad is not of size 3 as expected.")
2789 return (True, None)
2790
2791 def pack(self, assertstruct=True):
2792 """Pack message
2793 Packs empty array used as placeholder
2794 """
2795 if(assertstruct):
2796 if(not self.__assert()[0]):
2797 return None
2798 packed = ""
2799 packed += struct.pack("!QLB", self.datapath_id, self.n_buffers, self.n_tables)
2800 packed += struct.pack("!BBB", self.pad[0], self.pad[1], self.pad[2])
2801 packed += struct.pack("!LL", self.capabilities, self.actions)
2802 return packed
2803
2804 def unpack(self, binaryString):
2805 """Unpack message
2806 Do not unpack empty array used as placeholder
2807 since they can contain heterogeneous type
2808 """
2809 if (len(binaryString) < 24):
2810 return binaryString
2811 fmt = '!QLB'
2812 start = 0
2813 end = start + struct.calcsize(fmt)
2814 (self.datapath_id, self.n_buffers, self.n_tables) = struct.unpack(fmt, binaryString[start:end])
2815 fmt = '!BBB'
2816 start = 13
2817 end = start + struct.calcsize(fmt)
2818 (self.pad[0], self.pad[1], self.pad[2]) = struct.unpack(fmt, binaryString[start:end])
2819 fmt = '!LL'
2820 start = 16
2821 end = start + struct.calcsize(fmt)
2822 (self.capabilities, self.actions) = struct.unpack(fmt, binaryString[start:end])
2823 return binaryString[24:]
2824
2825 def __len__(self):
2826 """Return length of message
2827 """
2828 l = 24
2829 return l
2830
2831 def __eq__(self, other):
2832 """Return True if self and other have same values
2833 """
2834 if type(self) != type(other): return False
2835 if self.datapath_id != other.datapath_id: return False
2836 if self.n_buffers != other.n_buffers: return False
2837 if self.n_tables != other.n_tables: return False
2838 if self.pad != other.pad: return False
2839 if self.capabilities != other.capabilities: return False
2840 if self.actions != other.actions: return False
2841 return True
2842
2843 def __ne__(self, other): return not self.__eq__(other)
2844
2845 def show(self, prefix=''):
2846 """Generate string showing basic members of structure
2847 """
2848 outstr = ''
2849 outstr += prefix + 'datapath_id: ' + str(self.datapath_id) + '\n'
2850 outstr += prefix + 'n_buffers: ' + str(self.n_buffers) + '\n'
2851 outstr += prefix + 'n_tables: ' + str(self.n_tables) + '\n'
2852 outstr += prefix + 'capabilities: ' + str(self.capabilities) + '\n'
2853 outstr += prefix + 'actions: ' + str(self.actions) + '\n'
2854 return outstr
2855
2856
2857class ofp_match:
2858 """Automatically generated Python class for ofp_match
2859
Rich Lane5b44ab42013-03-11 12:37:45 -07002860 Date 2013-03-11
Rich Lane6242d9f2013-01-06 17:35:39 -08002861 Created by of.pythonize.pythonizer
2862 Core structure: Messages do not include ofp_header
2863 Does not include var-length arrays
2864 """
2865 def __init__(self):
2866 """Initialize
2867 Declare members and default values
2868 """
2869 self.wildcards = 0
2870 self.in_port = 0
Rich Lane5b44ab42013-03-11 12:37:45 -07002871 self.eth_src= [0,0,0,0,0,0]
2872 self.eth_dst= [0,0,0,0,0,0]
2873 self.vlan_vid = 0
2874 self.vlan_pcp = 0
Rich Lane6242d9f2013-01-06 17:35:39 -08002875 self.pad1 = 0
Rich Lane5b44ab42013-03-11 12:37:45 -07002876 self.eth_type = 0
2877 self.ip_dscp = 0
2878 self.ip_proto = 0
Rich Lane6242d9f2013-01-06 17:35:39 -08002879 self.pad2= [0,0]
Rich Lane5b44ab42013-03-11 12:37:45 -07002880 self.ipv4_src = 0
2881 self.ipv4_dst = 0
2882 self.tcp_src = 0
2883 self.tcp_dst = 0
Rich Lane6242d9f2013-01-06 17:35:39 -08002884
2885 def __assert(self):
2886 """Sanity check
2887 """
Rich Lane5b44ab42013-03-11 12:37:45 -07002888 if(not isinstance(self.eth_src, list)):
2889 return (False, "self.eth_src is not list as expected.")
2890 if(len(self.eth_src) != 6):
2891 return (False, "self.eth_src is not of size 6 as expected.")
2892 if(not isinstance(self.eth_dst, list)):
2893 return (False, "self.eth_dst is not list as expected.")
2894 if(len(self.eth_dst) != 6):
2895 return (False, "self.eth_dst is not of size 6 as expected.")
Rich Lane6242d9f2013-01-06 17:35:39 -08002896 if(not isinstance(self.pad2, list)):
2897 return (False, "self.pad2 is not list as expected.")
2898 if(len(self.pad2) != 2):
2899 return (False, "self.pad2 is not of size 2 as expected.")
2900 return (True, None)
2901
2902 def pack(self, assertstruct=True):
2903 """Pack message
2904 Packs empty array used as placeholder
2905 """
2906 if(assertstruct):
2907 if(not self.__assert()[0]):
2908 return None
2909 packed = ""
2910 packed += struct.pack("!LH", self.wildcards, self.in_port)
Rich Lane5b44ab42013-03-11 12:37:45 -07002911 packed += struct.pack("!BBBBBB", self.eth_src[0], self.eth_src[1], self.eth_src[2], self.eth_src[3], self.eth_src[4], self.eth_src[5])
2912 packed += struct.pack("!BBBBBB", self.eth_dst[0], self.eth_dst[1], self.eth_dst[2], self.eth_dst[3], self.eth_dst[4], self.eth_dst[5])
2913 packed += struct.pack("!HBBHBB", self.vlan_vid, self.vlan_pcp, self.pad1, self.eth_type, self.ip_dscp, self.ip_proto)
Rich Lane6242d9f2013-01-06 17:35:39 -08002914 packed += struct.pack("!BB", self.pad2[0], self.pad2[1])
Rich Lane5b44ab42013-03-11 12:37:45 -07002915 packed += struct.pack("!LLHH", self.ipv4_src, self.ipv4_dst, self.tcp_src, self.tcp_dst)
Rich Lane6242d9f2013-01-06 17:35:39 -08002916 return packed
2917
2918 def unpack(self, binaryString):
2919 """Unpack message
2920 Do not unpack empty array used as placeholder
2921 since they can contain heterogeneous type
2922 """
2923 if (len(binaryString) < 40):
2924 return binaryString
2925 fmt = '!LH'
2926 start = 0
2927 end = start + struct.calcsize(fmt)
2928 (self.wildcards, self.in_port) = struct.unpack(fmt, binaryString[start:end])
2929 fmt = '!BBBBBB'
2930 start = 6
2931 end = start + struct.calcsize(fmt)
Rich Lane5b44ab42013-03-11 12:37:45 -07002932 (self.eth_src[0], self.eth_src[1], self.eth_src[2], self.eth_src[3], self.eth_src[4], self.eth_src[5]) = struct.unpack(fmt, binaryString[start:end])
Rich Lane6242d9f2013-01-06 17:35:39 -08002933 fmt = '!BBBBBB'
2934 start = 12
2935 end = start + struct.calcsize(fmt)
Rich Lane5b44ab42013-03-11 12:37:45 -07002936 (self.eth_dst[0], self.eth_dst[1], self.eth_dst[2], self.eth_dst[3], self.eth_dst[4], self.eth_dst[5]) = struct.unpack(fmt, binaryString[start:end])
Rich Lane6242d9f2013-01-06 17:35:39 -08002937 fmt = '!HBBHBB'
2938 start = 18
2939 end = start + struct.calcsize(fmt)
Rich Lane5b44ab42013-03-11 12:37:45 -07002940 (self.vlan_vid, self.vlan_pcp, self.pad1, self.eth_type, self.ip_dscp, self.ip_proto) = struct.unpack(fmt, binaryString[start:end])
Rich Lane6242d9f2013-01-06 17:35:39 -08002941 fmt = '!BB'
2942 start = 26
2943 end = start + struct.calcsize(fmt)
2944 (self.pad2[0], self.pad2[1]) = struct.unpack(fmt, binaryString[start:end])
2945 fmt = '!LLHH'
2946 start = 28
2947 end = start + struct.calcsize(fmt)
Rich Lane5b44ab42013-03-11 12:37:45 -07002948 (self.ipv4_src, self.ipv4_dst, self.tcp_src, self.tcp_dst) = struct.unpack(fmt, binaryString[start:end])
Rich Lane6242d9f2013-01-06 17:35:39 -08002949 return binaryString[40:]
2950
2951 def __len__(self):
2952 """Return length of message
2953 """
2954 l = 40
2955 return l
2956
2957 def __eq__(self, other):
2958 """Return True if self and other have same values
2959 """
2960 if type(self) != type(other): return False
2961 if self.wildcards != other.wildcards: return False
2962 if self.in_port != other.in_port: return False
Rich Lane5b44ab42013-03-11 12:37:45 -07002963 if self.eth_src != other.eth_src: return False
2964 if self.eth_dst != other.eth_dst: return False
2965 if self.vlan_vid != other.vlan_vid: return False
2966 if self.vlan_pcp != other.vlan_pcp: return False
Rich Lane6242d9f2013-01-06 17:35:39 -08002967 if self.pad1 != other.pad1: return False
Rich Lane5b44ab42013-03-11 12:37:45 -07002968 if self.eth_type != other.eth_type: return False
2969 if self.ip_dscp != other.ip_dscp: return False
2970 if self.ip_proto != other.ip_proto: return False
Rich Lane6242d9f2013-01-06 17:35:39 -08002971 if self.pad2 != other.pad2: return False
Rich Lane5b44ab42013-03-11 12:37:45 -07002972 if self.ipv4_src != other.ipv4_src: return False
2973 if self.ipv4_dst != other.ipv4_dst: return False
2974 if self.tcp_src != other.tcp_src: return False
2975 if self.tcp_dst != other.tcp_dst: return False
Rich Lane6242d9f2013-01-06 17:35:39 -08002976 return True
2977
2978 def __ne__(self, other): return not self.__eq__(other)
2979
2980 def show(self, prefix=''):
2981 """Generate string showing basic members of structure
2982 """
2983 outstr = ''
2984 outstr += prefix + 'wildcards: ' + str(self.wildcards) + '\n'
2985 outstr += prefix + 'in_port: ' + str(self.in_port) + '\n'
Rich Lane5b44ab42013-03-11 12:37:45 -07002986 outstr += prefix + 'eth_src: ' + str(self.eth_src) + '\n'
2987 outstr += prefix + 'eth_dst: ' + str(self.eth_dst) + '\n'
2988 outstr += prefix + 'vlan_vid: ' + str(self.vlan_vid) + '\n'
2989 outstr += prefix + 'vlan_pcp: ' + str(self.vlan_pcp) + '\n'
2990 outstr += prefix + 'eth_type: ' + str(self.eth_type) + '\n'
2991 outstr += prefix + 'ip_dscp: ' + str(self.ip_dscp) + '\n'
2992 outstr += prefix + 'ip_proto: ' + str(self.ip_proto) + '\n'
2993 outstr += prefix + 'ipv4_src: ' + str(self.ipv4_src) + '\n'
2994 outstr += prefix + 'ipv4_dst: ' + str(self.ipv4_dst) + '\n'
2995 outstr += prefix + 'tcp_src: ' + str(self.tcp_src) + '\n'
2996 outstr += prefix + 'tcp_dst: ' + str(self.tcp_dst) + '\n'
Rich Lane6242d9f2013-01-06 17:35:39 -08002997 return outstr
2998
2999
3000class ofp_header:
3001 """Automatically generated Python class for ofp_header
3002
Rich Lane5b44ab42013-03-11 12:37:45 -07003003 Date 2013-03-11
Rich Lane6242d9f2013-01-06 17:35:39 -08003004 Created by of.pythonize.pythonizer
3005 Core structure: Messages do not include ofp_header
3006 Does not include var-length arrays
3007 """
3008 def __init__(self):
3009 """Initialize
3010 Declare members and default values
3011 """
3012 self.version = 0x01
3013 self.type = 0
3014 self.length = 0
3015 self.xid = 0
3016
3017 def __assert(self):
3018 """Sanity check
3019 """
3020 if (not (self.type in ofp_type_map.keys())):
3021 return (False, "type must have values from ofp_type_map.keys()")
3022 return (True, None)
3023
3024 def pack(self, assertstruct=True):
3025 """Pack message
3026 Packs empty array used as placeholder
3027 """
3028 if(assertstruct):
3029 if(not self.__assert()[0]):
3030 return None
3031 packed = ""
3032 packed += struct.pack("!BBHL", self.version, self.type, self.length, self.xid)
3033 return packed
3034
3035 def unpack(self, binaryString):
3036 """Unpack message
3037 Do not unpack empty array used as placeholder
3038 since they can contain heterogeneous type
3039 """
3040 if (len(binaryString) < 8):
3041 return binaryString
3042 fmt = '!BBHL'
3043 start = 0
3044 end = start + struct.calcsize(fmt)
3045 (self.version, self.type, self.length, self.xid) = struct.unpack(fmt, binaryString[start:end])
3046 return binaryString[8:]
3047
3048 def __len__(self):
3049 """Return length of message
3050 """
3051 l = 8
3052 return l
3053
3054 def __eq__(self, other):
3055 """Return True if self and other have same values
3056 """
3057 if type(self) != type(other): return False
3058 if self.version != other.version: return False
3059 if self.type != other.type: return False
3060 if self.length != other.length: return False
3061 if self.xid != other.xid: return False
3062 return True
3063
3064 def __ne__(self, other): return not self.__eq__(other)
3065
3066 def show(self, prefix=''):
3067 """Generate string showing basic members of structure
3068 """
3069 outstr = ''
3070 outstr += prefix + 'version: ' + str(self.version) + '\n'
3071 outstr += prefix + 'type: ' + str(self.type) + '\n'
3072 outstr += prefix + 'length: ' + str(self.length) + '\n'
3073 outstr += prefix + 'xid: ' + str(self.xid) + '\n'
3074 return outstr
3075
3076
3077class ofp_vendor_header:
3078 """Automatically generated Python class for ofp_vendor_header
3079
Rich Lane5b44ab42013-03-11 12:37:45 -07003080 Date 2013-03-11
Rich Lane6242d9f2013-01-06 17:35:39 -08003081 Created by of.pythonize.pythonizer
3082 Core structure: Messages do not include ofp_header
3083 Does not include var-length arrays
3084 """
3085 def __init__(self):
3086 """Initialize
3087 Declare members and default values
3088 """
3089 self.vendor = 0
3090
3091 def __assert(self):
3092 """Sanity check
3093 """
3094 return (True, None)
3095
3096 def pack(self, assertstruct=True):
3097 """Pack message
3098 Packs empty array used as placeholder
3099 """
3100 if(assertstruct):
3101 if(not self.__assert()[0]):
3102 return None
3103 packed = ""
3104 packed += struct.pack("!L", self.vendor)
3105 return packed
3106
3107 def unpack(self, binaryString):
3108 """Unpack message
3109 Do not unpack empty array used as placeholder
3110 since they can contain heterogeneous type
3111 """
3112 if (len(binaryString) < 4):
3113 return binaryString
3114 fmt = '!L'
3115 start = 0
3116 end = start + struct.calcsize(fmt)
3117 (self.vendor,) = struct.unpack(fmt, binaryString[start:end])
3118 return binaryString[4:]
3119
3120 def __len__(self):
3121 """Return length of message
3122 """
3123 l = 4
3124 return l
3125
3126 def __eq__(self, other):
3127 """Return True if self and other have same values
3128 """
3129 if type(self) != type(other): return False
3130 if self.vendor != other.vendor: return False
3131 return True
3132
3133 def __ne__(self, other): return not self.__eq__(other)
3134
3135 def show(self, prefix=''):
3136 """Generate string showing basic members of structure
3137 """
3138 outstr = ''
3139 outstr += prefix + 'vendor: ' + str(self.vendor) + '\n'
3140 return outstr
3141
3142
3143class ofp_packet_out:
3144 """Automatically generated Python class for ofp_packet_out
3145
Rich Lane5b44ab42013-03-11 12:37:45 -07003146 Date 2013-03-11
Rich Lane6242d9f2013-01-06 17:35:39 -08003147 Created by of.pythonize.pythonizer
3148 Core structure: Messages do not include ofp_header
3149 Does not include var-length arrays
3150 """
3151 def __init__(self):
3152 """Initialize
3153 Declare members and default values
3154 """
3155 self.buffer_id = 4294967295
3156 self.in_port = 0
3157 self.actions_len = 0
3158
3159 def __assert(self):
3160 """Sanity check
3161 """
3162 return (True, None)
3163
3164 def pack(self, assertstruct=True):
3165 """Pack message
3166 Packs empty array used as placeholder
3167 """
3168 if(assertstruct):
3169 if(not self.__assert()[0]):
3170 return None
3171 packed = ""
3172 packed += struct.pack("!LHH", self.buffer_id, self.in_port, self.actions_len)
3173 return packed
3174
3175 def unpack(self, binaryString):
3176 """Unpack message
3177 Do not unpack empty array used as placeholder
3178 since they can contain heterogeneous type
3179 """
3180 if (len(binaryString) < 8):
3181 return binaryString
3182 fmt = '!LHH'
3183 start = 0
3184 end = start + struct.calcsize(fmt)
3185 (self.buffer_id, self.in_port, self.actions_len) = struct.unpack(fmt, binaryString[start:end])
3186 return binaryString[8:]
3187
3188 def __len__(self):
3189 """Return length of message
3190 """
3191 l = 8
3192 return l
3193
3194 def __eq__(self, other):
3195 """Return True if self and other have same values
3196 """
3197 if type(self) != type(other): return False
3198 if self.buffer_id != other.buffer_id: return False
3199 if self.in_port != other.in_port: return False
3200 if self.actions_len != other.actions_len: return False
3201 return True
3202
3203 def __ne__(self, other): return not self.__eq__(other)
3204
3205 def show(self, prefix=''):
3206 """Generate string showing basic members of structure
3207 """
3208 outstr = ''
3209 outstr += prefix + 'buffer_id: ' + str(self.buffer_id) + '\n'
3210 outstr += prefix + 'in_port: ' + str(self.in_port) + '\n'
3211 outstr += prefix + 'actions_len: ' + str(self.actions_len) + '\n'
3212 return outstr
3213
3214
3215class ofp_action_nw_addr:
3216 """Automatically generated Python class for ofp_action_nw_addr
3217
Rich Lane5b44ab42013-03-11 12:37:45 -07003218 Date 2013-03-11
Rich Lane6242d9f2013-01-06 17:35:39 -08003219 Created by of.pythonize.pythonizer
3220 Core structure: Messages do not include ofp_header
3221 Does not include var-length arrays
3222 """
3223 def __init__(self):
3224 """Initialize
3225 Declare members and default values
3226 """
3227 self.type = 0
3228 self.len = 0
3229 self.nw_addr = 0
3230
3231 def __assert(self):
3232 """Sanity check
3233 """
3234 return (True, None)
3235
3236 def pack(self, assertstruct=True):
3237 """Pack message
3238 Packs empty array used as placeholder
3239 """
3240 if(assertstruct):
3241 if(not self.__assert()[0]):
3242 return None
3243 packed = ""
3244 packed += struct.pack("!HHL", self.type, self.len, self.nw_addr)
3245 return packed
3246
3247 def unpack(self, binaryString):
3248 """Unpack message
3249 Do not unpack empty array used as placeholder
3250 since they can contain heterogeneous type
3251 """
3252 if (len(binaryString) < 8):
3253 return binaryString
3254 fmt = '!HHL'
3255 start = 0
3256 end = start + struct.calcsize(fmt)
3257 (self.type, self.len, self.nw_addr) = struct.unpack(fmt, binaryString[start:end])
3258 return binaryString[8:]
3259
3260 def __len__(self):
3261 """Return length of message
3262 """
3263 l = 8
3264 return l
3265
3266 def __eq__(self, other):
3267 """Return True if self and other have same values
3268 """
3269 if type(self) != type(other): return False
3270 if self.type != other.type: return False
3271 if self.len != other.len: return False
3272 if self.nw_addr != other.nw_addr: return False
3273 return True
3274
3275 def __ne__(self, other): return not self.__eq__(other)
3276
3277 def show(self, prefix=''):
3278 """Generate string showing basic members of structure
3279 """
3280 outstr = ''
3281 outstr += prefix + 'type: ' + str(self.type) + '\n'
3282 outstr += prefix + 'len: ' + str(self.len) + '\n'
3283 outstr += prefix + 'nw_addr: ' + str(self.nw_addr) + '\n'
3284 return outstr
3285
3286
3287class ofp_action_vlan_pcp:
3288 """Automatically generated Python class for ofp_action_vlan_pcp
3289
Rich Lane5b44ab42013-03-11 12:37:45 -07003290 Date 2013-03-11
Rich Lane6242d9f2013-01-06 17:35:39 -08003291 Created by of.pythonize.pythonizer
3292 Core structure: Messages do not include ofp_header
3293 Does not include var-length arrays
3294 """
3295 def __init__(self):
3296 """Initialize
3297 Declare members and default values
3298 """
3299 self.type = 0
3300 self.len = 0
3301 self.vlan_pcp = 0
3302 self.pad= [0,0,0]
3303
3304 def __assert(self):
3305 """Sanity check
3306 """
3307 if(not isinstance(self.pad, list)):
3308 return (False, "self.pad is not list as expected.")
3309 if(len(self.pad) != 3):
3310 return (False, "self.pad is not of size 3 as expected.")
3311 return (True, None)
3312
3313 def pack(self, assertstruct=True):
3314 """Pack message
3315 Packs empty array used as placeholder
3316 """
3317 if(assertstruct):
3318 if(not self.__assert()[0]):
3319 return None
3320 packed = ""
3321 packed += struct.pack("!HHB", self.type, self.len, self.vlan_pcp)
3322 packed += struct.pack("!BBB", self.pad[0], self.pad[1], self.pad[2])
3323 return packed
3324
3325 def unpack(self, binaryString):
3326 """Unpack message
3327 Do not unpack empty array used as placeholder
3328 since they can contain heterogeneous type
3329 """
3330 if (len(binaryString) < 8):
3331 return binaryString
3332 fmt = '!HHB'
3333 start = 0
3334 end = start + struct.calcsize(fmt)
3335 (self.type, self.len, self.vlan_pcp) = struct.unpack(fmt, binaryString[start:end])
3336 fmt = '!BBB'
3337 start = 5
3338 end = start + struct.calcsize(fmt)
3339 (self.pad[0], self.pad[1], self.pad[2]) = struct.unpack(fmt, binaryString[start:end])
3340 return binaryString[8:]
3341
3342 def __len__(self):
3343 """Return length of message
3344 """
3345 l = 8
3346 return l
3347
3348 def __eq__(self, other):
3349 """Return True if self and other have same values
3350 """
3351 if type(self) != type(other): return False
3352 if self.type != other.type: return False
3353 if self.len != other.len: return False
3354 if self.vlan_pcp != other.vlan_pcp: return False
3355 if self.pad != other.pad: return False
3356 return True
3357
3358 def __ne__(self, other): return not self.__eq__(other)
3359
3360 def show(self, prefix=''):
3361 """Generate string showing basic members of structure
3362 """
3363 outstr = ''
3364 outstr += prefix + 'type: ' + str(self.type) + '\n'
3365 outstr += prefix + 'len: ' + str(self.len) + '\n'
3366 outstr += prefix + 'vlan_pcp: ' + str(self.vlan_pcp) + '\n'
3367 return outstr
3368
3369
3370class ofp_flow_mod:
3371 """Automatically generated Python class for ofp_flow_mod
3372
Rich Lane5b44ab42013-03-11 12:37:45 -07003373 Date 2013-03-11
Rich Lane6242d9f2013-01-06 17:35:39 -08003374 Created by of.pythonize.pythonizer
3375 Core structure: Messages do not include ofp_header
3376 Does not include var-length arrays
3377 """
3378 def __init__(self):
3379 """Initialize
3380 Declare members and default values
3381 """
3382 self.match = ofp_match()
3383 self.cookie = 0
3384 self.command = 0
3385 self.idle_timeout = 0
3386 self.hard_timeout = 0
3387 self.priority = 0x8000
3388 self.buffer_id = 0
3389 self.out_port = 0
3390 self.flags = 0
3391
3392 def __assert(self):
3393 """Sanity check
3394 """
3395 if(not isinstance(self.match, ofp_match)):
3396 return (False, "self.match is not class ofp_match as expected.")
3397 return (True, None)
3398
3399 def pack(self, assertstruct=True):
3400 """Pack message
3401 Packs empty array used as placeholder
3402 """
3403 if(assertstruct):
3404 if(not self.__assert()[0]):
3405 return None
3406 packed = ""
3407 packed += self.match.pack()
3408 packed += struct.pack("!QHHHHLHH", self.cookie, self.command, self.idle_timeout, self.hard_timeout, self.priority, self.buffer_id, self.out_port, self.flags)
3409 return packed
3410
3411 def unpack(self, binaryString):
3412 """Unpack message
3413 Do not unpack empty array used as placeholder
3414 since they can contain heterogeneous type
3415 """
3416 if (len(binaryString) < 64):
3417 return binaryString
3418 self.match.unpack(binaryString[0:])
3419 fmt = '!QHHHHLHH'
3420 start = 40
3421 end = start + struct.calcsize(fmt)
3422 (self.cookie, self.command, self.idle_timeout, self.hard_timeout, self.priority, self.buffer_id, self.out_port, self.flags) = struct.unpack(fmt, binaryString[start:end])
3423 return binaryString[64:]
3424
3425 def __len__(self):
3426 """Return length of message
3427 """
3428 l = 64
3429 return l
3430
3431 def __eq__(self, other):
3432 """Return True if self and other have same values
3433 """
3434 if type(self) != type(other): return False
3435 if self.match != other.match: return False
3436 if self.cookie != other.cookie: return False
3437 if self.command != other.command: return False
3438 if self.idle_timeout != other.idle_timeout: return False
3439 if self.hard_timeout != other.hard_timeout: return False
3440 if self.priority != other.priority: return False
3441 if self.buffer_id != other.buffer_id: return False
3442 if self.out_port != other.out_port: return False
3443 if self.flags != other.flags: return False
3444 return True
3445
3446 def __ne__(self, other): return not self.__eq__(other)
3447
3448 def show(self, prefix=''):
3449 """Generate string showing basic members of structure
3450 """
3451 outstr = ''
3452 outstr += prefix + 'match: \n'
3453 outstr += self.match.show(prefix + ' ')
3454 outstr += prefix + 'cookie: ' + str(self.cookie) + '\n'
3455 outstr += prefix + 'command: ' + str(self.command) + '\n'
3456 outstr += prefix + 'idle_timeout: ' + str(self.idle_timeout) + '\n'
3457 outstr += prefix + 'hard_timeout: ' + str(self.hard_timeout) + '\n'
3458 outstr += prefix + 'priority: ' + str(self.priority) + '\n'
3459 outstr += prefix + 'buffer_id: ' + str(self.buffer_id) + '\n'
3460 outstr += prefix + 'out_port: ' + str(self.out_port) + '\n'
3461 outstr += prefix + 'flags: ' + str(self.flags) + '\n'
3462 return outstr
3463
3464
3465class ofp_error_msg:
3466 """Automatically generated Python class for ofp_error_msg
3467
Rich Lane5b44ab42013-03-11 12:37:45 -07003468 Date 2013-03-11
Rich Lane6242d9f2013-01-06 17:35:39 -08003469 Created by of.pythonize.pythonizer
3470 Core structure: Messages do not include ofp_header
3471 Does not include var-length arrays
3472 """
3473 def __init__(self):
3474 """Initialize
3475 Declare members and default values
3476 """
3477 self.type = 0
3478 self.code = 0
3479
3480 def __assert(self):
3481 """Sanity check
3482 """
3483 return (True, None)
3484
3485 def pack(self, assertstruct=True):
3486 """Pack message
3487 Packs empty array used as placeholder
3488 """
3489 if(assertstruct):
3490 if(not self.__assert()[0]):
3491 return None
3492 packed = ""
3493 packed += struct.pack("!HH", self.type, self.code)
3494 return packed
3495
3496 def unpack(self, binaryString):
3497 """Unpack message
3498 Do not unpack empty array used as placeholder
3499 since they can contain heterogeneous type
3500 """
3501 if (len(binaryString) < 4):
3502 return binaryString
3503 fmt = '!HH'
3504 start = 0
3505 end = start + struct.calcsize(fmt)
3506 (self.type, self.code) = struct.unpack(fmt, binaryString[start:end])
3507 return binaryString[4:]
3508
3509 def __len__(self):
3510 """Return length of message
3511 """
3512 l = 4
3513 return l
3514
3515 def __eq__(self, other):
3516 """Return True if self and other have same values
3517 """
3518 if type(self) != type(other): return False
3519 if self.type != other.type: return False
3520 if self.code != other.code: return False
3521 return True
3522
3523 def __ne__(self, other): return not self.__eq__(other)
3524
3525 def show(self, prefix=''):
3526 """Generate string showing basic members of structure
3527 """
3528 outstr = ''
3529 outstr += prefix + 'type: ' + str(self.type) + '\n'
3530 outstr += prefix + 'code: ' + str(self.code) + '\n'
3531 return outstr
3532
3533
3534# Enumerated type definitions
3535ofp_error_type = ['OFPET_HELLO_FAILED', 'OFPET_BAD_REQUEST', 'OFPET_BAD_ACTION', 'OFPET_FLOW_MOD_FAILED', 'OFPET_PORT_MOD_FAILED', 'OFPET_QUEUE_OP_FAILED']
3536OFPET_HELLO_FAILED = 0
3537OFPET_BAD_REQUEST = 1
3538OFPET_BAD_ACTION = 2
3539OFPET_FLOW_MOD_FAILED = 3
3540OFPET_PORT_MOD_FAILED = 4
3541OFPET_QUEUE_OP_FAILED = 5
3542ofp_error_type_map = {
3543 0 : 'OFPET_HELLO_FAILED',
3544 1 : 'OFPET_BAD_REQUEST',
3545 2 : 'OFPET_BAD_ACTION',
3546 3 : 'OFPET_FLOW_MOD_FAILED',
3547 4 : 'OFPET_PORT_MOD_FAILED',
3548 5 : 'OFPET_QUEUE_OP_FAILED'
3549}
3550
3551ofp_flow_mod_flags = ['OFPFF_SEND_FLOW_REM', 'OFPFF_CHECK_OVERLAP', 'OFPFF_EMERG']
3552OFPFF_SEND_FLOW_REM = 1
3553OFPFF_CHECK_OVERLAP = 2
3554OFPFF_EMERG = 4
3555ofp_flow_mod_flags_map = {
3556 1 : 'OFPFF_SEND_FLOW_REM',
3557 2 : 'OFPFF_CHECK_OVERLAP',
3558 4 : 'OFPFF_EMERG'
3559}
3560
3561ofp_stats_reply_flags = ['OFPSF_REPLY_MORE']
3562OFPSF_REPLY_MORE = 1
3563ofp_stats_reply_flags_map = {
3564 1 : 'OFPSF_REPLY_MORE'
3565}
3566
3567ofp_flow_mod_failed_code = ['OFPFMFC_ALL_TABLES_FULL', 'OFPFMFC_OVERLAP', 'OFPFMFC_EPERM', 'OFPFMFC_BAD_EMERG_TIMEOUT', 'OFPFMFC_BAD_COMMAND', 'OFPFMFC_UNSUPPORTED']
3568OFPFMFC_ALL_TABLES_FULL = 0
3569OFPFMFC_OVERLAP = 1
3570OFPFMFC_EPERM = 2
3571OFPFMFC_BAD_EMERG_TIMEOUT = 3
3572OFPFMFC_BAD_COMMAND = 4
3573OFPFMFC_UNSUPPORTED = 5
3574ofp_flow_mod_failed_code_map = {
3575 0 : 'OFPFMFC_ALL_TABLES_FULL',
3576 1 : 'OFPFMFC_OVERLAP',
3577 2 : 'OFPFMFC_EPERM',
3578 3 : 'OFPFMFC_BAD_EMERG_TIMEOUT',
3579 4 : 'OFPFMFC_BAD_COMMAND',
3580 5 : 'OFPFMFC_UNSUPPORTED'
3581}
3582
3583ofp_port_config = ['OFPPC_PORT_DOWN', 'OFPPC_NO_STP', 'OFPPC_NO_RECV', 'OFPPC_NO_RECV_STP', 'OFPPC_NO_FLOOD', 'OFPPC_NO_FWD', 'OFPPC_NO_PACKET_IN']
3584OFPPC_PORT_DOWN = 1
3585OFPPC_NO_STP = 2
3586OFPPC_NO_RECV = 4
3587OFPPC_NO_RECV_STP = 8
3588OFPPC_NO_FLOOD = 16
3589OFPPC_NO_FWD = 32
3590OFPPC_NO_PACKET_IN = 64
3591ofp_port_config_map = {
3592 1 : 'OFPPC_PORT_DOWN',
3593 2 : 'OFPPC_NO_STP',
3594 4 : 'OFPPC_NO_RECV',
3595 8 : 'OFPPC_NO_RECV_STP',
3596 16 : 'OFPPC_NO_FLOOD',
3597 32 : 'OFPPC_NO_FWD',
3598 64 : 'OFPPC_NO_PACKET_IN'
3599}
3600
3601ofp_port_state = ['OFPPS_LINK_DOWN', 'OFPPS_STP_LISTEN', 'OFPPS_STP_LEARN', 'OFPPS_STP_FORWARD', 'OFPPS_STP_BLOCK', 'OFPPS_STP_MASK']
3602OFPPS_LINK_DOWN = 1
3603OFPPS_STP_LISTEN = 0
3604OFPPS_STP_LEARN = 256
3605OFPPS_STP_FORWARD = 512
3606OFPPS_STP_BLOCK = 768
3607OFPPS_STP_MASK = 768
3608ofp_port_state_map = {
3609 1 : 'OFPPS_LINK_DOWN',
3610 0 : 'OFPPS_STP_LISTEN',
3611 256 : 'OFPPS_STP_LEARN',
3612 512 : 'OFPPS_STP_FORWARD',
3613 768 : 'OFPPS_STP_BLOCK',
3614 768 : 'OFPPS_STP_MASK'
3615}
3616
3617ofp_config_flags = ['OFPC_FRAG_NORMAL', 'OFPC_FRAG_DROP', 'OFPC_FRAG_REASM', 'OFPC_FRAG_MASK']
3618OFPC_FRAG_NORMAL = 0
3619OFPC_FRAG_DROP = 1
3620OFPC_FRAG_REASM = 2
3621OFPC_FRAG_MASK = 3
3622ofp_config_flags_map = {
3623 0 : 'OFPC_FRAG_NORMAL',
3624 1 : 'OFPC_FRAG_DROP',
3625 2 : 'OFPC_FRAG_REASM',
3626 3 : 'OFPC_FRAG_MASK'
3627}
3628
3629ofp_hello_failed_code = ['OFPHFC_INCOMPATIBLE', 'OFPHFC_EPERM']
3630OFPHFC_INCOMPATIBLE = 0
3631OFPHFC_EPERM = 1
3632ofp_hello_failed_code_map = {
3633 0 : 'OFPHFC_INCOMPATIBLE',
3634 1 : 'OFPHFC_EPERM'
3635}
3636
3637ofp_capabilities = ['OFPC_FLOW_STATS', 'OFPC_TABLE_STATS', 'OFPC_PORT_STATS', 'OFPC_STP', 'OFPC_RESERVED', 'OFPC_IP_REASM', 'OFPC_QUEUE_STATS', 'OFPC_ARP_MATCH_IP']
3638OFPC_FLOW_STATS = 1
3639OFPC_TABLE_STATS = 2
3640OFPC_PORT_STATS = 4
3641OFPC_STP = 8
3642OFPC_RESERVED = 16
3643OFPC_IP_REASM = 32
3644OFPC_QUEUE_STATS = 64
3645OFPC_ARP_MATCH_IP = 128
3646ofp_capabilities_map = {
3647 1 : 'OFPC_FLOW_STATS',
3648 2 : 'OFPC_TABLE_STATS',
3649 4 : 'OFPC_PORT_STATS',
3650 8 : 'OFPC_STP',
3651 16 : 'OFPC_RESERVED',
3652 32 : 'OFPC_IP_REASM',
3653 64 : 'OFPC_QUEUE_STATS',
3654 128 : 'OFPC_ARP_MATCH_IP'
3655}
3656
3657ofp_flow_removed_reason = ['OFPRR_IDLE_TIMEOUT', 'OFPRR_HARD_TIMEOUT', 'OFPRR_DELETE']
3658OFPRR_IDLE_TIMEOUT = 0
3659OFPRR_HARD_TIMEOUT = 1
3660OFPRR_DELETE = 2
3661ofp_flow_removed_reason_map = {
3662 0 : 'OFPRR_IDLE_TIMEOUT',
3663 1 : 'OFPRR_HARD_TIMEOUT',
3664 2 : 'OFPRR_DELETE'
3665}
3666
3667ofp_queue_properties = ['OFPQT_NONE', 'OFPQT_MIN_RATE']
3668OFPQT_NONE = 0
3669OFPQT_MIN_RATE = 0
3670ofp_queue_properties_map = {
3671 0 : 'OFPQT_NONE',
3672 0 : 'OFPQT_MIN_RATE'
3673}
3674
3675ofp_flow_wildcards = ['OFPFW_IN_PORT', 'OFPFW_DL_VLAN', 'OFPFW_DL_SRC', 'OFPFW_DL_DST', 'OFPFW_DL_TYPE', 'OFPFW_NW_PROTO', 'OFPFW_TP_SRC', 'OFPFW_TP_DST', 'OFPFW_NW_SRC_SHIFT', 'OFPFW_NW_SRC_BITS', 'OFPFW_NW_SRC_MASK', 'OFPFW_NW_SRC_ALL', 'OFPFW_NW_DST_SHIFT', 'OFPFW_NW_DST_BITS', 'OFPFW_NW_DST_MASK', 'OFPFW_NW_DST_ALL', 'OFPFW_DL_VLAN_PCP', 'OFPFW_NW_TOS', 'OFPFW_ALL']
3676OFPFW_IN_PORT = 1
3677OFPFW_DL_VLAN = 2
3678OFPFW_DL_SRC = 4
3679OFPFW_DL_DST = 8
3680OFPFW_DL_TYPE = 16
3681OFPFW_NW_PROTO = 32
3682OFPFW_TP_SRC = 64
3683OFPFW_TP_DST = 128
3684OFPFW_NW_SRC_SHIFT = 8
3685OFPFW_NW_SRC_BITS = 6
3686OFPFW_NW_SRC_MASK = 16128
3687OFPFW_NW_SRC_ALL = 8192
3688OFPFW_NW_DST_SHIFT = 14
3689OFPFW_NW_DST_BITS = 6
3690OFPFW_NW_DST_MASK = 1032192
3691OFPFW_NW_DST_ALL = 524288
3692OFPFW_DL_VLAN_PCP = 1048576
3693OFPFW_NW_TOS = 2097152
3694OFPFW_ALL = 4194303
3695ofp_flow_wildcards_map = {
3696 1 : 'OFPFW_IN_PORT',
3697 2 : 'OFPFW_DL_VLAN',
3698 4 : 'OFPFW_DL_SRC',
3699 8 : 'OFPFW_DL_DST',
3700 16 : 'OFPFW_DL_TYPE',
3701 32 : 'OFPFW_NW_PROTO',
3702 64 : 'OFPFW_TP_SRC',
3703 128 : 'OFPFW_TP_DST',
3704 8 : 'OFPFW_NW_SRC_SHIFT',
3705 6 : 'OFPFW_NW_SRC_BITS',
3706 16128 : 'OFPFW_NW_SRC_MASK',
3707 8192 : 'OFPFW_NW_SRC_ALL',
3708 14 : 'OFPFW_NW_DST_SHIFT',
3709 6 : 'OFPFW_NW_DST_BITS',
3710 1032192 : 'OFPFW_NW_DST_MASK',
3711 524288 : 'OFPFW_NW_DST_ALL',
3712 1048576 : 'OFPFW_DL_VLAN_PCP',
3713 2097152 : 'OFPFW_NW_TOS',
3714 4194303 : 'OFPFW_ALL'
3715}
3716
3717ofp_port_reason = ['OFPPR_ADD', 'OFPPR_DELETE', 'OFPPR_MODIFY']
3718OFPPR_ADD = 0
3719OFPPR_DELETE = 1
3720OFPPR_MODIFY = 2
3721ofp_port_reason_map = {
3722 0 : 'OFPPR_ADD',
3723 1 : 'OFPPR_DELETE',
3724 2 : 'OFPPR_MODIFY'
3725}
3726
3727ofp_action_type = ['OFPAT_OUTPUT', 'OFPAT_SET_VLAN_VID', 'OFPAT_SET_VLAN_PCP', 'OFPAT_STRIP_VLAN', 'OFPAT_SET_DL_SRC', 'OFPAT_SET_DL_DST', 'OFPAT_SET_NW_SRC', 'OFPAT_SET_NW_DST', 'OFPAT_SET_NW_TOS', 'OFPAT_SET_TP_SRC', 'OFPAT_SET_TP_DST', 'OFPAT_ENQUEUE', 'OFPAT_VENDOR']
3728OFPAT_OUTPUT = 0
3729OFPAT_SET_VLAN_VID = 1
3730OFPAT_SET_VLAN_PCP = 2
3731OFPAT_STRIP_VLAN = 3
3732OFPAT_SET_DL_SRC = 4
3733OFPAT_SET_DL_DST = 5
3734OFPAT_SET_NW_SRC = 6
3735OFPAT_SET_NW_DST = 7
3736OFPAT_SET_NW_TOS = 8
3737OFPAT_SET_TP_SRC = 9
3738OFPAT_SET_TP_DST = 10
3739OFPAT_ENQUEUE = 11
3740OFPAT_VENDOR = 65535
3741ofp_action_type_map = {
3742 0 : 'OFPAT_OUTPUT',
3743 1 : 'OFPAT_SET_VLAN_VID',
3744 2 : 'OFPAT_SET_VLAN_PCP',
3745 3 : 'OFPAT_STRIP_VLAN',
3746 4 : 'OFPAT_SET_DL_SRC',
3747 5 : 'OFPAT_SET_DL_DST',
3748 6 : 'OFPAT_SET_NW_SRC',
3749 7 : 'OFPAT_SET_NW_DST',
3750 8 : 'OFPAT_SET_NW_TOS',
3751 9 : 'OFPAT_SET_TP_SRC',
3752 10 : 'OFPAT_SET_TP_DST',
3753 11 : 'OFPAT_ENQUEUE',
3754 65535 : 'OFPAT_VENDOR'
3755}
3756
3757ofp_flow_mod_command = ['OFPFC_ADD', 'OFPFC_MODIFY', 'OFPFC_MODIFY_STRICT', 'OFPFC_DELETE', 'OFPFC_DELETE_STRICT']
3758OFPFC_ADD = 0
3759OFPFC_MODIFY = 1
3760OFPFC_MODIFY_STRICT = 2
3761OFPFC_DELETE = 3
3762OFPFC_DELETE_STRICT = 4
3763ofp_flow_mod_command_map = {
3764 0 : 'OFPFC_ADD',
3765 1 : 'OFPFC_MODIFY',
3766 2 : 'OFPFC_MODIFY_STRICT',
3767 3 : 'OFPFC_DELETE',
3768 4 : 'OFPFC_DELETE_STRICT'
3769}
3770
3771ofp_queue_op_failed_code = ['OFPQOFC_BAD_PORT', 'OFPQOFC_BAD_QUEUE', 'OFPQOFC_EPERM']
3772OFPQOFC_BAD_PORT = 0
3773OFPQOFC_BAD_QUEUE = 1
3774OFPQOFC_EPERM = 2
3775ofp_queue_op_failed_code_map = {
3776 0 : 'OFPQOFC_BAD_PORT',
3777 1 : 'OFPQOFC_BAD_QUEUE',
3778 2 : 'OFPQOFC_EPERM'
3779}
3780
3781ofp_port = ['OFPP_MAX', 'OFPP_IN_PORT', 'OFPP_TABLE', 'OFPP_NORMAL', 'OFPP_FLOOD', 'OFPP_ALL', 'OFPP_CONTROLLER', 'OFPP_LOCAL', 'OFPP_NONE']
3782OFPP_MAX = 65280
3783OFPP_IN_PORT = 65528
3784OFPP_TABLE = 65529
3785OFPP_NORMAL = 65530
3786OFPP_FLOOD = 65531
3787OFPP_ALL = 65532
3788OFPP_CONTROLLER = 65533
3789OFPP_LOCAL = 65534
3790OFPP_NONE = 65535
3791ofp_port_map = {
3792 65280 : 'OFPP_MAX',
3793 65528 : 'OFPP_IN_PORT',
3794 65529 : 'OFPP_TABLE',
3795 65530 : 'OFPP_NORMAL',
3796 65531 : 'OFPP_FLOOD',
3797 65532 : 'OFPP_ALL',
3798 65533 : 'OFPP_CONTROLLER',
3799 65534 : 'OFPP_LOCAL',
3800 65535 : 'OFPP_NONE'
3801}
3802
3803ofp_bad_action_code = ['OFPBAC_BAD_TYPE', 'OFPBAC_BAD_LEN', 'OFPBAC_BAD_VENDOR', 'OFPBAC_BAD_VENDOR_TYPE', 'OFPBAC_BAD_OUT_PORT', 'OFPBAC_BAD_ARGUMENT', 'OFPBAC_EPERM', 'OFPBAC_TOO_MANY', 'OFPBAC_BAD_QUEUE']
3804OFPBAC_BAD_TYPE = 0
3805OFPBAC_BAD_LEN = 1
3806OFPBAC_BAD_VENDOR = 2
3807OFPBAC_BAD_VENDOR_TYPE = 3
3808OFPBAC_BAD_OUT_PORT = 4
3809OFPBAC_BAD_ARGUMENT = 5
3810OFPBAC_EPERM = 6
3811OFPBAC_TOO_MANY = 7
3812OFPBAC_BAD_QUEUE = 8
3813ofp_bad_action_code_map = {
3814 0 : 'OFPBAC_BAD_TYPE',
3815 1 : 'OFPBAC_BAD_LEN',
3816 2 : 'OFPBAC_BAD_VENDOR',
3817 3 : 'OFPBAC_BAD_VENDOR_TYPE',
3818 4 : 'OFPBAC_BAD_OUT_PORT',
3819 5 : 'OFPBAC_BAD_ARGUMENT',
3820 6 : 'OFPBAC_EPERM',
3821 7 : 'OFPBAC_TOO_MANY',
3822 8 : 'OFPBAC_BAD_QUEUE'
3823}
3824
3825ofp_bad_request_code = ['OFPBRC_BAD_VERSION', 'OFPBRC_BAD_TYPE', 'OFPBRC_BAD_STAT', 'OFPBRC_BAD_VENDOR', 'OFPBRC_BAD_SUBTYPE', 'OFPBRC_EPERM', 'OFPBRC_BAD_LEN', 'OFPBRC_BUFFER_EMPTY', 'OFPBRC_BUFFER_UNKNOWN']
3826OFPBRC_BAD_VERSION = 0
3827OFPBRC_BAD_TYPE = 1
3828OFPBRC_BAD_STAT = 2
3829OFPBRC_BAD_VENDOR = 3
3830OFPBRC_BAD_SUBTYPE = 4
3831OFPBRC_EPERM = 5
3832OFPBRC_BAD_LEN = 6
3833OFPBRC_BUFFER_EMPTY = 7
3834OFPBRC_BUFFER_UNKNOWN = 8
3835ofp_bad_request_code_map = {
3836 0 : 'OFPBRC_BAD_VERSION',
3837 1 : 'OFPBRC_BAD_TYPE',
3838 2 : 'OFPBRC_BAD_STAT',
3839 3 : 'OFPBRC_BAD_VENDOR',
3840 4 : 'OFPBRC_BAD_SUBTYPE',
3841 5 : 'OFPBRC_EPERM',
3842 6 : 'OFPBRC_BAD_LEN',
3843 7 : 'OFPBRC_BUFFER_EMPTY',
3844 8 : 'OFPBRC_BUFFER_UNKNOWN'
3845}
3846
3847ofp_port_features = ['OFPPF_10MB_HD', 'OFPPF_10MB_FD', 'OFPPF_100MB_HD', 'OFPPF_100MB_FD', 'OFPPF_1GB_HD', 'OFPPF_1GB_FD', 'OFPPF_10GB_FD', 'OFPPF_COPPER', 'OFPPF_FIBER', 'OFPPF_AUTONEG', 'OFPPF_PAUSE', 'OFPPF_PAUSE_ASYM']
3848OFPPF_10MB_HD = 1
3849OFPPF_10MB_FD = 2
3850OFPPF_100MB_HD = 4
3851OFPPF_100MB_FD = 8
3852OFPPF_1GB_HD = 16
3853OFPPF_1GB_FD = 32
3854OFPPF_10GB_FD = 64
3855OFPPF_COPPER = 128
3856OFPPF_FIBER = 256
3857OFPPF_AUTONEG = 512
3858OFPPF_PAUSE = 1024
3859OFPPF_PAUSE_ASYM = 2048
3860ofp_port_features_map = {
3861 1 : 'OFPPF_10MB_HD',
3862 2 : 'OFPPF_10MB_FD',
3863 4 : 'OFPPF_100MB_HD',
3864 8 : 'OFPPF_100MB_FD',
3865 16 : 'OFPPF_1GB_HD',
3866 32 : 'OFPPF_1GB_FD',
3867 64 : 'OFPPF_10GB_FD',
3868 128 : 'OFPPF_COPPER',
3869 256 : 'OFPPF_FIBER',
3870 512 : 'OFPPF_AUTONEG',
3871 1024 : 'OFPPF_PAUSE',
3872 2048 : 'OFPPF_PAUSE_ASYM'
3873}
3874
3875ofp_type = ['OFPT_HELLO', 'OFPT_ERROR', 'OFPT_ECHO_REQUEST', 'OFPT_ECHO_REPLY', 'OFPT_VENDOR', '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_PORT_MOD', 'OFPT_STATS_REQUEST', 'OFPT_STATS_REPLY', 'OFPT_BARRIER_REQUEST', 'OFPT_BARRIER_REPLY', 'OFPT_QUEUE_GET_CONFIG_REQUEST', 'OFPT_QUEUE_GET_CONFIG_REPLY']
3876OFPT_HELLO = 0
3877OFPT_ERROR = 1
3878OFPT_ECHO_REQUEST = 2
3879OFPT_ECHO_REPLY = 3
3880OFPT_VENDOR = 4
3881OFPT_FEATURES_REQUEST = 5
3882OFPT_FEATURES_REPLY = 6
3883OFPT_GET_CONFIG_REQUEST = 7
3884OFPT_GET_CONFIG_REPLY = 8
3885OFPT_SET_CONFIG = 9
3886OFPT_PACKET_IN = 10
3887OFPT_FLOW_REMOVED = 11
3888OFPT_PORT_STATUS = 12
3889OFPT_PACKET_OUT = 13
3890OFPT_FLOW_MOD = 14
3891OFPT_PORT_MOD = 15
3892OFPT_STATS_REQUEST = 16
3893OFPT_STATS_REPLY = 17
3894OFPT_BARRIER_REQUEST = 18
3895OFPT_BARRIER_REPLY = 19
3896OFPT_QUEUE_GET_CONFIG_REQUEST = 20
3897OFPT_QUEUE_GET_CONFIG_REPLY = 21
3898ofp_type_map = {
3899 0 : 'OFPT_HELLO',
3900 1 : 'OFPT_ERROR',
3901 2 : 'OFPT_ECHO_REQUEST',
3902 3 : 'OFPT_ECHO_REPLY',
3903 4 : 'OFPT_VENDOR',
3904 5 : 'OFPT_FEATURES_REQUEST',
3905 6 : 'OFPT_FEATURES_REPLY',
3906 7 : 'OFPT_GET_CONFIG_REQUEST',
3907 8 : 'OFPT_GET_CONFIG_REPLY',
3908 9 : 'OFPT_SET_CONFIG',
3909 10 : 'OFPT_PACKET_IN',
3910 11 : 'OFPT_FLOW_REMOVED',
3911 12 : 'OFPT_PORT_STATUS',
3912 13 : 'OFPT_PACKET_OUT',
3913 14 : 'OFPT_FLOW_MOD',
3914 15 : 'OFPT_PORT_MOD',
3915 16 : 'OFPT_STATS_REQUEST',
3916 17 : 'OFPT_STATS_REPLY',
3917 18 : 'OFPT_BARRIER_REQUEST',
3918 19 : 'OFPT_BARRIER_REPLY',
3919 20 : 'OFPT_QUEUE_GET_CONFIG_REQUEST',
3920 21 : 'OFPT_QUEUE_GET_CONFIG_REPLY'
3921}
3922
3923ofp_packet_in_reason = ['OFPR_NO_MATCH', 'OFPR_ACTION']
3924OFPR_NO_MATCH = 0
3925OFPR_ACTION = 1
3926ofp_packet_in_reason_map = {
3927 0 : 'OFPR_NO_MATCH',
3928 1 : 'OFPR_ACTION'
3929}
3930
3931ofp_stats_types = ['OFPST_DESC', 'OFPST_FLOW', 'OFPST_AGGREGATE', 'OFPST_TABLE', 'OFPST_PORT', 'OFPST_QUEUE', 'OFPST_VENDOR']
3932OFPST_DESC = 0
3933OFPST_FLOW = 1
3934OFPST_AGGREGATE = 2
3935OFPST_TABLE = 3
3936OFPST_PORT = 4
3937OFPST_QUEUE = 5
3938OFPST_VENDOR = 65535
3939ofp_stats_types_map = {
3940 0 : 'OFPST_DESC',
3941 1 : 'OFPST_FLOW',
3942 2 : 'OFPST_AGGREGATE',
3943 3 : 'OFPST_TABLE',
3944 4 : 'OFPST_PORT',
3945 5 : 'OFPST_QUEUE',
3946 65535 : 'OFPST_VENDOR'
3947}
3948
3949ofp_port_mod_failed_code = ['OFPPMFC_BAD_PORT', 'OFPPMFC_BAD_HW_ADDR']
3950OFPPMFC_BAD_PORT = 0
3951OFPPMFC_BAD_HW_ADDR = 1
3952ofp_port_mod_failed_code_map = {
3953 0 : 'OFPPMFC_BAD_PORT',
3954 1 : 'OFPPMFC_BAD_HW_ADDR'
3955}
3956
3957# Values from macro definitions
3958OFP_FLOW_PERMANENT = 0
3959OFP_DL_TYPE_ETH2_CUTOFF = 0x0600
3960DESC_STR_LEN = 256
3961OFPFW_ICMP_CODE = OFPFW_TP_DST
3962OFPQ_MIN_RATE_UNCFG = 0xffff
3963OFP_VERSION = 0x01
3964OFP_MAX_TABLE_NAME_LEN = 32
3965OFP_DL_TYPE_NOT_ETH_TYPE = 0x05ff
3966OFP_DEFAULT_MISS_SEND_LEN = 128
3967OFP_MAX_PORT_NAME_LEN = 16
3968OFP_SSL_PORT = 6633
3969OFPFW_ICMP_TYPE = OFPFW_TP_SRC
3970OFP_TCP_PORT = 6633
3971SERIAL_NUM_LEN = 32
3972OFP_DEFAULT_PRIORITY = 0x8000
3973OFP_ETH_ALEN = 6
3974OFP_VLAN_NONE = 0xffff
3975OFPQ_ALL = 0xffffffff
3976
3977# Basic structure size definitions.
3978# Does not include ofp_header members.
3979# Does not include variable length arrays.
3980OFP_ACTION_DL_ADDR_BYTES = 16
3981OFP_ACTION_ENQUEUE_BYTES = 16
3982OFP_ACTION_HEADER_BYTES = 8
3983OFP_ACTION_NW_ADDR_BYTES = 8
3984OFP_ACTION_NW_TOS_BYTES = 8
3985OFP_ACTION_OUTPUT_BYTES = 8
3986OFP_ACTION_TP_PORT_BYTES = 8
3987OFP_ACTION_VENDOR_HEADER_BYTES = 8
3988OFP_ACTION_VLAN_PCP_BYTES = 8
3989OFP_ACTION_VLAN_VID_BYTES = 8
3990OFP_AGGREGATE_STATS_REPLY_BYTES = 24
3991OFP_AGGREGATE_STATS_REQUEST_BYTES = 44
3992OFP_DESC_STATS_BYTES = 1056
3993OFP_ERROR_MSG_BYTES = 4
3994OFP_FLOW_MOD_BYTES = 64
3995OFP_FLOW_REMOVED_BYTES = 80
3996OFP_FLOW_STATS_BYTES = 88
3997OFP_FLOW_STATS_REQUEST_BYTES = 44
3998OFP_HEADER_BYTES = 8
3999OFP_HELLO_BYTES = 0
4000OFP_MATCH_BYTES = 40
4001OFP_PACKET_IN_BYTES = 10
4002OFP_PACKET_OUT_BYTES = 8
4003OFP_PACKET_QUEUE_BYTES = 8
4004OFP_PHY_PORT_BYTES = 48
4005OFP_PORT_MOD_BYTES = 24
4006OFP_PORT_STATS_BYTES = 104
4007OFP_PORT_STATS_REQUEST_BYTES = 8
4008OFP_PORT_STATUS_BYTES = 56
4009OFP_QUEUE_GET_CONFIG_REPLY_BYTES = 8
4010OFP_QUEUE_GET_CONFIG_REQUEST_BYTES = 4
4011OFP_QUEUE_PROP_HEADER_BYTES = 8
4012OFP_QUEUE_PROP_MIN_RATE_BYTES = 16
4013OFP_QUEUE_STATS_BYTES = 32
4014OFP_QUEUE_STATS_REQUEST_BYTES = 8
4015OFP_STATS_REPLY_BYTES = 4
4016OFP_STATS_REQUEST_BYTES = 4
4017OFP_SWITCH_CONFIG_BYTES = 4
4018OFP_SWITCH_FEATURES_BYTES = 24
4019OFP_TABLE_STATS_BYTES = 64
4020OFP_VENDOR_HEADER_BYTES = 4
4021