blob: 2adac3c9dc29ff59eb7832864bf3bd75b62448bb [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.of14']
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, importance=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 importance != None:
1562 self.importance = importance
1563 else:
1564 self.importance = 0
1565 if cookie != None:
1566 self.cookie = cookie
1567 else:
1568 self.cookie = 0
1569 if packet_count != None:
1570 self.packet_count = packet_count
1571 else:
1572 self.packet_count = 0
1573 if byte_count != None:
1574 self.byte_count = byte_count
1575 else:
1576 self.byte_count = 0
1577 if match != None:
1578 self.match = match
1579 else:
1580 self.match = ofp.match()
1581 if instructions != None:
1582 self.instructions = instructions
1583 else:
1584 self.instructions = []
1585 return
1586
1587 def pack(self):
1588 packed = []
1589 packed.append(struct.pack("!H", 0)) # placeholder for length at index 0
1590 packed.append(struct.pack("!B", self.table_id))
1591 packed.append('\x00' * 1)
1592 packed.append(struct.pack("!L", self.duration_sec))
1593 packed.append(struct.pack("!L", self.duration_nsec))
1594 packed.append(struct.pack("!H", self.priority))
1595 packed.append(struct.pack("!H", self.idle_timeout))
1596 packed.append(struct.pack("!H", self.hard_timeout))
1597 packed.append(struct.pack("!H", self.flags))
1598 packed.append(struct.pack("!H", self.importance))
1599 packed.append('\x00' * 2)
1600 packed.append(struct.pack("!Q", self.cookie))
1601 packed.append(struct.pack("!Q", self.packet_count))
1602 packed.append(struct.pack("!Q", self.byte_count))
1603 packed.append(self.match.pack())
1604 packed.append(loxi.generic_util.pack_list(self.instructions))
1605 length = sum([len(x) for x in packed])
1606 packed[0] = struct.pack("!H", length)
1607 return ''.join(packed)
1608
1609 @staticmethod
1610 def unpack(reader):
1611 obj = flow_stats_entry()
1612 _length = reader.read("!H")[0]
1613 orig_reader = reader
1614 reader = orig_reader.slice(_length, 2)
1615 obj.table_id = reader.read("!B")[0]
1616 reader.skip(1)
1617 obj.duration_sec = reader.read("!L")[0]
1618 obj.duration_nsec = reader.read("!L")[0]
1619 obj.priority = reader.read("!H")[0]
1620 obj.idle_timeout = reader.read("!H")[0]
1621 obj.hard_timeout = reader.read("!H")[0]
1622 obj.flags = reader.read("!H")[0]
1623 obj.importance = reader.read("!H")[0]
1624 reader.skip(2)
1625 obj.cookie = reader.read("!Q")[0]
1626 obj.packet_count = reader.read("!Q")[0]
1627 obj.byte_count = reader.read("!Q")[0]
1628 obj.match = ofp.match.unpack(reader)
1629 obj.instructions = loxi.generic_util.unpack_list(reader, ofp.instruction.instruction.unpack)
1630 return obj
1631
1632 def __eq__(self, other):
1633 if type(self) != type(other): return False
1634 if self.table_id != other.table_id: return False
1635 if self.duration_sec != other.duration_sec: return False
1636 if self.duration_nsec != other.duration_nsec: return False
1637 if self.priority != other.priority: return False
1638 if self.idle_timeout != other.idle_timeout: return False
1639 if self.hard_timeout != other.hard_timeout: return False
1640 if self.flags != other.flags: return False
1641 if self.importance != other.importance: return False
1642 if self.cookie != other.cookie: return False
1643 if self.packet_count != other.packet_count: return False
1644 if self.byte_count != other.byte_count: return False
1645 if self.match != other.match: return False
1646 if self.instructions != other.instructions: return False
1647 return True
1648
1649 def pretty_print(self, q):
1650 q.text("flow_stats_entry {")
1651 with q.group():
1652 with q.indent(2):
1653 q.breakable()
1654 q.text("table_id = ");
1655 q.text("%#x" % self.table_id)
1656 q.text(","); q.breakable()
1657 q.text("duration_sec = ");
1658 q.text("%#x" % self.duration_sec)
1659 q.text(","); q.breakable()
1660 q.text("duration_nsec = ");
1661 q.text("%#x" % self.duration_nsec)
1662 q.text(","); q.breakable()
1663 q.text("priority = ");
1664 q.text("%#x" % self.priority)
1665 q.text(","); q.breakable()
1666 q.text("idle_timeout = ");
1667 q.text("%#x" % self.idle_timeout)
1668 q.text(","); q.breakable()
1669 q.text("hard_timeout = ");
1670 q.text("%#x" % self.hard_timeout)
1671 q.text(","); q.breakable()
1672 q.text("flags = ");
1673 q.text("%#x" % self.flags)
1674 q.text(","); q.breakable()
1675 q.text("importance = ");
1676 q.text("%#x" % self.importance)
1677 q.text(","); q.breakable()
1678 q.text("cookie = ");
1679 q.text("%#x" % self.cookie)
1680 q.text(","); q.breakable()
1681 q.text("packet_count = ");
1682 q.text("%#x" % self.packet_count)
1683 q.text(","); q.breakable()
1684 q.text("byte_count = ");
1685 q.text("%#x" % self.byte_count)
1686 q.text(","); q.breakable()
1687 q.text("match = ");
1688 q.pp(self.match)
1689 q.text(","); q.breakable()
1690 q.text("instructions = ");
1691 q.pp(self.instructions)
1692 q.breakable()
1693 q.text('}')
1694
1695
1696class group_desc_stats_entry(loxi.OFObject):
1697
1698 def __init__(self, group_type=None, group_id=None, buckets=None):
1699 if group_type != None:
1700 self.group_type = group_type
1701 else:
1702 self.group_type = 0
1703 if group_id != None:
1704 self.group_id = group_id
1705 else:
1706 self.group_id = 0
1707 if buckets != None:
1708 self.buckets = buckets
1709 else:
1710 self.buckets = []
1711 return
1712
1713 def pack(self):
1714 packed = []
1715 packed.append(struct.pack("!H", 0)) # placeholder for length at index 0
1716 packed.append(struct.pack("!B", self.group_type))
1717 packed.append('\x00' * 1)
1718 packed.append(struct.pack("!L", self.group_id))
1719 packed.append(loxi.generic_util.pack_list(self.buckets))
1720 length = sum([len(x) for x in packed])
1721 packed[0] = struct.pack("!H", length)
1722 return ''.join(packed)
1723
1724 @staticmethod
1725 def unpack(reader):
1726 obj = group_desc_stats_entry()
1727 _length = reader.read("!H")[0]
1728 orig_reader = reader
1729 reader = orig_reader.slice(_length, 2)
1730 obj.group_type = reader.read("!B")[0]
1731 reader.skip(1)
1732 obj.group_id = reader.read("!L")[0]
1733 obj.buckets = loxi.generic_util.unpack_list(reader, ofp.common.bucket.unpack)
1734 return obj
1735
1736 def __eq__(self, other):
1737 if type(self) != type(other): return False
1738 if self.group_type != other.group_type: return False
1739 if self.group_id != other.group_id: return False
1740 if self.buckets != other.buckets: return False
1741 return True
1742
1743 def pretty_print(self, q):
1744 q.text("group_desc_stats_entry {")
1745 with q.group():
1746 with q.indent(2):
1747 q.breakable()
1748 q.text("group_type = ");
1749 q.text("%#x" % self.group_type)
1750 q.text(","); q.breakable()
1751 q.text("group_id = ");
1752 q.text("%#x" % self.group_id)
1753 q.text(","); q.breakable()
1754 q.text("buckets = ");
1755 q.pp(self.buckets)
1756 q.breakable()
1757 q.text('}')
1758
1759
1760class group_stats_entry(loxi.OFObject):
1761
1762 def __init__(self, group_id=None, ref_count=None, packet_count=None, byte_count=None, duration_sec=None, duration_nsec=None, bucket_stats=None):
1763 if group_id != None:
1764 self.group_id = group_id
1765 else:
1766 self.group_id = 0
1767 if ref_count != None:
1768 self.ref_count = ref_count
1769 else:
1770 self.ref_count = 0
1771 if packet_count != None:
1772 self.packet_count = packet_count
1773 else:
1774 self.packet_count = 0
1775 if byte_count != None:
1776 self.byte_count = byte_count
1777 else:
1778 self.byte_count = 0
1779 if duration_sec != None:
1780 self.duration_sec = duration_sec
1781 else:
1782 self.duration_sec = 0
1783 if duration_nsec != None:
1784 self.duration_nsec = duration_nsec
1785 else:
1786 self.duration_nsec = 0
1787 if bucket_stats != None:
1788 self.bucket_stats = bucket_stats
1789 else:
1790 self.bucket_stats = []
1791 return
1792
1793 def pack(self):
1794 packed = []
1795 packed.append(struct.pack("!H", 0)) # placeholder for length at index 0
1796 packed.append('\x00' * 2)
1797 packed.append(struct.pack("!L", self.group_id))
1798 packed.append(struct.pack("!L", self.ref_count))
1799 packed.append('\x00' * 4)
1800 packed.append(struct.pack("!Q", self.packet_count))
1801 packed.append(struct.pack("!Q", self.byte_count))
1802 packed.append(struct.pack("!L", self.duration_sec))
1803 packed.append(struct.pack("!L", self.duration_nsec))
1804 packed.append(loxi.generic_util.pack_list(self.bucket_stats))
1805 length = sum([len(x) for x in packed])
1806 packed[0] = struct.pack("!H", length)
1807 return ''.join(packed)
1808
1809 @staticmethod
1810 def unpack(reader):
1811 obj = group_stats_entry()
1812 _length = reader.read("!H")[0]
1813 orig_reader = reader
1814 reader = orig_reader.slice(_length, 2)
1815 reader.skip(2)
1816 obj.group_id = reader.read("!L")[0]
1817 obj.ref_count = reader.read("!L")[0]
1818 reader.skip(4)
1819 obj.packet_count = reader.read("!Q")[0]
1820 obj.byte_count = reader.read("!Q")[0]
1821 obj.duration_sec = reader.read("!L")[0]
1822 obj.duration_nsec = reader.read("!L")[0]
1823 obj.bucket_stats = loxi.generic_util.unpack_list(reader, ofp.common.bucket_counter.unpack)
1824 return obj
1825
1826 def __eq__(self, other):
1827 if type(self) != type(other): return False
1828 if self.group_id != other.group_id: return False
1829 if self.ref_count != other.ref_count: return False
1830 if self.packet_count != other.packet_count: return False
1831 if self.byte_count != other.byte_count: return False
1832 if self.duration_sec != other.duration_sec: return False
1833 if self.duration_nsec != other.duration_nsec: return False
1834 if self.bucket_stats != other.bucket_stats: return False
1835 return True
1836
1837 def pretty_print(self, q):
1838 q.text("group_stats_entry {")
1839 with q.group():
1840 with q.indent(2):
1841 q.breakable()
1842 q.text("group_id = ");
1843 q.text("%#x" % self.group_id)
1844 q.text(","); q.breakable()
1845 q.text("ref_count = ");
1846 q.text("%#x" % self.ref_count)
1847 q.text(","); q.breakable()
1848 q.text("packet_count = ");
1849 q.text("%#x" % self.packet_count)
1850 q.text(","); q.breakable()
1851 q.text("byte_count = ");
1852 q.text("%#x" % self.byte_count)
1853 q.text(","); q.breakable()
1854 q.text("duration_sec = ");
1855 q.text("%#x" % self.duration_sec)
1856 q.text(","); q.breakable()
1857 q.text("duration_nsec = ");
1858 q.text("%#x" % self.duration_nsec)
1859 q.text(","); q.breakable()
1860 q.text("bucket_stats = ");
1861 q.pp(self.bucket_stats)
1862 q.breakable()
1863 q.text('}')
1864
1865
1866class hello_elem(loxi.OFObject):
1867 subtypes = {}
1868
1869
1870 def __init__(self, type=None):
1871 if type != None:
1872 self.type = type
1873 else:
1874 self.type = 0
1875 return
1876
1877 def pack(self):
1878 packed = []
1879 packed.append(struct.pack("!H", self.type))
1880 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1881 length = sum([len(x) for x in packed])
1882 packed[1] = struct.pack("!H", length)
1883 return ''.join(packed)
1884
1885 @staticmethod
1886 def unpack(reader):
1887 subtype, = reader.peek('!H', 0)
1888 subclass = hello_elem.subtypes.get(subtype)
1889 if subclass:
1890 return subclass.unpack(reader)
1891
1892 obj = hello_elem()
1893 obj.type = reader.read("!H")[0]
1894 _length = reader.read("!H")[0]
1895 orig_reader = reader
1896 reader = orig_reader.slice(_length, 4)
1897 return obj
1898
1899 def __eq__(self, other):
1900 if type(self) != type(other): return False
1901 if self.type != other.type: return False
1902 return True
1903
1904 def pretty_print(self, q):
1905 q.text("hello_elem {")
1906 with q.group():
1907 with q.indent(2):
1908 q.breakable()
1909 q.breakable()
1910 q.text('}')
1911
1912
1913class hello_elem_versionbitmap(hello_elem):
1914 type = 1
1915
1916 def __init__(self, bitmaps=None):
1917 if bitmaps != None:
1918 self.bitmaps = bitmaps
1919 else:
1920 self.bitmaps = []
1921 return
1922
1923 def pack(self):
1924 packed = []
1925 packed.append(struct.pack("!H", self.type))
1926 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1927 packed.append(loxi.generic_util.pack_list(self.bitmaps))
1928 length = sum([len(x) for x in packed])
1929 packed[1] = struct.pack("!H", length)
1930 return ''.join(packed)
1931
1932 @staticmethod
1933 def unpack(reader):
1934 obj = hello_elem_versionbitmap()
1935 _type = reader.read("!H")[0]
1936 assert(_type == 1)
1937 _length = reader.read("!H")[0]
1938 orig_reader = reader
1939 reader = orig_reader.slice(_length, 4)
1940 obj.bitmaps = loxi.generic_util.unpack_list(reader, ofp.common.uint32.unpack)
1941 return obj
1942
1943 def __eq__(self, other):
1944 if type(self) != type(other): return False
1945 if self.bitmaps != other.bitmaps: return False
1946 return True
1947
1948 def pretty_print(self, q):
1949 q.text("hello_elem_versionbitmap {")
1950 with q.group():
1951 with q.indent(2):
1952 q.breakable()
1953 q.text("bitmaps = ");
1954 q.pp(self.bitmaps)
1955 q.breakable()
1956 q.text('}')
1957
1958hello_elem.subtypes[1] = hello_elem_versionbitmap
1959
1960class match_v3(loxi.OFObject):
1961 type = 1
1962
1963 def __init__(self, oxm_list=None):
1964 if oxm_list != None:
1965 self.oxm_list = oxm_list
1966 else:
1967 self.oxm_list = []
1968 return
1969
1970 def pack(self):
1971 packed = []
1972 packed.append(struct.pack("!H", self.type))
1973 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1974 packed.append(loxi.generic_util.pack_list(self.oxm_list))
1975 length = sum([len(x) for x in packed])
1976 packed[1] = struct.pack("!H", length)
1977 packed.append(loxi.generic_util.pad_to(8, length))
1978 return ''.join(packed)
1979
1980 @staticmethod
1981 def unpack(reader):
1982 obj = match_v3()
1983 _type = reader.read("!H")[0]
1984 assert(_type == 1)
1985 _length = reader.read("!H")[0]
1986 orig_reader = reader
1987 reader = orig_reader.slice(_length, 4)
1988 obj.oxm_list = loxi.generic_util.unpack_list(reader, ofp.oxm.oxm.unpack)
1989 orig_reader.skip_align()
1990 return obj
1991
1992 def __eq__(self, other):
1993 if type(self) != type(other): return False
1994 if self.oxm_list != other.oxm_list: return False
1995 return True
1996
1997 def pretty_print(self, q):
1998 q.text("match_v3 {")
1999 with q.group():
2000 with q.indent(2):
2001 q.breakable()
2002 q.text("oxm_list = ");
2003 q.pp(self.oxm_list)
2004 q.breakable()
2005 q.text('}')
2006
2007
2008class meter_band_stats(loxi.OFObject):
2009
2010 def __init__(self, packet_band_count=None, byte_band_count=None):
2011 if packet_band_count != None:
2012 self.packet_band_count = packet_band_count
2013 else:
2014 self.packet_band_count = 0
2015 if byte_band_count != None:
2016 self.byte_band_count = byte_band_count
2017 else:
2018 self.byte_band_count = 0
2019 return
2020
2021 def pack(self):
2022 packed = []
2023 packed.append(struct.pack("!Q", self.packet_band_count))
2024 packed.append(struct.pack("!Q", self.byte_band_count))
2025 return ''.join(packed)
2026
2027 @staticmethod
2028 def unpack(reader):
2029 obj = meter_band_stats()
2030 obj.packet_band_count = reader.read("!Q")[0]
2031 obj.byte_band_count = reader.read("!Q")[0]
2032 return obj
2033
2034 def __eq__(self, other):
2035 if type(self) != type(other): return False
2036 if self.packet_band_count != other.packet_band_count: return False
2037 if self.byte_band_count != other.byte_band_count: return False
2038 return True
2039
2040 def pretty_print(self, q):
2041 q.text("meter_band_stats {")
2042 with q.group():
2043 with q.indent(2):
2044 q.breakable()
2045 q.text("packet_band_count = ");
2046 q.text("%#x" % self.packet_band_count)
2047 q.text(","); q.breakable()
2048 q.text("byte_band_count = ");
2049 q.text("%#x" % self.byte_band_count)
2050 q.breakable()
2051 q.text('}')
2052
2053
2054class meter_config(loxi.OFObject):
2055
2056 def __init__(self, flags=None, meter_id=None, entries=None):
2057 if flags != None:
2058 self.flags = flags
2059 else:
2060 self.flags = 0
2061 if meter_id != None:
2062 self.meter_id = meter_id
2063 else:
2064 self.meter_id = 0
2065 if entries != None:
2066 self.entries = entries
2067 else:
2068 self.entries = []
2069 return
2070
2071 def pack(self):
2072 packed = []
2073 packed.append(struct.pack("!H", 0)) # placeholder for length at index 0
2074 packed.append(struct.pack("!H", self.flags))
2075 packed.append(struct.pack("!L", self.meter_id))
2076 packed.append(loxi.generic_util.pack_list(self.entries))
2077 length = sum([len(x) for x in packed])
2078 packed[0] = struct.pack("!H", length)
2079 return ''.join(packed)
2080
2081 @staticmethod
2082 def unpack(reader):
2083 obj = meter_config()
2084 _length = reader.read("!H")[0]
2085 orig_reader = reader
2086 reader = orig_reader.slice(_length, 2)
2087 obj.flags = reader.read("!H")[0]
2088 obj.meter_id = reader.read("!L")[0]
2089 obj.entries = loxi.generic_util.unpack_list(reader, ofp.meter_band.meter_band.unpack)
2090 return obj
2091
2092 def __eq__(self, other):
2093 if type(self) != type(other): return False
2094 if self.flags != other.flags: return False
2095 if self.meter_id != other.meter_id: return False
2096 if self.entries != other.entries: return False
2097 return True
2098
2099 def pretty_print(self, q):
2100 q.text("meter_config {")
2101 with q.group():
2102 with q.indent(2):
2103 q.breakable()
2104 q.text("flags = ");
2105 q.text("%#x" % self.flags)
2106 q.text(","); q.breakable()
2107 q.text("meter_id = ");
2108 q.text("%#x" % self.meter_id)
2109 q.text(","); q.breakable()
2110 q.text("entries = ");
2111 q.pp(self.entries)
2112 q.breakable()
2113 q.text('}')
2114
2115
2116class meter_features(loxi.OFObject):
2117
2118 def __init__(self, max_meter=None, band_types=None, capabilities=None, max_bands=None, max_color=None):
2119 if max_meter != None:
2120 self.max_meter = max_meter
2121 else:
2122 self.max_meter = 0
2123 if band_types != None:
2124 self.band_types = band_types
2125 else:
2126 self.band_types = 0
2127 if capabilities != None:
2128 self.capabilities = capabilities
2129 else:
2130 self.capabilities = 0
2131 if max_bands != None:
2132 self.max_bands = max_bands
2133 else:
2134 self.max_bands = 0
2135 if max_color != None:
2136 self.max_color = max_color
2137 else:
2138 self.max_color = 0
2139 return
2140
2141 def pack(self):
2142 packed = []
2143 packed.append(struct.pack("!L", self.max_meter))
2144 packed.append(struct.pack("!L", self.band_types))
2145 packed.append(struct.pack("!L", self.capabilities))
2146 packed.append(struct.pack("!B", self.max_bands))
2147 packed.append(struct.pack("!B", self.max_color))
2148 packed.append('\x00' * 2)
2149 return ''.join(packed)
2150
2151 @staticmethod
2152 def unpack(reader):
2153 obj = meter_features()
2154 obj.max_meter = reader.read("!L")[0]
2155 obj.band_types = reader.read("!L")[0]
2156 obj.capabilities = reader.read("!L")[0]
2157 obj.max_bands = reader.read("!B")[0]
2158 obj.max_color = reader.read("!B")[0]
2159 reader.skip(2)
2160 return obj
2161
2162 def __eq__(self, other):
2163 if type(self) != type(other): return False
2164 if self.max_meter != other.max_meter: return False
2165 if self.band_types != other.band_types: return False
2166 if self.capabilities != other.capabilities: return False
2167 if self.max_bands != other.max_bands: return False
2168 if self.max_color != other.max_color: return False
2169 return True
2170
2171 def pretty_print(self, q):
2172 q.text("meter_features {")
2173 with q.group():
2174 with q.indent(2):
2175 q.breakable()
2176 q.text("max_meter = ");
2177 q.text("%#x" % self.max_meter)
2178 q.text(","); q.breakable()
2179 q.text("band_types = ");
2180 q.text("%#x" % self.band_types)
2181 q.text(","); q.breakable()
2182 q.text("capabilities = ");
2183 q.text("%#x" % self.capabilities)
2184 q.text(","); q.breakable()
2185 q.text("max_bands = ");
2186 q.text("%#x" % self.max_bands)
2187 q.text(","); q.breakable()
2188 q.text("max_color = ");
2189 q.text("%#x" % self.max_color)
2190 q.breakable()
2191 q.text('}')
2192
2193
2194class meter_stats(loxi.OFObject):
2195
2196 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):
2197 if meter_id != None:
2198 self.meter_id = meter_id
2199 else:
2200 self.meter_id = 0
2201 if flow_count != None:
2202 self.flow_count = flow_count
2203 else:
2204 self.flow_count = 0
2205 if packet_in_count != None:
2206 self.packet_in_count = packet_in_count
2207 else:
2208 self.packet_in_count = 0
2209 if byte_in_count != None:
2210 self.byte_in_count = byte_in_count
2211 else:
2212 self.byte_in_count = 0
2213 if duration_sec != None:
2214 self.duration_sec = duration_sec
2215 else:
2216 self.duration_sec = 0
2217 if duration_nsec != None:
2218 self.duration_nsec = duration_nsec
2219 else:
2220 self.duration_nsec = 0
2221 if band_stats != None:
2222 self.band_stats = band_stats
2223 else:
2224 self.band_stats = []
2225 return
2226
2227 def pack(self):
2228 packed = []
2229 packed.append(struct.pack("!L", self.meter_id))
2230 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
2231 packed.append('\x00' * 6)
2232 packed.append(struct.pack("!L", self.flow_count))
2233 packed.append(struct.pack("!Q", self.packet_in_count))
2234 packed.append(struct.pack("!Q", self.byte_in_count))
2235 packed.append(struct.pack("!L", self.duration_sec))
2236 packed.append(struct.pack("!L", self.duration_nsec))
2237 packed.append(loxi.generic_util.pack_list(self.band_stats))
2238 length = sum([len(x) for x in packed])
2239 packed[1] = struct.pack("!H", length)
2240 return ''.join(packed)
2241
2242 @staticmethod
2243 def unpack(reader):
2244 obj = meter_stats()
2245 obj.meter_id = reader.read("!L")[0]
2246 _len = reader.read("!H")[0]
2247 orig_reader = reader
2248 reader = orig_reader.slice(_len, 6)
2249 reader.skip(6)
2250 obj.flow_count = reader.read("!L")[0]
2251 obj.packet_in_count = reader.read("!Q")[0]
2252 obj.byte_in_count = reader.read("!Q")[0]
2253 obj.duration_sec = reader.read("!L")[0]
2254 obj.duration_nsec = reader.read("!L")[0]
2255 obj.band_stats = loxi.generic_util.unpack_list(reader, ofp.common.meter_band_stats.unpack)
2256 return obj
2257
2258 def __eq__(self, other):
2259 if type(self) != type(other): return False
2260 if self.meter_id != other.meter_id: return False
2261 if self.flow_count != other.flow_count: return False
2262 if self.packet_in_count != other.packet_in_count: return False
2263 if self.byte_in_count != other.byte_in_count: return False
2264 if self.duration_sec != other.duration_sec: return False
2265 if self.duration_nsec != other.duration_nsec: return False
2266 if self.band_stats != other.band_stats: return False
2267 return True
2268
2269 def pretty_print(self, q):
2270 q.text("meter_stats {")
2271 with q.group():
2272 with q.indent(2):
2273 q.breakable()
2274 q.text("meter_id = ");
2275 q.text("%#x" % self.meter_id)
2276 q.text(","); q.breakable()
2277 q.text("flow_count = ");
2278 q.text("%#x" % self.flow_count)
2279 q.text(","); q.breakable()
2280 q.text("packet_in_count = ");
2281 q.text("%#x" % self.packet_in_count)
2282 q.text(","); q.breakable()
2283 q.text("byte_in_count = ");
2284 q.text("%#x" % self.byte_in_count)
2285 q.text(","); q.breakable()
2286 q.text("duration_sec = ");
2287 q.text("%#x" % self.duration_sec)
2288 q.text(","); q.breakable()
2289 q.text("duration_nsec = ");
2290 q.text("%#x" % self.duration_nsec)
2291 q.text(","); q.breakable()
2292 q.text("band_stats = ");
2293 q.pp(self.band_stats)
2294 q.breakable()
2295 q.text('}')
2296
2297
2298class packet_queue(loxi.OFObject):
2299
2300 def __init__(self, queue_id=None, port=None, properties=None):
2301 if queue_id != None:
2302 self.queue_id = queue_id
2303 else:
2304 self.queue_id = 0
2305 if port != None:
2306 self.port = port
2307 else:
2308 self.port = 0
2309 if properties != None:
2310 self.properties = properties
2311 else:
2312 self.properties = []
2313 return
2314
2315 def pack(self):
2316 packed = []
2317 packed.append(struct.pack("!L", self.queue_id))
2318 packed.append(util.pack_port_no(self.port))
2319 packed.append(struct.pack("!H", 0)) # placeholder for len at index 2
2320 packed.append('\x00' * 6)
2321 packed.append(loxi.generic_util.pack_list(self.properties))
2322 length = sum([len(x) for x in packed])
2323 packed[2] = struct.pack("!H", length)
2324 return ''.join(packed)
2325
2326 @staticmethod
2327 def unpack(reader):
2328 obj = packet_queue()
2329 obj.queue_id = reader.read("!L")[0]
2330 obj.port = util.unpack_port_no(reader)
2331 _len = reader.read("!H")[0]
2332 orig_reader = reader
2333 reader = orig_reader.slice(_len, 10)
2334 reader.skip(6)
2335 obj.properties = loxi.generic_util.unpack_list(reader, ofp.common.queue_prop.unpack)
2336 return obj
2337
2338 def __eq__(self, other):
2339 if type(self) != type(other): return False
2340 if self.queue_id != other.queue_id: return False
2341 if self.port != other.port: return False
2342 if self.properties != other.properties: return False
2343 return True
2344
2345 def pretty_print(self, q):
2346 q.text("packet_queue {")
2347 with q.group():
2348 with q.indent(2):
2349 q.breakable()
2350 q.text("queue_id = ");
2351 q.text("%#x" % self.queue_id)
2352 q.text(","); q.breakable()
2353 q.text("port = ");
2354 q.text(util.pretty_port(self.port))
2355 q.text(","); q.breakable()
2356 q.text("properties = ");
2357 q.pp(self.properties)
2358 q.breakable()
2359 q.text('}')
2360
2361
2362class port_desc(loxi.OFObject):
2363
2364 def __init__(self, port_no=None, hw_addr=None, name=None, config=None, state=None, properties=None):
2365 if port_no != None:
2366 self.port_no = port_no
2367 else:
2368 self.port_no = 0
2369 if hw_addr != None:
2370 self.hw_addr = hw_addr
2371 else:
2372 self.hw_addr = [0,0,0,0,0,0]
2373 if name != None:
2374 self.name = name
2375 else:
2376 self.name = ""
2377 if config != None:
2378 self.config = config
2379 else:
2380 self.config = 0
2381 if state != None:
2382 self.state = state
2383 else:
2384 self.state = 0
2385 if properties != None:
2386 self.properties = properties
2387 else:
2388 self.properties = []
2389 return
2390
2391 def pack(self):
2392 packed = []
2393 packed.append(util.pack_port_no(self.port_no))
2394 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2395 packed.append('\x00' * 2)
2396 packed.append(struct.pack("!6B", *self.hw_addr))
2397 packed.append('\x00' * 2)
2398 packed.append(struct.pack("!16s", self.name))
2399 packed.append(struct.pack("!L", self.config))
2400 packed.append(struct.pack("!L", self.state))
2401 packed.append(loxi.generic_util.pack_list(self.properties))
2402 length = sum([len(x) for x in packed])
2403 packed[1] = struct.pack("!H", length)
2404 return ''.join(packed)
2405
2406 @staticmethod
2407 def unpack(reader):
2408 obj = port_desc()
2409 obj.port_no = util.unpack_port_no(reader)
2410 _length = reader.read("!H")[0]
2411 orig_reader = reader
2412 reader = orig_reader.slice(_length, 6)
2413 reader.skip(2)
2414 obj.hw_addr = list(reader.read('!6B'))
2415 reader.skip(2)
2416 obj.name = reader.read("!16s")[0].rstrip("\x00")
2417 obj.config = reader.read("!L")[0]
2418 obj.state = reader.read("!L")[0]
2419 obj.properties = loxi.generic_util.unpack_list(reader, ofp.port_desc_prop.port_desc_prop.unpack)
2420 return obj
2421
2422 def __eq__(self, other):
2423 if type(self) != type(other): return False
2424 if self.port_no != other.port_no: return False
2425 if self.hw_addr != other.hw_addr: return False
2426 if self.name != other.name: return False
2427 if self.config != other.config: return False
2428 if self.state != other.state: return False
2429 if self.properties != other.properties: return False
2430 return True
2431
2432 def pretty_print(self, q):
2433 q.text("port_desc {")
2434 with q.group():
2435 with q.indent(2):
2436 q.breakable()
2437 q.text("port_no = ");
2438 q.text(util.pretty_port(self.port_no))
2439 q.text(","); q.breakable()
2440 q.text("hw_addr = ");
2441 q.text(util.pretty_mac(self.hw_addr))
2442 q.text(","); q.breakable()
2443 q.text("name = ");
2444 q.pp(self.name)
2445 q.text(","); q.breakable()
2446 q.text("config = ");
2447 q.text("%#x" % self.config)
2448 q.text(","); q.breakable()
2449 q.text("state = ");
2450 q.text("%#x" % self.state)
2451 q.text(","); q.breakable()
2452 q.text("properties = ");
2453 q.pp(self.properties)
2454 q.breakable()
2455 q.text('}')
2456
2457
2458class port_stats_entry(loxi.OFObject):
2459
2460 def __init__(self, port_no=None, duration_sec=None, duration_nsec=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, properties=None):
2461 if port_no != None:
2462 self.port_no = port_no
2463 else:
2464 self.port_no = 0
2465 if duration_sec != None:
2466 self.duration_sec = duration_sec
2467 else:
2468 self.duration_sec = 0
2469 if duration_nsec != None:
2470 self.duration_nsec = duration_nsec
2471 else:
2472 self.duration_nsec = 0
2473 if rx_packets != None:
2474 self.rx_packets = rx_packets
2475 else:
2476 self.rx_packets = 0
2477 if tx_packets != None:
2478 self.tx_packets = tx_packets
2479 else:
2480 self.tx_packets = 0
2481 if rx_bytes != None:
2482 self.rx_bytes = rx_bytes
2483 else:
2484 self.rx_bytes = 0
2485 if tx_bytes != None:
2486 self.tx_bytes = tx_bytes
2487 else:
2488 self.tx_bytes = 0
2489 if rx_dropped != None:
2490 self.rx_dropped = rx_dropped
2491 else:
2492 self.rx_dropped = 0
2493 if tx_dropped != None:
2494 self.tx_dropped = tx_dropped
2495 else:
2496 self.tx_dropped = 0
2497 if rx_errors != None:
2498 self.rx_errors = rx_errors
2499 else:
2500 self.rx_errors = 0
2501 if tx_errors != None:
2502 self.tx_errors = tx_errors
2503 else:
2504 self.tx_errors = 0
2505 if properties != None:
2506 self.properties = properties
2507 else:
2508 self.properties = []
2509 return
2510
2511 def pack(self):
2512 packed = []
2513 packed.append(struct.pack("!H", 0)) # placeholder for length at index 0
2514 packed.append('\x00' * 2)
2515 packed.append(util.pack_port_no(self.port_no))
2516 packed.append(struct.pack("!L", self.duration_sec))
2517 packed.append(struct.pack("!L", self.duration_nsec))
2518 packed.append(struct.pack("!Q", self.rx_packets))
2519 packed.append(struct.pack("!Q", self.tx_packets))
2520 packed.append(struct.pack("!Q", self.rx_bytes))
2521 packed.append(struct.pack("!Q", self.tx_bytes))
2522 packed.append(struct.pack("!Q", self.rx_dropped))
2523 packed.append(struct.pack("!Q", self.tx_dropped))
2524 packed.append(struct.pack("!Q", self.rx_errors))
2525 packed.append(struct.pack("!Q", self.tx_errors))
2526 packed.append(loxi.generic_util.pack_list(self.properties))
2527 length = sum([len(x) for x in packed])
2528 packed[0] = struct.pack("!H", length)
2529 return ''.join(packed)
2530
2531 @staticmethod
2532 def unpack(reader):
2533 obj = port_stats_entry()
2534 _length = reader.read("!H")[0]
2535 orig_reader = reader
2536 reader = orig_reader.slice(_length, 2)
2537 reader.skip(2)
2538 obj.port_no = util.unpack_port_no(reader)
2539 obj.duration_sec = reader.read("!L")[0]
2540 obj.duration_nsec = reader.read("!L")[0]
2541 obj.rx_packets = reader.read("!Q")[0]
2542 obj.tx_packets = reader.read("!Q")[0]
2543 obj.rx_bytes = reader.read("!Q")[0]
2544 obj.tx_bytes = reader.read("!Q")[0]
2545 obj.rx_dropped = reader.read("!Q")[0]
2546 obj.tx_dropped = reader.read("!Q")[0]
2547 obj.rx_errors = reader.read("!Q")[0]
2548 obj.tx_errors = reader.read("!Q")[0]
2549 obj.properties = loxi.generic_util.unpack_list(reader, ofp.port_stats_prop.port_stats_prop.unpack)
2550 return obj
2551
2552 def __eq__(self, other):
2553 if type(self) != type(other): return False
2554 if self.port_no != other.port_no: return False
2555 if self.duration_sec != other.duration_sec: return False
2556 if self.duration_nsec != other.duration_nsec: return False
2557 if self.rx_packets != other.rx_packets: return False
2558 if self.tx_packets != other.tx_packets: return False
2559 if self.rx_bytes != other.rx_bytes: return False
2560 if self.tx_bytes != other.tx_bytes: return False
2561 if self.rx_dropped != other.rx_dropped: return False
2562 if self.tx_dropped != other.tx_dropped: return False
2563 if self.rx_errors != other.rx_errors: return False
2564 if self.tx_errors != other.tx_errors: return False
2565 if self.properties != other.properties: return False
2566 return True
2567
2568 def pretty_print(self, q):
2569 q.text("port_stats_entry {")
2570 with q.group():
2571 with q.indent(2):
2572 q.breakable()
2573 q.text("port_no = ");
2574 q.text(util.pretty_port(self.port_no))
2575 q.text(","); q.breakable()
2576 q.text("duration_sec = ");
2577 q.text("%#x" % self.duration_sec)
2578 q.text(","); q.breakable()
2579 q.text("duration_nsec = ");
2580 q.text("%#x" % self.duration_nsec)
2581 q.text(","); q.breakable()
2582 q.text("rx_packets = ");
2583 q.text("%#x" % self.rx_packets)
2584 q.text(","); q.breakable()
2585 q.text("tx_packets = ");
2586 q.text("%#x" % self.tx_packets)
2587 q.text(","); q.breakable()
2588 q.text("rx_bytes = ");
2589 q.text("%#x" % self.rx_bytes)
2590 q.text(","); q.breakable()
2591 q.text("tx_bytes = ");
2592 q.text("%#x" % self.tx_bytes)
2593 q.text(","); q.breakable()
2594 q.text("rx_dropped = ");
2595 q.text("%#x" % self.rx_dropped)
2596 q.text(","); q.breakable()
2597 q.text("tx_dropped = ");
2598 q.text("%#x" % self.tx_dropped)
2599 q.text(","); q.breakable()
2600 q.text("rx_errors = ");
2601 q.text("%#x" % self.rx_errors)
2602 q.text(","); q.breakable()
2603 q.text("tx_errors = ");
2604 q.text("%#x" % self.tx_errors)
2605 q.text(","); q.breakable()
2606 q.text("properties = ");
2607 q.pp(self.properties)
2608 q.breakable()
2609 q.text('}')
2610
2611
2612class queue_desc(loxi.OFObject):
2613
2614 def __init__(self, port_no=None, queue_id=None, properties=None):
2615 if port_no != None:
2616 self.port_no = port_no
2617 else:
2618 self.port_no = 0
2619 if queue_id != None:
2620 self.queue_id = queue_id
2621 else:
2622 self.queue_id = 0
2623 if properties != None:
2624 self.properties = properties
2625 else:
2626 self.properties = []
2627 return
2628
2629 def pack(self):
2630 packed = []
2631 packed.append(struct.pack("!L", self.port_no))
2632 packed.append(struct.pack("!L", self.queue_id))
2633 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2634 packed.append('\x00' * 6)
2635 packed.append(loxi.generic_util.pack_list(self.properties))
2636 length = sum([len(x) for x in packed])
2637 packed[2] = struct.pack("!H", length)
2638 return ''.join(packed)
2639
2640 @staticmethod
2641 def unpack(reader):
2642 obj = queue_desc()
2643 obj.port_no = reader.read("!L")[0]
2644 obj.queue_id = reader.read("!L")[0]
2645 _length = reader.read("!H")[0]
2646 orig_reader = reader
2647 reader = orig_reader.slice(_length, 10)
2648 reader.skip(6)
2649 obj.properties = loxi.generic_util.unpack_list(reader, ofp.queue_desc_prop.queue_desc_prop.unpack)
2650 return obj
2651
2652 def __eq__(self, other):
2653 if type(self) != type(other): return False
2654 if self.port_no != other.port_no: return False
2655 if self.queue_id != other.queue_id: return False
2656 if self.properties != other.properties: return False
2657 return True
2658
2659 def pretty_print(self, q):
2660 q.text("queue_desc {")
2661 with q.group():
2662 with q.indent(2):
2663 q.breakable()
2664 q.text("port_no = ");
2665 q.text("%#x" % self.port_no)
2666 q.text(","); q.breakable()
2667 q.text("queue_id = ");
2668 q.text("%#x" % self.queue_id)
2669 q.text(","); q.breakable()
2670 q.text("properties = ");
2671 q.pp(self.properties)
2672 q.breakable()
2673 q.text('}')
2674
2675
2676class queue_prop(loxi.OFObject):
2677 subtypes = {}
2678
2679
2680 def __init__(self, type=None):
2681 if type != None:
2682 self.type = type
2683 else:
2684 self.type = 0
2685 return
2686
2687 def pack(self):
2688 packed = []
2689 packed.append(struct.pack("!H", self.type))
2690 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
2691 packed.append('\x00' * 4)
2692 length = sum([len(x) for x in packed])
2693 packed[1] = struct.pack("!H", length)
2694 return ''.join(packed)
2695
2696 @staticmethod
2697 def unpack(reader):
2698 subtype, = reader.peek('!H', 0)
2699 subclass = queue_prop.subtypes.get(subtype)
2700 if subclass:
2701 return subclass.unpack(reader)
2702
2703 obj = queue_prop()
2704 obj.type = reader.read("!H")[0]
2705 _len = reader.read("!H")[0]
2706 orig_reader = reader
2707 reader = orig_reader.slice(_len, 4)
2708 reader.skip(4)
2709 return obj
2710
2711 def __eq__(self, other):
2712 if type(self) != type(other): return False
2713 if self.type != other.type: return False
2714 return True
2715
2716 def pretty_print(self, q):
2717 q.text("queue_prop {")
2718 with q.group():
2719 with q.indent(2):
2720 q.breakable()
2721 q.breakable()
2722 q.text('}')
2723
2724
2725class queue_prop_experimenter(queue_prop):
2726 subtypes = {}
2727
2728 type = 65535
2729
2730 def __init__(self, experimenter=None, data=None):
2731 if experimenter != None:
2732 self.experimenter = experimenter
2733 else:
2734 self.experimenter = 0
2735 if data != None:
2736 self.data = data
2737 else:
2738 self.data = ''
2739 return
2740
2741 def pack(self):
2742 packed = []
2743 packed.append(struct.pack("!H", self.type))
2744 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
2745 packed.append('\x00' * 4)
2746 packed.append(struct.pack("!L", self.experimenter))
2747 packed.append('\x00' * 4)
2748 packed.append(self.data)
2749 length = sum([len(x) for x in packed])
2750 packed[1] = struct.pack("!H", length)
2751 return ''.join(packed)
2752
2753 @staticmethod
2754 def unpack(reader):
2755 subtype, = reader.peek('!L', 8)
2756 subclass = queue_prop_experimenter.subtypes.get(subtype)
2757 if subclass:
2758 return subclass.unpack(reader)
2759
2760 obj = queue_prop_experimenter()
2761 _type = reader.read("!H")[0]
2762 assert(_type == 65535)
2763 _len = reader.read("!H")[0]
2764 orig_reader = reader
2765 reader = orig_reader.slice(_len, 4)
2766 reader.skip(4)
2767 obj.experimenter = reader.read("!L")[0]
2768 reader.skip(4)
2769 obj.data = str(reader.read_all())
2770 return obj
2771
2772 def __eq__(self, other):
2773 if type(self) != type(other): return False
2774 if self.experimenter != other.experimenter: return False
2775 if self.data != other.data: return False
2776 return True
2777
2778 def pretty_print(self, q):
2779 q.text("queue_prop_experimenter {")
2780 with q.group():
2781 with q.indent(2):
2782 q.breakable()
2783 q.text("data = ");
2784 q.pp(self.data)
2785 q.breakable()
2786 q.text('}')
2787
2788queue_prop.subtypes[65535] = queue_prop_experimenter
2789
2790class queue_prop_max_rate(queue_prop):
2791 type = 2
2792
2793 def __init__(self, rate=None):
2794 if rate != None:
2795 self.rate = rate
2796 else:
2797 self.rate = 0
2798 return
2799
2800 def pack(self):
2801 packed = []
2802 packed.append(struct.pack("!H", self.type))
2803 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
2804 packed.append('\x00' * 4)
2805 packed.append(struct.pack("!H", self.rate))
2806 packed.append('\x00' * 6)
2807 length = sum([len(x) for x in packed])
2808 packed[1] = struct.pack("!H", length)
2809 return ''.join(packed)
2810
2811 @staticmethod
2812 def unpack(reader):
2813 obj = queue_prop_max_rate()
2814 _type = reader.read("!H")[0]
2815 assert(_type == 2)
2816 _len = reader.read("!H")[0]
2817 orig_reader = reader
2818 reader = orig_reader.slice(_len, 4)
2819 reader.skip(4)
2820 obj.rate = reader.read("!H")[0]
2821 reader.skip(6)
2822 return obj
2823
2824 def __eq__(self, other):
2825 if type(self) != type(other): return False
2826 if self.rate != other.rate: return False
2827 return True
2828
2829 def pretty_print(self, q):
2830 q.text("queue_prop_max_rate {")
2831 with q.group():
2832 with q.indent(2):
2833 q.breakable()
2834 q.text("rate = ");
2835 q.text("%#x" % self.rate)
2836 q.breakable()
2837 q.text('}')
2838
2839queue_prop.subtypes[2] = queue_prop_max_rate
2840
2841class queue_prop_min_rate(queue_prop):
2842 type = 1
2843
2844 def __init__(self, rate=None):
2845 if rate != None:
2846 self.rate = rate
2847 else:
2848 self.rate = 0
2849 return
2850
2851 def pack(self):
2852 packed = []
2853 packed.append(struct.pack("!H", self.type))
2854 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
2855 packed.append('\x00' * 4)
2856 packed.append(struct.pack("!H", self.rate))
2857 packed.append('\x00' * 6)
2858 length = sum([len(x) for x in packed])
2859 packed[1] = struct.pack("!H", length)
2860 return ''.join(packed)
2861
2862 @staticmethod
2863 def unpack(reader):
2864 obj = queue_prop_min_rate()
2865 _type = reader.read("!H")[0]
2866 assert(_type == 1)
2867 _len = reader.read("!H")[0]
2868 orig_reader = reader
2869 reader = orig_reader.slice(_len, 4)
2870 reader.skip(4)
2871 obj.rate = reader.read("!H")[0]
2872 reader.skip(6)
2873 return obj
2874
2875 def __eq__(self, other):
2876 if type(self) != type(other): return False
2877 if self.rate != other.rate: return False
2878 return True
2879
2880 def pretty_print(self, q):
2881 q.text("queue_prop_min_rate {")
2882 with q.group():
2883 with q.indent(2):
2884 q.breakable()
2885 q.text("rate = ");
2886 q.text("%#x" % self.rate)
2887 q.breakable()
2888 q.text('}')
2889
2890queue_prop.subtypes[1] = queue_prop_min_rate
2891
2892class queue_stats_entry(loxi.OFObject):
2893
2894 def __init__(self, port_no=None, queue_id=None, tx_bytes=None, tx_packets=None, tx_errors=None, duration_sec=None, duration_nsec=None, properties=None):
2895 if port_no != None:
2896 self.port_no = port_no
2897 else:
2898 self.port_no = 0
2899 if queue_id != None:
2900 self.queue_id = queue_id
2901 else:
2902 self.queue_id = 0
2903 if tx_bytes != None:
2904 self.tx_bytes = tx_bytes
2905 else:
2906 self.tx_bytes = 0
2907 if tx_packets != None:
2908 self.tx_packets = tx_packets
2909 else:
2910 self.tx_packets = 0
2911 if tx_errors != None:
2912 self.tx_errors = tx_errors
2913 else:
2914 self.tx_errors = 0
2915 if duration_sec != None:
2916 self.duration_sec = duration_sec
2917 else:
2918 self.duration_sec = 0
2919 if duration_nsec != None:
2920 self.duration_nsec = duration_nsec
2921 else:
2922 self.duration_nsec = 0
2923 if properties != None:
2924 self.properties = properties
2925 else:
2926 self.properties = []
2927 return
2928
2929 def pack(self):
2930 packed = []
2931 packed.append(struct.pack("!H", 0)) # placeholder for length at index 0
2932 packed.append('\x00' * 6)
2933 packed.append(util.pack_port_no(self.port_no))
2934 packed.append(struct.pack("!L", self.queue_id))
2935 packed.append(struct.pack("!Q", self.tx_bytes))
2936 packed.append(struct.pack("!Q", self.tx_packets))
2937 packed.append(struct.pack("!Q", self.tx_errors))
2938 packed.append(struct.pack("!L", self.duration_sec))
2939 packed.append(struct.pack("!L", self.duration_nsec))
2940 packed.append(loxi.generic_util.pack_list(self.properties))
2941 length = sum([len(x) for x in packed])
2942 packed[0] = struct.pack("!H", length)
2943 return ''.join(packed)
2944
2945 @staticmethod
2946 def unpack(reader):
2947 obj = queue_stats_entry()
2948 _length = reader.read("!H")[0]
2949 orig_reader = reader
2950 reader = orig_reader.slice(_length, 2)
2951 reader.skip(6)
2952 obj.port_no = util.unpack_port_no(reader)
2953 obj.queue_id = reader.read("!L")[0]
2954 obj.tx_bytes = reader.read("!Q")[0]
2955 obj.tx_packets = reader.read("!Q")[0]
2956 obj.tx_errors = reader.read("!Q")[0]
2957 obj.duration_sec = reader.read("!L")[0]
2958 obj.duration_nsec = reader.read("!L")[0]
2959 obj.properties = loxi.generic_util.unpack_list(reader, ofp.queue_stats_prop.queue_stats_prop.unpack)
2960 return obj
2961
2962 def __eq__(self, other):
2963 if type(self) != type(other): return False
2964 if self.port_no != other.port_no: return False
2965 if self.queue_id != other.queue_id: return False
2966 if self.tx_bytes != other.tx_bytes: return False
2967 if self.tx_packets != other.tx_packets: return False
2968 if self.tx_errors != other.tx_errors: return False
2969 if self.duration_sec != other.duration_sec: return False
2970 if self.duration_nsec != other.duration_nsec: return False
2971 if self.properties != other.properties: return False
2972 return True
2973
2974 def pretty_print(self, q):
2975 q.text("queue_stats_entry {")
2976 with q.group():
2977 with q.indent(2):
2978 q.breakable()
2979 q.text("port_no = ");
2980 q.text(util.pretty_port(self.port_no))
2981 q.text(","); q.breakable()
2982 q.text("queue_id = ");
2983 q.text("%#x" % self.queue_id)
2984 q.text(","); q.breakable()
2985 q.text("tx_bytes = ");
2986 q.text("%#x" % self.tx_bytes)
2987 q.text(","); q.breakable()
2988 q.text("tx_packets = ");
2989 q.text("%#x" % self.tx_packets)
2990 q.text(","); q.breakable()
2991 q.text("tx_errors = ");
2992 q.text("%#x" % self.tx_errors)
2993 q.text(","); q.breakable()
2994 q.text("duration_sec = ");
2995 q.text("%#x" % self.duration_sec)
2996 q.text(","); q.breakable()
2997 q.text("duration_nsec = ");
2998 q.text("%#x" % self.duration_nsec)
2999 q.text(","); q.breakable()
3000 q.text("properties = ");
3001 q.pp(self.properties)
3002 q.breakable()
3003 q.text('}')
3004
3005
3006class table_desc(loxi.OFObject):
3007
3008 def __init__(self, table_id=None, config=None):
3009 if table_id != None:
3010 self.table_id = table_id
3011 else:
3012 self.table_id = 0
3013 if config != None:
3014 self.config = config
3015 else:
3016 self.config = 0
3017 return
3018
3019 def pack(self):
3020 packed = []
3021 packed.append(struct.pack("!H", 0)) # placeholder for length at index 0
3022 packed.append(struct.pack("!B", self.table_id))
3023 packed.append('\x00' * 1)
3024 packed.append(struct.pack("!L", self.config))
3025 length = sum([len(x) for x in packed])
3026 packed[0] = struct.pack("!H", length)
3027 return ''.join(packed)
3028
3029 @staticmethod
3030 def unpack(reader):
3031 obj = table_desc()
3032 _length = reader.read("!H")[0]
3033 orig_reader = reader
3034 reader = orig_reader.slice(_length, 2)
3035 obj.table_id = reader.read("!B")[0]
3036 reader.skip(1)
3037 obj.config = reader.read("!L")[0]
3038 return obj
3039
3040 def __eq__(self, other):
3041 if type(self) != type(other): return False
3042 if self.table_id != other.table_id: return False
3043 if self.config != other.config: return False
3044 return True
3045
3046 def pretty_print(self, q):
3047 q.text("table_desc {")
3048 with q.group():
3049 with q.indent(2):
3050 q.breakable()
3051 q.text("table_id = ");
3052 q.text("%#x" % self.table_id)
3053 q.text(","); q.breakable()
3054 q.text("config = ");
3055 q.text("%#x" % self.config)
3056 q.breakable()
3057 q.text('}')
3058
3059
3060class table_feature_prop(loxi.OFObject):
3061 subtypes = {}
3062
3063
3064 def __init__(self, type=None):
3065 if type != None:
3066 self.type = type
3067 else:
3068 self.type = 0
3069 return
3070
3071 def pack(self):
3072 packed = []
3073 packed.append(struct.pack("!H", self.type))
3074 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3075 length = sum([len(x) for x in packed])
3076 packed[1] = struct.pack("!H", length)
3077 return ''.join(packed)
3078
3079 @staticmethod
3080 def unpack(reader):
3081 subtype, = reader.peek('!H', 0)
3082 subclass = table_feature_prop.subtypes.get(subtype)
3083 if subclass:
3084 return subclass.unpack(reader)
3085
3086 obj = table_feature_prop()
3087 obj.type = reader.read("!H")[0]
3088 _length = reader.read("!H")[0]
3089 orig_reader = reader
3090 reader = orig_reader.slice(_length, 4)
3091 return obj
3092
3093 def __eq__(self, other):
3094 if type(self) != type(other): return False
3095 if self.type != other.type: return False
3096 return True
3097
3098 def pretty_print(self, q):
3099 q.text("table_feature_prop {")
3100 with q.group():
3101 with q.indent(2):
3102 q.breakable()
3103 q.breakable()
3104 q.text('}')
3105
3106
3107class table_feature_prop_apply_actions(table_feature_prop):
3108 type = 6
3109
3110 def __init__(self, action_ids=None):
3111 if action_ids != None:
3112 self.action_ids = action_ids
3113 else:
3114 self.action_ids = []
3115 return
3116
3117 def pack(self):
3118 packed = []
3119 packed.append(struct.pack("!H", self.type))
3120 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3121 packed.append(loxi.generic_util.pack_list(self.action_ids))
3122 length = sum([len(x) for x in packed])
3123 packed[1] = struct.pack("!H", length)
3124 packed.append(loxi.generic_util.pad_to(8, length))
3125 return ''.join(packed)
3126
3127 @staticmethod
3128 def unpack(reader):
3129 obj = table_feature_prop_apply_actions()
3130 _type = reader.read("!H")[0]
3131 assert(_type == 6)
3132 _length = reader.read("!H")[0]
3133 orig_reader = reader
3134 reader = orig_reader.slice(_length, 4)
3135 obj.action_ids = loxi.generic_util.unpack_list(reader, ofp.action_id.action_id.unpack)
3136 orig_reader.skip_align()
3137 return obj
3138
3139 def __eq__(self, other):
3140 if type(self) != type(other): return False
3141 if self.action_ids != other.action_ids: return False
3142 return True
3143
3144 def pretty_print(self, q):
3145 q.text("table_feature_prop_apply_actions {")
3146 with q.group():
3147 with q.indent(2):
3148 q.breakable()
3149 q.text("action_ids = ");
3150 q.pp(self.action_ids)
3151 q.breakable()
3152 q.text('}')
3153
3154table_feature_prop.subtypes[6] = table_feature_prop_apply_actions
3155
3156class table_feature_prop_apply_actions_miss(table_feature_prop):
3157 type = 7
3158
3159 def __init__(self, action_ids=None):
3160 if action_ids != None:
3161 self.action_ids = action_ids
3162 else:
3163 self.action_ids = []
3164 return
3165
3166 def pack(self):
3167 packed = []
3168 packed.append(struct.pack("!H", self.type))
3169 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3170 packed.append(loxi.generic_util.pack_list(self.action_ids))
3171 length = sum([len(x) for x in packed])
3172 packed[1] = struct.pack("!H", length)
3173 packed.append(loxi.generic_util.pad_to(8, length))
3174 return ''.join(packed)
3175
3176 @staticmethod
3177 def unpack(reader):
3178 obj = table_feature_prop_apply_actions_miss()
3179 _type = reader.read("!H")[0]
3180 assert(_type == 7)
3181 _length = reader.read("!H")[0]
3182 orig_reader = reader
3183 reader = orig_reader.slice(_length, 4)
3184 obj.action_ids = loxi.generic_util.unpack_list(reader, ofp.action_id.action_id.unpack)
3185 orig_reader.skip_align()
3186 return obj
3187
3188 def __eq__(self, other):
3189 if type(self) != type(other): return False
3190 if self.action_ids != other.action_ids: return False
3191 return True
3192
3193 def pretty_print(self, q):
3194 q.text("table_feature_prop_apply_actions_miss {")
3195 with q.group():
3196 with q.indent(2):
3197 q.breakable()
3198 q.text("action_ids = ");
3199 q.pp(self.action_ids)
3200 q.breakable()
3201 q.text('}')
3202
3203table_feature_prop.subtypes[7] = table_feature_prop_apply_actions_miss
3204
3205class table_feature_prop_apply_setfield(table_feature_prop):
3206 type = 14
3207
3208 def __init__(self, oxm_ids=None):
3209 if oxm_ids != None:
3210 self.oxm_ids = oxm_ids
3211 else:
3212 self.oxm_ids = []
3213 return
3214
3215 def pack(self):
3216 packed = []
3217 packed.append(struct.pack("!H", self.type))
3218 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3219 packed.append(loxi.generic_util.pack_list(self.oxm_ids))
3220 length = sum([len(x) for x in packed])
3221 packed[1] = struct.pack("!H", length)
3222 packed.append(loxi.generic_util.pad_to(8, length))
3223 return ''.join(packed)
3224
3225 @staticmethod
3226 def unpack(reader):
3227 obj = table_feature_prop_apply_setfield()
3228 _type = reader.read("!H")[0]
3229 assert(_type == 14)
3230 _length = reader.read("!H")[0]
3231 orig_reader = reader
3232 reader = orig_reader.slice(_length, 4)
3233 obj.oxm_ids = loxi.generic_util.unpack_list(reader, ofp.common.uint32.unpack)
3234 orig_reader.skip_align()
3235 return obj
3236
3237 def __eq__(self, other):
3238 if type(self) != type(other): return False
3239 if self.oxm_ids != other.oxm_ids: return False
3240 return True
3241
3242 def pretty_print(self, q):
3243 q.text("table_feature_prop_apply_setfield {")
3244 with q.group():
3245 with q.indent(2):
3246 q.breakable()
3247 q.text("oxm_ids = ");
3248 q.pp(self.oxm_ids)
3249 q.breakable()
3250 q.text('}')
3251
3252table_feature_prop.subtypes[14] = table_feature_prop_apply_setfield
3253
3254class table_feature_prop_apply_setfield_miss(table_feature_prop):
3255 type = 15
3256
3257 def __init__(self, oxm_ids=None):
3258 if oxm_ids != None:
3259 self.oxm_ids = oxm_ids
3260 else:
3261 self.oxm_ids = []
3262 return
3263
3264 def pack(self):
3265 packed = []
3266 packed.append(struct.pack("!H", self.type))
3267 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3268 packed.append(loxi.generic_util.pack_list(self.oxm_ids))
3269 length = sum([len(x) for x in packed])
3270 packed[1] = struct.pack("!H", length)
3271 packed.append(loxi.generic_util.pad_to(8, length))
3272 return ''.join(packed)
3273
3274 @staticmethod
3275 def unpack(reader):
3276 obj = table_feature_prop_apply_setfield_miss()
3277 _type = reader.read("!H")[0]
3278 assert(_type == 15)
3279 _length = reader.read("!H")[0]
3280 orig_reader = reader
3281 reader = orig_reader.slice(_length, 4)
3282 obj.oxm_ids = loxi.generic_util.unpack_list(reader, ofp.common.uint32.unpack)
3283 orig_reader.skip_align()
3284 return obj
3285
3286 def __eq__(self, other):
3287 if type(self) != type(other): return False
3288 if self.oxm_ids != other.oxm_ids: return False
3289 return True
3290
3291 def pretty_print(self, q):
3292 q.text("table_feature_prop_apply_setfield_miss {")
3293 with q.group():
3294 with q.indent(2):
3295 q.breakable()
3296 q.text("oxm_ids = ");
3297 q.pp(self.oxm_ids)
3298 q.breakable()
3299 q.text('}')
3300
3301table_feature_prop.subtypes[15] = table_feature_prop_apply_setfield_miss
3302
3303class table_feature_prop_experimenter(table_feature_prop):
3304 subtypes = {}
3305
3306 type = 65534
3307
3308 def __init__(self, experimenter=None, subtype=None, experimenter_data=None):
3309 if experimenter != None:
3310 self.experimenter = experimenter
3311 else:
3312 self.experimenter = 0
3313 if subtype != None:
3314 self.subtype = subtype
3315 else:
3316 self.subtype = 0
3317 if experimenter_data != None:
3318 self.experimenter_data = experimenter_data
3319 else:
3320 self.experimenter_data = ''
3321 return
3322
3323 def pack(self):
3324 packed = []
3325 packed.append(struct.pack("!H", self.type))
3326 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3327 packed.append(struct.pack("!L", self.experimenter))
3328 packed.append(struct.pack("!L", self.subtype))
3329 packed.append(self.experimenter_data)
3330 length = sum([len(x) for x in packed])
3331 packed[1] = struct.pack("!H", length)
3332 packed.append(loxi.generic_util.pad_to(8, length))
3333 return ''.join(packed)
3334
3335 @staticmethod
3336 def unpack(reader):
3337 subtype, = reader.peek('!L', 4)
3338 subclass = table_feature_prop_experimenter.subtypes.get(subtype)
3339 if subclass:
3340 return subclass.unpack(reader)
3341
3342 obj = table_feature_prop_experimenter()
3343 _type = reader.read("!H")[0]
3344 assert(_type == 65534)
3345 _length = reader.read("!H")[0]
3346 orig_reader = reader
3347 reader = orig_reader.slice(_length, 4)
3348 obj.experimenter = reader.read("!L")[0]
3349 obj.subtype = reader.read("!L")[0]
3350 obj.experimenter_data = str(reader.read_all())
3351 orig_reader.skip_align()
3352 return obj
3353
3354 def __eq__(self, other):
3355 if type(self) != type(other): return False
3356 if self.experimenter != other.experimenter: return False
3357 if self.subtype != other.subtype: return False
3358 if self.experimenter_data != other.experimenter_data: return False
3359 return True
3360
3361 def pretty_print(self, q):
3362 q.text("table_feature_prop_experimenter {")
3363 with q.group():
3364 with q.indent(2):
3365 q.breakable()
3366 q.text("subtype = ");
3367 q.text("%#x" % self.subtype)
3368 q.text(","); q.breakable()
3369 q.text("experimenter_data = ");
3370 q.pp(self.experimenter_data)
3371 q.breakable()
3372 q.text('}')
3373
3374table_feature_prop.subtypes[65534] = table_feature_prop_experimenter
3375
3376class table_feature_prop_experimenter_miss(table_feature_prop):
3377 subtypes = {}
3378
3379 type = 65535
3380
3381 def __init__(self, experimenter=None, subtype=None, experimenter_data=None):
3382 if experimenter != None:
3383 self.experimenter = experimenter
3384 else:
3385 self.experimenter = 0
3386 if subtype != None:
3387 self.subtype = subtype
3388 else:
3389 self.subtype = 0
3390 if experimenter_data != None:
3391 self.experimenter_data = experimenter_data
3392 else:
3393 self.experimenter_data = ''
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(struct.pack("!L", self.experimenter))
3401 packed.append(struct.pack("!L", self.subtype))
3402 packed.append(self.experimenter_data)
3403 length = sum([len(x) for x in packed])
3404 packed[1] = struct.pack("!H", length)
3405 packed.append(loxi.generic_util.pad_to(8, length))
3406 return ''.join(packed)
3407
3408 @staticmethod
3409 def unpack(reader):
3410 subtype, = reader.peek('!L', 4)
3411 subclass = table_feature_prop_experimenter_miss.subtypes.get(subtype)
3412 if subclass:
3413 return subclass.unpack(reader)
3414
3415 obj = table_feature_prop_experimenter_miss()
3416 _type = reader.read("!H")[0]
3417 assert(_type == 65535)
3418 _length = reader.read("!H")[0]
3419 orig_reader = reader
3420 reader = orig_reader.slice(_length, 4)
3421 obj.experimenter = reader.read("!L")[0]
3422 obj.subtype = reader.read("!L")[0]
3423 obj.experimenter_data = str(reader.read_all())
3424 orig_reader.skip_align()
3425 return obj
3426
3427 def __eq__(self, other):
3428 if type(self) != type(other): return False
3429 if self.experimenter != other.experimenter: return False
3430 if self.subtype != other.subtype: return False
3431 if self.experimenter_data != other.experimenter_data: return False
3432 return True
3433
3434 def pretty_print(self, q):
3435 q.text("table_feature_prop_experimenter_miss {")
3436 with q.group():
3437 with q.indent(2):
3438 q.breakable()
3439 q.text("subtype = ");
3440 q.text("%#x" % self.subtype)
3441 q.text(","); q.breakable()
3442 q.text("experimenter_data = ");
3443 q.pp(self.experimenter_data)
3444 q.breakable()
3445 q.text('}')
3446
3447table_feature_prop.subtypes[65535] = table_feature_prop_experimenter_miss
3448
3449class table_feature_prop_instructions(table_feature_prop):
3450 type = 0
3451
3452 def __init__(self, instruction_ids=None):
3453 if instruction_ids != None:
3454 self.instruction_ids = instruction_ids
3455 else:
3456 self.instruction_ids = []
3457 return
3458
3459 def pack(self):
3460 packed = []
3461 packed.append(struct.pack("!H", self.type))
3462 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3463 packed.append(loxi.generic_util.pack_list(self.instruction_ids))
3464 length = sum([len(x) for x in packed])
3465 packed[1] = struct.pack("!H", length)
3466 packed.append(loxi.generic_util.pad_to(8, length))
3467 return ''.join(packed)
3468
3469 @staticmethod
3470 def unpack(reader):
3471 obj = table_feature_prop_instructions()
3472 _type = reader.read("!H")[0]
3473 assert(_type == 0)
3474 _length = reader.read("!H")[0]
3475 orig_reader = reader
3476 reader = orig_reader.slice(_length, 4)
3477 obj.instruction_ids = loxi.generic_util.unpack_list(reader, ofp.instruction_id.instruction_id.unpack)
3478 orig_reader.skip_align()
3479 return obj
3480
3481 def __eq__(self, other):
3482 if type(self) != type(other): return False
3483 if self.instruction_ids != other.instruction_ids: return False
3484 return True
3485
3486 def pretty_print(self, q):
3487 q.text("table_feature_prop_instructions {")
3488 with q.group():
3489 with q.indent(2):
3490 q.breakable()
3491 q.text("instruction_ids = ");
3492 q.pp(self.instruction_ids)
3493 q.breakable()
3494 q.text('}')
3495
3496table_feature_prop.subtypes[0] = table_feature_prop_instructions
3497
3498class table_feature_prop_instructions_miss(table_feature_prop):
3499 type = 1
3500
3501 def __init__(self, instruction_ids=None):
3502 if instruction_ids != None:
3503 self.instruction_ids = instruction_ids
3504 else:
3505 self.instruction_ids = []
3506 return
3507
3508 def pack(self):
3509 packed = []
3510 packed.append(struct.pack("!H", self.type))
3511 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3512 packed.append(loxi.generic_util.pack_list(self.instruction_ids))
3513 length = sum([len(x) for x in packed])
3514 packed[1] = struct.pack("!H", length)
3515 packed.append(loxi.generic_util.pad_to(8, length))
3516 return ''.join(packed)
3517
3518 @staticmethod
3519 def unpack(reader):
3520 obj = table_feature_prop_instructions_miss()
3521 _type = reader.read("!H")[0]
3522 assert(_type == 1)
3523 _length = reader.read("!H")[0]
3524 orig_reader = reader
3525 reader = orig_reader.slice(_length, 4)
3526 obj.instruction_ids = loxi.generic_util.unpack_list(reader, ofp.instruction_id.instruction_id.unpack)
3527 orig_reader.skip_align()
3528 return obj
3529
3530 def __eq__(self, other):
3531 if type(self) != type(other): return False
3532 if self.instruction_ids != other.instruction_ids: return False
3533 return True
3534
3535 def pretty_print(self, q):
3536 q.text("table_feature_prop_instructions_miss {")
3537 with q.group():
3538 with q.indent(2):
3539 q.breakable()
3540 q.text("instruction_ids = ");
3541 q.pp(self.instruction_ids)
3542 q.breakable()
3543 q.text('}')
3544
3545table_feature_prop.subtypes[1] = table_feature_prop_instructions_miss
3546
3547class table_feature_prop_match(table_feature_prop):
3548 type = 8
3549
3550 def __init__(self, oxm_ids=None):
3551 if oxm_ids != None:
3552 self.oxm_ids = oxm_ids
3553 else:
3554 self.oxm_ids = []
3555 return
3556
3557 def pack(self):
3558 packed = []
3559 packed.append(struct.pack("!H", self.type))
3560 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3561 packed.append(loxi.generic_util.pack_list(self.oxm_ids))
3562 length = sum([len(x) for x in packed])
3563 packed[1] = struct.pack("!H", length)
3564 packed.append(loxi.generic_util.pad_to(8, length))
3565 return ''.join(packed)
3566
3567 @staticmethod
3568 def unpack(reader):
3569 obj = table_feature_prop_match()
3570 _type = reader.read("!H")[0]
3571 assert(_type == 8)
3572 _length = reader.read("!H")[0]
3573 orig_reader = reader
3574 reader = orig_reader.slice(_length, 4)
3575 obj.oxm_ids = loxi.generic_util.unpack_list(reader, ofp.common.uint32.unpack)
3576 orig_reader.skip_align()
3577 return obj
3578
3579 def __eq__(self, other):
3580 if type(self) != type(other): return False
3581 if self.oxm_ids != other.oxm_ids: return False
3582 return True
3583
3584 def pretty_print(self, q):
3585 q.text("table_feature_prop_match {")
3586 with q.group():
3587 with q.indent(2):
3588 q.breakable()
3589 q.text("oxm_ids = ");
3590 q.pp(self.oxm_ids)
3591 q.breakable()
3592 q.text('}')
3593
3594table_feature_prop.subtypes[8] = table_feature_prop_match
3595
3596class table_feature_prop_next_tables(table_feature_prop):
3597 type = 2
3598
3599 def __init__(self, next_table_ids=None):
3600 if next_table_ids != None:
3601 self.next_table_ids = next_table_ids
3602 else:
3603 self.next_table_ids = []
3604 return
3605
3606 def pack(self):
3607 packed = []
3608 packed.append(struct.pack("!H", self.type))
3609 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3610 packed.append(loxi.generic_util.pack_list(self.next_table_ids))
3611 length = sum([len(x) for x in packed])
3612 packed[1] = struct.pack("!H", length)
3613 packed.append(loxi.generic_util.pad_to(8, length))
3614 return ''.join(packed)
3615
3616 @staticmethod
3617 def unpack(reader):
3618 obj = table_feature_prop_next_tables()
3619 _type = reader.read("!H")[0]
3620 assert(_type == 2)
3621 _length = reader.read("!H")[0]
3622 orig_reader = reader
3623 reader = orig_reader.slice(_length, 4)
3624 obj.next_table_ids = loxi.generic_util.unpack_list(reader, ofp.common.uint8.unpack)
3625 orig_reader.skip_align()
3626 return obj
3627
3628 def __eq__(self, other):
3629 if type(self) != type(other): return False
3630 if self.next_table_ids != other.next_table_ids: return False
3631 return True
3632
3633 def pretty_print(self, q):
3634 q.text("table_feature_prop_next_tables {")
3635 with q.group():
3636 with q.indent(2):
3637 q.breakable()
3638 q.text("next_table_ids = ");
3639 q.pp(self.next_table_ids)
3640 q.breakable()
3641 q.text('}')
3642
3643table_feature_prop.subtypes[2] = table_feature_prop_next_tables
3644
3645class table_feature_prop_next_tables_miss(table_feature_prop):
3646 type = 3
3647
3648 def __init__(self, next_table_ids=None):
3649 if next_table_ids != None:
3650 self.next_table_ids = next_table_ids
3651 else:
3652 self.next_table_ids = []
3653 return
3654
3655 def pack(self):
3656 packed = []
3657 packed.append(struct.pack("!H", self.type))
3658 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3659 packed.append(loxi.generic_util.pack_list(self.next_table_ids))
3660 length = sum([len(x) for x in packed])
3661 packed[1] = struct.pack("!H", length)
3662 packed.append(loxi.generic_util.pad_to(8, length))
3663 return ''.join(packed)
3664
3665 @staticmethod
3666 def unpack(reader):
3667 obj = table_feature_prop_next_tables_miss()
3668 _type = reader.read("!H")[0]
3669 assert(_type == 3)
3670 _length = reader.read("!H")[0]
3671 orig_reader = reader
3672 reader = orig_reader.slice(_length, 4)
3673 obj.next_table_ids = loxi.generic_util.unpack_list(reader, ofp.common.uint8.unpack)
3674 orig_reader.skip_align()
3675 return obj
3676
3677 def __eq__(self, other):
3678 if type(self) != type(other): return False
3679 if self.next_table_ids != other.next_table_ids: return False
3680 return True
3681
3682 def pretty_print(self, q):
3683 q.text("table_feature_prop_next_tables_miss {")
3684 with q.group():
3685 with q.indent(2):
3686 q.breakable()
3687 q.text("next_table_ids = ");
3688 q.pp(self.next_table_ids)
3689 q.breakable()
3690 q.text('}')
3691
3692table_feature_prop.subtypes[3] = table_feature_prop_next_tables_miss
3693
3694class table_feature_prop_table_sync_from(table_feature_prop):
3695 type = 16
3696
3697 def __init__(self, table_ids=None):
3698 if table_ids != None:
3699 self.table_ids = table_ids
3700 else:
3701 self.table_ids = []
3702 return
3703
3704 def pack(self):
3705 packed = []
3706 packed.append(struct.pack("!H", self.type))
3707 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3708 packed.append(loxi.generic_util.pack_list(self.table_ids))
3709 length = sum([len(x) for x in packed])
3710 packed[1] = struct.pack("!H", length)
3711 packed.append(loxi.generic_util.pad_to(8, length))
3712 return ''.join(packed)
3713
3714 @staticmethod
3715 def unpack(reader):
3716 obj = table_feature_prop_table_sync_from()
3717 _type = reader.read("!H")[0]
3718 assert(_type == 16)
3719 _length = reader.read("!H")[0]
3720 orig_reader = reader
3721 reader = orig_reader.slice(_length, 4)
3722 obj.table_ids = loxi.generic_util.unpack_list(reader, ofp.common.uint8.unpack)
3723 orig_reader.skip_align()
3724 return obj
3725
3726 def __eq__(self, other):
3727 if type(self) != type(other): return False
3728 if self.table_ids != other.table_ids: return False
3729 return True
3730
3731 def pretty_print(self, q):
3732 q.text("table_feature_prop_table_sync_from {")
3733 with q.group():
3734 with q.indent(2):
3735 q.breakable()
3736 q.text("table_ids = ");
3737 q.pp(self.table_ids)
3738 q.breakable()
3739 q.text('}')
3740
3741table_feature_prop.subtypes[16] = table_feature_prop_table_sync_from
3742
3743class table_feature_prop_wildcards(table_feature_prop):
3744 type = 10
3745
3746 def __init__(self, oxm_ids=None):
3747 if oxm_ids != None:
3748 self.oxm_ids = oxm_ids
3749 else:
3750 self.oxm_ids = []
3751 return
3752
3753 def pack(self):
3754 packed = []
3755 packed.append(struct.pack("!H", self.type))
3756 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3757 packed.append(loxi.generic_util.pack_list(self.oxm_ids))
3758 length = sum([len(x) for x in packed])
3759 packed[1] = struct.pack("!H", length)
3760 packed.append(loxi.generic_util.pad_to(8, length))
3761 return ''.join(packed)
3762
3763 @staticmethod
3764 def unpack(reader):
3765 obj = table_feature_prop_wildcards()
3766 _type = reader.read("!H")[0]
3767 assert(_type == 10)
3768 _length = reader.read("!H")[0]
3769 orig_reader = reader
3770 reader = orig_reader.slice(_length, 4)
3771 obj.oxm_ids = loxi.generic_util.unpack_list(reader, ofp.common.uint32.unpack)
3772 orig_reader.skip_align()
3773 return obj
3774
3775 def __eq__(self, other):
3776 if type(self) != type(other): return False
3777 if self.oxm_ids != other.oxm_ids: return False
3778 return True
3779
3780 def pretty_print(self, q):
3781 q.text("table_feature_prop_wildcards {")
3782 with q.group():
3783 with q.indent(2):
3784 q.breakable()
3785 q.text("oxm_ids = ");
3786 q.pp(self.oxm_ids)
3787 q.breakable()
3788 q.text('}')
3789
3790table_feature_prop.subtypes[10] = table_feature_prop_wildcards
3791
3792class table_feature_prop_write_actions(table_feature_prop):
3793 type = 4
3794
3795 def __init__(self, action_ids=None):
3796 if action_ids != None:
3797 self.action_ids = action_ids
3798 else:
3799 self.action_ids = []
3800 return
3801
3802 def pack(self):
3803 packed = []
3804 packed.append(struct.pack("!H", self.type))
3805 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3806 packed.append(loxi.generic_util.pack_list(self.action_ids))
3807 length = sum([len(x) for x in packed])
3808 packed[1] = struct.pack("!H", length)
3809 packed.append(loxi.generic_util.pad_to(8, length))
3810 return ''.join(packed)
3811
3812 @staticmethod
3813 def unpack(reader):
3814 obj = table_feature_prop_write_actions()
3815 _type = reader.read("!H")[0]
3816 assert(_type == 4)
3817 _length = reader.read("!H")[0]
3818 orig_reader = reader
3819 reader = orig_reader.slice(_length, 4)
3820 obj.action_ids = loxi.generic_util.unpack_list(reader, ofp.action_id.action_id.unpack)
3821 orig_reader.skip_align()
3822 return obj
3823
3824 def __eq__(self, other):
3825 if type(self) != type(other): return False
3826 if self.action_ids != other.action_ids: return False
3827 return True
3828
3829 def pretty_print(self, q):
3830 q.text("table_feature_prop_write_actions {")
3831 with q.group():
3832 with q.indent(2):
3833 q.breakable()
3834 q.text("action_ids = ");
3835 q.pp(self.action_ids)
3836 q.breakable()
3837 q.text('}')
3838
3839table_feature_prop.subtypes[4] = table_feature_prop_write_actions
3840
3841class table_feature_prop_write_actions_miss(table_feature_prop):
3842 type = 5
3843
3844 def __init__(self, action_ids=None):
3845 if action_ids != None:
3846 self.action_ids = action_ids
3847 else:
3848 self.action_ids = []
3849 return
3850
3851 def pack(self):
3852 packed = []
3853 packed.append(struct.pack("!H", self.type))
3854 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3855 packed.append(loxi.generic_util.pack_list(self.action_ids))
3856 length = sum([len(x) for x in packed])
3857 packed[1] = struct.pack("!H", length)
3858 packed.append(loxi.generic_util.pad_to(8, length))
3859 return ''.join(packed)
3860
3861 @staticmethod
3862 def unpack(reader):
3863 obj = table_feature_prop_write_actions_miss()
3864 _type = reader.read("!H")[0]
3865 assert(_type == 5)
3866 _length = reader.read("!H")[0]
3867 orig_reader = reader
3868 reader = orig_reader.slice(_length, 4)
3869 obj.action_ids = loxi.generic_util.unpack_list(reader, ofp.action_id.action_id.unpack)
3870 orig_reader.skip_align()
3871 return obj
3872
3873 def __eq__(self, other):
3874 if type(self) != type(other): return False
3875 if self.action_ids != other.action_ids: return False
3876 return True
3877
3878 def pretty_print(self, q):
3879 q.text("table_feature_prop_write_actions_miss {")
3880 with q.group():
3881 with q.indent(2):
3882 q.breakable()
3883 q.text("action_ids = ");
3884 q.pp(self.action_ids)
3885 q.breakable()
3886 q.text('}')
3887
3888table_feature_prop.subtypes[5] = table_feature_prop_write_actions_miss
3889
3890class table_feature_prop_write_setfield(table_feature_prop):
3891 type = 12
3892
3893 def __init__(self, oxm_ids=None):
3894 if oxm_ids != None:
3895 self.oxm_ids = oxm_ids
3896 else:
3897 self.oxm_ids = []
3898 return
3899
3900 def pack(self):
3901 packed = []
3902 packed.append(struct.pack("!H", self.type))
3903 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3904 packed.append(loxi.generic_util.pack_list(self.oxm_ids))
3905 length = sum([len(x) for x in packed])
3906 packed[1] = struct.pack("!H", length)
3907 packed.append(loxi.generic_util.pad_to(8, length))
3908 return ''.join(packed)
3909
3910 @staticmethod
3911 def unpack(reader):
3912 obj = table_feature_prop_write_setfield()
3913 _type = reader.read("!H")[0]
3914 assert(_type == 12)
3915 _length = reader.read("!H")[0]
3916 orig_reader = reader
3917 reader = orig_reader.slice(_length, 4)
3918 obj.oxm_ids = loxi.generic_util.unpack_list(reader, ofp.common.uint32.unpack)
3919 orig_reader.skip_align()
3920 return obj
3921
3922 def __eq__(self, other):
3923 if type(self) != type(other): return False
3924 if self.oxm_ids != other.oxm_ids: return False
3925 return True
3926
3927 def pretty_print(self, q):
3928 q.text("table_feature_prop_write_setfield {")
3929 with q.group():
3930 with q.indent(2):
3931 q.breakable()
3932 q.text("oxm_ids = ");
3933 q.pp(self.oxm_ids)
3934 q.breakable()
3935 q.text('}')
3936
3937table_feature_prop.subtypes[12] = table_feature_prop_write_setfield
3938
3939class table_feature_prop_write_setfield_miss(table_feature_prop):
3940 type = 13
3941
3942 def __init__(self, oxm_ids=None):
3943 if oxm_ids != None:
3944 self.oxm_ids = oxm_ids
3945 else:
3946 self.oxm_ids = []
3947 return
3948
3949 def pack(self):
3950 packed = []
3951 packed.append(struct.pack("!H", self.type))
3952 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3953 packed.append(loxi.generic_util.pack_list(self.oxm_ids))
3954 length = sum([len(x) for x in packed])
3955 packed[1] = struct.pack("!H", length)
3956 packed.append(loxi.generic_util.pad_to(8, length))
3957 return ''.join(packed)
3958
3959 @staticmethod
3960 def unpack(reader):
3961 obj = table_feature_prop_write_setfield_miss()
3962 _type = reader.read("!H")[0]
3963 assert(_type == 13)
3964 _length = reader.read("!H")[0]
3965 orig_reader = reader
3966 reader = orig_reader.slice(_length, 4)
3967 obj.oxm_ids = loxi.generic_util.unpack_list(reader, ofp.common.uint32.unpack)
3968 orig_reader.skip_align()
3969 return obj
3970
3971 def __eq__(self, other):
3972 if type(self) != type(other): return False
3973 if self.oxm_ids != other.oxm_ids: return False
3974 return True
3975
3976 def pretty_print(self, q):
3977 q.text("table_feature_prop_write_setfield_miss {")
3978 with q.group():
3979 with q.indent(2):
3980 q.breakable()
3981 q.text("oxm_ids = ");
3982 q.pp(self.oxm_ids)
3983 q.breakable()
3984 q.text('}')
3985
3986table_feature_prop.subtypes[13] = table_feature_prop_write_setfield_miss
3987
3988class table_features(loxi.OFObject):
3989
3990 def __init__(self, table_id=None, name=None, metadata_match=None, metadata_write=None, config=None, max_entries=None, properties=None):
3991 if table_id != None:
3992 self.table_id = table_id
3993 else:
3994 self.table_id = 0
3995 if name != None:
3996 self.name = name
3997 else:
3998 self.name = ""
3999 if metadata_match != None:
4000 self.metadata_match = metadata_match
4001 else:
4002 self.metadata_match = 0
4003 if metadata_write != None:
4004 self.metadata_write = metadata_write
4005 else:
4006 self.metadata_write = 0
4007 if config != None:
4008 self.config = config
4009 else:
4010 self.config = 0
4011 if max_entries != None:
4012 self.max_entries = max_entries
4013 else:
4014 self.max_entries = 0
4015 if properties != None:
4016 self.properties = properties
4017 else:
4018 self.properties = []
4019 return
4020
4021 def pack(self):
4022 packed = []
4023 packed.append(struct.pack("!H", 0)) # placeholder for length at index 0
4024 packed.append(struct.pack("!B", self.table_id))
4025 packed.append('\x00' * 5)
4026 packed.append(struct.pack("!32s", self.name))
4027 packed.append(struct.pack("!Q", self.metadata_match))
4028 packed.append(struct.pack("!Q", self.metadata_write))
4029 packed.append(struct.pack("!L", self.config))
4030 packed.append(struct.pack("!L", self.max_entries))
4031 packed.append(loxi.generic_util.pack_list(self.properties))
4032 length = sum([len(x) for x in packed])
4033 packed[0] = struct.pack("!H", length)
4034 return ''.join(packed)
4035
4036 @staticmethod
4037 def unpack(reader):
4038 obj = table_features()
4039 _length = reader.read("!H")[0]
4040 orig_reader = reader
4041 reader = orig_reader.slice(_length, 2)
4042 obj.table_id = reader.read("!B")[0]
4043 reader.skip(5)
4044 obj.name = reader.read("!32s")[0].rstrip("\x00")
4045 obj.metadata_match = reader.read("!Q")[0]
4046 obj.metadata_write = reader.read("!Q")[0]
4047 obj.config = reader.read("!L")[0]
4048 obj.max_entries = reader.read("!L")[0]
4049 obj.properties = loxi.generic_util.unpack_list(reader, ofp.common.table_feature_prop.unpack)
4050 return obj
4051
4052 def __eq__(self, other):
4053 if type(self) != type(other): return False
4054 if self.table_id != other.table_id: return False
4055 if self.name != other.name: return False
4056 if self.metadata_match != other.metadata_match: return False
4057 if self.metadata_write != other.metadata_write: return False
4058 if self.config != other.config: return False
4059 if self.max_entries != other.max_entries: return False
4060 if self.properties != other.properties: return False
4061 return True
4062
4063 def pretty_print(self, q):
4064 q.text("table_features {")
4065 with q.group():
4066 with q.indent(2):
4067 q.breakable()
4068 q.text("table_id = ");
4069 q.text("%#x" % self.table_id)
4070 q.text(","); q.breakable()
4071 q.text("name = ");
4072 q.pp(self.name)
4073 q.text(","); q.breakable()
4074 q.text("metadata_match = ");
4075 q.text("%#x" % self.metadata_match)
4076 q.text(","); q.breakable()
4077 q.text("metadata_write = ");
4078 q.text("%#x" % self.metadata_write)
4079 q.text(","); q.breakable()
4080 q.text("config = ");
4081 q.text("%#x" % self.config)
4082 q.text(","); q.breakable()
4083 q.text("max_entries = ");
4084 q.text("%#x" % self.max_entries)
4085 q.text(","); q.breakable()
4086 q.text("properties = ");
4087 q.pp(self.properties)
4088 q.breakable()
4089 q.text('}')
4090
4091
4092class table_mod_prop_eviction(loxi.OFObject):
4093 type = 2
4094
4095 def __init__(self, flags=None):
4096 if flags != None:
4097 self.flags = flags
4098 else:
4099 self.flags = 0
4100 return
4101
4102 def pack(self):
4103 packed = []
4104 packed.append(struct.pack("!H", self.type))
4105 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
4106 packed.append(struct.pack("!L", self.flags))
4107 length = sum([len(x) for x in packed])
4108 packed[1] = struct.pack("!H", length)
4109 return ''.join(packed)
4110
4111 @staticmethod
4112 def unpack(reader):
4113 obj = table_mod_prop_eviction()
4114 _type = reader.read("!H")[0]
4115 assert(_type == 2)
4116 _length = reader.read("!H")[0]
4117 orig_reader = reader
4118 reader = orig_reader.slice(_length, 4)
4119 obj.flags = reader.read("!L")[0]
4120 return obj
4121
4122 def __eq__(self, other):
4123 if type(self) != type(other): return False
4124 if self.flags != other.flags: return False
4125 return True
4126
4127 def pretty_print(self, q):
4128 q.text("table_mod_prop_eviction {")
4129 with q.group():
4130 with q.indent(2):
4131 q.breakable()
4132 q.text("flags = ");
4133 q.text("%#x" % self.flags)
4134 q.breakable()
4135 q.text('}')
4136
4137
4138class table_mod_prop_experimenter(loxi.OFObject):
4139 subtypes = {}
4140
4141 type = 65535
4142
4143 def __init__(self, experimenter=None, exp_type=None):
4144 if experimenter != None:
4145 self.experimenter = experimenter
4146 else:
4147 self.experimenter = 0
4148 if exp_type != None:
4149 self.exp_type = exp_type
4150 else:
4151 self.exp_type = 0
4152 return
4153
4154 def pack(self):
4155 packed = []
4156 packed.append(struct.pack("!H", self.type))
4157 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
4158 packed.append(struct.pack("!L", self.experimenter))
4159 packed.append(struct.pack("!L", self.exp_type))
4160 length = sum([len(x) for x in packed])
4161 packed[1] = struct.pack("!H", length)
4162 return ''.join(packed)
4163
4164 @staticmethod
4165 def unpack(reader):
4166 subtype, = reader.peek('!L', 4)
4167 subclass = table_mod_prop_experimenter.subtypes.get(subtype)
4168 if subclass:
4169 return subclass.unpack(reader)
4170
4171 obj = table_mod_prop_experimenter()
4172 _type = reader.read("!H")[0]
4173 assert(_type == 65535)
4174 _length = reader.read("!H")[0]
4175 orig_reader = reader
4176 reader = orig_reader.slice(_length, 4)
4177 obj.experimenter = reader.read("!L")[0]
4178 obj.exp_type = reader.read("!L")[0]
4179 return obj
4180
4181 def __eq__(self, other):
4182 if type(self) != type(other): return False
4183 if self.experimenter != other.experimenter: return False
4184 if self.exp_type != other.exp_type: return False
4185 return True
4186
4187 def pretty_print(self, q):
4188 q.text("table_mod_prop_experimenter {")
4189 with q.group():
4190 with q.indent(2):
4191 q.breakable()
4192 q.text("exp_type = ");
4193 q.text("%#x" % self.exp_type)
4194 q.breakable()
4195 q.text('}')
4196
4197
4198class table_mod_prop_vacancy(loxi.OFObject):
4199 type = 3
4200
4201 def __init__(self, vacancy_down=None, vacancy_up=None, vacancy=None):
4202 if vacancy_down != None:
4203 self.vacancy_down = vacancy_down
4204 else:
4205 self.vacancy_down = 0
4206 if vacancy_up != None:
4207 self.vacancy_up = vacancy_up
4208 else:
4209 self.vacancy_up = 0
4210 if vacancy != None:
4211 self.vacancy = vacancy
4212 else:
4213 self.vacancy = 0
4214 return
4215
4216 def pack(self):
4217 packed = []
4218 packed.append(struct.pack("!H", self.type))
4219 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
4220 packed.append(struct.pack("!B", self.vacancy_down))
4221 packed.append(struct.pack("!B", self.vacancy_up))
4222 packed.append(struct.pack("!B", self.vacancy))
4223 packed.append('\x00' * 1)
4224 length = sum([len(x) for x in packed])
4225 packed[1] = struct.pack("!H", length)
4226 return ''.join(packed)
4227
4228 @staticmethod
4229 def unpack(reader):
4230 obj = table_mod_prop_vacancy()
4231 _type = reader.read("!H")[0]
4232 assert(_type == 3)
4233 _length = reader.read("!H")[0]
4234 orig_reader = reader
4235 reader = orig_reader.slice(_length, 4)
4236 obj.vacancy_down = reader.read("!B")[0]
4237 obj.vacancy_up = reader.read("!B")[0]
4238 obj.vacancy = reader.read("!B")[0]
4239 reader.skip(1)
4240 return obj
4241
4242 def __eq__(self, other):
4243 if type(self) != type(other): return False
4244 if self.vacancy_down != other.vacancy_down: return False
4245 if self.vacancy_up != other.vacancy_up: return False
4246 if self.vacancy != other.vacancy: return False
4247 return True
4248
4249 def pretty_print(self, q):
4250 q.text("table_mod_prop_vacancy {")
4251 with q.group():
4252 with q.indent(2):
4253 q.breakable()
4254 q.text("vacancy_down = ");
4255 q.text("%#x" % self.vacancy_down)
4256 q.text(","); q.breakable()
4257 q.text("vacancy_up = ");
4258 q.text("%#x" % self.vacancy_up)
4259 q.text(","); q.breakable()
4260 q.text("vacancy = ");
4261 q.text("%#x" % self.vacancy)
4262 q.breakable()
4263 q.text('}')
4264
4265
4266class table_stats_entry(loxi.OFObject):
4267
4268 def __init__(self, table_id=None, active_count=None, lookup_count=None, matched_count=None):
4269 if table_id != None:
4270 self.table_id = table_id
4271 else:
4272 self.table_id = 0
4273 if active_count != None:
4274 self.active_count = active_count
4275 else:
4276 self.active_count = 0
4277 if lookup_count != None:
4278 self.lookup_count = lookup_count
4279 else:
4280 self.lookup_count = 0
4281 if matched_count != None:
4282 self.matched_count = matched_count
4283 else:
4284 self.matched_count = 0
4285 return
4286
4287 def pack(self):
4288 packed = []
4289 packed.append(struct.pack("!B", self.table_id))
4290 packed.append('\x00' * 3)
4291 packed.append(struct.pack("!L", self.active_count))
4292 packed.append(struct.pack("!Q", self.lookup_count))
4293 packed.append(struct.pack("!Q", self.matched_count))
4294 return ''.join(packed)
4295
4296 @staticmethod
4297 def unpack(reader):
4298 obj = table_stats_entry()
4299 obj.table_id = reader.read("!B")[0]
4300 reader.skip(3)
4301 obj.active_count = reader.read("!L")[0]
4302 obj.lookup_count = reader.read("!Q")[0]
4303 obj.matched_count = reader.read("!Q")[0]
4304 return obj
4305
4306 def __eq__(self, other):
4307 if type(self) != type(other): return False
4308 if self.table_id != other.table_id: return False
4309 if self.active_count != other.active_count: return False
4310 if self.lookup_count != other.lookup_count: return False
4311 if self.matched_count != other.matched_count: return False
4312 return True
4313
4314 def pretty_print(self, q):
4315 q.text("table_stats_entry {")
4316 with q.group():
4317 with q.indent(2):
4318 q.breakable()
4319 q.text("table_id = ");
4320 q.text("%#x" % self.table_id)
4321 q.text(","); q.breakable()
4322 q.text("active_count = ");
4323 q.text("%#x" % self.active_count)
4324 q.text(","); q.breakable()
4325 q.text("lookup_count = ");
4326 q.text("%#x" % self.lookup_count)
4327 q.text(","); q.breakable()
4328 q.text("matched_count = ");
4329 q.text("%#x" % self.matched_count)
4330 q.breakable()
4331 q.text('}')
4332
4333
4334class uint32(loxi.OFObject):
4335
4336 def __init__(self, value=None):
4337 if value != None:
4338 self.value = value
4339 else:
4340 self.value = 0
4341 return
4342
4343 def pack(self):
4344 packed = []
4345 packed.append(struct.pack("!L", self.value))
4346 return ''.join(packed)
4347
4348 @staticmethod
4349 def unpack(reader):
4350 obj = uint32()
4351 obj.value = reader.read("!L")[0]
4352 return obj
4353
4354 def __eq__(self, other):
4355 if type(self) != type(other): return False
4356 if self.value != other.value: return False
4357 return True
4358
4359 def pretty_print(self, q):
4360 q.text("uint32 {")
4361 with q.group():
4362 with q.indent(2):
4363 q.breakable()
4364 q.text("value = ");
4365 q.text("%#x" % self.value)
4366 q.breakable()
4367 q.text('}')
4368
4369
4370class uint64(loxi.OFObject):
4371
4372 def __init__(self, value=None):
4373 if value != None:
4374 self.value = value
4375 else:
4376 self.value = 0
4377 return
4378
4379 def pack(self):
4380 packed = []
4381 packed.append(struct.pack("!Q", self.value))
4382 return ''.join(packed)
4383
4384 @staticmethod
4385 def unpack(reader):
4386 obj = uint64()
4387 obj.value = reader.read("!Q")[0]
4388 return obj
4389
4390 def __eq__(self, other):
4391 if type(self) != type(other): return False
4392 if self.value != other.value: return False
4393 return True
4394
4395 def pretty_print(self, q):
4396 q.text("uint64 {")
4397 with q.group():
4398 with q.indent(2):
4399 q.breakable()
4400 q.text("value = ");
4401 q.text("%#x" % self.value)
4402 q.breakable()
4403 q.text('}')
4404
4405
4406class uint8(loxi.OFObject):
4407
4408 def __init__(self, value=None):
4409 if value != None:
4410 self.value = value
4411 else:
4412 self.value = 0
4413 return
4414
4415 def pack(self):
4416 packed = []
4417 packed.append(struct.pack("!B", self.value))
4418 return ''.join(packed)
4419
4420 @staticmethod
4421 def unpack(reader):
4422 obj = uint8()
4423 obj.value = reader.read("!B")[0]
4424 return obj
4425
4426 def __eq__(self, other):
4427 if type(self) != type(other): return False
4428 if self.value != other.value: return False
4429 return True
4430
4431 def pretty_print(self, q):
4432 q.text("uint8 {")
4433 with q.group():
4434 with q.indent(2):
4435 q.breakable()
4436 q.text("value = ");
4437 q.text("%#x" % self.value)
4438 q.breakable()
4439 q.text('}')
4440
4441
4442
4443match = match_v3