blob: 191fa7a5ddd2673b37de7e707498f6811fda665f [file] [log] [blame]
Rich Lane2e079da2014-10-29 15:30:24 -07001# Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
2# Copyright (c) 2011, 2012 Open Networking Foundation
3# Copyright (c) 2012, 2013 Big Switch Networks, Inc.
4# See the file LICENSE.pyloxi which should have been included in the source distribution
5
6# Automatically generated by LOXI from template module.py
7# Do not modify
8
9import struct
10import loxi
11import const
12import port_desc_prop
13import meter_band
14import table_mod_prop
15import instruction
16import queue_desc_prop
17import oxm
18import bundle_prop
19import common
20import instruction_id
21import action
22import role_prop
23import message
24import queue_stats_prop
25import port_stats_prop
26import port_mod_prop
27import async_config_prop
28import action_id
29import util
30import loxi.generic_util
31
32class bsn_interface(loxi.OFObject):
33
34 def __init__(self, hw_addr=None, name=None, ipv4_addr=None, ipv4_netmask=None):
35 if hw_addr != None:
36 self.hw_addr = hw_addr
37 else:
38 self.hw_addr = [0,0,0,0,0,0]
39 if name != None:
40 self.name = name
41 else:
42 self.name = ""
43 if ipv4_addr != None:
44 self.ipv4_addr = ipv4_addr
45 else:
46 self.ipv4_addr = 0
47 if ipv4_netmask != None:
48 self.ipv4_netmask = ipv4_netmask
49 else:
50 self.ipv4_netmask = 0
51 return
52
53 def pack(self):
54 packed = []
55 packed.append(struct.pack("!6B", *self.hw_addr))
56 packed.append('\x00' * 2)
57 packed.append(struct.pack("!16s", self.name))
58 packed.append(struct.pack("!L", self.ipv4_addr))
59 packed.append(struct.pack("!L", self.ipv4_netmask))
60 return ''.join(packed)
61
62 @staticmethod
63 def unpack(reader):
64 obj = bsn_interface()
65 obj.hw_addr = list(reader.read('!6B'))
66 reader.skip(2)
67 obj.name = reader.read("!16s")[0].rstrip("\x00")
68 obj.ipv4_addr = reader.read("!L")[0]
69 obj.ipv4_netmask = reader.read("!L")[0]
70 return obj
71
72 def __eq__(self, other):
73 if type(self) != type(other): return False
74 if self.hw_addr != other.hw_addr: return False
75 if self.name != other.name: return False
76 if self.ipv4_addr != other.ipv4_addr: return False
77 if self.ipv4_netmask != other.ipv4_netmask: return False
78 return True
79
80 def pretty_print(self, q):
81 q.text("bsn_interface {")
82 with q.group():
83 with q.indent(2):
84 q.breakable()
85 q.text("hw_addr = ");
86 q.text(util.pretty_mac(self.hw_addr))
87 q.text(","); q.breakable()
88 q.text("name = ");
89 q.pp(self.name)
90 q.text(","); q.breakable()
91 q.text("ipv4_addr = ");
92 q.text(util.pretty_ipv4(self.ipv4_addr))
93 q.text(","); q.breakable()
94 q.text("ipv4_netmask = ");
95 q.text(util.pretty_ipv4(self.ipv4_netmask))
96 q.breakable()
97 q.text('}')
98
99
100class bsn_vport(loxi.OFObject):
101 subtypes = {}
102
103
104 def __init__(self, type=None):
105 if type != None:
106 self.type = type
107 else:
108 self.type = 0
109 return
110
111 def pack(self):
112 packed = []
113 packed.append(struct.pack("!H", self.type))
114 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
115 length = sum([len(x) for x in packed])
116 packed[1] = struct.pack("!H", length)
117 return ''.join(packed)
118
119 @staticmethod
120 def unpack(reader):
121 subtype, = reader.peek('!H', 0)
122 subclass = bsn_vport.subtypes.get(subtype)
123 if subclass:
124 return subclass.unpack(reader)
125
126 obj = bsn_vport()
127 obj.type = reader.read("!H")[0]
128 _length = reader.read("!H")[0]
129 orig_reader = reader
130 reader = orig_reader.slice(_length - (2 + 2))
131 return obj
132
133 def __eq__(self, other):
134 if type(self) != type(other): return False
135 if self.type != other.type: return False
136 return True
137
138 def pretty_print(self, q):
139 q.text("bsn_vport {")
140 with q.group():
141 with q.indent(2):
142 q.breakable()
143 q.breakable()
144 q.text('}')
145
146
147class bsn_vport_l2gre(bsn_vport):
148 type = 1
149
150 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):
151 if flags != None:
152 self.flags = flags
153 else:
154 self.flags = 0
155 if port_no != None:
156 self.port_no = port_no
157 else:
158 self.port_no = 0
159 if loopback_port_no != None:
160 self.loopback_port_no = loopback_port_no
161 else:
162 self.loopback_port_no = 0
163 if local_mac != None:
164 self.local_mac = local_mac
165 else:
166 self.local_mac = [0,0,0,0,0,0]
167 if nh_mac != None:
168 self.nh_mac = nh_mac
169 else:
170 self.nh_mac = [0,0,0,0,0,0]
171 if src_ip != None:
172 self.src_ip = src_ip
173 else:
174 self.src_ip = 0
175 if dst_ip != None:
176 self.dst_ip = dst_ip
177 else:
178 self.dst_ip = 0
179 if dscp != None:
180 self.dscp = dscp
181 else:
182 self.dscp = 0
183 if ttl != None:
184 self.ttl = ttl
185 else:
186 self.ttl = 0
187 if vpn != None:
188 self.vpn = vpn
189 else:
190 self.vpn = 0
191 if rate_limit != None:
192 self.rate_limit = rate_limit
193 else:
194 self.rate_limit = 0
195 if if_name != None:
196 self.if_name = if_name
197 else:
198 self.if_name = ""
199 return
200
201 def pack(self):
202 packed = []
203 packed.append(struct.pack("!H", self.type))
204 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
205 packed.append(struct.pack("!L", self.flags))
206 packed.append(util.pack_port_no(self.port_no))
207 packed.append(util.pack_port_no(self.loopback_port_no))
208 packed.append(struct.pack("!6B", *self.local_mac))
209 packed.append(struct.pack("!6B", *self.nh_mac))
210 packed.append(struct.pack("!L", self.src_ip))
211 packed.append(struct.pack("!L", self.dst_ip))
212 packed.append(struct.pack("!B", self.dscp))
213 packed.append(struct.pack("!B", self.ttl))
214 packed.append('\x00' * 2)
215 packed.append(struct.pack("!L", self.vpn))
216 packed.append(struct.pack("!L", self.rate_limit))
217 packed.append(struct.pack("!16s", self.if_name))
218 length = sum([len(x) for x in packed])
219 packed[1] = struct.pack("!H", length)
220 return ''.join(packed)
221
222 @staticmethod
223 def unpack(reader):
224 obj = bsn_vport_l2gre()
225 _type = reader.read("!H")[0]
226 assert(_type == 1)
227 _length = reader.read("!H")[0]
228 orig_reader = reader
229 reader = orig_reader.slice(_length - (2 + 2))
230 obj.flags = reader.read("!L")[0]
231 obj.port_no = util.unpack_port_no(reader)
232 obj.loopback_port_no = util.unpack_port_no(reader)
233 obj.local_mac = list(reader.read('!6B'))
234 obj.nh_mac = list(reader.read('!6B'))
235 obj.src_ip = reader.read("!L")[0]
236 obj.dst_ip = reader.read("!L")[0]
237 obj.dscp = reader.read("!B")[0]
238 obj.ttl = reader.read("!B")[0]
239 reader.skip(2)
240 obj.vpn = reader.read("!L")[0]
241 obj.rate_limit = reader.read("!L")[0]
242 obj.if_name = reader.read("!16s")[0].rstrip("\x00")
243 return obj
244
245 def __eq__(self, other):
246 if type(self) != type(other): return False
247 if self.flags != other.flags: return False
248 if self.port_no != other.port_no: return False
249 if self.loopback_port_no != other.loopback_port_no: return False
250 if self.local_mac != other.local_mac: return False
251 if self.nh_mac != other.nh_mac: return False
252 if self.src_ip != other.src_ip: return False
253 if self.dst_ip != other.dst_ip: return False
254 if self.dscp != other.dscp: return False
255 if self.ttl != other.ttl: return False
256 if self.vpn != other.vpn: return False
257 if self.rate_limit != other.rate_limit: return False
258 if self.if_name != other.if_name: return False
259 return True
260
261 def pretty_print(self, q):
262 q.text("bsn_vport_l2gre {")
263 with q.group():
264 with q.indent(2):
265 q.breakable()
266 q.text("flags = ");
267 q.text("%#x" % self.flags)
268 q.text(","); q.breakable()
269 q.text("port_no = ");
270 q.text(util.pretty_port(self.port_no))
271 q.text(","); q.breakable()
272 q.text("loopback_port_no = ");
273 q.text(util.pretty_port(self.loopback_port_no))
274 q.text(","); q.breakable()
275 q.text("local_mac = ");
276 q.text(util.pretty_mac(self.local_mac))
277 q.text(","); q.breakable()
278 q.text("nh_mac = ");
279 q.text(util.pretty_mac(self.nh_mac))
280 q.text(","); q.breakable()
281 q.text("src_ip = ");
282 q.text(util.pretty_ipv4(self.src_ip))
283 q.text(","); q.breakable()
284 q.text("dst_ip = ");
285 q.text(util.pretty_ipv4(self.dst_ip))
286 q.text(","); q.breakable()
287 q.text("dscp = ");
288 q.text("%#x" % self.dscp)
289 q.text(","); q.breakable()
290 q.text("ttl = ");
291 q.text("%#x" % self.ttl)
292 q.text(","); q.breakable()
293 q.text("vpn = ");
294 q.text("%#x" % self.vpn)
295 q.text(","); q.breakable()
296 q.text("rate_limit = ");
297 q.text("%#x" % self.rate_limit)
298 q.text(","); q.breakable()
299 q.text("if_name = ");
300 q.pp(self.if_name)
301 q.breakable()
302 q.text('}')
303
304bsn_vport.subtypes[1] = bsn_vport_l2gre
305
306class bsn_vport_q_in_q(bsn_vport):
307 type = 0
308
309 def __init__(self, port_no=None, ingress_tpid=None, ingress_vlan_id=None, egress_tpid=None, egress_vlan_id=None, if_name=None):
310 if port_no != None:
311 self.port_no = port_no
312 else:
313 self.port_no = 0
314 if ingress_tpid != None:
315 self.ingress_tpid = ingress_tpid
316 else:
317 self.ingress_tpid = 0
318 if ingress_vlan_id != None:
319 self.ingress_vlan_id = ingress_vlan_id
320 else:
321 self.ingress_vlan_id = 0
322 if egress_tpid != None:
323 self.egress_tpid = egress_tpid
324 else:
325 self.egress_tpid = 0
326 if egress_vlan_id != None:
327 self.egress_vlan_id = egress_vlan_id
328 else:
329 self.egress_vlan_id = 0
330 if if_name != None:
331 self.if_name = if_name
332 else:
333 self.if_name = ""
334 return
335
336 def pack(self):
337 packed = []
338 packed.append(struct.pack("!H", self.type))
339 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
340 packed.append(struct.pack("!L", self.port_no))
341 packed.append(struct.pack("!H", self.ingress_tpid))
342 packed.append(struct.pack("!H", self.ingress_vlan_id))
343 packed.append(struct.pack("!H", self.egress_tpid))
344 packed.append(struct.pack("!H", self.egress_vlan_id))
345 packed.append(struct.pack("!16s", self.if_name))
346 length = sum([len(x) for x in packed])
347 packed[1] = struct.pack("!H", length)
348 return ''.join(packed)
349
350 @staticmethod
351 def unpack(reader):
352 obj = bsn_vport_q_in_q()
353 _type = reader.read("!H")[0]
354 assert(_type == 0)
355 _length = reader.read("!H")[0]
356 orig_reader = reader
357 reader = orig_reader.slice(_length - (2 + 2))
358 obj.port_no = reader.read("!L")[0]
359 obj.ingress_tpid = reader.read("!H")[0]
360 obj.ingress_vlan_id = reader.read("!H")[0]
361 obj.egress_tpid = reader.read("!H")[0]
362 obj.egress_vlan_id = reader.read("!H")[0]
363 obj.if_name = reader.read("!16s")[0].rstrip("\x00")
364 return obj
365
366 def __eq__(self, other):
367 if type(self) != type(other): return False
368 if self.port_no != other.port_no: return False
369 if self.ingress_tpid != other.ingress_tpid: return False
370 if self.ingress_vlan_id != other.ingress_vlan_id: return False
371 if self.egress_tpid != other.egress_tpid: return False
372 if self.egress_vlan_id != other.egress_vlan_id: return False
373 if self.if_name != other.if_name: return False
374 return True
375
376 def pretty_print(self, q):
377 q.text("bsn_vport_q_in_q {")
378 with q.group():
379 with q.indent(2):
380 q.breakable()
381 q.text("port_no = ");
382 q.text("%#x" % self.port_no)
383 q.text(","); q.breakable()
384 q.text("ingress_tpid = ");
385 q.text("%#x" % self.ingress_tpid)
386 q.text(","); q.breakable()
387 q.text("ingress_vlan_id = ");
388 q.text("%#x" % self.ingress_vlan_id)
389 q.text(","); q.breakable()
390 q.text("egress_tpid = ");
391 q.text("%#x" % self.egress_tpid)
392 q.text(","); q.breakable()
393 q.text("egress_vlan_id = ");
394 q.text("%#x" % self.egress_vlan_id)
395 q.text(","); q.breakable()
396 q.text("if_name = ");
397 q.pp(self.if_name)
398 q.breakable()
399 q.text('}')
400
401bsn_vport.subtypes[0] = bsn_vport_q_in_q
402
403class bucket(loxi.OFObject):
404
405 def __init__(self, weight=None, watch_port=None, watch_group=None, actions=None):
406 if weight != None:
407 self.weight = weight
408 else:
409 self.weight = 0
410 if watch_port != None:
411 self.watch_port = watch_port
412 else:
413 self.watch_port = 0
414 if watch_group != None:
415 self.watch_group = watch_group
416 else:
417 self.watch_group = 0
418 if actions != None:
419 self.actions = actions
420 else:
421 self.actions = []
422 return
423
424 def pack(self):
425 packed = []
426 packed.append(struct.pack("!H", 0)) # placeholder for len at index 0
427 packed.append(struct.pack("!H", self.weight))
428 packed.append(util.pack_port_no(self.watch_port))
429 packed.append(struct.pack("!L", self.watch_group))
430 packed.append('\x00' * 4)
431 packed.append(loxi.generic_util.pack_list(self.actions))
432 length = sum([len(x) for x in packed])
433 packed[0] = struct.pack("!H", length)
434 return ''.join(packed)
435
436 @staticmethod
437 def unpack(reader):
438 obj = bucket()
439 _len = reader.read("!H")[0]
440 orig_reader = reader
441 reader = orig_reader.slice(_len - (0 + 2))
442 obj.weight = reader.read("!H")[0]
443 obj.watch_port = util.unpack_port_no(reader)
444 obj.watch_group = reader.read("!L")[0]
445 reader.skip(4)
446 obj.actions = loxi.generic_util.unpack_list(reader, action.action.unpack)
447 return obj
448
449 def __eq__(self, other):
450 if type(self) != type(other): return False
451 if self.weight != other.weight: return False
452 if self.watch_port != other.watch_port: return False
453 if self.watch_group != other.watch_group: return False
454 if self.actions != other.actions: return False
455 return True
456
457 def pretty_print(self, q):
458 q.text("bucket {")
459 with q.group():
460 with q.indent(2):
461 q.breakable()
462 q.text("weight = ");
463 q.text("%#x" % self.weight)
464 q.text(","); q.breakable()
465 q.text("watch_port = ");
466 q.text(util.pretty_port(self.watch_port))
467 q.text(","); q.breakable()
468 q.text("watch_group = ");
469 q.text("%#x" % self.watch_group)
470 q.text(","); q.breakable()
471 q.text("actions = ");
472 q.pp(self.actions)
473 q.breakable()
474 q.text('}')
475
476
477class bucket_counter(loxi.OFObject):
478
479 def __init__(self, packet_count=None, byte_count=None):
480 if packet_count != None:
481 self.packet_count = packet_count
482 else:
483 self.packet_count = 0
484 if byte_count != None:
485 self.byte_count = byte_count
486 else:
487 self.byte_count = 0
488 return
489
490 def pack(self):
491 packed = []
492 packed.append(struct.pack("!Q", self.packet_count))
493 packed.append(struct.pack("!Q", self.byte_count))
494 return ''.join(packed)
495
496 @staticmethod
497 def unpack(reader):
498 obj = bucket_counter()
499 obj.packet_count = reader.read("!Q")[0]
500 obj.byte_count = reader.read("!Q")[0]
501 return obj
502
503 def __eq__(self, other):
504 if type(self) != type(other): return False
505 if self.packet_count != other.packet_count: return False
506 if self.byte_count != other.byte_count: return False
507 return True
508
509 def pretty_print(self, q):
510 q.text("bucket_counter {")
511 with q.group():
512 with q.indent(2):
513 q.breakable()
514 q.text("packet_count = ");
515 q.text("%#x" % self.packet_count)
516 q.text(","); q.breakable()
517 q.text("byte_count = ");
518 q.text("%#x" % self.byte_count)
519 q.breakable()
520 q.text('}')
521
522
523class flow_stats_entry(loxi.OFObject):
524
525 def __init__(self, table_id=None, duration_sec=None, duration_nsec=None, priority=None, idle_timeout=None, hard_timeout=None, flags=None, importance=None, cookie=None, packet_count=None, byte_count=None, match=None, instructions=None):
526 if table_id != None:
527 self.table_id = table_id
528 else:
529 self.table_id = 0
530 if duration_sec != None:
531 self.duration_sec = duration_sec
532 else:
533 self.duration_sec = 0
534 if duration_nsec != None:
535 self.duration_nsec = duration_nsec
536 else:
537 self.duration_nsec = 0
538 if priority != None:
539 self.priority = priority
540 else:
541 self.priority = 0
542 if idle_timeout != None:
543 self.idle_timeout = idle_timeout
544 else:
545 self.idle_timeout = 0
546 if hard_timeout != None:
547 self.hard_timeout = hard_timeout
548 else:
549 self.hard_timeout = 0
550 if flags != None:
551 self.flags = flags
552 else:
553 self.flags = 0
554 if importance != None:
555 self.importance = importance
556 else:
557 self.importance = 0
558 if cookie != None:
559 self.cookie = cookie
560 else:
561 self.cookie = 0
562 if packet_count != None:
563 self.packet_count = packet_count
564 else:
565 self.packet_count = 0
566 if byte_count != None:
567 self.byte_count = byte_count
568 else:
569 self.byte_count = 0
570 if match != None:
571 self.match = match
572 else:
573 self.match = common.match()
574 if instructions != None:
575 self.instructions = instructions
576 else:
577 self.instructions = []
578 return
579
580 def pack(self):
581 packed = []
582 packed.append(struct.pack("!H", 0)) # placeholder for length at index 0
583 packed.append(struct.pack("!B", self.table_id))
584 packed.append('\x00' * 1)
585 packed.append(struct.pack("!L", self.duration_sec))
586 packed.append(struct.pack("!L", self.duration_nsec))
587 packed.append(struct.pack("!H", self.priority))
588 packed.append(struct.pack("!H", self.idle_timeout))
589 packed.append(struct.pack("!H", self.hard_timeout))
590 packed.append(struct.pack("!H", self.flags))
591 packed.append(struct.pack("!H", self.importance))
592 packed.append('\x00' * 2)
593 packed.append(struct.pack("!Q", self.cookie))
594 packed.append(struct.pack("!Q", self.packet_count))
595 packed.append(struct.pack("!Q", self.byte_count))
596 packed.append(self.match.pack())
597 packed.append(loxi.generic_util.pack_list(self.instructions))
598 length = sum([len(x) for x in packed])
599 packed[0] = struct.pack("!H", length)
600 return ''.join(packed)
601
602 @staticmethod
603 def unpack(reader):
604 obj = flow_stats_entry()
605 _length = reader.read("!H")[0]
606 orig_reader = reader
607 reader = orig_reader.slice(_length - (0 + 2))
608 obj.table_id = reader.read("!B")[0]
609 reader.skip(1)
610 obj.duration_sec = reader.read("!L")[0]
611 obj.duration_nsec = reader.read("!L")[0]
612 obj.priority = reader.read("!H")[0]
613 obj.idle_timeout = reader.read("!H")[0]
614 obj.hard_timeout = reader.read("!H")[0]
615 obj.flags = reader.read("!H")[0]
616 obj.importance = reader.read("!H")[0]
617 reader.skip(2)
618 obj.cookie = reader.read("!Q")[0]
619 obj.packet_count = reader.read("!Q")[0]
620 obj.byte_count = reader.read("!Q")[0]
621 obj.match = common.match.unpack(reader)
622 obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack)
623 return obj
624
625 def __eq__(self, other):
626 if type(self) != type(other): return False
627 if self.table_id != other.table_id: return False
628 if self.duration_sec != other.duration_sec: return False
629 if self.duration_nsec != other.duration_nsec: return False
630 if self.priority != other.priority: return False
631 if self.idle_timeout != other.idle_timeout: return False
632 if self.hard_timeout != other.hard_timeout: return False
633 if self.flags != other.flags: return False
634 if self.importance != other.importance: return False
635 if self.cookie != other.cookie: return False
636 if self.packet_count != other.packet_count: return False
637 if self.byte_count != other.byte_count: return False
638 if self.match != other.match: return False
639 if self.instructions != other.instructions: return False
640 return True
641
642 def pretty_print(self, q):
643 q.text("flow_stats_entry {")
644 with q.group():
645 with q.indent(2):
646 q.breakable()
647 q.text("table_id = ");
648 q.text("%#x" % self.table_id)
649 q.text(","); q.breakable()
650 q.text("duration_sec = ");
651 q.text("%#x" % self.duration_sec)
652 q.text(","); q.breakable()
653 q.text("duration_nsec = ");
654 q.text("%#x" % self.duration_nsec)
655 q.text(","); q.breakable()
656 q.text("priority = ");
657 q.text("%#x" % self.priority)
658 q.text(","); q.breakable()
659 q.text("idle_timeout = ");
660 q.text("%#x" % self.idle_timeout)
661 q.text(","); q.breakable()
662 q.text("hard_timeout = ");
663 q.text("%#x" % self.hard_timeout)
664 q.text(","); q.breakable()
665 q.text("flags = ");
666 q.text("%#x" % self.flags)
667 q.text(","); q.breakable()
668 q.text("importance = ");
669 q.text("%#x" % self.importance)
670 q.text(","); q.breakable()
671 q.text("cookie = ");
672 q.text("%#x" % self.cookie)
673 q.text(","); q.breakable()
674 q.text("packet_count = ");
675 q.text("%#x" % self.packet_count)
676 q.text(","); q.breakable()
677 q.text("byte_count = ");
678 q.text("%#x" % self.byte_count)
679 q.text(","); q.breakable()
680 q.text("match = ");
681 q.pp(self.match)
682 q.text(","); q.breakable()
683 q.text("instructions = ");
684 q.pp(self.instructions)
685 q.breakable()
686 q.text('}')
687
688
689class group_desc_stats_entry(loxi.OFObject):
690
691 def __init__(self, group_type=None, group_id=None, buckets=None):
692 if group_type != None:
693 self.group_type = group_type
694 else:
695 self.group_type = 0
696 if group_id != None:
697 self.group_id = group_id
698 else:
699 self.group_id = 0
700 if buckets != None:
701 self.buckets = buckets
702 else:
703 self.buckets = []
704 return
705
706 def pack(self):
707 packed = []
708 packed.append(struct.pack("!H", 0)) # placeholder for length at index 0
709 packed.append(struct.pack("!B", self.group_type))
710 packed.append('\x00' * 1)
711 packed.append(struct.pack("!L", self.group_id))
712 packed.append(loxi.generic_util.pack_list(self.buckets))
713 length = sum([len(x) for x in packed])
714 packed[0] = struct.pack("!H", length)
715 return ''.join(packed)
716
717 @staticmethod
718 def unpack(reader):
719 obj = group_desc_stats_entry()
720 _length = reader.read("!H")[0]
721 orig_reader = reader
722 reader = orig_reader.slice(_length - (0 + 2))
723 obj.group_type = reader.read("!B")[0]
724 reader.skip(1)
725 obj.group_id = reader.read("!L")[0]
726 obj.buckets = loxi.generic_util.unpack_list(reader, common.bucket.unpack)
727 return obj
728
729 def __eq__(self, other):
730 if type(self) != type(other): return False
731 if self.group_type != other.group_type: return False
732 if self.group_id != other.group_id: return False
733 if self.buckets != other.buckets: return False
734 return True
735
736 def pretty_print(self, q):
737 q.text("group_desc_stats_entry {")
738 with q.group():
739 with q.indent(2):
740 q.breakable()
741 q.text("group_type = ");
742 q.text("%#x" % self.group_type)
743 q.text(","); q.breakable()
744 q.text("group_id = ");
745 q.text("%#x" % self.group_id)
746 q.text(","); q.breakable()
747 q.text("buckets = ");
748 q.pp(self.buckets)
749 q.breakable()
750 q.text('}')
751
752
753class group_stats_entry(loxi.OFObject):
754
755 def __init__(self, group_id=None, ref_count=None, packet_count=None, byte_count=None, duration_sec=None, duration_nsec=None, bucket_stats=None):
756 if group_id != None:
757 self.group_id = group_id
758 else:
759 self.group_id = 0
760 if ref_count != None:
761 self.ref_count = ref_count
762 else:
763 self.ref_count = 0
764 if packet_count != None:
765 self.packet_count = packet_count
766 else:
767 self.packet_count = 0
768 if byte_count != None:
769 self.byte_count = byte_count
770 else:
771 self.byte_count = 0
772 if duration_sec != None:
773 self.duration_sec = duration_sec
774 else:
775 self.duration_sec = 0
776 if duration_nsec != None:
777 self.duration_nsec = duration_nsec
778 else:
779 self.duration_nsec = 0
780 if bucket_stats != None:
781 self.bucket_stats = bucket_stats
782 else:
783 self.bucket_stats = []
784 return
785
786 def pack(self):
787 packed = []
788 packed.append(struct.pack("!H", 0)) # placeholder for length at index 0
789 packed.append('\x00' * 2)
790 packed.append(struct.pack("!L", self.group_id))
791 packed.append(struct.pack("!L", self.ref_count))
792 packed.append('\x00' * 4)
793 packed.append(struct.pack("!Q", self.packet_count))
794 packed.append(struct.pack("!Q", self.byte_count))
795 packed.append(struct.pack("!L", self.duration_sec))
796 packed.append(struct.pack("!L", self.duration_nsec))
797 packed.append(loxi.generic_util.pack_list(self.bucket_stats))
798 length = sum([len(x) for x in packed])
799 packed[0] = struct.pack("!H", length)
800 return ''.join(packed)
801
802 @staticmethod
803 def unpack(reader):
804 obj = group_stats_entry()
805 _length = reader.read("!H")[0]
806 orig_reader = reader
807 reader = orig_reader.slice(_length - (0 + 2))
808 reader.skip(2)
809 obj.group_id = reader.read("!L")[0]
810 obj.ref_count = reader.read("!L")[0]
811 reader.skip(4)
812 obj.packet_count = reader.read("!Q")[0]
813 obj.byte_count = reader.read("!Q")[0]
814 obj.duration_sec = reader.read("!L")[0]
815 obj.duration_nsec = reader.read("!L")[0]
816 obj.bucket_stats = loxi.generic_util.unpack_list(reader, common.bucket_counter.unpack)
817 return obj
818
819 def __eq__(self, other):
820 if type(self) != type(other): return False
821 if self.group_id != other.group_id: return False
822 if self.ref_count != other.ref_count: return False
823 if self.packet_count != other.packet_count: return False
824 if self.byte_count != other.byte_count: return False
825 if self.duration_sec != other.duration_sec: return False
826 if self.duration_nsec != other.duration_nsec: return False
827 if self.bucket_stats != other.bucket_stats: return False
828 return True
829
830 def pretty_print(self, q):
831 q.text("group_stats_entry {")
832 with q.group():
833 with q.indent(2):
834 q.breakable()
835 q.text("group_id = ");
836 q.text("%#x" % self.group_id)
837 q.text(","); q.breakable()
838 q.text("ref_count = ");
839 q.text("%#x" % self.ref_count)
840 q.text(","); q.breakable()
841 q.text("packet_count = ");
842 q.text("%#x" % self.packet_count)
843 q.text(","); q.breakable()
844 q.text("byte_count = ");
845 q.text("%#x" % self.byte_count)
846 q.text(","); q.breakable()
847 q.text("duration_sec = ");
848 q.text("%#x" % self.duration_sec)
849 q.text(","); q.breakable()
850 q.text("duration_nsec = ");
851 q.text("%#x" % self.duration_nsec)
852 q.text(","); q.breakable()
853 q.text("bucket_stats = ");
854 q.pp(self.bucket_stats)
855 q.breakable()
856 q.text('}')
857
858
859class hello_elem(loxi.OFObject):
860 subtypes = {}
861
862
863 def __init__(self, type=None):
864 if type != None:
865 self.type = type
866 else:
867 self.type = 0
868 return
869
870 def pack(self):
871 packed = []
872 packed.append(struct.pack("!H", self.type))
873 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
874 length = sum([len(x) for x in packed])
875 packed[1] = struct.pack("!H", length)
876 return ''.join(packed)
877
878 @staticmethod
879 def unpack(reader):
880 subtype, = reader.peek('!H', 0)
881 subclass = hello_elem.subtypes.get(subtype)
882 if subclass:
883 return subclass.unpack(reader)
884
885 obj = hello_elem()
886 obj.type = reader.read("!H")[0]
887 _length = reader.read("!H")[0]
888 orig_reader = reader
889 reader = orig_reader.slice(_length - (2 + 2))
890 return obj
891
892 def __eq__(self, other):
893 if type(self) != type(other): return False
894 if self.type != other.type: return False
895 return True
896
897 def pretty_print(self, q):
898 q.text("hello_elem {")
899 with q.group():
900 with q.indent(2):
901 q.breakable()
902 q.breakable()
903 q.text('}')
904
905
906class hello_elem_versionbitmap(hello_elem):
907 type = 1
908
909 def __init__(self, bitmaps=None):
910 if bitmaps != None:
911 self.bitmaps = bitmaps
912 else:
913 self.bitmaps = []
914 return
915
916 def pack(self):
917 packed = []
918 packed.append(struct.pack("!H", self.type))
919 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
920 packed.append(loxi.generic_util.pack_list(self.bitmaps))
921 length = sum([len(x) for x in packed])
922 packed[1] = struct.pack("!H", length)
923 return ''.join(packed)
924
925 @staticmethod
926 def unpack(reader):
927 obj = hello_elem_versionbitmap()
928 _type = reader.read("!H")[0]
929 assert(_type == 1)
930 _length = reader.read("!H")[0]
931 orig_reader = reader
932 reader = orig_reader.slice(_length - (2 + 2))
933 obj.bitmaps = loxi.generic_util.unpack_list(reader, common.uint32.unpack)
934 return obj
935
936 def __eq__(self, other):
937 if type(self) != type(other): return False
938 if self.bitmaps != other.bitmaps: return False
939 return True
940
941 def pretty_print(self, q):
942 q.text("hello_elem_versionbitmap {")
943 with q.group():
944 with q.indent(2):
945 q.breakable()
946 q.text("bitmaps = ");
947 q.pp(self.bitmaps)
948 q.breakable()
949 q.text('}')
950
951hello_elem.subtypes[1] = hello_elem_versionbitmap
952
953class match_v3(loxi.OFObject):
954 type = 1
955
956 def __init__(self, oxm_list=None):
957 if oxm_list != None:
958 self.oxm_list = oxm_list
959 else:
960 self.oxm_list = []
961 return
962
963 def pack(self):
964 packed = []
965 packed.append(struct.pack("!H", self.type))
966 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
967 packed.append(loxi.generic_util.pack_list(self.oxm_list))
968 length = sum([len(x) for x in packed])
969 packed[1] = struct.pack("!H", length)
970 packed.append(loxi.generic_util.pad_to(8, length))
971 return ''.join(packed)
972
973 @staticmethod
974 def unpack(reader):
975 obj = match_v3()
976 _type = reader.read("!H")[0]
977 assert(_type == 1)
978 _length = reader.read("!H")[0]
979 orig_reader = reader
980 reader = orig_reader.slice(_length - (2 + 2))
981 obj.oxm_list = loxi.generic_util.unpack_list(reader, oxm.oxm.unpack)
982 orig_reader.skip_align()
983 return obj
984
985 def __eq__(self, other):
986 if type(self) != type(other): return False
987 if self.oxm_list != other.oxm_list: return False
988 return True
989
990 def pretty_print(self, q):
991 q.text("match_v3 {")
992 with q.group():
993 with q.indent(2):
994 q.breakable()
995 q.text("oxm_list = ");
996 q.pp(self.oxm_list)
997 q.breakable()
998 q.text('}')
999
1000
1001class meter_band_stats(loxi.OFObject):
1002
1003 def __init__(self, packet_band_count=None, byte_band_count=None):
1004 if packet_band_count != None:
1005 self.packet_band_count = packet_band_count
1006 else:
1007 self.packet_band_count = 0
1008 if byte_band_count != None:
1009 self.byte_band_count = byte_band_count
1010 else:
1011 self.byte_band_count = 0
1012 return
1013
1014 def pack(self):
1015 packed = []
1016 packed.append(struct.pack("!Q", self.packet_band_count))
1017 packed.append(struct.pack("!Q", self.byte_band_count))
1018 return ''.join(packed)
1019
1020 @staticmethod
1021 def unpack(reader):
1022 obj = meter_band_stats()
1023 obj.packet_band_count = reader.read("!Q")[0]
1024 obj.byte_band_count = reader.read("!Q")[0]
1025 return obj
1026
1027 def __eq__(self, other):
1028 if type(self) != type(other): return False
1029 if self.packet_band_count != other.packet_band_count: return False
1030 if self.byte_band_count != other.byte_band_count: return False
1031 return True
1032
1033 def pretty_print(self, q):
1034 q.text("meter_band_stats {")
1035 with q.group():
1036 with q.indent(2):
1037 q.breakable()
1038 q.text("packet_band_count = ");
1039 q.text("%#x" % self.packet_band_count)
1040 q.text(","); q.breakable()
1041 q.text("byte_band_count = ");
1042 q.text("%#x" % self.byte_band_count)
1043 q.breakable()
1044 q.text('}')
1045
1046
1047class meter_config(loxi.OFObject):
1048
1049 def __init__(self, flags=None, meter_id=None, entries=None):
1050 if flags != None:
1051 self.flags = flags
1052 else:
1053 self.flags = 0
1054 if meter_id != None:
1055 self.meter_id = meter_id
1056 else:
1057 self.meter_id = 0
1058 if entries != None:
1059 self.entries = entries
1060 else:
1061 self.entries = []
1062 return
1063
1064 def pack(self):
1065 packed = []
1066 packed.append(struct.pack("!H", 0)) # placeholder for length at index 0
1067 packed.append(struct.pack("!H", self.flags))
1068 packed.append(struct.pack("!L", self.meter_id))
1069 packed.append(loxi.generic_util.pack_list(self.entries))
1070 length = sum([len(x) for x in packed])
1071 packed[0] = struct.pack("!H", length)
1072 return ''.join(packed)
1073
1074 @staticmethod
1075 def unpack(reader):
1076 obj = meter_config()
1077 _length = reader.read("!H")[0]
1078 orig_reader = reader
1079 reader = orig_reader.slice(_length - (0 + 2))
1080 obj.flags = reader.read("!H")[0]
1081 obj.meter_id = reader.read("!L")[0]
1082 obj.entries = loxi.generic_util.unpack_list(reader, meter_band.meter_band.unpack)
1083 return obj
1084
1085 def __eq__(self, other):
1086 if type(self) != type(other): return False
1087 if self.flags != other.flags: return False
1088 if self.meter_id != other.meter_id: return False
1089 if self.entries != other.entries: return False
1090 return True
1091
1092 def pretty_print(self, q):
1093 q.text("meter_config {")
1094 with q.group():
1095 with q.indent(2):
1096 q.breakable()
1097 q.text("flags = ");
1098 q.text("%#x" % self.flags)
1099 q.text(","); q.breakable()
1100 q.text("meter_id = ");
1101 q.text("%#x" % self.meter_id)
1102 q.text(","); q.breakable()
1103 q.text("entries = ");
1104 q.pp(self.entries)
1105 q.breakable()
1106 q.text('}')
1107
1108
1109class meter_features(loxi.OFObject):
1110
1111 def __init__(self, max_meter=None, band_types=None, capabilities=None, max_bands=None, max_color=None):
1112 if max_meter != None:
1113 self.max_meter = max_meter
1114 else:
1115 self.max_meter = 0
1116 if band_types != None:
1117 self.band_types = band_types
1118 else:
1119 self.band_types = 0
1120 if capabilities != None:
1121 self.capabilities = capabilities
1122 else:
1123 self.capabilities = 0
1124 if max_bands != None:
1125 self.max_bands = max_bands
1126 else:
1127 self.max_bands = 0
1128 if max_color != None:
1129 self.max_color = max_color
1130 else:
1131 self.max_color = 0
1132 return
1133
1134 def pack(self):
1135 packed = []
1136 packed.append(struct.pack("!L", self.max_meter))
1137 packed.append(struct.pack("!L", self.band_types))
1138 packed.append(struct.pack("!L", self.capabilities))
1139 packed.append(struct.pack("!B", self.max_bands))
1140 packed.append(struct.pack("!B", self.max_color))
1141 packed.append('\x00' * 2)
1142 return ''.join(packed)
1143
1144 @staticmethod
1145 def unpack(reader):
1146 obj = meter_features()
1147 obj.max_meter = reader.read("!L")[0]
1148 obj.band_types = reader.read("!L")[0]
1149 obj.capabilities = reader.read("!L")[0]
1150 obj.max_bands = reader.read("!B")[0]
1151 obj.max_color = reader.read("!B")[0]
1152 reader.skip(2)
1153 return obj
1154
1155 def __eq__(self, other):
1156 if type(self) != type(other): return False
1157 if self.max_meter != other.max_meter: return False
1158 if self.band_types != other.band_types: return False
1159 if self.capabilities != other.capabilities: return False
1160 if self.max_bands != other.max_bands: return False
1161 if self.max_color != other.max_color: return False
1162 return True
1163
1164 def pretty_print(self, q):
1165 q.text("meter_features {")
1166 with q.group():
1167 with q.indent(2):
1168 q.breakable()
1169 q.text("max_meter = ");
1170 q.text("%#x" % self.max_meter)
1171 q.text(","); q.breakable()
1172 q.text("band_types = ");
1173 q.text("%#x" % self.band_types)
1174 q.text(","); q.breakable()
1175 q.text("capabilities = ");
1176 q.text("%#x" % self.capabilities)
1177 q.text(","); q.breakable()
1178 q.text("max_bands = ");
1179 q.text("%#x" % self.max_bands)
1180 q.text(","); q.breakable()
1181 q.text("max_color = ");
1182 q.text("%#x" % self.max_color)
1183 q.breakable()
1184 q.text('}')
1185
1186
1187class meter_stats(loxi.OFObject):
1188
1189 def __init__(self, meter_id=None, flow_count=None, packet_in_count=None, byte_in_count=None, duration_sec=None, duration_nsec=None, band_stats=None):
1190 if meter_id != None:
1191 self.meter_id = meter_id
1192 else:
1193 self.meter_id = 0
1194 if flow_count != None:
1195 self.flow_count = flow_count
1196 else:
1197 self.flow_count = 0
1198 if packet_in_count != None:
1199 self.packet_in_count = packet_in_count
1200 else:
1201 self.packet_in_count = 0
1202 if byte_in_count != None:
1203 self.byte_in_count = byte_in_count
1204 else:
1205 self.byte_in_count = 0
1206 if duration_sec != None:
1207 self.duration_sec = duration_sec
1208 else:
1209 self.duration_sec = 0
1210 if duration_nsec != None:
1211 self.duration_nsec = duration_nsec
1212 else:
1213 self.duration_nsec = 0
1214 if band_stats != None:
1215 self.band_stats = band_stats
1216 else:
1217 self.band_stats = []
1218 return
1219
1220 def pack(self):
1221 packed = []
1222 packed.append(struct.pack("!L", self.meter_id))
1223 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
1224 packed.append('\x00' * 6)
1225 packed.append(struct.pack("!L", self.flow_count))
1226 packed.append(struct.pack("!Q", self.packet_in_count))
1227 packed.append(struct.pack("!Q", self.byte_in_count))
1228 packed.append(struct.pack("!L", self.duration_sec))
1229 packed.append(struct.pack("!L", self.duration_nsec))
1230 packed.append(loxi.generic_util.pack_list(self.band_stats))
1231 length = sum([len(x) for x in packed])
1232 packed[1] = struct.pack("!H", length)
1233 return ''.join(packed)
1234
1235 @staticmethod
1236 def unpack(reader):
1237 obj = meter_stats()
1238 obj.meter_id = reader.read("!L")[0]
1239 _len = reader.read("!H")[0]
1240 orig_reader = reader
1241 reader = orig_reader.slice(_len - (4 + 2))
1242 reader.skip(6)
1243 obj.flow_count = reader.read("!L")[0]
1244 obj.packet_in_count = reader.read("!Q")[0]
1245 obj.byte_in_count = reader.read("!Q")[0]
1246 obj.duration_sec = reader.read("!L")[0]
1247 obj.duration_nsec = reader.read("!L")[0]
1248 obj.band_stats = loxi.generic_util.unpack_list(reader, common.meter_band_stats.unpack)
1249 return obj
1250
1251 def __eq__(self, other):
1252 if type(self) != type(other): return False
1253 if self.meter_id != other.meter_id: return False
1254 if self.flow_count != other.flow_count: return False
1255 if self.packet_in_count != other.packet_in_count: return False
1256 if self.byte_in_count != other.byte_in_count: return False
1257 if self.duration_sec != other.duration_sec: return False
1258 if self.duration_nsec != other.duration_nsec: return False
1259 if self.band_stats != other.band_stats: return False
1260 return True
1261
1262 def pretty_print(self, q):
1263 q.text("meter_stats {")
1264 with q.group():
1265 with q.indent(2):
1266 q.breakable()
1267 q.text("meter_id = ");
1268 q.text("%#x" % self.meter_id)
1269 q.text(","); q.breakable()
1270 q.text("flow_count = ");
1271 q.text("%#x" % self.flow_count)
1272 q.text(","); q.breakable()
1273 q.text("packet_in_count = ");
1274 q.text("%#x" % self.packet_in_count)
1275 q.text(","); q.breakable()
1276 q.text("byte_in_count = ");
1277 q.text("%#x" % self.byte_in_count)
1278 q.text(","); q.breakable()
1279 q.text("duration_sec = ");
1280 q.text("%#x" % self.duration_sec)
1281 q.text(","); q.breakable()
1282 q.text("duration_nsec = ");
1283 q.text("%#x" % self.duration_nsec)
1284 q.text(","); q.breakable()
1285 q.text("band_stats = ");
1286 q.pp(self.band_stats)
1287 q.breakable()
1288 q.text('}')
1289
1290
1291class packet_queue(loxi.OFObject):
1292
1293 def __init__(self, queue_id=None, port=None, properties=None):
1294 if queue_id != None:
1295 self.queue_id = queue_id
1296 else:
1297 self.queue_id = 0
1298 if port != None:
1299 self.port = port
1300 else:
1301 self.port = 0
1302 if properties != None:
1303 self.properties = properties
1304 else:
1305 self.properties = []
1306 return
1307
1308 def pack(self):
1309 packed = []
1310 packed.append(struct.pack("!L", self.queue_id))
1311 packed.append(util.pack_port_no(self.port))
1312 packed.append(struct.pack("!H", 0)) # placeholder for len at index 2
1313 packed.append('\x00' * 6)
1314 packed.append(loxi.generic_util.pack_list(self.properties))
1315 length = sum([len(x) for x in packed])
1316 packed[2] = struct.pack("!H", length)
1317 return ''.join(packed)
1318
1319 @staticmethod
1320 def unpack(reader):
1321 obj = packet_queue()
1322 obj.queue_id = reader.read("!L")[0]
1323 obj.port = util.unpack_port_no(reader)
1324 _len = reader.read("!H")[0]
1325 orig_reader = reader
1326 reader = orig_reader.slice(_len - (8 + 2))
1327 reader.skip(6)
1328 obj.properties = loxi.generic_util.unpack_list(reader, common.queue_prop.unpack)
1329 return obj
1330
1331 def __eq__(self, other):
1332 if type(self) != type(other): return False
1333 if self.queue_id != other.queue_id: return False
1334 if self.port != other.port: return False
1335 if self.properties != other.properties: return False
1336 return True
1337
1338 def pretty_print(self, q):
1339 q.text("packet_queue {")
1340 with q.group():
1341 with q.indent(2):
1342 q.breakable()
1343 q.text("queue_id = ");
1344 q.text("%#x" % self.queue_id)
1345 q.text(","); q.breakable()
1346 q.text("port = ");
1347 q.text(util.pretty_port(self.port))
1348 q.text(","); q.breakable()
1349 q.text("properties = ");
1350 q.pp(self.properties)
1351 q.breakable()
1352 q.text('}')
1353
1354
1355class port_desc(loxi.OFObject):
1356
1357 def __init__(self, port_no=None, hw_addr=None, name=None, config=None, state=None, properties=None):
1358 if port_no != None:
1359 self.port_no = port_no
1360 else:
1361 self.port_no = 0
1362 if hw_addr != None:
1363 self.hw_addr = hw_addr
1364 else:
1365 self.hw_addr = [0,0,0,0,0,0]
1366 if name != None:
1367 self.name = name
1368 else:
1369 self.name = ""
1370 if config != None:
1371 self.config = config
1372 else:
1373 self.config = 0
1374 if state != None:
1375 self.state = state
1376 else:
1377 self.state = 0
1378 if properties != None:
1379 self.properties = properties
1380 else:
1381 self.properties = []
1382 return
1383
1384 def pack(self):
1385 packed = []
1386 packed.append(util.pack_port_no(self.port_no))
1387 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1388 packed.append('\x00' * 2)
1389 packed.append(struct.pack("!6B", *self.hw_addr))
1390 packed.append('\x00' * 2)
1391 packed.append(struct.pack("!16s", self.name))
1392 packed.append(struct.pack("!L", self.config))
1393 packed.append(struct.pack("!L", self.state))
1394 packed.append(loxi.generic_util.pack_list(self.properties))
1395 length = sum([len(x) for x in packed])
1396 packed[1] = struct.pack("!H", length)
1397 return ''.join(packed)
1398
1399 @staticmethod
1400 def unpack(reader):
1401 obj = port_desc()
1402 obj.port_no = util.unpack_port_no(reader)
1403 _length = reader.read("!H")[0]
1404 orig_reader = reader
1405 reader = orig_reader.slice(_length - (4 + 2))
1406 reader.skip(2)
1407 obj.hw_addr = list(reader.read('!6B'))
1408 reader.skip(2)
1409 obj.name = reader.read("!16s")[0].rstrip("\x00")
1410 obj.config = reader.read("!L")[0]
1411 obj.state = reader.read("!L")[0]
1412 obj.properties = loxi.generic_util.unpack_list(reader, port_desc_prop.port_desc_prop.unpack)
1413 return obj
1414
1415 def __eq__(self, other):
1416 if type(self) != type(other): return False
1417 if self.port_no != other.port_no: return False
1418 if self.hw_addr != other.hw_addr: return False
1419 if self.name != other.name: return False
1420 if self.config != other.config: return False
1421 if self.state != other.state: return False
1422 if self.properties != other.properties: return False
1423 return True
1424
1425 def pretty_print(self, q):
1426 q.text("port_desc {")
1427 with q.group():
1428 with q.indent(2):
1429 q.breakable()
1430 q.text("port_no = ");
1431 q.text(util.pretty_port(self.port_no))
1432 q.text(","); q.breakable()
1433 q.text("hw_addr = ");
1434 q.text(util.pretty_mac(self.hw_addr))
1435 q.text(","); q.breakable()
1436 q.text("name = ");
1437 q.pp(self.name)
1438 q.text(","); q.breakable()
1439 q.text("config = ");
1440 q.text("%#x" % self.config)
1441 q.text(","); q.breakable()
1442 q.text("state = ");
1443 q.text("%#x" % self.state)
1444 q.text(","); q.breakable()
1445 q.text("properties = ");
1446 q.pp(self.properties)
1447 q.breakable()
1448 q.text('}')
1449
1450
1451class port_stats_entry(loxi.OFObject):
1452
1453 def __init__(self, port_no=None, duration_sec=None, duration_nsec=None, rx_packets=None, tx_packets=None, rx_bytes=None, tx_bytes=None, rx_dropped=None, tx_dropped=None, rx_errors=None, tx_errors=None, properties=None):
1454 if port_no != None:
1455 self.port_no = port_no
1456 else:
1457 self.port_no = 0
1458 if duration_sec != None:
1459 self.duration_sec = duration_sec
1460 else:
1461 self.duration_sec = 0
1462 if duration_nsec != None:
1463 self.duration_nsec = duration_nsec
1464 else:
1465 self.duration_nsec = 0
1466 if rx_packets != None:
1467 self.rx_packets = rx_packets
1468 else:
1469 self.rx_packets = 0
1470 if tx_packets != None:
1471 self.tx_packets = tx_packets
1472 else:
1473 self.tx_packets = 0
1474 if rx_bytes != None:
1475 self.rx_bytes = rx_bytes
1476 else:
1477 self.rx_bytes = 0
1478 if tx_bytes != None:
1479 self.tx_bytes = tx_bytes
1480 else:
1481 self.tx_bytes = 0
1482 if rx_dropped != None:
1483 self.rx_dropped = rx_dropped
1484 else:
1485 self.rx_dropped = 0
1486 if tx_dropped != None:
1487 self.tx_dropped = tx_dropped
1488 else:
1489 self.tx_dropped = 0
1490 if rx_errors != None:
1491 self.rx_errors = rx_errors
1492 else:
1493 self.rx_errors = 0
1494 if tx_errors != None:
1495 self.tx_errors = tx_errors
1496 else:
1497 self.tx_errors = 0
1498 if properties != None:
1499 self.properties = properties
1500 else:
1501 self.properties = []
1502 return
1503
1504 def pack(self):
1505 packed = []
1506 packed.append(struct.pack("!H", 0)) # placeholder for length at index 0
1507 packed.append('\x00' * 2)
1508 packed.append(util.pack_port_no(self.port_no))
1509 packed.append(struct.pack("!L", self.duration_sec))
1510 packed.append(struct.pack("!L", self.duration_nsec))
1511 packed.append(struct.pack("!Q", self.rx_packets))
1512 packed.append(struct.pack("!Q", self.tx_packets))
1513 packed.append(struct.pack("!Q", self.rx_bytes))
1514 packed.append(struct.pack("!Q", self.tx_bytes))
1515 packed.append(struct.pack("!Q", self.rx_dropped))
1516 packed.append(struct.pack("!Q", self.tx_dropped))
1517 packed.append(struct.pack("!Q", self.rx_errors))
1518 packed.append(struct.pack("!Q", self.tx_errors))
1519 packed.append(loxi.generic_util.pack_list(self.properties))
1520 length = sum([len(x) for x in packed])
1521 packed[0] = struct.pack("!H", length)
1522 return ''.join(packed)
1523
1524 @staticmethod
1525 def unpack(reader):
1526 obj = port_stats_entry()
1527 _length = reader.read("!H")[0]
1528 orig_reader = reader
1529 reader = orig_reader.slice(_length - (0 + 2))
1530 reader.skip(2)
1531 obj.port_no = util.unpack_port_no(reader)
1532 obj.duration_sec = reader.read("!L")[0]
1533 obj.duration_nsec = reader.read("!L")[0]
1534 obj.rx_packets = reader.read("!Q")[0]
1535 obj.tx_packets = reader.read("!Q")[0]
1536 obj.rx_bytes = reader.read("!Q")[0]
1537 obj.tx_bytes = reader.read("!Q")[0]
1538 obj.rx_dropped = reader.read("!Q")[0]
1539 obj.tx_dropped = reader.read("!Q")[0]
1540 obj.rx_errors = reader.read("!Q")[0]
1541 obj.tx_errors = reader.read("!Q")[0]
1542 obj.properties = loxi.generic_util.unpack_list(reader, port_stats_prop.port_stats_prop.unpack)
1543 return obj
1544
1545 def __eq__(self, other):
1546 if type(self) != type(other): return False
1547 if self.port_no != other.port_no: return False
1548 if self.duration_sec != other.duration_sec: return False
1549 if self.duration_nsec != other.duration_nsec: return False
1550 if self.rx_packets != other.rx_packets: return False
1551 if self.tx_packets != other.tx_packets: return False
1552 if self.rx_bytes != other.rx_bytes: return False
1553 if self.tx_bytes != other.tx_bytes: return False
1554 if self.rx_dropped != other.rx_dropped: return False
1555 if self.tx_dropped != other.tx_dropped: return False
1556 if self.rx_errors != other.rx_errors: return False
1557 if self.tx_errors != other.tx_errors: return False
1558 if self.properties != other.properties: return False
1559 return True
1560
1561 def pretty_print(self, q):
1562 q.text("port_stats_entry {")
1563 with q.group():
1564 with q.indent(2):
1565 q.breakable()
1566 q.text("port_no = ");
1567 q.text(util.pretty_port(self.port_no))
1568 q.text(","); q.breakable()
1569 q.text("duration_sec = ");
1570 q.text("%#x" % self.duration_sec)
1571 q.text(","); q.breakable()
1572 q.text("duration_nsec = ");
1573 q.text("%#x" % self.duration_nsec)
1574 q.text(","); q.breakable()
1575 q.text("rx_packets = ");
1576 q.text("%#x" % self.rx_packets)
1577 q.text(","); q.breakable()
1578 q.text("tx_packets = ");
1579 q.text("%#x" % self.tx_packets)
1580 q.text(","); q.breakable()
1581 q.text("rx_bytes = ");
1582 q.text("%#x" % self.rx_bytes)
1583 q.text(","); q.breakable()
1584 q.text("tx_bytes = ");
1585 q.text("%#x" % self.tx_bytes)
1586 q.text(","); q.breakable()
1587 q.text("rx_dropped = ");
1588 q.text("%#x" % self.rx_dropped)
1589 q.text(","); q.breakable()
1590 q.text("tx_dropped = ");
1591 q.text("%#x" % self.tx_dropped)
1592 q.text(","); q.breakable()
1593 q.text("rx_errors = ");
1594 q.text("%#x" % self.rx_errors)
1595 q.text(","); q.breakable()
1596 q.text("tx_errors = ");
1597 q.text("%#x" % self.tx_errors)
1598 q.text(","); q.breakable()
1599 q.text("properties = ");
1600 q.pp(self.properties)
1601 q.breakable()
1602 q.text('}')
1603
1604
1605class queue_desc(loxi.OFObject):
1606
1607 def __init__(self, port_no=None, queue_id=None, properties=None):
1608 if port_no != None:
1609 self.port_no = port_no
1610 else:
1611 self.port_no = 0
1612 if queue_id != None:
1613 self.queue_id = queue_id
1614 else:
1615 self.queue_id = 0
1616 if properties != None:
1617 self.properties = properties
1618 else:
1619 self.properties = []
1620 return
1621
1622 def pack(self):
1623 packed = []
1624 packed.append(struct.pack("!L", self.port_no))
1625 packed.append(struct.pack("!L", self.queue_id))
1626 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1627 packed.append('\x00' * 6)
1628 packed.append(loxi.generic_util.pack_list(self.properties))
1629 length = sum([len(x) for x in packed])
1630 packed[2] = struct.pack("!H", length)
1631 return ''.join(packed)
1632
1633 @staticmethod
1634 def unpack(reader):
1635 obj = queue_desc()
1636 obj.port_no = reader.read("!L")[0]
1637 obj.queue_id = reader.read("!L")[0]
1638 _length = reader.read("!H")[0]
1639 orig_reader = reader
1640 reader = orig_reader.slice(_length - (8 + 2))
1641 reader.skip(6)
1642 obj.properties = loxi.generic_util.unpack_list(reader, queue_desc_prop.queue_desc_prop.unpack)
1643 return obj
1644
1645 def __eq__(self, other):
1646 if type(self) != type(other): return False
1647 if self.port_no != other.port_no: return False
1648 if self.queue_id != other.queue_id: return False
1649 if self.properties != other.properties: return False
1650 return True
1651
1652 def pretty_print(self, q):
1653 q.text("queue_desc {")
1654 with q.group():
1655 with q.indent(2):
1656 q.breakable()
1657 q.text("port_no = ");
1658 q.text("%#x" % self.port_no)
1659 q.text(","); q.breakable()
1660 q.text("queue_id = ");
1661 q.text("%#x" % self.queue_id)
1662 q.text(","); q.breakable()
1663 q.text("properties = ");
1664 q.pp(self.properties)
1665 q.breakable()
1666 q.text('}')
1667
1668
1669class queue_prop(loxi.OFObject):
1670 subtypes = {}
1671
1672
1673 def __init__(self, type=None):
1674 if type != None:
1675 self.type = type
1676 else:
1677 self.type = 0
1678 return
1679
1680 def pack(self):
1681 packed = []
1682 packed.append(struct.pack("!H", self.type))
1683 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
1684 packed.append('\x00' * 4)
1685 length = sum([len(x) for x in packed])
1686 packed[1] = struct.pack("!H", length)
1687 return ''.join(packed)
1688
1689 @staticmethod
1690 def unpack(reader):
1691 subtype, = reader.peek('!H', 0)
1692 subclass = queue_prop.subtypes.get(subtype)
1693 if subclass:
1694 return subclass.unpack(reader)
1695
1696 obj = queue_prop()
1697 obj.type = reader.read("!H")[0]
1698 _len = reader.read("!H")[0]
1699 orig_reader = reader
1700 reader = orig_reader.slice(_len - (2 + 2))
1701 reader.skip(4)
1702 return obj
1703
1704 def __eq__(self, other):
1705 if type(self) != type(other): return False
1706 if self.type != other.type: return False
1707 return True
1708
1709 def pretty_print(self, q):
1710 q.text("queue_prop {")
1711 with q.group():
1712 with q.indent(2):
1713 q.breakable()
1714 q.breakable()
1715 q.text('}')
1716
1717
1718class queue_prop_experimenter(queue_prop):
1719 subtypes = {}
1720
1721 type = 65535
1722
1723 def __init__(self, experimenter=None, data=None):
1724 if experimenter != None:
1725 self.experimenter = experimenter
1726 else:
1727 self.experimenter = 0
1728 if data != None:
1729 self.data = data
1730 else:
1731 self.data = ''
1732 return
1733
1734 def pack(self):
1735 packed = []
1736 packed.append(struct.pack("!H", self.type))
1737 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
1738 packed.append('\x00' * 4)
1739 packed.append(struct.pack("!L", self.experimenter))
1740 packed.append('\x00' * 4)
1741 packed.append(self.data)
1742 length = sum([len(x) for x in packed])
1743 packed[1] = struct.pack("!H", length)
1744 return ''.join(packed)
1745
1746 @staticmethod
1747 def unpack(reader):
1748 subtype, = reader.peek('!L', 8)
1749 subclass = queue_prop_experimenter.subtypes.get(subtype)
1750 if subclass:
1751 return subclass.unpack(reader)
1752
1753 obj = queue_prop_experimenter()
1754 _type = reader.read("!H")[0]
1755 assert(_type == 65535)
1756 _len = reader.read("!H")[0]
1757 orig_reader = reader
1758 reader = orig_reader.slice(_len - (2 + 2))
1759 reader.skip(4)
1760 obj.experimenter = reader.read("!L")[0]
1761 reader.skip(4)
1762 obj.data = str(reader.read_all())
1763 return obj
1764
1765 def __eq__(self, other):
1766 if type(self) != type(other): return False
1767 if self.experimenter != other.experimenter: return False
1768 if self.data != other.data: return False
1769 return True
1770
1771 def pretty_print(self, q):
1772 q.text("queue_prop_experimenter {")
1773 with q.group():
1774 with q.indent(2):
1775 q.breakable()
1776 q.text("data = ");
1777 q.pp(self.data)
1778 q.breakable()
1779 q.text('}')
1780
1781queue_prop.subtypes[65535] = queue_prop_experimenter
1782
1783class queue_prop_max_rate(queue_prop):
1784 type = 2
1785
1786 def __init__(self, rate=None):
1787 if rate != None:
1788 self.rate = rate
1789 else:
1790 self.rate = 0
1791 return
1792
1793 def pack(self):
1794 packed = []
1795 packed.append(struct.pack("!H", self.type))
1796 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
1797 packed.append('\x00' * 4)
1798 packed.append(struct.pack("!H", self.rate))
1799 packed.append('\x00' * 6)
1800 length = sum([len(x) for x in packed])
1801 packed[1] = struct.pack("!H", length)
1802 return ''.join(packed)
1803
1804 @staticmethod
1805 def unpack(reader):
1806 obj = queue_prop_max_rate()
1807 _type = reader.read("!H")[0]
1808 assert(_type == 2)
1809 _len = reader.read("!H")[0]
1810 orig_reader = reader
1811 reader = orig_reader.slice(_len - (2 + 2))
1812 reader.skip(4)
1813 obj.rate = reader.read("!H")[0]
1814 reader.skip(6)
1815 return obj
1816
1817 def __eq__(self, other):
1818 if type(self) != type(other): return False
1819 if self.rate != other.rate: return False
1820 return True
1821
1822 def pretty_print(self, q):
1823 q.text("queue_prop_max_rate {")
1824 with q.group():
1825 with q.indent(2):
1826 q.breakable()
1827 q.text("rate = ");
1828 q.text("%#x" % self.rate)
1829 q.breakable()
1830 q.text('}')
1831
1832queue_prop.subtypes[2] = queue_prop_max_rate
1833
1834class queue_prop_min_rate(queue_prop):
1835 type = 1
1836
1837 def __init__(self, rate=None):
1838 if rate != None:
1839 self.rate = rate
1840 else:
1841 self.rate = 0
1842 return
1843
1844 def pack(self):
1845 packed = []
1846 packed.append(struct.pack("!H", self.type))
1847 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
1848 packed.append('\x00' * 4)
1849 packed.append(struct.pack("!H", self.rate))
1850 packed.append('\x00' * 6)
1851 length = sum([len(x) for x in packed])
1852 packed[1] = struct.pack("!H", length)
1853 return ''.join(packed)
1854
1855 @staticmethod
1856 def unpack(reader):
1857 obj = queue_prop_min_rate()
1858 _type = reader.read("!H")[0]
1859 assert(_type == 1)
1860 _len = reader.read("!H")[0]
1861 orig_reader = reader
1862 reader = orig_reader.slice(_len - (2 + 2))
1863 reader.skip(4)
1864 obj.rate = reader.read("!H")[0]
1865 reader.skip(6)
1866 return obj
1867
1868 def __eq__(self, other):
1869 if type(self) != type(other): return False
1870 if self.rate != other.rate: return False
1871 return True
1872
1873 def pretty_print(self, q):
1874 q.text("queue_prop_min_rate {")
1875 with q.group():
1876 with q.indent(2):
1877 q.breakable()
1878 q.text("rate = ");
1879 q.text("%#x" % self.rate)
1880 q.breakable()
1881 q.text('}')
1882
1883queue_prop.subtypes[1] = queue_prop_min_rate
1884
1885class queue_stats_entry(loxi.OFObject):
1886
1887 def __init__(self, port_no=None, queue_id=None, tx_bytes=None, tx_packets=None, tx_errors=None, duration_sec=None, duration_nsec=None, properties=None):
1888 if port_no != None:
1889 self.port_no = port_no
1890 else:
1891 self.port_no = 0
1892 if queue_id != None:
1893 self.queue_id = queue_id
1894 else:
1895 self.queue_id = 0
1896 if tx_bytes != None:
1897 self.tx_bytes = tx_bytes
1898 else:
1899 self.tx_bytes = 0
1900 if tx_packets != None:
1901 self.tx_packets = tx_packets
1902 else:
1903 self.tx_packets = 0
1904 if tx_errors != None:
1905 self.tx_errors = tx_errors
1906 else:
1907 self.tx_errors = 0
1908 if duration_sec != None:
1909 self.duration_sec = duration_sec
1910 else:
1911 self.duration_sec = 0
1912 if duration_nsec != None:
1913 self.duration_nsec = duration_nsec
1914 else:
1915 self.duration_nsec = 0
1916 if properties != None:
1917 self.properties = properties
1918 else:
1919 self.properties = []
1920 return
1921
1922 def pack(self):
1923 packed = []
1924 packed.append(struct.pack("!H", 0)) # placeholder for length at index 0
1925 packed.append('\x00' * 6)
1926 packed.append(util.pack_port_no(self.port_no))
1927 packed.append(struct.pack("!L", self.queue_id))
1928 packed.append(struct.pack("!Q", self.tx_bytes))
1929 packed.append(struct.pack("!Q", self.tx_packets))
1930 packed.append(struct.pack("!Q", self.tx_errors))
1931 packed.append(struct.pack("!L", self.duration_sec))
1932 packed.append(struct.pack("!L", self.duration_nsec))
1933 packed.append(loxi.generic_util.pack_list(self.properties))
1934 length = sum([len(x) for x in packed])
1935 packed[0] = struct.pack("!H", length)
1936 return ''.join(packed)
1937
1938 @staticmethod
1939 def unpack(reader):
1940 obj = queue_stats_entry()
1941 _length = reader.read("!H")[0]
1942 orig_reader = reader
1943 reader = orig_reader.slice(_length - (0 + 2))
1944 reader.skip(6)
1945 obj.port_no = util.unpack_port_no(reader)
1946 obj.queue_id = reader.read("!L")[0]
1947 obj.tx_bytes = reader.read("!Q")[0]
1948 obj.tx_packets = reader.read("!Q")[0]
1949 obj.tx_errors = reader.read("!Q")[0]
1950 obj.duration_sec = reader.read("!L")[0]
1951 obj.duration_nsec = reader.read("!L")[0]
1952 obj.properties = loxi.generic_util.unpack_list(reader, queue_stats_prop.queue_stats_prop.unpack)
1953 return obj
1954
1955 def __eq__(self, other):
1956 if type(self) != type(other): return False
1957 if self.port_no != other.port_no: return False
1958 if self.queue_id != other.queue_id: return False
1959 if self.tx_bytes != other.tx_bytes: return False
1960 if self.tx_packets != other.tx_packets: return False
1961 if self.tx_errors != other.tx_errors: return False
1962 if self.duration_sec != other.duration_sec: return False
1963 if self.duration_nsec != other.duration_nsec: return False
1964 if self.properties != other.properties: return False
1965 return True
1966
1967 def pretty_print(self, q):
1968 q.text("queue_stats_entry {")
1969 with q.group():
1970 with q.indent(2):
1971 q.breakable()
1972 q.text("port_no = ");
1973 q.text(util.pretty_port(self.port_no))
1974 q.text(","); q.breakable()
1975 q.text("queue_id = ");
1976 q.text("%#x" % self.queue_id)
1977 q.text(","); q.breakable()
1978 q.text("tx_bytes = ");
1979 q.text("%#x" % self.tx_bytes)
1980 q.text(","); q.breakable()
1981 q.text("tx_packets = ");
1982 q.text("%#x" % self.tx_packets)
1983 q.text(","); q.breakable()
1984 q.text("tx_errors = ");
1985 q.text("%#x" % self.tx_errors)
1986 q.text(","); q.breakable()
1987 q.text("duration_sec = ");
1988 q.text("%#x" % self.duration_sec)
1989 q.text(","); q.breakable()
1990 q.text("duration_nsec = ");
1991 q.text("%#x" % self.duration_nsec)
1992 q.text(","); q.breakable()
1993 q.text("properties = ");
1994 q.pp(self.properties)
1995 q.breakable()
1996 q.text('}')
1997
1998
1999class table_desc(loxi.OFObject):
2000
2001 def __init__(self, table_id=None, config=None):
2002 if table_id != None:
2003 self.table_id = table_id
2004 else:
2005 self.table_id = 0
2006 if config != None:
2007 self.config = config
2008 else:
2009 self.config = 0
2010 return
2011
2012 def pack(self):
2013 packed = []
2014 packed.append(struct.pack("!H", 0)) # placeholder for length at index 0
2015 packed.append(struct.pack("!B", self.table_id))
2016 packed.append('\x00' * 1)
2017 packed.append(struct.pack("!L", self.config))
2018 length = sum([len(x) for x in packed])
2019 packed[0] = struct.pack("!H", length)
2020 return ''.join(packed)
2021
2022 @staticmethod
2023 def unpack(reader):
2024 obj = table_desc()
2025 _length = reader.read("!H")[0]
2026 orig_reader = reader
2027 reader = orig_reader.slice(_length - (0 + 2))
2028 obj.table_id = reader.read("!B")[0]
2029 reader.skip(1)
2030 obj.config = reader.read("!L")[0]
2031 return obj
2032
2033 def __eq__(self, other):
2034 if type(self) != type(other): return False
2035 if self.table_id != other.table_id: return False
2036 if self.config != other.config: return False
2037 return True
2038
2039 def pretty_print(self, q):
2040 q.text("table_desc {")
2041 with q.group():
2042 with q.indent(2):
2043 q.breakable()
2044 q.text("table_id = ");
2045 q.text("%#x" % self.table_id)
2046 q.text(","); q.breakable()
2047 q.text("config = ");
2048 q.text("%#x" % self.config)
2049 q.breakable()
2050 q.text('}')
2051
2052
2053class table_feature_prop(loxi.OFObject):
2054 subtypes = {}
2055
2056
2057 def __init__(self, type=None):
2058 if type != None:
2059 self.type = type
2060 else:
2061 self.type = 0
2062 return
2063
2064 def pack(self):
2065 packed = []
2066 packed.append(struct.pack("!H", self.type))
2067 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2068 length = sum([len(x) for x in packed])
2069 packed[1] = struct.pack("!H", length)
2070 return ''.join(packed)
2071
2072 @staticmethod
2073 def unpack(reader):
2074 subtype, = reader.peek('!H', 0)
2075 subclass = table_feature_prop.subtypes.get(subtype)
2076 if subclass:
2077 return subclass.unpack(reader)
2078
2079 obj = table_feature_prop()
2080 obj.type = reader.read("!H")[0]
2081 _length = reader.read("!H")[0]
2082 orig_reader = reader
2083 reader = orig_reader.slice(_length - (2 + 2))
2084 return obj
2085
2086 def __eq__(self, other):
2087 if type(self) != type(other): return False
2088 if self.type != other.type: return False
2089 return True
2090
2091 def pretty_print(self, q):
2092 q.text("table_feature_prop {")
2093 with q.group():
2094 with q.indent(2):
2095 q.breakable()
2096 q.breakable()
2097 q.text('}')
2098
2099
2100class table_feature_prop_apply_actions(table_feature_prop):
2101 type = 6
2102
2103 def __init__(self, action_ids=None):
2104 if action_ids != None:
2105 self.action_ids = action_ids
2106 else:
2107 self.action_ids = []
2108 return
2109
2110 def pack(self):
2111 packed = []
2112 packed.append(struct.pack("!H", self.type))
2113 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2114 packed.append(loxi.generic_util.pack_list(self.action_ids))
2115 length = sum([len(x) for x in packed])
2116 packed[1] = struct.pack("!H", length)
2117 return ''.join(packed)
2118
2119 @staticmethod
2120 def unpack(reader):
2121 obj = table_feature_prop_apply_actions()
2122 _type = reader.read("!H")[0]
2123 assert(_type == 6)
2124 _length = reader.read("!H")[0]
2125 orig_reader = reader
2126 reader = orig_reader.slice(_length - (2 + 2))
2127 obj.action_ids = loxi.generic_util.unpack_list(reader, action_id.action_id.unpack)
2128 return obj
2129
2130 def __eq__(self, other):
2131 if type(self) != type(other): return False
2132 if self.action_ids != other.action_ids: return False
2133 return True
2134
2135 def pretty_print(self, q):
2136 q.text("table_feature_prop_apply_actions {")
2137 with q.group():
2138 with q.indent(2):
2139 q.breakable()
2140 q.text("action_ids = ");
2141 q.pp(self.action_ids)
2142 q.breakable()
2143 q.text('}')
2144
2145table_feature_prop.subtypes[6] = table_feature_prop_apply_actions
2146
2147class table_feature_prop_apply_actions_miss(table_feature_prop):
2148 type = 7
2149
2150 def __init__(self, action_ids=None):
2151 if action_ids != None:
2152 self.action_ids = action_ids
2153 else:
2154 self.action_ids = []
2155 return
2156
2157 def pack(self):
2158 packed = []
2159 packed.append(struct.pack("!H", self.type))
2160 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2161 packed.append(loxi.generic_util.pack_list(self.action_ids))
2162 length = sum([len(x) for x in packed])
2163 packed[1] = struct.pack("!H", length)
2164 return ''.join(packed)
2165
2166 @staticmethod
2167 def unpack(reader):
2168 obj = table_feature_prop_apply_actions_miss()
2169 _type = reader.read("!H")[0]
2170 assert(_type == 7)
2171 _length = reader.read("!H")[0]
2172 orig_reader = reader
2173 reader = orig_reader.slice(_length - (2 + 2))
2174 obj.action_ids = loxi.generic_util.unpack_list(reader, action_id.action_id.unpack)
2175 return obj
2176
2177 def __eq__(self, other):
2178 if type(self) != type(other): return False
2179 if self.action_ids != other.action_ids: return False
2180 return True
2181
2182 def pretty_print(self, q):
2183 q.text("table_feature_prop_apply_actions_miss {")
2184 with q.group():
2185 with q.indent(2):
2186 q.breakable()
2187 q.text("action_ids = ");
2188 q.pp(self.action_ids)
2189 q.breakable()
2190 q.text('}')
2191
2192table_feature_prop.subtypes[7] = table_feature_prop_apply_actions_miss
2193
2194class table_feature_prop_apply_setfield(table_feature_prop):
2195 type = 14
2196
2197 def __init__(self, oxm_ids=None):
2198 if oxm_ids != None:
2199 self.oxm_ids = oxm_ids
2200 else:
2201 self.oxm_ids = []
2202 return
2203
2204 def pack(self):
2205 packed = []
2206 packed.append(struct.pack("!H", self.type))
2207 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2208 packed.append(loxi.generic_util.pack_list(self.oxm_ids))
2209 length = sum([len(x) for x in packed])
2210 packed[1] = struct.pack("!H", length)
2211 return ''.join(packed)
2212
2213 @staticmethod
2214 def unpack(reader):
2215 obj = table_feature_prop_apply_setfield()
2216 _type = reader.read("!H")[0]
2217 assert(_type == 14)
2218 _length = reader.read("!H")[0]
2219 orig_reader = reader
2220 reader = orig_reader.slice(_length - (2 + 2))
2221 obj.oxm_ids = loxi.generic_util.unpack_list(reader, common.uint32.unpack)
2222 return obj
2223
2224 def __eq__(self, other):
2225 if type(self) != type(other): return False
2226 if self.oxm_ids != other.oxm_ids: return False
2227 return True
2228
2229 def pretty_print(self, q):
2230 q.text("table_feature_prop_apply_setfield {")
2231 with q.group():
2232 with q.indent(2):
2233 q.breakable()
2234 q.text("oxm_ids = ");
2235 q.pp(self.oxm_ids)
2236 q.breakable()
2237 q.text('}')
2238
2239table_feature_prop.subtypes[14] = table_feature_prop_apply_setfield
2240
2241class table_feature_prop_apply_setfield_miss(table_feature_prop):
2242 type = 15
2243
2244 def __init__(self, oxm_ids=None):
2245 if oxm_ids != None:
2246 self.oxm_ids = oxm_ids
2247 else:
2248 self.oxm_ids = []
2249 return
2250
2251 def pack(self):
2252 packed = []
2253 packed.append(struct.pack("!H", self.type))
2254 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2255 packed.append(loxi.generic_util.pack_list(self.oxm_ids))
2256 length = sum([len(x) for x in packed])
2257 packed[1] = struct.pack("!H", length)
2258 return ''.join(packed)
2259
2260 @staticmethod
2261 def unpack(reader):
2262 obj = table_feature_prop_apply_setfield_miss()
2263 _type = reader.read("!H")[0]
2264 assert(_type == 15)
2265 _length = reader.read("!H")[0]
2266 orig_reader = reader
2267 reader = orig_reader.slice(_length - (2 + 2))
2268 obj.oxm_ids = loxi.generic_util.unpack_list(reader, common.uint32.unpack)
2269 return obj
2270
2271 def __eq__(self, other):
2272 if type(self) != type(other): return False
2273 if self.oxm_ids != other.oxm_ids: return False
2274 return True
2275
2276 def pretty_print(self, q):
2277 q.text("table_feature_prop_apply_setfield_miss {")
2278 with q.group():
2279 with q.indent(2):
2280 q.breakable()
2281 q.text("oxm_ids = ");
2282 q.pp(self.oxm_ids)
2283 q.breakable()
2284 q.text('}')
2285
2286table_feature_prop.subtypes[15] = table_feature_prop_apply_setfield_miss
2287
2288class table_feature_prop_experimenter(table_feature_prop):
2289 subtypes = {}
2290
2291 type = 65534
2292
2293 def __init__(self, experimenter=None, subtype=None, experimenter_data=None):
2294 if experimenter != None:
2295 self.experimenter = experimenter
2296 else:
2297 self.experimenter = 0
2298 if subtype != None:
2299 self.subtype = subtype
2300 else:
2301 self.subtype = 0
2302 if experimenter_data != None:
2303 self.experimenter_data = experimenter_data
2304 else:
2305 self.experimenter_data = ''
2306 return
2307
2308 def pack(self):
2309 packed = []
2310 packed.append(struct.pack("!H", self.type))
2311 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2312 packed.append(struct.pack("!L", self.experimenter))
2313 packed.append(struct.pack("!L", self.subtype))
2314 packed.append(self.experimenter_data)
2315 length = sum([len(x) for x in packed])
2316 packed[1] = struct.pack("!H", length)
2317 return ''.join(packed)
2318
2319 @staticmethod
2320 def unpack(reader):
2321 subtype, = reader.peek('!L', 4)
2322 subclass = table_feature_prop_experimenter.subtypes.get(subtype)
2323 if subclass:
2324 return subclass.unpack(reader)
2325
2326 obj = table_feature_prop_experimenter()
2327 _type = reader.read("!H")[0]
2328 assert(_type == 65534)
2329 _length = reader.read("!H")[0]
2330 orig_reader = reader
2331 reader = orig_reader.slice(_length - (2 + 2))
2332 obj.experimenter = reader.read("!L")[0]
2333 obj.subtype = reader.read("!L")[0]
2334 obj.experimenter_data = str(reader.read_all())
2335 return obj
2336
2337 def __eq__(self, other):
2338 if type(self) != type(other): return False
2339 if self.experimenter != other.experimenter: return False
2340 if self.subtype != other.subtype: return False
2341 if self.experimenter_data != other.experimenter_data: return False
2342 return True
2343
2344 def pretty_print(self, q):
2345 q.text("table_feature_prop_experimenter {")
2346 with q.group():
2347 with q.indent(2):
2348 q.breakable()
2349 q.text("subtype = ");
2350 q.text("%#x" % self.subtype)
2351 q.text(","); q.breakable()
2352 q.text("experimenter_data = ");
2353 q.pp(self.experimenter_data)
2354 q.breakable()
2355 q.text('}')
2356
2357table_feature_prop.subtypes[65534] = table_feature_prop_experimenter
2358
2359class table_feature_prop_experimenter_miss(table_feature_prop):
2360 subtypes = {}
2361
2362 type = 65535
2363
2364 def __init__(self, experimenter=None, subtype=None, experimenter_data=None):
2365 if experimenter != None:
2366 self.experimenter = experimenter
2367 else:
2368 self.experimenter = 0
2369 if subtype != None:
2370 self.subtype = subtype
2371 else:
2372 self.subtype = 0
2373 if experimenter_data != None:
2374 self.experimenter_data = experimenter_data
2375 else:
2376 self.experimenter_data = ''
2377 return
2378
2379 def pack(self):
2380 packed = []
2381 packed.append(struct.pack("!H", self.type))
2382 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2383 packed.append(struct.pack("!L", self.experimenter))
2384 packed.append(struct.pack("!L", self.subtype))
2385 packed.append(self.experimenter_data)
2386 length = sum([len(x) for x in packed])
2387 packed[1] = struct.pack("!H", length)
2388 return ''.join(packed)
2389
2390 @staticmethod
2391 def unpack(reader):
2392 subtype, = reader.peek('!L', 4)
2393 subclass = table_feature_prop_experimenter_miss.subtypes.get(subtype)
2394 if subclass:
2395 return subclass.unpack(reader)
2396
2397 obj = table_feature_prop_experimenter_miss()
2398 _type = reader.read("!H")[0]
2399 assert(_type == 65535)
2400 _length = reader.read("!H")[0]
2401 orig_reader = reader
2402 reader = orig_reader.slice(_length - (2 + 2))
2403 obj.experimenter = reader.read("!L")[0]
2404 obj.subtype = reader.read("!L")[0]
2405 obj.experimenter_data = str(reader.read_all())
2406 return obj
2407
2408 def __eq__(self, other):
2409 if type(self) != type(other): return False
2410 if self.experimenter != other.experimenter: return False
2411 if self.subtype != other.subtype: return False
2412 if self.experimenter_data != other.experimenter_data: return False
2413 return True
2414
2415 def pretty_print(self, q):
2416 q.text("table_feature_prop_experimenter_miss {")
2417 with q.group():
2418 with q.indent(2):
2419 q.breakable()
2420 q.text("subtype = ");
2421 q.text("%#x" % self.subtype)
2422 q.text(","); q.breakable()
2423 q.text("experimenter_data = ");
2424 q.pp(self.experimenter_data)
2425 q.breakable()
2426 q.text('}')
2427
2428table_feature_prop.subtypes[65535] = table_feature_prop_experimenter_miss
2429
2430class table_feature_prop_instructions(table_feature_prop):
2431 type = 0
2432
2433 def __init__(self, instruction_ids=None):
2434 if instruction_ids != None:
2435 self.instruction_ids = instruction_ids
2436 else:
2437 self.instruction_ids = []
2438 return
2439
2440 def pack(self):
2441 packed = []
2442 packed.append(struct.pack("!H", self.type))
2443 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2444 packed.append(loxi.generic_util.pack_list(self.instruction_ids))
2445 length = sum([len(x) for x in packed])
2446 packed[1] = struct.pack("!H", length)
2447 return ''.join(packed)
2448
2449 @staticmethod
2450 def unpack(reader):
2451 obj = table_feature_prop_instructions()
2452 _type = reader.read("!H")[0]
2453 assert(_type == 0)
2454 _length = reader.read("!H")[0]
2455 orig_reader = reader
2456 reader = orig_reader.slice(_length - (2 + 2))
2457 obj.instruction_ids = loxi.generic_util.unpack_list(reader, instruction_id.instruction_id.unpack)
2458 return obj
2459
2460 def __eq__(self, other):
2461 if type(self) != type(other): return False
2462 if self.instruction_ids != other.instruction_ids: return False
2463 return True
2464
2465 def pretty_print(self, q):
2466 q.text("table_feature_prop_instructions {")
2467 with q.group():
2468 with q.indent(2):
2469 q.breakable()
2470 q.text("instruction_ids = ");
2471 q.pp(self.instruction_ids)
2472 q.breakable()
2473 q.text('}')
2474
2475table_feature_prop.subtypes[0] = table_feature_prop_instructions
2476
2477class table_feature_prop_instructions_miss(table_feature_prop):
2478 type = 1
2479
2480 def __init__(self, instruction_ids=None):
2481 if instruction_ids != None:
2482 self.instruction_ids = instruction_ids
2483 else:
2484 self.instruction_ids = []
2485 return
2486
2487 def pack(self):
2488 packed = []
2489 packed.append(struct.pack("!H", self.type))
2490 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2491 packed.append(loxi.generic_util.pack_list(self.instruction_ids))
2492 length = sum([len(x) for x in packed])
2493 packed[1] = struct.pack("!H", length)
2494 return ''.join(packed)
2495
2496 @staticmethod
2497 def unpack(reader):
2498 obj = table_feature_prop_instructions_miss()
2499 _type = reader.read("!H")[0]
2500 assert(_type == 1)
2501 _length = reader.read("!H")[0]
2502 orig_reader = reader
2503 reader = orig_reader.slice(_length - (2 + 2))
2504 obj.instruction_ids = loxi.generic_util.unpack_list(reader, instruction_id.instruction_id.unpack)
2505 return obj
2506
2507 def __eq__(self, other):
2508 if type(self) != type(other): return False
2509 if self.instruction_ids != other.instruction_ids: return False
2510 return True
2511
2512 def pretty_print(self, q):
2513 q.text("table_feature_prop_instructions_miss {")
2514 with q.group():
2515 with q.indent(2):
2516 q.breakable()
2517 q.text("instruction_ids = ");
2518 q.pp(self.instruction_ids)
2519 q.breakable()
2520 q.text('}')
2521
2522table_feature_prop.subtypes[1] = table_feature_prop_instructions_miss
2523
2524class table_feature_prop_match(table_feature_prop):
2525 type = 8
2526
2527 def __init__(self, oxm_ids=None):
2528 if oxm_ids != None:
2529 self.oxm_ids = oxm_ids
2530 else:
2531 self.oxm_ids = []
2532 return
2533
2534 def pack(self):
2535 packed = []
2536 packed.append(struct.pack("!H", self.type))
2537 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2538 packed.append(loxi.generic_util.pack_list(self.oxm_ids))
2539 length = sum([len(x) for x in packed])
2540 packed[1] = struct.pack("!H", length)
2541 return ''.join(packed)
2542
2543 @staticmethod
2544 def unpack(reader):
2545 obj = table_feature_prop_match()
2546 _type = reader.read("!H")[0]
2547 assert(_type == 8)
2548 _length = reader.read("!H")[0]
2549 orig_reader = reader
2550 reader = orig_reader.slice(_length - (2 + 2))
2551 obj.oxm_ids = loxi.generic_util.unpack_list(reader, common.uint32.unpack)
2552 return obj
2553
2554 def __eq__(self, other):
2555 if type(self) != type(other): return False
2556 if self.oxm_ids != other.oxm_ids: return False
2557 return True
2558
2559 def pretty_print(self, q):
2560 q.text("table_feature_prop_match {")
2561 with q.group():
2562 with q.indent(2):
2563 q.breakable()
2564 q.text("oxm_ids = ");
2565 q.pp(self.oxm_ids)
2566 q.breakable()
2567 q.text('}')
2568
2569table_feature_prop.subtypes[8] = table_feature_prop_match
2570
2571class table_feature_prop_next_tables(table_feature_prop):
2572 type = 2
2573
2574 def __init__(self, next_table_ids=None):
2575 if next_table_ids != None:
2576 self.next_table_ids = next_table_ids
2577 else:
2578 self.next_table_ids = []
2579 return
2580
2581 def pack(self):
2582 packed = []
2583 packed.append(struct.pack("!H", self.type))
2584 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2585 packed.append(loxi.generic_util.pack_list(self.next_table_ids))
2586 length = sum([len(x) for x in packed])
2587 packed[1] = struct.pack("!H", length)
2588 return ''.join(packed)
2589
2590 @staticmethod
2591 def unpack(reader):
2592 obj = table_feature_prop_next_tables()
2593 _type = reader.read("!H")[0]
2594 assert(_type == 2)
2595 _length = reader.read("!H")[0]
2596 orig_reader = reader
2597 reader = orig_reader.slice(_length - (2 + 2))
2598 obj.next_table_ids = loxi.generic_util.unpack_list(reader, common.uint8.unpack)
2599 return obj
2600
2601 def __eq__(self, other):
2602 if type(self) != type(other): return False
2603 if self.next_table_ids != other.next_table_ids: return False
2604 return True
2605
2606 def pretty_print(self, q):
2607 q.text("table_feature_prop_next_tables {")
2608 with q.group():
2609 with q.indent(2):
2610 q.breakable()
2611 q.text("next_table_ids = ");
2612 q.pp(self.next_table_ids)
2613 q.breakable()
2614 q.text('}')
2615
2616table_feature_prop.subtypes[2] = table_feature_prop_next_tables
2617
2618class table_feature_prop_next_tables_miss(table_feature_prop):
2619 type = 3
2620
2621 def __init__(self, next_table_ids=None):
2622 if next_table_ids != None:
2623 self.next_table_ids = next_table_ids
2624 else:
2625 self.next_table_ids = []
2626 return
2627
2628 def pack(self):
2629 packed = []
2630 packed.append(struct.pack("!H", self.type))
2631 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2632 packed.append(loxi.generic_util.pack_list(self.next_table_ids))
2633 length = sum([len(x) for x in packed])
2634 packed[1] = struct.pack("!H", length)
2635 return ''.join(packed)
2636
2637 @staticmethod
2638 def unpack(reader):
2639 obj = table_feature_prop_next_tables_miss()
2640 _type = reader.read("!H")[0]
2641 assert(_type == 3)
2642 _length = reader.read("!H")[0]
2643 orig_reader = reader
2644 reader = orig_reader.slice(_length - (2 + 2))
2645 obj.next_table_ids = loxi.generic_util.unpack_list(reader, common.uint8.unpack)
2646 return obj
2647
2648 def __eq__(self, other):
2649 if type(self) != type(other): return False
2650 if self.next_table_ids != other.next_table_ids: return False
2651 return True
2652
2653 def pretty_print(self, q):
2654 q.text("table_feature_prop_next_tables_miss {")
2655 with q.group():
2656 with q.indent(2):
2657 q.breakable()
2658 q.text("next_table_ids = ");
2659 q.pp(self.next_table_ids)
2660 q.breakable()
2661 q.text('}')
2662
2663table_feature_prop.subtypes[3] = table_feature_prop_next_tables_miss
2664
2665class table_feature_prop_table_sync_from(table_feature_prop):
2666 type = 16
2667
2668 def __init__(self, table_ids=None):
2669 if table_ids != None:
2670 self.table_ids = table_ids
2671 else:
2672 self.table_ids = []
2673 return
2674
2675 def pack(self):
2676 packed = []
2677 packed.append(struct.pack("!H", self.type))
2678 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2679 packed.append(loxi.generic_util.pack_list(self.table_ids))
2680 length = sum([len(x) for x in packed])
2681 packed[1] = struct.pack("!H", length)
2682 return ''.join(packed)
2683
2684 @staticmethod
2685 def unpack(reader):
2686 obj = table_feature_prop_table_sync_from()
2687 _type = reader.read("!H")[0]
2688 assert(_type == 16)
2689 _length = reader.read("!H")[0]
2690 orig_reader = reader
2691 reader = orig_reader.slice(_length - (2 + 2))
2692 obj.table_ids = loxi.generic_util.unpack_list(reader, common.uint8.unpack)
2693 return obj
2694
2695 def __eq__(self, other):
2696 if type(self) != type(other): return False
2697 if self.table_ids != other.table_ids: return False
2698 return True
2699
2700 def pretty_print(self, q):
2701 q.text("table_feature_prop_table_sync_from {")
2702 with q.group():
2703 with q.indent(2):
2704 q.breakable()
2705 q.text("table_ids = ");
2706 q.pp(self.table_ids)
2707 q.breakable()
2708 q.text('}')
2709
2710table_feature_prop.subtypes[16] = table_feature_prop_table_sync_from
2711
2712class table_feature_prop_wildcards(table_feature_prop):
2713 type = 10
2714
2715 def __init__(self, oxm_ids=None):
2716 if oxm_ids != None:
2717 self.oxm_ids = oxm_ids
2718 else:
2719 self.oxm_ids = []
2720 return
2721
2722 def pack(self):
2723 packed = []
2724 packed.append(struct.pack("!H", self.type))
2725 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2726 packed.append(loxi.generic_util.pack_list(self.oxm_ids))
2727 length = sum([len(x) for x in packed])
2728 packed[1] = struct.pack("!H", length)
2729 return ''.join(packed)
2730
2731 @staticmethod
2732 def unpack(reader):
2733 obj = table_feature_prop_wildcards()
2734 _type = reader.read("!H")[0]
2735 assert(_type == 10)
2736 _length = reader.read("!H")[0]
2737 orig_reader = reader
2738 reader = orig_reader.slice(_length - (2 + 2))
2739 obj.oxm_ids = loxi.generic_util.unpack_list(reader, common.uint32.unpack)
2740 return obj
2741
2742 def __eq__(self, other):
2743 if type(self) != type(other): return False
2744 if self.oxm_ids != other.oxm_ids: return False
2745 return True
2746
2747 def pretty_print(self, q):
2748 q.text("table_feature_prop_wildcards {")
2749 with q.group():
2750 with q.indent(2):
2751 q.breakable()
2752 q.text("oxm_ids = ");
2753 q.pp(self.oxm_ids)
2754 q.breakable()
2755 q.text('}')
2756
2757table_feature_prop.subtypes[10] = table_feature_prop_wildcards
2758
2759class table_feature_prop_write_actions(table_feature_prop):
2760 type = 4
2761
2762 def __init__(self, action_ids=None):
2763 if action_ids != None:
2764 self.action_ids = action_ids
2765 else:
2766 self.action_ids = []
2767 return
2768
2769 def pack(self):
2770 packed = []
2771 packed.append(struct.pack("!H", self.type))
2772 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2773 packed.append(loxi.generic_util.pack_list(self.action_ids))
2774 length = sum([len(x) for x in packed])
2775 packed[1] = struct.pack("!H", length)
2776 return ''.join(packed)
2777
2778 @staticmethod
2779 def unpack(reader):
2780 obj = table_feature_prop_write_actions()
2781 _type = reader.read("!H")[0]
2782 assert(_type == 4)
2783 _length = reader.read("!H")[0]
2784 orig_reader = reader
2785 reader = orig_reader.slice(_length - (2 + 2))
2786 obj.action_ids = loxi.generic_util.unpack_list(reader, action_id.action_id.unpack)
2787 return obj
2788
2789 def __eq__(self, other):
2790 if type(self) != type(other): return False
2791 if self.action_ids != other.action_ids: return False
2792 return True
2793
2794 def pretty_print(self, q):
2795 q.text("table_feature_prop_write_actions {")
2796 with q.group():
2797 with q.indent(2):
2798 q.breakable()
2799 q.text("action_ids = ");
2800 q.pp(self.action_ids)
2801 q.breakable()
2802 q.text('}')
2803
2804table_feature_prop.subtypes[4] = table_feature_prop_write_actions
2805
2806class table_feature_prop_write_actions_miss(table_feature_prop):
2807 type = 5
2808
2809 def __init__(self, action_ids=None):
2810 if action_ids != None:
2811 self.action_ids = action_ids
2812 else:
2813 self.action_ids = []
2814 return
2815
2816 def pack(self):
2817 packed = []
2818 packed.append(struct.pack("!H", self.type))
2819 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2820 packed.append(loxi.generic_util.pack_list(self.action_ids))
2821 length = sum([len(x) for x in packed])
2822 packed[1] = struct.pack("!H", length)
2823 return ''.join(packed)
2824
2825 @staticmethod
2826 def unpack(reader):
2827 obj = table_feature_prop_write_actions_miss()
2828 _type = reader.read("!H")[0]
2829 assert(_type == 5)
2830 _length = reader.read("!H")[0]
2831 orig_reader = reader
2832 reader = orig_reader.slice(_length - (2 + 2))
2833 obj.action_ids = loxi.generic_util.unpack_list(reader, action_id.action_id.unpack)
2834 return obj
2835
2836 def __eq__(self, other):
2837 if type(self) != type(other): return False
2838 if self.action_ids != other.action_ids: return False
2839 return True
2840
2841 def pretty_print(self, q):
2842 q.text("table_feature_prop_write_actions_miss {")
2843 with q.group():
2844 with q.indent(2):
2845 q.breakable()
2846 q.text("action_ids = ");
2847 q.pp(self.action_ids)
2848 q.breakable()
2849 q.text('}')
2850
2851table_feature_prop.subtypes[5] = table_feature_prop_write_actions_miss
2852
2853class table_feature_prop_write_setfield(table_feature_prop):
2854 type = 12
2855
2856 def __init__(self, oxm_ids=None):
2857 if oxm_ids != None:
2858 self.oxm_ids = oxm_ids
2859 else:
2860 self.oxm_ids = []
2861 return
2862
2863 def pack(self):
2864 packed = []
2865 packed.append(struct.pack("!H", self.type))
2866 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2867 packed.append(loxi.generic_util.pack_list(self.oxm_ids))
2868 length = sum([len(x) for x in packed])
2869 packed[1] = struct.pack("!H", length)
2870 return ''.join(packed)
2871
2872 @staticmethod
2873 def unpack(reader):
2874 obj = table_feature_prop_write_setfield()
2875 _type = reader.read("!H")[0]
2876 assert(_type == 12)
2877 _length = reader.read("!H")[0]
2878 orig_reader = reader
2879 reader = orig_reader.slice(_length - (2 + 2))
2880 obj.oxm_ids = loxi.generic_util.unpack_list(reader, common.uint32.unpack)
2881 return obj
2882
2883 def __eq__(self, other):
2884 if type(self) != type(other): return False
2885 if self.oxm_ids != other.oxm_ids: return False
2886 return True
2887
2888 def pretty_print(self, q):
2889 q.text("table_feature_prop_write_setfield {")
2890 with q.group():
2891 with q.indent(2):
2892 q.breakable()
2893 q.text("oxm_ids = ");
2894 q.pp(self.oxm_ids)
2895 q.breakable()
2896 q.text('}')
2897
2898table_feature_prop.subtypes[12] = table_feature_prop_write_setfield
2899
2900class table_feature_prop_write_setfield_miss(table_feature_prop):
2901 type = 13
2902
2903 def __init__(self, oxm_ids=None):
2904 if oxm_ids != None:
2905 self.oxm_ids = oxm_ids
2906 else:
2907 self.oxm_ids = []
2908 return
2909
2910 def pack(self):
2911 packed = []
2912 packed.append(struct.pack("!H", self.type))
2913 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2914 packed.append(loxi.generic_util.pack_list(self.oxm_ids))
2915 length = sum([len(x) for x in packed])
2916 packed[1] = struct.pack("!H", length)
2917 return ''.join(packed)
2918
2919 @staticmethod
2920 def unpack(reader):
2921 obj = table_feature_prop_write_setfield_miss()
2922 _type = reader.read("!H")[0]
2923 assert(_type == 13)
2924 _length = reader.read("!H")[0]
2925 orig_reader = reader
2926 reader = orig_reader.slice(_length - (2 + 2))
2927 obj.oxm_ids = loxi.generic_util.unpack_list(reader, common.uint32.unpack)
2928 return obj
2929
2930 def __eq__(self, other):
2931 if type(self) != type(other): return False
2932 if self.oxm_ids != other.oxm_ids: return False
2933 return True
2934
2935 def pretty_print(self, q):
2936 q.text("table_feature_prop_write_setfield_miss {")
2937 with q.group():
2938 with q.indent(2):
2939 q.breakable()
2940 q.text("oxm_ids = ");
2941 q.pp(self.oxm_ids)
2942 q.breakable()
2943 q.text('}')
2944
2945table_feature_prop.subtypes[13] = table_feature_prop_write_setfield_miss
2946
2947class table_features(loxi.OFObject):
2948
2949 def __init__(self, table_id=None, name=None, metadata_match=None, metadata_write=None, config=None, max_entries=None, properties=None):
2950 if table_id != None:
2951 self.table_id = table_id
2952 else:
2953 self.table_id = 0
2954 if name != None:
2955 self.name = name
2956 else:
2957 self.name = ""
2958 if metadata_match != None:
2959 self.metadata_match = metadata_match
2960 else:
2961 self.metadata_match = 0
2962 if metadata_write != None:
2963 self.metadata_write = metadata_write
2964 else:
2965 self.metadata_write = 0
2966 if config != None:
2967 self.config = config
2968 else:
2969 self.config = 0
2970 if max_entries != None:
2971 self.max_entries = max_entries
2972 else:
2973 self.max_entries = 0
2974 if properties != None:
2975 self.properties = properties
2976 else:
2977 self.properties = []
2978 return
2979
2980 def pack(self):
2981 packed = []
2982 packed.append(struct.pack("!H", 0)) # placeholder for length at index 0
2983 packed.append(struct.pack("!B", self.table_id))
2984 packed.append('\x00' * 5)
2985 packed.append(struct.pack("!32s", self.name))
2986 packed.append(struct.pack("!Q", self.metadata_match))
2987 packed.append(struct.pack("!Q", self.metadata_write))
2988 packed.append(struct.pack("!L", self.config))
2989 packed.append(struct.pack("!L", self.max_entries))
2990 packed.append(loxi.generic_util.pack_list(self.properties))
2991 length = sum([len(x) for x in packed])
2992 packed[0] = struct.pack("!H", length)
2993 return ''.join(packed)
2994
2995 @staticmethod
2996 def unpack(reader):
2997 obj = table_features()
2998 _length = reader.read("!H")[0]
2999 orig_reader = reader
3000 reader = orig_reader.slice(_length - (0 + 2))
3001 obj.table_id = reader.read("!B")[0]
3002 reader.skip(5)
3003 obj.name = reader.read("!32s")[0].rstrip("\x00")
3004 obj.metadata_match = reader.read("!Q")[0]
3005 obj.metadata_write = reader.read("!Q")[0]
3006 obj.config = reader.read("!L")[0]
3007 obj.max_entries = reader.read("!L")[0]
3008 obj.properties = loxi.generic_util.unpack_list(reader, common.table_feature_prop.unpack)
3009 return obj
3010
3011 def __eq__(self, other):
3012 if type(self) != type(other): return False
3013 if self.table_id != other.table_id: return False
3014 if self.name != other.name: return False
3015 if self.metadata_match != other.metadata_match: return False
3016 if self.metadata_write != other.metadata_write: return False
3017 if self.config != other.config: return False
3018 if self.max_entries != other.max_entries: return False
3019 if self.properties != other.properties: return False
3020 return True
3021
3022 def pretty_print(self, q):
3023 q.text("table_features {")
3024 with q.group():
3025 with q.indent(2):
3026 q.breakable()
3027 q.text("table_id = ");
3028 q.text("%#x" % self.table_id)
3029 q.text(","); q.breakable()
3030 q.text("name = ");
3031 q.pp(self.name)
3032 q.text(","); q.breakable()
3033 q.text("metadata_match = ");
3034 q.text("%#x" % self.metadata_match)
3035 q.text(","); q.breakable()
3036 q.text("metadata_write = ");
3037 q.text("%#x" % self.metadata_write)
3038 q.text(","); q.breakable()
3039 q.text("config = ");
3040 q.text("%#x" % self.config)
3041 q.text(","); q.breakable()
3042 q.text("max_entries = ");
3043 q.text("%#x" % self.max_entries)
3044 q.text(","); q.breakable()
3045 q.text("properties = ");
3046 q.pp(self.properties)
3047 q.breakable()
3048 q.text('}')
3049
3050
3051class table_mod_prop_eviction(loxi.OFObject):
3052 type = 2
3053
3054 def __init__(self, flags=None):
3055 if flags != None:
3056 self.flags = flags
3057 else:
3058 self.flags = 0
3059 return
3060
3061 def pack(self):
3062 packed = []
3063 packed.append(struct.pack("!H", self.type))
3064 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3065 packed.append(struct.pack("!L", self.flags))
3066 length = sum([len(x) for x in packed])
3067 packed[1] = struct.pack("!H", length)
3068 return ''.join(packed)
3069
3070 @staticmethod
3071 def unpack(reader):
3072 obj = table_mod_prop_eviction()
3073 _type = reader.read("!H")[0]
3074 assert(_type == 2)
3075 _length = reader.read("!H")[0]
3076 orig_reader = reader
3077 reader = orig_reader.slice(_length - (2 + 2))
3078 obj.flags = reader.read("!L")[0]
3079 return obj
3080
3081 def __eq__(self, other):
3082 if type(self) != type(other): return False
3083 if self.flags != other.flags: return False
3084 return True
3085
3086 def pretty_print(self, q):
3087 q.text("table_mod_prop_eviction {")
3088 with q.group():
3089 with q.indent(2):
3090 q.breakable()
3091 q.text("flags = ");
3092 q.text("%#x" % self.flags)
3093 q.breakable()
3094 q.text('}')
3095
3096
3097class table_mod_prop_experimenter(loxi.OFObject):
3098 subtypes = {}
3099
3100 type = 65535
3101
3102 def __init__(self, experimenter=None, exp_type=None):
3103 if experimenter != None:
3104 self.experimenter = experimenter
3105 else:
3106 self.experimenter = 0
3107 if exp_type != None:
3108 self.exp_type = exp_type
3109 else:
3110 self.exp_type = 0
3111 return
3112
3113 def pack(self):
3114 packed = []
3115 packed.append(struct.pack("!H", self.type))
3116 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3117 packed.append(struct.pack("!L", self.experimenter))
3118 packed.append(struct.pack("!L", self.exp_type))
3119 length = sum([len(x) for x in packed])
3120 packed[1] = struct.pack("!H", length)
3121 return ''.join(packed)
3122
3123 @staticmethod
3124 def unpack(reader):
3125 subtype, = reader.peek('!L', 4)
3126 subclass = table_mod_prop_experimenter.subtypes.get(subtype)
3127 if subclass:
3128 return subclass.unpack(reader)
3129
3130 obj = table_mod_prop_experimenter()
3131 _type = reader.read("!H")[0]
3132 assert(_type == 65535)
3133 _length = reader.read("!H")[0]
3134 orig_reader = reader
3135 reader = orig_reader.slice(_length - (2 + 2))
3136 obj.experimenter = reader.read("!L")[0]
3137 obj.exp_type = reader.read("!L")[0]
3138 return obj
3139
3140 def __eq__(self, other):
3141 if type(self) != type(other): return False
3142 if self.experimenter != other.experimenter: return False
3143 if self.exp_type != other.exp_type: return False
3144 return True
3145
3146 def pretty_print(self, q):
3147 q.text("table_mod_prop_experimenter {")
3148 with q.group():
3149 with q.indent(2):
3150 q.breakable()
3151 q.text("exp_type = ");
3152 q.text("%#x" % self.exp_type)
3153 q.breakable()
3154 q.text('}')
3155
3156
3157class table_mod_prop_vacancy(loxi.OFObject):
3158 type = 3
3159
3160 def __init__(self, vacancy_down=None, vacancy_up=None, vacancy=None):
3161 if vacancy_down != None:
3162 self.vacancy_down = vacancy_down
3163 else:
3164 self.vacancy_down = 0
3165 if vacancy_up != None:
3166 self.vacancy_up = vacancy_up
3167 else:
3168 self.vacancy_up = 0
3169 if vacancy != None:
3170 self.vacancy = vacancy
3171 else:
3172 self.vacancy = 0
3173 return
3174
3175 def pack(self):
3176 packed = []
3177 packed.append(struct.pack("!H", self.type))
3178 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3179 packed.append(struct.pack("!B", self.vacancy_down))
3180 packed.append(struct.pack("!B", self.vacancy_up))
3181 packed.append(struct.pack("!B", self.vacancy))
3182 packed.append('\x00' * 1)
3183 length = sum([len(x) for x in packed])
3184 packed[1] = struct.pack("!H", length)
3185 return ''.join(packed)
3186
3187 @staticmethod
3188 def unpack(reader):
3189 obj = table_mod_prop_vacancy()
3190 _type = reader.read("!H")[0]
3191 assert(_type == 3)
3192 _length = reader.read("!H")[0]
3193 orig_reader = reader
3194 reader = orig_reader.slice(_length - (2 + 2))
3195 obj.vacancy_down = reader.read("!B")[0]
3196 obj.vacancy_up = reader.read("!B")[0]
3197 obj.vacancy = reader.read("!B")[0]
3198 reader.skip(1)
3199 return obj
3200
3201 def __eq__(self, other):
3202 if type(self) != type(other): return False
3203 if self.vacancy_down != other.vacancy_down: return False
3204 if self.vacancy_up != other.vacancy_up: return False
3205 if self.vacancy != other.vacancy: return False
3206 return True
3207
3208 def pretty_print(self, q):
3209 q.text("table_mod_prop_vacancy {")
3210 with q.group():
3211 with q.indent(2):
3212 q.breakable()
3213 q.text("vacancy_down = ");
3214 q.text("%#x" % self.vacancy_down)
3215 q.text(","); q.breakable()
3216 q.text("vacancy_up = ");
3217 q.text("%#x" % self.vacancy_up)
3218 q.text(","); q.breakable()
3219 q.text("vacancy = ");
3220 q.text("%#x" % self.vacancy)
3221 q.breakable()
3222 q.text('}')
3223
3224
3225class table_stats_entry(loxi.OFObject):
3226
3227 def __init__(self, table_id=None, active_count=None, lookup_count=None, matched_count=None):
3228 if table_id != None:
3229 self.table_id = table_id
3230 else:
3231 self.table_id = 0
3232 if active_count != None:
3233 self.active_count = active_count
3234 else:
3235 self.active_count = 0
3236 if lookup_count != None:
3237 self.lookup_count = lookup_count
3238 else:
3239 self.lookup_count = 0
3240 if matched_count != None:
3241 self.matched_count = matched_count
3242 else:
3243 self.matched_count = 0
3244 return
3245
3246 def pack(self):
3247 packed = []
3248 packed.append(struct.pack("!B", self.table_id))
3249 packed.append('\x00' * 3)
3250 packed.append(struct.pack("!L", self.active_count))
3251 packed.append(struct.pack("!Q", self.lookup_count))
3252 packed.append(struct.pack("!Q", self.matched_count))
3253 return ''.join(packed)
3254
3255 @staticmethod
3256 def unpack(reader):
3257 obj = table_stats_entry()
3258 obj.table_id = reader.read("!B")[0]
3259 reader.skip(3)
3260 obj.active_count = reader.read("!L")[0]
3261 obj.lookup_count = reader.read("!Q")[0]
3262 obj.matched_count = reader.read("!Q")[0]
3263 return obj
3264
3265 def __eq__(self, other):
3266 if type(self) != type(other): return False
3267 if self.table_id != other.table_id: return False
3268 if self.active_count != other.active_count: return False
3269 if self.lookup_count != other.lookup_count: return False
3270 if self.matched_count != other.matched_count: return False
3271 return True
3272
3273 def pretty_print(self, q):
3274 q.text("table_stats_entry {")
3275 with q.group():
3276 with q.indent(2):
3277 q.breakable()
3278 q.text("table_id = ");
3279 q.text("%#x" % self.table_id)
3280 q.text(","); q.breakable()
3281 q.text("active_count = ");
3282 q.text("%#x" % self.active_count)
3283 q.text(","); q.breakable()
3284 q.text("lookup_count = ");
3285 q.text("%#x" % self.lookup_count)
3286 q.text(","); q.breakable()
3287 q.text("matched_count = ");
3288 q.text("%#x" % self.matched_count)
3289 q.breakable()
3290 q.text('}')
3291
3292
3293class uint32(loxi.OFObject):
3294
3295 def __init__(self, value=None):
3296 if value != None:
3297 self.value = value
3298 else:
3299 self.value = 0
3300 return
3301
3302 def pack(self):
3303 packed = []
3304 packed.append(struct.pack("!L", self.value))
3305 return ''.join(packed)
3306
3307 @staticmethod
3308 def unpack(reader):
3309 obj = uint32()
3310 obj.value = reader.read("!L")[0]
3311 return obj
3312
3313 def __eq__(self, other):
3314 if type(self) != type(other): return False
3315 if self.value != other.value: return False
3316 return True
3317
3318 def pretty_print(self, q):
3319 q.text("uint32 {")
3320 with q.group():
3321 with q.indent(2):
3322 q.breakable()
3323 q.text("value = ");
3324 q.text("%#x" % self.value)
3325 q.breakable()
3326 q.text('}')
3327
3328
3329class uint64(loxi.OFObject):
3330
3331 def __init__(self, value=None):
3332 if value != None:
3333 self.value = value
3334 else:
3335 self.value = 0
3336 return
3337
3338 def pack(self):
3339 packed = []
3340 packed.append(struct.pack("!Q", self.value))
3341 return ''.join(packed)
3342
3343 @staticmethod
3344 def unpack(reader):
3345 obj = uint64()
3346 obj.value = reader.read("!Q")[0]
3347 return obj
3348
3349 def __eq__(self, other):
3350 if type(self) != type(other): return False
3351 if self.value != other.value: return False
3352 return True
3353
3354 def pretty_print(self, q):
3355 q.text("uint64 {")
3356 with q.group():
3357 with q.indent(2):
3358 q.breakable()
3359 q.text("value = ");
3360 q.text("%#x" % self.value)
3361 q.breakable()
3362 q.text('}')
3363
3364
3365class uint8(loxi.OFObject):
3366
3367 def __init__(self, value=None):
3368 if value != None:
3369 self.value = value
3370 else:
3371 self.value = 0
3372 return
3373
3374 def pack(self):
3375 packed = []
3376 packed.append(struct.pack("!B", self.value))
3377 return ''.join(packed)
3378
3379 @staticmethod
3380 def unpack(reader):
3381 obj = uint8()
3382 obj.value = reader.read("!B")[0]
3383 return obj
3384
3385 def __eq__(self, other):
3386 if type(self) != type(other): return False
3387 if self.value != other.value: return False
3388 return True
3389
3390 def pretty_print(self, q):
3391 q.text("uint8 {")
3392 with q.group():
3393 with q.indent(2):
3394 q.breakable()
3395 q.text("value = ");
3396 q.text("%#x" % self.value)
3397 q.breakable()
3398 q.text('}')
3399
3400
3401
3402match = match_v3