blob: 4bb1449b718f997f0d5b887f19371c92df9e1cd0 [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 action
Rich Lane7dcdf022013-12-11 14:45:27 -080013import oxm
Harshmeet Singh1db46332014-10-14 16:29:13 -070014import message
15import instruction
16import common
Rich Lanec2ee4b82013-04-24 17:12:38 -070017import util
18import loxi.generic_util
19
Rich Lane7dcdf022013-12-11 14:45:27 -080020class bsn_interface(loxi.OFObject):
Rich Lanec2ee4b82013-04-24 17:12:38 -070021
22 def __init__(self, hw_addr=None, name=None, ipv4_addr=None, ipv4_netmask=None):
23 if hw_addr != None:
24 self.hw_addr = hw_addr
25 else:
26 self.hw_addr = [0,0,0,0,0,0]
27 if name != None:
28 self.name = name
29 else:
30 self.name = ""
31 if ipv4_addr != None:
32 self.ipv4_addr = ipv4_addr
33 else:
34 self.ipv4_addr = 0
35 if ipv4_netmask != None:
36 self.ipv4_netmask = ipv4_netmask
37 else:
38 self.ipv4_netmask = 0
39 return
40
41 def pack(self):
42 packed = []
43 packed.append(struct.pack("!6B", *self.hw_addr))
44 packed.append('\x00' * 2)
45 packed.append(struct.pack("!16s", self.name))
46 packed.append(struct.pack("!L", self.ipv4_addr))
47 packed.append(struct.pack("!L", self.ipv4_netmask))
48 return ''.join(packed)
49
50 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -080051 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -070052 obj = bsn_interface()
Rich Lanec2ee4b82013-04-24 17:12:38 -070053 obj.hw_addr = list(reader.read('!6B'))
54 reader.skip(2)
55 obj.name = reader.read("!16s")[0].rstrip("\x00")
Dan Talaycof6202252013-07-02 01:00:29 -070056 obj.ipv4_addr = reader.read("!L")[0]
57 obj.ipv4_netmask = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -070058 return obj
59
60 def __eq__(self, other):
61 if type(self) != type(other): return False
62 if self.hw_addr != other.hw_addr: return False
63 if self.name != other.name: return False
64 if self.ipv4_addr != other.ipv4_addr: return False
65 if self.ipv4_netmask != other.ipv4_netmask: return False
66 return True
67
Rich Lanec2ee4b82013-04-24 17:12:38 -070068 def pretty_print(self, q):
69 q.text("bsn_interface {")
70 with q.group():
71 with q.indent(2):
72 q.breakable()
73 q.text("hw_addr = ");
74 q.text(util.pretty_mac(self.hw_addr))
75 q.text(","); q.breakable()
76 q.text("name = ");
77 q.pp(self.name)
78 q.text(","); q.breakable()
79 q.text("ipv4_addr = ");
80 q.text(util.pretty_ipv4(self.ipv4_addr))
81 q.text(","); q.breakable()
82 q.text("ipv4_netmask = ");
83 q.text(util.pretty_ipv4(self.ipv4_netmask))
84 q.breakable()
85 q.text('}')
86
Rich Lane7dcdf022013-12-11 14:45:27 -080087
88class bsn_vport(loxi.OFObject):
89 subtypes = {}
90
Rich Lane95f7fc92014-01-27 17:08:16 -080091
92 def __init__(self, type=None):
93 if type != None:
94 self.type = type
95 else:
96 self.type = 0
97 return
98
99 def pack(self):
100 packed = []
101 packed.append(struct.pack("!H", self.type))
102 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
103 length = sum([len(x) for x in packed])
104 packed[1] = struct.pack("!H", length)
105 return ''.join(packed)
106
Rich Lane7dcdf022013-12-11 14:45:27 -0800107 @staticmethod
108 def unpack(reader):
109 subtype, = reader.peek('!H', 0)
Rich Lane95f7fc92014-01-27 17:08:16 -0800110 subclass = bsn_vport.subtypes.get(subtype)
111 if subclass:
112 return subclass.unpack(reader)
113
114 obj = bsn_vport()
115 obj.type = reader.read("!H")[0]
116 _length = reader.read("!H")[0]
117 orig_reader = reader
118 reader = orig_reader.slice(_length - (2 + 2))
119 return obj
120
121 def __eq__(self, other):
122 if type(self) != type(other): return False
123 if self.type != other.type: return False
124 return True
125
126 def pretty_print(self, q):
127 q.text("bsn_vport {")
128 with q.group():
129 with q.indent(2):
130 q.breakable()
131 q.breakable()
132 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -0800133
134
Rich Lane93b33132014-04-21 12:20:58 -0700135class bsn_vport_l2gre(bsn_vport):
136 type = 1
137
Rich Lanef9530c42014-09-15 09:59:43 -0700138 def __init__(self, flags=None, port_no=None, loopback_port_no=None, local_mac=None, nh_mac=None, src_ip=None, dst_ip=None, dscp=None, ttl=None, vpn=None, rate_limit=None, if_name=None):
Rich Lane93b33132014-04-21 12:20:58 -0700139 if flags != None:
140 self.flags = flags
141 else:
142 self.flags = 0
143 if port_no != None:
144 self.port_no = port_no
145 else:
146 self.port_no = 0
Rich Lane5587ab12014-06-30 11:19:09 -0700147 if loopback_port_no != None:
148 self.loopback_port_no = loopback_port_no
149 else:
150 self.loopback_port_no = 0
Rich Lane93b33132014-04-21 12:20:58 -0700151 if local_mac != None:
152 self.local_mac = local_mac
153 else:
154 self.local_mac = [0,0,0,0,0,0]
155 if nh_mac != None:
156 self.nh_mac = nh_mac
157 else:
158 self.nh_mac = [0,0,0,0,0,0]
159 if src_ip != None:
160 self.src_ip = src_ip
161 else:
162 self.src_ip = 0
163 if dst_ip != None:
164 self.dst_ip = dst_ip
165 else:
166 self.dst_ip = 0
167 if dscp != None:
168 self.dscp = dscp
169 else:
170 self.dscp = 0
171 if ttl != None:
172 self.ttl = ttl
173 else:
174 self.ttl = 0
175 if vpn != None:
176 self.vpn = vpn
177 else:
178 self.vpn = 0
Rich Lanef9530c42014-09-15 09:59:43 -0700179 if rate_limit != None:
180 self.rate_limit = rate_limit
181 else:
182 self.rate_limit = 0
Rich Lane93b33132014-04-21 12:20:58 -0700183 if if_name != None:
184 self.if_name = if_name
185 else:
186 self.if_name = ""
187 return
188
189 def pack(self):
190 packed = []
191 packed.append(struct.pack("!H", self.type))
192 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
193 packed.append(struct.pack("!L", self.flags))
194 packed.append(util.pack_port_no(self.port_no))
Rich Lane5587ab12014-06-30 11:19:09 -0700195 packed.append(util.pack_port_no(self.loopback_port_no))
Rich Lane93b33132014-04-21 12:20:58 -0700196 packed.append(struct.pack("!6B", *self.local_mac))
197 packed.append(struct.pack("!6B", *self.nh_mac))
198 packed.append(struct.pack("!L", self.src_ip))
199 packed.append(struct.pack("!L", self.dst_ip))
200 packed.append(struct.pack("!B", self.dscp))
201 packed.append(struct.pack("!B", self.ttl))
202 packed.append('\x00' * 2)
203 packed.append(struct.pack("!L", self.vpn))
Rich Lanef9530c42014-09-15 09:59:43 -0700204 packed.append(struct.pack("!L", self.rate_limit))
Rich Lane93b33132014-04-21 12:20:58 -0700205 packed.append(struct.pack("!16s", self.if_name))
206 length = sum([len(x) for x in packed])
207 packed[1] = struct.pack("!H", length)
208 return ''.join(packed)
209
210 @staticmethod
211 def unpack(reader):
212 obj = bsn_vport_l2gre()
213 _type = reader.read("!H")[0]
214 assert(_type == 1)
215 _length = reader.read("!H")[0]
216 orig_reader = reader
217 reader = orig_reader.slice(_length - (2 + 2))
218 obj.flags = reader.read("!L")[0]
219 obj.port_no = util.unpack_port_no(reader)
Rich Lane5587ab12014-06-30 11:19:09 -0700220 obj.loopback_port_no = util.unpack_port_no(reader)
Rich Lane93b33132014-04-21 12:20:58 -0700221 obj.local_mac = list(reader.read('!6B'))
222 obj.nh_mac = list(reader.read('!6B'))
223 obj.src_ip = reader.read("!L")[0]
224 obj.dst_ip = reader.read("!L")[0]
225 obj.dscp = reader.read("!B")[0]
226 obj.ttl = reader.read("!B")[0]
227 reader.skip(2)
228 obj.vpn = reader.read("!L")[0]
Rich Lanef9530c42014-09-15 09:59:43 -0700229 obj.rate_limit = reader.read("!L")[0]
Rich Lane93b33132014-04-21 12:20:58 -0700230 obj.if_name = reader.read("!16s")[0].rstrip("\x00")
231 return obj
232
233 def __eq__(self, other):
234 if type(self) != type(other): return False
235 if self.flags != other.flags: return False
236 if self.port_no != other.port_no: return False
Rich Lane5587ab12014-06-30 11:19:09 -0700237 if self.loopback_port_no != other.loopback_port_no: return False
Rich Lane93b33132014-04-21 12:20:58 -0700238 if self.local_mac != other.local_mac: return False
239 if self.nh_mac != other.nh_mac: return False
240 if self.src_ip != other.src_ip: return False
241 if self.dst_ip != other.dst_ip: return False
242 if self.dscp != other.dscp: return False
243 if self.ttl != other.ttl: return False
244 if self.vpn != other.vpn: return False
Rich Lanef9530c42014-09-15 09:59:43 -0700245 if self.rate_limit != other.rate_limit: return False
Rich Lane93b33132014-04-21 12:20:58 -0700246 if self.if_name != other.if_name: return False
247 return True
248
249 def pretty_print(self, q):
250 q.text("bsn_vport_l2gre {")
251 with q.group():
252 with q.indent(2):
253 q.breakable()
254 q.text("flags = ");
255 q.text("%#x" % self.flags)
256 q.text(","); q.breakable()
257 q.text("port_no = ");
258 q.text(util.pretty_port(self.port_no))
259 q.text(","); q.breakable()
Rich Lane5587ab12014-06-30 11:19:09 -0700260 q.text("loopback_port_no = ");
261 q.text(util.pretty_port(self.loopback_port_no))
262 q.text(","); q.breakable()
Rich Lane93b33132014-04-21 12:20:58 -0700263 q.text("local_mac = ");
264 q.text(util.pretty_mac(self.local_mac))
265 q.text(","); q.breakable()
266 q.text("nh_mac = ");
267 q.text(util.pretty_mac(self.nh_mac))
268 q.text(","); q.breakable()
269 q.text("src_ip = ");
270 q.text(util.pretty_ipv4(self.src_ip))
271 q.text(","); q.breakable()
272 q.text("dst_ip = ");
273 q.text(util.pretty_ipv4(self.dst_ip))
274 q.text(","); q.breakable()
275 q.text("dscp = ");
276 q.text("%#x" % self.dscp)
277 q.text(","); q.breakable()
278 q.text("ttl = ");
279 q.text("%#x" % self.ttl)
280 q.text(","); q.breakable()
281 q.text("vpn = ");
282 q.text("%#x" % self.vpn)
283 q.text(","); q.breakable()
Rich Lanef9530c42014-09-15 09:59:43 -0700284 q.text("rate_limit = ");
285 q.text("%#x" % self.rate_limit)
286 q.text(","); q.breakable()
Rich Lane93b33132014-04-21 12:20:58 -0700287 q.text("if_name = ");
288 q.pp(self.if_name)
289 q.breakable()
290 q.text('}')
291
292bsn_vport.subtypes[1] = bsn_vport_l2gre
293
Rich Lane7dcdf022013-12-11 14:45:27 -0800294class bsn_vport_q_in_q(bsn_vport):
Dan Talaycof6202252013-07-02 01:00:29 -0700295 type = 0
296
Kiran Poola150d8b02013-09-20 13:30:39 -0700297 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 -0700298 if port_no != None:
299 self.port_no = port_no
300 else:
301 self.port_no = 0
302 if ingress_tpid != None:
303 self.ingress_tpid = ingress_tpid
304 else:
305 self.ingress_tpid = 0
306 if ingress_vlan_id != None:
307 self.ingress_vlan_id = ingress_vlan_id
308 else:
309 self.ingress_vlan_id = 0
310 if egress_tpid != None:
311 self.egress_tpid = egress_tpid
312 else:
313 self.egress_tpid = 0
314 if egress_vlan_id != None:
315 self.egress_vlan_id = egress_vlan_id
316 else:
317 self.egress_vlan_id = 0
Kiran Poola150d8b02013-09-20 13:30:39 -0700318 if if_name != None:
319 self.if_name = if_name
320 else:
321 self.if_name = ""
Dan Talaycof6202252013-07-02 01:00:29 -0700322 return
323
324 def pack(self):
325 packed = []
326 packed.append(struct.pack("!H", self.type))
Kiran Poola150d8b02013-09-20 13:30:39 -0700327 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
Dan Talaycof6202252013-07-02 01:00:29 -0700328 packed.append(struct.pack("!L", self.port_no))
329 packed.append(struct.pack("!H", self.ingress_tpid))
330 packed.append(struct.pack("!H", self.ingress_vlan_id))
331 packed.append(struct.pack("!H", self.egress_tpid))
332 packed.append(struct.pack("!H", self.egress_vlan_id))
Kiran Poola150d8b02013-09-20 13:30:39 -0700333 packed.append(struct.pack("!16s", self.if_name))
Dan Talaycof6202252013-07-02 01:00:29 -0700334 length = sum([len(x) for x in packed])
Kiran Poola150d8b02013-09-20 13:30:39 -0700335 packed[1] = struct.pack("!H", length)
Dan Talaycof6202252013-07-02 01:00:29 -0700336 return ''.join(packed)
337
338 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800339 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -0700340 obj = bsn_vport_q_in_q()
Dan Talaycof6202252013-07-02 01:00:29 -0700341 _type = reader.read("!H")[0]
342 assert(_type == 0)
343 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800344 orig_reader = reader
345 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700346 obj.port_no = reader.read("!L")[0]
347 obj.ingress_tpid = reader.read("!H")[0]
348 obj.ingress_vlan_id = reader.read("!H")[0]
349 obj.egress_tpid = reader.read("!H")[0]
350 obj.egress_vlan_id = reader.read("!H")[0]
Kiran Poola150d8b02013-09-20 13:30:39 -0700351 obj.if_name = reader.read("!16s")[0].rstrip("\x00")
Dan Talaycof6202252013-07-02 01:00:29 -0700352 return obj
353
354 def __eq__(self, other):
355 if type(self) != type(other): return False
356 if self.port_no != other.port_no: return False
357 if self.ingress_tpid != other.ingress_tpid: return False
358 if self.ingress_vlan_id != other.ingress_vlan_id: return False
359 if self.egress_tpid != other.egress_tpid: return False
360 if self.egress_vlan_id != other.egress_vlan_id: return False
Kiran Poola150d8b02013-09-20 13:30:39 -0700361 if self.if_name != other.if_name: return False
Dan Talaycof6202252013-07-02 01:00:29 -0700362 return True
363
Dan Talaycof6202252013-07-02 01:00:29 -0700364 def pretty_print(self, q):
365 q.text("bsn_vport_q_in_q {")
366 with q.group():
367 with q.indent(2):
368 q.breakable()
369 q.text("port_no = ");
370 q.text("%#x" % self.port_no)
371 q.text(","); q.breakable()
372 q.text("ingress_tpid = ");
373 q.text("%#x" % self.ingress_tpid)
374 q.text(","); q.breakable()
375 q.text("ingress_vlan_id = ");
376 q.text("%#x" % self.ingress_vlan_id)
377 q.text(","); q.breakable()
378 q.text("egress_tpid = ");
379 q.text("%#x" % self.egress_tpid)
380 q.text(","); q.breakable()
381 q.text("egress_vlan_id = ");
382 q.text("%#x" % self.egress_vlan_id)
Kiran Poola150d8b02013-09-20 13:30:39 -0700383 q.text(","); q.breakable()
384 q.text("if_name = ");
385 q.pp(self.if_name)
Dan Talaycof6202252013-07-02 01:00:29 -0700386 q.breakable()
387 q.text('}')
388
Rich Lane7dcdf022013-12-11 14:45:27 -0800389bsn_vport.subtypes[0] = bsn_vport_q_in_q
390
391class bucket(loxi.OFObject):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700392
393 def __init__(self, weight=None, watch_port=None, watch_group=None, actions=None):
394 if weight != None:
395 self.weight = weight
396 else:
397 self.weight = 0
398 if watch_port != None:
399 self.watch_port = watch_port
400 else:
401 self.watch_port = 0
402 if watch_group != None:
403 self.watch_group = watch_group
404 else:
405 self.watch_group = 0
406 if actions != None:
407 self.actions = actions
408 else:
409 self.actions = []
410 return
411
412 def pack(self):
413 packed = []
414 packed.append(struct.pack("!H", 0)) # placeholder for len at index 0
415 packed.append(struct.pack("!H", self.weight))
Dan Talaycof6202252013-07-02 01:00:29 -0700416 packed.append(util.pack_port_no(self.watch_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700417 packed.append(struct.pack("!L", self.watch_group))
418 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -0800419 packed.append(loxi.generic_util.pack_list(self.actions))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700420 length = sum([len(x) for x in packed])
421 packed[0] = struct.pack("!H", length)
422 return ''.join(packed)
423
424 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800425 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700426 obj = bucket()
Dan Talaycof6202252013-07-02 01:00:29 -0700427 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800428 orig_reader = reader
429 reader = orig_reader.slice(_len - (0 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700430 obj.weight = reader.read("!H")[0]
431 obj.watch_port = util.unpack_port_no(reader)
432 obj.watch_group = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700433 reader.skip(4)
Rich Lane7dcdf022013-12-11 14:45:27 -0800434 obj.actions = loxi.generic_util.unpack_list(reader, action.action.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -0700435 return obj
436
437 def __eq__(self, other):
438 if type(self) != type(other): return False
439 if self.weight != other.weight: return False
440 if self.watch_port != other.watch_port: return False
441 if self.watch_group != other.watch_group: return False
442 if self.actions != other.actions: return False
443 return True
444
Rich Lanec2ee4b82013-04-24 17:12:38 -0700445 def pretty_print(self, q):
446 q.text("bucket {")
447 with q.group():
448 with q.indent(2):
449 q.breakable()
450 q.text("weight = ");
451 q.text("%#x" % self.weight)
452 q.text(","); q.breakable()
453 q.text("watch_port = ");
454 q.text(util.pretty_port(self.watch_port))
455 q.text(","); q.breakable()
456 q.text("watch_group = ");
457 q.text("%#x" % self.watch_group)
458 q.text(","); q.breakable()
459 q.text("actions = ");
460 q.pp(self.actions)
461 q.breakable()
462 q.text('}')
463
Rich Lane7dcdf022013-12-11 14:45:27 -0800464
465class bucket_counter(loxi.OFObject):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700466
467 def __init__(self, packet_count=None, byte_count=None):
468 if packet_count != None:
469 self.packet_count = packet_count
470 else:
471 self.packet_count = 0
472 if byte_count != None:
473 self.byte_count = byte_count
474 else:
475 self.byte_count = 0
476 return
477
478 def pack(self):
479 packed = []
480 packed.append(struct.pack("!Q", self.packet_count))
481 packed.append(struct.pack("!Q", self.byte_count))
482 return ''.join(packed)
483
484 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800485 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700486 obj = bucket_counter()
Dan Talaycof6202252013-07-02 01:00:29 -0700487 obj.packet_count = reader.read("!Q")[0]
488 obj.byte_count = reader.read("!Q")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700489 return obj
490
491 def __eq__(self, other):
492 if type(self) != type(other): return False
493 if self.packet_count != other.packet_count: return False
494 if self.byte_count != other.byte_count: return False
495 return True
496
Rich Lanec2ee4b82013-04-24 17:12:38 -0700497 def pretty_print(self, q):
498 q.text("bucket_counter {")
499 with q.group():
500 with q.indent(2):
501 q.breakable()
502 q.text("packet_count = ");
503 q.text("%#x" % self.packet_count)
504 q.text(","); q.breakable()
505 q.text("byte_count = ");
506 q.text("%#x" % self.byte_count)
507 q.breakable()
508 q.text('}')
509
Rich Lane7dcdf022013-12-11 14:45:27 -0800510
511class flow_stats_entry(loxi.OFObject):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700512
513 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):
514 if table_id != None:
515 self.table_id = table_id
516 else:
517 self.table_id = 0
518 if duration_sec != None:
519 self.duration_sec = duration_sec
520 else:
521 self.duration_sec = 0
522 if duration_nsec != None:
523 self.duration_nsec = duration_nsec
524 else:
525 self.duration_nsec = 0
526 if priority != None:
527 self.priority = priority
528 else:
529 self.priority = 0
530 if idle_timeout != None:
531 self.idle_timeout = idle_timeout
532 else:
533 self.idle_timeout = 0
534 if hard_timeout != None:
535 self.hard_timeout = hard_timeout
536 else:
537 self.hard_timeout = 0
538 if cookie != None:
539 self.cookie = cookie
540 else:
541 self.cookie = 0
542 if packet_count != None:
543 self.packet_count = packet_count
544 else:
545 self.packet_count = 0
546 if byte_count != None:
547 self.byte_count = byte_count
548 else:
549 self.byte_count = 0
550 if match != None:
551 self.match = match
552 else:
553 self.match = common.match()
554 if instructions != None:
555 self.instructions = instructions
556 else:
557 self.instructions = []
558 return
559
560 def pack(self):
561 packed = []
562 packed.append(struct.pack("!H", 0)) # placeholder for length at index 0
563 packed.append(struct.pack("!B", self.table_id))
564 packed.append('\x00' * 1)
565 packed.append(struct.pack("!L", self.duration_sec))
566 packed.append(struct.pack("!L", self.duration_nsec))
567 packed.append(struct.pack("!H", self.priority))
568 packed.append(struct.pack("!H", self.idle_timeout))
569 packed.append(struct.pack("!H", self.hard_timeout))
570 packed.append('\x00' * 6)
571 packed.append(struct.pack("!Q", self.cookie))
572 packed.append(struct.pack("!Q", self.packet_count))
573 packed.append(struct.pack("!Q", self.byte_count))
574 packed.append(self.match.pack())
Rich Lane7dcdf022013-12-11 14:45:27 -0800575 packed.append(loxi.generic_util.pack_list(self.instructions))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700576 length = sum([len(x) for x in packed])
577 packed[0] = struct.pack("!H", length)
578 return ''.join(packed)
579
580 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800581 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700582 obj = flow_stats_entry()
Dan Talaycof6202252013-07-02 01:00:29 -0700583 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800584 orig_reader = reader
585 reader = orig_reader.slice(_length - (0 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700586 obj.table_id = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700587 reader.skip(1)
Dan Talaycof6202252013-07-02 01:00:29 -0700588 obj.duration_sec = reader.read("!L")[0]
589 obj.duration_nsec = reader.read("!L")[0]
590 obj.priority = reader.read("!H")[0]
591 obj.idle_timeout = reader.read("!H")[0]
592 obj.hard_timeout = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700593 reader.skip(6)
Dan Talaycof6202252013-07-02 01:00:29 -0700594 obj.cookie = reader.read("!Q")[0]
595 obj.packet_count = reader.read("!Q")[0]
596 obj.byte_count = reader.read("!Q")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700597 obj.match = common.match.unpack(reader)
Rich Lane7dcdf022013-12-11 14:45:27 -0800598 obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -0700599 return obj
600
601 def __eq__(self, other):
602 if type(self) != type(other): return False
603 if self.table_id != other.table_id: return False
604 if self.duration_sec != other.duration_sec: return False
605 if self.duration_nsec != other.duration_nsec: return False
606 if self.priority != other.priority: return False
607 if self.idle_timeout != other.idle_timeout: return False
608 if self.hard_timeout != other.hard_timeout: return False
609 if self.cookie != other.cookie: return False
610 if self.packet_count != other.packet_count: return False
611 if self.byte_count != other.byte_count: return False
612 if self.match != other.match: return False
613 if self.instructions != other.instructions: return False
614 return True
615
Rich Lanec2ee4b82013-04-24 17:12:38 -0700616 def pretty_print(self, q):
617 q.text("flow_stats_entry {")
618 with q.group():
619 with q.indent(2):
620 q.breakable()
621 q.text("table_id = ");
622 q.text("%#x" % self.table_id)
623 q.text(","); q.breakable()
624 q.text("duration_sec = ");
625 q.text("%#x" % self.duration_sec)
626 q.text(","); q.breakable()
627 q.text("duration_nsec = ");
628 q.text("%#x" % self.duration_nsec)
629 q.text(","); q.breakable()
630 q.text("priority = ");
631 q.text("%#x" % self.priority)
632 q.text(","); q.breakable()
633 q.text("idle_timeout = ");
634 q.text("%#x" % self.idle_timeout)
635 q.text(","); q.breakable()
636 q.text("hard_timeout = ");
637 q.text("%#x" % self.hard_timeout)
638 q.text(","); q.breakable()
639 q.text("cookie = ");
640 q.text("%#x" % self.cookie)
641 q.text(","); q.breakable()
642 q.text("packet_count = ");
643 q.text("%#x" % self.packet_count)
644 q.text(","); q.breakable()
645 q.text("byte_count = ");
646 q.text("%#x" % self.byte_count)
647 q.text(","); q.breakable()
648 q.text("match = ");
649 q.pp(self.match)
650 q.text(","); q.breakable()
651 q.text("instructions = ");
652 q.pp(self.instructions)
653 q.breakable()
654 q.text('}')
655
Rich Lane7dcdf022013-12-11 14:45:27 -0800656
657class group_desc_stats_entry(loxi.OFObject):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700658
Rich Lane6f4978c2013-10-20 21:33:52 -0700659 def __init__(self, group_type=None, group_id=None, buckets=None):
660 if group_type != None:
661 self.group_type = group_type
Rich Lanec2ee4b82013-04-24 17:12:38 -0700662 else:
Rich Lane6f4978c2013-10-20 21:33:52 -0700663 self.group_type = 0
Rich Lanec2ee4b82013-04-24 17:12:38 -0700664 if group_id != None:
665 self.group_id = group_id
666 else:
667 self.group_id = 0
668 if buckets != None:
669 self.buckets = buckets
670 else:
671 self.buckets = []
672 return
673
674 def pack(self):
675 packed = []
676 packed.append(struct.pack("!H", 0)) # placeholder for length at index 0
Rich Lane6f4978c2013-10-20 21:33:52 -0700677 packed.append(struct.pack("!B", self.group_type))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700678 packed.append('\x00' * 1)
679 packed.append(struct.pack("!L", self.group_id))
Rich Lane7dcdf022013-12-11 14:45:27 -0800680 packed.append(loxi.generic_util.pack_list(self.buckets))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700681 length = sum([len(x) for x in packed])
682 packed[0] = struct.pack("!H", length)
683 return ''.join(packed)
684
685 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800686 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700687 obj = group_desc_stats_entry()
Dan Talaycof6202252013-07-02 01:00:29 -0700688 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800689 orig_reader = reader
690 reader = orig_reader.slice(_length - (0 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -0700691 obj.group_type = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700692 reader.skip(1)
Dan Talaycof6202252013-07-02 01:00:29 -0700693 obj.group_id = reader.read("!L")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800694 obj.buckets = loxi.generic_util.unpack_list(reader, common.bucket.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -0700695 return obj
696
697 def __eq__(self, other):
698 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -0700699 if self.group_type != other.group_type: return False
Rich Lanec2ee4b82013-04-24 17:12:38 -0700700 if self.group_id != other.group_id: return False
701 if self.buckets != other.buckets: return False
702 return True
703
Rich Lanec2ee4b82013-04-24 17:12:38 -0700704 def pretty_print(self, q):
705 q.text("group_desc_stats_entry {")
706 with q.group():
707 with q.indent(2):
708 q.breakable()
Rich Lane6f4978c2013-10-20 21:33:52 -0700709 q.text("group_type = ");
710 q.text("%#x" % self.group_type)
Rich Lanec2ee4b82013-04-24 17:12:38 -0700711 q.text(","); q.breakable()
712 q.text("group_id = ");
713 q.text("%#x" % self.group_id)
714 q.text(","); q.breakable()
715 q.text("buckets = ");
716 q.pp(self.buckets)
717 q.breakable()
718 q.text('}')
719
Rich Lane7dcdf022013-12-11 14:45:27 -0800720
721class group_stats_entry(loxi.OFObject):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700722
723 def __init__(self, group_id=None, ref_count=None, packet_count=None, byte_count=None, bucket_stats=None):
724 if group_id != None:
725 self.group_id = group_id
726 else:
727 self.group_id = 0
728 if ref_count != None:
729 self.ref_count = ref_count
730 else:
731 self.ref_count = 0
732 if packet_count != None:
733 self.packet_count = packet_count
734 else:
735 self.packet_count = 0
736 if byte_count != None:
737 self.byte_count = byte_count
738 else:
739 self.byte_count = 0
740 if bucket_stats != None:
741 self.bucket_stats = bucket_stats
742 else:
743 self.bucket_stats = []
744 return
745
746 def pack(self):
747 packed = []
748 packed.append(struct.pack("!H", 0)) # placeholder for length at index 0
749 packed.append('\x00' * 2)
750 packed.append(struct.pack("!L", self.group_id))
751 packed.append(struct.pack("!L", self.ref_count))
752 packed.append('\x00' * 4)
753 packed.append(struct.pack("!Q", self.packet_count))
754 packed.append(struct.pack("!Q", self.byte_count))
Rich Lane7dcdf022013-12-11 14:45:27 -0800755 packed.append(loxi.generic_util.pack_list(self.bucket_stats))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700756 length = sum([len(x) for x in packed])
757 packed[0] = struct.pack("!H", length)
758 return ''.join(packed)
759
760 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800761 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700762 obj = group_stats_entry()
Dan Talaycof6202252013-07-02 01:00:29 -0700763 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800764 orig_reader = reader
765 reader = orig_reader.slice(_length - (0 + 2))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700766 reader.skip(2)
Dan Talaycof6202252013-07-02 01:00:29 -0700767 obj.group_id = reader.read("!L")[0]
768 obj.ref_count = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700769 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -0700770 obj.packet_count = reader.read("!Q")[0]
771 obj.byte_count = reader.read("!Q")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700772 obj.bucket_stats = loxi.generic_util.unpack_list(reader, common.bucket_counter.unpack)
773 return obj
774
775 def __eq__(self, other):
776 if type(self) != type(other): return False
777 if self.group_id != other.group_id: return False
778 if self.ref_count != other.ref_count: return False
779 if self.packet_count != other.packet_count: return False
780 if self.byte_count != other.byte_count: return False
781 if self.bucket_stats != other.bucket_stats: return False
782 return True
783
Rich Lanec2ee4b82013-04-24 17:12:38 -0700784 def pretty_print(self, q):
785 q.text("group_stats_entry {")
786 with q.group():
787 with q.indent(2):
788 q.breakable()
789 q.text("group_id = ");
790 q.text("%#x" % self.group_id)
791 q.text(","); q.breakable()
792 q.text("ref_count = ");
793 q.text("%#x" % self.ref_count)
794 q.text(","); q.breakable()
795 q.text("packet_count = ");
796 q.text("%#x" % self.packet_count)
797 q.text(","); q.breakable()
798 q.text("byte_count = ");
799 q.text("%#x" % self.byte_count)
800 q.text(","); q.breakable()
801 q.text("bucket_stats = ");
802 q.pp(self.bucket_stats)
803 q.breakable()
804 q.text('}')
805
Rich Lane7dcdf022013-12-11 14:45:27 -0800806
807class match_v3(loxi.OFObject):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700808 type = 1
809
810 def __init__(self, oxm_list=None):
811 if oxm_list != None:
812 self.oxm_list = oxm_list
813 else:
814 self.oxm_list = []
815 return
816
817 def pack(self):
818 packed = []
819 packed.append(struct.pack("!H", self.type))
820 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
Rich Lane7dcdf022013-12-11 14:45:27 -0800821 packed.append(loxi.generic_util.pack_list(self.oxm_list))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700822 length = sum([len(x) for x in packed])
823 packed[1] = struct.pack("!H", length)
Rich Laned53156a2013-08-05 17:17:33 -0700824 packed.append(loxi.generic_util.pad_to(8, length))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700825 return ''.join(packed)
826
827 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800828 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700829 obj = match_v3()
Dan Talaycof6202252013-07-02 01:00:29 -0700830 _type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700831 assert(_type == 1)
Dan Talaycof6202252013-07-02 01:00:29 -0700832 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800833 orig_reader = reader
834 reader = orig_reader.slice(_length - (2 + 2))
835 obj.oxm_list = loxi.generic_util.unpack_list(reader, oxm.oxm.unpack)
836 orig_reader.skip_align()
Rich Lanec2ee4b82013-04-24 17:12:38 -0700837 return obj
838
839 def __eq__(self, other):
840 if type(self) != type(other): return False
841 if self.oxm_list != other.oxm_list: return False
842 return True
843
Rich Lanec2ee4b82013-04-24 17:12:38 -0700844 def pretty_print(self, q):
845 q.text("match_v3 {")
846 with q.group():
847 with q.indent(2):
848 q.breakable()
849 q.text("oxm_list = ");
850 q.pp(self.oxm_list)
851 q.breakable()
852 q.text('}')
853
Rich Lane7dcdf022013-12-11 14:45:27 -0800854
855class packet_queue(loxi.OFObject):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700856
857 def __init__(self, queue_id=None, port=None, properties=None):
858 if queue_id != None:
859 self.queue_id = queue_id
860 else:
861 self.queue_id = 0
862 if port != None:
863 self.port = port
864 else:
865 self.port = 0
866 if properties != None:
867 self.properties = properties
868 else:
869 self.properties = []
870 return
871
872 def pack(self):
873 packed = []
874 packed.append(struct.pack("!L", self.queue_id))
Dan Talaycof6202252013-07-02 01:00:29 -0700875 packed.append(util.pack_port_no(self.port))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700876 packed.append(struct.pack("!H", 0)) # placeholder for len at index 2
877 packed.append('\x00' * 6)
Rich Lane7dcdf022013-12-11 14:45:27 -0800878 packed.append(loxi.generic_util.pack_list(self.properties))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700879 length = sum([len(x) for x in packed])
880 packed[2] = struct.pack("!H", length)
881 return ''.join(packed)
882
883 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800884 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700885 obj = packet_queue()
Dan Talaycof6202252013-07-02 01:00:29 -0700886 obj.queue_id = reader.read("!L")[0]
887 obj.port = util.unpack_port_no(reader)
888 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800889 orig_reader = reader
890 reader = orig_reader.slice(_len - (8 + 2))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700891 reader.skip(6)
Rich Lane7dcdf022013-12-11 14:45:27 -0800892 obj.properties = loxi.generic_util.unpack_list(reader, common.queue_prop.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -0700893 return obj
894
895 def __eq__(self, other):
896 if type(self) != type(other): return False
897 if self.queue_id != other.queue_id: return False
898 if self.port != other.port: return False
899 if self.properties != other.properties: return False
900 return True
901
Rich Lanec2ee4b82013-04-24 17:12:38 -0700902 def pretty_print(self, q):
903 q.text("packet_queue {")
904 with q.group():
905 with q.indent(2):
906 q.breakable()
907 q.text("queue_id = ");
908 q.text("%#x" % self.queue_id)
909 q.text(","); q.breakable()
910 q.text("port = ");
911 q.text(util.pretty_port(self.port))
912 q.text(","); q.breakable()
913 q.text("properties = ");
914 q.pp(self.properties)
915 q.breakable()
916 q.text('}')
917
Rich Lane7dcdf022013-12-11 14:45:27 -0800918
919class port_desc(loxi.OFObject):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700920
921 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):
922 if port_no != None:
923 self.port_no = port_no
924 else:
925 self.port_no = 0
926 if hw_addr != None:
927 self.hw_addr = hw_addr
928 else:
929 self.hw_addr = [0,0,0,0,0,0]
930 if name != None:
931 self.name = name
932 else:
933 self.name = ""
934 if config != None:
935 self.config = config
936 else:
937 self.config = 0
938 if state != None:
939 self.state = state
940 else:
941 self.state = 0
942 if curr != None:
943 self.curr = curr
944 else:
945 self.curr = 0
946 if advertised != None:
947 self.advertised = advertised
948 else:
949 self.advertised = 0
950 if supported != None:
951 self.supported = supported
952 else:
953 self.supported = 0
954 if peer != None:
955 self.peer = peer
956 else:
957 self.peer = 0
958 if curr_speed != None:
959 self.curr_speed = curr_speed
960 else:
961 self.curr_speed = 0
962 if max_speed != None:
963 self.max_speed = max_speed
964 else:
965 self.max_speed = 0
966 return
967
968 def pack(self):
969 packed = []
Dan Talaycof6202252013-07-02 01:00:29 -0700970 packed.append(util.pack_port_no(self.port_no))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700971 packed.append('\x00' * 4)
972 packed.append(struct.pack("!6B", *self.hw_addr))
973 packed.append('\x00' * 2)
974 packed.append(struct.pack("!16s", self.name))
975 packed.append(struct.pack("!L", self.config))
976 packed.append(struct.pack("!L", self.state))
977 packed.append(struct.pack("!L", self.curr))
978 packed.append(struct.pack("!L", self.advertised))
979 packed.append(struct.pack("!L", self.supported))
980 packed.append(struct.pack("!L", self.peer))
981 packed.append(struct.pack("!L", self.curr_speed))
982 packed.append(struct.pack("!L", self.max_speed))
983 return ''.join(packed)
984
985 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800986 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700987 obj = port_desc()
Dan Talaycof6202252013-07-02 01:00:29 -0700988 obj.port_no = util.unpack_port_no(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -0700989 reader.skip(4)
990 obj.hw_addr = list(reader.read('!6B'))
991 reader.skip(2)
992 obj.name = reader.read("!16s")[0].rstrip("\x00")
Dan Talaycof6202252013-07-02 01:00:29 -0700993 obj.config = reader.read("!L")[0]
994 obj.state = reader.read("!L")[0]
995 obj.curr = reader.read("!L")[0]
996 obj.advertised = reader.read("!L")[0]
997 obj.supported = reader.read("!L")[0]
998 obj.peer = reader.read("!L")[0]
999 obj.curr_speed = reader.read("!L")[0]
1000 obj.max_speed = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001001 return obj
1002
1003 def __eq__(self, other):
1004 if type(self) != type(other): return False
1005 if self.port_no != other.port_no: return False
1006 if self.hw_addr != other.hw_addr: return False
1007 if self.name != other.name: return False
1008 if self.config != other.config: return False
1009 if self.state != other.state: return False
1010 if self.curr != other.curr: return False
1011 if self.advertised != other.advertised: return False
1012 if self.supported != other.supported: return False
1013 if self.peer != other.peer: return False
1014 if self.curr_speed != other.curr_speed: return False
1015 if self.max_speed != other.max_speed: return False
1016 return True
1017
Rich Lanec2ee4b82013-04-24 17:12:38 -07001018 def pretty_print(self, q):
1019 q.text("port_desc {")
1020 with q.group():
1021 with q.indent(2):
1022 q.breakable()
1023 q.text("port_no = ");
1024 q.text(util.pretty_port(self.port_no))
1025 q.text(","); q.breakable()
1026 q.text("hw_addr = ");
1027 q.text(util.pretty_mac(self.hw_addr))
1028 q.text(","); q.breakable()
1029 q.text("name = ");
1030 q.pp(self.name)
1031 q.text(","); q.breakable()
1032 q.text("config = ");
1033 q.text("%#x" % self.config)
1034 q.text(","); q.breakable()
1035 q.text("state = ");
1036 q.text("%#x" % self.state)
1037 q.text(","); q.breakable()
1038 q.text("curr = ");
1039 q.text("%#x" % self.curr)
1040 q.text(","); q.breakable()
1041 q.text("advertised = ");
1042 q.text("%#x" % self.advertised)
1043 q.text(","); q.breakable()
1044 q.text("supported = ");
1045 q.text("%#x" % self.supported)
1046 q.text(","); q.breakable()
1047 q.text("peer = ");
1048 q.text("%#x" % self.peer)
1049 q.text(","); q.breakable()
1050 q.text("curr_speed = ");
1051 q.text("%#x" % self.curr_speed)
1052 q.text(","); q.breakable()
1053 q.text("max_speed = ");
1054 q.text("%#x" % self.max_speed)
1055 q.breakable()
1056 q.text('}')
1057
Rich Lane7dcdf022013-12-11 14:45:27 -08001058
1059class port_stats_entry(loxi.OFObject):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001060
1061 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):
1062 if port_no != None:
1063 self.port_no = port_no
1064 else:
1065 self.port_no = 0
1066 if rx_packets != None:
1067 self.rx_packets = rx_packets
1068 else:
1069 self.rx_packets = 0
1070 if tx_packets != None:
1071 self.tx_packets = tx_packets
1072 else:
1073 self.tx_packets = 0
1074 if rx_bytes != None:
1075 self.rx_bytes = rx_bytes
1076 else:
1077 self.rx_bytes = 0
1078 if tx_bytes != None:
1079 self.tx_bytes = tx_bytes
1080 else:
1081 self.tx_bytes = 0
1082 if rx_dropped != None:
1083 self.rx_dropped = rx_dropped
1084 else:
1085 self.rx_dropped = 0
1086 if tx_dropped != None:
1087 self.tx_dropped = tx_dropped
1088 else:
1089 self.tx_dropped = 0
1090 if rx_errors != None:
1091 self.rx_errors = rx_errors
1092 else:
1093 self.rx_errors = 0
1094 if tx_errors != None:
1095 self.tx_errors = tx_errors
1096 else:
1097 self.tx_errors = 0
1098 if rx_frame_err != None:
1099 self.rx_frame_err = rx_frame_err
1100 else:
1101 self.rx_frame_err = 0
1102 if rx_over_err != None:
1103 self.rx_over_err = rx_over_err
1104 else:
1105 self.rx_over_err = 0
1106 if rx_crc_err != None:
1107 self.rx_crc_err = rx_crc_err
1108 else:
1109 self.rx_crc_err = 0
1110 if collisions != None:
1111 self.collisions = collisions
1112 else:
1113 self.collisions = 0
1114 return
1115
1116 def pack(self):
1117 packed = []
Dan Talaycof6202252013-07-02 01:00:29 -07001118 packed.append(util.pack_port_no(self.port_no))
Rich Lanec2ee4b82013-04-24 17:12:38 -07001119 packed.append('\x00' * 4)
1120 packed.append(struct.pack("!Q", self.rx_packets))
1121 packed.append(struct.pack("!Q", self.tx_packets))
1122 packed.append(struct.pack("!Q", self.rx_bytes))
1123 packed.append(struct.pack("!Q", self.tx_bytes))
1124 packed.append(struct.pack("!Q", self.rx_dropped))
1125 packed.append(struct.pack("!Q", self.tx_dropped))
1126 packed.append(struct.pack("!Q", self.rx_errors))
1127 packed.append(struct.pack("!Q", self.tx_errors))
1128 packed.append(struct.pack("!Q", self.rx_frame_err))
1129 packed.append(struct.pack("!Q", self.rx_over_err))
1130 packed.append(struct.pack("!Q", self.rx_crc_err))
1131 packed.append(struct.pack("!Q", self.collisions))
1132 return ''.join(packed)
1133
1134 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001135 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001136 obj = port_stats_entry()
Dan Talaycof6202252013-07-02 01:00:29 -07001137 obj.port_no = util.unpack_port_no(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -07001138 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -07001139 obj.rx_packets = reader.read("!Q")[0]
1140 obj.tx_packets = reader.read("!Q")[0]
1141 obj.rx_bytes = reader.read("!Q")[0]
1142 obj.tx_bytes = reader.read("!Q")[0]
1143 obj.rx_dropped = reader.read("!Q")[0]
1144 obj.tx_dropped = reader.read("!Q")[0]
1145 obj.rx_errors = reader.read("!Q")[0]
1146 obj.tx_errors = reader.read("!Q")[0]
1147 obj.rx_frame_err = reader.read("!Q")[0]
1148 obj.rx_over_err = reader.read("!Q")[0]
1149 obj.rx_crc_err = reader.read("!Q")[0]
1150 obj.collisions = reader.read("!Q")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001151 return obj
1152
1153 def __eq__(self, other):
1154 if type(self) != type(other): return False
1155 if self.port_no != other.port_no: return False
1156 if self.rx_packets != other.rx_packets: return False
1157 if self.tx_packets != other.tx_packets: return False
1158 if self.rx_bytes != other.rx_bytes: return False
1159 if self.tx_bytes != other.tx_bytes: return False
1160 if self.rx_dropped != other.rx_dropped: return False
1161 if self.tx_dropped != other.tx_dropped: return False
1162 if self.rx_errors != other.rx_errors: return False
1163 if self.tx_errors != other.tx_errors: return False
1164 if self.rx_frame_err != other.rx_frame_err: return False
1165 if self.rx_over_err != other.rx_over_err: return False
1166 if self.rx_crc_err != other.rx_crc_err: return False
1167 if self.collisions != other.collisions: return False
1168 return True
1169
Rich Lanec2ee4b82013-04-24 17:12:38 -07001170 def pretty_print(self, q):
1171 q.text("port_stats_entry {")
1172 with q.group():
1173 with q.indent(2):
1174 q.breakable()
1175 q.text("port_no = ");
1176 q.text(util.pretty_port(self.port_no))
1177 q.text(","); q.breakable()
1178 q.text("rx_packets = ");
1179 q.text("%#x" % self.rx_packets)
1180 q.text(","); q.breakable()
1181 q.text("tx_packets = ");
1182 q.text("%#x" % self.tx_packets)
1183 q.text(","); q.breakable()
1184 q.text("rx_bytes = ");
1185 q.text("%#x" % self.rx_bytes)
1186 q.text(","); q.breakable()
1187 q.text("tx_bytes = ");
1188 q.text("%#x" % self.tx_bytes)
1189 q.text(","); q.breakable()
1190 q.text("rx_dropped = ");
1191 q.text("%#x" % self.rx_dropped)
1192 q.text(","); q.breakable()
1193 q.text("tx_dropped = ");
1194 q.text("%#x" % self.tx_dropped)
1195 q.text(","); q.breakable()
1196 q.text("rx_errors = ");
1197 q.text("%#x" % self.rx_errors)
1198 q.text(","); q.breakable()
1199 q.text("tx_errors = ");
1200 q.text("%#x" % self.tx_errors)
1201 q.text(","); q.breakable()
1202 q.text("rx_frame_err = ");
1203 q.text("%#x" % self.rx_frame_err)
1204 q.text(","); q.breakable()
1205 q.text("rx_over_err = ");
1206 q.text("%#x" % self.rx_over_err)
1207 q.text(","); q.breakable()
1208 q.text("rx_crc_err = ");
1209 q.text("%#x" % self.rx_crc_err)
1210 q.text(","); q.breakable()
1211 q.text("collisions = ");
1212 q.text("%#x" % self.collisions)
1213 q.breakable()
1214 q.text('}')
1215
Rich Lane7dcdf022013-12-11 14:45:27 -08001216
1217class queue_prop(loxi.OFObject):
1218 subtypes = {}
1219
Rich Lane95f7fc92014-01-27 17:08:16 -08001220
1221 def __init__(self, type=None):
1222 if type != None:
1223 self.type = type
1224 else:
1225 self.type = 0
1226 return
1227
1228 def pack(self):
1229 packed = []
1230 packed.append(struct.pack("!H", self.type))
1231 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
1232 packed.append('\x00' * 4)
1233 length = sum([len(x) for x in packed])
1234 packed[1] = struct.pack("!H", length)
1235 return ''.join(packed)
1236
Rich Lane7dcdf022013-12-11 14:45:27 -08001237 @staticmethod
1238 def unpack(reader):
1239 subtype, = reader.peek('!H', 0)
Rich Lane95f7fc92014-01-27 17:08:16 -08001240 subclass = queue_prop.subtypes.get(subtype)
1241 if subclass:
1242 return subclass.unpack(reader)
1243
1244 obj = queue_prop()
1245 obj.type = reader.read("!H")[0]
1246 _len = reader.read("!H")[0]
1247 orig_reader = reader
1248 reader = orig_reader.slice(_len - (2 + 2))
1249 reader.skip(4)
1250 return obj
1251
1252 def __eq__(self, other):
1253 if type(self) != type(other): return False
1254 if self.type != other.type: return False
1255 return True
1256
1257 def pretty_print(self, q):
1258 q.text("queue_prop {")
1259 with q.group():
1260 with q.indent(2):
1261 q.breakable()
1262 q.breakable()
1263 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -08001264
1265
1266class queue_prop_experimenter(queue_prop):
1267 subtypes = {}
1268
Rich Lane95f7fc92014-01-27 17:08:16 -08001269 type = 65535
1270
1271 def __init__(self, experimenter=None, data=None):
1272 if experimenter != None:
1273 self.experimenter = experimenter
1274 else:
1275 self.experimenter = 0
1276 if data != None:
1277 self.data = data
1278 else:
1279 self.data = ''
1280 return
1281
1282 def pack(self):
1283 packed = []
1284 packed.append(struct.pack("!H", self.type))
1285 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
1286 packed.append('\x00' * 4)
1287 packed.append(struct.pack("!L", self.experimenter))
1288 packed.append('\x00' * 4)
1289 packed.append(self.data)
1290 length = sum([len(x) for x in packed])
1291 packed[1] = struct.pack("!H", length)
1292 return ''.join(packed)
1293
Rich Lane7dcdf022013-12-11 14:45:27 -08001294 @staticmethod
1295 def unpack(reader):
1296 subtype, = reader.peek('!L', 8)
Rich Lane95f7fc92014-01-27 17:08:16 -08001297 subclass = queue_prop_experimenter.subtypes.get(subtype)
1298 if subclass:
1299 return subclass.unpack(reader)
1300
1301 obj = queue_prop_experimenter()
1302 _type = reader.read("!H")[0]
1303 assert(_type == 65535)
1304 _len = reader.read("!H")[0]
1305 orig_reader = reader
1306 reader = orig_reader.slice(_len - (2 + 2))
1307 reader.skip(4)
1308 obj.experimenter = reader.read("!L")[0]
1309 reader.skip(4)
1310 obj.data = str(reader.read_all())
1311 return obj
1312
1313 def __eq__(self, other):
1314 if type(self) != type(other): return False
1315 if self.experimenter != other.experimenter: return False
1316 if self.data != other.data: return False
1317 return True
1318
1319 def pretty_print(self, q):
1320 q.text("queue_prop_experimenter {")
1321 with q.group():
1322 with q.indent(2):
1323 q.breakable()
1324 q.text("data = ");
1325 q.pp(self.data)
1326 q.breakable()
1327 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -08001328
1329queue_prop.subtypes[65535] = queue_prop_experimenter
1330
1331class queue_prop_max_rate(queue_prop):
Dan Talaycof6202252013-07-02 01:00:29 -07001332 type = 2
Rich Lanec2ee4b82013-04-24 17:12:38 -07001333
1334 def __init__(self, rate=None):
1335 if rate != None:
1336 self.rate = rate
1337 else:
1338 self.rate = 0
1339 return
1340
1341 def pack(self):
1342 packed = []
1343 packed.append(struct.pack("!H", self.type))
1344 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
1345 packed.append('\x00' * 4)
1346 packed.append(struct.pack("!H", self.rate))
1347 packed.append('\x00' * 6)
1348 length = sum([len(x) for x in packed])
1349 packed[1] = struct.pack("!H", length)
1350 return ''.join(packed)
1351
1352 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001353 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001354 obj = queue_prop_max_rate()
Dan Talaycof6202252013-07-02 01:00:29 -07001355 _type = reader.read("!H")[0]
1356 assert(_type == 2)
1357 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001358 orig_reader = reader
1359 reader = orig_reader.slice(_len - (2 + 2))
Rich Lanec2ee4b82013-04-24 17:12:38 -07001360 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -07001361 obj.rate = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001362 reader.skip(6)
1363 return obj
1364
1365 def __eq__(self, other):
1366 if type(self) != type(other): return False
1367 if self.rate != other.rate: return False
1368 return True
1369
Rich Lanec2ee4b82013-04-24 17:12:38 -07001370 def pretty_print(self, q):
1371 q.text("queue_prop_max_rate {")
1372 with q.group():
1373 with q.indent(2):
1374 q.breakable()
1375 q.text("rate = ");
1376 q.text("%#x" % self.rate)
1377 q.breakable()
1378 q.text('}')
1379
Rich Lane7dcdf022013-12-11 14:45:27 -08001380queue_prop.subtypes[2] = queue_prop_max_rate
1381
1382class queue_prop_min_rate(queue_prop):
Dan Talaycof6202252013-07-02 01:00:29 -07001383 type = 1
Rich Lanec2ee4b82013-04-24 17:12:38 -07001384
1385 def __init__(self, rate=None):
1386 if rate != None:
1387 self.rate = rate
1388 else:
1389 self.rate = 0
1390 return
1391
1392 def pack(self):
1393 packed = []
1394 packed.append(struct.pack("!H", self.type))
1395 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
1396 packed.append('\x00' * 4)
1397 packed.append(struct.pack("!H", self.rate))
1398 packed.append('\x00' * 6)
1399 length = sum([len(x) for x in packed])
1400 packed[1] = struct.pack("!H", length)
1401 return ''.join(packed)
1402
1403 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001404 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001405 obj = queue_prop_min_rate()
Dan Talaycof6202252013-07-02 01:00:29 -07001406 _type = reader.read("!H")[0]
1407 assert(_type == 1)
1408 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001409 orig_reader = reader
1410 reader = orig_reader.slice(_len - (2 + 2))
Rich Lanec2ee4b82013-04-24 17:12:38 -07001411 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -07001412 obj.rate = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001413 reader.skip(6)
1414 return obj
1415
1416 def __eq__(self, other):
1417 if type(self) != type(other): return False
1418 if self.rate != other.rate: return False
1419 return True
1420
Rich Lanec2ee4b82013-04-24 17:12:38 -07001421 def pretty_print(self, q):
1422 q.text("queue_prop_min_rate {")
1423 with q.group():
1424 with q.indent(2):
1425 q.breakable()
1426 q.text("rate = ");
1427 q.text("%#x" % self.rate)
1428 q.breakable()
1429 q.text('}')
1430
Rich Lane7dcdf022013-12-11 14:45:27 -08001431queue_prop.subtypes[1] = queue_prop_min_rate
1432
1433class queue_stats_entry(loxi.OFObject):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001434
1435 def __init__(self, port_no=None, queue_id=None, tx_bytes=None, tx_packets=None, tx_errors=None):
1436 if port_no != None:
1437 self.port_no = port_no
1438 else:
1439 self.port_no = 0
1440 if queue_id != None:
1441 self.queue_id = queue_id
1442 else:
1443 self.queue_id = 0
1444 if tx_bytes != None:
1445 self.tx_bytes = tx_bytes
1446 else:
1447 self.tx_bytes = 0
1448 if tx_packets != None:
1449 self.tx_packets = tx_packets
1450 else:
1451 self.tx_packets = 0
1452 if tx_errors != None:
1453 self.tx_errors = tx_errors
1454 else:
1455 self.tx_errors = 0
1456 return
1457
1458 def pack(self):
1459 packed = []
Dan Talaycof6202252013-07-02 01:00:29 -07001460 packed.append(util.pack_port_no(self.port_no))
Rich Lanec2ee4b82013-04-24 17:12:38 -07001461 packed.append(struct.pack("!L", self.queue_id))
1462 packed.append(struct.pack("!Q", self.tx_bytes))
1463 packed.append(struct.pack("!Q", self.tx_packets))
1464 packed.append(struct.pack("!Q", self.tx_errors))
1465 return ''.join(packed)
1466
1467 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001468 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001469 obj = queue_stats_entry()
Dan Talaycof6202252013-07-02 01:00:29 -07001470 obj.port_no = util.unpack_port_no(reader)
1471 obj.queue_id = reader.read("!L")[0]
1472 obj.tx_bytes = reader.read("!Q")[0]
1473 obj.tx_packets = reader.read("!Q")[0]
1474 obj.tx_errors = reader.read("!Q")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001475 return obj
1476
1477 def __eq__(self, other):
1478 if type(self) != type(other): return False
1479 if self.port_no != other.port_no: return False
1480 if self.queue_id != other.queue_id: return False
1481 if self.tx_bytes != other.tx_bytes: return False
1482 if self.tx_packets != other.tx_packets: return False
1483 if self.tx_errors != other.tx_errors: return False
1484 return True
1485
Rich Lanec2ee4b82013-04-24 17:12:38 -07001486 def pretty_print(self, q):
1487 q.text("queue_stats_entry {")
1488 with q.group():
1489 with q.indent(2):
1490 q.breakable()
1491 q.text("port_no = ");
1492 q.text(util.pretty_port(self.port_no))
1493 q.text(","); q.breakable()
1494 q.text("queue_id = ");
1495 q.text("%#x" % self.queue_id)
1496 q.text(","); q.breakable()
1497 q.text("tx_bytes = ");
1498 q.text("%#x" % self.tx_bytes)
1499 q.text(","); q.breakable()
1500 q.text("tx_packets = ");
1501 q.text("%#x" % self.tx_packets)
1502 q.text(","); q.breakable()
1503 q.text("tx_errors = ");
1504 q.text("%#x" % self.tx_errors)
1505 q.breakable()
1506 q.text('}')
1507
Rich Lane7dcdf022013-12-11 14:45:27 -08001508
1509class table_stats_entry(loxi.OFObject):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001510
1511 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):
1512 if table_id != None:
1513 self.table_id = table_id
1514 else:
1515 self.table_id = 0
1516 if name != None:
1517 self.name = name
1518 else:
1519 self.name = ""
1520 if match != None:
1521 self.match = match
1522 else:
Dan Talaycof6202252013-07-02 01:00:29 -07001523 self.match = util.init_match_bmap()
Rich Lanec2ee4b82013-04-24 17:12:38 -07001524 if wildcards != None:
1525 self.wildcards = wildcards
1526 else:
Dan Talaycof6202252013-07-02 01:00:29 -07001527 self.wildcards = util.init_wc_bmap()
Rich Lanec2ee4b82013-04-24 17:12:38 -07001528 if write_actions != None:
1529 self.write_actions = write_actions
1530 else:
1531 self.write_actions = 0
1532 if apply_actions != None:
1533 self.apply_actions = apply_actions
1534 else:
1535 self.apply_actions = 0
1536 if write_setfields != None:
1537 self.write_setfields = write_setfields
1538 else:
1539 self.write_setfields = 0
1540 if apply_setfields != None:
1541 self.apply_setfields = apply_setfields
1542 else:
1543 self.apply_setfields = 0
1544 if metadata_match != None:
1545 self.metadata_match = metadata_match
1546 else:
1547 self.metadata_match = 0
1548 if metadata_write != None:
1549 self.metadata_write = metadata_write
1550 else:
1551 self.metadata_write = 0
1552 if instructions != None:
1553 self.instructions = instructions
1554 else:
1555 self.instructions = 0
1556 if config != None:
1557 self.config = config
1558 else:
1559 self.config = 0
1560 if max_entries != None:
1561 self.max_entries = max_entries
1562 else:
1563 self.max_entries = 0
1564 if active_count != None:
1565 self.active_count = active_count
1566 else:
1567 self.active_count = 0
1568 if lookup_count != None:
1569 self.lookup_count = lookup_count
1570 else:
1571 self.lookup_count = 0
1572 if matched_count != None:
1573 self.matched_count = matched_count
1574 else:
1575 self.matched_count = 0
1576 return
1577
1578 def pack(self):
1579 packed = []
1580 packed.append(struct.pack("!B", self.table_id))
1581 packed.append('\x00' * 7)
1582 packed.append(struct.pack("!32s", self.name))
Dan Talaycof6202252013-07-02 01:00:29 -07001583 packed.append(util.pack_match_bmap(self.match))
1584 packed.append(util.pack_wc_bmap(self.wildcards))
Rich Lanec2ee4b82013-04-24 17:12:38 -07001585 packed.append(struct.pack("!L", self.write_actions))
1586 packed.append(struct.pack("!L", self.apply_actions))
1587 packed.append(struct.pack("!Q", self.write_setfields))
1588 packed.append(struct.pack("!Q", self.apply_setfields))
1589 packed.append(struct.pack("!Q", self.metadata_match))
1590 packed.append(struct.pack("!Q", self.metadata_write))
1591 packed.append(struct.pack("!L", self.instructions))
1592 packed.append(struct.pack("!L", self.config))
1593 packed.append(struct.pack("!L", self.max_entries))
1594 packed.append(struct.pack("!L", self.active_count))
1595 packed.append(struct.pack("!Q", self.lookup_count))
1596 packed.append(struct.pack("!Q", self.matched_count))
1597 return ''.join(packed)
1598
1599 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001600 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001601 obj = table_stats_entry()
Dan Talaycof6202252013-07-02 01:00:29 -07001602 obj.table_id = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001603 reader.skip(7)
1604 obj.name = reader.read("!32s")[0].rstrip("\x00")
Dan Talaycof6202252013-07-02 01:00:29 -07001605 obj.match = util.unpack_match_bmap(reader)
1606 obj.wildcards = util.unpack_wc_bmap(reader)
1607 obj.write_actions = reader.read("!L")[0]
1608 obj.apply_actions = reader.read("!L")[0]
1609 obj.write_setfields = reader.read("!Q")[0]
1610 obj.apply_setfields = reader.read("!Q")[0]
1611 obj.metadata_match = reader.read("!Q")[0]
1612 obj.metadata_write = reader.read("!Q")[0]
1613 obj.instructions = reader.read("!L")[0]
1614 obj.config = reader.read("!L")[0]
1615 obj.max_entries = reader.read("!L")[0]
1616 obj.active_count = reader.read("!L")[0]
1617 obj.lookup_count = reader.read("!Q")[0]
1618 obj.matched_count = reader.read("!Q")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001619 return obj
1620
1621 def __eq__(self, other):
1622 if type(self) != type(other): return False
1623 if self.table_id != other.table_id: return False
1624 if self.name != other.name: return False
1625 if self.match != other.match: return False
1626 if self.wildcards != other.wildcards: return False
1627 if self.write_actions != other.write_actions: return False
1628 if self.apply_actions != other.apply_actions: return False
1629 if self.write_setfields != other.write_setfields: return False
1630 if self.apply_setfields != other.apply_setfields: return False
1631 if self.metadata_match != other.metadata_match: return False
1632 if self.metadata_write != other.metadata_write: return False
1633 if self.instructions != other.instructions: return False
1634 if self.config != other.config: return False
1635 if self.max_entries != other.max_entries: return False
1636 if self.active_count != other.active_count: return False
1637 if self.lookup_count != other.lookup_count: return False
1638 if self.matched_count != other.matched_count: return False
1639 return True
1640
Rich Lanec2ee4b82013-04-24 17:12:38 -07001641 def pretty_print(self, q):
1642 q.text("table_stats_entry {")
1643 with q.group():
1644 with q.indent(2):
1645 q.breakable()
1646 q.text("table_id = ");
1647 q.text("%#x" % self.table_id)
1648 q.text(","); q.breakable()
1649 q.text("name = ");
1650 q.pp(self.name)
1651 q.text(","); q.breakable()
1652 q.text("match = ");
1653 q.pp(self.match)
1654 q.text(","); q.breakable()
1655 q.text("wildcards = ");
1656 q.pp(self.wildcards)
1657 q.text(","); q.breakable()
1658 q.text("write_actions = ");
1659 q.text("%#x" % self.write_actions)
1660 q.text(","); q.breakable()
1661 q.text("apply_actions = ");
1662 q.text("%#x" % self.apply_actions)
1663 q.text(","); q.breakable()
1664 q.text("write_setfields = ");
1665 q.text("%#x" % self.write_setfields)
1666 q.text(","); q.breakable()
1667 q.text("apply_setfields = ");
1668 q.text("%#x" % self.apply_setfields)
1669 q.text(","); q.breakable()
1670 q.text("metadata_match = ");
1671 q.text("%#x" % self.metadata_match)
1672 q.text(","); q.breakable()
1673 q.text("metadata_write = ");
1674 q.text("%#x" % self.metadata_write)
1675 q.text(","); q.breakable()
1676 q.text("instructions = ");
1677 q.text("%#x" % self.instructions)
1678 q.text(","); q.breakable()
1679 q.text("config = ");
1680 q.text("%#x" % self.config)
1681 q.text(","); q.breakable()
1682 q.text("max_entries = ");
1683 q.text("%#x" % self.max_entries)
1684 q.text(","); q.breakable()
1685 q.text("active_count = ");
1686 q.text("%#x" % self.active_count)
1687 q.text(","); q.breakable()
1688 q.text("lookup_count = ");
1689 q.text("%#x" % self.lookup_count)
1690 q.text(","); q.breakable()
1691 q.text("matched_count = ");
1692 q.text("%#x" % self.matched_count)
1693 q.breakable()
1694 q.text('}')
1695
1696
Rich Lane7dcdf022013-12-11 14:45:27 -08001697
Rich Lanec2ee4b82013-04-24 17:12:38 -07001698match = match_v3