blob: eb95605ce047d600c139edcf6868803523ae069c [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
sathishgbbb90992017-06-23 09:52:29 +05301950class hello_elem_bitmap(loxi.OFObject):
1951
1952 def __init__(self, version_list=None):
1953 if version_list != None:
1954 self.version_list = version_list
1955 else:
1956 self.version_list = []
1957 self.bitmap = 0
1958 for version in version_list:
1959 self.bitmap = self.bitmap | 1 << version
1960 return
1961
1962 def pack(self):
1963 return struct.pack("!L", self.bitmap)
1964
Nathan Knuth418fdc82016-09-16 22:51:15 -07001965class match_v3(loxi.OFObject):
1966 type = 1
1967
1968 def __init__(self, oxm_list=None):
1969 if oxm_list != None:
1970 self.oxm_list = oxm_list
1971 else:
1972 self.oxm_list = []
1973 return
1974
1975 def pack(self):
1976 packed = []
1977 packed.append(struct.pack("!H", self.type))
1978 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1979 packed.append(loxi.generic_util.pack_list(self.oxm_list))
1980 length = sum([len(x) for x in packed])
1981 packed[1] = struct.pack("!H", length)
1982 packed.append(loxi.generic_util.pad_to(8, length))
1983 return ''.join(packed)
1984
1985 @staticmethod
1986 def unpack(reader):
1987 obj = match_v3()
1988 _type = reader.read("!H")[0]
1989 assert(_type == 1)
1990 _length = reader.read("!H")[0]
1991 orig_reader = reader
1992 reader = orig_reader.slice(_length, 4)
1993 obj.oxm_list = loxi.generic_util.unpack_list(reader, ofp.oxm.oxm.unpack)
1994 orig_reader.skip_align()
1995 return obj
1996
1997 def __eq__(self, other):
1998 if type(self) != type(other): return False
1999 if self.oxm_list != other.oxm_list: return False
2000 return True
2001
2002 def pretty_print(self, q):
2003 q.text("match_v3 {")
2004 with q.group():
2005 with q.indent(2):
2006 q.breakable()
2007 q.text("oxm_list = ");
2008 q.pp(self.oxm_list)
2009 q.breakable()
2010 q.text('}')
2011
2012
2013class meter_band_stats(loxi.OFObject):
2014
2015 def __init__(self, packet_band_count=None, byte_band_count=None):
2016 if packet_band_count != None:
2017 self.packet_band_count = packet_band_count
2018 else:
2019 self.packet_band_count = 0
2020 if byte_band_count != None:
2021 self.byte_band_count = byte_band_count
2022 else:
2023 self.byte_band_count = 0
2024 return
2025
2026 def pack(self):
2027 packed = []
2028 packed.append(struct.pack("!Q", self.packet_band_count))
2029 packed.append(struct.pack("!Q", self.byte_band_count))
2030 return ''.join(packed)
2031
2032 @staticmethod
2033 def unpack(reader):
2034 obj = meter_band_stats()
2035 obj.packet_band_count = reader.read("!Q")[0]
2036 obj.byte_band_count = reader.read("!Q")[0]
2037 return obj
2038
2039 def __eq__(self, other):
2040 if type(self) != type(other): return False
2041 if self.packet_band_count != other.packet_band_count: return False
2042 if self.byte_band_count != other.byte_band_count: return False
2043 return True
2044
2045 def pretty_print(self, q):
2046 q.text("meter_band_stats {")
2047 with q.group():
2048 with q.indent(2):
2049 q.breakable()
2050 q.text("packet_band_count = ");
2051 q.text("%#x" % self.packet_band_count)
2052 q.text(","); q.breakable()
2053 q.text("byte_band_count = ");
2054 q.text("%#x" % self.byte_band_count)
2055 q.breakable()
2056 q.text('}')
2057
2058
2059class meter_config(loxi.OFObject):
2060
2061 def __init__(self, flags=None, meter_id=None, entries=None):
2062 if flags != None:
2063 self.flags = flags
2064 else:
2065 self.flags = 0
2066 if meter_id != None:
2067 self.meter_id = meter_id
2068 else:
2069 self.meter_id = 0
2070 if entries != None:
2071 self.entries = entries
2072 else:
2073 self.entries = []
2074 return
2075
2076 def pack(self):
2077 packed = []
2078 packed.append(struct.pack("!H", 0)) # placeholder for length at index 0
2079 packed.append(struct.pack("!H", self.flags))
2080 packed.append(struct.pack("!L", self.meter_id))
2081 packed.append(loxi.generic_util.pack_list(self.entries))
2082 length = sum([len(x) for x in packed])
2083 packed[0] = struct.pack("!H", length)
2084 return ''.join(packed)
2085
2086 @staticmethod
2087 def unpack(reader):
2088 obj = meter_config()
2089 _length = reader.read("!H")[0]
2090 orig_reader = reader
2091 reader = orig_reader.slice(_length, 2)
2092 obj.flags = reader.read("!H")[0]
2093 obj.meter_id = reader.read("!L")[0]
2094 obj.entries = loxi.generic_util.unpack_list(reader, ofp.meter_band.meter_band.unpack)
2095 return obj
2096
2097 def __eq__(self, other):
2098 if type(self) != type(other): return False
2099 if self.flags != other.flags: return False
2100 if self.meter_id != other.meter_id: return False
2101 if self.entries != other.entries: return False
2102 return True
2103
2104 def pretty_print(self, q):
2105 q.text("meter_config {")
2106 with q.group():
2107 with q.indent(2):
2108 q.breakable()
2109 q.text("flags = ");
2110 q.text("%#x" % self.flags)
2111 q.text(","); q.breakable()
2112 q.text("meter_id = ");
2113 q.text("%#x" % self.meter_id)
2114 q.text(","); q.breakable()
2115 q.text("entries = ");
2116 q.pp(self.entries)
2117 q.breakable()
2118 q.text('}')
2119
2120
2121class meter_features(loxi.OFObject):
2122
2123 def __init__(self, max_meter=None, band_types=None, capabilities=None, max_bands=None, max_color=None):
2124 if max_meter != None:
2125 self.max_meter = max_meter
2126 else:
2127 self.max_meter = 0
2128 if band_types != None:
2129 self.band_types = band_types
2130 else:
2131 self.band_types = 0
2132 if capabilities != None:
2133 self.capabilities = capabilities
2134 else:
2135 self.capabilities = 0
2136 if max_bands != None:
2137 self.max_bands = max_bands
2138 else:
2139 self.max_bands = 0
2140 if max_color != None:
2141 self.max_color = max_color
2142 else:
2143 self.max_color = 0
2144 return
2145
2146 def pack(self):
2147 packed = []
2148 packed.append(struct.pack("!L", self.max_meter))
2149 packed.append(struct.pack("!L", self.band_types))
2150 packed.append(struct.pack("!L", self.capabilities))
2151 packed.append(struct.pack("!B", self.max_bands))
2152 packed.append(struct.pack("!B", self.max_color))
2153 packed.append('\x00' * 2)
2154 return ''.join(packed)
2155
2156 @staticmethod
2157 def unpack(reader):
2158 obj = meter_features()
2159 obj.max_meter = reader.read("!L")[0]
2160 obj.band_types = reader.read("!L")[0]
2161 obj.capabilities = reader.read("!L")[0]
2162 obj.max_bands = reader.read("!B")[0]
2163 obj.max_color = reader.read("!B")[0]
2164 reader.skip(2)
2165 return obj
2166
2167 def __eq__(self, other):
2168 if type(self) != type(other): return False
2169 if self.max_meter != other.max_meter: return False
2170 if self.band_types != other.band_types: return False
2171 if self.capabilities != other.capabilities: return False
2172 if self.max_bands != other.max_bands: return False
2173 if self.max_color != other.max_color: return False
2174 return True
2175
2176 def pretty_print(self, q):
2177 q.text("meter_features {")
2178 with q.group():
2179 with q.indent(2):
2180 q.breakable()
2181 q.text("max_meter = ");
2182 q.text("%#x" % self.max_meter)
2183 q.text(","); q.breakable()
2184 q.text("band_types = ");
2185 q.text("%#x" % self.band_types)
2186 q.text(","); q.breakable()
2187 q.text("capabilities = ");
2188 q.text("%#x" % self.capabilities)
2189 q.text(","); q.breakable()
2190 q.text("max_bands = ");
2191 q.text("%#x" % self.max_bands)
2192 q.text(","); q.breakable()
2193 q.text("max_color = ");
2194 q.text("%#x" % self.max_color)
2195 q.breakable()
2196 q.text('}')
2197
2198
2199class meter_stats(loxi.OFObject):
2200
2201 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):
2202 if meter_id != None:
2203 self.meter_id = meter_id
2204 else:
2205 self.meter_id = 0
2206 if flow_count != None:
2207 self.flow_count = flow_count
2208 else:
2209 self.flow_count = 0
2210 if packet_in_count != None:
2211 self.packet_in_count = packet_in_count
2212 else:
2213 self.packet_in_count = 0
2214 if byte_in_count != None:
2215 self.byte_in_count = byte_in_count
2216 else:
2217 self.byte_in_count = 0
2218 if duration_sec != None:
2219 self.duration_sec = duration_sec
2220 else:
2221 self.duration_sec = 0
2222 if duration_nsec != None:
2223 self.duration_nsec = duration_nsec
2224 else:
2225 self.duration_nsec = 0
2226 if band_stats != None:
2227 self.band_stats = band_stats
2228 else:
2229 self.band_stats = []
2230 return
2231
2232 def pack(self):
2233 packed = []
2234 packed.append(struct.pack("!L", self.meter_id))
2235 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
2236 packed.append('\x00' * 6)
2237 packed.append(struct.pack("!L", self.flow_count))
2238 packed.append(struct.pack("!Q", self.packet_in_count))
2239 packed.append(struct.pack("!Q", self.byte_in_count))
2240 packed.append(struct.pack("!L", self.duration_sec))
2241 packed.append(struct.pack("!L", self.duration_nsec))
2242 packed.append(loxi.generic_util.pack_list(self.band_stats))
2243 length = sum([len(x) for x in packed])
2244 packed[1] = struct.pack("!H", length)
2245 return ''.join(packed)
2246
2247 @staticmethod
2248 def unpack(reader):
2249 obj = meter_stats()
2250 obj.meter_id = reader.read("!L")[0]
2251 _len = reader.read("!H")[0]
2252 orig_reader = reader
2253 reader = orig_reader.slice(_len, 6)
2254 reader.skip(6)
2255 obj.flow_count = reader.read("!L")[0]
2256 obj.packet_in_count = reader.read("!Q")[0]
2257 obj.byte_in_count = reader.read("!Q")[0]
2258 obj.duration_sec = reader.read("!L")[0]
2259 obj.duration_nsec = reader.read("!L")[0]
2260 obj.band_stats = loxi.generic_util.unpack_list(reader, ofp.common.meter_band_stats.unpack)
2261 return obj
2262
2263 def __eq__(self, other):
2264 if type(self) != type(other): return False
2265 if self.meter_id != other.meter_id: return False
2266 if self.flow_count != other.flow_count: return False
2267 if self.packet_in_count != other.packet_in_count: return False
2268 if self.byte_in_count != other.byte_in_count: return False
2269 if self.duration_sec != other.duration_sec: return False
2270 if self.duration_nsec != other.duration_nsec: return False
2271 if self.band_stats != other.band_stats: return False
2272 return True
2273
2274 def pretty_print(self, q):
2275 q.text("meter_stats {")
2276 with q.group():
2277 with q.indent(2):
2278 q.breakable()
2279 q.text("meter_id = ");
2280 q.text("%#x" % self.meter_id)
2281 q.text(","); q.breakable()
2282 q.text("flow_count = ");
2283 q.text("%#x" % self.flow_count)
2284 q.text(","); q.breakable()
2285 q.text("packet_in_count = ");
2286 q.text("%#x" % self.packet_in_count)
2287 q.text(","); q.breakable()
2288 q.text("byte_in_count = ");
2289 q.text("%#x" % self.byte_in_count)
2290 q.text(","); q.breakable()
2291 q.text("duration_sec = ");
2292 q.text("%#x" % self.duration_sec)
2293 q.text(","); q.breakable()
2294 q.text("duration_nsec = ");
2295 q.text("%#x" % self.duration_nsec)
2296 q.text(","); q.breakable()
2297 q.text("band_stats = ");
2298 q.pp(self.band_stats)
2299 q.breakable()
2300 q.text('}')
2301
2302
2303class packet_queue(loxi.OFObject):
2304
2305 def __init__(self, queue_id=None, port=None, properties=None):
2306 if queue_id != None:
2307 self.queue_id = queue_id
2308 else:
2309 self.queue_id = 0
2310 if port != None:
2311 self.port = port
2312 else:
2313 self.port = 0
2314 if properties != None:
2315 self.properties = properties
2316 else:
2317 self.properties = []
2318 return
2319
2320 def pack(self):
2321 packed = []
2322 packed.append(struct.pack("!L", self.queue_id))
2323 packed.append(util.pack_port_no(self.port))
2324 packed.append(struct.pack("!H", 0)) # placeholder for len at index 2
2325 packed.append('\x00' * 6)
2326 packed.append(loxi.generic_util.pack_list(self.properties))
2327 length = sum([len(x) for x in packed])
2328 packed[2] = struct.pack("!H", length)
2329 return ''.join(packed)
2330
2331 @staticmethod
2332 def unpack(reader):
2333 obj = packet_queue()
2334 obj.queue_id = reader.read("!L")[0]
2335 obj.port = util.unpack_port_no(reader)
2336 _len = reader.read("!H")[0]
2337 orig_reader = reader
2338 reader = orig_reader.slice(_len, 10)
2339 reader.skip(6)
2340 obj.properties = loxi.generic_util.unpack_list(reader, ofp.common.queue_prop.unpack)
2341 return obj
2342
2343 def __eq__(self, other):
2344 if type(self) != type(other): return False
2345 if self.queue_id != other.queue_id: return False
2346 if self.port != other.port: return False
2347 if self.properties != other.properties: return False
2348 return True
2349
2350 def pretty_print(self, q):
2351 q.text("packet_queue {")
2352 with q.group():
2353 with q.indent(2):
2354 q.breakable()
2355 q.text("queue_id = ");
2356 q.text("%#x" % self.queue_id)
2357 q.text(","); q.breakable()
2358 q.text("port = ");
2359 q.text(util.pretty_port(self.port))
2360 q.text(","); q.breakable()
2361 q.text("properties = ");
2362 q.pp(self.properties)
2363 q.breakable()
2364 q.text('}')
2365
2366
2367class port_desc(loxi.OFObject):
2368
2369 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):
2370 if port_no != None:
2371 self.port_no = port_no
2372 else:
2373 self.port_no = 0
2374 if hw_addr != None:
2375 self.hw_addr = hw_addr
2376 else:
2377 self.hw_addr = [0,0,0,0,0,0]
2378 if name != None:
2379 self.name = name
2380 else:
2381 self.name = ""
2382 if config != None:
2383 self.config = config
2384 else:
2385 self.config = 0
2386 if state != None:
2387 self.state = state
2388 else:
2389 self.state = 0
2390 if curr != None:
2391 self.curr = curr
2392 else:
2393 self.curr = 0
2394 if advertised != None:
2395 self.advertised = advertised
2396 else:
2397 self.advertised = 0
2398 if supported != None:
2399 self.supported = supported
2400 else:
2401 self.supported = 0
2402 if peer != None:
2403 self.peer = peer
2404 else:
2405 self.peer = 0
2406 if curr_speed != None:
2407 self.curr_speed = curr_speed
2408 else:
2409 self.curr_speed = 0
2410 if max_speed != None:
2411 self.max_speed = max_speed
2412 else:
2413 self.max_speed = 0
2414 return
2415
2416 def pack(self):
2417 packed = []
2418 packed.append(util.pack_port_no(self.port_no))
2419 packed.append('\x00' * 4)
2420 packed.append(struct.pack("!6B", *self.hw_addr))
2421 packed.append('\x00' * 2)
2422 packed.append(struct.pack("!16s", self.name))
2423 packed.append(struct.pack("!L", self.config))
2424 packed.append(struct.pack("!L", self.state))
2425 packed.append(struct.pack("!L", self.curr))
2426 packed.append(struct.pack("!L", self.advertised))
2427 packed.append(struct.pack("!L", self.supported))
2428 packed.append(struct.pack("!L", self.peer))
2429 packed.append(struct.pack("!L", self.curr_speed))
2430 packed.append(struct.pack("!L", self.max_speed))
2431 return ''.join(packed)
2432
2433 @staticmethod
2434 def unpack(reader):
2435 obj = port_desc()
2436 obj.port_no = util.unpack_port_no(reader)
2437 reader.skip(4)
2438 obj.hw_addr = list(reader.read('!6B'))
2439 reader.skip(2)
2440 obj.name = reader.read("!16s")[0].rstrip("\x00")
2441 obj.config = reader.read("!L")[0]
2442 obj.state = reader.read("!L")[0]
2443 obj.curr = reader.read("!L")[0]
2444 obj.advertised = reader.read("!L")[0]
2445 obj.supported = reader.read("!L")[0]
2446 obj.peer = reader.read("!L")[0]
2447 obj.curr_speed = reader.read("!L")[0]
2448 obj.max_speed = reader.read("!L")[0]
2449 return obj
2450
2451 def __eq__(self, other):
2452 if type(self) != type(other): return False
2453 if self.port_no != other.port_no: return False
2454 if self.hw_addr != other.hw_addr: return False
2455 if self.name != other.name: return False
2456 if self.config != other.config: return False
2457 if self.state != other.state: return False
2458 if self.curr != other.curr: return False
2459 if self.advertised != other.advertised: return False
2460 if self.supported != other.supported: return False
2461 if self.peer != other.peer: return False
2462 if self.curr_speed != other.curr_speed: return False
2463 if self.max_speed != other.max_speed: return False
2464 return True
2465
2466 def pretty_print(self, q):
2467 q.text("port_desc {")
2468 with q.group():
2469 with q.indent(2):
2470 q.breakable()
2471 q.text("port_no = ");
2472 q.text(util.pretty_port(self.port_no))
2473 q.text(","); q.breakable()
2474 q.text("hw_addr = ");
2475 q.text(util.pretty_mac(self.hw_addr))
2476 q.text(","); q.breakable()
2477 q.text("name = ");
2478 q.pp(self.name)
2479 q.text(","); q.breakable()
2480 q.text("config = ");
2481 q.text("%#x" % self.config)
2482 q.text(","); q.breakable()
2483 q.text("state = ");
2484 q.text("%#x" % self.state)
2485 q.text(","); q.breakable()
2486 q.text("curr = ");
2487 q.text("%#x" % self.curr)
2488 q.text(","); q.breakable()
2489 q.text("advertised = ");
2490 q.text("%#x" % self.advertised)
2491 q.text(","); q.breakable()
2492 q.text("supported = ");
2493 q.text("%#x" % self.supported)
2494 q.text(","); q.breakable()
2495 q.text("peer = ");
2496 q.text("%#x" % self.peer)
2497 q.text(","); q.breakable()
2498 q.text("curr_speed = ");
2499 q.text("%#x" % self.curr_speed)
2500 q.text(","); q.breakable()
2501 q.text("max_speed = ");
2502 q.text("%#x" % self.max_speed)
2503 q.breakable()
2504 q.text('}')
2505
2506
2507class port_stats_entry(loxi.OFObject):
2508
2509 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):
2510 if port_no != None:
2511 self.port_no = port_no
2512 else:
2513 self.port_no = 0
2514 if rx_packets != None:
2515 self.rx_packets = rx_packets
2516 else:
2517 self.rx_packets = 0
2518 if tx_packets != None:
2519 self.tx_packets = tx_packets
2520 else:
2521 self.tx_packets = 0
2522 if rx_bytes != None:
2523 self.rx_bytes = rx_bytes
2524 else:
2525 self.rx_bytes = 0
2526 if tx_bytes != None:
2527 self.tx_bytes = tx_bytes
2528 else:
2529 self.tx_bytes = 0
2530 if rx_dropped != None:
2531 self.rx_dropped = rx_dropped
2532 else:
2533 self.rx_dropped = 0
2534 if tx_dropped != None:
2535 self.tx_dropped = tx_dropped
2536 else:
2537 self.tx_dropped = 0
2538 if rx_errors != None:
2539 self.rx_errors = rx_errors
2540 else:
2541 self.rx_errors = 0
2542 if tx_errors != None:
2543 self.tx_errors = tx_errors
2544 else:
2545 self.tx_errors = 0
2546 if rx_frame_err != None:
2547 self.rx_frame_err = rx_frame_err
2548 else:
2549 self.rx_frame_err = 0
2550 if rx_over_err != None:
2551 self.rx_over_err = rx_over_err
2552 else:
2553 self.rx_over_err = 0
2554 if rx_crc_err != None:
2555 self.rx_crc_err = rx_crc_err
2556 else:
2557 self.rx_crc_err = 0
2558 if collisions != None:
2559 self.collisions = collisions
2560 else:
2561 self.collisions = 0
2562 if duration_sec != None:
2563 self.duration_sec = duration_sec
2564 else:
2565 self.duration_sec = 0
2566 if duration_nsec != None:
2567 self.duration_nsec = duration_nsec
2568 else:
2569 self.duration_nsec = 0
2570 return
2571
2572 def pack(self):
2573 packed = []
2574 packed.append(util.pack_port_no(self.port_no))
2575 packed.append('\x00' * 4)
2576 packed.append(struct.pack("!Q", self.rx_packets))
2577 packed.append(struct.pack("!Q", self.tx_packets))
2578 packed.append(struct.pack("!Q", self.rx_bytes))
2579 packed.append(struct.pack("!Q", self.tx_bytes))
2580 packed.append(struct.pack("!Q", self.rx_dropped))
2581 packed.append(struct.pack("!Q", self.tx_dropped))
2582 packed.append(struct.pack("!Q", self.rx_errors))
2583 packed.append(struct.pack("!Q", self.tx_errors))
2584 packed.append(struct.pack("!Q", self.rx_frame_err))
2585 packed.append(struct.pack("!Q", self.rx_over_err))
2586 packed.append(struct.pack("!Q", self.rx_crc_err))
2587 packed.append(struct.pack("!Q", self.collisions))
2588 packed.append(struct.pack("!L", self.duration_sec))
2589 packed.append(struct.pack("!L", self.duration_nsec))
2590 return ''.join(packed)
2591
2592 @staticmethod
2593 def unpack(reader):
2594 obj = port_stats_entry()
2595 obj.port_no = util.unpack_port_no(reader)
2596 reader.skip(4)
2597 obj.rx_packets = reader.read("!Q")[0]
2598 obj.tx_packets = reader.read("!Q")[0]
2599 obj.rx_bytes = reader.read("!Q")[0]
2600 obj.tx_bytes = reader.read("!Q")[0]
2601 obj.rx_dropped = reader.read("!Q")[0]
2602 obj.tx_dropped = reader.read("!Q")[0]
2603 obj.rx_errors = reader.read("!Q")[0]
2604 obj.tx_errors = reader.read("!Q")[0]
2605 obj.rx_frame_err = reader.read("!Q")[0]
2606 obj.rx_over_err = reader.read("!Q")[0]
2607 obj.rx_crc_err = reader.read("!Q")[0]
2608 obj.collisions = reader.read("!Q")[0]
2609 obj.duration_sec = reader.read("!L")[0]
2610 obj.duration_nsec = reader.read("!L")[0]
2611 return obj
2612
2613 def __eq__(self, other):
2614 if type(self) != type(other): return False
2615 if self.port_no != other.port_no: return False
2616 if self.rx_packets != other.rx_packets: return False
2617 if self.tx_packets != other.tx_packets: return False
2618 if self.rx_bytes != other.rx_bytes: return False
2619 if self.tx_bytes != other.tx_bytes: return False
2620 if self.rx_dropped != other.rx_dropped: return False
2621 if self.tx_dropped != other.tx_dropped: return False
2622 if self.rx_errors != other.rx_errors: return False
2623 if self.tx_errors != other.tx_errors: return False
2624 if self.rx_frame_err != other.rx_frame_err: return False
2625 if self.rx_over_err != other.rx_over_err: return False
2626 if self.rx_crc_err != other.rx_crc_err: return False
2627 if self.collisions != other.collisions: return False
2628 if self.duration_sec != other.duration_sec: return False
2629 if self.duration_nsec != other.duration_nsec: return False
2630 return True
2631
2632 def pretty_print(self, q):
2633 q.text("port_stats_entry {")
2634 with q.group():
2635 with q.indent(2):
2636 q.breakable()
2637 q.text("port_no = ");
2638 q.text(util.pretty_port(self.port_no))
2639 q.text(","); q.breakable()
2640 q.text("rx_packets = ");
2641 q.text("%#x" % self.rx_packets)
2642 q.text(","); q.breakable()
2643 q.text("tx_packets = ");
2644 q.text("%#x" % self.tx_packets)
2645 q.text(","); q.breakable()
2646 q.text("rx_bytes = ");
2647 q.text("%#x" % self.rx_bytes)
2648 q.text(","); q.breakable()
2649 q.text("tx_bytes = ");
2650 q.text("%#x" % self.tx_bytes)
2651 q.text(","); q.breakable()
2652 q.text("rx_dropped = ");
2653 q.text("%#x" % self.rx_dropped)
2654 q.text(","); q.breakable()
2655 q.text("tx_dropped = ");
2656 q.text("%#x" % self.tx_dropped)
2657 q.text(","); q.breakable()
2658 q.text("rx_errors = ");
2659 q.text("%#x" % self.rx_errors)
2660 q.text(","); q.breakable()
2661 q.text("tx_errors = ");
2662 q.text("%#x" % self.tx_errors)
2663 q.text(","); q.breakable()
2664 q.text("rx_frame_err = ");
2665 q.text("%#x" % self.rx_frame_err)
2666 q.text(","); q.breakable()
2667 q.text("rx_over_err = ");
2668 q.text("%#x" % self.rx_over_err)
2669 q.text(","); q.breakable()
2670 q.text("rx_crc_err = ");
2671 q.text("%#x" % self.rx_crc_err)
2672 q.text(","); q.breakable()
2673 q.text("collisions = ");
2674 q.text("%#x" % self.collisions)
2675 q.text(","); q.breakable()
2676 q.text("duration_sec = ");
2677 q.text("%#x" % self.duration_sec)
2678 q.text(","); q.breakable()
2679 q.text("duration_nsec = ");
2680 q.text("%#x" % self.duration_nsec)
2681 q.breakable()
2682 q.text('}')
2683
2684
2685class queue_prop(loxi.OFObject):
2686 subtypes = {}
2687
2688
2689 def __init__(self, type=None):
2690 if type != None:
2691 self.type = type
2692 else:
2693 self.type = 0
2694 return
2695
2696 def pack(self):
2697 packed = []
2698 packed.append(struct.pack("!H", self.type))
2699 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
2700 packed.append('\x00' * 4)
2701 length = sum([len(x) for x in packed])
2702 packed[1] = struct.pack("!H", length)
2703 return ''.join(packed)
2704
2705 @staticmethod
2706 def unpack(reader):
2707 subtype, = reader.peek('!H', 0)
2708 subclass = queue_prop.subtypes.get(subtype)
2709 if subclass:
2710 return subclass.unpack(reader)
2711
2712 obj = queue_prop()
2713 obj.type = reader.read("!H")[0]
2714 _len = reader.read("!H")[0]
2715 orig_reader = reader
2716 reader = orig_reader.slice(_len, 4)
2717 reader.skip(4)
2718 return obj
2719
2720 def __eq__(self, other):
2721 if type(self) != type(other): return False
2722 if self.type != other.type: return False
2723 return True
2724
2725 def pretty_print(self, q):
2726 q.text("queue_prop {")
2727 with q.group():
2728 with q.indent(2):
2729 q.breakable()
2730 q.breakable()
2731 q.text('}')
2732
2733
2734class queue_prop_experimenter(queue_prop):
2735 subtypes = {}
2736
2737 type = 65535
2738
2739 def __init__(self, experimenter=None, data=None):
2740 if experimenter != None:
2741 self.experimenter = experimenter
2742 else:
2743 self.experimenter = 0
2744 if data != None:
2745 self.data = data
2746 else:
2747 self.data = ''
2748 return
2749
2750 def pack(self):
2751 packed = []
2752 packed.append(struct.pack("!H", self.type))
2753 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
2754 packed.append('\x00' * 4)
2755 packed.append(struct.pack("!L", self.experimenter))
2756 packed.append('\x00' * 4)
2757 packed.append(self.data)
2758 length = sum([len(x) for x in packed])
2759 packed[1] = struct.pack("!H", length)
2760 return ''.join(packed)
2761
2762 @staticmethod
2763 def unpack(reader):
2764 subtype, = reader.peek('!L', 8)
2765 subclass = queue_prop_experimenter.subtypes.get(subtype)
2766 if subclass:
2767 return subclass.unpack(reader)
2768
2769 obj = queue_prop_experimenter()
2770 _type = reader.read("!H")[0]
2771 assert(_type == 65535)
2772 _len = reader.read("!H")[0]
2773 orig_reader = reader
2774 reader = orig_reader.slice(_len, 4)
2775 reader.skip(4)
2776 obj.experimenter = reader.read("!L")[0]
2777 reader.skip(4)
2778 obj.data = str(reader.read_all())
2779 return obj
2780
2781 def __eq__(self, other):
2782 if type(self) != type(other): return False
2783 if self.experimenter != other.experimenter: return False
2784 if self.data != other.data: return False
2785 return True
2786
2787 def pretty_print(self, q):
2788 q.text("queue_prop_experimenter {")
2789 with q.group():
2790 with q.indent(2):
2791 q.breakable()
2792 q.text("data = ");
2793 q.pp(self.data)
2794 q.breakable()
2795 q.text('}')
2796
2797queue_prop.subtypes[65535] = queue_prop_experimenter
2798
2799class queue_prop_max_rate(queue_prop):
2800 type = 2
2801
2802 def __init__(self, rate=None):
2803 if rate != None:
2804 self.rate = rate
2805 else:
2806 self.rate = 0
2807 return
2808
2809 def pack(self):
2810 packed = []
2811 packed.append(struct.pack("!H", self.type))
2812 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
2813 packed.append('\x00' * 4)
2814 packed.append(struct.pack("!H", self.rate))
2815 packed.append('\x00' * 6)
2816 length = sum([len(x) for x in packed])
2817 packed[1] = struct.pack("!H", length)
2818 return ''.join(packed)
2819
2820 @staticmethod
2821 def unpack(reader):
2822 obj = queue_prop_max_rate()
2823 _type = reader.read("!H")[0]
2824 assert(_type == 2)
2825 _len = reader.read("!H")[0]
2826 orig_reader = reader
2827 reader = orig_reader.slice(_len, 4)
2828 reader.skip(4)
2829 obj.rate = reader.read("!H")[0]
2830 reader.skip(6)
2831 return obj
2832
2833 def __eq__(self, other):
2834 if type(self) != type(other): return False
2835 if self.rate != other.rate: return False
2836 return True
2837
2838 def pretty_print(self, q):
2839 q.text("queue_prop_max_rate {")
2840 with q.group():
2841 with q.indent(2):
2842 q.breakable()
2843 q.text("rate = ");
2844 q.text("%#x" % self.rate)
2845 q.breakable()
2846 q.text('}')
2847
2848queue_prop.subtypes[2] = queue_prop_max_rate
2849
2850class queue_prop_min_rate(queue_prop):
2851 type = 1
2852
2853 def __init__(self, rate=None):
2854 if rate != None:
2855 self.rate = rate
2856 else:
2857 self.rate = 0
2858 return
2859
2860 def pack(self):
2861 packed = []
2862 packed.append(struct.pack("!H", self.type))
2863 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
2864 packed.append('\x00' * 4)
2865 packed.append(struct.pack("!H", self.rate))
2866 packed.append('\x00' * 6)
2867 length = sum([len(x) for x in packed])
2868 packed[1] = struct.pack("!H", length)
2869 return ''.join(packed)
2870
2871 @staticmethod
2872 def unpack(reader):
2873 obj = queue_prop_min_rate()
2874 _type = reader.read("!H")[0]
2875 assert(_type == 1)
2876 _len = reader.read("!H")[0]
2877 orig_reader = reader
2878 reader = orig_reader.slice(_len, 4)
2879 reader.skip(4)
2880 obj.rate = reader.read("!H")[0]
2881 reader.skip(6)
2882 return obj
2883
2884 def __eq__(self, other):
2885 if type(self) != type(other): return False
2886 if self.rate != other.rate: return False
2887 return True
2888
2889 def pretty_print(self, q):
2890 q.text("queue_prop_min_rate {")
2891 with q.group():
2892 with q.indent(2):
2893 q.breakable()
2894 q.text("rate = ");
2895 q.text("%#x" % self.rate)
2896 q.breakable()
2897 q.text('}')
2898
2899queue_prop.subtypes[1] = queue_prop_min_rate
2900
2901class queue_stats_entry(loxi.OFObject):
2902
2903 def __init__(self, port_no=None, queue_id=None, tx_bytes=None, tx_packets=None, tx_errors=None, duration_sec=None, duration_nsec=None):
2904 if port_no != None:
2905 self.port_no = port_no
2906 else:
2907 self.port_no = 0
2908 if queue_id != None:
2909 self.queue_id = queue_id
2910 else:
2911 self.queue_id = 0
2912 if tx_bytes != None:
2913 self.tx_bytes = tx_bytes
2914 else:
2915 self.tx_bytes = 0
2916 if tx_packets != None:
2917 self.tx_packets = tx_packets
2918 else:
2919 self.tx_packets = 0
2920 if tx_errors != None:
2921 self.tx_errors = tx_errors
2922 else:
2923 self.tx_errors = 0
2924 if duration_sec != None:
2925 self.duration_sec = duration_sec
2926 else:
2927 self.duration_sec = 0
2928 if duration_nsec != None:
2929 self.duration_nsec = duration_nsec
2930 else:
2931 self.duration_nsec = 0
2932 return
2933
2934 def pack(self):
2935 packed = []
2936 packed.append(util.pack_port_no(self.port_no))
2937 packed.append(struct.pack("!L", self.queue_id))
2938 packed.append(struct.pack("!Q", self.tx_bytes))
2939 packed.append(struct.pack("!Q", self.tx_packets))
2940 packed.append(struct.pack("!Q", self.tx_errors))
2941 packed.append(struct.pack("!L", self.duration_sec))
2942 packed.append(struct.pack("!L", self.duration_nsec))
2943 return ''.join(packed)
2944
2945 @staticmethod
2946 def unpack(reader):
2947 obj = queue_stats_entry()
2948 obj.port_no = util.unpack_port_no(reader)
2949 obj.queue_id = reader.read("!L")[0]
2950 obj.tx_bytes = reader.read("!Q")[0]
2951 obj.tx_packets = reader.read("!Q")[0]
2952 obj.tx_errors = reader.read("!Q")[0]
2953 obj.duration_sec = reader.read("!L")[0]
2954 obj.duration_nsec = reader.read("!L")[0]
2955 return obj
2956
2957 def __eq__(self, other):
2958 if type(self) != type(other): return False
2959 if self.port_no != other.port_no: return False
2960 if self.queue_id != other.queue_id: return False
2961 if self.tx_bytes != other.tx_bytes: return False
2962 if self.tx_packets != other.tx_packets: return False
2963 if self.tx_errors != other.tx_errors: return False
2964 if self.duration_sec != other.duration_sec: return False
2965 if self.duration_nsec != other.duration_nsec: return False
2966 return True
2967
2968 def pretty_print(self, q):
2969 q.text("queue_stats_entry {")
2970 with q.group():
2971 with q.indent(2):
2972 q.breakable()
2973 q.text("port_no = ");
2974 q.text(util.pretty_port(self.port_no))
2975 q.text(","); q.breakable()
2976 q.text("queue_id = ");
2977 q.text("%#x" % self.queue_id)
2978 q.text(","); q.breakable()
2979 q.text("tx_bytes = ");
2980 q.text("%#x" % self.tx_bytes)
2981 q.text(","); q.breakable()
2982 q.text("tx_packets = ");
2983 q.text("%#x" % self.tx_packets)
2984 q.text(","); q.breakable()
2985 q.text("tx_errors = ");
2986 q.text("%#x" % self.tx_errors)
2987 q.text(","); q.breakable()
2988 q.text("duration_sec = ");
2989 q.text("%#x" % self.duration_sec)
2990 q.text(","); q.breakable()
2991 q.text("duration_nsec = ");
2992 q.text("%#x" % self.duration_nsec)
2993 q.breakable()
2994 q.text('}')
2995
2996
2997class table_feature_prop(loxi.OFObject):
2998 subtypes = {}
2999
3000
3001 def __init__(self, type=None):
3002 if type != None:
3003 self.type = type
3004 else:
3005 self.type = 0
3006 return
3007
3008 def pack(self):
3009 packed = []
3010 packed.append(struct.pack("!H", self.type))
3011 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3012 length = sum([len(x) for x in packed])
3013 packed[1] = struct.pack("!H", length)
3014 return ''.join(packed)
3015
3016 @staticmethod
3017 def unpack(reader):
3018 subtype, = reader.peek('!H', 0)
3019 subclass = table_feature_prop.subtypes.get(subtype)
3020 if subclass:
3021 return subclass.unpack(reader)
3022
3023 obj = table_feature_prop()
3024 obj.type = reader.read("!H")[0]
3025 _length = reader.read("!H")[0]
3026 orig_reader = reader
3027 reader = orig_reader.slice(_length, 4)
3028 return obj
3029
3030 def __eq__(self, other):
3031 if type(self) != type(other): return False
3032 if self.type != other.type: return False
3033 return True
3034
3035 def pretty_print(self, q):
3036 q.text("table_feature_prop {")
3037 with q.group():
3038 with q.indent(2):
3039 q.breakable()
3040 q.breakable()
3041 q.text('}')
3042
3043
3044class table_feature_prop_apply_actions(table_feature_prop):
3045 type = 6
3046
3047 def __init__(self, action_ids=None):
3048 if action_ids != None:
3049 self.action_ids = action_ids
3050 else:
3051 self.action_ids = []
3052 return
3053
3054 def pack(self):
3055 packed = []
3056 packed.append(struct.pack("!H", self.type))
3057 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3058 packed.append(loxi.generic_util.pack_list(self.action_ids))
3059 length = sum([len(x) for x in packed])
3060 packed[1] = struct.pack("!H", length)
3061 packed.append(loxi.generic_util.pad_to(8, length))
3062 return ''.join(packed)
3063
3064 @staticmethod
3065 def unpack(reader):
3066 obj = table_feature_prop_apply_actions()
3067 _type = reader.read("!H")[0]
3068 assert(_type == 6)
3069 _length = reader.read("!H")[0]
3070 orig_reader = reader
3071 reader = orig_reader.slice(_length, 4)
3072 obj.action_ids = loxi.generic_util.unpack_list(reader, ofp.action_id.action_id.unpack)
3073 orig_reader.skip_align()
3074 return obj
3075
3076 def __eq__(self, other):
3077 if type(self) != type(other): return False
3078 if self.action_ids != other.action_ids: return False
3079 return True
3080
3081 def pretty_print(self, q):
3082 q.text("table_feature_prop_apply_actions {")
3083 with q.group():
3084 with q.indent(2):
3085 q.breakable()
3086 q.text("action_ids = ");
3087 q.pp(self.action_ids)
3088 q.breakable()
3089 q.text('}')
3090
3091table_feature_prop.subtypes[6] = table_feature_prop_apply_actions
3092
3093class table_feature_prop_apply_actions_miss(table_feature_prop):
3094 type = 7
3095
3096 def __init__(self, action_ids=None):
3097 if action_ids != None:
3098 self.action_ids = action_ids
3099 else:
3100 self.action_ids = []
3101 return
3102
3103 def pack(self):
3104 packed = []
3105 packed.append(struct.pack("!H", self.type))
3106 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3107 packed.append(loxi.generic_util.pack_list(self.action_ids))
3108 length = sum([len(x) for x in packed])
3109 packed[1] = struct.pack("!H", length)
3110 packed.append(loxi.generic_util.pad_to(8, length))
3111 return ''.join(packed)
3112
3113 @staticmethod
3114 def unpack(reader):
3115 obj = table_feature_prop_apply_actions_miss()
3116 _type = reader.read("!H")[0]
3117 assert(_type == 7)
3118 _length = reader.read("!H")[0]
3119 orig_reader = reader
3120 reader = orig_reader.slice(_length, 4)
3121 obj.action_ids = loxi.generic_util.unpack_list(reader, ofp.action_id.action_id.unpack)
3122 orig_reader.skip_align()
3123 return obj
3124
3125 def __eq__(self, other):
3126 if type(self) != type(other): return False
3127 if self.action_ids != other.action_ids: return False
3128 return True
3129
3130 def pretty_print(self, q):
3131 q.text("table_feature_prop_apply_actions_miss {")
3132 with q.group():
3133 with q.indent(2):
3134 q.breakable()
3135 q.text("action_ids = ");
3136 q.pp(self.action_ids)
3137 q.breakable()
3138 q.text('}')
3139
3140table_feature_prop.subtypes[7] = table_feature_prop_apply_actions_miss
3141
3142class table_feature_prop_apply_setfield(table_feature_prop):
3143 type = 14
3144
3145 def __init__(self, oxm_ids=None):
3146 if oxm_ids != None:
3147 self.oxm_ids = oxm_ids
3148 else:
3149 self.oxm_ids = []
3150 return
3151
3152 def pack(self):
3153 packed = []
3154 packed.append(struct.pack("!H", self.type))
3155 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3156 packed.append(loxi.generic_util.pack_list(self.oxm_ids))
3157 length = sum([len(x) for x in packed])
3158 packed[1] = struct.pack("!H", length)
3159 packed.append(loxi.generic_util.pad_to(8, length))
3160 return ''.join(packed)
3161
3162 @staticmethod
3163 def unpack(reader):
3164 obj = table_feature_prop_apply_setfield()
3165 _type = reader.read("!H")[0]
3166 assert(_type == 14)
3167 _length = reader.read("!H")[0]
3168 orig_reader = reader
3169 reader = orig_reader.slice(_length, 4)
3170 obj.oxm_ids = loxi.generic_util.unpack_list(reader, ofp.common.uint32.unpack)
3171 orig_reader.skip_align()
3172 return obj
3173
3174 def __eq__(self, other):
3175 if type(self) != type(other): return False
3176 if self.oxm_ids != other.oxm_ids: return False
3177 return True
3178
3179 def pretty_print(self, q):
3180 q.text("table_feature_prop_apply_setfield {")
3181 with q.group():
3182 with q.indent(2):
3183 q.breakable()
3184 q.text("oxm_ids = ");
3185 q.pp(self.oxm_ids)
3186 q.breakable()
3187 q.text('}')
3188
3189table_feature_prop.subtypes[14] = table_feature_prop_apply_setfield
3190
3191class table_feature_prop_apply_setfield_miss(table_feature_prop):
3192 type = 15
3193
3194 def __init__(self, oxm_ids=None):
3195 if oxm_ids != None:
3196 self.oxm_ids = oxm_ids
3197 else:
3198 self.oxm_ids = []
3199 return
3200
3201 def pack(self):
3202 packed = []
3203 packed.append(struct.pack("!H", self.type))
3204 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3205 packed.append(loxi.generic_util.pack_list(self.oxm_ids))
3206 length = sum([len(x) for x in packed])
3207 packed[1] = struct.pack("!H", length)
3208 packed.append(loxi.generic_util.pad_to(8, length))
3209 return ''.join(packed)
3210
3211 @staticmethod
3212 def unpack(reader):
3213 obj = table_feature_prop_apply_setfield_miss()
3214 _type = reader.read("!H")[0]
3215 assert(_type == 15)
3216 _length = reader.read("!H")[0]
3217 orig_reader = reader
3218 reader = orig_reader.slice(_length, 4)
3219 obj.oxm_ids = loxi.generic_util.unpack_list(reader, ofp.common.uint32.unpack)
3220 orig_reader.skip_align()
3221 return obj
3222
3223 def __eq__(self, other):
3224 if type(self) != type(other): return False
3225 if self.oxm_ids != other.oxm_ids: return False
3226 return True
3227
3228 def pretty_print(self, q):
3229 q.text("table_feature_prop_apply_setfield_miss {")
3230 with q.group():
3231 with q.indent(2):
3232 q.breakable()
3233 q.text("oxm_ids = ");
3234 q.pp(self.oxm_ids)
3235 q.breakable()
3236 q.text('}')
3237
3238table_feature_prop.subtypes[15] = table_feature_prop_apply_setfield_miss
3239
3240class table_feature_prop_experimenter(table_feature_prop):
3241 subtypes = {}
3242
3243 type = 65534
3244
3245 def __init__(self, experimenter=None, subtype=None, experimenter_data=None):
3246 if experimenter != None:
3247 self.experimenter = experimenter
3248 else:
3249 self.experimenter = 0
3250 if subtype != None:
3251 self.subtype = subtype
3252 else:
3253 self.subtype = 0
3254 if experimenter_data != None:
3255 self.experimenter_data = experimenter_data
3256 else:
3257 self.experimenter_data = ''
3258 return
3259
3260 def pack(self):
3261 packed = []
3262 packed.append(struct.pack("!H", self.type))
3263 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3264 packed.append(struct.pack("!L", self.experimenter))
3265 packed.append(struct.pack("!L", self.subtype))
3266 packed.append(self.experimenter_data)
3267 length = sum([len(x) for x in packed])
3268 packed[1] = struct.pack("!H", length)
3269 packed.append(loxi.generic_util.pad_to(8, length))
3270 return ''.join(packed)
3271
3272 @staticmethod
3273 def unpack(reader):
3274 subtype, = reader.peek('!L', 4)
3275 subclass = table_feature_prop_experimenter.subtypes.get(subtype)
3276 if subclass:
3277 return subclass.unpack(reader)
3278
3279 obj = table_feature_prop_experimenter()
3280 _type = reader.read("!H")[0]
3281 assert(_type == 65534)
3282 _length = reader.read("!H")[0]
3283 orig_reader = reader
3284 reader = orig_reader.slice(_length, 4)
3285 obj.experimenter = reader.read("!L")[0]
3286 obj.subtype = reader.read("!L")[0]
3287 obj.experimenter_data = str(reader.read_all())
3288 orig_reader.skip_align()
3289 return obj
3290
3291 def __eq__(self, other):
3292 if type(self) != type(other): return False
3293 if self.experimenter != other.experimenter: return False
3294 if self.subtype != other.subtype: return False
3295 if self.experimenter_data != other.experimenter_data: return False
3296 return True
3297
3298 def pretty_print(self, q):
3299 q.text("table_feature_prop_experimenter {")
3300 with q.group():
3301 with q.indent(2):
3302 q.breakable()
3303 q.text("subtype = ");
3304 q.text("%#x" % self.subtype)
3305 q.text(","); q.breakable()
3306 q.text("experimenter_data = ");
3307 q.pp(self.experimenter_data)
3308 q.breakable()
3309 q.text('}')
3310
3311table_feature_prop.subtypes[65534] = table_feature_prop_experimenter
3312
3313class table_feature_prop_experimenter_miss(table_feature_prop):
3314 subtypes = {}
3315
3316 type = 65535
3317
3318 def __init__(self, experimenter=None, subtype=None, experimenter_data=None):
3319 if experimenter != None:
3320 self.experimenter = experimenter
3321 else:
3322 self.experimenter = 0
3323 if subtype != None:
3324 self.subtype = subtype
3325 else:
3326 self.subtype = 0
3327 if experimenter_data != None:
3328 self.experimenter_data = experimenter_data
3329 else:
3330 self.experimenter_data = ''
3331 return
3332
3333 def pack(self):
3334 packed = []
3335 packed.append(struct.pack("!H", self.type))
3336 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3337 packed.append(struct.pack("!L", self.experimenter))
3338 packed.append(struct.pack("!L", self.subtype))
3339 packed.append(self.experimenter_data)
3340 length = sum([len(x) for x in packed])
3341 packed[1] = struct.pack("!H", length)
3342 packed.append(loxi.generic_util.pad_to(8, length))
3343 return ''.join(packed)
3344
3345 @staticmethod
3346 def unpack(reader):
3347 subtype, = reader.peek('!L', 4)
3348 subclass = table_feature_prop_experimenter_miss.subtypes.get(subtype)
3349 if subclass:
3350 return subclass.unpack(reader)
3351
3352 obj = table_feature_prop_experimenter_miss()
3353 _type = reader.read("!H")[0]
3354 assert(_type == 65535)
3355 _length = reader.read("!H")[0]
3356 orig_reader = reader
3357 reader = orig_reader.slice(_length, 4)
3358 obj.experimenter = reader.read("!L")[0]
3359 obj.subtype = reader.read("!L")[0]
3360 obj.experimenter_data = str(reader.read_all())
3361 orig_reader.skip_align()
3362 return obj
3363
3364 def __eq__(self, other):
3365 if type(self) != type(other): return False
3366 if self.experimenter != other.experimenter: return False
3367 if self.subtype != other.subtype: return False
3368 if self.experimenter_data != other.experimenter_data: return False
3369 return True
3370
3371 def pretty_print(self, q):
3372 q.text("table_feature_prop_experimenter_miss {")
3373 with q.group():
3374 with q.indent(2):
3375 q.breakable()
3376 q.text("subtype = ");
3377 q.text("%#x" % self.subtype)
3378 q.text(","); q.breakable()
3379 q.text("experimenter_data = ");
3380 q.pp(self.experimenter_data)
3381 q.breakable()
3382 q.text('}')
3383
3384table_feature_prop.subtypes[65535] = table_feature_prop_experimenter_miss
3385
3386class table_feature_prop_instructions(table_feature_prop):
3387 type = 0
3388
3389 def __init__(self, instruction_ids=None):
3390 if instruction_ids != None:
3391 self.instruction_ids = instruction_ids
3392 else:
3393 self.instruction_ids = []
3394 return
3395
3396 def pack(self):
3397 packed = []
3398 packed.append(struct.pack("!H", self.type))
3399 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3400 packed.append(loxi.generic_util.pack_list(self.instruction_ids))
3401 length = sum([len(x) for x in packed])
3402 packed[1] = struct.pack("!H", length)
3403 packed.append(loxi.generic_util.pad_to(8, length))
3404 return ''.join(packed)
3405
3406 @staticmethod
3407 def unpack(reader):
3408 obj = table_feature_prop_instructions()
3409 _type = reader.read("!H")[0]
3410 assert(_type == 0)
3411 _length = reader.read("!H")[0]
3412 orig_reader = reader
3413 reader = orig_reader.slice(_length, 4)
3414 obj.instruction_ids = loxi.generic_util.unpack_list(reader, ofp.instruction_id.instruction_id.unpack)
3415 orig_reader.skip_align()
3416 return obj
3417
3418 def __eq__(self, other):
3419 if type(self) != type(other): return False
3420 if self.instruction_ids != other.instruction_ids: return False
3421 return True
3422
3423 def pretty_print(self, q):
3424 q.text("table_feature_prop_instructions {")
3425 with q.group():
3426 with q.indent(2):
3427 q.breakable()
3428 q.text("instruction_ids = ");
3429 q.pp(self.instruction_ids)
3430 q.breakable()
3431 q.text('}')
3432
3433table_feature_prop.subtypes[0] = table_feature_prop_instructions
3434
3435class table_feature_prop_instructions_miss(table_feature_prop):
3436 type = 1
3437
3438 def __init__(self, instruction_ids=None):
3439 if instruction_ids != None:
3440 self.instruction_ids = instruction_ids
3441 else:
3442 self.instruction_ids = []
3443 return
3444
3445 def pack(self):
3446 packed = []
3447 packed.append(struct.pack("!H", self.type))
3448 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3449 packed.append(loxi.generic_util.pack_list(self.instruction_ids))
3450 length = sum([len(x) for x in packed])
3451 packed[1] = struct.pack("!H", length)
3452 packed.append(loxi.generic_util.pad_to(8, length))
3453 return ''.join(packed)
3454
3455 @staticmethod
3456 def unpack(reader):
3457 obj = table_feature_prop_instructions_miss()
3458 _type = reader.read("!H")[0]
3459 assert(_type == 1)
3460 _length = reader.read("!H")[0]
3461 orig_reader = reader
3462 reader = orig_reader.slice(_length, 4)
3463 obj.instruction_ids = loxi.generic_util.unpack_list(reader, ofp.instruction_id.instruction_id.unpack)
3464 orig_reader.skip_align()
3465 return obj
3466
3467 def __eq__(self, other):
3468 if type(self) != type(other): return False
3469 if self.instruction_ids != other.instruction_ids: return False
3470 return True
3471
3472 def pretty_print(self, q):
3473 q.text("table_feature_prop_instructions_miss {")
3474 with q.group():
3475 with q.indent(2):
3476 q.breakable()
3477 q.text("instruction_ids = ");
3478 q.pp(self.instruction_ids)
3479 q.breakable()
3480 q.text('}')
3481
3482table_feature_prop.subtypes[1] = table_feature_prop_instructions_miss
3483
3484class table_feature_prop_match(table_feature_prop):
3485 type = 8
3486
3487 def __init__(self, oxm_ids=None):
3488 if oxm_ids != None:
3489 self.oxm_ids = oxm_ids
3490 else:
3491 self.oxm_ids = []
3492 return
3493
3494 def pack(self):
3495 packed = []
3496 packed.append(struct.pack("!H", self.type))
3497 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3498 packed.append(loxi.generic_util.pack_list(self.oxm_ids))
3499 length = sum([len(x) for x in packed])
3500 packed[1] = struct.pack("!H", length)
3501 packed.append(loxi.generic_util.pad_to(8, length))
3502 return ''.join(packed)
3503
3504 @staticmethod
3505 def unpack(reader):
3506 obj = table_feature_prop_match()
3507 _type = reader.read("!H")[0]
3508 assert(_type == 8)
3509 _length = reader.read("!H")[0]
3510 orig_reader = reader
3511 reader = orig_reader.slice(_length, 4)
3512 obj.oxm_ids = loxi.generic_util.unpack_list(reader, ofp.common.uint32.unpack)
3513 orig_reader.skip_align()
3514 return obj
3515
3516 def __eq__(self, other):
3517 if type(self) != type(other): return False
3518 if self.oxm_ids != other.oxm_ids: return False
3519 return True
3520
3521 def pretty_print(self, q):
3522 q.text("table_feature_prop_match {")
3523 with q.group():
3524 with q.indent(2):
3525 q.breakable()
3526 q.text("oxm_ids = ");
3527 q.pp(self.oxm_ids)
3528 q.breakable()
3529 q.text('}')
3530
3531table_feature_prop.subtypes[8] = table_feature_prop_match
3532
3533class table_feature_prop_next_tables(table_feature_prop):
3534 type = 2
3535
3536 def __init__(self, next_table_ids=None):
3537 if next_table_ids != None:
3538 self.next_table_ids = next_table_ids
3539 else:
3540 self.next_table_ids = []
3541 return
3542
3543 def pack(self):
3544 packed = []
3545 packed.append(struct.pack("!H", self.type))
3546 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3547 packed.append(loxi.generic_util.pack_list(self.next_table_ids))
3548 length = sum([len(x) for x in packed])
3549 packed[1] = struct.pack("!H", length)
3550 packed.append(loxi.generic_util.pad_to(8, length))
3551 return ''.join(packed)
3552
3553 @staticmethod
3554 def unpack(reader):
3555 obj = table_feature_prop_next_tables()
3556 _type = reader.read("!H")[0]
3557 assert(_type == 2)
3558 _length = reader.read("!H")[0]
3559 orig_reader = reader
3560 reader = orig_reader.slice(_length, 4)
3561 obj.next_table_ids = loxi.generic_util.unpack_list(reader, ofp.common.uint8.unpack)
3562 orig_reader.skip_align()
3563 return obj
3564
3565 def __eq__(self, other):
3566 if type(self) != type(other): return False
3567 if self.next_table_ids != other.next_table_ids: return False
3568 return True
3569
3570 def pretty_print(self, q):
3571 q.text("table_feature_prop_next_tables {")
3572 with q.group():
3573 with q.indent(2):
3574 q.breakable()
3575 q.text("next_table_ids = ");
3576 q.pp(self.next_table_ids)
3577 q.breakable()
3578 q.text('}')
3579
3580table_feature_prop.subtypes[2] = table_feature_prop_next_tables
3581
3582class table_feature_prop_next_tables_miss(table_feature_prop):
3583 type = 3
3584
3585 def __init__(self, next_table_ids=None):
3586 if next_table_ids != None:
3587 self.next_table_ids = next_table_ids
3588 else:
3589 self.next_table_ids = []
3590 return
3591
3592 def pack(self):
3593 packed = []
3594 packed.append(struct.pack("!H", self.type))
3595 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3596 packed.append(loxi.generic_util.pack_list(self.next_table_ids))
3597 length = sum([len(x) for x in packed])
3598 packed[1] = struct.pack("!H", length)
3599 packed.append(loxi.generic_util.pad_to(8, length))
3600 return ''.join(packed)
3601
3602 @staticmethod
3603 def unpack(reader):
3604 obj = table_feature_prop_next_tables_miss()
3605 _type = reader.read("!H")[0]
3606 assert(_type == 3)
3607 _length = reader.read("!H")[0]
3608 orig_reader = reader
3609 reader = orig_reader.slice(_length, 4)
3610 obj.next_table_ids = loxi.generic_util.unpack_list(reader, ofp.common.uint8.unpack)
3611 orig_reader.skip_align()
3612 return obj
3613
3614 def __eq__(self, other):
3615 if type(self) != type(other): return False
3616 if self.next_table_ids != other.next_table_ids: return False
3617 return True
3618
3619 def pretty_print(self, q):
3620 q.text("table_feature_prop_next_tables_miss {")
3621 with q.group():
3622 with q.indent(2):
3623 q.breakable()
3624 q.text("next_table_ids = ");
3625 q.pp(self.next_table_ids)
3626 q.breakable()
3627 q.text('}')
3628
3629table_feature_prop.subtypes[3] = table_feature_prop_next_tables_miss
3630
3631class table_feature_prop_wildcards(table_feature_prop):
3632 type = 10
3633
3634 def __init__(self, oxm_ids=None):
3635 if oxm_ids != None:
3636 self.oxm_ids = oxm_ids
3637 else:
3638 self.oxm_ids = []
3639 return
3640
3641 def pack(self):
3642 packed = []
3643 packed.append(struct.pack("!H", self.type))
3644 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3645 packed.append(loxi.generic_util.pack_list(self.oxm_ids))
3646 length = sum([len(x) for x in packed])
3647 packed[1] = struct.pack("!H", length)
3648 packed.append(loxi.generic_util.pad_to(8, length))
3649 return ''.join(packed)
3650
3651 @staticmethod
3652 def unpack(reader):
3653 obj = table_feature_prop_wildcards()
3654 _type = reader.read("!H")[0]
3655 assert(_type == 10)
3656 _length = reader.read("!H")[0]
3657 orig_reader = reader
3658 reader = orig_reader.slice(_length, 4)
3659 obj.oxm_ids = loxi.generic_util.unpack_list(reader, ofp.common.uint32.unpack)
3660 orig_reader.skip_align()
3661 return obj
3662
3663 def __eq__(self, other):
3664 if type(self) != type(other): return False
3665 if self.oxm_ids != other.oxm_ids: return False
3666 return True
3667
3668 def pretty_print(self, q):
3669 q.text("table_feature_prop_wildcards {")
3670 with q.group():
3671 with q.indent(2):
3672 q.breakable()
3673 q.text("oxm_ids = ");
3674 q.pp(self.oxm_ids)
3675 q.breakable()
3676 q.text('}')
3677
3678table_feature_prop.subtypes[10] = table_feature_prop_wildcards
3679
3680class table_feature_prop_write_actions(table_feature_prop):
3681 type = 4
3682
3683 def __init__(self, action_ids=None):
3684 if action_ids != None:
3685 self.action_ids = action_ids
3686 else:
3687 self.action_ids = []
3688 return
3689
3690 def pack(self):
3691 packed = []
3692 packed.append(struct.pack("!H", self.type))
3693 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3694 packed.append(loxi.generic_util.pack_list(self.action_ids))
3695 length = sum([len(x) for x in packed])
3696 packed[1] = struct.pack("!H", length)
3697 packed.append(loxi.generic_util.pad_to(8, length))
3698 return ''.join(packed)
3699
3700 @staticmethod
3701 def unpack(reader):
3702 obj = table_feature_prop_write_actions()
3703 _type = reader.read("!H")[0]
3704 assert(_type == 4)
3705 _length = reader.read("!H")[0]
3706 orig_reader = reader
3707 reader = orig_reader.slice(_length, 4)
3708 obj.action_ids = loxi.generic_util.unpack_list(reader, ofp.action_id.action_id.unpack)
3709 orig_reader.skip_align()
3710 return obj
3711
3712 def __eq__(self, other):
3713 if type(self) != type(other): return False
3714 if self.action_ids != other.action_ids: return False
3715 return True
3716
3717 def pretty_print(self, q):
3718 q.text("table_feature_prop_write_actions {")
3719 with q.group():
3720 with q.indent(2):
3721 q.breakable()
3722 q.text("action_ids = ");
3723 q.pp(self.action_ids)
3724 q.breakable()
3725 q.text('}')
3726
3727table_feature_prop.subtypes[4] = table_feature_prop_write_actions
3728
3729class table_feature_prop_write_actions_miss(table_feature_prop):
3730 type = 5
3731
3732 def __init__(self, action_ids=None):
3733 if action_ids != None:
3734 self.action_ids = action_ids
3735 else:
3736 self.action_ids = []
3737 return
3738
3739 def pack(self):
3740 packed = []
3741 packed.append(struct.pack("!H", self.type))
3742 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3743 packed.append(loxi.generic_util.pack_list(self.action_ids))
3744 length = sum([len(x) for x in packed])
3745 packed[1] = struct.pack("!H", length)
3746 packed.append(loxi.generic_util.pad_to(8, length))
3747 return ''.join(packed)
3748
3749 @staticmethod
3750 def unpack(reader):
3751 obj = table_feature_prop_write_actions_miss()
3752 _type = reader.read("!H")[0]
3753 assert(_type == 5)
3754 _length = reader.read("!H")[0]
3755 orig_reader = reader
3756 reader = orig_reader.slice(_length, 4)
3757 obj.action_ids = loxi.generic_util.unpack_list(reader, ofp.action_id.action_id.unpack)
3758 orig_reader.skip_align()
3759 return obj
3760
3761 def __eq__(self, other):
3762 if type(self) != type(other): return False
3763 if self.action_ids != other.action_ids: return False
3764 return True
3765
3766 def pretty_print(self, q):
3767 q.text("table_feature_prop_write_actions_miss {")
3768 with q.group():
3769 with q.indent(2):
3770 q.breakable()
3771 q.text("action_ids = ");
3772 q.pp(self.action_ids)
3773 q.breakable()
3774 q.text('}')
3775
3776table_feature_prop.subtypes[5] = table_feature_prop_write_actions_miss
3777
3778class table_feature_prop_write_setfield(table_feature_prop):
3779 type = 12
3780
3781 def __init__(self, oxm_ids=None):
3782 if oxm_ids != None:
3783 self.oxm_ids = oxm_ids
3784 else:
3785 self.oxm_ids = []
3786 return
3787
3788 def pack(self):
3789 packed = []
3790 packed.append(struct.pack("!H", self.type))
3791 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3792 packed.append(loxi.generic_util.pack_list(self.oxm_ids))
3793 length = sum([len(x) for x in packed])
3794 packed[1] = struct.pack("!H", length)
3795 packed.append(loxi.generic_util.pad_to(8, length))
3796 return ''.join(packed)
3797
3798 @staticmethod
3799 def unpack(reader):
3800 obj = table_feature_prop_write_setfield()
3801 _type = reader.read("!H")[0]
3802 assert(_type == 12)
3803 _length = reader.read("!H")[0]
3804 orig_reader = reader
3805 reader = orig_reader.slice(_length, 4)
3806 obj.oxm_ids = loxi.generic_util.unpack_list(reader, ofp.common.uint32.unpack)
3807 orig_reader.skip_align()
3808 return obj
3809
3810 def __eq__(self, other):
3811 if type(self) != type(other): return False
3812 if self.oxm_ids != other.oxm_ids: return False
3813 return True
3814
3815 def pretty_print(self, q):
3816 q.text("table_feature_prop_write_setfield {")
3817 with q.group():
3818 with q.indent(2):
3819 q.breakable()
3820 q.text("oxm_ids = ");
3821 q.pp(self.oxm_ids)
3822 q.breakable()
3823 q.text('}')
3824
3825table_feature_prop.subtypes[12] = table_feature_prop_write_setfield
3826
3827class table_feature_prop_write_setfield_miss(table_feature_prop):
3828 type = 13
3829
3830 def __init__(self, oxm_ids=None):
3831 if oxm_ids != None:
3832 self.oxm_ids = oxm_ids
3833 else:
3834 self.oxm_ids = []
3835 return
3836
3837 def pack(self):
3838 packed = []
3839 packed.append(struct.pack("!H", self.type))
3840 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3841 packed.append(loxi.generic_util.pack_list(self.oxm_ids))
3842 length = sum([len(x) for x in packed])
3843 packed[1] = struct.pack("!H", length)
3844 packed.append(loxi.generic_util.pad_to(8, length))
3845 return ''.join(packed)
3846
3847 @staticmethod
3848 def unpack(reader):
3849 obj = table_feature_prop_write_setfield_miss()
3850 _type = reader.read("!H")[0]
3851 assert(_type == 13)
3852 _length = reader.read("!H")[0]
3853 orig_reader = reader
3854 reader = orig_reader.slice(_length, 4)
3855 obj.oxm_ids = loxi.generic_util.unpack_list(reader, ofp.common.uint32.unpack)
3856 orig_reader.skip_align()
3857 return obj
3858
3859 def __eq__(self, other):
3860 if type(self) != type(other): return False
3861 if self.oxm_ids != other.oxm_ids: return False
3862 return True
3863
3864 def pretty_print(self, q):
3865 q.text("table_feature_prop_write_setfield_miss {")
3866 with q.group():
3867 with q.indent(2):
3868 q.breakable()
3869 q.text("oxm_ids = ");
3870 q.pp(self.oxm_ids)
3871 q.breakable()
3872 q.text('}')
3873
3874table_feature_prop.subtypes[13] = table_feature_prop_write_setfield_miss
3875
3876class table_features(loxi.OFObject):
3877
3878 def __init__(self, table_id=None, name=None, metadata_match=None, metadata_write=None, config=None, max_entries=None, properties=None):
3879 if table_id != None:
3880 self.table_id = table_id
3881 else:
3882 self.table_id = 0
3883 if name != None:
3884 self.name = name
3885 else:
3886 self.name = ""
3887 if metadata_match != None:
3888 self.metadata_match = metadata_match
3889 else:
3890 self.metadata_match = 0
3891 if metadata_write != None:
3892 self.metadata_write = metadata_write
3893 else:
3894 self.metadata_write = 0
3895 if config != None:
3896 self.config = config
3897 else:
3898 self.config = 0
3899 if max_entries != None:
3900 self.max_entries = max_entries
3901 else:
3902 self.max_entries = 0
3903 if properties != None:
3904 self.properties = properties
3905 else:
3906 self.properties = []
3907 return
3908
3909 def pack(self):
3910 packed = []
3911 packed.append(struct.pack("!H", 0)) # placeholder for length at index 0
3912 packed.append(struct.pack("!B", self.table_id))
3913 packed.append('\x00' * 5)
3914 packed.append(struct.pack("!32s", self.name))
3915 packed.append(struct.pack("!Q", self.metadata_match))
3916 packed.append(struct.pack("!Q", self.metadata_write))
3917 packed.append(struct.pack("!L", self.config))
3918 packed.append(struct.pack("!L", self.max_entries))
3919 packed.append(loxi.generic_util.pack_list(self.properties))
3920 length = sum([len(x) for x in packed])
3921 packed[0] = struct.pack("!H", length)
3922 return ''.join(packed)
3923
3924 @staticmethod
3925 def unpack(reader):
3926 obj = table_features()
3927 _length = reader.read("!H")[0]
3928 orig_reader = reader
3929 reader = orig_reader.slice(_length, 2)
3930 obj.table_id = reader.read("!B")[0]
3931 reader.skip(5)
3932 obj.name = reader.read("!32s")[0].rstrip("\x00")
3933 obj.metadata_match = reader.read("!Q")[0]
3934 obj.metadata_write = reader.read("!Q")[0]
3935 obj.config = reader.read("!L")[0]
3936 obj.max_entries = reader.read("!L")[0]
3937 obj.properties = loxi.generic_util.unpack_list(reader, ofp.common.table_feature_prop.unpack)
3938 return obj
3939
3940 def __eq__(self, other):
3941 if type(self) != type(other): return False
3942 if self.table_id != other.table_id: return False
3943 if self.name != other.name: return False
3944 if self.metadata_match != other.metadata_match: return False
3945 if self.metadata_write != other.metadata_write: return False
3946 if self.config != other.config: return False
3947 if self.max_entries != other.max_entries: return False
3948 if self.properties != other.properties: return False
3949 return True
3950
3951 def pretty_print(self, q):
3952 q.text("table_features {")
3953 with q.group():
3954 with q.indent(2):
3955 q.breakable()
3956 q.text("table_id = ");
3957 q.text("%#x" % self.table_id)
3958 q.text(","); q.breakable()
3959 q.text("name = ");
3960 q.pp(self.name)
3961 q.text(","); q.breakable()
3962 q.text("metadata_match = ");
3963 q.text("%#x" % self.metadata_match)
3964 q.text(","); q.breakable()
3965 q.text("metadata_write = ");
3966 q.text("%#x" % self.metadata_write)
3967 q.text(","); q.breakable()
3968 q.text("config = ");
3969 q.text("%#x" % self.config)
3970 q.text(","); q.breakable()
3971 q.text("max_entries = ");
3972 q.text("%#x" % self.max_entries)
3973 q.text(","); q.breakable()
3974 q.text("properties = ");
3975 q.pp(self.properties)
3976 q.breakable()
3977 q.text('}')
3978
3979
3980class table_stats_entry(loxi.OFObject):
3981
3982 def __init__(self, table_id=None, active_count=None, lookup_count=None, matched_count=None):
3983 if table_id != None:
3984 self.table_id = table_id
3985 else:
3986 self.table_id = 0
3987 if active_count != None:
3988 self.active_count = active_count
3989 else:
3990 self.active_count = 0
3991 if lookup_count != None:
3992 self.lookup_count = lookup_count
3993 else:
3994 self.lookup_count = 0
3995 if matched_count != None:
3996 self.matched_count = matched_count
3997 else:
3998 self.matched_count = 0
3999 return
4000
4001 def pack(self):
4002 packed = []
4003 packed.append(struct.pack("!B", self.table_id))
4004 packed.append('\x00' * 3)
4005 packed.append(struct.pack("!L", self.active_count))
4006 packed.append(struct.pack("!Q", self.lookup_count))
4007 packed.append(struct.pack("!Q", self.matched_count))
4008 return ''.join(packed)
4009
4010 @staticmethod
4011 def unpack(reader):
4012 obj = table_stats_entry()
4013 obj.table_id = reader.read("!B")[0]
4014 reader.skip(3)
4015 obj.active_count = reader.read("!L")[0]
4016 obj.lookup_count = reader.read("!Q")[0]
4017 obj.matched_count = reader.read("!Q")[0]
4018 return obj
4019
4020 def __eq__(self, other):
4021 if type(self) != type(other): return False
4022 if self.table_id != other.table_id: return False
4023 if self.active_count != other.active_count: return False
4024 if self.lookup_count != other.lookup_count: return False
4025 if self.matched_count != other.matched_count: return False
4026 return True
4027
4028 def pretty_print(self, q):
4029 q.text("table_stats_entry {")
4030 with q.group():
4031 with q.indent(2):
4032 q.breakable()
4033 q.text("table_id = ");
4034 q.text("%#x" % self.table_id)
4035 q.text(","); q.breakable()
4036 q.text("active_count = ");
4037 q.text("%#x" % self.active_count)
4038 q.text(","); q.breakable()
4039 q.text("lookup_count = ");
4040 q.text("%#x" % self.lookup_count)
4041 q.text(","); q.breakable()
4042 q.text("matched_count = ");
4043 q.text("%#x" % self.matched_count)
4044 q.breakable()
4045 q.text('}')
4046
4047
4048class uint32(loxi.OFObject):
4049
4050 def __init__(self, value=None):
4051 if value != None:
4052 self.value = value
4053 else:
4054 self.value = 0
4055 return
4056
4057 def pack(self):
4058 packed = []
4059 packed.append(struct.pack("!L", self.value))
4060 return ''.join(packed)
4061
4062 @staticmethod
4063 def unpack(reader):
4064 obj = uint32()
4065 obj.value = reader.read("!L")[0]
4066 return obj
4067
4068 def __eq__(self, other):
4069 if type(self) != type(other): return False
4070 if self.value != other.value: return False
4071 return True
4072
4073 def pretty_print(self, q):
4074 q.text("uint32 {")
4075 with q.group():
4076 with q.indent(2):
4077 q.breakable()
4078 q.text("value = ");
4079 q.text("%#x" % self.value)
4080 q.breakable()
4081 q.text('}')
4082
4083
4084class uint64(loxi.OFObject):
4085
4086 def __init__(self, value=None):
4087 if value != None:
4088 self.value = value
4089 else:
4090 self.value = 0
4091 return
4092
4093 def pack(self):
4094 packed = []
4095 packed.append(struct.pack("!Q", self.value))
4096 return ''.join(packed)
4097
4098 @staticmethod
4099 def unpack(reader):
4100 obj = uint64()
4101 obj.value = reader.read("!Q")[0]
4102 return obj
4103
4104 def __eq__(self, other):
4105 if type(self) != type(other): return False
4106 if self.value != other.value: return False
4107 return True
4108
4109 def pretty_print(self, q):
4110 q.text("uint64 {")
4111 with q.group():
4112 with q.indent(2):
4113 q.breakable()
4114 q.text("value = ");
4115 q.text("%#x" % self.value)
4116 q.breakable()
4117 q.text('}')
4118
4119
4120class uint8(loxi.OFObject):
4121
4122 def __init__(self, value=None):
4123 if value != None:
4124 self.value = value
4125 else:
4126 self.value = 0
4127 return
4128
4129 def pack(self):
4130 packed = []
4131 packed.append(struct.pack("!B", self.value))
4132 return ''.join(packed)
4133
4134 @staticmethod
4135 def unpack(reader):
4136 obj = uint8()
4137 obj.value = reader.read("!B")[0]
4138 return obj
4139
4140 def __eq__(self, other):
4141 if type(self) != type(other): return False
4142 if self.value != other.value: return False
4143 return True
4144
4145 def pretty_print(self, q):
4146 q.text("uint8 {")
4147 with q.group():
4148 with q.indent(2):
4149 q.breakable()
4150 q.text("value = ");
4151 q.text("%#x" % self.value)
4152 q.breakable()
4153 q.text('}')
4154
4155
4156
4157match = match_v3