blob: 13cc2f4fc729f426621f1ab2dcbfb2851454a6c7 [file] [log] [blame]
Rich Lanec2ee4b82013-04-24 17:12:38 -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
5# Automatically generated by LOXI from template common.py
6# Do not modify
7
8import sys
9import struct
10import action
11import instruction # for unpack_list
12import const
13import util
14import loxi.generic_util
15
16import oxm
17
18# HACK make this module visible as 'common' to simplify code generation
19common = sys.modules[__name__]
20
21def unpack_list_flow_stats_entry(reader):
22 return loxi.generic_util.unpack_list_lv16(reader, flow_stats_entry.unpack)
23
24def unpack_list_queue_prop(reader):
25 def deserializer(reader, typ):
26 if typ == const.OFPQT_MIN_RATE:
27 return queue_prop_min_rate.unpack(reader)
28 else:
29 raise loxi.ProtocolError("unknown queue prop %d" % typ)
30 return loxi.generic_util.unpack_list_tlv16(reader, deserializer)
31
32def unpack_list_packet_queue(reader):
33 def wrapper(reader):
34 length, = reader.peek('!4xH')
35 return packet_queue.unpack(reader.slice(length))
36 return loxi.generic_util.unpack_list(reader, wrapper)
37
38def unpack_list_hello_elem(reader):
39 def deserializer(reader, typ):
40 if typ == const.OFPHET_VERSIONBITMAP:
41 return hello_elem_versionbitmap.unpack(reader)
42 else:
43 return None
44 return [x for x in loxi.generic_util.unpack_list_tlv16(reader, deserializer) if x != None]
45
46def unpack_list_bucket(reader):
47 return loxi.generic_util.unpack_list_lv16(reader, bucket.unpack)
48
49def unpack_list_group_desc_stats_entry(reader):
50 return loxi.generic_util.unpack_list_lv16(reader, group_desc_stats_entry.unpack)
51
52def unpack_list_group_stats_entry(reader):
53 return loxi.generic_util.unpack_list_lv16(reader, group_stats_entry.unpack)
54
55def unpack_list_meter_stats(reader):
56 def wrapper(reader):
57 length, = reader.peek('!4xH')
58 return meter_stats.unpack(reader.slice(length))
59 return loxi.generic_util.unpack_list(reader, wrapper)
60
61class bsn_interface(object):
62
63 def __init__(self, hw_addr=None, name=None, ipv4_addr=None, ipv4_netmask=None):
64 if hw_addr != None:
65 self.hw_addr = hw_addr
66 else:
67 self.hw_addr = [0,0,0,0,0,0]
68 if name != None:
69 self.name = name
70 else:
71 self.name = ""
72 if ipv4_addr != None:
73 self.ipv4_addr = ipv4_addr
74 else:
75 self.ipv4_addr = 0
76 if ipv4_netmask != None:
77 self.ipv4_netmask = ipv4_netmask
78 else:
79 self.ipv4_netmask = 0
80 return
81
82 def pack(self):
83 packed = []
84 packed.append(struct.pack("!6B", *self.hw_addr))
85 packed.append('\x00' * 2)
86 packed.append(struct.pack("!16s", self.name))
87 packed.append(struct.pack("!L", self.ipv4_addr))
88 packed.append(struct.pack("!L", self.ipv4_netmask))
89 return ''.join(packed)
90
91 @staticmethod
92 def unpack(buf):
93 obj = bsn_interface()
94 if type(buf) == loxi.generic_util.OFReader:
95 reader = buf
96 else:
97 reader = loxi.generic_util.OFReader(buf)
98 obj.hw_addr = list(reader.read('!6B'))
99 reader.skip(2)
100 obj.name = reader.read("!16s")[0].rstrip("\x00")
101 obj.ipv4_addr = reader.read('!L')[0]
102 obj.ipv4_netmask = reader.read('!L')[0]
103 return obj
104
105 def __eq__(self, other):
106 if type(self) != type(other): return False
107 if self.hw_addr != other.hw_addr: return False
108 if self.name != other.name: return False
109 if self.ipv4_addr != other.ipv4_addr: return False
110 if self.ipv4_netmask != other.ipv4_netmask: return False
111 return True
112
113 def __ne__(self, other):
114 return not self.__eq__(other)
115
116 def show(self):
117 import loxi.pp
118 return loxi.pp.pp(self)
119
120 def pretty_print(self, q):
121 q.text("bsn_interface {")
122 with q.group():
123 with q.indent(2):
124 q.breakable()
125 q.text("hw_addr = ");
126 q.text(util.pretty_mac(self.hw_addr))
127 q.text(","); q.breakable()
128 q.text("name = ");
129 q.pp(self.name)
130 q.text(","); q.breakable()
131 q.text("ipv4_addr = ");
132 q.text(util.pretty_ipv4(self.ipv4_addr))
133 q.text(","); q.breakable()
134 q.text("ipv4_netmask = ");
135 q.text(util.pretty_ipv4(self.ipv4_netmask))
136 q.breakable()
137 q.text('}')
138
139class bucket(object):
140
141 def __init__(self, weight=None, watch_port=None, watch_group=None, actions=None):
142 if weight != None:
143 self.weight = weight
144 else:
145 self.weight = 0
146 if watch_port != None:
147 self.watch_port = watch_port
148 else:
149 self.watch_port = 0
150 if watch_group != None:
151 self.watch_group = watch_group
152 else:
153 self.watch_group = 0
154 if actions != None:
155 self.actions = actions
156 else:
157 self.actions = []
158 return
159
160 def pack(self):
161 packed = []
162 packed.append(struct.pack("!H", 0)) # placeholder for len at index 0
163 packed.append(struct.pack("!H", self.weight))
164 packed.append(struct.pack("!L", self.watch_port))
165 packed.append(struct.pack("!L", self.watch_group))
166 packed.append('\x00' * 4)
167 packed.append("".join([x.pack() for x in self.actions]))
168 length = sum([len(x) for x in packed])
169 packed[0] = struct.pack("!H", length)
170 return ''.join(packed)
171
172 @staticmethod
173 def unpack(buf):
174 obj = bucket()
175 if type(buf) == loxi.generic_util.OFReader:
176 reader = buf
177 else:
178 reader = loxi.generic_util.OFReader(buf)
179 _len = reader.read('!H')[0]
180 obj.weight = reader.read('!H')[0]
181 obj.watch_port = reader.read('!L')[0]
182 obj.watch_group = reader.read('!L')[0]
183 reader.skip(4)
184 obj.actions = action.unpack_list(reader)
185 return obj
186
187 def __eq__(self, other):
188 if type(self) != type(other): return False
189 if self.weight != other.weight: return False
190 if self.watch_port != other.watch_port: return False
191 if self.watch_group != other.watch_group: return False
192 if self.actions != other.actions: return False
193 return True
194
195 def __ne__(self, other):
196 return not self.__eq__(other)
197
198 def show(self):
199 import loxi.pp
200 return loxi.pp.pp(self)
201
202 def pretty_print(self, q):
203 q.text("bucket {")
204 with q.group():
205 with q.indent(2):
206 q.breakable()
207 q.text("weight = ");
208 q.text("%#x" % self.weight)
209 q.text(","); q.breakable()
210 q.text("watch_port = ");
211 q.text(util.pretty_port(self.watch_port))
212 q.text(","); q.breakable()
213 q.text("watch_group = ");
214 q.text("%#x" % self.watch_group)
215 q.text(","); q.breakable()
216 q.text("actions = ");
217 q.pp(self.actions)
218 q.breakable()
219 q.text('}')
220
221class bucket_counter(object):
222
223 def __init__(self, packet_count=None, byte_count=None):
224 if packet_count != None:
225 self.packet_count = packet_count
226 else:
227 self.packet_count = 0
228 if byte_count != None:
229 self.byte_count = byte_count
230 else:
231 self.byte_count = 0
232 return
233
234 def pack(self):
235 packed = []
236 packed.append(struct.pack("!Q", self.packet_count))
237 packed.append(struct.pack("!Q", self.byte_count))
238 return ''.join(packed)
239
240 @staticmethod
241 def unpack(buf):
242 obj = bucket_counter()
243 if type(buf) == loxi.generic_util.OFReader:
244 reader = buf
245 else:
246 reader = loxi.generic_util.OFReader(buf)
247 obj.packet_count = reader.read('!Q')[0]
248 obj.byte_count = reader.read('!Q')[0]
249 return obj
250
251 def __eq__(self, other):
252 if type(self) != type(other): return False
253 if self.packet_count != other.packet_count: return False
254 if self.byte_count != other.byte_count: return False
255 return True
256
257 def __ne__(self, other):
258 return not self.__eq__(other)
259
260 def show(self):
261 import loxi.pp
262 return loxi.pp.pp(self)
263
264 def pretty_print(self, q):
265 q.text("bucket_counter {")
266 with q.group():
267 with q.indent(2):
268 q.breakable()
269 q.text("packet_count = ");
270 q.text("%#x" % self.packet_count)
271 q.text(","); q.breakable()
272 q.text("byte_count = ");
273 q.text("%#x" % self.byte_count)
274 q.breakable()
275 q.text('}')
276
277class flow_stats_entry(object):
278
279 def __init__(self, table_id=None, duration_sec=None, duration_nsec=None, priority=None, idle_timeout=None, hard_timeout=None, cookie=None, packet_count=None, byte_count=None, match=None, instructions=None):
280 if table_id != None:
281 self.table_id = table_id
282 else:
283 self.table_id = 0
284 if duration_sec != None:
285 self.duration_sec = duration_sec
286 else:
287 self.duration_sec = 0
288 if duration_nsec != None:
289 self.duration_nsec = duration_nsec
290 else:
291 self.duration_nsec = 0
292 if priority != None:
293 self.priority = priority
294 else:
295 self.priority = 0
296 if idle_timeout != None:
297 self.idle_timeout = idle_timeout
298 else:
299 self.idle_timeout = 0
300 if hard_timeout != None:
301 self.hard_timeout = hard_timeout
302 else:
303 self.hard_timeout = 0
304 if cookie != None:
305 self.cookie = cookie
306 else:
307 self.cookie = 0
308 if packet_count != None:
309 self.packet_count = packet_count
310 else:
311 self.packet_count = 0
312 if byte_count != None:
313 self.byte_count = byte_count
314 else:
315 self.byte_count = 0
316 if match != None:
317 self.match = match
318 else:
319 self.match = common.match()
320 if instructions != None:
321 self.instructions = instructions
322 else:
323 self.instructions = []
324 return
325
326 def pack(self):
327 packed = []
328 packed.append(struct.pack("!H", 0)) # placeholder for length at index 0
329 packed.append(struct.pack("!B", self.table_id))
330 packed.append('\x00' * 1)
331 packed.append(struct.pack("!L", self.duration_sec))
332 packed.append(struct.pack("!L", self.duration_nsec))
333 packed.append(struct.pack("!H", self.priority))
334 packed.append(struct.pack("!H", self.idle_timeout))
335 packed.append(struct.pack("!H", self.hard_timeout))
336 packed.append('\x00' * 6)
337 packed.append(struct.pack("!Q", self.cookie))
338 packed.append(struct.pack("!Q", self.packet_count))
339 packed.append(struct.pack("!Q", self.byte_count))
340 packed.append(self.match.pack())
341 packed.append("".join([x.pack() for x in self.instructions]))
342 length = sum([len(x) for x in packed])
343 packed[0] = struct.pack("!H", length)
344 return ''.join(packed)
345
346 @staticmethod
347 def unpack(buf):
348 obj = flow_stats_entry()
349 if type(buf) == loxi.generic_util.OFReader:
350 reader = buf
351 else:
352 reader = loxi.generic_util.OFReader(buf)
353 _length = reader.read('!H')[0]
354 obj.table_id = reader.read('!B')[0]
355 reader.skip(1)
356 obj.duration_sec = reader.read('!L')[0]
357 obj.duration_nsec = reader.read('!L')[0]
358 obj.priority = reader.read('!H')[0]
359 obj.idle_timeout = reader.read('!H')[0]
360 obj.hard_timeout = reader.read('!H')[0]
361 reader.skip(6)
362 obj.cookie = reader.read('!Q')[0]
363 obj.packet_count = reader.read('!Q')[0]
364 obj.byte_count = reader.read('!Q')[0]
365 obj.match = common.match.unpack(reader)
366 obj.instructions = instruction.unpack_list(reader)
367 return obj
368
369 def __eq__(self, other):
370 if type(self) != type(other): return False
371 if self.table_id != other.table_id: return False
372 if self.duration_sec != other.duration_sec: return False
373 if self.duration_nsec != other.duration_nsec: return False
374 if self.priority != other.priority: return False
375 if self.idle_timeout != other.idle_timeout: return False
376 if self.hard_timeout != other.hard_timeout: return False
377 if self.cookie != other.cookie: return False
378 if self.packet_count != other.packet_count: return False
379 if self.byte_count != other.byte_count: return False
380 if self.match != other.match: return False
381 if self.instructions != other.instructions: return False
382 return True
383
384 def __ne__(self, other):
385 return not self.__eq__(other)
386
387 def show(self):
388 import loxi.pp
389 return loxi.pp.pp(self)
390
391 def pretty_print(self, q):
392 q.text("flow_stats_entry {")
393 with q.group():
394 with q.indent(2):
395 q.breakable()
396 q.text("table_id = ");
397 q.text("%#x" % self.table_id)
398 q.text(","); q.breakable()
399 q.text("duration_sec = ");
400 q.text("%#x" % self.duration_sec)
401 q.text(","); q.breakable()
402 q.text("duration_nsec = ");
403 q.text("%#x" % self.duration_nsec)
404 q.text(","); q.breakable()
405 q.text("priority = ");
406 q.text("%#x" % self.priority)
407 q.text(","); q.breakable()
408 q.text("idle_timeout = ");
409 q.text("%#x" % self.idle_timeout)
410 q.text(","); q.breakable()
411 q.text("hard_timeout = ");
412 q.text("%#x" % self.hard_timeout)
413 q.text(","); q.breakable()
414 q.text("cookie = ");
415 q.text("%#x" % self.cookie)
416 q.text(","); q.breakable()
417 q.text("packet_count = ");
418 q.text("%#x" % self.packet_count)
419 q.text(","); q.breakable()
420 q.text("byte_count = ");
421 q.text("%#x" % self.byte_count)
422 q.text(","); q.breakable()
423 q.text("match = ");
424 q.pp(self.match)
425 q.text(","); q.breakable()
426 q.text("instructions = ");
427 q.pp(self.instructions)
428 q.breakable()
429 q.text('}')
430
431class group_desc_stats_entry(object):
432
433 def __init__(self, type=None, group_id=None, buckets=None):
434 if type != None:
435 self.type = type
436 else:
437 self.type = 0
438 if group_id != None:
439 self.group_id = group_id
440 else:
441 self.group_id = 0
442 if buckets != None:
443 self.buckets = buckets
444 else:
445 self.buckets = []
446 return
447
448 def pack(self):
449 packed = []
450 packed.append(struct.pack("!H", 0)) # placeholder for length at index 0
451 packed.append(struct.pack("!B", self.type))
452 packed.append('\x00' * 1)
453 packed.append(struct.pack("!L", self.group_id))
454 packed.append("".join([x.pack() for x in self.buckets]))
455 length = sum([len(x) for x in packed])
456 packed[0] = struct.pack("!H", length)
457 return ''.join(packed)
458
459 @staticmethod
460 def unpack(buf):
461 obj = group_desc_stats_entry()
462 if type(buf) == loxi.generic_util.OFReader:
463 reader = buf
464 else:
465 reader = loxi.generic_util.OFReader(buf)
466 _length = reader.read('!H')[0]
467 obj.type = reader.read('!B')[0]
468 reader.skip(1)
469 obj.group_id = reader.read('!L')[0]
470 obj.buckets = common.unpack_list_bucket(reader)
471 return obj
472
473 def __eq__(self, other):
474 if type(self) != type(other): return False
475 if self.type != other.type: return False
476 if self.group_id != other.group_id: return False
477 if self.buckets != other.buckets: return False
478 return True
479
480 def __ne__(self, other):
481 return not self.__eq__(other)
482
483 def show(self):
484 import loxi.pp
485 return loxi.pp.pp(self)
486
487 def pretty_print(self, q):
488 q.text("group_desc_stats_entry {")
489 with q.group():
490 with q.indent(2):
491 q.breakable()
492 q.text("type = ");
493 q.text("%#x" % self.type)
494 q.text(","); q.breakable()
495 q.text("group_id = ");
496 q.text("%#x" % self.group_id)
497 q.text(","); q.breakable()
498 q.text("buckets = ");
499 q.pp(self.buckets)
500 q.breakable()
501 q.text('}')
502
503class group_stats_entry(object):
504
505 def __init__(self, group_id=None, ref_count=None, packet_count=None, byte_count=None, bucket_stats=None):
506 if group_id != None:
507 self.group_id = group_id
508 else:
509 self.group_id = 0
510 if ref_count != None:
511 self.ref_count = ref_count
512 else:
513 self.ref_count = 0
514 if packet_count != None:
515 self.packet_count = packet_count
516 else:
517 self.packet_count = 0
518 if byte_count != None:
519 self.byte_count = byte_count
520 else:
521 self.byte_count = 0
522 if bucket_stats != None:
523 self.bucket_stats = bucket_stats
524 else:
525 self.bucket_stats = []
526 return
527
528 def pack(self):
529 packed = []
530 packed.append(struct.pack("!H", 0)) # placeholder for length at index 0
531 packed.append('\x00' * 2)
532 packed.append(struct.pack("!L", self.group_id))
533 packed.append(struct.pack("!L", self.ref_count))
534 packed.append('\x00' * 4)
535 packed.append(struct.pack("!Q", self.packet_count))
536 packed.append(struct.pack("!Q", self.byte_count))
537 packed.append("".join([x.pack() for x in self.bucket_stats]))
538 length = sum([len(x) for x in packed])
539 packed[0] = struct.pack("!H", length)
540 return ''.join(packed)
541
542 @staticmethod
543 def unpack(buf):
544 obj = group_stats_entry()
545 if type(buf) == loxi.generic_util.OFReader:
546 reader = buf
547 else:
548 reader = loxi.generic_util.OFReader(buf)
549 _length = reader.read('!H')[0]
550 reader.skip(2)
551 obj.group_id = reader.read('!L')[0]
552 obj.ref_count = reader.read('!L')[0]
553 reader.skip(4)
554 obj.packet_count = reader.read('!Q')[0]
555 obj.byte_count = reader.read('!Q')[0]
556 obj.bucket_stats = loxi.generic_util.unpack_list(reader, common.bucket_counter.unpack)
557 return obj
558
559 def __eq__(self, other):
560 if type(self) != type(other): return False
561 if self.group_id != other.group_id: return False
562 if self.ref_count != other.ref_count: return False
563 if self.packet_count != other.packet_count: return False
564 if self.byte_count != other.byte_count: return False
565 if self.bucket_stats != other.bucket_stats: return False
566 return True
567
568 def __ne__(self, other):
569 return not self.__eq__(other)
570
571 def show(self):
572 import loxi.pp
573 return loxi.pp.pp(self)
574
575 def pretty_print(self, q):
576 q.text("group_stats_entry {")
577 with q.group():
578 with q.indent(2):
579 q.breakable()
580 q.text("group_id = ");
581 q.text("%#x" % self.group_id)
582 q.text(","); q.breakable()
583 q.text("ref_count = ");
584 q.text("%#x" % self.ref_count)
585 q.text(","); q.breakable()
586 q.text("packet_count = ");
587 q.text("%#x" % self.packet_count)
588 q.text(","); q.breakable()
589 q.text("byte_count = ");
590 q.text("%#x" % self.byte_count)
591 q.text(","); q.breakable()
592 q.text("bucket_stats = ");
593 q.pp(self.bucket_stats)
594 q.breakable()
595 q.text('}')
596
597class match_v3(object):
598 type = 1
599
600 def __init__(self, oxm_list=None):
601 if oxm_list != None:
602 self.oxm_list = oxm_list
603 else:
604 self.oxm_list = []
605 return
606
607 def pack(self):
608 packed = []
609 packed.append(struct.pack("!H", self.type))
610 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
611 packed.append("".join([x.pack() for x in self.oxm_list]))
612 length = sum([len(x) for x in packed])
613 packed[1] = struct.pack("!H", length)
614 packed.append('\x00' * ((length + 7)/8*8 - length))
615 return ''.join(packed)
616
617 @staticmethod
618 def unpack(buf):
619 obj = match_v3()
620 if type(buf) == loxi.generic_util.OFReader:
621 reader = buf
622 else:
623 reader = loxi.generic_util.OFReader(buf)
624 _type = reader.read('!H')[0]
625 assert(_type == 1)
626 _length = reader.read('!H')[0]
627 obj.oxm_list = oxm.unpack_list(reader.slice(_length-4))
628 reader.skip((_length + 7)/8*8 - _length)
629 return obj
630
631 def __eq__(self, other):
632 if type(self) != type(other): return False
633 if self.oxm_list != other.oxm_list: return False
634 return True
635
636 def __ne__(self, other):
637 return not self.__eq__(other)
638
639 def show(self):
640 import loxi.pp
641 return loxi.pp.pp(self)
642
643 def pretty_print(self, q):
644 q.text("match_v3 {")
645 with q.group():
646 with q.indent(2):
647 q.breakable()
648 q.text("oxm_list = ");
649 q.pp(self.oxm_list)
650 q.breakable()
651 q.text('}')
652
653class packet_queue(object):
654
655 def __init__(self, queue_id=None, port=None, properties=None):
656 if queue_id != None:
657 self.queue_id = queue_id
658 else:
659 self.queue_id = 0
660 if port != None:
661 self.port = port
662 else:
663 self.port = 0
664 if properties != None:
665 self.properties = properties
666 else:
667 self.properties = []
668 return
669
670 def pack(self):
671 packed = []
672 packed.append(struct.pack("!L", self.queue_id))
673 packed.append(struct.pack("!L", self.port))
674 packed.append(struct.pack("!H", 0)) # placeholder for len at index 2
675 packed.append('\x00' * 6)
676 packed.append("".join([x.pack() for x in self.properties]))
677 length = sum([len(x) for x in packed])
678 packed[2] = struct.pack("!H", length)
679 return ''.join(packed)
680
681 @staticmethod
682 def unpack(buf):
683 obj = packet_queue()
684 if type(buf) == loxi.generic_util.OFReader:
685 reader = buf
686 else:
687 reader = loxi.generic_util.OFReader(buf)
688 obj.queue_id = reader.read('!L')[0]
689 obj.port = reader.read('!L')[0]
690 _len = reader.read('!H')[0]
691 reader.skip(6)
692 obj.properties = common.unpack_list_queue_prop(reader)
693 return obj
694
695 def __eq__(self, other):
696 if type(self) != type(other): return False
697 if self.queue_id != other.queue_id: return False
698 if self.port != other.port: return False
699 if self.properties != other.properties: return False
700 return True
701
702 def __ne__(self, other):
703 return not self.__eq__(other)
704
705 def show(self):
706 import loxi.pp
707 return loxi.pp.pp(self)
708
709 def pretty_print(self, q):
710 q.text("packet_queue {")
711 with q.group():
712 with q.indent(2):
713 q.breakable()
714 q.text("queue_id = ");
715 q.text("%#x" % self.queue_id)
716 q.text(","); q.breakable()
717 q.text("port = ");
718 q.text(util.pretty_port(self.port))
719 q.text(","); q.breakable()
720 q.text("properties = ");
721 q.pp(self.properties)
722 q.breakable()
723 q.text('}')
724
725class port_desc(object):
726
727 def __init__(self, port_no=None, hw_addr=None, name=None, config=None, state=None, curr=None, advertised=None, supported=None, peer=None, curr_speed=None, max_speed=None):
728 if port_no != None:
729 self.port_no = port_no
730 else:
731 self.port_no = 0
732 if hw_addr != None:
733 self.hw_addr = hw_addr
734 else:
735 self.hw_addr = [0,0,0,0,0,0]
736 if name != None:
737 self.name = name
738 else:
739 self.name = ""
740 if config != None:
741 self.config = config
742 else:
743 self.config = 0
744 if state != None:
745 self.state = state
746 else:
747 self.state = 0
748 if curr != None:
749 self.curr = curr
750 else:
751 self.curr = 0
752 if advertised != None:
753 self.advertised = advertised
754 else:
755 self.advertised = 0
756 if supported != None:
757 self.supported = supported
758 else:
759 self.supported = 0
760 if peer != None:
761 self.peer = peer
762 else:
763 self.peer = 0
764 if curr_speed != None:
765 self.curr_speed = curr_speed
766 else:
767 self.curr_speed = 0
768 if max_speed != None:
769 self.max_speed = max_speed
770 else:
771 self.max_speed = 0
772 return
773
774 def pack(self):
775 packed = []
776 packed.append(struct.pack("!L", self.port_no))
777 packed.append('\x00' * 4)
778 packed.append(struct.pack("!6B", *self.hw_addr))
779 packed.append('\x00' * 2)
780 packed.append(struct.pack("!16s", self.name))
781 packed.append(struct.pack("!L", self.config))
782 packed.append(struct.pack("!L", self.state))
783 packed.append(struct.pack("!L", self.curr))
784 packed.append(struct.pack("!L", self.advertised))
785 packed.append(struct.pack("!L", self.supported))
786 packed.append(struct.pack("!L", self.peer))
787 packed.append(struct.pack("!L", self.curr_speed))
788 packed.append(struct.pack("!L", self.max_speed))
789 return ''.join(packed)
790
791 @staticmethod
792 def unpack(buf):
793 obj = port_desc()
794 if type(buf) == loxi.generic_util.OFReader:
795 reader = buf
796 else:
797 reader = loxi.generic_util.OFReader(buf)
798 obj.port_no = reader.read('!L')[0]
799 reader.skip(4)
800 obj.hw_addr = list(reader.read('!6B'))
801 reader.skip(2)
802 obj.name = reader.read("!16s")[0].rstrip("\x00")
803 obj.config = reader.read('!L')[0]
804 obj.state = reader.read('!L')[0]
805 obj.curr = reader.read('!L')[0]
806 obj.advertised = reader.read('!L')[0]
807 obj.supported = reader.read('!L')[0]
808 obj.peer = reader.read('!L')[0]
809 obj.curr_speed = reader.read('!L')[0]
810 obj.max_speed = reader.read('!L')[0]
811 return obj
812
813 def __eq__(self, other):
814 if type(self) != type(other): return False
815 if self.port_no != other.port_no: return False
816 if self.hw_addr != other.hw_addr: return False
817 if self.name != other.name: return False
818 if self.config != other.config: return False
819 if self.state != other.state: return False
820 if self.curr != other.curr: return False
821 if self.advertised != other.advertised: return False
822 if self.supported != other.supported: return False
823 if self.peer != other.peer: return False
824 if self.curr_speed != other.curr_speed: return False
825 if self.max_speed != other.max_speed: return False
826 return True
827
828 def __ne__(self, other):
829 return not self.__eq__(other)
830
831 def show(self):
832 import loxi.pp
833 return loxi.pp.pp(self)
834
835 def pretty_print(self, q):
836 q.text("port_desc {")
837 with q.group():
838 with q.indent(2):
839 q.breakable()
840 q.text("port_no = ");
841 q.text(util.pretty_port(self.port_no))
842 q.text(","); q.breakable()
843 q.text("hw_addr = ");
844 q.text(util.pretty_mac(self.hw_addr))
845 q.text(","); q.breakable()
846 q.text("name = ");
847 q.pp(self.name)
848 q.text(","); q.breakable()
849 q.text("config = ");
850 q.text("%#x" % self.config)
851 q.text(","); q.breakable()
852 q.text("state = ");
853 q.text("%#x" % self.state)
854 q.text(","); q.breakable()
855 q.text("curr = ");
856 q.text("%#x" % self.curr)
857 q.text(","); q.breakable()
858 q.text("advertised = ");
859 q.text("%#x" % self.advertised)
860 q.text(","); q.breakable()
861 q.text("supported = ");
862 q.text("%#x" % self.supported)
863 q.text(","); q.breakable()
864 q.text("peer = ");
865 q.text("%#x" % self.peer)
866 q.text(","); q.breakable()
867 q.text("curr_speed = ");
868 q.text("%#x" % self.curr_speed)
869 q.text(","); q.breakable()
870 q.text("max_speed = ");
871 q.text("%#x" % self.max_speed)
872 q.breakable()
873 q.text('}')
874
875class port_stats_entry(object):
876
877 def __init__(self, port_no=None, rx_packets=None, tx_packets=None, rx_bytes=None, tx_bytes=None, rx_dropped=None, tx_dropped=None, rx_errors=None, tx_errors=None, rx_frame_err=None, rx_over_err=None, rx_crc_err=None, collisions=None):
878 if port_no != None:
879 self.port_no = port_no
880 else:
881 self.port_no = 0
882 if rx_packets != None:
883 self.rx_packets = rx_packets
884 else:
885 self.rx_packets = 0
886 if tx_packets != None:
887 self.tx_packets = tx_packets
888 else:
889 self.tx_packets = 0
890 if rx_bytes != None:
891 self.rx_bytes = rx_bytes
892 else:
893 self.rx_bytes = 0
894 if tx_bytes != None:
895 self.tx_bytes = tx_bytes
896 else:
897 self.tx_bytes = 0
898 if rx_dropped != None:
899 self.rx_dropped = rx_dropped
900 else:
901 self.rx_dropped = 0
902 if tx_dropped != None:
903 self.tx_dropped = tx_dropped
904 else:
905 self.tx_dropped = 0
906 if rx_errors != None:
907 self.rx_errors = rx_errors
908 else:
909 self.rx_errors = 0
910 if tx_errors != None:
911 self.tx_errors = tx_errors
912 else:
913 self.tx_errors = 0
914 if rx_frame_err != None:
915 self.rx_frame_err = rx_frame_err
916 else:
917 self.rx_frame_err = 0
918 if rx_over_err != None:
919 self.rx_over_err = rx_over_err
920 else:
921 self.rx_over_err = 0
922 if rx_crc_err != None:
923 self.rx_crc_err = rx_crc_err
924 else:
925 self.rx_crc_err = 0
926 if collisions != None:
927 self.collisions = collisions
928 else:
929 self.collisions = 0
930 return
931
932 def pack(self):
933 packed = []
934 packed.append(struct.pack("!L", self.port_no))
935 packed.append('\x00' * 4)
936 packed.append(struct.pack("!Q", self.rx_packets))
937 packed.append(struct.pack("!Q", self.tx_packets))
938 packed.append(struct.pack("!Q", self.rx_bytes))
939 packed.append(struct.pack("!Q", self.tx_bytes))
940 packed.append(struct.pack("!Q", self.rx_dropped))
941 packed.append(struct.pack("!Q", self.tx_dropped))
942 packed.append(struct.pack("!Q", self.rx_errors))
943 packed.append(struct.pack("!Q", self.tx_errors))
944 packed.append(struct.pack("!Q", self.rx_frame_err))
945 packed.append(struct.pack("!Q", self.rx_over_err))
946 packed.append(struct.pack("!Q", self.rx_crc_err))
947 packed.append(struct.pack("!Q", self.collisions))
948 return ''.join(packed)
949
950 @staticmethod
951 def unpack(buf):
952 obj = port_stats_entry()
953 if type(buf) == loxi.generic_util.OFReader:
954 reader = buf
955 else:
956 reader = loxi.generic_util.OFReader(buf)
957 obj.port_no = reader.read('!L')[0]
958 reader.skip(4)
959 obj.rx_packets = reader.read('!Q')[0]
960 obj.tx_packets = reader.read('!Q')[0]
961 obj.rx_bytes = reader.read('!Q')[0]
962 obj.tx_bytes = reader.read('!Q')[0]
963 obj.rx_dropped = reader.read('!Q')[0]
964 obj.tx_dropped = reader.read('!Q')[0]
965 obj.rx_errors = reader.read('!Q')[0]
966 obj.tx_errors = reader.read('!Q')[0]
967 obj.rx_frame_err = reader.read('!Q')[0]
968 obj.rx_over_err = reader.read('!Q')[0]
969 obj.rx_crc_err = reader.read('!Q')[0]
970 obj.collisions = reader.read('!Q')[0]
971 return obj
972
973 def __eq__(self, other):
974 if type(self) != type(other): return False
975 if self.port_no != other.port_no: return False
976 if self.rx_packets != other.rx_packets: return False
977 if self.tx_packets != other.tx_packets: return False
978 if self.rx_bytes != other.rx_bytes: return False
979 if self.tx_bytes != other.tx_bytes: return False
980 if self.rx_dropped != other.rx_dropped: return False
981 if self.tx_dropped != other.tx_dropped: return False
982 if self.rx_errors != other.rx_errors: return False
983 if self.tx_errors != other.tx_errors: return False
984 if self.rx_frame_err != other.rx_frame_err: return False
985 if self.rx_over_err != other.rx_over_err: return False
986 if self.rx_crc_err != other.rx_crc_err: return False
987 if self.collisions != other.collisions: return False
988 return True
989
990 def __ne__(self, other):
991 return not self.__eq__(other)
992
993 def show(self):
994 import loxi.pp
995 return loxi.pp.pp(self)
996
997 def pretty_print(self, q):
998 q.text("port_stats_entry {")
999 with q.group():
1000 with q.indent(2):
1001 q.breakable()
1002 q.text("port_no = ");
1003 q.text(util.pretty_port(self.port_no))
1004 q.text(","); q.breakable()
1005 q.text("rx_packets = ");
1006 q.text("%#x" % self.rx_packets)
1007 q.text(","); q.breakable()
1008 q.text("tx_packets = ");
1009 q.text("%#x" % self.tx_packets)
1010 q.text(","); q.breakable()
1011 q.text("rx_bytes = ");
1012 q.text("%#x" % self.rx_bytes)
1013 q.text(","); q.breakable()
1014 q.text("tx_bytes = ");
1015 q.text("%#x" % self.tx_bytes)
1016 q.text(","); q.breakable()
1017 q.text("rx_dropped = ");
1018 q.text("%#x" % self.rx_dropped)
1019 q.text(","); q.breakable()
1020 q.text("tx_dropped = ");
1021 q.text("%#x" % self.tx_dropped)
1022 q.text(","); q.breakable()
1023 q.text("rx_errors = ");
1024 q.text("%#x" % self.rx_errors)
1025 q.text(","); q.breakable()
1026 q.text("tx_errors = ");
1027 q.text("%#x" % self.tx_errors)
1028 q.text(","); q.breakable()
1029 q.text("rx_frame_err = ");
1030 q.text("%#x" % self.rx_frame_err)
1031 q.text(","); q.breakable()
1032 q.text("rx_over_err = ");
1033 q.text("%#x" % self.rx_over_err)
1034 q.text(","); q.breakable()
1035 q.text("rx_crc_err = ");
1036 q.text("%#x" % self.rx_crc_err)
1037 q.text(","); q.breakable()
1038 q.text("collisions = ");
1039 q.text("%#x" % self.collisions)
1040 q.breakable()
1041 q.text('}')
1042
1043class queue_prop_experimenter(object):
1044 type = const.OFPQT_EXPERIMENTER
1045
1046 def __init__(self, experimenter=None, data=None):
1047 if experimenter != None:
1048 self.experimenter = experimenter
1049 else:
1050 self.experimenter = 0
1051 if data != None:
1052 self.data = data
1053 else:
1054 self.data = ""
1055 return
1056
1057 def pack(self):
1058 packed = []
1059 packed.append(struct.pack("!H", self.type))
1060 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
1061 packed.append('\x00' * 4)
1062 packed.append(struct.pack("!L", self.experimenter))
1063 packed.append('\x00' * 4)
1064 packed.append(self.data)
1065 length = sum([len(x) for x in packed])
1066 packed[1] = struct.pack("!H", length)
1067 return ''.join(packed)
1068
1069 @staticmethod
1070 def unpack(buf):
1071 obj = queue_prop_experimenter()
1072 if type(buf) == loxi.generic_util.OFReader:
1073 reader = buf
1074 else:
1075 reader = loxi.generic_util.OFReader(buf)
1076 _type = reader.read('!H')[0]
1077 assert(_type == const.OFPQT_EXPERIMENTER)
1078 _len = reader.read('!H')[0]
1079 reader.skip(4)
1080 obj.experimenter = reader.read('!L')[0]
1081 reader.skip(4)
1082 obj.data = str(reader.read_all())
1083 return obj
1084
1085 def __eq__(self, other):
1086 if type(self) != type(other): return False
1087 if self.experimenter != other.experimenter: return False
1088 if self.data != other.data: return False
1089 return True
1090
1091 def __ne__(self, other):
1092 return not self.__eq__(other)
1093
1094 def show(self):
1095 import loxi.pp
1096 return loxi.pp.pp(self)
1097
1098 def pretty_print(self, q):
1099 q.text("queue_prop_experimenter {")
1100 with q.group():
1101 with q.indent(2):
1102 q.breakable()
1103 q.text("experimenter = ");
1104 q.text("%#x" % self.experimenter)
1105 q.text(","); q.breakable()
1106 q.text("data = ");
1107 q.pp(self.data)
1108 q.breakable()
1109 q.text('}')
1110
1111class queue_prop_max_rate(object):
1112 type = const.OFPQT_MAX_RATE
1113
1114 def __init__(self, rate=None):
1115 if rate != None:
1116 self.rate = rate
1117 else:
1118 self.rate = 0
1119 return
1120
1121 def pack(self):
1122 packed = []
1123 packed.append(struct.pack("!H", self.type))
1124 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
1125 packed.append('\x00' * 4)
1126 packed.append(struct.pack("!H", self.rate))
1127 packed.append('\x00' * 6)
1128 length = sum([len(x) for x in packed])
1129 packed[1] = struct.pack("!H", length)
1130 return ''.join(packed)
1131
1132 @staticmethod
1133 def unpack(buf):
1134 obj = queue_prop_max_rate()
1135 if type(buf) == loxi.generic_util.OFReader:
1136 reader = buf
1137 else:
1138 reader = loxi.generic_util.OFReader(buf)
1139 _type = reader.read('!H')[0]
1140 assert(_type == const.OFPQT_MAX_RATE)
1141 _len = reader.read('!H')[0]
1142 reader.skip(4)
1143 obj.rate = reader.read('!H')[0]
1144 reader.skip(6)
1145 return obj
1146
1147 def __eq__(self, other):
1148 if type(self) != type(other): return False
1149 if self.rate != other.rate: return False
1150 return True
1151
1152 def __ne__(self, other):
1153 return not self.__eq__(other)
1154
1155 def show(self):
1156 import loxi.pp
1157 return loxi.pp.pp(self)
1158
1159 def pretty_print(self, q):
1160 q.text("queue_prop_max_rate {")
1161 with q.group():
1162 with q.indent(2):
1163 q.breakable()
1164 q.text("rate = ");
1165 q.text("%#x" % self.rate)
1166 q.breakable()
1167 q.text('}')
1168
1169class queue_prop_min_rate(object):
1170 type = const.OFPQT_MIN_RATE
1171
1172 def __init__(self, rate=None):
1173 if rate != None:
1174 self.rate = rate
1175 else:
1176 self.rate = 0
1177 return
1178
1179 def pack(self):
1180 packed = []
1181 packed.append(struct.pack("!H", self.type))
1182 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
1183 packed.append('\x00' * 4)
1184 packed.append(struct.pack("!H", self.rate))
1185 packed.append('\x00' * 6)
1186 length = sum([len(x) for x in packed])
1187 packed[1] = struct.pack("!H", length)
1188 return ''.join(packed)
1189
1190 @staticmethod
1191 def unpack(buf):
1192 obj = queue_prop_min_rate()
1193 if type(buf) == loxi.generic_util.OFReader:
1194 reader = buf
1195 else:
1196 reader = loxi.generic_util.OFReader(buf)
1197 _type = reader.read('!H')[0]
1198 assert(_type == const.OFPQT_MIN_RATE)
1199 _len = reader.read('!H')[0]
1200 reader.skip(4)
1201 obj.rate = reader.read('!H')[0]
1202 reader.skip(6)
1203 return obj
1204
1205 def __eq__(self, other):
1206 if type(self) != type(other): return False
1207 if self.rate != other.rate: return False
1208 return True
1209
1210 def __ne__(self, other):
1211 return not self.__eq__(other)
1212
1213 def show(self):
1214 import loxi.pp
1215 return loxi.pp.pp(self)
1216
1217 def pretty_print(self, q):
1218 q.text("queue_prop_min_rate {")
1219 with q.group():
1220 with q.indent(2):
1221 q.breakable()
1222 q.text("rate = ");
1223 q.text("%#x" % self.rate)
1224 q.breakable()
1225 q.text('}')
1226
1227class queue_stats_entry(object):
1228
1229 def __init__(self, port_no=None, queue_id=None, tx_bytes=None, tx_packets=None, tx_errors=None):
1230 if port_no != None:
1231 self.port_no = port_no
1232 else:
1233 self.port_no = 0
1234 if queue_id != None:
1235 self.queue_id = queue_id
1236 else:
1237 self.queue_id = 0
1238 if tx_bytes != None:
1239 self.tx_bytes = tx_bytes
1240 else:
1241 self.tx_bytes = 0
1242 if tx_packets != None:
1243 self.tx_packets = tx_packets
1244 else:
1245 self.tx_packets = 0
1246 if tx_errors != None:
1247 self.tx_errors = tx_errors
1248 else:
1249 self.tx_errors = 0
1250 return
1251
1252 def pack(self):
1253 packed = []
1254 packed.append(struct.pack("!L", self.port_no))
1255 packed.append(struct.pack("!L", self.queue_id))
1256 packed.append(struct.pack("!Q", self.tx_bytes))
1257 packed.append(struct.pack("!Q", self.tx_packets))
1258 packed.append(struct.pack("!Q", self.tx_errors))
1259 return ''.join(packed)
1260
1261 @staticmethod
1262 def unpack(buf):
1263 obj = queue_stats_entry()
1264 if type(buf) == loxi.generic_util.OFReader:
1265 reader = buf
1266 else:
1267 reader = loxi.generic_util.OFReader(buf)
1268 obj.port_no = reader.read('!L')[0]
1269 obj.queue_id = reader.read('!L')[0]
1270 obj.tx_bytes = reader.read('!Q')[0]
1271 obj.tx_packets = reader.read('!Q')[0]
1272 obj.tx_errors = reader.read('!Q')[0]
1273 return obj
1274
1275 def __eq__(self, other):
1276 if type(self) != type(other): return False
1277 if self.port_no != other.port_no: return False
1278 if self.queue_id != other.queue_id: return False
1279 if self.tx_bytes != other.tx_bytes: return False
1280 if self.tx_packets != other.tx_packets: return False
1281 if self.tx_errors != other.tx_errors: return False
1282 return True
1283
1284 def __ne__(self, other):
1285 return not self.__eq__(other)
1286
1287 def show(self):
1288 import loxi.pp
1289 return loxi.pp.pp(self)
1290
1291 def pretty_print(self, q):
1292 q.text("queue_stats_entry {")
1293 with q.group():
1294 with q.indent(2):
1295 q.breakable()
1296 q.text("port_no = ");
1297 q.text(util.pretty_port(self.port_no))
1298 q.text(","); q.breakable()
1299 q.text("queue_id = ");
1300 q.text("%#x" % self.queue_id)
1301 q.text(","); q.breakable()
1302 q.text("tx_bytes = ");
1303 q.text("%#x" % self.tx_bytes)
1304 q.text(","); q.breakable()
1305 q.text("tx_packets = ");
1306 q.text("%#x" % self.tx_packets)
1307 q.text(","); q.breakable()
1308 q.text("tx_errors = ");
1309 q.text("%#x" % self.tx_errors)
1310 q.breakable()
1311 q.text('}')
1312
1313class table_stats_entry(object):
1314
1315 def __init__(self, table_id=None, name=None, match=None, wildcards=None, write_actions=None, apply_actions=None, write_setfields=None, apply_setfields=None, metadata_match=None, metadata_write=None, instructions=None, config=None, max_entries=None, active_count=None, lookup_count=None, matched_count=None):
1316 if table_id != None:
1317 self.table_id = table_id
1318 else:
1319 self.table_id = 0
1320 if name != None:
1321 self.name = name
1322 else:
1323 self.name = ""
1324 if match != None:
1325 self.match = match
1326 else:
1327 self.match = 0
1328 if wildcards != None:
1329 self.wildcards = wildcards
1330 else:
1331 self.wildcards = 0
1332 if write_actions != None:
1333 self.write_actions = write_actions
1334 else:
1335 self.write_actions = 0
1336 if apply_actions != None:
1337 self.apply_actions = apply_actions
1338 else:
1339 self.apply_actions = 0
1340 if write_setfields != None:
1341 self.write_setfields = write_setfields
1342 else:
1343 self.write_setfields = 0
1344 if apply_setfields != None:
1345 self.apply_setfields = apply_setfields
1346 else:
1347 self.apply_setfields = 0
1348 if metadata_match != None:
1349 self.metadata_match = metadata_match
1350 else:
1351 self.metadata_match = 0
1352 if metadata_write != None:
1353 self.metadata_write = metadata_write
1354 else:
1355 self.metadata_write = 0
1356 if instructions != None:
1357 self.instructions = instructions
1358 else:
1359 self.instructions = 0
1360 if config != None:
1361 self.config = config
1362 else:
1363 self.config = 0
1364 if max_entries != None:
1365 self.max_entries = max_entries
1366 else:
1367 self.max_entries = 0
1368 if active_count != None:
1369 self.active_count = active_count
1370 else:
1371 self.active_count = 0
1372 if lookup_count != None:
1373 self.lookup_count = lookup_count
1374 else:
1375 self.lookup_count = 0
1376 if matched_count != None:
1377 self.matched_count = matched_count
1378 else:
1379 self.matched_count = 0
1380 return
1381
1382 def pack(self):
1383 packed = []
1384 packed.append(struct.pack("!B", self.table_id))
1385 packed.append('\x00' * 7)
1386 packed.append(struct.pack("!32s", self.name))
1387 packed.append(struct.pack("!Q", self.match))
1388 packed.append(struct.pack("!Q", self.wildcards))
1389 packed.append(struct.pack("!L", self.write_actions))
1390 packed.append(struct.pack("!L", self.apply_actions))
1391 packed.append(struct.pack("!Q", self.write_setfields))
1392 packed.append(struct.pack("!Q", self.apply_setfields))
1393 packed.append(struct.pack("!Q", self.metadata_match))
1394 packed.append(struct.pack("!Q", self.metadata_write))
1395 packed.append(struct.pack("!L", self.instructions))
1396 packed.append(struct.pack("!L", self.config))
1397 packed.append(struct.pack("!L", self.max_entries))
1398 packed.append(struct.pack("!L", self.active_count))
1399 packed.append(struct.pack("!Q", self.lookup_count))
1400 packed.append(struct.pack("!Q", self.matched_count))
1401 return ''.join(packed)
1402
1403 @staticmethod
1404 def unpack(buf):
1405 obj = table_stats_entry()
1406 if type(buf) == loxi.generic_util.OFReader:
1407 reader = buf
1408 else:
1409 reader = loxi.generic_util.OFReader(buf)
1410 obj.table_id = reader.read('!B')[0]
1411 reader.skip(7)
1412 obj.name = reader.read("!32s")[0].rstrip("\x00")
1413 obj.match = reader.read('!Q')[0]
1414 obj.wildcards = reader.read('!Q')[0]
1415 obj.write_actions = reader.read('!L')[0]
1416 obj.apply_actions = reader.read('!L')[0]
1417 obj.write_setfields = reader.read('!Q')[0]
1418 obj.apply_setfields = reader.read('!Q')[0]
1419 obj.metadata_match = reader.read('!Q')[0]
1420 obj.metadata_write = reader.read('!Q')[0]
1421 obj.instructions = reader.read('!L')[0]
1422 obj.config = reader.read('!L')[0]
1423 obj.max_entries = reader.read('!L')[0]
1424 obj.active_count = reader.read('!L')[0]
1425 obj.lookup_count = reader.read('!Q')[0]
1426 obj.matched_count = reader.read('!Q')[0]
1427 return obj
1428
1429 def __eq__(self, other):
1430 if type(self) != type(other): return False
1431 if self.table_id != other.table_id: return False
1432 if self.name != other.name: return False
1433 if self.match != other.match: return False
1434 if self.wildcards != other.wildcards: return False
1435 if self.write_actions != other.write_actions: return False
1436 if self.apply_actions != other.apply_actions: return False
1437 if self.write_setfields != other.write_setfields: return False
1438 if self.apply_setfields != other.apply_setfields: return False
1439 if self.metadata_match != other.metadata_match: return False
1440 if self.metadata_write != other.metadata_write: return False
1441 if self.instructions != other.instructions: return False
1442 if self.config != other.config: return False
1443 if self.max_entries != other.max_entries: return False
1444 if self.active_count != other.active_count: return False
1445 if self.lookup_count != other.lookup_count: return False
1446 if self.matched_count != other.matched_count: return False
1447 return True
1448
1449 def __ne__(self, other):
1450 return not self.__eq__(other)
1451
1452 def show(self):
1453 import loxi.pp
1454 return loxi.pp.pp(self)
1455
1456 def pretty_print(self, q):
1457 q.text("table_stats_entry {")
1458 with q.group():
1459 with q.indent(2):
1460 q.breakable()
1461 q.text("table_id = ");
1462 q.text("%#x" % self.table_id)
1463 q.text(","); q.breakable()
1464 q.text("name = ");
1465 q.pp(self.name)
1466 q.text(","); q.breakable()
1467 q.text("match = ");
1468 q.pp(self.match)
1469 q.text(","); q.breakable()
1470 q.text("wildcards = ");
1471 q.pp(self.wildcards)
1472 q.text(","); q.breakable()
1473 q.text("write_actions = ");
1474 q.text("%#x" % self.write_actions)
1475 q.text(","); q.breakable()
1476 q.text("apply_actions = ");
1477 q.text("%#x" % self.apply_actions)
1478 q.text(","); q.breakable()
1479 q.text("write_setfields = ");
1480 q.text("%#x" % self.write_setfields)
1481 q.text(","); q.breakable()
1482 q.text("apply_setfields = ");
1483 q.text("%#x" % self.apply_setfields)
1484 q.text(","); q.breakable()
1485 q.text("metadata_match = ");
1486 q.text("%#x" % self.metadata_match)
1487 q.text(","); q.breakable()
1488 q.text("metadata_write = ");
1489 q.text("%#x" % self.metadata_write)
1490 q.text(","); q.breakable()
1491 q.text("instructions = ");
1492 q.text("%#x" % self.instructions)
1493 q.text(","); q.breakable()
1494 q.text("config = ");
1495 q.text("%#x" % self.config)
1496 q.text(","); q.breakable()
1497 q.text("max_entries = ");
1498 q.text("%#x" % self.max_entries)
1499 q.text(","); q.breakable()
1500 q.text("active_count = ");
1501 q.text("%#x" % self.active_count)
1502 q.text(","); q.breakable()
1503 q.text("lookup_count = ");
1504 q.text("%#x" % self.lookup_count)
1505 q.text(","); q.breakable()
1506 q.text("matched_count = ");
1507 q.text("%#x" % self.matched_count)
1508 q.breakable()
1509 q.text('}')
1510
1511
1512match = match_v3