blob: 4bf175004f502260833cd56b3324129ec9cc2704 [file] [log] [blame]
Nathan Knuth418fdc82016-09-16 22:51:15 -07001# Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
2# Copyright (c) 2011, 2012 Open Networking Foundation
3# Copyright (c) 2012, 2013 Big Switch Networks, Inc.
4# See the file LICENSE.pyloxi which should have been included in the source distribution
5
6# Automatically generated by LOXI from template module.py
7# Do not modify
8
9import struct
10import loxi
11import util
12import loxi.generic_util
13
14import sys
15ofp = sys.modules['loxi.of13']
16
17class bsn_controller_connection(loxi.OFObject):
18
19 def __init__(self, state=None, auxiliary_id=None, role=None, uri=None):
20 if state != None:
21 self.state = state
22 else:
23 self.state = 0
24 if auxiliary_id != None:
25 self.auxiliary_id = auxiliary_id
26 else:
27 self.auxiliary_id = 0
28 if role != None:
29 self.role = role
30 else:
31 self.role = 0
32 if uri != None:
33 self.uri = uri
34 else:
35 self.uri = ""
36 return
37
38 def pack(self):
39 packed = []
40 packed.append(struct.pack("!B", self.state))
41 packed.append(struct.pack("!B", self.auxiliary_id))
42 packed.append('\x00' * 2)
43 packed.append(struct.pack("!L", self.role))
44 packed.append(struct.pack("!256s", self.uri))
45 return ''.join(packed)
46
47 @staticmethod
48 def unpack(reader):
49 obj = bsn_controller_connection()
50 obj.state = reader.read("!B")[0]
51 obj.auxiliary_id = reader.read("!B")[0]
52 reader.skip(2)
53 obj.role = reader.read("!L")[0]
54 obj.uri = reader.read("!256s")[0].rstrip("\x00")
55 return obj
56
57 def __eq__(self, other):
58 if type(self) != type(other): return False
59 if self.state != other.state: return False
60 if self.auxiliary_id != other.auxiliary_id: return False
61 if self.role != other.role: return False
62 if self.uri != other.uri: return False
63 return True
64
65 def pretty_print(self, q):
66 q.text("bsn_controller_connection {")
67 with q.group():
68 with q.indent(2):
69 q.breakable()
70 q.text("state = ");
71 q.text("%#x" % self.state)
72 q.text(","); q.breakable()
73 q.text("auxiliary_id = ");
74 q.text("%#x" % self.auxiliary_id)
75 q.text(","); q.breakable()
76 q.text("role = ");
77 q.text("%#x" % self.role)
78 q.text(","); q.breakable()
79 q.text("uri = ");
80 q.pp(self.uri)
81 q.breakable()
82 q.text('}')
83
84
85class bsn_debug_counter_desc_stats_entry(loxi.OFObject):
86
87 def __init__(self, counter_id=None, name=None, description=None):
88 if counter_id != None:
89 self.counter_id = counter_id
90 else:
91 self.counter_id = 0
92 if name != None:
93 self.name = name
94 else:
95 self.name = ""
96 if description != None:
97 self.description = description
98 else:
99 self.description = ""
100 return
101
102 def pack(self):
103 packed = []
104 packed.append(struct.pack("!Q", self.counter_id))
105 packed.append(struct.pack("!64s", self.name))
106 packed.append(struct.pack("!256s", self.description))
107 return ''.join(packed)
108
109 @staticmethod
110 def unpack(reader):
111 obj = bsn_debug_counter_desc_stats_entry()
112 obj.counter_id = reader.read("!Q")[0]
113 obj.name = reader.read("!64s")[0].rstrip("\x00")
114 obj.description = reader.read("!256s")[0].rstrip("\x00")
115 return obj
116
117 def __eq__(self, other):
118 if type(self) != type(other): return False
119 if self.counter_id != other.counter_id: return False
120 if self.name != other.name: return False
121 if self.description != other.description: return False
122 return True
123
124 def pretty_print(self, q):
125 q.text("bsn_debug_counter_desc_stats_entry {")
126 with q.group():
127 with q.indent(2):
128 q.breakable()
129 q.text("counter_id = ");
130 q.text("%#x" % self.counter_id)
131 q.text(","); q.breakable()
132 q.text("name = ");
133 q.pp(self.name)
134 q.text(","); q.breakable()
135 q.text("description = ");
136 q.pp(self.description)
137 q.breakable()
138 q.text('}')
139
140
141class bsn_debug_counter_stats_entry(loxi.OFObject):
142
143 def __init__(self, counter_id=None, value=None):
144 if counter_id != None:
145 self.counter_id = counter_id
146 else:
147 self.counter_id = 0
148 if value != None:
149 self.value = value
150 else:
151 self.value = 0
152 return
153
154 def pack(self):
155 packed = []
156 packed.append(struct.pack("!Q", self.counter_id))
157 packed.append(struct.pack("!Q", self.value))
158 return ''.join(packed)
159
160 @staticmethod
161 def unpack(reader):
162 obj = bsn_debug_counter_stats_entry()
163 obj.counter_id = reader.read("!Q")[0]
164 obj.value = reader.read("!Q")[0]
165 return obj
166
167 def __eq__(self, other):
168 if type(self) != type(other): return False
169 if self.counter_id != other.counter_id: return False
170 if self.value != other.value: return False
171 return True
172
173 def pretty_print(self, q):
174 q.text("bsn_debug_counter_stats_entry {")
175 with q.group():
176 with q.indent(2):
177 q.breakable()
178 q.text("counter_id = ");
179 q.text("%#x" % self.counter_id)
180 q.text(","); q.breakable()
181 q.text("value = ");
182 q.text("%#x" % self.value)
183 q.breakable()
184 q.text('}')
185
186
187class bsn_flow_checksum_bucket_stats_entry(loxi.OFObject):
188
189 def __init__(self, checksum=None):
190 if checksum != None:
191 self.checksum = checksum
192 else:
193 self.checksum = 0
194 return
195
196 def pack(self):
197 packed = []
198 packed.append(struct.pack("!Q", self.checksum))
199 return ''.join(packed)
200
201 @staticmethod
202 def unpack(reader):
203 obj = bsn_flow_checksum_bucket_stats_entry()
204 obj.checksum = reader.read("!Q")[0]
205 return obj
206
207 def __eq__(self, other):
208 if type(self) != type(other): return False
209 if self.checksum != other.checksum: return False
210 return True
211
212 def pretty_print(self, q):
213 q.text("bsn_flow_checksum_bucket_stats_entry {")
214 with q.group():
215 with q.indent(2):
216 q.breakable()
217 q.text("checksum = ");
218 q.text("%#x" % self.checksum)
219 q.breakable()
220 q.text('}')
221
222
223class bsn_generic_stats_entry(loxi.OFObject):
224
225 def __init__(self, tlvs=None):
226 if tlvs != None:
227 self.tlvs = tlvs
228 else:
229 self.tlvs = []
230 return
231
232 def pack(self):
233 packed = []
234 packed.append(struct.pack("!H", 0)) # placeholder for length at index 0
235 packed.append(loxi.generic_util.pack_list(self.tlvs))
236 length = sum([len(x) for x in packed])
237 packed[0] = struct.pack("!H", length)
238 return ''.join(packed)
239
240 @staticmethod
241 def unpack(reader):
242 obj = bsn_generic_stats_entry()
243 _length = reader.read("!H")[0]
244 orig_reader = reader
245 reader = orig_reader.slice(_length, 2)
246 obj.tlvs = loxi.generic_util.unpack_list(reader, ofp.bsn_tlv.bsn_tlv.unpack)
247 return obj
248
249 def __eq__(self, other):
250 if type(self) != type(other): return False
251 if self.tlvs != other.tlvs: return False
252 return True
253
254 def pretty_print(self, q):
255 q.text("bsn_generic_stats_entry {")
256 with q.group():
257 with q.indent(2):
258 q.breakable()
259 q.text("tlvs = ");
260 q.pp(self.tlvs)
261 q.breakable()
262 q.text('}')
263
264
265class bsn_gentable_bucket_stats_entry(loxi.OFObject):
266
267 def __init__(self, checksum=None):
268 if checksum != None:
269 self.checksum = checksum
270 else:
271 self.checksum = 0
272 return
273
274 def pack(self):
275 packed = []
276 packed.append(util.pack_checksum_128(self.checksum))
277 return ''.join(packed)
278
279 @staticmethod
280 def unpack(reader):
281 obj = bsn_gentable_bucket_stats_entry()
282 obj.checksum = util.unpack_checksum_128(reader)
283 return obj
284
285 def __eq__(self, other):
286 if type(self) != type(other): return False
287 if self.checksum != other.checksum: return False
288 return True
289
290 def pretty_print(self, q):
291 q.text("bsn_gentable_bucket_stats_entry {")
292 with q.group():
293 with q.indent(2):
294 q.breakable()
295 q.text("checksum = ");
296 q.pp(self.checksum)
297 q.breakable()
298 q.text('}')
299
300
301class bsn_gentable_desc_stats_entry(loxi.OFObject):
302
303 def __init__(self, table_id=None, name=None, buckets_size=None, max_entries=None):
304 if table_id != None:
305 self.table_id = table_id
306 else:
307 self.table_id = 0
308 if name != None:
309 self.name = name
310 else:
311 self.name = ""
312 if buckets_size != None:
313 self.buckets_size = buckets_size
314 else:
315 self.buckets_size = 0
316 if max_entries != None:
317 self.max_entries = max_entries
318 else:
319 self.max_entries = 0
320 return
321
322 def pack(self):
323 packed = []
324 packed.append(struct.pack("!H", 0)) # placeholder for length at index 0
325 packed.append(struct.pack("!H", self.table_id))
326 packed.append(struct.pack("!32s", self.name))
327 packed.append(struct.pack("!L", self.buckets_size))
328 packed.append(struct.pack("!L", self.max_entries))
329 packed.append('\x00' * 4)
330 length = sum([len(x) for x in packed])
331 packed[0] = struct.pack("!H", length)
332 return ''.join(packed)
333
334 @staticmethod
335 def unpack(reader):
336 obj = bsn_gentable_desc_stats_entry()
337 _length = reader.read("!H")[0]
338 orig_reader = reader
339 reader = orig_reader.slice(_length, 2)
340 obj.table_id = reader.read("!H")[0]
341 obj.name = reader.read("!32s")[0].rstrip("\x00")
342 obj.buckets_size = reader.read("!L")[0]
343 obj.max_entries = reader.read("!L")[0]
344 reader.skip(4)
345 return obj
346
347 def __eq__(self, other):
348 if type(self) != type(other): return False
349 if self.table_id != other.table_id: return False
350 if self.name != other.name: return False
351 if self.buckets_size != other.buckets_size: return False
352 if self.max_entries != other.max_entries: return False
353 return True
354
355 def pretty_print(self, q):
356 q.text("bsn_gentable_desc_stats_entry {")
357 with q.group():
358 with q.indent(2):
359 q.breakable()
360 q.text("table_id = ");
361 q.text("%#x" % self.table_id)
362 q.text(","); q.breakable()
363 q.text("name = ");
364 q.pp(self.name)
365 q.text(","); q.breakable()
366 q.text("buckets_size = ");
367 q.text("%#x" % self.buckets_size)
368 q.text(","); q.breakable()
369 q.text("max_entries = ");
370 q.text("%#x" % self.max_entries)
371 q.breakable()
372 q.text('}')
373
374
375class bsn_gentable_entry_desc_stats_entry(loxi.OFObject):
376
377 def __init__(self, checksum=None, key=None, value=None):
378 if checksum != None:
379 self.checksum = checksum
380 else:
381 self.checksum = 0
382 if key != None:
383 self.key = key
384 else:
385 self.key = []
386 if value != None:
387 self.value = value
388 else:
389 self.value = []
390 return
391
392 def pack(self):
393 packed = []
394 packed.append(struct.pack("!H", 0)) # placeholder for length at index 0
395 packed.append(struct.pack("!H", 0)) # placeholder for key_length at index 1
396 packed.append(util.pack_checksum_128(self.checksum))
397 packed.append(loxi.generic_util.pack_list(self.key))
398 packed[1] = struct.pack("!H", len(packed[-1]))
399 packed.append(loxi.generic_util.pack_list(self.value))
400 length = sum([len(x) for x in packed])
401 packed[0] = struct.pack("!H", length)
402 return ''.join(packed)
403
404 @staticmethod
405 def unpack(reader):
406 obj = bsn_gentable_entry_desc_stats_entry()
407 _length = reader.read("!H")[0]
408 orig_reader = reader
409 reader = orig_reader.slice(_length, 2)
410 _key_length = reader.read("!H")[0]
411 obj.checksum = util.unpack_checksum_128(reader)
412 obj.key = loxi.generic_util.unpack_list(reader.slice(_key_length), ofp.bsn_tlv.bsn_tlv.unpack)
413 obj.value = loxi.generic_util.unpack_list(reader, ofp.bsn_tlv.bsn_tlv.unpack)
414 return obj
415
416 def __eq__(self, other):
417 if type(self) != type(other): return False
418 if self.checksum != other.checksum: return False
419 if self.key != other.key: return False
420 if self.value != other.value: return False
421 return True
422
423 def pretty_print(self, q):
424 q.text("bsn_gentable_entry_desc_stats_entry {")
425 with q.group():
426 with q.indent(2):
427 q.breakable()
428 q.text("checksum = ");
429 q.pp(self.checksum)
430 q.text(","); q.breakable()
431 q.text("key = ");
432 q.pp(self.key)
433 q.text(","); q.breakable()
434 q.text("value = ");
435 q.pp(self.value)
436 q.breakable()
437 q.text('}')
438
439
440class bsn_gentable_entry_stats_entry(loxi.OFObject):
441
442 def __init__(self, key=None, stats=None):
443 if key != None:
444 self.key = key
445 else:
446 self.key = []
447 if stats != None:
448 self.stats = stats
449 else:
450 self.stats = []
451 return
452
453 def pack(self):
454 packed = []
455 packed.append(struct.pack("!H", 0)) # placeholder for length at index 0
456 packed.append(struct.pack("!H", 0)) # placeholder for key_length at index 1
457 packed.append(loxi.generic_util.pack_list(self.key))
458 packed[1] = struct.pack("!H", len(packed[-1]))
459 packed.append(loxi.generic_util.pack_list(self.stats))
460 length = sum([len(x) for x in packed])
461 packed[0] = struct.pack("!H", length)
462 return ''.join(packed)
463
464 @staticmethod
465 def unpack(reader):
466 obj = bsn_gentable_entry_stats_entry()
467 _length = reader.read("!H")[0]
468 orig_reader = reader
469 reader = orig_reader.slice(_length, 2)
470 _key_length = reader.read("!H")[0]
471 obj.key = loxi.generic_util.unpack_list(reader.slice(_key_length), ofp.bsn_tlv.bsn_tlv.unpack)
472 obj.stats = loxi.generic_util.unpack_list(reader, ofp.bsn_tlv.bsn_tlv.unpack)
473 return obj
474
475 def __eq__(self, other):
476 if type(self) != type(other): return False
477 if self.key != other.key: return False
478 if self.stats != other.stats: return False
479 return True
480
481 def pretty_print(self, q):
482 q.text("bsn_gentable_entry_stats_entry {")
483 with q.group():
484 with q.indent(2):
485 q.breakable()
486 q.text("key = ");
487 q.pp(self.key)
488 q.text(","); q.breakable()
489 q.text("stats = ");
490 q.pp(self.stats)
491 q.breakable()
492 q.text('}')
493
494
495class bsn_gentable_stats_entry(loxi.OFObject):
496
497 def __init__(self, table_id=None, entry_count=None, checksum=None):
498 if table_id != None:
499 self.table_id = table_id
500 else:
501 self.table_id = 0
502 if entry_count != None:
503 self.entry_count = entry_count
504 else:
505 self.entry_count = 0
506 if checksum != None:
507 self.checksum = checksum
508 else:
509 self.checksum = 0
510 return
511
512 def pack(self):
513 packed = []
514 packed.append(struct.pack("!H", self.table_id))
515 packed.append('\x00' * 2)
516 packed.append(struct.pack("!L", self.entry_count))
517 packed.append(util.pack_checksum_128(self.checksum))
518 return ''.join(packed)
519
520 @staticmethod
521 def unpack(reader):
522 obj = bsn_gentable_stats_entry()
523 obj.table_id = reader.read("!H")[0]
524 reader.skip(2)
525 obj.entry_count = reader.read("!L")[0]
526 obj.checksum = util.unpack_checksum_128(reader)
527 return obj
528
529 def __eq__(self, other):
530 if type(self) != type(other): return False
531 if self.table_id != other.table_id: return False
532 if self.entry_count != other.entry_count: return False
533 if self.checksum != other.checksum: return False
534 return True
535
536 def pretty_print(self, q):
537 q.text("bsn_gentable_stats_entry {")
538 with q.group():
539 with q.indent(2):
540 q.breakable()
541 q.text("table_id = ");
542 q.text("%#x" % self.table_id)
543 q.text(","); q.breakable()
544 q.text("entry_count = ");
545 q.text("%#x" % self.entry_count)
546 q.text(","); q.breakable()
547 q.text("checksum = ");
548 q.pp(self.checksum)
549 q.breakable()
550 q.text('}')
551
552
553class bsn_interface(loxi.OFObject):
554
555 def __init__(self, hw_addr=None, name=None, ipv4_addr=None, ipv4_netmask=None):
556 if hw_addr != None:
557 self.hw_addr = hw_addr
558 else:
559 self.hw_addr = [0,0,0,0,0,0]
560 if name != None:
561 self.name = name
562 else:
563 self.name = ""
564 if ipv4_addr != None:
565 self.ipv4_addr = ipv4_addr
566 else:
567 self.ipv4_addr = 0
568 if ipv4_netmask != None:
569 self.ipv4_netmask = ipv4_netmask
570 else:
571 self.ipv4_netmask = 0
572 return
573
574 def pack(self):
575 packed = []
576 packed.append(struct.pack("!6B", *self.hw_addr))
577 packed.append('\x00' * 2)
578 packed.append(struct.pack("!16s", self.name))
579 packed.append(struct.pack("!L", self.ipv4_addr))
580 packed.append(struct.pack("!L", self.ipv4_netmask))
581 return ''.join(packed)
582
583 @staticmethod
584 def unpack(reader):
585 obj = bsn_interface()
586 obj.hw_addr = list(reader.read('!6B'))
587 reader.skip(2)
588 obj.name = reader.read("!16s")[0].rstrip("\x00")
589 obj.ipv4_addr = reader.read("!L")[0]
590 obj.ipv4_netmask = reader.read("!L")[0]
591 return obj
592
593 def __eq__(self, other):
594 if type(self) != type(other): return False
595 if self.hw_addr != other.hw_addr: return False
596 if self.name != other.name: return False
597 if self.ipv4_addr != other.ipv4_addr: return False
598 if self.ipv4_netmask != other.ipv4_netmask: return False
599 return True
600
601 def pretty_print(self, q):
602 q.text("bsn_interface {")
603 with q.group():
604 with q.indent(2):
605 q.breakable()
606 q.text("hw_addr = ");
607 q.text(util.pretty_mac(self.hw_addr))
608 q.text(","); q.breakable()
609 q.text("name = ");
610 q.pp(self.name)
611 q.text(","); q.breakable()
612 q.text("ipv4_addr = ");
613 q.text(util.pretty_ipv4(self.ipv4_addr))
614 q.text(","); q.breakable()
615 q.text("ipv4_netmask = ");
616 q.text(util.pretty_ipv4(self.ipv4_netmask))
617 q.breakable()
618 q.text('}')
619
620
621class bsn_lacp_stats_entry(loxi.OFObject):
622
623 def __init__(self, port_no=None, actor_sys_priority=None, actor_sys_mac=None, actor_port_priority=None, actor_port_num=None, actor_key=None, convergence_status=None, partner_sys_priority=None, partner_sys_mac=None, partner_port_priority=None, partner_port_num=None, partner_key=None):
624 if port_no != None:
625 self.port_no = port_no
626 else:
627 self.port_no = 0
628 if actor_sys_priority != None:
629 self.actor_sys_priority = actor_sys_priority
630 else:
631 self.actor_sys_priority = 0
632 if actor_sys_mac != None:
633 self.actor_sys_mac = actor_sys_mac
634 else:
635 self.actor_sys_mac = [0,0,0,0,0,0]
636 if actor_port_priority != None:
637 self.actor_port_priority = actor_port_priority
638 else:
639 self.actor_port_priority = 0
640 if actor_port_num != None:
641 self.actor_port_num = actor_port_num
642 else:
643 self.actor_port_num = 0
644 if actor_key != None:
645 self.actor_key = actor_key
646 else:
647 self.actor_key = 0
648 if convergence_status != None:
649 self.convergence_status = convergence_status
650 else:
651 self.convergence_status = 0
652 if partner_sys_priority != None:
653 self.partner_sys_priority = partner_sys_priority
654 else:
655 self.partner_sys_priority = 0
656 if partner_sys_mac != None:
657 self.partner_sys_mac = partner_sys_mac
658 else:
659 self.partner_sys_mac = [0,0,0,0,0,0]
660 if partner_port_priority != None:
661 self.partner_port_priority = partner_port_priority
662 else:
663 self.partner_port_priority = 0
664 if partner_port_num != None:
665 self.partner_port_num = partner_port_num
666 else:
667 self.partner_port_num = 0
668 if partner_key != None:
669 self.partner_key = partner_key
670 else:
671 self.partner_key = 0
672 return
673
674 def pack(self):
675 packed = []
676 packed.append(util.pack_port_no(self.port_no))
677 packed.append(struct.pack("!H", self.actor_sys_priority))
678 packed.append(struct.pack("!6B", *self.actor_sys_mac))
679 packed.append(struct.pack("!H", self.actor_port_priority))
680 packed.append(struct.pack("!H", self.actor_port_num))
681 packed.append(struct.pack("!H", self.actor_key))
682 packed.append(struct.pack("!B", self.convergence_status))
683 packed.append('\x00' * 1)
684 packed.append(struct.pack("!H", self.partner_sys_priority))
685 packed.append(struct.pack("!6B", *self.partner_sys_mac))
686 packed.append(struct.pack("!H", self.partner_port_priority))
687 packed.append(struct.pack("!H", self.partner_port_num))
688 packed.append(struct.pack("!H", self.partner_key))
689 packed.append('\x00' * 2)
690 return ''.join(packed)
691
692 @staticmethod
693 def unpack(reader):
694 obj = bsn_lacp_stats_entry()
695 obj.port_no = util.unpack_port_no(reader)
696 obj.actor_sys_priority = reader.read("!H")[0]
697 obj.actor_sys_mac = list(reader.read('!6B'))
698 obj.actor_port_priority = reader.read("!H")[0]
699 obj.actor_port_num = reader.read("!H")[0]
700 obj.actor_key = reader.read("!H")[0]
701 obj.convergence_status = reader.read("!B")[0]
702 reader.skip(1)
703 obj.partner_sys_priority = reader.read("!H")[0]
704 obj.partner_sys_mac = list(reader.read('!6B'))
705 obj.partner_port_priority = reader.read("!H")[0]
706 obj.partner_port_num = reader.read("!H")[0]
707 obj.partner_key = reader.read("!H")[0]
708 reader.skip(2)
709 return obj
710
711 def __eq__(self, other):
712 if type(self) != type(other): return False
713 if self.port_no != other.port_no: return False
714 if self.actor_sys_priority != other.actor_sys_priority: return False
715 if self.actor_sys_mac != other.actor_sys_mac: return False
716 if self.actor_port_priority != other.actor_port_priority: return False
717 if self.actor_port_num != other.actor_port_num: return False
718 if self.actor_key != other.actor_key: return False
719 if self.convergence_status != other.convergence_status: return False
720 if self.partner_sys_priority != other.partner_sys_priority: return False
721 if self.partner_sys_mac != other.partner_sys_mac: return False
722 if self.partner_port_priority != other.partner_port_priority: return False
723 if self.partner_port_num != other.partner_port_num: return False
724 if self.partner_key != other.partner_key: return False
725 return True
726
727 def pretty_print(self, q):
728 q.text("bsn_lacp_stats_entry {")
729 with q.group():
730 with q.indent(2):
731 q.breakable()
732 q.text("port_no = ");
733 q.text(util.pretty_port(self.port_no))
734 q.text(","); q.breakable()
735 q.text("actor_sys_priority = ");
736 q.text("%#x" % self.actor_sys_priority)
737 q.text(","); q.breakable()
738 q.text("actor_sys_mac = ");
739 q.text(util.pretty_mac(self.actor_sys_mac))
740 q.text(","); q.breakable()
741 q.text("actor_port_priority = ");
742 q.text("%#x" % self.actor_port_priority)
743 q.text(","); q.breakable()
744 q.text("actor_port_num = ");
745 q.text("%#x" % self.actor_port_num)
746 q.text(","); q.breakable()
747 q.text("actor_key = ");
748 q.text("%#x" % self.actor_key)
749 q.text(","); q.breakable()
750 q.text("convergence_status = ");
751 q.text("%#x" % self.convergence_status)
752 q.text(","); q.breakable()
753 q.text("partner_sys_priority = ");
754 q.text("%#x" % self.partner_sys_priority)
755 q.text(","); q.breakable()
756 q.text("partner_sys_mac = ");
757 q.text(util.pretty_mac(self.partner_sys_mac))
758 q.text(","); q.breakable()
759 q.text("partner_port_priority = ");
760 q.text("%#x" % self.partner_port_priority)
761 q.text(","); q.breakable()
762 q.text("partner_port_num = ");
763 q.text("%#x" % self.partner_port_num)
764 q.text(","); q.breakable()
765 q.text("partner_key = ");
766 q.text("%#x" % self.partner_key)
767 q.breakable()
768 q.text('}')
769
770
771class bsn_port_counter_stats_entry(loxi.OFObject):
772
773 def __init__(self, port_no=None, values=None):
774 if port_no != None:
775 self.port_no = port_no
776 else:
777 self.port_no = 0
778 if values != None:
779 self.values = values
780 else:
781 self.values = []
782 return
783
784 def pack(self):
785 packed = []
786 packed.append(struct.pack("!H", 0)) # placeholder for length at index 0
787 packed.append('\x00' * 2)
788 packed.append(util.pack_port_no(self.port_no))
789 packed.append(loxi.generic_util.pack_list(self.values))
790 length = sum([len(x) for x in packed])
791 packed[0] = struct.pack("!H", length)
792 return ''.join(packed)
793
794 @staticmethod
795 def unpack(reader):
796 obj = bsn_port_counter_stats_entry()
797 _length = reader.read("!H")[0]
798 orig_reader = reader
799 reader = orig_reader.slice(_length, 2)
800 reader.skip(2)
801 obj.port_no = util.unpack_port_no(reader)
802 obj.values = loxi.generic_util.unpack_list(reader, ofp.common.uint64.unpack)
803 return obj
804
805 def __eq__(self, other):
806 if type(self) != type(other): return False
807 if self.port_no != other.port_no: return False
808 if self.values != other.values: return False
809 return True
810
811 def pretty_print(self, q):
812 q.text("bsn_port_counter_stats_entry {")
813 with q.group():
814 with q.indent(2):
815 q.breakable()
816 q.text("port_no = ");
817 q.text(util.pretty_port(self.port_no))
818 q.text(","); q.breakable()
819 q.text("values = ");
820 q.pp(self.values)
821 q.breakable()
822 q.text('}')
823
824
825class bsn_switch_pipeline_stats_entry(loxi.OFObject):
826
827 def __init__(self, pipeline=None):
828 if pipeline != None:
829 self.pipeline = pipeline
830 else:
831 self.pipeline = ""
832 return
833
834 def pack(self):
835 packed = []
836 packed.append(struct.pack("!256s", self.pipeline))
837 return ''.join(packed)
838
839 @staticmethod
840 def unpack(reader):
841 obj = bsn_switch_pipeline_stats_entry()
842 obj.pipeline = reader.read("!256s")[0].rstrip("\x00")
843 return obj
844
845 def __eq__(self, other):
846 if type(self) != type(other): return False
847 if self.pipeline != other.pipeline: return False
848 return True
849
850 def pretty_print(self, q):
851 q.text("bsn_switch_pipeline_stats_entry {")
852 with q.group():
853 with q.indent(2):
854 q.breakable()
855 q.text("pipeline = ");
856 q.pp(self.pipeline)
857 q.breakable()
858 q.text('}')
859
860
861class bsn_table_checksum_stats_entry(loxi.OFObject):
862
863 def __init__(self, table_id=None, checksum=None):
864 if table_id != None:
865 self.table_id = table_id
866 else:
867 self.table_id = 0
868 if checksum != None:
869 self.checksum = checksum
870 else:
871 self.checksum = 0
872 return
873
874 def pack(self):
875 packed = []
876 packed.append(struct.pack("!B", self.table_id))
877 packed.append(struct.pack("!Q", self.checksum))
878 return ''.join(packed)
879
880 @staticmethod
881 def unpack(reader):
882 obj = bsn_table_checksum_stats_entry()
883 obj.table_id = reader.read("!B")[0]
884 obj.checksum = reader.read("!Q")[0]
885 return obj
886
887 def __eq__(self, other):
888 if type(self) != type(other): return False
889 if self.table_id != other.table_id: return False
890 if self.checksum != other.checksum: return False
891 return True
892
893 def pretty_print(self, q):
894 q.text("bsn_table_checksum_stats_entry {")
895 with q.group():
896 with q.indent(2):
897 q.breakable()
898 q.text("table_id = ");
899 q.text("%#x" % self.table_id)
900 q.text(","); q.breakable()
901 q.text("checksum = ");
902 q.text("%#x" % self.checksum)
903 q.breakable()
904 q.text('}')
905
906
907class bsn_tlv_vlan_mac_list(loxi.OFObject):
908 type = 98
909
910 def __init__(self, key=None):
911 if key != None:
912 self.key = key
913 else:
914 self.key = []
915 return
916
917 def pack(self):
918 packed = []
919 packed.append(struct.pack("!H", self.type))
920 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
921 packed.append(loxi.generic_util.pack_list(self.key))
922 length = sum([len(x) for x in packed])
923 packed[1] = struct.pack("!H", length)
924 return ''.join(packed)
925
926 @staticmethod
927 def unpack(reader):
928 obj = bsn_tlv_vlan_mac_list()
929 _type = reader.read("!H")[0]
930 assert(_type == 98)
931 _length = reader.read("!H")[0]
932 orig_reader = reader
933 reader = orig_reader.slice(_length, 4)
934 obj.key = loxi.generic_util.unpack_list(reader, ofp.common.bsn_vlan_mac.unpack)
935 return obj
936
937 def __eq__(self, other):
938 if type(self) != type(other): return False
939 if self.key != other.key: return False
940 return True
941
942 def pretty_print(self, q):
943 q.text("bsn_tlv_vlan_mac_list {")
944 with q.group():
945 with q.indent(2):
946 q.breakable()
947 q.text("key = ");
948 q.pp(self.key)
949 q.breakable()
950 q.text('}')
951
952
953class bsn_vport(loxi.OFObject):
954 subtypes = {}
955
956
957 def __init__(self, type=None):
958 if type != None:
959 self.type = type
960 else:
961 self.type = 0
962 return
963
964 def pack(self):
965 packed = []
966 packed.append(struct.pack("!H", self.type))
967 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
968 length = sum([len(x) for x in packed])
969 packed[1] = struct.pack("!H", length)
970 return ''.join(packed)
971
972 @staticmethod
973 def unpack(reader):
974 subtype, = reader.peek('!H', 0)
975 subclass = bsn_vport.subtypes.get(subtype)
976 if subclass:
977 return subclass.unpack(reader)
978
979 obj = bsn_vport()
980 obj.type = reader.read("!H")[0]
981 _length = reader.read("!H")[0]
982 orig_reader = reader
983 reader = orig_reader.slice(_length, 4)
984 return obj
985
986 def __eq__(self, other):
987 if type(self) != type(other): return False
988 if self.type != other.type: return False
989 return True
990
991 def pretty_print(self, q):
992 q.text("bsn_vport {")
993 with q.group():
994 with q.indent(2):
995 q.breakable()
996 q.breakable()
997 q.text('}')
998
999
1000class bsn_vlan_counter_stats_entry(loxi.OFObject):
1001
1002 def __init__(self, vlan_vid=None, values=None):
1003 if vlan_vid != None:
1004 self.vlan_vid = vlan_vid
1005 else:
1006 self.vlan_vid = 0
1007 if values != None:
1008 self.values = values
1009 else:
1010 self.values = []
1011 return
1012
1013 def pack(self):
1014 packed = []
1015 packed.append(struct.pack("!H", 0)) # placeholder for length at index 0
1016 packed.append(struct.pack("!H", self.vlan_vid))
1017 packed.append('\x00' * 4)
1018 packed.append(loxi.generic_util.pack_list(self.values))
1019 length = sum([len(x) for x in packed])
1020 packed[0] = struct.pack("!H", length)
1021 return ''.join(packed)
1022
1023 @staticmethod
1024 def unpack(reader):
1025 obj = bsn_vlan_counter_stats_entry()
1026 _length = reader.read("!H")[0]
1027 orig_reader = reader
1028 reader = orig_reader.slice(_length, 2)
1029 obj.vlan_vid = reader.read("!H")[0]
1030 reader.skip(4)
1031 obj.values = loxi.generic_util.unpack_list(reader, ofp.common.uint64.unpack)
1032 return obj
1033
1034 def __eq__(self, other):
1035 if type(self) != type(other): return False
1036 if self.vlan_vid != other.vlan_vid: return False
1037 if self.values != other.values: return False
1038 return True
1039
1040 def pretty_print(self, q):
1041 q.text("bsn_vlan_counter_stats_entry {")
1042 with q.group():
1043 with q.indent(2):
1044 q.breakable()
1045 q.text("vlan_vid = ");
1046 q.text("%#x" % self.vlan_vid)
1047 q.text(","); q.breakable()
1048 q.text("values = ");
1049 q.pp(self.values)
1050 q.breakable()
1051 q.text('}')
1052
1053
1054class bsn_vlan_mac(loxi.OFObject):
1055
1056 def __init__(self, vlan_vid=None, mac=None):
1057 if vlan_vid != None:
1058 self.vlan_vid = vlan_vid
1059 else:
1060 self.vlan_vid = 0
1061 if mac != None:
1062 self.mac = mac
1063 else:
1064 self.mac = [0,0,0,0,0,0]
1065 return
1066
1067 def pack(self):
1068 packed = []
1069 packed.append(struct.pack("!H", self.vlan_vid))
1070 packed.append(struct.pack("!6B", *self.mac))
1071 return ''.join(packed)
1072
1073 @staticmethod
1074 def unpack(reader):
1075 obj = bsn_vlan_mac()
1076 obj.vlan_vid = reader.read("!H")[0]
1077 obj.mac = list(reader.read('!6B'))
1078 return obj
1079
1080 def __eq__(self, other):
1081 if type(self) != type(other): return False
1082 if self.vlan_vid != other.vlan_vid: return False
1083 if self.mac != other.mac: return False
1084 return True
1085
1086 def pretty_print(self, q):
1087 q.text("bsn_vlan_mac {")
1088 with q.group():
1089 with q.indent(2):
1090 q.breakable()
1091 q.text("vlan_vid = ");
1092 q.text("%#x" % self.vlan_vid)
1093 q.text(","); q.breakable()
1094 q.text("mac = ");
1095 q.text(util.pretty_mac(self.mac))
1096 q.breakable()
1097 q.text('}')
1098
1099
1100class bsn_vport_l2gre(bsn_vport):
1101 type = 1
1102
1103 def __init__(self, flags=None, port_no=None, loopback_port_no=None, local_mac=None, nh_mac=None, src_ip=None, dst_ip=None, dscp=None, ttl=None, vpn=None, rate_limit=None, if_name=None):
1104 if flags != None:
1105 self.flags = flags
1106 else:
1107 self.flags = 0
1108 if port_no != None:
1109 self.port_no = port_no
1110 else:
1111 self.port_no = 0
1112 if loopback_port_no != None:
1113 self.loopback_port_no = loopback_port_no
1114 else:
1115 self.loopback_port_no = 0
1116 if local_mac != None:
1117 self.local_mac = local_mac
1118 else:
1119 self.local_mac = [0,0,0,0,0,0]
1120 if nh_mac != None:
1121 self.nh_mac = nh_mac
1122 else:
1123 self.nh_mac = [0,0,0,0,0,0]
1124 if src_ip != None:
1125 self.src_ip = src_ip
1126 else:
1127 self.src_ip = 0
1128 if dst_ip != None:
1129 self.dst_ip = dst_ip
1130 else:
1131 self.dst_ip = 0
1132 if dscp != None:
1133 self.dscp = dscp
1134 else:
1135 self.dscp = 0
1136 if ttl != None:
1137 self.ttl = ttl
1138 else:
1139 self.ttl = 0
1140 if vpn != None:
1141 self.vpn = vpn
1142 else:
1143 self.vpn = 0
1144 if rate_limit != None:
1145 self.rate_limit = rate_limit
1146 else:
1147 self.rate_limit = 0
1148 if if_name != None:
1149 self.if_name = if_name
1150 else:
1151 self.if_name = ""
1152 return
1153
1154 def pack(self):
1155 packed = []
1156 packed.append(struct.pack("!H", self.type))
1157 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1158 packed.append(struct.pack("!L", self.flags))
1159 packed.append(util.pack_port_no(self.port_no))
1160 packed.append(util.pack_port_no(self.loopback_port_no))
1161 packed.append(struct.pack("!6B", *self.local_mac))
1162 packed.append(struct.pack("!6B", *self.nh_mac))
1163 packed.append(struct.pack("!L", self.src_ip))
1164 packed.append(struct.pack("!L", self.dst_ip))
1165 packed.append(struct.pack("!B", self.dscp))
1166 packed.append(struct.pack("!B", self.ttl))
1167 packed.append('\x00' * 2)
1168 packed.append(struct.pack("!L", self.vpn))
1169 packed.append(struct.pack("!L", self.rate_limit))
1170 packed.append(struct.pack("!16s", self.if_name))
1171 length = sum([len(x) for x in packed])
1172 packed[1] = struct.pack("!H", length)
1173 return ''.join(packed)
1174
1175 @staticmethod
1176 def unpack(reader):
1177 obj = bsn_vport_l2gre()
1178 _type = reader.read("!H")[0]
1179 assert(_type == 1)
1180 _length = reader.read("!H")[0]
1181 orig_reader = reader
1182 reader = orig_reader.slice(_length, 4)
1183 obj.flags = reader.read("!L")[0]
1184 obj.port_no = util.unpack_port_no(reader)
1185 obj.loopback_port_no = util.unpack_port_no(reader)
1186 obj.local_mac = list(reader.read('!6B'))
1187 obj.nh_mac = list(reader.read('!6B'))
1188 obj.src_ip = reader.read("!L")[0]
1189 obj.dst_ip = reader.read("!L")[0]
1190 obj.dscp = reader.read("!B")[0]
1191 obj.ttl = reader.read("!B")[0]
1192 reader.skip(2)
1193 obj.vpn = reader.read("!L")[0]
1194 obj.rate_limit = reader.read("!L")[0]
1195 obj.if_name = reader.read("!16s")[0].rstrip("\x00")
1196 return obj
1197
1198 def __eq__(self, other):
1199 if type(self) != type(other): return False
1200 if self.flags != other.flags: return False
1201 if self.port_no != other.port_no: return False
1202 if self.loopback_port_no != other.loopback_port_no: return False
1203 if self.local_mac != other.local_mac: return False
1204 if self.nh_mac != other.nh_mac: return False
1205 if self.src_ip != other.src_ip: return False
1206 if self.dst_ip != other.dst_ip: return False
1207 if self.dscp != other.dscp: return False
1208 if self.ttl != other.ttl: return False
1209 if self.vpn != other.vpn: return False
1210 if self.rate_limit != other.rate_limit: return False
1211 if self.if_name != other.if_name: return False
1212 return True
1213
1214 def pretty_print(self, q):
1215 q.text("bsn_vport_l2gre {")
1216 with q.group():
1217 with q.indent(2):
1218 q.breakable()
1219 q.text("flags = ");
1220 q.text("%#x" % self.flags)
1221 q.text(","); q.breakable()
1222 q.text("port_no = ");
1223 q.text(util.pretty_port(self.port_no))
1224 q.text(","); q.breakable()
1225 q.text("loopback_port_no = ");
1226 q.text(util.pretty_port(self.loopback_port_no))
1227 q.text(","); q.breakable()
1228 q.text("local_mac = ");
1229 q.text(util.pretty_mac(self.local_mac))
1230 q.text(","); q.breakable()
1231 q.text("nh_mac = ");
1232 q.text(util.pretty_mac(self.nh_mac))
1233 q.text(","); q.breakable()
1234 q.text("src_ip = ");
1235 q.text(util.pretty_ipv4(self.src_ip))
1236 q.text(","); q.breakable()
1237 q.text("dst_ip = ");
1238 q.text(util.pretty_ipv4(self.dst_ip))
1239 q.text(","); q.breakable()
1240 q.text("dscp = ");
1241 q.text("%#x" % self.dscp)
1242 q.text(","); q.breakable()
1243 q.text("ttl = ");
1244 q.text("%#x" % self.ttl)
1245 q.text(","); q.breakable()
1246 q.text("vpn = ");
1247 q.text("%#x" % self.vpn)
1248 q.text(","); q.breakable()
1249 q.text("rate_limit = ");
1250 q.text("%#x" % self.rate_limit)
1251 q.text(","); q.breakable()
1252 q.text("if_name = ");
1253 q.pp(self.if_name)
1254 q.breakable()
1255 q.text('}')
1256
1257bsn_vport.subtypes[1] = bsn_vport_l2gre
1258
1259class bsn_vport_q_in_q(bsn_vport):
1260 type = 0
1261
1262 def __init__(self, port_no=None, ingress_tpid=None, ingress_vlan_id=None, egress_tpid=None, egress_vlan_id=None, if_name=None):
1263 if port_no != None:
1264 self.port_no = port_no
1265 else:
1266 self.port_no = 0
1267 if ingress_tpid != None:
1268 self.ingress_tpid = ingress_tpid
1269 else:
1270 self.ingress_tpid = 0
1271 if ingress_vlan_id != None:
1272 self.ingress_vlan_id = ingress_vlan_id
1273 else:
1274 self.ingress_vlan_id = 0
1275 if egress_tpid != None:
1276 self.egress_tpid = egress_tpid
1277 else:
1278 self.egress_tpid = 0
1279 if egress_vlan_id != None:
1280 self.egress_vlan_id = egress_vlan_id
1281 else:
1282 self.egress_vlan_id = 0
1283 if if_name != None:
1284 self.if_name = if_name
1285 else:
1286 self.if_name = ""
1287 return
1288
1289 def pack(self):
1290 packed = []
1291 packed.append(struct.pack("!H", self.type))
1292 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1293 packed.append(struct.pack("!L", self.port_no))
1294 packed.append(struct.pack("!H", self.ingress_tpid))
1295 packed.append(struct.pack("!H", self.ingress_vlan_id))
1296 packed.append(struct.pack("!H", self.egress_tpid))
1297 packed.append(struct.pack("!H", self.egress_vlan_id))
1298 packed.append(struct.pack("!16s", self.if_name))
1299 length = sum([len(x) for x in packed])
1300 packed[1] = struct.pack("!H", length)
1301 return ''.join(packed)
1302
1303 @staticmethod
1304 def unpack(reader):
1305 obj = bsn_vport_q_in_q()
1306 _type = reader.read("!H")[0]
1307 assert(_type == 0)
1308 _length = reader.read("!H")[0]
1309 orig_reader = reader
1310 reader = orig_reader.slice(_length, 4)
1311 obj.port_no = reader.read("!L")[0]
1312 obj.ingress_tpid = reader.read("!H")[0]
1313 obj.ingress_vlan_id = reader.read("!H")[0]
1314 obj.egress_tpid = reader.read("!H")[0]
1315 obj.egress_vlan_id = reader.read("!H")[0]
1316 obj.if_name = reader.read("!16s")[0].rstrip("\x00")
1317 return obj
1318
1319 def __eq__(self, other):
1320 if type(self) != type(other): return False
1321 if self.port_no != other.port_no: return False
1322 if self.ingress_tpid != other.ingress_tpid: return False
1323 if self.ingress_vlan_id != other.ingress_vlan_id: return False
1324 if self.egress_tpid != other.egress_tpid: return False
1325 if self.egress_vlan_id != other.egress_vlan_id: return False
1326 if self.if_name != other.if_name: return False
1327 return True
1328
1329 def pretty_print(self, q):
1330 q.text("bsn_vport_q_in_q {")
1331 with q.group():
1332 with q.indent(2):
1333 q.breakable()
1334 q.text("port_no = ");
1335 q.text("%#x" % self.port_no)
1336 q.text(","); q.breakable()
1337 q.text("ingress_tpid = ");
1338 q.text("%#x" % self.ingress_tpid)
1339 q.text(","); q.breakable()
1340 q.text("ingress_vlan_id = ");
1341 q.text("%#x" % self.ingress_vlan_id)
1342 q.text(","); q.breakable()
1343 q.text("egress_tpid = ");
1344 q.text("%#x" % self.egress_tpid)
1345 q.text(","); q.breakable()
1346 q.text("egress_vlan_id = ");
1347 q.text("%#x" % self.egress_vlan_id)
1348 q.text(","); q.breakable()
1349 q.text("if_name = ");
1350 q.pp(self.if_name)
1351 q.breakable()
1352 q.text('}')
1353
1354bsn_vport.subtypes[0] = bsn_vport_q_in_q
1355
1356class bsn_vrf_counter_stats_entry(loxi.OFObject):
1357
1358 def __init__(self, vrf=None, values=None):
1359 if vrf != None:
1360 self.vrf = vrf
1361 else:
1362 self.vrf = 0
1363 if values != None:
1364 self.values = values
1365 else:
1366 self.values = []
1367 return
1368
1369 def pack(self):
1370 packed = []
1371 packed.append(struct.pack("!H", 0)) # placeholder for length at index 0
1372 packed.append('\x00' * 2)
1373 packed.append(struct.pack("!L", self.vrf))
1374 packed.append(loxi.generic_util.pack_list(self.values))
1375 length = sum([len(x) for x in packed])
1376 packed[0] = struct.pack("!H", length)
1377 return ''.join(packed)
1378
1379 @staticmethod
1380 def unpack(reader):
1381 obj = bsn_vrf_counter_stats_entry()
1382 _length = reader.read("!H")[0]
1383 orig_reader = reader
1384 reader = orig_reader.slice(_length, 2)
1385 reader.skip(2)
1386 obj.vrf = reader.read("!L")[0]
1387 obj.values = loxi.generic_util.unpack_list(reader, ofp.common.uint64.unpack)
1388 return obj
1389
1390 def __eq__(self, other):
1391 if type(self) != type(other): return False
1392 if self.vrf != other.vrf: return False
1393 if self.values != other.values: return False
1394 return True
1395
1396 def pretty_print(self, q):
1397 q.text("bsn_vrf_counter_stats_entry {")
1398 with q.group():
1399 with q.indent(2):
1400 q.breakable()
1401 q.text("vrf = ");
1402 q.text("%#x" % self.vrf)
1403 q.text(","); q.breakable()
1404 q.text("values = ");
1405 q.pp(self.values)
1406 q.breakable()
1407 q.text('}')
1408
1409
1410class bucket(loxi.OFObject):
1411
1412 def __init__(self, weight=None, watch_port=None, watch_group=None, actions=None):
1413 if weight != None:
1414 self.weight = weight
1415 else:
1416 self.weight = 0
1417 if watch_port != None:
1418 self.watch_port = watch_port
1419 else:
1420 self.watch_port = 0
1421 if watch_group != None:
1422 self.watch_group = watch_group
1423 else:
1424 self.watch_group = 0
1425 if actions != None:
1426 self.actions = actions
1427 else:
1428 self.actions = []
1429 return
1430
1431 def pack(self):
1432 packed = []
1433 packed.append(struct.pack("!H", 0)) # placeholder for len at index 0
1434 packed.append(struct.pack("!H", self.weight))
1435 packed.append(util.pack_port_no(self.watch_port))
1436 packed.append(struct.pack("!L", self.watch_group))
1437 packed.append('\x00' * 4)
1438 packed.append(loxi.generic_util.pack_list(self.actions))
1439 length = sum([len(x) for x in packed])
1440 packed[0] = struct.pack("!H", length)
1441 return ''.join(packed)
1442
1443 @staticmethod
1444 def unpack(reader):
1445 obj = bucket()
1446 _len = reader.read("!H")[0]
1447 orig_reader = reader
1448 reader = orig_reader.slice(_len, 2)
1449 obj.weight = reader.read("!H")[0]
1450 obj.watch_port = util.unpack_port_no(reader)
1451 obj.watch_group = reader.read("!L")[0]
1452 reader.skip(4)
1453 obj.actions = loxi.generic_util.unpack_list(reader, ofp.action.action.unpack)
1454 return obj
1455
1456 def __eq__(self, other):
1457 if type(self) != type(other): return False
1458 if self.weight != other.weight: return False
1459 if self.watch_port != other.watch_port: return False
1460 if self.watch_group != other.watch_group: return False
1461 if self.actions != other.actions: return False
1462 return True
1463
1464 def pretty_print(self, q):
1465 q.text("bucket {")
1466 with q.group():
1467 with q.indent(2):
1468 q.breakable()
1469 q.text("weight = ");
1470 q.text("%#x" % self.weight)
1471 q.text(","); q.breakable()
1472 q.text("watch_port = ");
1473 q.text(util.pretty_port(self.watch_port))
1474 q.text(","); q.breakable()
1475 q.text("watch_group = ");
1476 q.text("%#x" % self.watch_group)
1477 q.text(","); q.breakable()
1478 q.text("actions = ");
1479 q.pp(self.actions)
1480 q.breakable()
1481 q.text('}')
1482
1483
1484class bucket_counter(loxi.OFObject):
1485
1486 def __init__(self, packet_count=None, byte_count=None):
1487 if packet_count != None:
1488 self.packet_count = packet_count
1489 else:
1490 self.packet_count = 0
1491 if byte_count != None:
1492 self.byte_count = byte_count
1493 else:
1494 self.byte_count = 0
1495 return
1496
1497 def pack(self):
1498 packed = []
1499 packed.append(struct.pack("!Q", self.packet_count))
1500 packed.append(struct.pack("!Q", self.byte_count))
1501 return ''.join(packed)
1502
1503 @staticmethod
1504 def unpack(reader):
1505 obj = bucket_counter()
1506 obj.packet_count = reader.read("!Q")[0]
1507 obj.byte_count = reader.read("!Q")[0]
1508 return obj
1509
1510 def __eq__(self, other):
1511 if type(self) != type(other): return False
1512 if self.packet_count != other.packet_count: return False
1513 if self.byte_count != other.byte_count: return False
1514 return True
1515
1516 def pretty_print(self, q):
1517 q.text("bucket_counter {")
1518 with q.group():
1519 with q.indent(2):
1520 q.breakable()
1521 q.text("packet_count = ");
1522 q.text("%#x" % self.packet_count)
1523 q.text(","); q.breakable()
1524 q.text("byte_count = ");
1525 q.text("%#x" % self.byte_count)
1526 q.breakable()
1527 q.text('}')
1528
1529
1530class flow_stats_entry(loxi.OFObject):
1531
1532 def __init__(self, table_id=None, duration_sec=None, duration_nsec=None, priority=None, idle_timeout=None, hard_timeout=None, flags=None, cookie=None, packet_count=None, byte_count=None, match=None, instructions=None):
1533 if table_id != None:
1534 self.table_id = table_id
1535 else:
1536 self.table_id = 0
1537 if duration_sec != None:
1538 self.duration_sec = duration_sec
1539 else:
1540 self.duration_sec = 0
1541 if duration_nsec != None:
1542 self.duration_nsec = duration_nsec
1543 else:
1544 self.duration_nsec = 0
1545 if priority != None:
1546 self.priority = priority
1547 else:
1548 self.priority = 0
1549 if idle_timeout != None:
1550 self.idle_timeout = idle_timeout
1551 else:
1552 self.idle_timeout = 0
1553 if hard_timeout != None:
1554 self.hard_timeout = hard_timeout
1555 else:
1556 self.hard_timeout = 0
1557 if flags != None:
1558 self.flags = flags
1559 else:
1560 self.flags = 0
1561 if cookie != None:
1562 self.cookie = cookie
1563 else:
1564 self.cookie = 0
1565 if packet_count != None:
1566 self.packet_count = packet_count
1567 else:
1568 self.packet_count = 0
1569 if byte_count != None:
1570 self.byte_count = byte_count
1571 else:
1572 self.byte_count = 0
1573 if match != None:
1574 self.match = match
1575 else:
1576 self.match = ofp.match()
1577 if instructions != None:
1578 self.instructions = instructions
1579 else:
1580 self.instructions = []
1581 return
1582
1583 def pack(self):
1584 packed = []
1585 packed.append(struct.pack("!H", 0)) # placeholder for length at index 0
1586 packed.append(struct.pack("!B", self.table_id))
1587 packed.append('\x00' * 1)
1588 packed.append(struct.pack("!L", self.duration_sec))
1589 packed.append(struct.pack("!L", self.duration_nsec))
1590 packed.append(struct.pack("!H", self.priority))
1591 packed.append(struct.pack("!H", self.idle_timeout))
1592 packed.append(struct.pack("!H", self.hard_timeout))
1593 packed.append(struct.pack("!H", self.flags))
1594 packed.append('\x00' * 4)
1595 packed.append(struct.pack("!Q", self.cookie))
1596 packed.append(struct.pack("!Q", self.packet_count))
1597 packed.append(struct.pack("!Q", self.byte_count))
1598 packed.append(self.match.pack())
1599 packed.append(loxi.generic_util.pack_list(self.instructions))
1600 length = sum([len(x) for x in packed])
1601 packed[0] = struct.pack("!H", length)
1602 return ''.join(packed)
1603
1604 @staticmethod
1605 def unpack(reader):
1606 obj = flow_stats_entry()
1607 _length = reader.read("!H")[0]
1608 orig_reader = reader
1609 reader = orig_reader.slice(_length, 2)
1610 obj.table_id = reader.read("!B")[0]
1611 reader.skip(1)
1612 obj.duration_sec = reader.read("!L")[0]
1613 obj.duration_nsec = reader.read("!L")[0]
1614 obj.priority = reader.read("!H")[0]
1615 obj.idle_timeout = reader.read("!H")[0]
1616 obj.hard_timeout = reader.read("!H")[0]
1617 obj.flags = reader.read("!H")[0]
1618 reader.skip(4)
1619 obj.cookie = reader.read("!Q")[0]
1620 obj.packet_count = reader.read("!Q")[0]
1621 obj.byte_count = reader.read("!Q")[0]
1622 obj.match = ofp.match.unpack(reader)
1623 obj.instructions = loxi.generic_util.unpack_list(reader, ofp.instruction.instruction.unpack)
1624 return obj
1625
1626 def __eq__(self, other):
1627 if type(self) != type(other): return False
1628 if self.table_id != other.table_id: return False
1629 if self.duration_sec != other.duration_sec: return False
1630 if self.duration_nsec != other.duration_nsec: return False
1631 if self.priority != other.priority: return False
1632 if self.idle_timeout != other.idle_timeout: return False
1633 if self.hard_timeout != other.hard_timeout: return False
1634 if self.flags != other.flags: return False
1635 if self.cookie != other.cookie: return False
1636 if self.packet_count != other.packet_count: return False
1637 if self.byte_count != other.byte_count: return False
1638 if self.match != other.match: return False
1639 if self.instructions != other.instructions: return False
1640 return True
1641
1642 def pretty_print(self, q):
1643 q.text("flow_stats_entry {")
1644 with q.group():
1645 with q.indent(2):
1646 q.breakable()
1647 q.text("table_id = ");
1648 q.text("%#x" % self.table_id)
1649 q.text(","); q.breakable()
1650 q.text("duration_sec = ");
1651 q.text("%#x" % self.duration_sec)
1652 q.text(","); q.breakable()
1653 q.text("duration_nsec = ");
1654 q.text("%#x" % self.duration_nsec)
1655 q.text(","); q.breakable()
1656 q.text("priority = ");
1657 q.text("%#x" % self.priority)
1658 q.text(","); q.breakable()
1659 q.text("idle_timeout = ");
1660 q.text("%#x" % self.idle_timeout)
1661 q.text(","); q.breakable()
1662 q.text("hard_timeout = ");
1663 q.text("%#x" % self.hard_timeout)
1664 q.text(","); q.breakable()
1665 q.text("flags = ");
1666 q.text("%#x" % self.flags)
1667 q.text(","); q.breakable()
1668 q.text("cookie = ");
1669 q.text("%#x" % self.cookie)
1670 q.text(","); q.breakable()
1671 q.text("packet_count = ");
1672 q.text("%#x" % self.packet_count)
1673 q.text(","); q.breakable()
1674 q.text("byte_count = ");
1675 q.text("%#x" % self.byte_count)
1676 q.text(","); q.breakable()
1677 q.text("match = ");
1678 q.pp(self.match)
1679 q.text(","); q.breakable()
1680 q.text("instructions = ");
1681 q.pp(self.instructions)
1682 q.breakable()
1683 q.text('}')
1684
1685
1686class group_desc_stats_entry(loxi.OFObject):
1687
1688 def __init__(self, group_type=None, group_id=None, buckets=None):
1689 if group_type != None:
1690 self.group_type = group_type
1691 else:
1692 self.group_type = 0
1693 if group_id != None:
1694 self.group_id = group_id
1695 else:
1696 self.group_id = 0
1697 if buckets != None:
1698 self.buckets = buckets
1699 else:
1700 self.buckets = []
1701 return
1702
1703 def pack(self):
1704 packed = []
1705 packed.append(struct.pack("!H", 0)) # placeholder for length at index 0
1706 packed.append(struct.pack("!B", self.group_type))
1707 packed.append('\x00' * 1)
1708 packed.append(struct.pack("!L", self.group_id))
1709 packed.append(loxi.generic_util.pack_list(self.buckets))
1710 length = sum([len(x) for x in packed])
1711 packed[0] = struct.pack("!H", length)
1712 return ''.join(packed)
1713
1714 @staticmethod
1715 def unpack(reader):
1716 obj = group_desc_stats_entry()
1717 _length = reader.read("!H")[0]
1718 orig_reader = reader
1719 reader = orig_reader.slice(_length, 2)
1720 obj.group_type = reader.read("!B")[0]
1721 reader.skip(1)
1722 obj.group_id = reader.read("!L")[0]
1723 obj.buckets = loxi.generic_util.unpack_list(reader, ofp.common.bucket.unpack)
1724 return obj
1725
1726 def __eq__(self, other):
1727 if type(self) != type(other): return False
1728 if self.group_type != other.group_type: return False
1729 if self.group_id != other.group_id: return False
1730 if self.buckets != other.buckets: return False
1731 return True
1732
1733 def pretty_print(self, q):
1734 q.text("group_desc_stats_entry {")
1735 with q.group():
1736 with q.indent(2):
1737 q.breakable()
1738 q.text("group_type = ");
1739 q.text("%#x" % self.group_type)
1740 q.text(","); q.breakable()
1741 q.text("group_id = ");
1742 q.text("%#x" % self.group_id)
1743 q.text(","); q.breakable()
1744 q.text("buckets = ");
1745 q.pp(self.buckets)
1746 q.breakable()
1747 q.text('}')
1748
1749
1750class group_stats_entry(loxi.OFObject):
1751
1752 def __init__(self, group_id=None, ref_count=None, packet_count=None, byte_count=None, duration_sec=None, duration_nsec=None, bucket_stats=None):
1753 if group_id != None:
1754 self.group_id = group_id
1755 else:
1756 self.group_id = 0
1757 if ref_count != None:
1758 self.ref_count = ref_count
1759 else:
1760 self.ref_count = 0
1761 if packet_count != None:
1762 self.packet_count = packet_count
1763 else:
1764 self.packet_count = 0
1765 if byte_count != None:
1766 self.byte_count = byte_count
1767 else:
1768 self.byte_count = 0
1769 if duration_sec != None:
1770 self.duration_sec = duration_sec
1771 else:
1772 self.duration_sec = 0
1773 if duration_nsec != None:
1774 self.duration_nsec = duration_nsec
1775 else:
1776 self.duration_nsec = 0
1777 if bucket_stats != None:
1778 self.bucket_stats = bucket_stats
1779 else:
1780 self.bucket_stats = []
1781 return
1782
1783 def pack(self):
1784 packed = []
1785 packed.append(struct.pack("!H", 0)) # placeholder for length at index 0
1786 packed.append('\x00' * 2)
1787 packed.append(struct.pack("!L", self.group_id))
1788 packed.append(struct.pack("!L", self.ref_count))
1789 packed.append('\x00' * 4)
1790 packed.append(struct.pack("!Q", self.packet_count))
1791 packed.append(struct.pack("!Q", self.byte_count))
1792 packed.append(struct.pack("!L", self.duration_sec))
1793 packed.append(struct.pack("!L", self.duration_nsec))
1794 packed.append(loxi.generic_util.pack_list(self.bucket_stats))
1795 length = sum([len(x) for x in packed])
1796 packed[0] = struct.pack("!H", length)
1797 return ''.join(packed)
1798
1799 @staticmethod
1800 def unpack(reader):
1801 obj = group_stats_entry()
1802 _length = reader.read("!H")[0]
1803 orig_reader = reader
1804 reader = orig_reader.slice(_length, 2)
1805 reader.skip(2)
1806 obj.group_id = reader.read("!L")[0]
1807 obj.ref_count = reader.read("!L")[0]
1808 reader.skip(4)
1809 obj.packet_count = reader.read("!Q")[0]
1810 obj.byte_count = reader.read("!Q")[0]
1811 obj.duration_sec = reader.read("!L")[0]
1812 obj.duration_nsec = reader.read("!L")[0]
1813 obj.bucket_stats = loxi.generic_util.unpack_list(reader, ofp.common.bucket_counter.unpack)
1814 return obj
1815
1816 def __eq__(self, other):
1817 if type(self) != type(other): return False
1818 if self.group_id != other.group_id: return False
1819 if self.ref_count != other.ref_count: return False
1820 if self.packet_count != other.packet_count: return False
1821 if self.byte_count != other.byte_count: return False
1822 if self.duration_sec != other.duration_sec: return False
1823 if self.duration_nsec != other.duration_nsec: return False
1824 if self.bucket_stats != other.bucket_stats: return False
1825 return True
1826
1827 def pretty_print(self, q):
1828 q.text("group_stats_entry {")
1829 with q.group():
1830 with q.indent(2):
1831 q.breakable()
1832 q.text("group_id = ");
1833 q.text("%#x" % self.group_id)
1834 q.text(","); q.breakable()
1835 q.text("ref_count = ");
1836 q.text("%#x" % self.ref_count)
1837 q.text(","); q.breakable()
1838 q.text("packet_count = ");
1839 q.text("%#x" % self.packet_count)
1840 q.text(","); q.breakable()
1841 q.text("byte_count = ");
1842 q.text("%#x" % self.byte_count)
1843 q.text(","); q.breakable()
1844 q.text("duration_sec = ");
1845 q.text("%#x" % self.duration_sec)
1846 q.text(","); q.breakable()
1847 q.text("duration_nsec = ");
1848 q.text("%#x" % self.duration_nsec)
1849 q.text(","); q.breakable()
1850 q.text("bucket_stats = ");
1851 q.pp(self.bucket_stats)
1852 q.breakable()
1853 q.text('}')
1854
1855
1856class hello_elem(loxi.OFObject):
1857 subtypes = {}
1858
1859
1860 def __init__(self, type=None):
1861 if type != None:
1862 self.type = type
1863 else:
1864 self.type = 0
1865 return
1866
1867 def pack(self):
1868 packed = []
1869 packed.append(struct.pack("!H", self.type))
1870 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1871 length = sum([len(x) for x in packed])
1872 packed[1] = struct.pack("!H", length)
1873 return ''.join(packed)
1874
1875 @staticmethod
1876 def unpack(reader):
1877 subtype, = reader.peek('!H', 0)
1878 subclass = hello_elem.subtypes.get(subtype)
1879 if subclass:
1880 return subclass.unpack(reader)
1881
1882 obj = hello_elem()
1883 obj.type = reader.read("!H")[0]
1884 _length = reader.read("!H")[0]
1885 orig_reader = reader
1886 reader = orig_reader.slice(_length, 4)
1887 return obj
1888
1889 def __eq__(self, other):
1890 if type(self) != type(other): return False
1891 if self.type != other.type: return False
1892 return True
1893
1894 def pretty_print(self, q):
1895 q.text("hello_elem {")
1896 with q.group():
1897 with q.indent(2):
1898 q.breakable()
1899 q.breakable()
1900 q.text('}')
1901
1902
1903class hello_elem_versionbitmap(hello_elem):
1904 type = 1
1905
1906 def __init__(self, bitmaps=None):
1907 if bitmaps != None:
1908 self.bitmaps = bitmaps
1909 else:
1910 self.bitmaps = []
1911 return
1912
1913 def pack(self):
1914 packed = []
1915 packed.append(struct.pack("!H", self.type))
1916 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1917 packed.append(loxi.generic_util.pack_list(self.bitmaps))
1918 length = sum([len(x) for x in packed])
1919 packed[1] = struct.pack("!H", length)
1920 return ''.join(packed)
1921
1922 @staticmethod
1923 def unpack(reader):
1924 obj = hello_elem_versionbitmap()
1925 _type = reader.read("!H")[0]
1926 assert(_type == 1)
1927 _length = reader.read("!H")[0]
1928 orig_reader = reader
1929 reader = orig_reader.slice(_length, 4)
1930 obj.bitmaps = loxi.generic_util.unpack_list(reader, ofp.common.uint32.unpack)
1931 return obj
1932
1933 def __eq__(self, other):
1934 if type(self) != type(other): return False
1935 if self.bitmaps != other.bitmaps: return False
1936 return True
1937
1938 def pretty_print(self, q):
1939 q.text("hello_elem_versionbitmap {")
1940 with q.group():
1941 with q.indent(2):
1942 q.breakable()
1943 q.text("bitmaps = ");
1944 q.pp(self.bitmaps)
1945 q.breakable()
1946 q.text('}')
1947
1948hello_elem.subtypes[1] = hello_elem_versionbitmap
1949
1950class match_v3(loxi.OFObject):
1951 type = 1
1952
1953 def __init__(self, oxm_list=None):
1954 if oxm_list != None:
1955 self.oxm_list = oxm_list
1956 else:
1957 self.oxm_list = []
1958 return
1959
1960 def pack(self):
1961 packed = []
1962 packed.append(struct.pack("!H", self.type))
1963 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1964 packed.append(loxi.generic_util.pack_list(self.oxm_list))
1965 length = sum([len(x) for x in packed])
1966 packed[1] = struct.pack("!H", length)
1967 packed.append(loxi.generic_util.pad_to(8, length))
1968 return ''.join(packed)
1969
1970 @staticmethod
1971 def unpack(reader):
1972 obj = match_v3()
1973 _type = reader.read("!H")[0]
1974 assert(_type == 1)
1975 _length = reader.read("!H")[0]
1976 orig_reader = reader
1977 reader = orig_reader.slice(_length, 4)
1978 obj.oxm_list = loxi.generic_util.unpack_list(reader, ofp.oxm.oxm.unpack)
1979 orig_reader.skip_align()
1980 return obj
1981
1982 def __eq__(self, other):
1983 if type(self) != type(other): return False
1984 if self.oxm_list != other.oxm_list: return False
1985 return True
1986
1987 def pretty_print(self, q):
1988 q.text("match_v3 {")
1989 with q.group():
1990 with q.indent(2):
1991 q.breakable()
1992 q.text("oxm_list = ");
1993 q.pp(self.oxm_list)
1994 q.breakable()
1995 q.text('}')
1996
1997
1998class meter_band_stats(loxi.OFObject):
1999
2000 def __init__(self, packet_band_count=None, byte_band_count=None):
2001 if packet_band_count != None:
2002 self.packet_band_count = packet_band_count
2003 else:
2004 self.packet_band_count = 0
2005 if byte_band_count != None:
2006 self.byte_band_count = byte_band_count
2007 else:
2008 self.byte_band_count = 0
2009 return
2010
2011 def pack(self):
2012 packed = []
2013 packed.append(struct.pack("!Q", self.packet_band_count))
2014 packed.append(struct.pack("!Q", self.byte_band_count))
2015 return ''.join(packed)
2016
2017 @staticmethod
2018 def unpack(reader):
2019 obj = meter_band_stats()
2020 obj.packet_band_count = reader.read("!Q")[0]
2021 obj.byte_band_count = reader.read("!Q")[0]
2022 return obj
2023
2024 def __eq__(self, other):
2025 if type(self) != type(other): return False
2026 if self.packet_band_count != other.packet_band_count: return False
2027 if self.byte_band_count != other.byte_band_count: return False
2028 return True
2029
2030 def pretty_print(self, q):
2031 q.text("meter_band_stats {")
2032 with q.group():
2033 with q.indent(2):
2034 q.breakable()
2035 q.text("packet_band_count = ");
2036 q.text("%#x" % self.packet_band_count)
2037 q.text(","); q.breakable()
2038 q.text("byte_band_count = ");
2039 q.text("%#x" % self.byte_band_count)
2040 q.breakable()
2041 q.text('}')
2042
2043
2044class meter_config(loxi.OFObject):
2045
2046 def __init__(self, flags=None, meter_id=None, entries=None):
2047 if flags != None:
2048 self.flags = flags
2049 else:
2050 self.flags = 0
2051 if meter_id != None:
2052 self.meter_id = meter_id
2053 else:
2054 self.meter_id = 0
2055 if entries != None:
2056 self.entries = entries
2057 else:
2058 self.entries = []
2059 return
2060
2061 def pack(self):
2062 packed = []
2063 packed.append(struct.pack("!H", 0)) # placeholder for length at index 0
2064 packed.append(struct.pack("!H", self.flags))
2065 packed.append(struct.pack("!L", self.meter_id))
2066 packed.append(loxi.generic_util.pack_list(self.entries))
2067 length = sum([len(x) for x in packed])
2068 packed[0] = struct.pack("!H", length)
2069 return ''.join(packed)
2070
2071 @staticmethod
2072 def unpack(reader):
2073 obj = meter_config()
2074 _length = reader.read("!H")[0]
2075 orig_reader = reader
2076 reader = orig_reader.slice(_length, 2)
2077 obj.flags = reader.read("!H")[0]
2078 obj.meter_id = reader.read("!L")[0]
2079 obj.entries = loxi.generic_util.unpack_list(reader, ofp.meter_band.meter_band.unpack)
2080 return obj
2081
2082 def __eq__(self, other):
2083 if type(self) != type(other): return False
2084 if self.flags != other.flags: return False
2085 if self.meter_id != other.meter_id: return False
2086 if self.entries != other.entries: return False
2087 return True
2088
2089 def pretty_print(self, q):
2090 q.text("meter_config {")
2091 with q.group():
2092 with q.indent(2):
2093 q.breakable()
2094 q.text("flags = ");
2095 q.text("%#x" % self.flags)
2096 q.text(","); q.breakable()
2097 q.text("meter_id = ");
2098 q.text("%#x" % self.meter_id)
2099 q.text(","); q.breakable()
2100 q.text("entries = ");
2101 q.pp(self.entries)
2102 q.breakable()
2103 q.text('}')
2104
2105
2106class meter_features(loxi.OFObject):
2107
2108 def __init__(self, max_meter=None, band_types=None, capabilities=None, max_bands=None, max_color=None):
2109 if max_meter != None:
2110 self.max_meter = max_meter
2111 else:
2112 self.max_meter = 0
2113 if band_types != None:
2114 self.band_types = band_types
2115 else:
2116 self.band_types = 0
2117 if capabilities != None:
2118 self.capabilities = capabilities
2119 else:
2120 self.capabilities = 0
2121 if max_bands != None:
2122 self.max_bands = max_bands
2123 else:
2124 self.max_bands = 0
2125 if max_color != None:
2126 self.max_color = max_color
2127 else:
2128 self.max_color = 0
2129 return
2130
2131 def pack(self):
2132 packed = []
2133 packed.append(struct.pack("!L", self.max_meter))
2134 packed.append(struct.pack("!L", self.band_types))
2135 packed.append(struct.pack("!L", self.capabilities))
2136 packed.append(struct.pack("!B", self.max_bands))
2137 packed.append(struct.pack("!B", self.max_color))
2138 packed.append('\x00' * 2)
2139 return ''.join(packed)
2140
2141 @staticmethod
2142 def unpack(reader):
2143 obj = meter_features()
2144 obj.max_meter = reader.read("!L")[0]
2145 obj.band_types = reader.read("!L")[0]
2146 obj.capabilities = reader.read("!L")[0]
2147 obj.max_bands = reader.read("!B")[0]
2148 obj.max_color = reader.read("!B")[0]
2149 reader.skip(2)
2150 return obj
2151
2152 def __eq__(self, other):
2153 if type(self) != type(other): return False
2154 if self.max_meter != other.max_meter: return False
2155 if self.band_types != other.band_types: return False
2156 if self.capabilities != other.capabilities: return False
2157 if self.max_bands != other.max_bands: return False
2158 if self.max_color != other.max_color: return False
2159 return True
2160
2161 def pretty_print(self, q):
2162 q.text("meter_features {")
2163 with q.group():
2164 with q.indent(2):
2165 q.breakable()
2166 q.text("max_meter = ");
2167 q.text("%#x" % self.max_meter)
2168 q.text(","); q.breakable()
2169 q.text("band_types = ");
2170 q.text("%#x" % self.band_types)
2171 q.text(","); q.breakable()
2172 q.text("capabilities = ");
2173 q.text("%#x" % self.capabilities)
2174 q.text(","); q.breakable()
2175 q.text("max_bands = ");
2176 q.text("%#x" % self.max_bands)
2177 q.text(","); q.breakable()
2178 q.text("max_color = ");
2179 q.text("%#x" % self.max_color)
2180 q.breakable()
2181 q.text('}')
2182
2183
2184class meter_stats(loxi.OFObject):
2185
2186 def __init__(self, meter_id=None, flow_count=None, packet_in_count=None, byte_in_count=None, duration_sec=None, duration_nsec=None, band_stats=None):
2187 if meter_id != None:
2188 self.meter_id = meter_id
2189 else:
2190 self.meter_id = 0
2191 if flow_count != None:
2192 self.flow_count = flow_count
2193 else:
2194 self.flow_count = 0
2195 if packet_in_count != None:
2196 self.packet_in_count = packet_in_count
2197 else:
2198 self.packet_in_count = 0
2199 if byte_in_count != None:
2200 self.byte_in_count = byte_in_count
2201 else:
2202 self.byte_in_count = 0
2203 if duration_sec != None:
2204 self.duration_sec = duration_sec
2205 else:
2206 self.duration_sec = 0
2207 if duration_nsec != None:
2208 self.duration_nsec = duration_nsec
2209 else:
2210 self.duration_nsec = 0
2211 if band_stats != None:
2212 self.band_stats = band_stats
2213 else:
2214 self.band_stats = []
2215 return
2216
2217 def pack(self):
2218 packed = []
2219 packed.append(struct.pack("!L", self.meter_id))
2220 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
2221 packed.append('\x00' * 6)
2222 packed.append(struct.pack("!L", self.flow_count))
2223 packed.append(struct.pack("!Q", self.packet_in_count))
2224 packed.append(struct.pack("!Q", self.byte_in_count))
2225 packed.append(struct.pack("!L", self.duration_sec))
2226 packed.append(struct.pack("!L", self.duration_nsec))
2227 packed.append(loxi.generic_util.pack_list(self.band_stats))
2228 length = sum([len(x) for x in packed])
2229 packed[1] = struct.pack("!H", length)
2230 return ''.join(packed)
2231
2232 @staticmethod
2233 def unpack(reader):
2234 obj = meter_stats()
2235 obj.meter_id = reader.read("!L")[0]
2236 _len = reader.read("!H")[0]
2237 orig_reader = reader
2238 reader = orig_reader.slice(_len, 6)
2239 reader.skip(6)
2240 obj.flow_count = reader.read("!L")[0]
2241 obj.packet_in_count = reader.read("!Q")[0]
2242 obj.byte_in_count = reader.read("!Q")[0]
2243 obj.duration_sec = reader.read("!L")[0]
2244 obj.duration_nsec = reader.read("!L")[0]
2245 obj.band_stats = loxi.generic_util.unpack_list(reader, ofp.common.meter_band_stats.unpack)
2246 return obj
2247
2248 def __eq__(self, other):
2249 if type(self) != type(other): return False
2250 if self.meter_id != other.meter_id: return False
2251 if self.flow_count != other.flow_count: return False
2252 if self.packet_in_count != other.packet_in_count: return False
2253 if self.byte_in_count != other.byte_in_count: return False
2254 if self.duration_sec != other.duration_sec: return False
2255 if self.duration_nsec != other.duration_nsec: return False
2256 if self.band_stats != other.band_stats: return False
2257 return True
2258
2259 def pretty_print(self, q):
2260 q.text("meter_stats {")
2261 with q.group():
2262 with q.indent(2):
2263 q.breakable()
2264 q.text("meter_id = ");
2265 q.text("%#x" % self.meter_id)
2266 q.text(","); q.breakable()
2267 q.text("flow_count = ");
2268 q.text("%#x" % self.flow_count)
2269 q.text(","); q.breakable()
2270 q.text("packet_in_count = ");
2271 q.text("%#x" % self.packet_in_count)
2272 q.text(","); q.breakable()
2273 q.text("byte_in_count = ");
2274 q.text("%#x" % self.byte_in_count)
2275 q.text(","); q.breakable()
2276 q.text("duration_sec = ");
2277 q.text("%#x" % self.duration_sec)
2278 q.text(","); q.breakable()
2279 q.text("duration_nsec = ");
2280 q.text("%#x" % self.duration_nsec)
2281 q.text(","); q.breakable()
2282 q.text("band_stats = ");
2283 q.pp(self.band_stats)
2284 q.breakable()
2285 q.text('}')
2286
2287
2288class packet_queue(loxi.OFObject):
2289
2290 def __init__(self, queue_id=None, port=None, properties=None):
2291 if queue_id != None:
2292 self.queue_id = queue_id
2293 else:
2294 self.queue_id = 0
2295 if port != None:
2296 self.port = port
2297 else:
2298 self.port = 0
2299 if properties != None:
2300 self.properties = properties
2301 else:
2302 self.properties = []
2303 return
2304
2305 def pack(self):
2306 packed = []
2307 packed.append(struct.pack("!L", self.queue_id))
2308 packed.append(util.pack_port_no(self.port))
2309 packed.append(struct.pack("!H", 0)) # placeholder for len at index 2
2310 packed.append('\x00' * 6)
2311 packed.append(loxi.generic_util.pack_list(self.properties))
2312 length = sum([len(x) for x in packed])
2313 packed[2] = struct.pack("!H", length)
2314 return ''.join(packed)
2315
2316 @staticmethod
2317 def unpack(reader):
2318 obj = packet_queue()
2319 obj.queue_id = reader.read("!L")[0]
2320 obj.port = util.unpack_port_no(reader)
2321 _len = reader.read("!H")[0]
2322 orig_reader = reader
2323 reader = orig_reader.slice(_len, 10)
2324 reader.skip(6)
2325 obj.properties = loxi.generic_util.unpack_list(reader, ofp.common.queue_prop.unpack)
2326 return obj
2327
2328 def __eq__(self, other):
2329 if type(self) != type(other): return False
2330 if self.queue_id != other.queue_id: return False
2331 if self.port != other.port: return False
2332 if self.properties != other.properties: return False
2333 return True
2334
2335 def pretty_print(self, q):
2336 q.text("packet_queue {")
2337 with q.group():
2338 with q.indent(2):
2339 q.breakable()
2340 q.text("queue_id = ");
2341 q.text("%#x" % self.queue_id)
2342 q.text(","); q.breakable()
2343 q.text("port = ");
2344 q.text(util.pretty_port(self.port))
2345 q.text(","); q.breakable()
2346 q.text("properties = ");
2347 q.pp(self.properties)
2348 q.breakable()
2349 q.text('}')
2350
2351
2352class port_desc(loxi.OFObject):
2353
2354 def __init__(self, port_no=None, hw_addr=None, name=None, config=None, state=None, curr=None, advertised=None, supported=None, peer=None, curr_speed=None, max_speed=None):
2355 if port_no != None:
2356 self.port_no = port_no
2357 else:
2358 self.port_no = 0
2359 if hw_addr != None:
2360 self.hw_addr = hw_addr
2361 else:
2362 self.hw_addr = [0,0,0,0,0,0]
2363 if name != None:
2364 self.name = name
2365 else:
2366 self.name = ""
2367 if config != None:
2368 self.config = config
2369 else:
2370 self.config = 0
2371 if state != None:
2372 self.state = state
2373 else:
2374 self.state = 0
2375 if curr != None:
2376 self.curr = curr
2377 else:
2378 self.curr = 0
2379 if advertised != None:
2380 self.advertised = advertised
2381 else:
2382 self.advertised = 0
2383 if supported != None:
2384 self.supported = supported
2385 else:
2386 self.supported = 0
2387 if peer != None:
2388 self.peer = peer
2389 else:
2390 self.peer = 0
2391 if curr_speed != None:
2392 self.curr_speed = curr_speed
2393 else:
2394 self.curr_speed = 0
2395 if max_speed != None:
2396 self.max_speed = max_speed
2397 else:
2398 self.max_speed = 0
2399 return
2400
2401 def pack(self):
2402 packed = []
2403 packed.append(util.pack_port_no(self.port_no))
2404 packed.append('\x00' * 4)
2405 packed.append(struct.pack("!6B", *self.hw_addr))
2406 packed.append('\x00' * 2)
2407 packed.append(struct.pack("!16s", self.name))
2408 packed.append(struct.pack("!L", self.config))
2409 packed.append(struct.pack("!L", self.state))
2410 packed.append(struct.pack("!L", self.curr))
2411 packed.append(struct.pack("!L", self.advertised))
2412 packed.append(struct.pack("!L", self.supported))
2413 packed.append(struct.pack("!L", self.peer))
2414 packed.append(struct.pack("!L", self.curr_speed))
2415 packed.append(struct.pack("!L", self.max_speed))
2416 return ''.join(packed)
2417
2418 @staticmethod
2419 def unpack(reader):
2420 obj = port_desc()
2421 obj.port_no = util.unpack_port_no(reader)
2422 reader.skip(4)
2423 obj.hw_addr = list(reader.read('!6B'))
2424 reader.skip(2)
2425 obj.name = reader.read("!16s")[0].rstrip("\x00")
2426 obj.config = reader.read("!L")[0]
2427 obj.state = reader.read("!L")[0]
2428 obj.curr = reader.read("!L")[0]
2429 obj.advertised = reader.read("!L")[0]
2430 obj.supported = reader.read("!L")[0]
2431 obj.peer = reader.read("!L")[0]
2432 obj.curr_speed = reader.read("!L")[0]
2433 obj.max_speed = reader.read("!L")[0]
2434 return obj
2435
2436 def __eq__(self, other):
2437 if type(self) != type(other): return False
2438 if self.port_no != other.port_no: return False
2439 if self.hw_addr != other.hw_addr: return False
2440 if self.name != other.name: return False
2441 if self.config != other.config: return False
2442 if self.state != other.state: return False
2443 if self.curr != other.curr: return False
2444 if self.advertised != other.advertised: return False
2445 if self.supported != other.supported: return False
2446 if self.peer != other.peer: return False
2447 if self.curr_speed != other.curr_speed: return False
2448 if self.max_speed != other.max_speed: return False
2449 return True
2450
2451 def pretty_print(self, q):
2452 q.text("port_desc {")
2453 with q.group():
2454 with q.indent(2):
2455 q.breakable()
2456 q.text("port_no = ");
2457 q.text(util.pretty_port(self.port_no))
2458 q.text(","); q.breakable()
2459 q.text("hw_addr = ");
2460 q.text(util.pretty_mac(self.hw_addr))
2461 q.text(","); q.breakable()
2462 q.text("name = ");
2463 q.pp(self.name)
2464 q.text(","); q.breakable()
2465 q.text("config = ");
2466 q.text("%#x" % self.config)
2467 q.text(","); q.breakable()
2468 q.text("state = ");
2469 q.text("%#x" % self.state)
2470 q.text(","); q.breakable()
2471 q.text("curr = ");
2472 q.text("%#x" % self.curr)
2473 q.text(","); q.breakable()
2474 q.text("advertised = ");
2475 q.text("%#x" % self.advertised)
2476 q.text(","); q.breakable()
2477 q.text("supported = ");
2478 q.text("%#x" % self.supported)
2479 q.text(","); q.breakable()
2480 q.text("peer = ");
2481 q.text("%#x" % self.peer)
2482 q.text(","); q.breakable()
2483 q.text("curr_speed = ");
2484 q.text("%#x" % self.curr_speed)
2485 q.text(","); q.breakable()
2486 q.text("max_speed = ");
2487 q.text("%#x" % self.max_speed)
2488 q.breakable()
2489 q.text('}')
2490
2491
2492class port_stats_entry(loxi.OFObject):
2493
2494 def __init__(self, port_no=None, rx_packets=None, tx_packets=None, rx_bytes=None, tx_bytes=None, rx_dropped=None, tx_dropped=None, rx_errors=None, tx_errors=None, rx_frame_err=None, rx_over_err=None, rx_crc_err=None, collisions=None, duration_sec=None, duration_nsec=None):
2495 if port_no != None:
2496 self.port_no = port_no
2497 else:
2498 self.port_no = 0
2499 if rx_packets != None:
2500 self.rx_packets = rx_packets
2501 else:
2502 self.rx_packets = 0
2503 if tx_packets != None:
2504 self.tx_packets = tx_packets
2505 else:
2506 self.tx_packets = 0
2507 if rx_bytes != None:
2508 self.rx_bytes = rx_bytes
2509 else:
2510 self.rx_bytes = 0
2511 if tx_bytes != None:
2512 self.tx_bytes = tx_bytes
2513 else:
2514 self.tx_bytes = 0
2515 if rx_dropped != None:
2516 self.rx_dropped = rx_dropped
2517 else:
2518 self.rx_dropped = 0
2519 if tx_dropped != None:
2520 self.tx_dropped = tx_dropped
2521 else:
2522 self.tx_dropped = 0
2523 if rx_errors != None:
2524 self.rx_errors = rx_errors
2525 else:
2526 self.rx_errors = 0
2527 if tx_errors != None:
2528 self.tx_errors = tx_errors
2529 else:
2530 self.tx_errors = 0
2531 if rx_frame_err != None:
2532 self.rx_frame_err = rx_frame_err
2533 else:
2534 self.rx_frame_err = 0
2535 if rx_over_err != None:
2536 self.rx_over_err = rx_over_err
2537 else:
2538 self.rx_over_err = 0
2539 if rx_crc_err != None:
2540 self.rx_crc_err = rx_crc_err
2541 else:
2542 self.rx_crc_err = 0
2543 if collisions != None:
2544 self.collisions = collisions
2545 else:
2546 self.collisions = 0
2547 if duration_sec != None:
2548 self.duration_sec = duration_sec
2549 else:
2550 self.duration_sec = 0
2551 if duration_nsec != None:
2552 self.duration_nsec = duration_nsec
2553 else:
2554 self.duration_nsec = 0
2555 return
2556
2557 def pack(self):
2558 packed = []
2559 packed.append(util.pack_port_no(self.port_no))
2560 packed.append('\x00' * 4)
2561 packed.append(struct.pack("!Q", self.rx_packets))
2562 packed.append(struct.pack("!Q", self.tx_packets))
2563 packed.append(struct.pack("!Q", self.rx_bytes))
2564 packed.append(struct.pack("!Q", self.tx_bytes))
2565 packed.append(struct.pack("!Q", self.rx_dropped))
2566 packed.append(struct.pack("!Q", self.tx_dropped))
2567 packed.append(struct.pack("!Q", self.rx_errors))
2568 packed.append(struct.pack("!Q", self.tx_errors))
2569 packed.append(struct.pack("!Q", self.rx_frame_err))
2570 packed.append(struct.pack("!Q", self.rx_over_err))
2571 packed.append(struct.pack("!Q", self.rx_crc_err))
2572 packed.append(struct.pack("!Q", self.collisions))
2573 packed.append(struct.pack("!L", self.duration_sec))
2574 packed.append(struct.pack("!L", self.duration_nsec))
2575 return ''.join(packed)
2576
2577 @staticmethod
2578 def unpack(reader):
2579 obj = port_stats_entry()
2580 obj.port_no = util.unpack_port_no(reader)
2581 reader.skip(4)
2582 obj.rx_packets = reader.read("!Q")[0]
2583 obj.tx_packets = reader.read("!Q")[0]
2584 obj.rx_bytes = reader.read("!Q")[0]
2585 obj.tx_bytes = reader.read("!Q")[0]
2586 obj.rx_dropped = reader.read("!Q")[0]
2587 obj.tx_dropped = reader.read("!Q")[0]
2588 obj.rx_errors = reader.read("!Q")[0]
2589 obj.tx_errors = reader.read("!Q")[0]
2590 obj.rx_frame_err = reader.read("!Q")[0]
2591 obj.rx_over_err = reader.read("!Q")[0]
2592 obj.rx_crc_err = reader.read("!Q")[0]
2593 obj.collisions = reader.read("!Q")[0]
2594 obj.duration_sec = reader.read("!L")[0]
2595 obj.duration_nsec = reader.read("!L")[0]
2596 return obj
2597
2598 def __eq__(self, other):
2599 if type(self) != type(other): return False
2600 if self.port_no != other.port_no: return False
2601 if self.rx_packets != other.rx_packets: return False
2602 if self.tx_packets != other.tx_packets: return False
2603 if self.rx_bytes != other.rx_bytes: return False
2604 if self.tx_bytes != other.tx_bytes: return False
2605 if self.rx_dropped != other.rx_dropped: return False
2606 if self.tx_dropped != other.tx_dropped: return False
2607 if self.rx_errors != other.rx_errors: return False
2608 if self.tx_errors != other.tx_errors: return False
2609 if self.rx_frame_err != other.rx_frame_err: return False
2610 if self.rx_over_err != other.rx_over_err: return False
2611 if self.rx_crc_err != other.rx_crc_err: return False
2612 if self.collisions != other.collisions: return False
2613 if self.duration_sec != other.duration_sec: return False
2614 if self.duration_nsec != other.duration_nsec: return False
2615 return True
2616
2617 def pretty_print(self, q):
2618 q.text("port_stats_entry {")
2619 with q.group():
2620 with q.indent(2):
2621 q.breakable()
2622 q.text("port_no = ");
2623 q.text(util.pretty_port(self.port_no))
2624 q.text(","); q.breakable()
2625 q.text("rx_packets = ");
2626 q.text("%#x" % self.rx_packets)
2627 q.text(","); q.breakable()
2628 q.text("tx_packets = ");
2629 q.text("%#x" % self.tx_packets)
2630 q.text(","); q.breakable()
2631 q.text("rx_bytes = ");
2632 q.text("%#x" % self.rx_bytes)
2633 q.text(","); q.breakable()
2634 q.text("tx_bytes = ");
2635 q.text("%#x" % self.tx_bytes)
2636 q.text(","); q.breakable()
2637 q.text("rx_dropped = ");
2638 q.text("%#x" % self.rx_dropped)
2639 q.text(","); q.breakable()
2640 q.text("tx_dropped = ");
2641 q.text("%#x" % self.tx_dropped)
2642 q.text(","); q.breakable()
2643 q.text("rx_errors = ");
2644 q.text("%#x" % self.rx_errors)
2645 q.text(","); q.breakable()
2646 q.text("tx_errors = ");
2647 q.text("%#x" % self.tx_errors)
2648 q.text(","); q.breakable()
2649 q.text("rx_frame_err = ");
2650 q.text("%#x" % self.rx_frame_err)
2651 q.text(","); q.breakable()
2652 q.text("rx_over_err = ");
2653 q.text("%#x" % self.rx_over_err)
2654 q.text(","); q.breakable()
2655 q.text("rx_crc_err = ");
2656 q.text("%#x" % self.rx_crc_err)
2657 q.text(","); q.breakable()
2658 q.text("collisions = ");
2659 q.text("%#x" % self.collisions)
2660 q.text(","); q.breakable()
2661 q.text("duration_sec = ");
2662 q.text("%#x" % self.duration_sec)
2663 q.text(","); q.breakable()
2664 q.text("duration_nsec = ");
2665 q.text("%#x" % self.duration_nsec)
2666 q.breakable()
2667 q.text('}')
2668
2669
2670class queue_prop(loxi.OFObject):
2671 subtypes = {}
2672
2673
2674 def __init__(self, type=None):
2675 if type != None:
2676 self.type = type
2677 else:
2678 self.type = 0
2679 return
2680
2681 def pack(self):
2682 packed = []
2683 packed.append(struct.pack("!H", self.type))
2684 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
2685 packed.append('\x00' * 4)
2686 length = sum([len(x) for x in packed])
2687 packed[1] = struct.pack("!H", length)
2688 return ''.join(packed)
2689
2690 @staticmethod
2691 def unpack(reader):
2692 subtype, = reader.peek('!H', 0)
2693 subclass = queue_prop.subtypes.get(subtype)
2694 if subclass:
2695 return subclass.unpack(reader)
2696
2697 obj = queue_prop()
2698 obj.type = reader.read("!H")[0]
2699 _len = reader.read("!H")[0]
2700 orig_reader = reader
2701 reader = orig_reader.slice(_len, 4)
2702 reader.skip(4)
2703 return obj
2704
2705 def __eq__(self, other):
2706 if type(self) != type(other): return False
2707 if self.type != other.type: return False
2708 return True
2709
2710 def pretty_print(self, q):
2711 q.text("queue_prop {")
2712 with q.group():
2713 with q.indent(2):
2714 q.breakable()
2715 q.breakable()
2716 q.text('}')
2717
2718
2719class queue_prop_experimenter(queue_prop):
2720 subtypes = {}
2721
2722 type = 65535
2723
2724 def __init__(self, experimenter=None, data=None):
2725 if experimenter != None:
2726 self.experimenter = experimenter
2727 else:
2728 self.experimenter = 0
2729 if data != None:
2730 self.data = data
2731 else:
2732 self.data = ''
2733 return
2734
2735 def pack(self):
2736 packed = []
2737 packed.append(struct.pack("!H", self.type))
2738 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
2739 packed.append('\x00' * 4)
2740 packed.append(struct.pack("!L", self.experimenter))
2741 packed.append('\x00' * 4)
2742 packed.append(self.data)
2743 length = sum([len(x) for x in packed])
2744 packed[1] = struct.pack("!H", length)
2745 return ''.join(packed)
2746
2747 @staticmethod
2748 def unpack(reader):
2749 subtype, = reader.peek('!L', 8)
2750 subclass = queue_prop_experimenter.subtypes.get(subtype)
2751 if subclass:
2752 return subclass.unpack(reader)
2753
2754 obj = queue_prop_experimenter()
2755 _type = reader.read("!H")[0]
2756 assert(_type == 65535)
2757 _len = reader.read("!H")[0]
2758 orig_reader = reader
2759 reader = orig_reader.slice(_len, 4)
2760 reader.skip(4)
2761 obj.experimenter = reader.read("!L")[0]
2762 reader.skip(4)
2763 obj.data = str(reader.read_all())
2764 return obj
2765
2766 def __eq__(self, other):
2767 if type(self) != type(other): return False
2768 if self.experimenter != other.experimenter: return False
2769 if self.data != other.data: return False
2770 return True
2771
2772 def pretty_print(self, q):
2773 q.text("queue_prop_experimenter {")
2774 with q.group():
2775 with q.indent(2):
2776 q.breakable()
2777 q.text("data = ");
2778 q.pp(self.data)
2779 q.breakable()
2780 q.text('}')
2781
2782queue_prop.subtypes[65535] = queue_prop_experimenter
2783
2784class queue_prop_max_rate(queue_prop):
2785 type = 2
2786
2787 def __init__(self, rate=None):
2788 if rate != None:
2789 self.rate = rate
2790 else:
2791 self.rate = 0
2792 return
2793
2794 def pack(self):
2795 packed = []
2796 packed.append(struct.pack("!H", self.type))
2797 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
2798 packed.append('\x00' * 4)
2799 packed.append(struct.pack("!H", self.rate))
2800 packed.append('\x00' * 6)
2801 length = sum([len(x) for x in packed])
2802 packed[1] = struct.pack("!H", length)
2803 return ''.join(packed)
2804
2805 @staticmethod
2806 def unpack(reader):
2807 obj = queue_prop_max_rate()
2808 _type = reader.read("!H")[0]
2809 assert(_type == 2)
2810 _len = reader.read("!H")[0]
2811 orig_reader = reader
2812 reader = orig_reader.slice(_len, 4)
2813 reader.skip(4)
2814 obj.rate = reader.read("!H")[0]
2815 reader.skip(6)
2816 return obj
2817
2818 def __eq__(self, other):
2819 if type(self) != type(other): return False
2820 if self.rate != other.rate: return False
2821 return True
2822
2823 def pretty_print(self, q):
2824 q.text("queue_prop_max_rate {")
2825 with q.group():
2826 with q.indent(2):
2827 q.breakable()
2828 q.text("rate = ");
2829 q.text("%#x" % self.rate)
2830 q.breakable()
2831 q.text('}')
2832
2833queue_prop.subtypes[2] = queue_prop_max_rate
2834
2835class queue_prop_min_rate(queue_prop):
2836 type = 1
2837
2838 def __init__(self, rate=None):
2839 if rate != None:
2840 self.rate = rate
2841 else:
2842 self.rate = 0
2843 return
2844
2845 def pack(self):
2846 packed = []
2847 packed.append(struct.pack("!H", self.type))
2848 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
2849 packed.append('\x00' * 4)
2850 packed.append(struct.pack("!H", self.rate))
2851 packed.append('\x00' * 6)
2852 length = sum([len(x) for x in packed])
2853 packed[1] = struct.pack("!H", length)
2854 return ''.join(packed)
2855
2856 @staticmethod
2857 def unpack(reader):
2858 obj = queue_prop_min_rate()
2859 _type = reader.read("!H")[0]
2860 assert(_type == 1)
2861 _len = reader.read("!H")[0]
2862 orig_reader = reader
2863 reader = orig_reader.slice(_len, 4)
2864 reader.skip(4)
2865 obj.rate = reader.read("!H")[0]
2866 reader.skip(6)
2867 return obj
2868
2869 def __eq__(self, other):
2870 if type(self) != type(other): return False
2871 if self.rate != other.rate: return False
2872 return True
2873
2874 def pretty_print(self, q):
2875 q.text("queue_prop_min_rate {")
2876 with q.group():
2877 with q.indent(2):
2878 q.breakable()
2879 q.text("rate = ");
2880 q.text("%#x" % self.rate)
2881 q.breakable()
2882 q.text('}')
2883
2884queue_prop.subtypes[1] = queue_prop_min_rate
2885
2886class queue_stats_entry(loxi.OFObject):
2887
2888 def __init__(self, port_no=None, queue_id=None, tx_bytes=None, tx_packets=None, tx_errors=None, duration_sec=None, duration_nsec=None):
2889 if port_no != None:
2890 self.port_no = port_no
2891 else:
2892 self.port_no = 0
2893 if queue_id != None:
2894 self.queue_id = queue_id
2895 else:
2896 self.queue_id = 0
2897 if tx_bytes != None:
2898 self.tx_bytes = tx_bytes
2899 else:
2900 self.tx_bytes = 0
2901 if tx_packets != None:
2902 self.tx_packets = tx_packets
2903 else:
2904 self.tx_packets = 0
2905 if tx_errors != None:
2906 self.tx_errors = tx_errors
2907 else:
2908 self.tx_errors = 0
2909 if duration_sec != None:
2910 self.duration_sec = duration_sec
2911 else:
2912 self.duration_sec = 0
2913 if duration_nsec != None:
2914 self.duration_nsec = duration_nsec
2915 else:
2916 self.duration_nsec = 0
2917 return
2918
2919 def pack(self):
2920 packed = []
2921 packed.append(util.pack_port_no(self.port_no))
2922 packed.append(struct.pack("!L", self.queue_id))
2923 packed.append(struct.pack("!Q", self.tx_bytes))
2924 packed.append(struct.pack("!Q", self.tx_packets))
2925 packed.append(struct.pack("!Q", self.tx_errors))
2926 packed.append(struct.pack("!L", self.duration_sec))
2927 packed.append(struct.pack("!L", self.duration_nsec))
2928 return ''.join(packed)
2929
2930 @staticmethod
2931 def unpack(reader):
2932 obj = queue_stats_entry()
2933 obj.port_no = util.unpack_port_no(reader)
2934 obj.queue_id = reader.read("!L")[0]
2935 obj.tx_bytes = reader.read("!Q")[0]
2936 obj.tx_packets = reader.read("!Q")[0]
2937 obj.tx_errors = reader.read("!Q")[0]
2938 obj.duration_sec = reader.read("!L")[0]
2939 obj.duration_nsec = reader.read("!L")[0]
2940 return obj
2941
2942 def __eq__(self, other):
2943 if type(self) != type(other): return False
2944 if self.port_no != other.port_no: return False
2945 if self.queue_id != other.queue_id: return False
2946 if self.tx_bytes != other.tx_bytes: return False
2947 if self.tx_packets != other.tx_packets: return False
2948 if self.tx_errors != other.tx_errors: return False
2949 if self.duration_sec != other.duration_sec: return False
2950 if self.duration_nsec != other.duration_nsec: return False
2951 return True
2952
2953 def pretty_print(self, q):
2954 q.text("queue_stats_entry {")
2955 with q.group():
2956 with q.indent(2):
2957 q.breakable()
2958 q.text("port_no = ");
2959 q.text(util.pretty_port(self.port_no))
2960 q.text(","); q.breakable()
2961 q.text("queue_id = ");
2962 q.text("%#x" % self.queue_id)
2963 q.text(","); q.breakable()
2964 q.text("tx_bytes = ");
2965 q.text("%#x" % self.tx_bytes)
2966 q.text(","); q.breakable()
2967 q.text("tx_packets = ");
2968 q.text("%#x" % self.tx_packets)
2969 q.text(","); q.breakable()
2970 q.text("tx_errors = ");
2971 q.text("%#x" % self.tx_errors)
2972 q.text(","); q.breakable()
2973 q.text("duration_sec = ");
2974 q.text("%#x" % self.duration_sec)
2975 q.text(","); q.breakable()
2976 q.text("duration_nsec = ");
2977 q.text("%#x" % self.duration_nsec)
2978 q.breakable()
2979 q.text('}')
2980
2981
2982class table_feature_prop(loxi.OFObject):
2983 subtypes = {}
2984
2985
2986 def __init__(self, type=None):
2987 if type != None:
2988 self.type = type
2989 else:
2990 self.type = 0
2991 return
2992
2993 def pack(self):
2994 packed = []
2995 packed.append(struct.pack("!H", self.type))
2996 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2997 length = sum([len(x) for x in packed])
2998 packed[1] = struct.pack("!H", length)
2999 return ''.join(packed)
3000
3001 @staticmethod
3002 def unpack(reader):
3003 subtype, = reader.peek('!H', 0)
3004 subclass = table_feature_prop.subtypes.get(subtype)
3005 if subclass:
3006 return subclass.unpack(reader)
3007
3008 obj = table_feature_prop()
3009 obj.type = reader.read("!H")[0]
3010 _length = reader.read("!H")[0]
3011 orig_reader = reader
3012 reader = orig_reader.slice(_length, 4)
3013 return obj
3014
3015 def __eq__(self, other):
3016 if type(self) != type(other): return False
3017 if self.type != other.type: return False
3018 return True
3019
3020 def pretty_print(self, q):
3021 q.text("table_feature_prop {")
3022 with q.group():
3023 with q.indent(2):
3024 q.breakable()
3025 q.breakable()
3026 q.text('}')
3027
3028
3029class table_feature_prop_apply_actions(table_feature_prop):
3030 type = 6
3031
3032 def __init__(self, action_ids=None):
3033 if action_ids != None:
3034 self.action_ids = action_ids
3035 else:
3036 self.action_ids = []
3037 return
3038
3039 def pack(self):
3040 packed = []
3041 packed.append(struct.pack("!H", self.type))
3042 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3043 packed.append(loxi.generic_util.pack_list(self.action_ids))
3044 length = sum([len(x) for x in packed])
3045 packed[1] = struct.pack("!H", length)
3046 packed.append(loxi.generic_util.pad_to(8, length))
3047 return ''.join(packed)
3048
3049 @staticmethod
3050 def unpack(reader):
3051 obj = table_feature_prop_apply_actions()
3052 _type = reader.read("!H")[0]
3053 assert(_type == 6)
3054 _length = reader.read("!H")[0]
3055 orig_reader = reader
3056 reader = orig_reader.slice(_length, 4)
3057 obj.action_ids = loxi.generic_util.unpack_list(reader, ofp.action_id.action_id.unpack)
3058 orig_reader.skip_align()
3059 return obj
3060
3061 def __eq__(self, other):
3062 if type(self) != type(other): return False
3063 if self.action_ids != other.action_ids: return False
3064 return True
3065
3066 def pretty_print(self, q):
3067 q.text("table_feature_prop_apply_actions {")
3068 with q.group():
3069 with q.indent(2):
3070 q.breakable()
3071 q.text("action_ids = ");
3072 q.pp(self.action_ids)
3073 q.breakable()
3074 q.text('}')
3075
3076table_feature_prop.subtypes[6] = table_feature_prop_apply_actions
3077
3078class table_feature_prop_apply_actions_miss(table_feature_prop):
3079 type = 7
3080
3081 def __init__(self, action_ids=None):
3082 if action_ids != None:
3083 self.action_ids = action_ids
3084 else:
3085 self.action_ids = []
3086 return
3087
3088 def pack(self):
3089 packed = []
3090 packed.append(struct.pack("!H", self.type))
3091 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3092 packed.append(loxi.generic_util.pack_list(self.action_ids))
3093 length = sum([len(x) for x in packed])
3094 packed[1] = struct.pack("!H", length)
3095 packed.append(loxi.generic_util.pad_to(8, length))
3096 return ''.join(packed)
3097
3098 @staticmethod
3099 def unpack(reader):
3100 obj = table_feature_prop_apply_actions_miss()
3101 _type = reader.read("!H")[0]
3102 assert(_type == 7)
3103 _length = reader.read("!H")[0]
3104 orig_reader = reader
3105 reader = orig_reader.slice(_length, 4)
3106 obj.action_ids = loxi.generic_util.unpack_list(reader, ofp.action_id.action_id.unpack)
3107 orig_reader.skip_align()
3108 return obj
3109
3110 def __eq__(self, other):
3111 if type(self) != type(other): return False
3112 if self.action_ids != other.action_ids: return False
3113 return True
3114
3115 def pretty_print(self, q):
3116 q.text("table_feature_prop_apply_actions_miss {")
3117 with q.group():
3118 with q.indent(2):
3119 q.breakable()
3120 q.text("action_ids = ");
3121 q.pp(self.action_ids)
3122 q.breakable()
3123 q.text('}')
3124
3125table_feature_prop.subtypes[7] = table_feature_prop_apply_actions_miss
3126
3127class table_feature_prop_apply_setfield(table_feature_prop):
3128 type = 14
3129
3130 def __init__(self, oxm_ids=None):
3131 if oxm_ids != None:
3132 self.oxm_ids = oxm_ids
3133 else:
3134 self.oxm_ids = []
3135 return
3136
3137 def pack(self):
3138 packed = []
3139 packed.append(struct.pack("!H", self.type))
3140 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3141 packed.append(loxi.generic_util.pack_list(self.oxm_ids))
3142 length = sum([len(x) for x in packed])
3143 packed[1] = struct.pack("!H", length)
3144 packed.append(loxi.generic_util.pad_to(8, length))
3145 return ''.join(packed)
3146
3147 @staticmethod
3148 def unpack(reader):
3149 obj = table_feature_prop_apply_setfield()
3150 _type = reader.read("!H")[0]
3151 assert(_type == 14)
3152 _length = reader.read("!H")[0]
3153 orig_reader = reader
3154 reader = orig_reader.slice(_length, 4)
3155 obj.oxm_ids = loxi.generic_util.unpack_list(reader, ofp.common.uint32.unpack)
3156 orig_reader.skip_align()
3157 return obj
3158
3159 def __eq__(self, other):
3160 if type(self) != type(other): return False
3161 if self.oxm_ids != other.oxm_ids: return False
3162 return True
3163
3164 def pretty_print(self, q):
3165 q.text("table_feature_prop_apply_setfield {")
3166 with q.group():
3167 with q.indent(2):
3168 q.breakable()
3169 q.text("oxm_ids = ");
3170 q.pp(self.oxm_ids)
3171 q.breakable()
3172 q.text('}')
3173
3174table_feature_prop.subtypes[14] = table_feature_prop_apply_setfield
3175
3176class table_feature_prop_apply_setfield_miss(table_feature_prop):
3177 type = 15
3178
3179 def __init__(self, oxm_ids=None):
3180 if oxm_ids != None:
3181 self.oxm_ids = oxm_ids
3182 else:
3183 self.oxm_ids = []
3184 return
3185
3186 def pack(self):
3187 packed = []
3188 packed.append(struct.pack("!H", self.type))
3189 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3190 packed.append(loxi.generic_util.pack_list(self.oxm_ids))
3191 length = sum([len(x) for x in packed])
3192 packed[1] = struct.pack("!H", length)
3193 packed.append(loxi.generic_util.pad_to(8, length))
3194 return ''.join(packed)
3195
3196 @staticmethod
3197 def unpack(reader):
3198 obj = table_feature_prop_apply_setfield_miss()
3199 _type = reader.read("!H")[0]
3200 assert(_type == 15)
3201 _length = reader.read("!H")[0]
3202 orig_reader = reader
3203 reader = orig_reader.slice(_length, 4)
3204 obj.oxm_ids = loxi.generic_util.unpack_list(reader, ofp.common.uint32.unpack)
3205 orig_reader.skip_align()
3206 return obj
3207
3208 def __eq__(self, other):
3209 if type(self) != type(other): return False
3210 if self.oxm_ids != other.oxm_ids: return False
3211 return True
3212
3213 def pretty_print(self, q):
3214 q.text("table_feature_prop_apply_setfield_miss {")
3215 with q.group():
3216 with q.indent(2):
3217 q.breakable()
3218 q.text("oxm_ids = ");
3219 q.pp(self.oxm_ids)
3220 q.breakable()
3221 q.text('}')
3222
3223table_feature_prop.subtypes[15] = table_feature_prop_apply_setfield_miss
3224
3225class table_feature_prop_experimenter(table_feature_prop):
3226 subtypes = {}
3227
3228 type = 65534
3229
3230 def __init__(self, experimenter=None, subtype=None, experimenter_data=None):
3231 if experimenter != None:
3232 self.experimenter = experimenter
3233 else:
3234 self.experimenter = 0
3235 if subtype != None:
3236 self.subtype = subtype
3237 else:
3238 self.subtype = 0
3239 if experimenter_data != None:
3240 self.experimenter_data = experimenter_data
3241 else:
3242 self.experimenter_data = ''
3243 return
3244
3245 def pack(self):
3246 packed = []
3247 packed.append(struct.pack("!H", self.type))
3248 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3249 packed.append(struct.pack("!L", self.experimenter))
3250 packed.append(struct.pack("!L", self.subtype))
3251 packed.append(self.experimenter_data)
3252 length = sum([len(x) for x in packed])
3253 packed[1] = struct.pack("!H", length)
3254 packed.append(loxi.generic_util.pad_to(8, length))
3255 return ''.join(packed)
3256
3257 @staticmethod
3258 def unpack(reader):
3259 subtype, = reader.peek('!L', 4)
3260 subclass = table_feature_prop_experimenter.subtypes.get(subtype)
3261 if subclass:
3262 return subclass.unpack(reader)
3263
3264 obj = table_feature_prop_experimenter()
3265 _type = reader.read("!H")[0]
3266 assert(_type == 65534)
3267 _length = reader.read("!H")[0]
3268 orig_reader = reader
3269 reader = orig_reader.slice(_length, 4)
3270 obj.experimenter = reader.read("!L")[0]
3271 obj.subtype = reader.read("!L")[0]
3272 obj.experimenter_data = str(reader.read_all())
3273 orig_reader.skip_align()
3274 return obj
3275
3276 def __eq__(self, other):
3277 if type(self) != type(other): return False
3278 if self.experimenter != other.experimenter: return False
3279 if self.subtype != other.subtype: return False
3280 if self.experimenter_data != other.experimenter_data: return False
3281 return True
3282
3283 def pretty_print(self, q):
3284 q.text("table_feature_prop_experimenter {")
3285 with q.group():
3286 with q.indent(2):
3287 q.breakable()
3288 q.text("subtype = ");
3289 q.text("%#x" % self.subtype)
3290 q.text(","); q.breakable()
3291 q.text("experimenter_data = ");
3292 q.pp(self.experimenter_data)
3293 q.breakable()
3294 q.text('}')
3295
3296table_feature_prop.subtypes[65534] = table_feature_prop_experimenter
3297
3298class table_feature_prop_experimenter_miss(table_feature_prop):
3299 subtypes = {}
3300
3301 type = 65535
3302
3303 def __init__(self, experimenter=None, subtype=None, experimenter_data=None):
3304 if experimenter != None:
3305 self.experimenter = experimenter
3306 else:
3307 self.experimenter = 0
3308 if subtype != None:
3309 self.subtype = subtype
3310 else:
3311 self.subtype = 0
3312 if experimenter_data != None:
3313 self.experimenter_data = experimenter_data
3314 else:
3315 self.experimenter_data = ''
3316 return
3317
3318 def pack(self):
3319 packed = []
3320 packed.append(struct.pack("!H", self.type))
3321 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3322 packed.append(struct.pack("!L", self.experimenter))
3323 packed.append(struct.pack("!L", self.subtype))
3324 packed.append(self.experimenter_data)
3325 length = sum([len(x) for x in packed])
3326 packed[1] = struct.pack("!H", length)
3327 packed.append(loxi.generic_util.pad_to(8, length))
3328 return ''.join(packed)
3329
3330 @staticmethod
3331 def unpack(reader):
3332 subtype, = reader.peek('!L', 4)
3333 subclass = table_feature_prop_experimenter_miss.subtypes.get(subtype)
3334 if subclass:
3335 return subclass.unpack(reader)
3336
3337 obj = table_feature_prop_experimenter_miss()
3338 _type = reader.read("!H")[0]
3339 assert(_type == 65535)
3340 _length = reader.read("!H")[0]
3341 orig_reader = reader
3342 reader = orig_reader.slice(_length, 4)
3343 obj.experimenter = reader.read("!L")[0]
3344 obj.subtype = reader.read("!L")[0]
3345 obj.experimenter_data = str(reader.read_all())
3346 orig_reader.skip_align()
3347 return obj
3348
3349 def __eq__(self, other):
3350 if type(self) != type(other): return False
3351 if self.experimenter != other.experimenter: return False
3352 if self.subtype != other.subtype: return False
3353 if self.experimenter_data != other.experimenter_data: return False
3354 return True
3355
3356 def pretty_print(self, q):
3357 q.text("table_feature_prop_experimenter_miss {")
3358 with q.group():
3359 with q.indent(2):
3360 q.breakable()
3361 q.text("subtype = ");
3362 q.text("%#x" % self.subtype)
3363 q.text(","); q.breakable()
3364 q.text("experimenter_data = ");
3365 q.pp(self.experimenter_data)
3366 q.breakable()
3367 q.text('}')
3368
3369table_feature_prop.subtypes[65535] = table_feature_prop_experimenter_miss
3370
3371class table_feature_prop_instructions(table_feature_prop):
3372 type = 0
3373
3374 def __init__(self, instruction_ids=None):
3375 if instruction_ids != None:
3376 self.instruction_ids = instruction_ids
3377 else:
3378 self.instruction_ids = []
3379 return
3380
3381 def pack(self):
3382 packed = []
3383 packed.append(struct.pack("!H", self.type))
3384 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3385 packed.append(loxi.generic_util.pack_list(self.instruction_ids))
3386 length = sum([len(x) for x in packed])
3387 packed[1] = struct.pack("!H", length)
3388 packed.append(loxi.generic_util.pad_to(8, length))
3389 return ''.join(packed)
3390
3391 @staticmethod
3392 def unpack(reader):
3393 obj = table_feature_prop_instructions()
3394 _type = reader.read("!H")[0]
3395 assert(_type == 0)
3396 _length = reader.read("!H")[0]
3397 orig_reader = reader
3398 reader = orig_reader.slice(_length, 4)
3399 obj.instruction_ids = loxi.generic_util.unpack_list(reader, ofp.instruction_id.instruction_id.unpack)
3400 orig_reader.skip_align()
3401 return obj
3402
3403 def __eq__(self, other):
3404 if type(self) != type(other): return False
3405 if self.instruction_ids != other.instruction_ids: return False
3406 return True
3407
3408 def pretty_print(self, q):
3409 q.text("table_feature_prop_instructions {")
3410 with q.group():
3411 with q.indent(2):
3412 q.breakable()
3413 q.text("instruction_ids = ");
3414 q.pp(self.instruction_ids)
3415 q.breakable()
3416 q.text('}')
3417
3418table_feature_prop.subtypes[0] = table_feature_prop_instructions
3419
3420class table_feature_prop_instructions_miss(table_feature_prop):
3421 type = 1
3422
3423 def __init__(self, instruction_ids=None):
3424 if instruction_ids != None:
3425 self.instruction_ids = instruction_ids
3426 else:
3427 self.instruction_ids = []
3428 return
3429
3430 def pack(self):
3431 packed = []
3432 packed.append(struct.pack("!H", self.type))
3433 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3434 packed.append(loxi.generic_util.pack_list(self.instruction_ids))
3435 length = sum([len(x) for x in packed])
3436 packed[1] = struct.pack("!H", length)
3437 packed.append(loxi.generic_util.pad_to(8, length))
3438 return ''.join(packed)
3439
3440 @staticmethod
3441 def unpack(reader):
3442 obj = table_feature_prop_instructions_miss()
3443 _type = reader.read("!H")[0]
3444 assert(_type == 1)
3445 _length = reader.read("!H")[0]
3446 orig_reader = reader
3447 reader = orig_reader.slice(_length, 4)
3448 obj.instruction_ids = loxi.generic_util.unpack_list(reader, ofp.instruction_id.instruction_id.unpack)
3449 orig_reader.skip_align()
3450 return obj
3451
3452 def __eq__(self, other):
3453 if type(self) != type(other): return False
3454 if self.instruction_ids != other.instruction_ids: return False
3455 return True
3456
3457 def pretty_print(self, q):
3458 q.text("table_feature_prop_instructions_miss {")
3459 with q.group():
3460 with q.indent(2):
3461 q.breakable()
3462 q.text("instruction_ids = ");
3463 q.pp(self.instruction_ids)
3464 q.breakable()
3465 q.text('}')
3466
3467table_feature_prop.subtypes[1] = table_feature_prop_instructions_miss
3468
3469class table_feature_prop_match(table_feature_prop):
3470 type = 8
3471
3472 def __init__(self, oxm_ids=None):
3473 if oxm_ids != None:
3474 self.oxm_ids = oxm_ids
3475 else:
3476 self.oxm_ids = []
3477 return
3478
3479 def pack(self):
3480 packed = []
3481 packed.append(struct.pack("!H", self.type))
3482 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3483 packed.append(loxi.generic_util.pack_list(self.oxm_ids))
3484 length = sum([len(x) for x in packed])
3485 packed[1] = struct.pack("!H", length)
3486 packed.append(loxi.generic_util.pad_to(8, length))
3487 return ''.join(packed)
3488
3489 @staticmethod
3490 def unpack(reader):
3491 obj = table_feature_prop_match()
3492 _type = reader.read("!H")[0]
3493 assert(_type == 8)
3494 _length = reader.read("!H")[0]
3495 orig_reader = reader
3496 reader = orig_reader.slice(_length, 4)
3497 obj.oxm_ids = loxi.generic_util.unpack_list(reader, ofp.common.uint32.unpack)
3498 orig_reader.skip_align()
3499 return obj
3500
3501 def __eq__(self, other):
3502 if type(self) != type(other): return False
3503 if self.oxm_ids != other.oxm_ids: return False
3504 return True
3505
3506 def pretty_print(self, q):
3507 q.text("table_feature_prop_match {")
3508 with q.group():
3509 with q.indent(2):
3510 q.breakable()
3511 q.text("oxm_ids = ");
3512 q.pp(self.oxm_ids)
3513 q.breakable()
3514 q.text('}')
3515
3516table_feature_prop.subtypes[8] = table_feature_prop_match
3517
3518class table_feature_prop_next_tables(table_feature_prop):
3519 type = 2
3520
3521 def __init__(self, next_table_ids=None):
3522 if next_table_ids != None:
3523 self.next_table_ids = next_table_ids
3524 else:
3525 self.next_table_ids = []
3526 return
3527
3528 def pack(self):
3529 packed = []
3530 packed.append(struct.pack("!H", self.type))
3531 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3532 packed.append(loxi.generic_util.pack_list(self.next_table_ids))
3533 length = sum([len(x) for x in packed])
3534 packed[1] = struct.pack("!H", length)
3535 packed.append(loxi.generic_util.pad_to(8, length))
3536 return ''.join(packed)
3537
3538 @staticmethod
3539 def unpack(reader):
3540 obj = table_feature_prop_next_tables()
3541 _type = reader.read("!H")[0]
3542 assert(_type == 2)
3543 _length = reader.read("!H")[0]
3544 orig_reader = reader
3545 reader = orig_reader.slice(_length, 4)
3546 obj.next_table_ids = loxi.generic_util.unpack_list(reader, ofp.common.uint8.unpack)
3547 orig_reader.skip_align()
3548 return obj
3549
3550 def __eq__(self, other):
3551 if type(self) != type(other): return False
3552 if self.next_table_ids != other.next_table_ids: return False
3553 return True
3554
3555 def pretty_print(self, q):
3556 q.text("table_feature_prop_next_tables {")
3557 with q.group():
3558 with q.indent(2):
3559 q.breakable()
3560 q.text("next_table_ids = ");
3561 q.pp(self.next_table_ids)
3562 q.breakable()
3563 q.text('}')
3564
3565table_feature_prop.subtypes[2] = table_feature_prop_next_tables
3566
3567class table_feature_prop_next_tables_miss(table_feature_prop):
3568 type = 3
3569
3570 def __init__(self, next_table_ids=None):
3571 if next_table_ids != None:
3572 self.next_table_ids = next_table_ids
3573 else:
3574 self.next_table_ids = []
3575 return
3576
3577 def pack(self):
3578 packed = []
3579 packed.append(struct.pack("!H", self.type))
3580 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3581 packed.append(loxi.generic_util.pack_list(self.next_table_ids))
3582 length = sum([len(x) for x in packed])
3583 packed[1] = struct.pack("!H", length)
3584 packed.append(loxi.generic_util.pad_to(8, length))
3585 return ''.join(packed)
3586
3587 @staticmethod
3588 def unpack(reader):
3589 obj = table_feature_prop_next_tables_miss()
3590 _type = reader.read("!H")[0]
3591 assert(_type == 3)
3592 _length = reader.read("!H")[0]
3593 orig_reader = reader
3594 reader = orig_reader.slice(_length, 4)
3595 obj.next_table_ids = loxi.generic_util.unpack_list(reader, ofp.common.uint8.unpack)
3596 orig_reader.skip_align()
3597 return obj
3598
3599 def __eq__(self, other):
3600 if type(self) != type(other): return False
3601 if self.next_table_ids != other.next_table_ids: return False
3602 return True
3603
3604 def pretty_print(self, q):
3605 q.text("table_feature_prop_next_tables_miss {")
3606 with q.group():
3607 with q.indent(2):
3608 q.breakable()
3609 q.text("next_table_ids = ");
3610 q.pp(self.next_table_ids)
3611 q.breakable()
3612 q.text('}')
3613
3614table_feature_prop.subtypes[3] = table_feature_prop_next_tables_miss
3615
3616class table_feature_prop_wildcards(table_feature_prop):
3617 type = 10
3618
3619 def __init__(self, oxm_ids=None):
3620 if oxm_ids != None:
3621 self.oxm_ids = oxm_ids
3622 else:
3623 self.oxm_ids = []
3624 return
3625
3626 def pack(self):
3627 packed = []
3628 packed.append(struct.pack("!H", self.type))
3629 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3630 packed.append(loxi.generic_util.pack_list(self.oxm_ids))
3631 length = sum([len(x) for x in packed])
3632 packed[1] = struct.pack("!H", length)
3633 packed.append(loxi.generic_util.pad_to(8, length))
3634 return ''.join(packed)
3635
3636 @staticmethod
3637 def unpack(reader):
3638 obj = table_feature_prop_wildcards()
3639 _type = reader.read("!H")[0]
3640 assert(_type == 10)
3641 _length = reader.read("!H")[0]
3642 orig_reader = reader
3643 reader = orig_reader.slice(_length, 4)
3644 obj.oxm_ids = loxi.generic_util.unpack_list(reader, ofp.common.uint32.unpack)
3645 orig_reader.skip_align()
3646 return obj
3647
3648 def __eq__(self, other):
3649 if type(self) != type(other): return False
3650 if self.oxm_ids != other.oxm_ids: return False
3651 return True
3652
3653 def pretty_print(self, q):
3654 q.text("table_feature_prop_wildcards {")
3655 with q.group():
3656 with q.indent(2):
3657 q.breakable()
3658 q.text("oxm_ids = ");
3659 q.pp(self.oxm_ids)
3660 q.breakable()
3661 q.text('}')
3662
3663table_feature_prop.subtypes[10] = table_feature_prop_wildcards
3664
3665class table_feature_prop_write_actions(table_feature_prop):
3666 type = 4
3667
3668 def __init__(self, action_ids=None):
3669 if action_ids != None:
3670 self.action_ids = action_ids
3671 else:
3672 self.action_ids = []
3673 return
3674
3675 def pack(self):
3676 packed = []
3677 packed.append(struct.pack("!H", self.type))
3678 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3679 packed.append(loxi.generic_util.pack_list(self.action_ids))
3680 length = sum([len(x) for x in packed])
3681 packed[1] = struct.pack("!H", length)
3682 packed.append(loxi.generic_util.pad_to(8, length))
3683 return ''.join(packed)
3684
3685 @staticmethod
3686 def unpack(reader):
3687 obj = table_feature_prop_write_actions()
3688 _type = reader.read("!H")[0]
3689 assert(_type == 4)
3690 _length = reader.read("!H")[0]
3691 orig_reader = reader
3692 reader = orig_reader.slice(_length, 4)
3693 obj.action_ids = loxi.generic_util.unpack_list(reader, ofp.action_id.action_id.unpack)
3694 orig_reader.skip_align()
3695 return obj
3696
3697 def __eq__(self, other):
3698 if type(self) != type(other): return False
3699 if self.action_ids != other.action_ids: return False
3700 return True
3701
3702 def pretty_print(self, q):
3703 q.text("table_feature_prop_write_actions {")
3704 with q.group():
3705 with q.indent(2):
3706 q.breakable()
3707 q.text("action_ids = ");
3708 q.pp(self.action_ids)
3709 q.breakable()
3710 q.text('}')
3711
3712table_feature_prop.subtypes[4] = table_feature_prop_write_actions
3713
3714class table_feature_prop_write_actions_miss(table_feature_prop):
3715 type = 5
3716
3717 def __init__(self, action_ids=None):
3718 if action_ids != None:
3719 self.action_ids = action_ids
3720 else:
3721 self.action_ids = []
3722 return
3723
3724 def pack(self):
3725 packed = []
3726 packed.append(struct.pack("!H", self.type))
3727 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3728 packed.append(loxi.generic_util.pack_list(self.action_ids))
3729 length = sum([len(x) for x in packed])
3730 packed[1] = struct.pack("!H", length)
3731 packed.append(loxi.generic_util.pad_to(8, length))
3732 return ''.join(packed)
3733
3734 @staticmethod
3735 def unpack(reader):
3736 obj = table_feature_prop_write_actions_miss()
3737 _type = reader.read("!H")[0]
3738 assert(_type == 5)
3739 _length = reader.read("!H")[0]
3740 orig_reader = reader
3741 reader = orig_reader.slice(_length, 4)
3742 obj.action_ids = loxi.generic_util.unpack_list(reader, ofp.action_id.action_id.unpack)
3743 orig_reader.skip_align()
3744 return obj
3745
3746 def __eq__(self, other):
3747 if type(self) != type(other): return False
3748 if self.action_ids != other.action_ids: return False
3749 return True
3750
3751 def pretty_print(self, q):
3752 q.text("table_feature_prop_write_actions_miss {")
3753 with q.group():
3754 with q.indent(2):
3755 q.breakable()
3756 q.text("action_ids = ");
3757 q.pp(self.action_ids)
3758 q.breakable()
3759 q.text('}')
3760
3761table_feature_prop.subtypes[5] = table_feature_prop_write_actions_miss
3762
3763class table_feature_prop_write_setfield(table_feature_prop):
3764 type = 12
3765
3766 def __init__(self, oxm_ids=None):
3767 if oxm_ids != None:
3768 self.oxm_ids = oxm_ids
3769 else:
3770 self.oxm_ids = []
3771 return
3772
3773 def pack(self):
3774 packed = []
3775 packed.append(struct.pack("!H", self.type))
3776 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3777 packed.append(loxi.generic_util.pack_list(self.oxm_ids))
3778 length = sum([len(x) for x in packed])
3779 packed[1] = struct.pack("!H", length)
3780 packed.append(loxi.generic_util.pad_to(8, length))
3781 return ''.join(packed)
3782
3783 @staticmethod
3784 def unpack(reader):
3785 obj = table_feature_prop_write_setfield()
3786 _type = reader.read("!H")[0]
3787 assert(_type == 12)
3788 _length = reader.read("!H")[0]
3789 orig_reader = reader
3790 reader = orig_reader.slice(_length, 4)
3791 obj.oxm_ids = loxi.generic_util.unpack_list(reader, ofp.common.uint32.unpack)
3792 orig_reader.skip_align()
3793 return obj
3794
3795 def __eq__(self, other):
3796 if type(self) != type(other): return False
3797 if self.oxm_ids != other.oxm_ids: return False
3798 return True
3799
3800 def pretty_print(self, q):
3801 q.text("table_feature_prop_write_setfield {")
3802 with q.group():
3803 with q.indent(2):
3804 q.breakable()
3805 q.text("oxm_ids = ");
3806 q.pp(self.oxm_ids)
3807 q.breakable()
3808 q.text('}')
3809
3810table_feature_prop.subtypes[12] = table_feature_prop_write_setfield
3811
3812class table_feature_prop_write_setfield_miss(table_feature_prop):
3813 type = 13
3814
3815 def __init__(self, oxm_ids=None):
3816 if oxm_ids != None:
3817 self.oxm_ids = oxm_ids
3818 else:
3819 self.oxm_ids = []
3820 return
3821
3822 def pack(self):
3823 packed = []
3824 packed.append(struct.pack("!H", self.type))
3825 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3826 packed.append(loxi.generic_util.pack_list(self.oxm_ids))
3827 length = sum([len(x) for x in packed])
3828 packed[1] = struct.pack("!H", length)
3829 packed.append(loxi.generic_util.pad_to(8, length))
3830 return ''.join(packed)
3831
3832 @staticmethod
3833 def unpack(reader):
3834 obj = table_feature_prop_write_setfield_miss()
3835 _type = reader.read("!H")[0]
3836 assert(_type == 13)
3837 _length = reader.read("!H")[0]
3838 orig_reader = reader
3839 reader = orig_reader.slice(_length, 4)
3840 obj.oxm_ids = loxi.generic_util.unpack_list(reader, ofp.common.uint32.unpack)
3841 orig_reader.skip_align()
3842 return obj
3843
3844 def __eq__(self, other):
3845 if type(self) != type(other): return False
3846 if self.oxm_ids != other.oxm_ids: return False
3847 return True
3848
3849 def pretty_print(self, q):
3850 q.text("table_feature_prop_write_setfield_miss {")
3851 with q.group():
3852 with q.indent(2):
3853 q.breakable()
3854 q.text("oxm_ids = ");
3855 q.pp(self.oxm_ids)
3856 q.breakable()
3857 q.text('}')
3858
3859table_feature_prop.subtypes[13] = table_feature_prop_write_setfield_miss
3860
3861class table_features(loxi.OFObject):
3862
3863 def __init__(self, table_id=None, name=None, metadata_match=None, metadata_write=None, config=None, max_entries=None, properties=None):
3864 if table_id != None:
3865 self.table_id = table_id
3866 else:
3867 self.table_id = 0
3868 if name != None:
3869 self.name = name
3870 else:
3871 self.name = ""
3872 if metadata_match != None:
3873 self.metadata_match = metadata_match
3874 else:
3875 self.metadata_match = 0
3876 if metadata_write != None:
3877 self.metadata_write = metadata_write
3878 else:
3879 self.metadata_write = 0
3880 if config != None:
3881 self.config = config
3882 else:
3883 self.config = 0
3884 if max_entries != None:
3885 self.max_entries = max_entries
3886 else:
3887 self.max_entries = 0
3888 if properties != None:
3889 self.properties = properties
3890 else:
3891 self.properties = []
3892 return
3893
3894 def pack(self):
3895 packed = []
3896 packed.append(struct.pack("!H", 0)) # placeholder for length at index 0
3897 packed.append(struct.pack("!B", self.table_id))
3898 packed.append('\x00' * 5)
3899 packed.append(struct.pack("!32s", self.name))
3900 packed.append(struct.pack("!Q", self.metadata_match))
3901 packed.append(struct.pack("!Q", self.metadata_write))
3902 packed.append(struct.pack("!L", self.config))
3903 packed.append(struct.pack("!L", self.max_entries))
3904 packed.append(loxi.generic_util.pack_list(self.properties))
3905 length = sum([len(x) for x in packed])
3906 packed[0] = struct.pack("!H", length)
3907 return ''.join(packed)
3908
3909 @staticmethod
3910 def unpack(reader):
3911 obj = table_features()
3912 _length = reader.read("!H")[0]
3913 orig_reader = reader
3914 reader = orig_reader.slice(_length, 2)
3915 obj.table_id = reader.read("!B")[0]
3916 reader.skip(5)
3917 obj.name = reader.read("!32s")[0].rstrip("\x00")
3918 obj.metadata_match = reader.read("!Q")[0]
3919 obj.metadata_write = reader.read("!Q")[0]
3920 obj.config = reader.read("!L")[0]
3921 obj.max_entries = reader.read("!L")[0]
3922 obj.properties = loxi.generic_util.unpack_list(reader, ofp.common.table_feature_prop.unpack)
3923 return obj
3924
3925 def __eq__(self, other):
3926 if type(self) != type(other): return False
3927 if self.table_id != other.table_id: return False
3928 if self.name != other.name: return False
3929 if self.metadata_match != other.metadata_match: return False
3930 if self.metadata_write != other.metadata_write: return False
3931 if self.config != other.config: return False
3932 if self.max_entries != other.max_entries: return False
3933 if self.properties != other.properties: return False
3934 return True
3935
3936 def pretty_print(self, q):
3937 q.text("table_features {")
3938 with q.group():
3939 with q.indent(2):
3940 q.breakable()
3941 q.text("table_id = ");
3942 q.text("%#x" % self.table_id)
3943 q.text(","); q.breakable()
3944 q.text("name = ");
3945 q.pp(self.name)
3946 q.text(","); q.breakable()
3947 q.text("metadata_match = ");
3948 q.text("%#x" % self.metadata_match)
3949 q.text(","); q.breakable()
3950 q.text("metadata_write = ");
3951 q.text("%#x" % self.metadata_write)
3952 q.text(","); q.breakable()
3953 q.text("config = ");
3954 q.text("%#x" % self.config)
3955 q.text(","); q.breakable()
3956 q.text("max_entries = ");
3957 q.text("%#x" % self.max_entries)
3958 q.text(","); q.breakable()
3959 q.text("properties = ");
3960 q.pp(self.properties)
3961 q.breakable()
3962 q.text('}')
3963
3964
3965class table_stats_entry(loxi.OFObject):
3966
3967 def __init__(self, table_id=None, active_count=None, lookup_count=None, matched_count=None):
3968 if table_id != None:
3969 self.table_id = table_id
3970 else:
3971 self.table_id = 0
3972 if active_count != None:
3973 self.active_count = active_count
3974 else:
3975 self.active_count = 0
3976 if lookup_count != None:
3977 self.lookup_count = lookup_count
3978 else:
3979 self.lookup_count = 0
3980 if matched_count != None:
3981 self.matched_count = matched_count
3982 else:
3983 self.matched_count = 0
3984 return
3985
3986 def pack(self):
3987 packed = []
3988 packed.append(struct.pack("!B", self.table_id))
3989 packed.append('\x00' * 3)
3990 packed.append(struct.pack("!L", self.active_count))
3991 packed.append(struct.pack("!Q", self.lookup_count))
3992 packed.append(struct.pack("!Q", self.matched_count))
3993 return ''.join(packed)
3994
3995 @staticmethod
3996 def unpack(reader):
3997 obj = table_stats_entry()
3998 obj.table_id = reader.read("!B")[0]
3999 reader.skip(3)
4000 obj.active_count = reader.read("!L")[0]
4001 obj.lookup_count = reader.read("!Q")[0]
4002 obj.matched_count = reader.read("!Q")[0]
4003 return obj
4004
4005 def __eq__(self, other):
4006 if type(self) != type(other): return False
4007 if self.table_id != other.table_id: return False
4008 if self.active_count != other.active_count: return False
4009 if self.lookup_count != other.lookup_count: return False
4010 if self.matched_count != other.matched_count: return False
4011 return True
4012
4013 def pretty_print(self, q):
4014 q.text("table_stats_entry {")
4015 with q.group():
4016 with q.indent(2):
4017 q.breakable()
4018 q.text("table_id = ");
4019 q.text("%#x" % self.table_id)
4020 q.text(","); q.breakable()
4021 q.text("active_count = ");
4022 q.text("%#x" % self.active_count)
4023 q.text(","); q.breakable()
4024 q.text("lookup_count = ");
4025 q.text("%#x" % self.lookup_count)
4026 q.text(","); q.breakable()
4027 q.text("matched_count = ");
4028 q.text("%#x" % self.matched_count)
4029 q.breakable()
4030 q.text('}')
4031
4032
4033class uint32(loxi.OFObject):
4034
4035 def __init__(self, value=None):
4036 if value != None:
4037 self.value = value
4038 else:
4039 self.value = 0
4040 return
4041
4042 def pack(self):
4043 packed = []
4044 packed.append(struct.pack("!L", self.value))
4045 return ''.join(packed)
4046
4047 @staticmethod
4048 def unpack(reader):
4049 obj = uint32()
4050 obj.value = reader.read("!L")[0]
4051 return obj
4052
4053 def __eq__(self, other):
4054 if type(self) != type(other): return False
4055 if self.value != other.value: return False
4056 return True
4057
4058 def pretty_print(self, q):
4059 q.text("uint32 {")
4060 with q.group():
4061 with q.indent(2):
4062 q.breakable()
4063 q.text("value = ");
4064 q.text("%#x" % self.value)
4065 q.breakable()
4066 q.text('}')
4067
4068
4069class uint64(loxi.OFObject):
4070
4071 def __init__(self, value=None):
4072 if value != None:
4073 self.value = value
4074 else:
4075 self.value = 0
4076 return
4077
4078 def pack(self):
4079 packed = []
4080 packed.append(struct.pack("!Q", self.value))
4081 return ''.join(packed)
4082
4083 @staticmethod
4084 def unpack(reader):
4085 obj = uint64()
4086 obj.value = reader.read("!Q")[0]
4087 return obj
4088
4089 def __eq__(self, other):
4090 if type(self) != type(other): return False
4091 if self.value != other.value: return False
4092 return True
4093
4094 def pretty_print(self, q):
4095 q.text("uint64 {")
4096 with q.group():
4097 with q.indent(2):
4098 q.breakable()
4099 q.text("value = ");
4100 q.text("%#x" % self.value)
4101 q.breakable()
4102 q.text('}')
4103
4104
4105class uint8(loxi.OFObject):
4106
4107 def __init__(self, value=None):
4108 if value != None:
4109 self.value = value
4110 else:
4111 self.value = 0
4112 return
4113
4114 def pack(self):
4115 packed = []
4116 packed.append(struct.pack("!B", self.value))
4117 return ''.join(packed)
4118
4119 @staticmethod
4120 def unpack(reader):
4121 obj = uint8()
4122 obj.value = reader.read("!B")[0]
4123 return obj
4124
4125 def __eq__(self, other):
4126 if type(self) != type(other): return False
4127 if self.value != other.value: return False
4128 return True
4129
4130 def pretty_print(self, q):
4131 q.text("uint8 {")
4132 with q.group():
4133 with q.indent(2):
4134 q.breakable()
4135 q.text("value = ");
4136 q.text("%#x" % self.value)
4137 q.breakable()
4138 q.text('}')
4139
4140
4141
4142match = match_v3