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