blob: cba725ff1779e45d984b9673ef2bec28e0a1c807 [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 Lanef9530c42014-09-15 09:59:43 -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, rate_limit=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
Rich Lanef9530c42014-09-15 09:59:43 -0700178 if rate_limit != None:
179 self.rate_limit = rate_limit
180 else:
181 self.rate_limit = 0
Rich Lane93b33132014-04-21 12:20:58 -0700182 if if_name != None:
183 self.if_name = if_name
184 else:
185 self.if_name = ""
186 return
187
188 def pack(self):
189 packed = []
190 packed.append(struct.pack("!H", self.type))
191 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
192 packed.append(struct.pack("!L", self.flags))
193 packed.append(util.pack_port_no(self.port_no))
Rich Lane5587ab12014-06-30 11:19:09 -0700194 packed.append(util.pack_port_no(self.loopback_port_no))
Rich Lane93b33132014-04-21 12:20:58 -0700195 packed.append(struct.pack("!6B", *self.local_mac))
196 packed.append(struct.pack("!6B", *self.nh_mac))
197 packed.append(struct.pack("!L", self.src_ip))
198 packed.append(struct.pack("!L", self.dst_ip))
199 packed.append(struct.pack("!B", self.dscp))
200 packed.append(struct.pack("!B", self.ttl))
201 packed.append('\x00' * 2)
202 packed.append(struct.pack("!L", self.vpn))
Rich Lanef9530c42014-09-15 09:59:43 -0700203 packed.append(struct.pack("!L", self.rate_limit))
Rich Lane93b33132014-04-21 12:20:58 -0700204 packed.append(struct.pack("!16s", self.if_name))
205 length = sum([len(x) for x in packed])
206 packed[1] = struct.pack("!H", length)
207 return ''.join(packed)
208
209 @staticmethod
210 def unpack(reader):
211 obj = bsn_vport_l2gre()
212 _type = reader.read("!H")[0]
213 assert(_type == 1)
214 _length = reader.read("!H")[0]
215 orig_reader = reader
216 reader = orig_reader.slice(_length - (2 + 2))
217 obj.flags = reader.read("!L")[0]
218 obj.port_no = util.unpack_port_no(reader)
Rich Lane5587ab12014-06-30 11:19:09 -0700219 obj.loopback_port_no = util.unpack_port_no(reader)
Rich Lane93b33132014-04-21 12:20:58 -0700220 obj.local_mac = list(reader.read('!6B'))
221 obj.nh_mac = list(reader.read('!6B'))
222 obj.src_ip = reader.read("!L")[0]
223 obj.dst_ip = reader.read("!L")[0]
224 obj.dscp = reader.read("!B")[0]
225 obj.ttl = reader.read("!B")[0]
226 reader.skip(2)
227 obj.vpn = reader.read("!L")[0]
Rich Lanef9530c42014-09-15 09:59:43 -0700228 obj.rate_limit = reader.read("!L")[0]
Rich Lane93b33132014-04-21 12:20:58 -0700229 obj.if_name = reader.read("!16s")[0].rstrip("\x00")
230 return obj
231
232 def __eq__(self, other):
233 if type(self) != type(other): return False
234 if self.flags != other.flags: return False
235 if self.port_no != other.port_no: return False
Rich Lane5587ab12014-06-30 11:19:09 -0700236 if self.loopback_port_no != other.loopback_port_no: return False
Rich Lane93b33132014-04-21 12:20:58 -0700237 if self.local_mac != other.local_mac: return False
238 if self.nh_mac != other.nh_mac: return False
239 if self.src_ip != other.src_ip: return False
240 if self.dst_ip != other.dst_ip: return False
241 if self.dscp != other.dscp: return False
242 if self.ttl != other.ttl: return False
243 if self.vpn != other.vpn: return False
Rich Lanef9530c42014-09-15 09:59:43 -0700244 if self.rate_limit != other.rate_limit: return False
Rich Lane93b33132014-04-21 12:20:58 -0700245 if self.if_name != other.if_name: return False
246 return True
247
248 def pretty_print(self, q):
249 q.text("bsn_vport_l2gre {")
250 with q.group():
251 with q.indent(2):
252 q.breakable()
253 q.text("flags = ");
254 q.text("%#x" % self.flags)
255 q.text(","); q.breakable()
256 q.text("port_no = ");
257 q.text(util.pretty_port(self.port_no))
258 q.text(","); q.breakable()
Rich Lane5587ab12014-06-30 11:19:09 -0700259 q.text("loopback_port_no = ");
260 q.text(util.pretty_port(self.loopback_port_no))
261 q.text(","); q.breakable()
Rich Lane93b33132014-04-21 12:20:58 -0700262 q.text("local_mac = ");
263 q.text(util.pretty_mac(self.local_mac))
264 q.text(","); q.breakable()
265 q.text("nh_mac = ");
266 q.text(util.pretty_mac(self.nh_mac))
267 q.text(","); q.breakable()
268 q.text("src_ip = ");
269 q.text(util.pretty_ipv4(self.src_ip))
270 q.text(","); q.breakable()
271 q.text("dst_ip = ");
272 q.text(util.pretty_ipv4(self.dst_ip))
273 q.text(","); q.breakable()
274 q.text("dscp = ");
275 q.text("%#x" % self.dscp)
276 q.text(","); q.breakable()
277 q.text("ttl = ");
278 q.text("%#x" % self.ttl)
279 q.text(","); q.breakable()
280 q.text("vpn = ");
281 q.text("%#x" % self.vpn)
282 q.text(","); q.breakable()
Rich Lanef9530c42014-09-15 09:59:43 -0700283 q.text("rate_limit = ");
284 q.text("%#x" % self.rate_limit)
285 q.text(","); q.breakable()
Rich Lane93b33132014-04-21 12:20:58 -0700286 q.text("if_name = ");
287 q.pp(self.if_name)
288 q.breakable()
289 q.text('}')
290
291bsn_vport.subtypes[1] = bsn_vport_l2gre
292
Rich Lane7dcdf022013-12-11 14:45:27 -0800293class bsn_vport_q_in_q(bsn_vport):
Dan Talaycof6202252013-07-02 01:00:29 -0700294 type = 0
295
Kiran Poola150d8b02013-09-20 13:30:39 -0700296 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 -0700297 if port_no != None:
298 self.port_no = port_no
299 else:
300 self.port_no = 0
301 if ingress_tpid != None:
302 self.ingress_tpid = ingress_tpid
303 else:
304 self.ingress_tpid = 0
305 if ingress_vlan_id != None:
306 self.ingress_vlan_id = ingress_vlan_id
307 else:
308 self.ingress_vlan_id = 0
309 if egress_tpid != None:
310 self.egress_tpid = egress_tpid
311 else:
312 self.egress_tpid = 0
313 if egress_vlan_id != None:
314 self.egress_vlan_id = egress_vlan_id
315 else:
316 self.egress_vlan_id = 0
Kiran Poola150d8b02013-09-20 13:30:39 -0700317 if if_name != None:
318 self.if_name = if_name
319 else:
320 self.if_name = ""
Dan Talaycof6202252013-07-02 01:00:29 -0700321 return
322
323 def pack(self):
324 packed = []
325 packed.append(struct.pack("!H", self.type))
Kiran Poola150d8b02013-09-20 13:30:39 -0700326 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
Dan Talaycof6202252013-07-02 01:00:29 -0700327 packed.append(struct.pack("!L", self.port_no))
328 packed.append(struct.pack("!H", self.ingress_tpid))
329 packed.append(struct.pack("!H", self.ingress_vlan_id))
330 packed.append(struct.pack("!H", self.egress_tpid))
331 packed.append(struct.pack("!H", self.egress_vlan_id))
Kiran Poola150d8b02013-09-20 13:30:39 -0700332 packed.append(struct.pack("!16s", self.if_name))
Dan Talaycof6202252013-07-02 01:00:29 -0700333 length = sum([len(x) for x in packed])
Kiran Poola150d8b02013-09-20 13:30:39 -0700334 packed[1] = struct.pack("!H", length)
Dan Talaycof6202252013-07-02 01:00:29 -0700335 return ''.join(packed)
336
337 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800338 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -0700339 obj = bsn_vport_q_in_q()
Dan Talaycof6202252013-07-02 01:00:29 -0700340 _type = reader.read("!H")[0]
341 assert(_type == 0)
342 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800343 orig_reader = reader
344 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700345 obj.port_no = reader.read("!L")[0]
346 obj.ingress_tpid = reader.read("!H")[0]
347 obj.ingress_vlan_id = reader.read("!H")[0]
348 obj.egress_tpid = reader.read("!H")[0]
349 obj.egress_vlan_id = reader.read("!H")[0]
Kiran Poola150d8b02013-09-20 13:30:39 -0700350 obj.if_name = reader.read("!16s")[0].rstrip("\x00")
Dan Talaycof6202252013-07-02 01:00:29 -0700351 return obj
352
353 def __eq__(self, other):
354 if type(self) != type(other): return False
355 if self.port_no != other.port_no: return False
356 if self.ingress_tpid != other.ingress_tpid: return False
357 if self.ingress_vlan_id != other.ingress_vlan_id: return False
358 if self.egress_tpid != other.egress_tpid: return False
359 if self.egress_vlan_id != other.egress_vlan_id: return False
Kiran Poola150d8b02013-09-20 13:30:39 -0700360 if self.if_name != other.if_name: return False
Dan Talaycof6202252013-07-02 01:00:29 -0700361 return True
362
Dan Talaycof6202252013-07-02 01:00:29 -0700363 def pretty_print(self, q):
364 q.text("bsn_vport_q_in_q {")
365 with q.group():
366 with q.indent(2):
367 q.breakable()
368 q.text("port_no = ");
369 q.text("%#x" % self.port_no)
370 q.text(","); q.breakable()
371 q.text("ingress_tpid = ");
372 q.text("%#x" % self.ingress_tpid)
373 q.text(","); q.breakable()
374 q.text("ingress_vlan_id = ");
375 q.text("%#x" % self.ingress_vlan_id)
376 q.text(","); q.breakable()
377 q.text("egress_tpid = ");
378 q.text("%#x" % self.egress_tpid)
379 q.text(","); q.breakable()
380 q.text("egress_vlan_id = ");
381 q.text("%#x" % self.egress_vlan_id)
Kiran Poola150d8b02013-09-20 13:30:39 -0700382 q.text(","); q.breakable()
383 q.text("if_name = ");
384 q.pp(self.if_name)
Dan Talaycof6202252013-07-02 01:00:29 -0700385 q.breakable()
386 q.text('}')
387
Rich Lane7dcdf022013-12-11 14:45:27 -0800388bsn_vport.subtypes[0] = bsn_vport_q_in_q
389
390class bucket(loxi.OFObject):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700391
392 def __init__(self, weight=None, watch_port=None, watch_group=None, actions=None):
393 if weight != None:
394 self.weight = weight
395 else:
396 self.weight = 0
397 if watch_port != None:
398 self.watch_port = watch_port
399 else:
400 self.watch_port = 0
401 if watch_group != None:
402 self.watch_group = watch_group
403 else:
404 self.watch_group = 0
405 if actions != None:
406 self.actions = actions
407 else:
408 self.actions = []
409 return
410
411 def pack(self):
412 packed = []
413 packed.append(struct.pack("!H", 0)) # placeholder for len at index 0
414 packed.append(struct.pack("!H", self.weight))
Dan Talaycof6202252013-07-02 01:00:29 -0700415 packed.append(util.pack_port_no(self.watch_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700416 packed.append(struct.pack("!L", self.watch_group))
417 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -0800418 packed.append(loxi.generic_util.pack_list(self.actions))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700419 length = sum([len(x) for x in packed])
420 packed[0] = struct.pack("!H", length)
421 return ''.join(packed)
422
423 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800424 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700425 obj = bucket()
Dan Talaycof6202252013-07-02 01:00:29 -0700426 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800427 orig_reader = reader
428 reader = orig_reader.slice(_len - (0 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700429 obj.weight = reader.read("!H")[0]
430 obj.watch_port = util.unpack_port_no(reader)
431 obj.watch_group = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700432 reader.skip(4)
Rich Lane7dcdf022013-12-11 14:45:27 -0800433 obj.actions = loxi.generic_util.unpack_list(reader, action.action.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -0700434 return obj
435
436 def __eq__(self, other):
437 if type(self) != type(other): return False
438 if self.weight != other.weight: return False
439 if self.watch_port != other.watch_port: return False
440 if self.watch_group != other.watch_group: return False
441 if self.actions != other.actions: return False
442 return True
443
Rich Lanec2ee4b82013-04-24 17:12:38 -0700444 def pretty_print(self, q):
445 q.text("bucket {")
446 with q.group():
447 with q.indent(2):
448 q.breakable()
449 q.text("weight = ");
450 q.text("%#x" % self.weight)
451 q.text(","); q.breakable()
452 q.text("watch_port = ");
453 q.text(util.pretty_port(self.watch_port))
454 q.text(","); q.breakable()
455 q.text("watch_group = ");
456 q.text("%#x" % self.watch_group)
457 q.text(","); q.breakable()
458 q.text("actions = ");
459 q.pp(self.actions)
460 q.breakable()
461 q.text('}')
462
Rich Lane7dcdf022013-12-11 14:45:27 -0800463
464class bucket_counter(loxi.OFObject):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700465
466 def __init__(self, packet_count=None, byte_count=None):
467 if packet_count != None:
468 self.packet_count = packet_count
469 else:
470 self.packet_count = 0
471 if byte_count != None:
472 self.byte_count = byte_count
473 else:
474 self.byte_count = 0
475 return
476
477 def pack(self):
478 packed = []
479 packed.append(struct.pack("!Q", self.packet_count))
480 packed.append(struct.pack("!Q", self.byte_count))
481 return ''.join(packed)
482
483 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800484 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700485 obj = bucket_counter()
Dan Talaycof6202252013-07-02 01:00:29 -0700486 obj.packet_count = reader.read("!Q")[0]
487 obj.byte_count = reader.read("!Q")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700488 return obj
489
490 def __eq__(self, other):
491 if type(self) != type(other): return False
492 if self.packet_count != other.packet_count: return False
493 if self.byte_count != other.byte_count: return False
494 return True
495
Rich Lanec2ee4b82013-04-24 17:12:38 -0700496 def pretty_print(self, q):
497 q.text("bucket_counter {")
498 with q.group():
499 with q.indent(2):
500 q.breakable()
501 q.text("packet_count = ");
502 q.text("%#x" % self.packet_count)
503 q.text(","); q.breakable()
504 q.text("byte_count = ");
505 q.text("%#x" % self.byte_count)
506 q.breakable()
507 q.text('}')
508
Rich Lane7dcdf022013-12-11 14:45:27 -0800509
510class flow_stats_entry(loxi.OFObject):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700511
512 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):
513 if table_id != None:
514 self.table_id = table_id
515 else:
516 self.table_id = 0
517 if duration_sec != None:
518 self.duration_sec = duration_sec
519 else:
520 self.duration_sec = 0
521 if duration_nsec != None:
522 self.duration_nsec = duration_nsec
523 else:
524 self.duration_nsec = 0
525 if priority != None:
526 self.priority = priority
527 else:
528 self.priority = 0
529 if idle_timeout != None:
530 self.idle_timeout = idle_timeout
531 else:
532 self.idle_timeout = 0
533 if hard_timeout != None:
534 self.hard_timeout = hard_timeout
535 else:
536 self.hard_timeout = 0
537 if cookie != None:
538 self.cookie = cookie
539 else:
540 self.cookie = 0
541 if packet_count != None:
542 self.packet_count = packet_count
543 else:
544 self.packet_count = 0
545 if byte_count != None:
546 self.byte_count = byte_count
547 else:
548 self.byte_count = 0
549 if match != None:
550 self.match = match
551 else:
552 self.match = common.match()
553 if instructions != None:
554 self.instructions = instructions
555 else:
556 self.instructions = []
557 return
558
559 def pack(self):
560 packed = []
561 packed.append(struct.pack("!H", 0)) # placeholder for length at index 0
562 packed.append(struct.pack("!B", self.table_id))
563 packed.append('\x00' * 1)
564 packed.append(struct.pack("!L", self.duration_sec))
565 packed.append(struct.pack("!L", self.duration_nsec))
566 packed.append(struct.pack("!H", self.priority))
567 packed.append(struct.pack("!H", self.idle_timeout))
568 packed.append(struct.pack("!H", self.hard_timeout))
569 packed.append('\x00' * 6)
570 packed.append(struct.pack("!Q", self.cookie))
571 packed.append(struct.pack("!Q", self.packet_count))
572 packed.append(struct.pack("!Q", self.byte_count))
573 packed.append(self.match.pack())
Rich Lane7dcdf022013-12-11 14:45:27 -0800574 packed.append(loxi.generic_util.pack_list(self.instructions))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700575 length = sum([len(x) for x in packed])
576 packed[0] = struct.pack("!H", length)
577 return ''.join(packed)
578
579 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800580 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700581 obj = flow_stats_entry()
Dan Talaycof6202252013-07-02 01:00:29 -0700582 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800583 orig_reader = reader
584 reader = orig_reader.slice(_length - (0 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -0700585 obj.table_id = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700586 reader.skip(1)
Dan Talaycof6202252013-07-02 01:00:29 -0700587 obj.duration_sec = reader.read("!L")[0]
588 obj.duration_nsec = reader.read("!L")[0]
589 obj.priority = reader.read("!H")[0]
590 obj.idle_timeout = reader.read("!H")[0]
591 obj.hard_timeout = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700592 reader.skip(6)
Dan Talaycof6202252013-07-02 01:00:29 -0700593 obj.cookie = reader.read("!Q")[0]
594 obj.packet_count = reader.read("!Q")[0]
595 obj.byte_count = reader.read("!Q")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700596 obj.match = common.match.unpack(reader)
Rich Lane7dcdf022013-12-11 14:45:27 -0800597 obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -0700598 return obj
599
600 def __eq__(self, other):
601 if type(self) != type(other): return False
602 if self.table_id != other.table_id: return False
603 if self.duration_sec != other.duration_sec: return False
604 if self.duration_nsec != other.duration_nsec: return False
605 if self.priority != other.priority: return False
606 if self.idle_timeout != other.idle_timeout: return False
607 if self.hard_timeout != other.hard_timeout: return False
608 if self.cookie != other.cookie: return False
609 if self.packet_count != other.packet_count: return False
610 if self.byte_count != other.byte_count: return False
611 if self.match != other.match: return False
612 if self.instructions != other.instructions: return False
613 return True
614
Rich Lanec2ee4b82013-04-24 17:12:38 -0700615 def pretty_print(self, q):
616 q.text("flow_stats_entry {")
617 with q.group():
618 with q.indent(2):
619 q.breakable()
620 q.text("table_id = ");
621 q.text("%#x" % self.table_id)
622 q.text(","); q.breakable()
623 q.text("duration_sec = ");
624 q.text("%#x" % self.duration_sec)
625 q.text(","); q.breakable()
626 q.text("duration_nsec = ");
627 q.text("%#x" % self.duration_nsec)
628 q.text(","); q.breakable()
629 q.text("priority = ");
630 q.text("%#x" % self.priority)
631 q.text(","); q.breakable()
632 q.text("idle_timeout = ");
633 q.text("%#x" % self.idle_timeout)
634 q.text(","); q.breakable()
635 q.text("hard_timeout = ");
636 q.text("%#x" % self.hard_timeout)
637 q.text(","); q.breakable()
638 q.text("cookie = ");
639 q.text("%#x" % self.cookie)
640 q.text(","); q.breakable()
641 q.text("packet_count = ");
642 q.text("%#x" % self.packet_count)
643 q.text(","); q.breakable()
644 q.text("byte_count = ");
645 q.text("%#x" % self.byte_count)
646 q.text(","); q.breakable()
647 q.text("match = ");
648 q.pp(self.match)
649 q.text(","); q.breakable()
650 q.text("instructions = ");
651 q.pp(self.instructions)
652 q.breakable()
653 q.text('}')
654
Rich Lane7dcdf022013-12-11 14:45:27 -0800655
656class group_desc_stats_entry(loxi.OFObject):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700657
Rich Lane6f4978c2013-10-20 21:33:52 -0700658 def __init__(self, group_type=None, group_id=None, buckets=None):
659 if group_type != None:
660 self.group_type = group_type
Rich Lanec2ee4b82013-04-24 17:12:38 -0700661 else:
Rich Lane6f4978c2013-10-20 21:33:52 -0700662 self.group_type = 0
Rich Lanec2ee4b82013-04-24 17:12:38 -0700663 if group_id != None:
664 self.group_id = group_id
665 else:
666 self.group_id = 0
667 if buckets != None:
668 self.buckets = buckets
669 else:
670 self.buckets = []
671 return
672
673 def pack(self):
674 packed = []
675 packed.append(struct.pack("!H", 0)) # placeholder for length at index 0
Rich Lane6f4978c2013-10-20 21:33:52 -0700676 packed.append(struct.pack("!B", self.group_type))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700677 packed.append('\x00' * 1)
678 packed.append(struct.pack("!L", self.group_id))
Rich Lane7dcdf022013-12-11 14:45:27 -0800679 packed.append(loxi.generic_util.pack_list(self.buckets))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700680 length = sum([len(x) for x in packed])
681 packed[0] = struct.pack("!H", length)
682 return ''.join(packed)
683
684 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800685 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700686 obj = group_desc_stats_entry()
Dan Talaycof6202252013-07-02 01:00:29 -0700687 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800688 orig_reader = reader
689 reader = orig_reader.slice(_length - (0 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -0700690 obj.group_type = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700691 reader.skip(1)
Dan Talaycof6202252013-07-02 01:00:29 -0700692 obj.group_id = reader.read("!L")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800693 obj.buckets = loxi.generic_util.unpack_list(reader, common.bucket.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -0700694 return obj
695
696 def __eq__(self, other):
697 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -0700698 if self.group_type != other.group_type: return False
Rich Lanec2ee4b82013-04-24 17:12:38 -0700699 if self.group_id != other.group_id: return False
700 if self.buckets != other.buckets: return False
701 return True
702
Rich Lanec2ee4b82013-04-24 17:12:38 -0700703 def pretty_print(self, q):
704 q.text("group_desc_stats_entry {")
705 with q.group():
706 with q.indent(2):
707 q.breakable()
Rich Lane6f4978c2013-10-20 21:33:52 -0700708 q.text("group_type = ");
709 q.text("%#x" % self.group_type)
Rich Lanec2ee4b82013-04-24 17:12:38 -0700710 q.text(","); q.breakable()
711 q.text("group_id = ");
712 q.text("%#x" % self.group_id)
713 q.text(","); q.breakable()
714 q.text("buckets = ");
715 q.pp(self.buckets)
716 q.breakable()
717 q.text('}')
718
Rich Lane7dcdf022013-12-11 14:45:27 -0800719
720class group_stats_entry(loxi.OFObject):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700721
722 def __init__(self, group_id=None, ref_count=None, packet_count=None, byte_count=None, bucket_stats=None):
723 if group_id != None:
724 self.group_id = group_id
725 else:
726 self.group_id = 0
727 if ref_count != None:
728 self.ref_count = ref_count
729 else:
730 self.ref_count = 0
731 if packet_count != None:
732 self.packet_count = packet_count
733 else:
734 self.packet_count = 0
735 if byte_count != None:
736 self.byte_count = byte_count
737 else:
738 self.byte_count = 0
739 if bucket_stats != None:
740 self.bucket_stats = bucket_stats
741 else:
742 self.bucket_stats = []
743 return
744
745 def pack(self):
746 packed = []
747 packed.append(struct.pack("!H", 0)) # placeholder for length at index 0
748 packed.append('\x00' * 2)
749 packed.append(struct.pack("!L", self.group_id))
750 packed.append(struct.pack("!L", self.ref_count))
751 packed.append('\x00' * 4)
752 packed.append(struct.pack("!Q", self.packet_count))
753 packed.append(struct.pack("!Q", self.byte_count))
Rich Lane7dcdf022013-12-11 14:45:27 -0800754 packed.append(loxi.generic_util.pack_list(self.bucket_stats))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700755 length = sum([len(x) for x in packed])
756 packed[0] = struct.pack("!H", length)
757 return ''.join(packed)
758
759 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800760 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700761 obj = group_stats_entry()
Dan Talaycof6202252013-07-02 01:00:29 -0700762 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800763 orig_reader = reader
764 reader = orig_reader.slice(_length - (0 + 2))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700765 reader.skip(2)
Dan Talaycof6202252013-07-02 01:00:29 -0700766 obj.group_id = reader.read("!L")[0]
767 obj.ref_count = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700768 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -0700769 obj.packet_count = reader.read("!Q")[0]
770 obj.byte_count = reader.read("!Q")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700771 obj.bucket_stats = loxi.generic_util.unpack_list(reader, common.bucket_counter.unpack)
772 return obj
773
774 def __eq__(self, other):
775 if type(self) != type(other): return False
776 if self.group_id != other.group_id: return False
777 if self.ref_count != other.ref_count: return False
778 if self.packet_count != other.packet_count: return False
779 if self.byte_count != other.byte_count: return False
780 if self.bucket_stats != other.bucket_stats: return False
781 return True
782
Rich Lanec2ee4b82013-04-24 17:12:38 -0700783 def pretty_print(self, q):
784 q.text("group_stats_entry {")
785 with q.group():
786 with q.indent(2):
787 q.breakable()
788 q.text("group_id = ");
789 q.text("%#x" % self.group_id)
790 q.text(","); q.breakable()
791 q.text("ref_count = ");
792 q.text("%#x" % self.ref_count)
793 q.text(","); q.breakable()
794 q.text("packet_count = ");
795 q.text("%#x" % self.packet_count)
796 q.text(","); q.breakable()
797 q.text("byte_count = ");
798 q.text("%#x" % self.byte_count)
799 q.text(","); q.breakable()
800 q.text("bucket_stats = ");
801 q.pp(self.bucket_stats)
802 q.breakable()
803 q.text('}')
804
Rich Lane7dcdf022013-12-11 14:45:27 -0800805
806class match_v3(loxi.OFObject):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700807 type = 1
808
809 def __init__(self, oxm_list=None):
810 if oxm_list != None:
811 self.oxm_list = oxm_list
812 else:
813 self.oxm_list = []
814 return
815
816 def pack(self):
817 packed = []
818 packed.append(struct.pack("!H", self.type))
819 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
Rich Lane7dcdf022013-12-11 14:45:27 -0800820 packed.append(loxi.generic_util.pack_list(self.oxm_list))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700821 length = sum([len(x) for x in packed])
822 packed[1] = struct.pack("!H", length)
Rich Laned53156a2013-08-05 17:17:33 -0700823 packed.append(loxi.generic_util.pad_to(8, length))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700824 return ''.join(packed)
825
826 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800827 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700828 obj = match_v3()
Dan Talaycof6202252013-07-02 01:00:29 -0700829 _type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700830 assert(_type == 1)
Dan Talaycof6202252013-07-02 01:00:29 -0700831 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800832 orig_reader = reader
833 reader = orig_reader.slice(_length - (2 + 2))
834 obj.oxm_list = loxi.generic_util.unpack_list(reader, oxm.oxm.unpack)
835 orig_reader.skip_align()
Rich Lanec2ee4b82013-04-24 17:12:38 -0700836 return obj
837
838 def __eq__(self, other):
839 if type(self) != type(other): return False
840 if self.oxm_list != other.oxm_list: return False
841 return True
842
Rich Lanec2ee4b82013-04-24 17:12:38 -0700843 def pretty_print(self, q):
844 q.text("match_v3 {")
845 with q.group():
846 with q.indent(2):
847 q.breakable()
848 q.text("oxm_list = ");
849 q.pp(self.oxm_list)
850 q.breakable()
851 q.text('}')
852
Rich Lane7dcdf022013-12-11 14:45:27 -0800853
854class packet_queue(loxi.OFObject):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700855
856 def __init__(self, queue_id=None, port=None, properties=None):
857 if queue_id != None:
858 self.queue_id = queue_id
859 else:
860 self.queue_id = 0
861 if port != None:
862 self.port = port
863 else:
864 self.port = 0
865 if properties != None:
866 self.properties = properties
867 else:
868 self.properties = []
869 return
870
871 def pack(self):
872 packed = []
873 packed.append(struct.pack("!L", self.queue_id))
Dan Talaycof6202252013-07-02 01:00:29 -0700874 packed.append(util.pack_port_no(self.port))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700875 packed.append(struct.pack("!H", 0)) # placeholder for len at index 2
876 packed.append('\x00' * 6)
Rich Lane7dcdf022013-12-11 14:45:27 -0800877 packed.append(loxi.generic_util.pack_list(self.properties))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700878 length = sum([len(x) for x in packed])
879 packed[2] = struct.pack("!H", length)
880 return ''.join(packed)
881
882 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800883 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700884 obj = packet_queue()
Dan Talaycof6202252013-07-02 01:00:29 -0700885 obj.queue_id = reader.read("!L")[0]
886 obj.port = util.unpack_port_no(reader)
887 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -0800888 orig_reader = reader
889 reader = orig_reader.slice(_len - (8 + 2))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700890 reader.skip(6)
Rich Lane7dcdf022013-12-11 14:45:27 -0800891 obj.properties = loxi.generic_util.unpack_list(reader, common.queue_prop.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -0700892 return obj
893
894 def __eq__(self, other):
895 if type(self) != type(other): return False
896 if self.queue_id != other.queue_id: return False
897 if self.port != other.port: return False
898 if self.properties != other.properties: return False
899 return True
900
Rich Lanec2ee4b82013-04-24 17:12:38 -0700901 def pretty_print(self, q):
902 q.text("packet_queue {")
903 with q.group():
904 with q.indent(2):
905 q.breakable()
906 q.text("queue_id = ");
907 q.text("%#x" % self.queue_id)
908 q.text(","); q.breakable()
909 q.text("port = ");
910 q.text(util.pretty_port(self.port))
911 q.text(","); q.breakable()
912 q.text("properties = ");
913 q.pp(self.properties)
914 q.breakable()
915 q.text('}')
916
Rich Lane7dcdf022013-12-11 14:45:27 -0800917
918class port_desc(loxi.OFObject):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700919
920 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):
921 if port_no != None:
922 self.port_no = port_no
923 else:
924 self.port_no = 0
925 if hw_addr != None:
926 self.hw_addr = hw_addr
927 else:
928 self.hw_addr = [0,0,0,0,0,0]
929 if name != None:
930 self.name = name
931 else:
932 self.name = ""
933 if config != None:
934 self.config = config
935 else:
936 self.config = 0
937 if state != None:
938 self.state = state
939 else:
940 self.state = 0
941 if curr != None:
942 self.curr = curr
943 else:
944 self.curr = 0
945 if advertised != None:
946 self.advertised = advertised
947 else:
948 self.advertised = 0
949 if supported != None:
950 self.supported = supported
951 else:
952 self.supported = 0
953 if peer != None:
954 self.peer = peer
955 else:
956 self.peer = 0
957 if curr_speed != None:
958 self.curr_speed = curr_speed
959 else:
960 self.curr_speed = 0
961 if max_speed != None:
962 self.max_speed = max_speed
963 else:
964 self.max_speed = 0
965 return
966
967 def pack(self):
968 packed = []
Dan Talaycof6202252013-07-02 01:00:29 -0700969 packed.append(util.pack_port_no(self.port_no))
Rich Lanec2ee4b82013-04-24 17:12:38 -0700970 packed.append('\x00' * 4)
971 packed.append(struct.pack("!6B", *self.hw_addr))
972 packed.append('\x00' * 2)
973 packed.append(struct.pack("!16s", self.name))
974 packed.append(struct.pack("!L", self.config))
975 packed.append(struct.pack("!L", self.state))
976 packed.append(struct.pack("!L", self.curr))
977 packed.append(struct.pack("!L", self.advertised))
978 packed.append(struct.pack("!L", self.supported))
979 packed.append(struct.pack("!L", self.peer))
980 packed.append(struct.pack("!L", self.curr_speed))
981 packed.append(struct.pack("!L", self.max_speed))
982 return ''.join(packed)
983
984 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800985 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700986 obj = port_desc()
Dan Talaycof6202252013-07-02 01:00:29 -0700987 obj.port_no = util.unpack_port_no(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -0700988 reader.skip(4)
989 obj.hw_addr = list(reader.read('!6B'))
990 reader.skip(2)
991 obj.name = reader.read("!16s")[0].rstrip("\x00")
Dan Talaycof6202252013-07-02 01:00:29 -0700992 obj.config = reader.read("!L")[0]
993 obj.state = reader.read("!L")[0]
994 obj.curr = reader.read("!L")[0]
995 obj.advertised = reader.read("!L")[0]
996 obj.supported = reader.read("!L")[0]
997 obj.peer = reader.read("!L")[0]
998 obj.curr_speed = reader.read("!L")[0]
999 obj.max_speed = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001000 return obj
1001
1002 def __eq__(self, other):
1003 if type(self) != type(other): return False
1004 if self.port_no != other.port_no: return False
1005 if self.hw_addr != other.hw_addr: return False
1006 if self.name != other.name: return False
1007 if self.config != other.config: return False
1008 if self.state != other.state: return False
1009 if self.curr != other.curr: return False
1010 if self.advertised != other.advertised: return False
1011 if self.supported != other.supported: return False
1012 if self.peer != other.peer: return False
1013 if self.curr_speed != other.curr_speed: return False
1014 if self.max_speed != other.max_speed: return False
1015 return True
1016
Rich Lanec2ee4b82013-04-24 17:12:38 -07001017 def pretty_print(self, q):
1018 q.text("port_desc {")
1019 with q.group():
1020 with q.indent(2):
1021 q.breakable()
1022 q.text("port_no = ");
1023 q.text(util.pretty_port(self.port_no))
1024 q.text(","); q.breakable()
1025 q.text("hw_addr = ");
1026 q.text(util.pretty_mac(self.hw_addr))
1027 q.text(","); q.breakable()
1028 q.text("name = ");
1029 q.pp(self.name)
1030 q.text(","); q.breakable()
1031 q.text("config = ");
1032 q.text("%#x" % self.config)
1033 q.text(","); q.breakable()
1034 q.text("state = ");
1035 q.text("%#x" % self.state)
1036 q.text(","); q.breakable()
1037 q.text("curr = ");
1038 q.text("%#x" % self.curr)
1039 q.text(","); q.breakable()
1040 q.text("advertised = ");
1041 q.text("%#x" % self.advertised)
1042 q.text(","); q.breakable()
1043 q.text("supported = ");
1044 q.text("%#x" % self.supported)
1045 q.text(","); q.breakable()
1046 q.text("peer = ");
1047 q.text("%#x" % self.peer)
1048 q.text(","); q.breakable()
1049 q.text("curr_speed = ");
1050 q.text("%#x" % self.curr_speed)
1051 q.text(","); q.breakable()
1052 q.text("max_speed = ");
1053 q.text("%#x" % self.max_speed)
1054 q.breakable()
1055 q.text('}')
1056
Rich Lane7dcdf022013-12-11 14:45:27 -08001057
1058class port_stats_entry(loxi.OFObject):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001059
1060 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):
1061 if port_no != None:
1062 self.port_no = port_no
1063 else:
1064 self.port_no = 0
1065 if rx_packets != None:
1066 self.rx_packets = rx_packets
1067 else:
1068 self.rx_packets = 0
1069 if tx_packets != None:
1070 self.tx_packets = tx_packets
1071 else:
1072 self.tx_packets = 0
1073 if rx_bytes != None:
1074 self.rx_bytes = rx_bytes
1075 else:
1076 self.rx_bytes = 0
1077 if tx_bytes != None:
1078 self.tx_bytes = tx_bytes
1079 else:
1080 self.tx_bytes = 0
1081 if rx_dropped != None:
1082 self.rx_dropped = rx_dropped
1083 else:
1084 self.rx_dropped = 0
1085 if tx_dropped != None:
1086 self.tx_dropped = tx_dropped
1087 else:
1088 self.tx_dropped = 0
1089 if rx_errors != None:
1090 self.rx_errors = rx_errors
1091 else:
1092 self.rx_errors = 0
1093 if tx_errors != None:
1094 self.tx_errors = tx_errors
1095 else:
1096 self.tx_errors = 0
1097 if rx_frame_err != None:
1098 self.rx_frame_err = rx_frame_err
1099 else:
1100 self.rx_frame_err = 0
1101 if rx_over_err != None:
1102 self.rx_over_err = rx_over_err
1103 else:
1104 self.rx_over_err = 0
1105 if rx_crc_err != None:
1106 self.rx_crc_err = rx_crc_err
1107 else:
1108 self.rx_crc_err = 0
1109 if collisions != None:
1110 self.collisions = collisions
1111 else:
1112 self.collisions = 0
1113 return
1114
1115 def pack(self):
1116 packed = []
Dan Talaycof6202252013-07-02 01:00:29 -07001117 packed.append(util.pack_port_no(self.port_no))
Rich Lanec2ee4b82013-04-24 17:12:38 -07001118 packed.append('\x00' * 4)
1119 packed.append(struct.pack("!Q", self.rx_packets))
1120 packed.append(struct.pack("!Q", self.tx_packets))
1121 packed.append(struct.pack("!Q", self.rx_bytes))
1122 packed.append(struct.pack("!Q", self.tx_bytes))
1123 packed.append(struct.pack("!Q", self.rx_dropped))
1124 packed.append(struct.pack("!Q", self.tx_dropped))
1125 packed.append(struct.pack("!Q", self.rx_errors))
1126 packed.append(struct.pack("!Q", self.tx_errors))
1127 packed.append(struct.pack("!Q", self.rx_frame_err))
1128 packed.append(struct.pack("!Q", self.rx_over_err))
1129 packed.append(struct.pack("!Q", self.rx_crc_err))
1130 packed.append(struct.pack("!Q", self.collisions))
1131 return ''.join(packed)
1132
1133 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001134 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001135 obj = port_stats_entry()
Dan Talaycof6202252013-07-02 01:00:29 -07001136 obj.port_no = util.unpack_port_no(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -07001137 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -07001138 obj.rx_packets = reader.read("!Q")[0]
1139 obj.tx_packets = reader.read("!Q")[0]
1140 obj.rx_bytes = reader.read("!Q")[0]
1141 obj.tx_bytes = reader.read("!Q")[0]
1142 obj.rx_dropped = reader.read("!Q")[0]
1143 obj.tx_dropped = reader.read("!Q")[0]
1144 obj.rx_errors = reader.read("!Q")[0]
1145 obj.tx_errors = reader.read("!Q")[0]
1146 obj.rx_frame_err = reader.read("!Q")[0]
1147 obj.rx_over_err = reader.read("!Q")[0]
1148 obj.rx_crc_err = reader.read("!Q")[0]
1149 obj.collisions = reader.read("!Q")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001150 return obj
1151
1152 def __eq__(self, other):
1153 if type(self) != type(other): return False
1154 if self.port_no != other.port_no: return False
1155 if self.rx_packets != other.rx_packets: return False
1156 if self.tx_packets != other.tx_packets: return False
1157 if self.rx_bytes != other.rx_bytes: return False
1158 if self.tx_bytes != other.tx_bytes: return False
1159 if self.rx_dropped != other.rx_dropped: return False
1160 if self.tx_dropped != other.tx_dropped: return False
1161 if self.rx_errors != other.rx_errors: return False
1162 if self.tx_errors != other.tx_errors: return False
1163 if self.rx_frame_err != other.rx_frame_err: return False
1164 if self.rx_over_err != other.rx_over_err: return False
1165 if self.rx_crc_err != other.rx_crc_err: return False
1166 if self.collisions != other.collisions: return False
1167 return True
1168
Rich Lanec2ee4b82013-04-24 17:12:38 -07001169 def pretty_print(self, q):
1170 q.text("port_stats_entry {")
1171 with q.group():
1172 with q.indent(2):
1173 q.breakable()
1174 q.text("port_no = ");
1175 q.text(util.pretty_port(self.port_no))
1176 q.text(","); q.breakable()
1177 q.text("rx_packets = ");
1178 q.text("%#x" % self.rx_packets)
1179 q.text(","); q.breakable()
1180 q.text("tx_packets = ");
1181 q.text("%#x" % self.tx_packets)
1182 q.text(","); q.breakable()
1183 q.text("rx_bytes = ");
1184 q.text("%#x" % self.rx_bytes)
1185 q.text(","); q.breakable()
1186 q.text("tx_bytes = ");
1187 q.text("%#x" % self.tx_bytes)
1188 q.text(","); q.breakable()
1189 q.text("rx_dropped = ");
1190 q.text("%#x" % self.rx_dropped)
1191 q.text(","); q.breakable()
1192 q.text("tx_dropped = ");
1193 q.text("%#x" % self.tx_dropped)
1194 q.text(","); q.breakable()
1195 q.text("rx_errors = ");
1196 q.text("%#x" % self.rx_errors)
1197 q.text(","); q.breakable()
1198 q.text("tx_errors = ");
1199 q.text("%#x" % self.tx_errors)
1200 q.text(","); q.breakable()
1201 q.text("rx_frame_err = ");
1202 q.text("%#x" % self.rx_frame_err)
1203 q.text(","); q.breakable()
1204 q.text("rx_over_err = ");
1205 q.text("%#x" % self.rx_over_err)
1206 q.text(","); q.breakable()
1207 q.text("rx_crc_err = ");
1208 q.text("%#x" % self.rx_crc_err)
1209 q.text(","); q.breakable()
1210 q.text("collisions = ");
1211 q.text("%#x" % self.collisions)
1212 q.breakable()
1213 q.text('}')
1214
Rich Lane7dcdf022013-12-11 14:45:27 -08001215
1216class queue_prop(loxi.OFObject):
1217 subtypes = {}
1218
Rich Lane95f7fc92014-01-27 17:08:16 -08001219
1220 def __init__(self, type=None):
1221 if type != None:
1222 self.type = type
1223 else:
1224 self.type = 0
1225 return
1226
1227 def pack(self):
1228 packed = []
1229 packed.append(struct.pack("!H", self.type))
1230 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
1231 packed.append('\x00' * 4)
1232 length = sum([len(x) for x in packed])
1233 packed[1] = struct.pack("!H", length)
1234 return ''.join(packed)
1235
Rich Lane7dcdf022013-12-11 14:45:27 -08001236 @staticmethod
1237 def unpack(reader):
1238 subtype, = reader.peek('!H', 0)
Rich Lane95f7fc92014-01-27 17:08:16 -08001239 subclass = queue_prop.subtypes.get(subtype)
1240 if subclass:
1241 return subclass.unpack(reader)
1242
1243 obj = queue_prop()
1244 obj.type = reader.read("!H")[0]
1245 _len = reader.read("!H")[0]
1246 orig_reader = reader
1247 reader = orig_reader.slice(_len - (2 + 2))
1248 reader.skip(4)
1249 return obj
1250
1251 def __eq__(self, other):
1252 if type(self) != type(other): return False
1253 if self.type != other.type: return False
1254 return True
1255
1256 def pretty_print(self, q):
1257 q.text("queue_prop {")
1258 with q.group():
1259 with q.indent(2):
1260 q.breakable()
1261 q.breakable()
1262 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -08001263
1264
1265class queue_prop_experimenter(queue_prop):
1266 subtypes = {}
1267
Rich Lane95f7fc92014-01-27 17:08:16 -08001268 type = 65535
1269
1270 def __init__(self, experimenter=None, data=None):
1271 if experimenter != None:
1272 self.experimenter = experimenter
1273 else:
1274 self.experimenter = 0
1275 if data != None:
1276 self.data = data
1277 else:
1278 self.data = ''
1279 return
1280
1281 def pack(self):
1282 packed = []
1283 packed.append(struct.pack("!H", self.type))
1284 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
1285 packed.append('\x00' * 4)
1286 packed.append(struct.pack("!L", self.experimenter))
1287 packed.append('\x00' * 4)
1288 packed.append(self.data)
1289 length = sum([len(x) for x in packed])
1290 packed[1] = struct.pack("!H", length)
1291 return ''.join(packed)
1292
Rich Lane7dcdf022013-12-11 14:45:27 -08001293 @staticmethod
1294 def unpack(reader):
1295 subtype, = reader.peek('!L', 8)
Rich Lane95f7fc92014-01-27 17:08:16 -08001296 subclass = queue_prop_experimenter.subtypes.get(subtype)
1297 if subclass:
1298 return subclass.unpack(reader)
1299
1300 obj = queue_prop_experimenter()
1301 _type = reader.read("!H")[0]
1302 assert(_type == 65535)
1303 _len = reader.read("!H")[0]
1304 orig_reader = reader
1305 reader = orig_reader.slice(_len - (2 + 2))
1306 reader.skip(4)
1307 obj.experimenter = reader.read("!L")[0]
1308 reader.skip(4)
1309 obj.data = str(reader.read_all())
1310 return obj
1311
1312 def __eq__(self, other):
1313 if type(self) != type(other): return False
1314 if self.experimenter != other.experimenter: return False
1315 if self.data != other.data: return False
1316 return True
1317
1318 def pretty_print(self, q):
1319 q.text("queue_prop_experimenter {")
1320 with q.group():
1321 with q.indent(2):
1322 q.breakable()
1323 q.text("data = ");
1324 q.pp(self.data)
1325 q.breakable()
1326 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -08001327
1328queue_prop.subtypes[65535] = queue_prop_experimenter
1329
1330class queue_prop_max_rate(queue_prop):
Dan Talaycof6202252013-07-02 01:00:29 -07001331 type = 2
Rich Lanec2ee4b82013-04-24 17:12:38 -07001332
1333 def __init__(self, rate=None):
1334 if rate != None:
1335 self.rate = rate
1336 else:
1337 self.rate = 0
1338 return
1339
1340 def pack(self):
1341 packed = []
1342 packed.append(struct.pack("!H", self.type))
1343 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
1344 packed.append('\x00' * 4)
1345 packed.append(struct.pack("!H", self.rate))
1346 packed.append('\x00' * 6)
1347 length = sum([len(x) for x in packed])
1348 packed[1] = struct.pack("!H", length)
1349 return ''.join(packed)
1350
1351 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001352 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001353 obj = queue_prop_max_rate()
Dan Talaycof6202252013-07-02 01:00:29 -07001354 _type = reader.read("!H")[0]
1355 assert(_type == 2)
1356 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001357 orig_reader = reader
1358 reader = orig_reader.slice(_len - (2 + 2))
Rich Lanec2ee4b82013-04-24 17:12:38 -07001359 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -07001360 obj.rate = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001361 reader.skip(6)
1362 return obj
1363
1364 def __eq__(self, other):
1365 if type(self) != type(other): return False
1366 if self.rate != other.rate: return False
1367 return True
1368
Rich Lanec2ee4b82013-04-24 17:12:38 -07001369 def pretty_print(self, q):
1370 q.text("queue_prop_max_rate {")
1371 with q.group():
1372 with q.indent(2):
1373 q.breakable()
1374 q.text("rate = ");
1375 q.text("%#x" % self.rate)
1376 q.breakable()
1377 q.text('}')
1378
Rich Lane7dcdf022013-12-11 14:45:27 -08001379queue_prop.subtypes[2] = queue_prop_max_rate
1380
1381class queue_prop_min_rate(queue_prop):
Dan Talaycof6202252013-07-02 01:00:29 -07001382 type = 1
Rich Lanec2ee4b82013-04-24 17:12:38 -07001383
1384 def __init__(self, rate=None):
1385 if rate != None:
1386 self.rate = rate
1387 else:
1388 self.rate = 0
1389 return
1390
1391 def pack(self):
1392 packed = []
1393 packed.append(struct.pack("!H", self.type))
1394 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
1395 packed.append('\x00' * 4)
1396 packed.append(struct.pack("!H", self.rate))
1397 packed.append('\x00' * 6)
1398 length = sum([len(x) for x in packed])
1399 packed[1] = struct.pack("!H", length)
1400 return ''.join(packed)
1401
1402 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001403 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001404 obj = queue_prop_min_rate()
Dan Talaycof6202252013-07-02 01:00:29 -07001405 _type = reader.read("!H")[0]
1406 assert(_type == 1)
1407 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001408 orig_reader = reader
1409 reader = orig_reader.slice(_len - (2 + 2))
Rich Lanec2ee4b82013-04-24 17:12:38 -07001410 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -07001411 obj.rate = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001412 reader.skip(6)
1413 return obj
1414
1415 def __eq__(self, other):
1416 if type(self) != type(other): return False
1417 if self.rate != other.rate: return False
1418 return True
1419
Rich Lanec2ee4b82013-04-24 17:12:38 -07001420 def pretty_print(self, q):
1421 q.text("queue_prop_min_rate {")
1422 with q.group():
1423 with q.indent(2):
1424 q.breakable()
1425 q.text("rate = ");
1426 q.text("%#x" % self.rate)
1427 q.breakable()
1428 q.text('}')
1429
Rich Lane7dcdf022013-12-11 14:45:27 -08001430queue_prop.subtypes[1] = queue_prop_min_rate
1431
1432class queue_stats_entry(loxi.OFObject):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001433
1434 def __init__(self, port_no=None, queue_id=None, tx_bytes=None, tx_packets=None, tx_errors=None):
1435 if port_no != None:
1436 self.port_no = port_no
1437 else:
1438 self.port_no = 0
1439 if queue_id != None:
1440 self.queue_id = queue_id
1441 else:
1442 self.queue_id = 0
1443 if tx_bytes != None:
1444 self.tx_bytes = tx_bytes
1445 else:
1446 self.tx_bytes = 0
1447 if tx_packets != None:
1448 self.tx_packets = tx_packets
1449 else:
1450 self.tx_packets = 0
1451 if tx_errors != None:
1452 self.tx_errors = tx_errors
1453 else:
1454 self.tx_errors = 0
1455 return
1456
1457 def pack(self):
1458 packed = []
Dan Talaycof6202252013-07-02 01:00:29 -07001459 packed.append(util.pack_port_no(self.port_no))
Rich Lanec2ee4b82013-04-24 17:12:38 -07001460 packed.append(struct.pack("!L", self.queue_id))
1461 packed.append(struct.pack("!Q", self.tx_bytes))
1462 packed.append(struct.pack("!Q", self.tx_packets))
1463 packed.append(struct.pack("!Q", self.tx_errors))
1464 return ''.join(packed)
1465
1466 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001467 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001468 obj = queue_stats_entry()
Dan Talaycof6202252013-07-02 01:00:29 -07001469 obj.port_no = util.unpack_port_no(reader)
1470 obj.queue_id = reader.read("!L")[0]
1471 obj.tx_bytes = reader.read("!Q")[0]
1472 obj.tx_packets = reader.read("!Q")[0]
1473 obj.tx_errors = reader.read("!Q")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001474 return obj
1475
1476 def __eq__(self, other):
1477 if type(self) != type(other): return False
1478 if self.port_no != other.port_no: return False
1479 if self.queue_id != other.queue_id: return False
1480 if self.tx_bytes != other.tx_bytes: return False
1481 if self.tx_packets != other.tx_packets: return False
1482 if self.tx_errors != other.tx_errors: return False
1483 return True
1484
Rich Lanec2ee4b82013-04-24 17:12:38 -07001485 def pretty_print(self, q):
1486 q.text("queue_stats_entry {")
1487 with q.group():
1488 with q.indent(2):
1489 q.breakable()
1490 q.text("port_no = ");
1491 q.text(util.pretty_port(self.port_no))
1492 q.text(","); q.breakable()
1493 q.text("queue_id = ");
1494 q.text("%#x" % self.queue_id)
1495 q.text(","); q.breakable()
1496 q.text("tx_bytes = ");
1497 q.text("%#x" % self.tx_bytes)
1498 q.text(","); q.breakable()
1499 q.text("tx_packets = ");
1500 q.text("%#x" % self.tx_packets)
1501 q.text(","); q.breakable()
1502 q.text("tx_errors = ");
1503 q.text("%#x" % self.tx_errors)
1504 q.breakable()
1505 q.text('}')
1506
Rich Lane7dcdf022013-12-11 14:45:27 -08001507
1508class table_stats_entry(loxi.OFObject):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001509
1510 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):
1511 if table_id != None:
1512 self.table_id = table_id
1513 else:
1514 self.table_id = 0
1515 if name != None:
1516 self.name = name
1517 else:
1518 self.name = ""
1519 if match != None:
1520 self.match = match
1521 else:
Dan Talaycof6202252013-07-02 01:00:29 -07001522 self.match = util.init_match_bmap()
Rich Lanec2ee4b82013-04-24 17:12:38 -07001523 if wildcards != None:
1524 self.wildcards = wildcards
1525 else:
Dan Talaycof6202252013-07-02 01:00:29 -07001526 self.wildcards = util.init_wc_bmap()
Rich Lanec2ee4b82013-04-24 17:12:38 -07001527 if write_actions != None:
1528 self.write_actions = write_actions
1529 else:
1530 self.write_actions = 0
1531 if apply_actions != None:
1532 self.apply_actions = apply_actions
1533 else:
1534 self.apply_actions = 0
1535 if write_setfields != None:
1536 self.write_setfields = write_setfields
1537 else:
1538 self.write_setfields = 0
1539 if apply_setfields != None:
1540 self.apply_setfields = apply_setfields
1541 else:
1542 self.apply_setfields = 0
1543 if metadata_match != None:
1544 self.metadata_match = metadata_match
1545 else:
1546 self.metadata_match = 0
1547 if metadata_write != None:
1548 self.metadata_write = metadata_write
1549 else:
1550 self.metadata_write = 0
1551 if instructions != None:
1552 self.instructions = instructions
1553 else:
1554 self.instructions = 0
1555 if config != None:
1556 self.config = config
1557 else:
1558 self.config = 0
1559 if max_entries != None:
1560 self.max_entries = max_entries
1561 else:
1562 self.max_entries = 0
1563 if active_count != None:
1564 self.active_count = active_count
1565 else:
1566 self.active_count = 0
1567 if lookup_count != None:
1568 self.lookup_count = lookup_count
1569 else:
1570 self.lookup_count = 0
1571 if matched_count != None:
1572 self.matched_count = matched_count
1573 else:
1574 self.matched_count = 0
1575 return
1576
1577 def pack(self):
1578 packed = []
1579 packed.append(struct.pack("!B", self.table_id))
1580 packed.append('\x00' * 7)
1581 packed.append(struct.pack("!32s", self.name))
Dan Talaycof6202252013-07-02 01:00:29 -07001582 packed.append(util.pack_match_bmap(self.match))
1583 packed.append(util.pack_wc_bmap(self.wildcards))
Rich Lanec2ee4b82013-04-24 17:12:38 -07001584 packed.append(struct.pack("!L", self.write_actions))
1585 packed.append(struct.pack("!L", self.apply_actions))
1586 packed.append(struct.pack("!Q", self.write_setfields))
1587 packed.append(struct.pack("!Q", self.apply_setfields))
1588 packed.append(struct.pack("!Q", self.metadata_match))
1589 packed.append(struct.pack("!Q", self.metadata_write))
1590 packed.append(struct.pack("!L", self.instructions))
1591 packed.append(struct.pack("!L", self.config))
1592 packed.append(struct.pack("!L", self.max_entries))
1593 packed.append(struct.pack("!L", self.active_count))
1594 packed.append(struct.pack("!Q", self.lookup_count))
1595 packed.append(struct.pack("!Q", self.matched_count))
1596 return ''.join(packed)
1597
1598 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001599 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001600 obj = table_stats_entry()
Dan Talaycof6202252013-07-02 01:00:29 -07001601 obj.table_id = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001602 reader.skip(7)
1603 obj.name = reader.read("!32s")[0].rstrip("\x00")
Dan Talaycof6202252013-07-02 01:00:29 -07001604 obj.match = util.unpack_match_bmap(reader)
1605 obj.wildcards = util.unpack_wc_bmap(reader)
1606 obj.write_actions = reader.read("!L")[0]
1607 obj.apply_actions = reader.read("!L")[0]
1608 obj.write_setfields = reader.read("!Q")[0]
1609 obj.apply_setfields = reader.read("!Q")[0]
1610 obj.metadata_match = reader.read("!Q")[0]
1611 obj.metadata_write = reader.read("!Q")[0]
1612 obj.instructions = reader.read("!L")[0]
1613 obj.config = reader.read("!L")[0]
1614 obj.max_entries = reader.read("!L")[0]
1615 obj.active_count = reader.read("!L")[0]
1616 obj.lookup_count = reader.read("!Q")[0]
1617 obj.matched_count = reader.read("!Q")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001618 return obj
1619
1620 def __eq__(self, other):
1621 if type(self) != type(other): return False
1622 if self.table_id != other.table_id: return False
1623 if self.name != other.name: return False
1624 if self.match != other.match: return False
1625 if self.wildcards != other.wildcards: return False
1626 if self.write_actions != other.write_actions: return False
1627 if self.apply_actions != other.apply_actions: return False
1628 if self.write_setfields != other.write_setfields: return False
1629 if self.apply_setfields != other.apply_setfields: return False
1630 if self.metadata_match != other.metadata_match: return False
1631 if self.metadata_write != other.metadata_write: return False
1632 if self.instructions != other.instructions: return False
1633 if self.config != other.config: return False
1634 if self.max_entries != other.max_entries: return False
1635 if self.active_count != other.active_count: return False
1636 if self.lookup_count != other.lookup_count: return False
1637 if self.matched_count != other.matched_count: return False
1638 return True
1639
Rich Lanec2ee4b82013-04-24 17:12:38 -07001640 def pretty_print(self, q):
1641 q.text("table_stats_entry {")
1642 with q.group():
1643 with q.indent(2):
1644 q.breakable()
1645 q.text("table_id = ");
1646 q.text("%#x" % self.table_id)
1647 q.text(","); q.breakable()
1648 q.text("name = ");
1649 q.pp(self.name)
1650 q.text(","); q.breakable()
1651 q.text("match = ");
1652 q.pp(self.match)
1653 q.text(","); q.breakable()
1654 q.text("wildcards = ");
1655 q.pp(self.wildcards)
1656 q.text(","); q.breakable()
1657 q.text("write_actions = ");
1658 q.text("%#x" % self.write_actions)
1659 q.text(","); q.breakable()
1660 q.text("apply_actions = ");
1661 q.text("%#x" % self.apply_actions)
1662 q.text(","); q.breakable()
1663 q.text("write_setfields = ");
1664 q.text("%#x" % self.write_setfields)
1665 q.text(","); q.breakable()
1666 q.text("apply_setfields = ");
1667 q.text("%#x" % self.apply_setfields)
1668 q.text(","); q.breakable()
1669 q.text("metadata_match = ");
1670 q.text("%#x" % self.metadata_match)
1671 q.text(","); q.breakable()
1672 q.text("metadata_write = ");
1673 q.text("%#x" % self.metadata_write)
1674 q.text(","); q.breakable()
1675 q.text("instructions = ");
1676 q.text("%#x" % self.instructions)
1677 q.text(","); q.breakable()
1678 q.text("config = ");
1679 q.text("%#x" % self.config)
1680 q.text(","); q.breakable()
1681 q.text("max_entries = ");
1682 q.text("%#x" % self.max_entries)
1683 q.text(","); q.breakable()
1684 q.text("active_count = ");
1685 q.text("%#x" % self.active_count)
1686 q.text(","); q.breakable()
1687 q.text("lookup_count = ");
1688 q.text("%#x" % self.lookup_count)
1689 q.text(","); q.breakable()
1690 q.text("matched_count = ");
1691 q.text("%#x" % self.matched_count)
1692 q.breakable()
1693 q.text('}')
1694
1695
Rich Lane7dcdf022013-12-11 14:45:27 -08001696
Rich Lanec2ee4b82013-04-24 17:12:38 -07001697match = match_v3