blob: 37da81038b90fb1fc1c900a5b5ec09285b616f74 [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.
Dan Talaycof6202252013-07-02 01:00:29 -07004# See the file LICENSE.pyloxi which should have been included in the source distribution
Rich Lane7dcdf022013-12-11 14:45:27 -08005
6# Automatically generated by LOXI from template module.py
Rich Lanec2ee4b82013-04-24 17:12:38 -07007# Do not modify
8
Rich Lanec2ee4b82013-04-24 17:12:38 -07009import struct
Rich Lane7dcdf022013-12-11 14:45:27 -080010import loxi
Rich Lanec2ee4b82013-04-24 17:12:38 -070011import const
Rich Lane7dcdf022013-12-11 14:45:27 -080012import common
13import action
14import instruction
15import oxm
Rich Lanec2ee4b82013-04-24 17:12:38 -070016import util
17import loxi.generic_util
18
Rich Lane7dcdf022013-12-11 14:45:27 -080019class bsn_interface(loxi.OFObject):
Rich Lanec2ee4b82013-04-24 17:12:38 -070020
21 def __init__(self, hw_addr=None, name=None, ipv4_addr=None, ipv4_netmask=None):
22 if hw_addr != None:
23 self.hw_addr = hw_addr
24 else:
25 self.hw_addr = [0,0,0,0,0,0]
26 if name != None:
27 self.name = name
28 else:
29 self.name = ""
30 if ipv4_addr != None:
31 self.ipv4_addr = ipv4_addr
32 else:
33 self.ipv4_addr = 0
34 if ipv4_netmask != None:
35 self.ipv4_netmask = ipv4_netmask
36 else:
37 self.ipv4_netmask = 0
38 return
39
40 def pack(self):
41 packed = []
42 packed.append(struct.pack("!6B", *self.hw_addr))
43 packed.append('\x00' * 2)
44 packed.append(struct.pack("!16s", self.name))
45 packed.append(struct.pack("!L", self.ipv4_addr))
46 packed.append(struct.pack("!L", self.ipv4_netmask))
47 return ''.join(packed)
48
49 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080050 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070051 obj = bsn_interface()
Rich Lanec2ee4b82013-04-24 17:12:38 -070052 obj.hw_addr = list(reader.read('!6B'))
53 reader.skip(2)
54 obj.name = reader.read("!16s")[0].rstrip("\x00")
Dan Talaycof6202252013-07-02 01:00:29 -070055 obj.ipv4_addr = reader.read("!L")[0]
56 obj.ipv4_netmask = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070057 return obj
58
59 def __eq__(self, other):
60 if type(self) != type(other): return False
61 if self.hw_addr != other.hw_addr: return False
62 if self.name != other.name: return False
63 if self.ipv4_addr != other.ipv4_addr: return False
64 if self.ipv4_netmask != other.ipv4_netmask: return False
65 return True
66
Rich Lanec2ee4b82013-04-24 17:12:38 -070067 def pretty_print(self, q):
68 q.text("bsn_interface {")
69 with q.group():
70 with q.indent(2):
71 q.breakable()
72 q.text("hw_addr = ");
73 q.text(util.pretty_mac(self.hw_addr))
74 q.text(","); q.breakable()
75 q.text("name = ");
76 q.pp(self.name)
77 q.text(","); q.breakable()
78 q.text("ipv4_addr = ");
79 q.text(util.pretty_ipv4(self.ipv4_addr))
80 q.text(","); q.breakable()
81 q.text("ipv4_netmask = ");
82 q.text(util.pretty_ipv4(self.ipv4_netmask))
83 q.breakable()
84 q.text('}')
85
Rich Lane7dcdf022013-12-11 14:45:27 -080086
87class bsn_vport(loxi.OFObject):
88 subtypes = {}
89
Rich Lane95f7fc92014-01-27 17:08:16 -080090
91 def __init__(self, type=None):
92 if type != None:
93 self.type = type
94 else:
95 self.type = 0
96 return
97
98 def pack(self):
99 packed = []
100 packed.append(struct.pack("!H", self.type))
101 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
102 length = sum([len(x) for x in packed])
103 packed[1] = struct.pack("!H", length)
104 return ''.join(packed)
105
Rich Lane7dcdf022013-12-11 14:45:27 -0800106 @staticmethod
107 def unpack(reader):
108 subtype, = reader.peek('!H', 0)
Rich Lane95f7fc92014-01-27 17:08:16 -0800109 subclass = bsn_vport.subtypes.get(subtype)
110 if subclass:
111 return subclass.unpack(reader)
112
113 obj = bsn_vport()
114 obj.type = reader.read("!H")[0]
115 _length = reader.read("!H")[0]
116 orig_reader = reader
117 reader = orig_reader.slice(_length - (2 + 2))
118 return obj
119
120 def __eq__(self, other):
121 if type(self) != type(other): return False
122 if self.type != other.type: return False
123 return True
124
125 def pretty_print(self, q):
126 q.text("bsn_vport {")
127 with q.group():
128 with q.indent(2):
129 q.breakable()
130 q.breakable()
131 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -0800132
133
Rich Lane93b33132014-04-21 12:20:58 -0700134class bsn_vport_l2gre(bsn_vport):
135 type = 1
136
Rich Lane5587ab12014-06-30 11:19:09 -0700137 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, if_name=None):
Rich Lane93b33132014-04-21 12:20:58 -0700138 if flags != None:
139 self.flags = flags
140 else:
141 self.flags = 0
142 if port_no != None:
143 self.port_no = port_no
144 else:
145 self.port_no = 0
Rich Lane5587ab12014-06-30 11:19:09 -0700146 if loopback_port_no != None:
147 self.loopback_port_no = loopback_port_no
148 else:
149 self.loopback_port_no = 0
Rich Lane93b33132014-04-21 12:20:58 -0700150 if local_mac != None:
151 self.local_mac = local_mac
152 else:
153 self.local_mac = [0,0,0,0,0,0]
154 if nh_mac != None:
155 self.nh_mac = nh_mac
156 else:
157 self.nh_mac = [0,0,0,0,0,0]
158 if src_ip != None:
159 self.src_ip = src_ip
160 else:
161 self.src_ip = 0
162 if dst_ip != None:
163 self.dst_ip = dst_ip
164 else:
165 self.dst_ip = 0
166 if dscp != None:
167 self.dscp = dscp
168 else:
169 self.dscp = 0
170 if ttl != None:
171 self.ttl = ttl
172 else:
173 self.ttl = 0
174 if vpn != None:
175 self.vpn = vpn
176 else:
177 self.vpn = 0
178 if if_name != None:
179 self.if_name = if_name
180 else:
181 self.if_name = ""
182 return
183
184 def pack(self):
185 packed = []
186 packed.append(struct.pack("!H", self.type))
187 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
188 packed.append(struct.pack("!L", self.flags))
189 packed.append(util.pack_port_no(self.port_no))
Rich Lane5587ab12014-06-30 11:19:09 -0700190 packed.append(util.pack_port_no(self.loopback_port_no))
Rich Lane93b33132014-04-21 12:20:58 -0700191 packed.append(struct.pack("!6B", *self.local_mac))
192 packed.append(struct.pack("!6B", *self.nh_mac))
193 packed.append(struct.pack("!L", self.src_ip))
194 packed.append(struct.pack("!L", self.dst_ip))
195 packed.append(struct.pack("!B", self.dscp))
196 packed.append(struct.pack("!B", self.ttl))
197 packed.append('\x00' * 2)
198 packed.append(struct.pack("!L", self.vpn))
199 packed.append(struct.pack("!16s", self.if_name))
200 length = sum([len(x) for x in packed])
201 packed[1] = struct.pack("!H", length)
202 return ''.join(packed)
203
204 @staticmethod
205 def unpack(reader):
206 obj = bsn_vport_l2gre()
207 _type = reader.read("!H")[0]
208 assert(_type == 1)
209 _length = reader.read("!H")[0]
210 orig_reader = reader
211 reader = orig_reader.slice(_length - (2 + 2))
212 obj.flags = reader.read("!L")[0]
213 obj.port_no = util.unpack_port_no(reader)
Rich Lane5587ab12014-06-30 11:19:09 -0700214 obj.loopback_port_no = util.unpack_port_no(reader)
Rich Lane93b33132014-04-21 12:20:58 -0700215 obj.local_mac = list(reader.read('!6B'))
216 obj.nh_mac = list(reader.read('!6B'))
217 obj.src_ip = reader.read("!L")[0]
218 obj.dst_ip = reader.read("!L")[0]
219 obj.dscp = reader.read("!B")[0]
220 obj.ttl = reader.read("!B")[0]
221 reader.skip(2)
222 obj.vpn = reader.read("!L")[0]
223 obj.if_name = reader.read("!16s")[0].rstrip("\x00")
224 return obj
225
226 def __eq__(self, other):
227 if type(self) != type(other): return False
228 if self.flags != other.flags: return False
229 if self.port_no != other.port_no: return False
Rich Lane5587ab12014-06-30 11:19:09 -0700230 if self.loopback_port_no != other.loopback_port_no: return False
Rich Lane93b33132014-04-21 12:20:58 -0700231 if self.local_mac != other.local_mac: return False
232 if self.nh_mac != other.nh_mac: return False
233 if self.src_ip != other.src_ip: return False
234 if self.dst_ip != other.dst_ip: return False
235 if self.dscp != other.dscp: return False
236 if self.ttl != other.ttl: return False
237 if self.vpn != other.vpn: return False
238 if self.if_name != other.if_name: return False
239 return True
240
241 def pretty_print(self, q):
242 q.text("bsn_vport_l2gre {")
243 with q.group():
244 with q.indent(2):
245 q.breakable()
246 q.text("flags = ");
247 q.text("%#x" % self.flags)
248 q.text(","); q.breakable()
249 q.text("port_no = ");
250 q.text(util.pretty_port(self.port_no))
251 q.text(","); q.breakable()
Rich Lane5587ab12014-06-30 11:19:09 -0700252 q.text("loopback_port_no = ");
253 q.text(util.pretty_port(self.loopback_port_no))
254 q.text(","); q.breakable()
Rich Lane93b33132014-04-21 12:20:58 -0700255 q.text("local_mac = ");
256 q.text(util.pretty_mac(self.local_mac))
257 q.text(","); q.breakable()
258 q.text("nh_mac = ");
259 q.text(util.pretty_mac(self.nh_mac))
260 q.text(","); q.breakable()
261 q.text("src_ip = ");
262 q.text(util.pretty_ipv4(self.src_ip))
263 q.text(","); q.breakable()
264 q.text("dst_ip = ");
265 q.text(util.pretty_ipv4(self.dst_ip))
266 q.text(","); q.breakable()
267 q.text("dscp = ");
268 q.text("%#x" % self.dscp)
269 q.text(","); q.breakable()
270 q.text("ttl = ");
271 q.text("%#x" % self.ttl)
272 q.text(","); q.breakable()
273 q.text("vpn = ");
274 q.text("%#x" % self.vpn)
275 q.text(","); q.breakable()
276 q.text("if_name = ");
277 q.pp(self.if_name)
278 q.breakable()
279 q.text('}')
280
281bsn_vport.subtypes[1] = bsn_vport_l2gre
282
Rich Lane7dcdf022013-12-11 14:45:27 -0800283class bsn_vport_q_in_q(bsn_vport):
Dan Talaycof6202252013-07-02 01:00:29 -0700284 type = 0
285
Kiran Poola150d8b02013-09-20 13:30:39 -0700286 def __init__(self, port_no=None, ingress_tpid=None, ingress_vlan_id=None, egress_tpid=None, egress_vlan_id=None, if_name=None):
Dan Talaycof6202252013-07-02 01:00:29 -0700287 if port_no != None:
288 self.port_no = port_no
289 else:
290 self.port_no = 0
291 if ingress_tpid != None:
292 self.ingress_tpid = ingress_tpid
293 else:
294 self.ingress_tpid = 0
295 if ingress_vlan_id != None:
296 self.ingress_vlan_id = ingress_vlan_id
297 else:
298 self.ingress_vlan_id = 0
299 if egress_tpid != None:
300 self.egress_tpid = egress_tpid
301 else:
302 self.egress_tpid = 0
303 if egress_vlan_id != None:
304 self.egress_vlan_id = egress_vlan_id
305 else:
306 self.egress_vlan_id = 0
Kiran Poola150d8b02013-09-20 13:30:39 -0700307 if if_name != None:
308 self.if_name = if_name
309 else:
310 self.if_name = ""
Dan Talaycof6202252013-07-02 01:00:29 -0700311 return
312
313 def pack(self):
314 packed = []
315 packed.append(struct.pack("!H", self.type))
Kiran Poola150d8b02013-09-20 13:30:39 -0700316 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
Dan Talaycof6202252013-07-02 01:00:29 -0700317 packed.append(struct.pack("!L", self.port_no))
318 packed.append(struct.pack("!H", self.ingress_tpid))
319 packed.append(struct.pack("!H", self.ingress_vlan_id))
320 packed.append(struct.pack("!H", self.egress_tpid))
321 packed.append(struct.pack("!H", self.egress_vlan_id))
Kiran Poola150d8b02013-09-20 13:30:39 -0700322 packed.append(struct.pack("!16s", self.if_name))
Dan Talaycof6202252013-07-02 01:00:29 -0700323 length = sum([len(x) for x in packed])
Kiran Poola150d8b02013-09-20 13:30:39 -0700324 packed[1] = struct.pack("!H", length)
Dan Talaycof6202252013-07-02 01:00:29 -0700325 return ''.join(packed)
326
327 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800328 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -0700329 obj = bsn_vport_q_in_q()
Dan Talaycof6202252013-07-02 01:00:29 -0700330 _type = reader.read("!H")[0]
331 assert(_type == 0)
332 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800333 orig_reader = reader
334 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700335 obj.port_no = reader.read("!L")[0]
336 obj.ingress_tpid = reader.read("!H")[0]
337 obj.ingress_vlan_id = reader.read("!H")[0]
338 obj.egress_tpid = reader.read("!H")[0]
339 obj.egress_vlan_id = reader.read("!H")[0]
Kiran Poola150d8b02013-09-20 13:30:39 -0700340 obj.if_name = reader.read("!16s")[0].rstrip("\x00")
Dan Talaycof6202252013-07-02 01:00:29 -0700341 return obj
342
343 def __eq__(self, other):
344 if type(self) != type(other): return False
345 if self.port_no != other.port_no: return False
346 if self.ingress_tpid != other.ingress_tpid: return False
347 if self.ingress_vlan_id != other.ingress_vlan_id: return False
348 if self.egress_tpid != other.egress_tpid: return False
349 if self.egress_vlan_id != other.egress_vlan_id: return False
Kiran Poola150d8b02013-09-20 13:30:39 -0700350 if self.if_name != other.if_name: return False
Dan Talaycof6202252013-07-02 01:00:29 -0700351 return True
352
Dan Talaycof6202252013-07-02 01:00:29 -0700353 def pretty_print(self, q):
354 q.text("bsn_vport_q_in_q {")
355 with q.group():
356 with q.indent(2):
357 q.breakable()
358 q.text("port_no = ");
359 q.text("%#x" % self.port_no)
360 q.text(","); q.breakable()
361 q.text("ingress_tpid = ");
362 q.text("%#x" % self.ingress_tpid)
363 q.text(","); q.breakable()
364 q.text("ingress_vlan_id = ");
365 q.text("%#x" % self.ingress_vlan_id)
366 q.text(","); q.breakable()
367 q.text("egress_tpid = ");
368 q.text("%#x" % self.egress_tpid)
369 q.text(","); q.breakable()
370 q.text("egress_vlan_id = ");
371 q.text("%#x" % self.egress_vlan_id)
Kiran Poola150d8b02013-09-20 13:30:39 -0700372 q.text(","); q.breakable()
373 q.text("if_name = ");
374 q.pp(self.if_name)
Dan Talaycof6202252013-07-02 01:00:29 -0700375 q.breakable()
376 q.text('}')
377
Rich Lane7dcdf022013-12-11 14:45:27 -0800378bsn_vport.subtypes[0] = bsn_vport_q_in_q
379
380class bucket(loxi.OFObject):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700381
382 def __init__(self, weight=None, watch_port=None, watch_group=None, actions=None):
383 if weight != None:
384 self.weight = weight
385 else:
386 self.weight = 0
387 if watch_port != None:
388 self.watch_port = watch_port
389 else:
390 self.watch_port = 0
391 if watch_group != None:
392 self.watch_group = watch_group
393 else:
394 self.watch_group = 0
395 if actions != None:
396 self.actions = actions
397 else:
398 self.actions = []
399 return
400
401 def pack(self):
402 packed = []
403 packed.append(struct.pack("!H", 0)) # placeholder for len at index 0
404 packed.append(struct.pack("!H", self.weight))
Dan Talaycof6202252013-07-02 01:00:29 -0700405 packed.append(util.pack_port_no(self.watch_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700406 packed.append(struct.pack("!L", self.watch_group))
407 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -0800408 packed.append(loxi.generic_util.pack_list(self.actions))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700409 length = sum([len(x) for x in packed])
410 packed[0] = struct.pack("!H", length)
411 return ''.join(packed)
412
413 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800414 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700415 obj = bucket()
Dan Talaycof6202252013-07-02 01:00:29 -0700416 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800417 orig_reader = reader
418 reader = orig_reader.slice(_len - (0 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700419 obj.weight = reader.read("!H")[0]
420 obj.watch_port = util.unpack_port_no(reader)
421 obj.watch_group = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700422 reader.skip(4)
Rich Lane7dcdf022013-12-11 14:45:27 -0800423 obj.actions = loxi.generic_util.unpack_list(reader, action.action.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -0700424 return obj
425
426 def __eq__(self, other):
427 if type(self) != type(other): return False
428 if self.weight != other.weight: return False
429 if self.watch_port != other.watch_port: return False
430 if self.watch_group != other.watch_group: return False
431 if self.actions != other.actions: return False
432 return True
433
Rich Lanec2ee4b82013-04-24 17:12:38 -0700434 def pretty_print(self, q):
435 q.text("bucket {")
436 with q.group():
437 with q.indent(2):
438 q.breakable()
439 q.text("weight = ");
440 q.text("%#x" % self.weight)
441 q.text(","); q.breakable()
442 q.text("watch_port = ");
443 q.text(util.pretty_port(self.watch_port))
444 q.text(","); q.breakable()
445 q.text("watch_group = ");
446 q.text("%#x" % self.watch_group)
447 q.text(","); q.breakable()
448 q.text("actions = ");
449 q.pp(self.actions)
450 q.breakable()
451 q.text('}')
452
Rich Lane7dcdf022013-12-11 14:45:27 -0800453
454class bucket_counter(loxi.OFObject):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700455
456 def __init__(self, packet_count=None, byte_count=None):
457 if packet_count != None:
458 self.packet_count = packet_count
459 else:
460 self.packet_count = 0
461 if byte_count != None:
462 self.byte_count = byte_count
463 else:
464 self.byte_count = 0
465 return
466
467 def pack(self):
468 packed = []
469 packed.append(struct.pack("!Q", self.packet_count))
470 packed.append(struct.pack("!Q", self.byte_count))
471 return ''.join(packed)
472
473 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800474 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700475 obj = bucket_counter()
Dan Talaycof6202252013-07-02 01:00:29 -0700476 obj.packet_count = reader.read("!Q")[0]
477 obj.byte_count = reader.read("!Q")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700478 return obj
479
480 def __eq__(self, other):
481 if type(self) != type(other): return False
482 if self.packet_count != other.packet_count: return False
483 if self.byte_count != other.byte_count: return False
484 return True
485
Rich Lanec2ee4b82013-04-24 17:12:38 -0700486 def pretty_print(self, q):
487 q.text("bucket_counter {")
488 with q.group():
489 with q.indent(2):
490 q.breakable()
491 q.text("packet_count = ");
492 q.text("%#x" % self.packet_count)
493 q.text(","); q.breakable()
494 q.text("byte_count = ");
495 q.text("%#x" % self.byte_count)
496 q.breakable()
497 q.text('}')
498
Rich Lane7dcdf022013-12-11 14:45:27 -0800499
500class flow_stats_entry(loxi.OFObject):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700501
502 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):
503 if table_id != None:
504 self.table_id = table_id
505 else:
506 self.table_id = 0
507 if duration_sec != None:
508 self.duration_sec = duration_sec
509 else:
510 self.duration_sec = 0
511 if duration_nsec != None:
512 self.duration_nsec = duration_nsec
513 else:
514 self.duration_nsec = 0
515 if priority != None:
516 self.priority = priority
517 else:
518 self.priority = 0
519 if idle_timeout != None:
520 self.idle_timeout = idle_timeout
521 else:
522 self.idle_timeout = 0
523 if hard_timeout != None:
524 self.hard_timeout = hard_timeout
525 else:
526 self.hard_timeout = 0
527 if cookie != None:
528 self.cookie = cookie
529 else:
530 self.cookie = 0
531 if packet_count != None:
532 self.packet_count = packet_count
533 else:
534 self.packet_count = 0
535 if byte_count != None:
536 self.byte_count = byte_count
537 else:
538 self.byte_count = 0
539 if match != None:
540 self.match = match
541 else:
542 self.match = common.match()
543 if instructions != None:
544 self.instructions = instructions
545 else:
546 self.instructions = []
547 return
548
549 def pack(self):
550 packed = []
551 packed.append(struct.pack("!H", 0)) # placeholder for length at index 0
552 packed.append(struct.pack("!B", self.table_id))
553 packed.append('\x00' * 1)
554 packed.append(struct.pack("!L", self.duration_sec))
555 packed.append(struct.pack("!L", self.duration_nsec))
556 packed.append(struct.pack("!H", self.priority))
557 packed.append(struct.pack("!H", self.idle_timeout))
558 packed.append(struct.pack("!H", self.hard_timeout))
559 packed.append('\x00' * 6)
560 packed.append(struct.pack("!Q", self.cookie))
561 packed.append(struct.pack("!Q", self.packet_count))
562 packed.append(struct.pack("!Q", self.byte_count))
563 packed.append(self.match.pack())
Rich Lane7dcdf022013-12-11 14:45:27 -0800564 packed.append(loxi.generic_util.pack_list(self.instructions))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700565 length = sum([len(x) for x in packed])
566 packed[0] = struct.pack("!H", length)
567 return ''.join(packed)
568
569 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800570 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700571 obj = flow_stats_entry()
Dan Talaycof6202252013-07-02 01:00:29 -0700572 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800573 orig_reader = reader
574 reader = orig_reader.slice(_length - (0 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700575 obj.table_id = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700576 reader.skip(1)
Dan Talaycof6202252013-07-02 01:00:29 -0700577 obj.duration_sec = reader.read("!L")[0]
578 obj.duration_nsec = reader.read("!L")[0]
579 obj.priority = reader.read("!H")[0]
580 obj.idle_timeout = reader.read("!H")[0]
581 obj.hard_timeout = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700582 reader.skip(6)
Dan Talaycof6202252013-07-02 01:00:29 -0700583 obj.cookie = reader.read("!Q")[0]
584 obj.packet_count = reader.read("!Q")[0]
585 obj.byte_count = reader.read("!Q")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700586 obj.match = common.match.unpack(reader)
Rich Lane7dcdf022013-12-11 14:45:27 -0800587 obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -0700588 return obj
589
590 def __eq__(self, other):
591 if type(self) != type(other): return False
592 if self.table_id != other.table_id: return False
593 if self.duration_sec != other.duration_sec: return False
594 if self.duration_nsec != other.duration_nsec: return False
595 if self.priority != other.priority: return False
596 if self.idle_timeout != other.idle_timeout: return False
597 if self.hard_timeout != other.hard_timeout: return False
598 if self.cookie != other.cookie: return False
599 if self.packet_count != other.packet_count: return False
600 if self.byte_count != other.byte_count: return False
601 if self.match != other.match: return False
602 if self.instructions != other.instructions: return False
603 return True
604
Rich Lanec2ee4b82013-04-24 17:12:38 -0700605 def pretty_print(self, q):
606 q.text("flow_stats_entry {")
607 with q.group():
608 with q.indent(2):
609 q.breakable()
610 q.text("table_id = ");
611 q.text("%#x" % self.table_id)
612 q.text(","); q.breakable()
613 q.text("duration_sec = ");
614 q.text("%#x" % self.duration_sec)
615 q.text(","); q.breakable()
616 q.text("duration_nsec = ");
617 q.text("%#x" % self.duration_nsec)
618 q.text(","); q.breakable()
619 q.text("priority = ");
620 q.text("%#x" % self.priority)
621 q.text(","); q.breakable()
622 q.text("idle_timeout = ");
623 q.text("%#x" % self.idle_timeout)
624 q.text(","); q.breakable()
625 q.text("hard_timeout = ");
626 q.text("%#x" % self.hard_timeout)
627 q.text(","); q.breakable()
628 q.text("cookie = ");
629 q.text("%#x" % self.cookie)
630 q.text(","); q.breakable()
631 q.text("packet_count = ");
632 q.text("%#x" % self.packet_count)
633 q.text(","); q.breakable()
634 q.text("byte_count = ");
635 q.text("%#x" % self.byte_count)
636 q.text(","); q.breakable()
637 q.text("match = ");
638 q.pp(self.match)
639 q.text(","); q.breakable()
640 q.text("instructions = ");
641 q.pp(self.instructions)
642 q.breakable()
643 q.text('}')
644
Rich Lane7dcdf022013-12-11 14:45:27 -0800645
646class group_desc_stats_entry(loxi.OFObject):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700647
Rich Lane6f4978c2013-10-20 21:33:52 -0700648 def __init__(self, group_type=None, group_id=None, buckets=None):
649 if group_type != None:
650 self.group_type = group_type
Rich Lanec2ee4b82013-04-24 17:12:38 -0700651 else:
Rich Lane6f4978c2013-10-20 21:33:52 -0700652 self.group_type = 0
Rich Lanec2ee4b82013-04-24 17:12:38 -0700653 if group_id != None:
654 self.group_id = group_id
655 else:
656 self.group_id = 0
657 if buckets != None:
658 self.buckets = buckets
659 else:
660 self.buckets = []
661 return
662
663 def pack(self):
664 packed = []
665 packed.append(struct.pack("!H", 0)) # placeholder for length at index 0
Rich Lane6f4978c2013-10-20 21:33:52 -0700666 packed.append(struct.pack("!B", self.group_type))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700667 packed.append('\x00' * 1)
668 packed.append(struct.pack("!L", self.group_id))
Rich Lane7dcdf022013-12-11 14:45:27 -0800669 packed.append(loxi.generic_util.pack_list(self.buckets))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700670 length = sum([len(x) for x in packed])
671 packed[0] = struct.pack("!H", length)
672 return ''.join(packed)
673
674 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800675 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700676 obj = group_desc_stats_entry()
Dan Talaycof6202252013-07-02 01:00:29 -0700677 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800678 orig_reader = reader
679 reader = orig_reader.slice(_length - (0 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -0700680 obj.group_type = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700681 reader.skip(1)
Dan Talaycof6202252013-07-02 01:00:29 -0700682 obj.group_id = reader.read("!L")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800683 obj.buckets = loxi.generic_util.unpack_list(reader, common.bucket.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -0700684 return obj
685
686 def __eq__(self, other):
687 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -0700688 if self.group_type != other.group_type: return False
Rich Lanec2ee4b82013-04-24 17:12:38 -0700689 if self.group_id != other.group_id: return False
690 if self.buckets != other.buckets: return False
691 return True
692
Rich Lanec2ee4b82013-04-24 17:12:38 -0700693 def pretty_print(self, q):
694 q.text("group_desc_stats_entry {")
695 with q.group():
696 with q.indent(2):
697 q.breakable()
Rich Lane6f4978c2013-10-20 21:33:52 -0700698 q.text("group_type = ");
699 q.text("%#x" % self.group_type)
Rich Lanec2ee4b82013-04-24 17:12:38 -0700700 q.text(","); q.breakable()
701 q.text("group_id = ");
702 q.text("%#x" % self.group_id)
703 q.text(","); q.breakable()
704 q.text("buckets = ");
705 q.pp(self.buckets)
706 q.breakable()
707 q.text('}')
708
Rich Lane7dcdf022013-12-11 14:45:27 -0800709
710class group_stats_entry(loxi.OFObject):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700711
712 def __init__(self, group_id=None, ref_count=None, packet_count=None, byte_count=None, bucket_stats=None):
713 if group_id != None:
714 self.group_id = group_id
715 else:
716 self.group_id = 0
717 if ref_count != None:
718 self.ref_count = ref_count
719 else:
720 self.ref_count = 0
721 if packet_count != None:
722 self.packet_count = packet_count
723 else:
724 self.packet_count = 0
725 if byte_count != None:
726 self.byte_count = byte_count
727 else:
728 self.byte_count = 0
729 if bucket_stats != None:
730 self.bucket_stats = bucket_stats
731 else:
732 self.bucket_stats = []
733 return
734
735 def pack(self):
736 packed = []
737 packed.append(struct.pack("!H", 0)) # placeholder for length at index 0
738 packed.append('\x00' * 2)
739 packed.append(struct.pack("!L", self.group_id))
740 packed.append(struct.pack("!L", self.ref_count))
741 packed.append('\x00' * 4)
742 packed.append(struct.pack("!Q", self.packet_count))
743 packed.append(struct.pack("!Q", self.byte_count))
Rich Lane7dcdf022013-12-11 14:45:27 -0800744 packed.append(loxi.generic_util.pack_list(self.bucket_stats))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700745 length = sum([len(x) for x in packed])
746 packed[0] = struct.pack("!H", length)
747 return ''.join(packed)
748
749 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800750 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700751 obj = group_stats_entry()
Dan Talaycof6202252013-07-02 01:00:29 -0700752 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800753 orig_reader = reader
754 reader = orig_reader.slice(_length - (0 + 2))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700755 reader.skip(2)
Dan Talaycof6202252013-07-02 01:00:29 -0700756 obj.group_id = reader.read("!L")[0]
757 obj.ref_count = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700758 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -0700759 obj.packet_count = reader.read("!Q")[0]
760 obj.byte_count = reader.read("!Q")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700761 obj.bucket_stats = loxi.generic_util.unpack_list(reader, common.bucket_counter.unpack)
762 return obj
763
764 def __eq__(self, other):
765 if type(self) != type(other): return False
766 if self.group_id != other.group_id: return False
767 if self.ref_count != other.ref_count: return False
768 if self.packet_count != other.packet_count: return False
769 if self.byte_count != other.byte_count: return False
770 if self.bucket_stats != other.bucket_stats: return False
771 return True
772
Rich Lanec2ee4b82013-04-24 17:12:38 -0700773 def pretty_print(self, q):
774 q.text("group_stats_entry {")
775 with q.group():
776 with q.indent(2):
777 q.breakable()
778 q.text("group_id = ");
779 q.text("%#x" % self.group_id)
780 q.text(","); q.breakable()
781 q.text("ref_count = ");
782 q.text("%#x" % self.ref_count)
783 q.text(","); q.breakable()
784 q.text("packet_count = ");
785 q.text("%#x" % self.packet_count)
786 q.text(","); q.breakable()
787 q.text("byte_count = ");
788 q.text("%#x" % self.byte_count)
789 q.text(","); q.breakable()
790 q.text("bucket_stats = ");
791 q.pp(self.bucket_stats)
792 q.breakable()
793 q.text('}')
794
Rich Lane7dcdf022013-12-11 14:45:27 -0800795
796class match_v3(loxi.OFObject):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700797 type = 1
798
799 def __init__(self, oxm_list=None):
800 if oxm_list != None:
801 self.oxm_list = oxm_list
802 else:
803 self.oxm_list = []
804 return
805
806 def pack(self):
807 packed = []
808 packed.append(struct.pack("!H", self.type))
809 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
Rich Lane7dcdf022013-12-11 14:45:27 -0800810 packed.append(loxi.generic_util.pack_list(self.oxm_list))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700811 length = sum([len(x) for x in packed])
812 packed[1] = struct.pack("!H", length)
Rich Laned53156a2013-08-05 17:17:33 -0700813 packed.append(loxi.generic_util.pad_to(8, length))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700814 return ''.join(packed)
815
816 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800817 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700818 obj = match_v3()
Dan Talaycof6202252013-07-02 01:00:29 -0700819 _type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700820 assert(_type == 1)
Dan Talaycof6202252013-07-02 01:00:29 -0700821 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800822 orig_reader = reader
823 reader = orig_reader.slice(_length - (2 + 2))
824 obj.oxm_list = loxi.generic_util.unpack_list(reader, oxm.oxm.unpack)
825 orig_reader.skip_align()
Rich Lanec2ee4b82013-04-24 17:12:38 -0700826 return obj
827
828 def __eq__(self, other):
829 if type(self) != type(other): return False
830 if self.oxm_list != other.oxm_list: return False
831 return True
832
Rich Lanec2ee4b82013-04-24 17:12:38 -0700833 def pretty_print(self, q):
834 q.text("match_v3 {")
835 with q.group():
836 with q.indent(2):
837 q.breakable()
838 q.text("oxm_list = ");
839 q.pp(self.oxm_list)
840 q.breakable()
841 q.text('}')
842
Rich Lane7dcdf022013-12-11 14:45:27 -0800843
844class packet_queue(loxi.OFObject):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700845
846 def __init__(self, queue_id=None, port=None, properties=None):
847 if queue_id != None:
848 self.queue_id = queue_id
849 else:
850 self.queue_id = 0
851 if port != None:
852 self.port = port
853 else:
854 self.port = 0
855 if properties != None:
856 self.properties = properties
857 else:
858 self.properties = []
859 return
860
861 def pack(self):
862 packed = []
863 packed.append(struct.pack("!L", self.queue_id))
Dan Talaycof6202252013-07-02 01:00:29 -0700864 packed.append(util.pack_port_no(self.port))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700865 packed.append(struct.pack("!H", 0)) # placeholder for len at index 2
866 packed.append('\x00' * 6)
Rich Lane7dcdf022013-12-11 14:45:27 -0800867 packed.append(loxi.generic_util.pack_list(self.properties))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700868 length = sum([len(x) for x in packed])
869 packed[2] = struct.pack("!H", length)
870 return ''.join(packed)
871
872 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800873 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700874 obj = packet_queue()
Dan Talaycof6202252013-07-02 01:00:29 -0700875 obj.queue_id = reader.read("!L")[0]
876 obj.port = util.unpack_port_no(reader)
877 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800878 orig_reader = reader
879 reader = orig_reader.slice(_len - (8 + 2))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700880 reader.skip(6)
Rich Lane7dcdf022013-12-11 14:45:27 -0800881 obj.properties = loxi.generic_util.unpack_list(reader, common.queue_prop.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -0700882 return obj
883
884 def __eq__(self, other):
885 if type(self) != type(other): return False
886 if self.queue_id != other.queue_id: return False
887 if self.port != other.port: return False
888 if self.properties != other.properties: return False
889 return True
890
Rich Lanec2ee4b82013-04-24 17:12:38 -0700891 def pretty_print(self, q):
892 q.text("packet_queue {")
893 with q.group():
894 with q.indent(2):
895 q.breakable()
896 q.text("queue_id = ");
897 q.text("%#x" % self.queue_id)
898 q.text(","); q.breakable()
899 q.text("port = ");
900 q.text(util.pretty_port(self.port))
901 q.text(","); q.breakable()
902 q.text("properties = ");
903 q.pp(self.properties)
904 q.breakable()
905 q.text('}')
906
Rich Lane7dcdf022013-12-11 14:45:27 -0800907
908class port_desc(loxi.OFObject):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700909
910 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):
911 if port_no != None:
912 self.port_no = port_no
913 else:
914 self.port_no = 0
915 if hw_addr != None:
916 self.hw_addr = hw_addr
917 else:
918 self.hw_addr = [0,0,0,0,0,0]
919 if name != None:
920 self.name = name
921 else:
922 self.name = ""
923 if config != None:
924 self.config = config
925 else:
926 self.config = 0
927 if state != None:
928 self.state = state
929 else:
930 self.state = 0
931 if curr != None:
932 self.curr = curr
933 else:
934 self.curr = 0
935 if advertised != None:
936 self.advertised = advertised
937 else:
938 self.advertised = 0
939 if supported != None:
940 self.supported = supported
941 else:
942 self.supported = 0
943 if peer != None:
944 self.peer = peer
945 else:
946 self.peer = 0
947 if curr_speed != None:
948 self.curr_speed = curr_speed
949 else:
950 self.curr_speed = 0
951 if max_speed != None:
952 self.max_speed = max_speed
953 else:
954 self.max_speed = 0
955 return
956
957 def pack(self):
958 packed = []
Dan Talaycof6202252013-07-02 01:00:29 -0700959 packed.append(util.pack_port_no(self.port_no))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700960 packed.append('\x00' * 4)
961 packed.append(struct.pack("!6B", *self.hw_addr))
962 packed.append('\x00' * 2)
963 packed.append(struct.pack("!16s", self.name))
964 packed.append(struct.pack("!L", self.config))
965 packed.append(struct.pack("!L", self.state))
966 packed.append(struct.pack("!L", self.curr))
967 packed.append(struct.pack("!L", self.advertised))
968 packed.append(struct.pack("!L", self.supported))
969 packed.append(struct.pack("!L", self.peer))
970 packed.append(struct.pack("!L", self.curr_speed))
971 packed.append(struct.pack("!L", self.max_speed))
972 return ''.join(packed)
973
974 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800975 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700976 obj = port_desc()
Dan Talaycof6202252013-07-02 01:00:29 -0700977 obj.port_no = util.unpack_port_no(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -0700978 reader.skip(4)
979 obj.hw_addr = list(reader.read('!6B'))
980 reader.skip(2)
981 obj.name = reader.read("!16s")[0].rstrip("\x00")
Dan Talaycof6202252013-07-02 01:00:29 -0700982 obj.config = reader.read("!L")[0]
983 obj.state = reader.read("!L")[0]
984 obj.curr = reader.read("!L")[0]
985 obj.advertised = reader.read("!L")[0]
986 obj.supported = reader.read("!L")[0]
987 obj.peer = reader.read("!L")[0]
988 obj.curr_speed = reader.read("!L")[0]
989 obj.max_speed = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700990 return obj
991
992 def __eq__(self, other):
993 if type(self) != type(other): return False
994 if self.port_no != other.port_no: return False
995 if self.hw_addr != other.hw_addr: return False
996 if self.name != other.name: return False
997 if self.config != other.config: return False
998 if self.state != other.state: return False
999 if self.curr != other.curr: return False
1000 if self.advertised != other.advertised: return False
1001 if self.supported != other.supported: return False
1002 if self.peer != other.peer: return False
1003 if self.curr_speed != other.curr_speed: return False
1004 if self.max_speed != other.max_speed: return False
1005 return True
1006
Rich Lanec2ee4b82013-04-24 17:12:38 -07001007 def pretty_print(self, q):
1008 q.text("port_desc {")
1009 with q.group():
1010 with q.indent(2):
1011 q.breakable()
1012 q.text("port_no = ");
1013 q.text(util.pretty_port(self.port_no))
1014 q.text(","); q.breakable()
1015 q.text("hw_addr = ");
1016 q.text(util.pretty_mac(self.hw_addr))
1017 q.text(","); q.breakable()
1018 q.text("name = ");
1019 q.pp(self.name)
1020 q.text(","); q.breakable()
1021 q.text("config = ");
1022 q.text("%#x" % self.config)
1023 q.text(","); q.breakable()
1024 q.text("state = ");
1025 q.text("%#x" % self.state)
1026 q.text(","); q.breakable()
1027 q.text("curr = ");
1028 q.text("%#x" % self.curr)
1029 q.text(","); q.breakable()
1030 q.text("advertised = ");
1031 q.text("%#x" % self.advertised)
1032 q.text(","); q.breakable()
1033 q.text("supported = ");
1034 q.text("%#x" % self.supported)
1035 q.text(","); q.breakable()
1036 q.text("peer = ");
1037 q.text("%#x" % self.peer)
1038 q.text(","); q.breakable()
1039 q.text("curr_speed = ");
1040 q.text("%#x" % self.curr_speed)
1041 q.text(","); q.breakable()
1042 q.text("max_speed = ");
1043 q.text("%#x" % self.max_speed)
1044 q.breakable()
1045 q.text('}')
1046
Rich Lane7dcdf022013-12-11 14:45:27 -08001047
1048class port_stats_entry(loxi.OFObject):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001049
1050 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):
1051 if port_no != None:
1052 self.port_no = port_no
1053 else:
1054 self.port_no = 0
1055 if rx_packets != None:
1056 self.rx_packets = rx_packets
1057 else:
1058 self.rx_packets = 0
1059 if tx_packets != None:
1060 self.tx_packets = tx_packets
1061 else:
1062 self.tx_packets = 0
1063 if rx_bytes != None:
1064 self.rx_bytes = rx_bytes
1065 else:
1066 self.rx_bytes = 0
1067 if tx_bytes != None:
1068 self.tx_bytes = tx_bytes
1069 else:
1070 self.tx_bytes = 0
1071 if rx_dropped != None:
1072 self.rx_dropped = rx_dropped
1073 else:
1074 self.rx_dropped = 0
1075 if tx_dropped != None:
1076 self.tx_dropped = tx_dropped
1077 else:
1078 self.tx_dropped = 0
1079 if rx_errors != None:
1080 self.rx_errors = rx_errors
1081 else:
1082 self.rx_errors = 0
1083 if tx_errors != None:
1084 self.tx_errors = tx_errors
1085 else:
1086 self.tx_errors = 0
1087 if rx_frame_err != None:
1088 self.rx_frame_err = rx_frame_err
1089 else:
1090 self.rx_frame_err = 0
1091 if rx_over_err != None:
1092 self.rx_over_err = rx_over_err
1093 else:
1094 self.rx_over_err = 0
1095 if rx_crc_err != None:
1096 self.rx_crc_err = rx_crc_err
1097 else:
1098 self.rx_crc_err = 0
1099 if collisions != None:
1100 self.collisions = collisions
1101 else:
1102 self.collisions = 0
1103 return
1104
1105 def pack(self):
1106 packed = []
Dan Talaycof6202252013-07-02 01:00:29 -07001107 packed.append(util.pack_port_no(self.port_no))
Rich Lanec2ee4b82013-04-24 17:12:38 -07001108 packed.append('\x00' * 4)
1109 packed.append(struct.pack("!Q", self.rx_packets))
1110 packed.append(struct.pack("!Q", self.tx_packets))
1111 packed.append(struct.pack("!Q", self.rx_bytes))
1112 packed.append(struct.pack("!Q", self.tx_bytes))
1113 packed.append(struct.pack("!Q", self.rx_dropped))
1114 packed.append(struct.pack("!Q", self.tx_dropped))
1115 packed.append(struct.pack("!Q", self.rx_errors))
1116 packed.append(struct.pack("!Q", self.tx_errors))
1117 packed.append(struct.pack("!Q", self.rx_frame_err))
1118 packed.append(struct.pack("!Q", self.rx_over_err))
1119 packed.append(struct.pack("!Q", self.rx_crc_err))
1120 packed.append(struct.pack("!Q", self.collisions))
1121 return ''.join(packed)
1122
1123 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001124 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001125 obj = port_stats_entry()
Dan Talaycof6202252013-07-02 01:00:29 -07001126 obj.port_no = util.unpack_port_no(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -07001127 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -07001128 obj.rx_packets = reader.read("!Q")[0]
1129 obj.tx_packets = reader.read("!Q")[0]
1130 obj.rx_bytes = reader.read("!Q")[0]
1131 obj.tx_bytes = reader.read("!Q")[0]
1132 obj.rx_dropped = reader.read("!Q")[0]
1133 obj.tx_dropped = reader.read("!Q")[0]
1134 obj.rx_errors = reader.read("!Q")[0]
1135 obj.tx_errors = reader.read("!Q")[0]
1136 obj.rx_frame_err = reader.read("!Q")[0]
1137 obj.rx_over_err = reader.read("!Q")[0]
1138 obj.rx_crc_err = reader.read("!Q")[0]
1139 obj.collisions = reader.read("!Q")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001140 return obj
1141
1142 def __eq__(self, other):
1143 if type(self) != type(other): return False
1144 if self.port_no != other.port_no: return False
1145 if self.rx_packets != other.rx_packets: return False
1146 if self.tx_packets != other.tx_packets: return False
1147 if self.rx_bytes != other.rx_bytes: return False
1148 if self.tx_bytes != other.tx_bytes: return False
1149 if self.rx_dropped != other.rx_dropped: return False
1150 if self.tx_dropped != other.tx_dropped: return False
1151 if self.rx_errors != other.rx_errors: return False
1152 if self.tx_errors != other.tx_errors: return False
1153 if self.rx_frame_err != other.rx_frame_err: return False
1154 if self.rx_over_err != other.rx_over_err: return False
1155 if self.rx_crc_err != other.rx_crc_err: return False
1156 if self.collisions != other.collisions: return False
1157 return True
1158
Rich Lanec2ee4b82013-04-24 17:12:38 -07001159 def pretty_print(self, q):
1160 q.text("port_stats_entry {")
1161 with q.group():
1162 with q.indent(2):
1163 q.breakable()
1164 q.text("port_no = ");
1165 q.text(util.pretty_port(self.port_no))
1166 q.text(","); q.breakable()
1167 q.text("rx_packets = ");
1168 q.text("%#x" % self.rx_packets)
1169 q.text(","); q.breakable()
1170 q.text("tx_packets = ");
1171 q.text("%#x" % self.tx_packets)
1172 q.text(","); q.breakable()
1173 q.text("rx_bytes = ");
1174 q.text("%#x" % self.rx_bytes)
1175 q.text(","); q.breakable()
1176 q.text("tx_bytes = ");
1177 q.text("%#x" % self.tx_bytes)
1178 q.text(","); q.breakable()
1179 q.text("rx_dropped = ");
1180 q.text("%#x" % self.rx_dropped)
1181 q.text(","); q.breakable()
1182 q.text("tx_dropped = ");
1183 q.text("%#x" % self.tx_dropped)
1184 q.text(","); q.breakable()
1185 q.text("rx_errors = ");
1186 q.text("%#x" % self.rx_errors)
1187 q.text(","); q.breakable()
1188 q.text("tx_errors = ");
1189 q.text("%#x" % self.tx_errors)
1190 q.text(","); q.breakable()
1191 q.text("rx_frame_err = ");
1192 q.text("%#x" % self.rx_frame_err)
1193 q.text(","); q.breakable()
1194 q.text("rx_over_err = ");
1195 q.text("%#x" % self.rx_over_err)
1196 q.text(","); q.breakable()
1197 q.text("rx_crc_err = ");
1198 q.text("%#x" % self.rx_crc_err)
1199 q.text(","); q.breakable()
1200 q.text("collisions = ");
1201 q.text("%#x" % self.collisions)
1202 q.breakable()
1203 q.text('}')
1204
Rich Lane7dcdf022013-12-11 14:45:27 -08001205
1206class queue_prop(loxi.OFObject):
1207 subtypes = {}
1208
Rich Lane95f7fc92014-01-27 17:08:16 -08001209
1210 def __init__(self, type=None):
1211 if type != None:
1212 self.type = type
1213 else:
1214 self.type = 0
1215 return
1216
1217 def pack(self):
1218 packed = []
1219 packed.append(struct.pack("!H", self.type))
1220 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
1221 packed.append('\x00' * 4)
1222 length = sum([len(x) for x in packed])
1223 packed[1] = struct.pack("!H", length)
1224 return ''.join(packed)
1225
Rich Lane7dcdf022013-12-11 14:45:27 -08001226 @staticmethod
1227 def unpack(reader):
1228 subtype, = reader.peek('!H', 0)
Rich Lane95f7fc92014-01-27 17:08:16 -08001229 subclass = queue_prop.subtypes.get(subtype)
1230 if subclass:
1231 return subclass.unpack(reader)
1232
1233 obj = queue_prop()
1234 obj.type = reader.read("!H")[0]
1235 _len = reader.read("!H")[0]
1236 orig_reader = reader
1237 reader = orig_reader.slice(_len - (2 + 2))
1238 reader.skip(4)
1239 return obj
1240
1241 def __eq__(self, other):
1242 if type(self) != type(other): return False
1243 if self.type != other.type: return False
1244 return True
1245
1246 def pretty_print(self, q):
1247 q.text("queue_prop {")
1248 with q.group():
1249 with q.indent(2):
1250 q.breakable()
1251 q.breakable()
1252 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -08001253
1254
1255class queue_prop_experimenter(queue_prop):
1256 subtypes = {}
1257
Rich Lane95f7fc92014-01-27 17:08:16 -08001258 type = 65535
1259
1260 def __init__(self, experimenter=None, data=None):
1261 if experimenter != None:
1262 self.experimenter = experimenter
1263 else:
1264 self.experimenter = 0
1265 if data != None:
1266 self.data = data
1267 else:
1268 self.data = ''
1269 return
1270
1271 def pack(self):
1272 packed = []
1273 packed.append(struct.pack("!H", self.type))
1274 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
1275 packed.append('\x00' * 4)
1276 packed.append(struct.pack("!L", self.experimenter))
1277 packed.append('\x00' * 4)
1278 packed.append(self.data)
1279 length = sum([len(x) for x in packed])
1280 packed[1] = struct.pack("!H", length)
1281 return ''.join(packed)
1282
Rich Lane7dcdf022013-12-11 14:45:27 -08001283 @staticmethod
1284 def unpack(reader):
1285 subtype, = reader.peek('!L', 8)
Rich Lane95f7fc92014-01-27 17:08:16 -08001286 subclass = queue_prop_experimenter.subtypes.get(subtype)
1287 if subclass:
1288 return subclass.unpack(reader)
1289
1290 obj = queue_prop_experimenter()
1291 _type = reader.read("!H")[0]
1292 assert(_type == 65535)
1293 _len = reader.read("!H")[0]
1294 orig_reader = reader
1295 reader = orig_reader.slice(_len - (2 + 2))
1296 reader.skip(4)
1297 obj.experimenter = reader.read("!L")[0]
1298 reader.skip(4)
1299 obj.data = str(reader.read_all())
1300 return obj
1301
1302 def __eq__(self, other):
1303 if type(self) != type(other): return False
1304 if self.experimenter != other.experimenter: return False
1305 if self.data != other.data: return False
1306 return True
1307
1308 def pretty_print(self, q):
1309 q.text("queue_prop_experimenter {")
1310 with q.group():
1311 with q.indent(2):
1312 q.breakable()
1313 q.text("data = ");
1314 q.pp(self.data)
1315 q.breakable()
1316 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -08001317
1318queue_prop.subtypes[65535] = queue_prop_experimenter
1319
1320class queue_prop_max_rate(queue_prop):
Dan Talaycof6202252013-07-02 01:00:29 -07001321 type = 2
Rich Lanec2ee4b82013-04-24 17:12:38 -07001322
1323 def __init__(self, rate=None):
1324 if rate != None:
1325 self.rate = rate
1326 else:
1327 self.rate = 0
1328 return
1329
1330 def pack(self):
1331 packed = []
1332 packed.append(struct.pack("!H", self.type))
1333 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
1334 packed.append('\x00' * 4)
1335 packed.append(struct.pack("!H", self.rate))
1336 packed.append('\x00' * 6)
1337 length = sum([len(x) for x in packed])
1338 packed[1] = struct.pack("!H", length)
1339 return ''.join(packed)
1340
1341 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001342 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001343 obj = queue_prop_max_rate()
Dan Talaycof6202252013-07-02 01:00:29 -07001344 _type = reader.read("!H")[0]
1345 assert(_type == 2)
1346 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001347 orig_reader = reader
1348 reader = orig_reader.slice(_len - (2 + 2))
Rich Lanec2ee4b82013-04-24 17:12:38 -07001349 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -07001350 obj.rate = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001351 reader.skip(6)
1352 return obj
1353
1354 def __eq__(self, other):
1355 if type(self) != type(other): return False
1356 if self.rate != other.rate: return False
1357 return True
1358
Rich Lanec2ee4b82013-04-24 17:12:38 -07001359 def pretty_print(self, q):
1360 q.text("queue_prop_max_rate {")
1361 with q.group():
1362 with q.indent(2):
1363 q.breakable()
1364 q.text("rate = ");
1365 q.text("%#x" % self.rate)
1366 q.breakable()
1367 q.text('}')
1368
Rich Lane7dcdf022013-12-11 14:45:27 -08001369queue_prop.subtypes[2] = queue_prop_max_rate
1370
1371class queue_prop_min_rate(queue_prop):
Dan Talaycof6202252013-07-02 01:00:29 -07001372 type = 1
Rich Lanec2ee4b82013-04-24 17:12:38 -07001373
1374 def __init__(self, rate=None):
1375 if rate != None:
1376 self.rate = rate
1377 else:
1378 self.rate = 0
1379 return
1380
1381 def pack(self):
1382 packed = []
1383 packed.append(struct.pack("!H", self.type))
1384 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
1385 packed.append('\x00' * 4)
1386 packed.append(struct.pack("!H", self.rate))
1387 packed.append('\x00' * 6)
1388 length = sum([len(x) for x in packed])
1389 packed[1] = struct.pack("!H", length)
1390 return ''.join(packed)
1391
1392 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001393 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001394 obj = queue_prop_min_rate()
Dan Talaycof6202252013-07-02 01:00:29 -07001395 _type = reader.read("!H")[0]
1396 assert(_type == 1)
1397 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001398 orig_reader = reader
1399 reader = orig_reader.slice(_len - (2 + 2))
Rich Lanec2ee4b82013-04-24 17:12:38 -07001400 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -07001401 obj.rate = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001402 reader.skip(6)
1403 return obj
1404
1405 def __eq__(self, other):
1406 if type(self) != type(other): return False
1407 if self.rate != other.rate: return False
1408 return True
1409
Rich Lanec2ee4b82013-04-24 17:12:38 -07001410 def pretty_print(self, q):
1411 q.text("queue_prop_min_rate {")
1412 with q.group():
1413 with q.indent(2):
1414 q.breakable()
1415 q.text("rate = ");
1416 q.text("%#x" % self.rate)
1417 q.breakable()
1418 q.text('}')
1419
Rich Lane7dcdf022013-12-11 14:45:27 -08001420queue_prop.subtypes[1] = queue_prop_min_rate
1421
1422class queue_stats_entry(loxi.OFObject):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001423
1424 def __init__(self, port_no=None, queue_id=None, tx_bytes=None, tx_packets=None, tx_errors=None):
1425 if port_no != None:
1426 self.port_no = port_no
1427 else:
1428 self.port_no = 0
1429 if queue_id != None:
1430 self.queue_id = queue_id
1431 else:
1432 self.queue_id = 0
1433 if tx_bytes != None:
1434 self.tx_bytes = tx_bytes
1435 else:
1436 self.tx_bytes = 0
1437 if tx_packets != None:
1438 self.tx_packets = tx_packets
1439 else:
1440 self.tx_packets = 0
1441 if tx_errors != None:
1442 self.tx_errors = tx_errors
1443 else:
1444 self.tx_errors = 0
1445 return
1446
1447 def pack(self):
1448 packed = []
Dan Talaycof6202252013-07-02 01:00:29 -07001449 packed.append(util.pack_port_no(self.port_no))
Rich Lanec2ee4b82013-04-24 17:12:38 -07001450 packed.append(struct.pack("!L", self.queue_id))
1451 packed.append(struct.pack("!Q", self.tx_bytes))
1452 packed.append(struct.pack("!Q", self.tx_packets))
1453 packed.append(struct.pack("!Q", self.tx_errors))
1454 return ''.join(packed)
1455
1456 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001457 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001458 obj = queue_stats_entry()
Dan Talaycof6202252013-07-02 01:00:29 -07001459 obj.port_no = util.unpack_port_no(reader)
1460 obj.queue_id = reader.read("!L")[0]
1461 obj.tx_bytes = reader.read("!Q")[0]
1462 obj.tx_packets = reader.read("!Q")[0]
1463 obj.tx_errors = reader.read("!Q")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001464 return obj
1465
1466 def __eq__(self, other):
1467 if type(self) != type(other): return False
1468 if self.port_no != other.port_no: return False
1469 if self.queue_id != other.queue_id: return False
1470 if self.tx_bytes != other.tx_bytes: return False
1471 if self.tx_packets != other.tx_packets: return False
1472 if self.tx_errors != other.tx_errors: return False
1473 return True
1474
Rich Lanec2ee4b82013-04-24 17:12:38 -07001475 def pretty_print(self, q):
1476 q.text("queue_stats_entry {")
1477 with q.group():
1478 with q.indent(2):
1479 q.breakable()
1480 q.text("port_no = ");
1481 q.text(util.pretty_port(self.port_no))
1482 q.text(","); q.breakable()
1483 q.text("queue_id = ");
1484 q.text("%#x" % self.queue_id)
1485 q.text(","); q.breakable()
1486 q.text("tx_bytes = ");
1487 q.text("%#x" % self.tx_bytes)
1488 q.text(","); q.breakable()
1489 q.text("tx_packets = ");
1490 q.text("%#x" % self.tx_packets)
1491 q.text(","); q.breakable()
1492 q.text("tx_errors = ");
1493 q.text("%#x" % self.tx_errors)
1494 q.breakable()
1495 q.text('}')
1496
Rich Lane7dcdf022013-12-11 14:45:27 -08001497
1498class table_stats_entry(loxi.OFObject):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001499
1500 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):
1501 if table_id != None:
1502 self.table_id = table_id
1503 else:
1504 self.table_id = 0
1505 if name != None:
1506 self.name = name
1507 else:
1508 self.name = ""
1509 if match != None:
1510 self.match = match
1511 else:
Dan Talaycof6202252013-07-02 01:00:29 -07001512 self.match = util.init_match_bmap()
Rich Lanec2ee4b82013-04-24 17:12:38 -07001513 if wildcards != None:
1514 self.wildcards = wildcards
1515 else:
Dan Talaycof6202252013-07-02 01:00:29 -07001516 self.wildcards = util.init_wc_bmap()
Rich Lanec2ee4b82013-04-24 17:12:38 -07001517 if write_actions != None:
1518 self.write_actions = write_actions
1519 else:
1520 self.write_actions = 0
1521 if apply_actions != None:
1522 self.apply_actions = apply_actions
1523 else:
1524 self.apply_actions = 0
1525 if write_setfields != None:
1526 self.write_setfields = write_setfields
1527 else:
1528 self.write_setfields = 0
1529 if apply_setfields != None:
1530 self.apply_setfields = apply_setfields
1531 else:
1532 self.apply_setfields = 0
1533 if metadata_match != None:
1534 self.metadata_match = metadata_match
1535 else:
1536 self.metadata_match = 0
1537 if metadata_write != None:
1538 self.metadata_write = metadata_write
1539 else:
1540 self.metadata_write = 0
1541 if instructions != None:
1542 self.instructions = instructions
1543 else:
1544 self.instructions = 0
1545 if config != None:
1546 self.config = config
1547 else:
1548 self.config = 0
1549 if max_entries != None:
1550 self.max_entries = max_entries
1551 else:
1552 self.max_entries = 0
1553 if active_count != None:
1554 self.active_count = active_count
1555 else:
1556 self.active_count = 0
1557 if lookup_count != None:
1558 self.lookup_count = lookup_count
1559 else:
1560 self.lookup_count = 0
1561 if matched_count != None:
1562 self.matched_count = matched_count
1563 else:
1564 self.matched_count = 0
1565 return
1566
1567 def pack(self):
1568 packed = []
1569 packed.append(struct.pack("!B", self.table_id))
1570 packed.append('\x00' * 7)
1571 packed.append(struct.pack("!32s", self.name))
Dan Talaycof6202252013-07-02 01:00:29 -07001572 packed.append(util.pack_match_bmap(self.match))
1573 packed.append(util.pack_wc_bmap(self.wildcards))
Rich Lanec2ee4b82013-04-24 17:12:38 -07001574 packed.append(struct.pack("!L", self.write_actions))
1575 packed.append(struct.pack("!L", self.apply_actions))
1576 packed.append(struct.pack("!Q", self.write_setfields))
1577 packed.append(struct.pack("!Q", self.apply_setfields))
1578 packed.append(struct.pack("!Q", self.metadata_match))
1579 packed.append(struct.pack("!Q", self.metadata_write))
1580 packed.append(struct.pack("!L", self.instructions))
1581 packed.append(struct.pack("!L", self.config))
1582 packed.append(struct.pack("!L", self.max_entries))
1583 packed.append(struct.pack("!L", self.active_count))
1584 packed.append(struct.pack("!Q", self.lookup_count))
1585 packed.append(struct.pack("!Q", self.matched_count))
1586 return ''.join(packed)
1587
1588 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001589 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001590 obj = table_stats_entry()
Dan Talaycof6202252013-07-02 01:00:29 -07001591 obj.table_id = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001592 reader.skip(7)
1593 obj.name = reader.read("!32s")[0].rstrip("\x00")
Dan Talaycof6202252013-07-02 01:00:29 -07001594 obj.match = util.unpack_match_bmap(reader)
1595 obj.wildcards = util.unpack_wc_bmap(reader)
1596 obj.write_actions = reader.read("!L")[0]
1597 obj.apply_actions = reader.read("!L")[0]
1598 obj.write_setfields = reader.read("!Q")[0]
1599 obj.apply_setfields = reader.read("!Q")[0]
1600 obj.metadata_match = reader.read("!Q")[0]
1601 obj.metadata_write = reader.read("!Q")[0]
1602 obj.instructions = reader.read("!L")[0]
1603 obj.config = reader.read("!L")[0]
1604 obj.max_entries = reader.read("!L")[0]
1605 obj.active_count = reader.read("!L")[0]
1606 obj.lookup_count = reader.read("!Q")[0]
1607 obj.matched_count = reader.read("!Q")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001608 return obj
1609
1610 def __eq__(self, other):
1611 if type(self) != type(other): return False
1612 if self.table_id != other.table_id: return False
1613 if self.name != other.name: return False
1614 if self.match != other.match: return False
1615 if self.wildcards != other.wildcards: return False
1616 if self.write_actions != other.write_actions: return False
1617 if self.apply_actions != other.apply_actions: return False
1618 if self.write_setfields != other.write_setfields: return False
1619 if self.apply_setfields != other.apply_setfields: return False
1620 if self.metadata_match != other.metadata_match: return False
1621 if self.metadata_write != other.metadata_write: return False
1622 if self.instructions != other.instructions: return False
1623 if self.config != other.config: return False
1624 if self.max_entries != other.max_entries: return False
1625 if self.active_count != other.active_count: return False
1626 if self.lookup_count != other.lookup_count: return False
1627 if self.matched_count != other.matched_count: return False
1628 return True
1629
Rich Lanec2ee4b82013-04-24 17:12:38 -07001630 def pretty_print(self, q):
1631 q.text("table_stats_entry {")
1632 with q.group():
1633 with q.indent(2):
1634 q.breakable()
1635 q.text("table_id = ");
1636 q.text("%#x" % self.table_id)
1637 q.text(","); q.breakable()
1638 q.text("name = ");
1639 q.pp(self.name)
1640 q.text(","); q.breakable()
1641 q.text("match = ");
1642 q.pp(self.match)
1643 q.text(","); q.breakable()
1644 q.text("wildcards = ");
1645 q.pp(self.wildcards)
1646 q.text(","); q.breakable()
1647 q.text("write_actions = ");
1648 q.text("%#x" % self.write_actions)
1649 q.text(","); q.breakable()
1650 q.text("apply_actions = ");
1651 q.text("%#x" % self.apply_actions)
1652 q.text(","); q.breakable()
1653 q.text("write_setfields = ");
1654 q.text("%#x" % self.write_setfields)
1655 q.text(","); q.breakable()
1656 q.text("apply_setfields = ");
1657 q.text("%#x" % self.apply_setfields)
1658 q.text(","); q.breakable()
1659 q.text("metadata_match = ");
1660 q.text("%#x" % self.metadata_match)
1661 q.text(","); q.breakable()
1662 q.text("metadata_write = ");
1663 q.text("%#x" % self.metadata_write)
1664 q.text(","); q.breakable()
1665 q.text("instructions = ");
1666 q.text("%#x" % self.instructions)
1667 q.text(","); q.breakable()
1668 q.text("config = ");
1669 q.text("%#x" % self.config)
1670 q.text(","); q.breakable()
1671 q.text("max_entries = ");
1672 q.text("%#x" % self.max_entries)
1673 q.text(","); q.breakable()
1674 q.text("active_count = ");
1675 q.text("%#x" % self.active_count)
1676 q.text(","); q.breakable()
1677 q.text("lookup_count = ");
1678 q.text("%#x" % self.lookup_count)
1679 q.text(","); q.breakable()
1680 q.text("matched_count = ");
1681 q.text("%#x" % self.matched_count)
1682 q.breakable()
1683 q.text('}')
1684
1685
Rich Lane7dcdf022013-12-11 14:45:27 -08001686
Rich Lanec2ee4b82013-04-24 17:12:38 -07001687match = match_v3