blob: 31eecb39c7672e327feef6d2d0566907ddf999e1 [file] [log] [blame]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001# Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
2# Copyright (c) 2011, 2012 Open Networking Foundation
3# Copyright (c) 2012, 2013 Big Switch Networks, Inc.
Dan Talaycof6202252013-07-02 01:00:29 -07004# See the file LICENSE.pyloxi which should have been included in the source distribution
Rich Lane7dcdf022013-12-11 14:45:27 -08005
6# Automatically generated by LOXI from template module.py
Rich Lanec2ee4b82013-04-24 17:12:38 -07007# Do not modify
8
Rich Lanec2ee4b82013-04-24 17:12:38 -07009import struct
Rich Lane7dcdf022013-12-11 14:45:27 -080010import loxi
Rich Lanec2ee4b82013-04-24 17:12:38 -070011import const
Rich Lane7dcdf022013-12-11 14:45:27 -080012import common
13import action
14import instruction
15import oxm
16import action_id
17import instruction_id
18import meter_band
Rich Lane5454b682014-01-14 17:07:36 -080019import bsn_tlv
Rich Lanec2ee4b82013-04-24 17:12:38 -070020import util
21import loxi.generic_util
22
Rich Lane5454b682014-01-14 17:07:36 -080023class bsn_controller_connection(loxi.OFObject):
24
25 def __init__(self, state=None, auxiliary_id=None, role=None, uri=None):
26 if state != None:
27 self.state = state
28 else:
29 self.state = 0
30 if auxiliary_id != None:
31 self.auxiliary_id = auxiliary_id
32 else:
33 self.auxiliary_id = 0
34 if role != None:
35 self.role = role
36 else:
37 self.role = 0
38 if uri != None:
39 self.uri = uri
40 else:
41 self.uri = ""
42 return
43
44 def pack(self):
45 packed = []
46 packed.append(struct.pack("!B", self.state))
47 packed.append(struct.pack("!B", self.auxiliary_id))
48 packed.append('\x00' * 2)
49 packed.append(struct.pack("!L", self.role))
50 packed.append(struct.pack("!256s", self.uri))
51 return ''.join(packed)
52
53 @staticmethod
54 def unpack(reader):
55 obj = bsn_controller_connection()
56 obj.state = reader.read("!B")[0]
57 obj.auxiliary_id = reader.read("!B")[0]
58 reader.skip(2)
59 obj.role = reader.read("!L")[0]
60 obj.uri = reader.read("!256s")[0].rstrip("\x00")
61 return obj
62
63 def __eq__(self, other):
64 if type(self) != type(other): return False
65 if self.state != other.state: return False
66 if self.auxiliary_id != other.auxiliary_id: return False
67 if self.role != other.role: return False
68 if self.uri != other.uri: return False
69 return True
70
71 def pretty_print(self, q):
72 q.text("bsn_controller_connection {")
73 with q.group():
74 with q.indent(2):
75 q.breakable()
76 q.text("state = ");
77 q.text("%#x" % self.state)
78 q.text(","); q.breakable()
79 q.text("auxiliary_id = ");
80 q.text("%#x" % self.auxiliary_id)
81 q.text(","); q.breakable()
82 q.text("role = ");
83 q.text("%#x" % self.role)
84 q.text(","); q.breakable()
85 q.text("uri = ");
86 q.pp(self.uri)
87 q.breakable()
88 q.text('}')
89
90
Rich Lane93b33132014-04-21 12:20:58 -070091class bsn_debug_counter_desc_stats_entry(loxi.OFObject):
92
93 def __init__(self, counter_id=None, name=None, description=None):
94 if counter_id != None:
95 self.counter_id = counter_id
96 else:
97 self.counter_id = 0
98 if name != None:
99 self.name = name
100 else:
101 self.name = ""
102 if description != None:
103 self.description = description
104 else:
105 self.description = ""
106 return
107
108 def pack(self):
109 packed = []
110 packed.append(struct.pack("!Q", self.counter_id))
111 packed.append(struct.pack("!64s", self.name))
112 packed.append(struct.pack("!256s", self.description))
113 return ''.join(packed)
114
115 @staticmethod
116 def unpack(reader):
117 obj = bsn_debug_counter_desc_stats_entry()
118 obj.counter_id = reader.read("!Q")[0]
119 obj.name = reader.read("!64s")[0].rstrip("\x00")
120 obj.description = reader.read("!256s")[0].rstrip("\x00")
121 return obj
122
123 def __eq__(self, other):
124 if type(self) != type(other): return False
125 if self.counter_id != other.counter_id: return False
126 if self.name != other.name: return False
127 if self.description != other.description: return False
128 return True
129
130 def pretty_print(self, q):
131 q.text("bsn_debug_counter_desc_stats_entry {")
132 with q.group():
133 with q.indent(2):
134 q.breakable()
135 q.text("counter_id = ");
136 q.text("%#x" % self.counter_id)
137 q.text(","); q.breakable()
138 q.text("name = ");
139 q.pp(self.name)
140 q.text(","); q.breakable()
141 q.text("description = ");
142 q.pp(self.description)
143 q.breakable()
144 q.text('}')
145
146
147class bsn_debug_counter_stats_entry(loxi.OFObject):
148
149 def __init__(self, counter_id=None, value=None):
150 if counter_id != None:
151 self.counter_id = counter_id
152 else:
153 self.counter_id = 0
154 if value != None:
155 self.value = value
156 else:
157 self.value = 0
158 return
159
160 def pack(self):
161 packed = []
162 packed.append(struct.pack("!Q", self.counter_id))
163 packed.append(struct.pack("!Q", self.value))
164 return ''.join(packed)
165
166 @staticmethod
167 def unpack(reader):
168 obj = bsn_debug_counter_stats_entry()
169 obj.counter_id = reader.read("!Q")[0]
170 obj.value = reader.read("!Q")[0]
171 return obj
172
173 def __eq__(self, other):
174 if type(self) != type(other): return False
175 if self.counter_id != other.counter_id: return False
176 if self.value != other.value: return False
177 return True
178
179 def pretty_print(self, q):
180 q.text("bsn_debug_counter_stats_entry {")
181 with q.group():
182 with q.indent(2):
183 q.breakable()
184 q.text("counter_id = ");
185 q.text("%#x" % self.counter_id)
186 q.text(","); q.breakable()
187 q.text("value = ");
188 q.text("%#x" % self.value)
189 q.breakable()
190 q.text('}')
191
192
Rich Lane9ec3fca2014-02-26 16:22:56 -0800193class bsn_flow_checksum_bucket_stats_entry(loxi.OFObject):
194
195 def __init__(self, checksum=None):
196 if checksum != None:
197 self.checksum = checksum
198 else:
199 self.checksum = 0
200 return
201
202 def pack(self):
203 packed = []
204 packed.append(struct.pack("!Q", self.checksum))
205 return ''.join(packed)
206
207 @staticmethod
208 def unpack(reader):
209 obj = bsn_flow_checksum_bucket_stats_entry()
210 obj.checksum = reader.read("!Q")[0]
211 return obj
212
213 def __eq__(self, other):
214 if type(self) != type(other): return False
215 if self.checksum != other.checksum: return False
216 return True
217
218 def pretty_print(self, q):
219 q.text("bsn_flow_checksum_bucket_stats_entry {")
220 with q.group():
221 with q.indent(2):
222 q.breakable()
223 q.text("checksum = ");
224 q.text("%#x" % self.checksum)
225 q.breakable()
226 q.text('}')
227
228
Rich Lane5454b682014-01-14 17:07:36 -0800229class bsn_gentable_bucket_stats_entry(loxi.OFObject):
230
231 def __init__(self, checksum=None):
232 if checksum != None:
233 self.checksum = checksum
234 else:
235 self.checksum = 0
236 return
237
238 def pack(self):
239 packed = []
240 packed.append(util.pack_checksum_128(self.checksum))
241 return ''.join(packed)
242
243 @staticmethod
244 def unpack(reader):
245 obj = bsn_gentable_bucket_stats_entry()
246 obj.checksum = util.unpack_checksum_128(reader)
247 return obj
248
249 def __eq__(self, other):
250 if type(self) != type(other): return False
251 if self.checksum != other.checksum: return False
252 return True
253
254 def pretty_print(self, q):
255 q.text("bsn_gentable_bucket_stats_entry {")
256 with q.group():
257 with q.indent(2):
258 q.breakable()
259 q.text("checksum = ");
260 q.pp(self.checksum)
261 q.breakable()
262 q.text('}')
263
264
265class bsn_gentable_desc_stats_entry(loxi.OFObject):
266
267 def __init__(self, table_id=None, name=None, buckets_size=None, max_entries=None):
268 if table_id != None:
269 self.table_id = table_id
270 else:
271 self.table_id = 0
272 if name != None:
273 self.name = name
274 else:
275 self.name = ""
276 if buckets_size != None:
277 self.buckets_size = buckets_size
278 else:
279 self.buckets_size = 0
280 if max_entries != None:
281 self.max_entries = max_entries
282 else:
283 self.max_entries = 0
284 return
285
286 def pack(self):
287 packed = []
288 packed.append(struct.pack("!H", 0)) # placeholder for length at index 0
289 packed.append(struct.pack("!H", self.table_id))
290 packed.append(struct.pack("!32s", self.name))
291 packed.append(struct.pack("!L", self.buckets_size))
292 packed.append(struct.pack("!L", self.max_entries))
293 packed.append('\x00' * 4)
294 length = sum([len(x) for x in packed])
295 packed[0] = struct.pack("!H", length)
296 return ''.join(packed)
297
298 @staticmethod
299 def unpack(reader):
300 obj = bsn_gentable_desc_stats_entry()
301 _length = reader.read("!H")[0]
302 orig_reader = reader
303 reader = orig_reader.slice(_length - (0 + 2))
304 obj.table_id = reader.read("!H")[0]
305 obj.name = reader.read("!32s")[0].rstrip("\x00")
306 obj.buckets_size = reader.read("!L")[0]
307 obj.max_entries = reader.read("!L")[0]
308 reader.skip(4)
309 return obj
310
311 def __eq__(self, other):
312 if type(self) != type(other): return False
313 if self.table_id != other.table_id: return False
314 if self.name != other.name: return False
315 if self.buckets_size != other.buckets_size: return False
316 if self.max_entries != other.max_entries: return False
317 return True
318
319 def pretty_print(self, q):
320 q.text("bsn_gentable_desc_stats_entry {")
321 with q.group():
322 with q.indent(2):
323 q.breakable()
324 q.text("table_id = ");
325 q.text("%#x" % self.table_id)
326 q.text(","); q.breakable()
327 q.text("name = ");
328 q.pp(self.name)
329 q.text(","); q.breakable()
330 q.text("buckets_size = ");
331 q.text("%#x" % self.buckets_size)
332 q.text(","); q.breakable()
333 q.text("max_entries = ");
334 q.text("%#x" % self.max_entries)
335 q.breakable()
336 q.text('}')
337
338
339class bsn_gentable_entry_desc_stats_entry(loxi.OFObject):
340
341 def __init__(self, checksum=None, key=None, value=None):
342 if checksum != None:
343 self.checksum = checksum
344 else:
345 self.checksum = 0
346 if key != None:
347 self.key = key
348 else:
349 self.key = []
350 if value != None:
351 self.value = value
352 else:
353 self.value = []
354 return
355
356 def pack(self):
357 packed = []
358 packed.append(struct.pack("!H", 0)) # placeholder for length at index 0
359 packed.append(struct.pack("!H", 0)) # placeholder for key_length at index 1
360 packed.append(util.pack_checksum_128(self.checksum))
361 packed.append(loxi.generic_util.pack_list(self.key))
362 packed[1] = struct.pack("!H", len(packed[-1]))
363 packed.append(loxi.generic_util.pack_list(self.value))
364 length = sum([len(x) for x in packed])
365 packed[0] = struct.pack("!H", length)
366 return ''.join(packed)
367
368 @staticmethod
369 def unpack(reader):
370 obj = bsn_gentable_entry_desc_stats_entry()
371 _length = reader.read("!H")[0]
372 orig_reader = reader
373 reader = orig_reader.slice(_length - (0 + 2))
374 _key_length = reader.read("!H")[0]
375 obj.checksum = util.unpack_checksum_128(reader)
376 obj.key = loxi.generic_util.unpack_list(reader.slice(_key_length), bsn_tlv.bsn_tlv.unpack)
377 obj.value = loxi.generic_util.unpack_list(reader, bsn_tlv.bsn_tlv.unpack)
378 return obj
379
380 def __eq__(self, other):
381 if type(self) != type(other): return False
382 if self.checksum != other.checksum: return False
383 if self.key != other.key: return False
384 if self.value != other.value: return False
385 return True
386
387 def pretty_print(self, q):
388 q.text("bsn_gentable_entry_desc_stats_entry {")
389 with q.group():
390 with q.indent(2):
391 q.breakable()
392 q.text("checksum = ");
393 q.pp(self.checksum)
394 q.text(","); q.breakable()
395 q.text("key = ");
396 q.pp(self.key)
397 q.text(","); q.breakable()
398 q.text("value = ");
399 q.pp(self.value)
400 q.breakable()
401 q.text('}')
402
403
404class bsn_gentable_entry_stats_entry(loxi.OFObject):
405
406 def __init__(self, key=None, stats=None):
407 if key != None:
408 self.key = key
409 else:
410 self.key = []
411 if stats != None:
412 self.stats = stats
413 else:
414 self.stats = []
415 return
416
417 def pack(self):
418 packed = []
419 packed.append(struct.pack("!H", 0)) # placeholder for length at index 0
420 packed.append(struct.pack("!H", 0)) # placeholder for key_length at index 1
421 packed.append(loxi.generic_util.pack_list(self.key))
422 packed[1] = struct.pack("!H", len(packed[-1]))
423 packed.append(loxi.generic_util.pack_list(self.stats))
424 length = sum([len(x) for x in packed])
425 packed[0] = struct.pack("!H", length)
426 return ''.join(packed)
427
428 @staticmethod
429 def unpack(reader):
430 obj = bsn_gentable_entry_stats_entry()
431 _length = reader.read("!H")[0]
432 orig_reader = reader
433 reader = orig_reader.slice(_length - (0 + 2))
434 _key_length = reader.read("!H")[0]
435 obj.key = loxi.generic_util.unpack_list(reader.slice(_key_length), bsn_tlv.bsn_tlv.unpack)
436 obj.stats = loxi.generic_util.unpack_list(reader, bsn_tlv.bsn_tlv.unpack)
437 return obj
438
439 def __eq__(self, other):
440 if type(self) != type(other): return False
441 if self.key != other.key: return False
442 if self.stats != other.stats: return False
443 return True
444
445 def pretty_print(self, q):
446 q.text("bsn_gentable_entry_stats_entry {")
447 with q.group():
448 with q.indent(2):
449 q.breakable()
450 q.text("key = ");
451 q.pp(self.key)
452 q.text(","); q.breakable()
453 q.text("stats = ");
454 q.pp(self.stats)
455 q.breakable()
456 q.text('}')
457
458
459class bsn_gentable_stats_entry(loxi.OFObject):
460
461 def __init__(self, table_id=None, entry_count=None, checksum=None):
462 if table_id != None:
463 self.table_id = table_id
464 else:
465 self.table_id = 0
466 if entry_count != None:
467 self.entry_count = entry_count
468 else:
469 self.entry_count = 0
470 if checksum != None:
471 self.checksum = checksum
472 else:
473 self.checksum = 0
474 return
475
476 def pack(self):
477 packed = []
478 packed.append(struct.pack("!H", self.table_id))
479 packed.append('\x00' * 2)
480 packed.append(struct.pack("!L", self.entry_count))
481 packed.append(util.pack_checksum_128(self.checksum))
482 return ''.join(packed)
483
484 @staticmethod
485 def unpack(reader):
486 obj = bsn_gentable_stats_entry()
487 obj.table_id = reader.read("!H")[0]
488 reader.skip(2)
489 obj.entry_count = reader.read("!L")[0]
490 obj.checksum = util.unpack_checksum_128(reader)
491 return obj
492
493 def __eq__(self, other):
494 if type(self) != type(other): return False
495 if self.table_id != other.table_id: return False
496 if self.entry_count != other.entry_count: return False
497 if self.checksum != other.checksum: return False
498 return True
499
500 def pretty_print(self, q):
501 q.text("bsn_gentable_stats_entry {")
502 with q.group():
503 with q.indent(2):
504 q.breakable()
505 q.text("table_id = ");
506 q.text("%#x" % self.table_id)
507 q.text(","); q.breakable()
508 q.text("entry_count = ");
509 q.text("%#x" % self.entry_count)
510 q.text(","); q.breakable()
511 q.text("checksum = ");
512 q.pp(self.checksum)
513 q.breakable()
514 q.text('}')
515
516
Rich Lane7dcdf022013-12-11 14:45:27 -0800517class bsn_interface(loxi.OFObject):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700518
519 def __init__(self, hw_addr=None, name=None, ipv4_addr=None, ipv4_netmask=None):
520 if hw_addr != None:
521 self.hw_addr = hw_addr
522 else:
523 self.hw_addr = [0,0,0,0,0,0]
524 if name != None:
525 self.name = name
526 else:
527 self.name = ""
528 if ipv4_addr != None:
529 self.ipv4_addr = ipv4_addr
530 else:
531 self.ipv4_addr = 0
532 if ipv4_netmask != None:
533 self.ipv4_netmask = ipv4_netmask
534 else:
535 self.ipv4_netmask = 0
536 return
537
538 def pack(self):
539 packed = []
540 packed.append(struct.pack("!6B", *self.hw_addr))
541 packed.append('\x00' * 2)
542 packed.append(struct.pack("!16s", self.name))
543 packed.append(struct.pack("!L", self.ipv4_addr))
544 packed.append(struct.pack("!L", self.ipv4_netmask))
545 return ''.join(packed)
546
547 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800548 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -0700549 obj = bsn_interface()
Rich Lanec2ee4b82013-04-24 17:12:38 -0700550 obj.hw_addr = list(reader.read('!6B'))
551 reader.skip(2)
552 obj.name = reader.read("!16s")[0].rstrip("\x00")
Dan Talaycof6202252013-07-02 01:00:29 -0700553 obj.ipv4_addr = reader.read("!L")[0]
554 obj.ipv4_netmask = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -0700555 return obj
556
557 def __eq__(self, other):
558 if type(self) != type(other): return False
559 if self.hw_addr != other.hw_addr: return False
560 if self.name != other.name: return False
561 if self.ipv4_addr != other.ipv4_addr: return False
562 if self.ipv4_netmask != other.ipv4_netmask: return False
563 return True
564
Rich Lanec2ee4b82013-04-24 17:12:38 -0700565 def pretty_print(self, q):
566 q.text("bsn_interface {")
567 with q.group():
568 with q.indent(2):
569 q.breakable()
570 q.text("hw_addr = ");
571 q.text(util.pretty_mac(self.hw_addr))
572 q.text(","); q.breakable()
573 q.text("name = ");
574 q.pp(self.name)
575 q.text(","); q.breakable()
576 q.text("ipv4_addr = ");
577 q.text(util.pretty_ipv4(self.ipv4_addr))
578 q.text(","); q.breakable()
579 q.text("ipv4_netmask = ");
580 q.text(util.pretty_ipv4(self.ipv4_netmask))
581 q.breakable()
582 q.text('}')
583
Rich Lane7dcdf022013-12-11 14:45:27 -0800584
585class bsn_lacp_stats_entry(loxi.OFObject):
Rich Lane7b0f2012013-11-22 14:15:26 -0800586
587 def __init__(self, port_no=None, actor_sys_priority=None, actor_sys_mac=None, actor_port_priority=None, actor_port_num=None, actor_key=None, convergence_status=None, partner_sys_priority=None, partner_sys_mac=None, partner_port_priority=None, partner_port_num=None, partner_key=None):
588 if port_no != None:
589 self.port_no = port_no
590 else:
591 self.port_no = 0
592 if actor_sys_priority != None:
593 self.actor_sys_priority = actor_sys_priority
594 else:
595 self.actor_sys_priority = 0
596 if actor_sys_mac != None:
597 self.actor_sys_mac = actor_sys_mac
598 else:
599 self.actor_sys_mac = [0,0,0,0,0,0]
600 if actor_port_priority != None:
601 self.actor_port_priority = actor_port_priority
602 else:
603 self.actor_port_priority = 0
604 if actor_port_num != None:
605 self.actor_port_num = actor_port_num
606 else:
607 self.actor_port_num = 0
608 if actor_key != None:
609 self.actor_key = actor_key
610 else:
611 self.actor_key = 0
612 if convergence_status != None:
613 self.convergence_status = convergence_status
614 else:
615 self.convergence_status = 0
616 if partner_sys_priority != None:
617 self.partner_sys_priority = partner_sys_priority
618 else:
619 self.partner_sys_priority = 0
620 if partner_sys_mac != None:
621 self.partner_sys_mac = partner_sys_mac
622 else:
623 self.partner_sys_mac = [0,0,0,0,0,0]
624 if partner_port_priority != None:
625 self.partner_port_priority = partner_port_priority
626 else:
627 self.partner_port_priority = 0
628 if partner_port_num != None:
629 self.partner_port_num = partner_port_num
630 else:
631 self.partner_port_num = 0
632 if partner_key != None:
633 self.partner_key = partner_key
634 else:
635 self.partner_key = 0
636 return
637
638 def pack(self):
639 packed = []
640 packed.append(util.pack_port_no(self.port_no))
641 packed.append(struct.pack("!H", self.actor_sys_priority))
642 packed.append(struct.pack("!6B", *self.actor_sys_mac))
643 packed.append(struct.pack("!H", self.actor_port_priority))
644 packed.append(struct.pack("!H", self.actor_port_num))
645 packed.append(struct.pack("!H", self.actor_key))
646 packed.append(struct.pack("!B", self.convergence_status))
647 packed.append('\x00' * 1)
648 packed.append(struct.pack("!H", self.partner_sys_priority))
649 packed.append(struct.pack("!6B", *self.partner_sys_mac))
650 packed.append(struct.pack("!H", self.partner_port_priority))
651 packed.append(struct.pack("!H", self.partner_port_num))
652 packed.append(struct.pack("!H", self.partner_key))
653 packed.append('\x00' * 2)
654 return ''.join(packed)
655
656 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -0800657 def unpack(reader):
Rich Lane7b0f2012013-11-22 14:15:26 -0800658 obj = bsn_lacp_stats_entry()
Rich Lane7b0f2012013-11-22 14:15:26 -0800659 obj.port_no = util.unpack_port_no(reader)
660 obj.actor_sys_priority = reader.read("!H")[0]
661 obj.actor_sys_mac = list(reader.read('!6B'))
662 obj.actor_port_priority = reader.read("!H")[0]
663 obj.actor_port_num = reader.read("!H")[0]
664 obj.actor_key = reader.read("!H")[0]
665 obj.convergence_status = reader.read("!B")[0]
666 reader.skip(1)
667 obj.partner_sys_priority = reader.read("!H")[0]
668 obj.partner_sys_mac = list(reader.read('!6B'))
669 obj.partner_port_priority = reader.read("!H")[0]
670 obj.partner_port_num = reader.read("!H")[0]
671 obj.partner_key = reader.read("!H")[0]
672 reader.skip(2)
673 return obj
674
675 def __eq__(self, other):
676 if type(self) != type(other): return False
677 if self.port_no != other.port_no: return False
678 if self.actor_sys_priority != other.actor_sys_priority: return False
679 if self.actor_sys_mac != other.actor_sys_mac: return False
680 if self.actor_port_priority != other.actor_port_priority: return False
681 if self.actor_port_num != other.actor_port_num: return False
682 if self.actor_key != other.actor_key: return False
683 if self.convergence_status != other.convergence_status: return False
684 if self.partner_sys_priority != other.partner_sys_priority: return False
685 if self.partner_sys_mac != other.partner_sys_mac: return False
686 if self.partner_port_priority != other.partner_port_priority: return False
687 if self.partner_port_num != other.partner_port_num: return False
688 if self.partner_key != other.partner_key: return False
689 return True
690
Rich Lane7b0f2012013-11-22 14:15:26 -0800691 def pretty_print(self, q):
692 q.text("bsn_lacp_stats_entry {")
693 with q.group():
694 with q.indent(2):
695 q.breakable()
696 q.text("port_no = ");
697 q.text(util.pretty_port(self.port_no))
698 q.text(","); q.breakable()
699 q.text("actor_sys_priority = ");
700 q.text("%#x" % self.actor_sys_priority)
701 q.text(","); q.breakable()
702 q.text("actor_sys_mac = ");
703 q.text(util.pretty_mac(self.actor_sys_mac))
704 q.text(","); q.breakable()
705 q.text("actor_port_priority = ");
706 q.text("%#x" % self.actor_port_priority)
707 q.text(","); q.breakable()
708 q.text("actor_port_num = ");
709 q.text("%#x" % self.actor_port_num)
710 q.text(","); q.breakable()
711 q.text("actor_key = ");
712 q.text("%#x" % self.actor_key)
713 q.text(","); q.breakable()
714 q.text("convergence_status = ");
715 q.text("%#x" % self.convergence_status)
716 q.text(","); q.breakable()
717 q.text("partner_sys_priority = ");
718 q.text("%#x" % self.partner_sys_priority)
719 q.text(","); q.breakable()
720 q.text("partner_sys_mac = ");
721 q.text(util.pretty_mac(self.partner_sys_mac))
722 q.text(","); q.breakable()
723 q.text("partner_port_priority = ");
724 q.text("%#x" % self.partner_port_priority)
725 q.text(","); q.breakable()
726 q.text("partner_port_num = ");
727 q.text("%#x" % self.partner_port_num)
728 q.text(","); q.breakable()
729 q.text("partner_key = ");
730 q.text("%#x" % self.partner_key)
731 q.breakable()
732 q.text('}')
733
Rich Lane7dcdf022013-12-11 14:45:27 -0800734
735class bsn_port_counter_stats_entry(loxi.OFObject):
736
737 def __init__(self, port_no=None, values=None):
738 if port_no != None:
739 self.port_no = port_no
740 else:
741 self.port_no = 0
742 if values != None:
743 self.values = values
744 else:
745 self.values = []
746 return
747
748 def pack(self):
749 packed = []
750 packed.append(struct.pack("!H", 0)) # placeholder for length at index 0
751 packed.append('\x00' * 2)
752 packed.append(util.pack_port_no(self.port_no))
753 packed.append(loxi.generic_util.pack_list(self.values))
754 length = sum([len(x) for x in packed])
755 packed[0] = struct.pack("!H", length)
756 return ''.join(packed)
757
758 @staticmethod
759 def unpack(reader):
760 obj = bsn_port_counter_stats_entry()
761 _length = reader.read("!H")[0]
762 orig_reader = reader
763 reader = orig_reader.slice(_length - (0 + 2))
764 reader.skip(2)
765 obj.port_no = util.unpack_port_no(reader)
766 obj.values = loxi.generic_util.unpack_list(reader, common.uint64.unpack)
767 return obj
768
769 def __eq__(self, other):
770 if type(self) != type(other): return False
771 if self.port_no != other.port_no: return False
772 if self.values != other.values: return False
773 return True
774
775 def pretty_print(self, q):
776 q.text("bsn_port_counter_stats_entry {")
777 with q.group():
778 with q.indent(2):
779 q.breakable()
780 q.text("port_no = ");
781 q.text(util.pretty_port(self.port_no))
782 q.text(","); q.breakable()
783 q.text("values = ");
784 q.pp(self.values)
785 q.breakable()
786 q.text('}')
787
788
789class bsn_switch_pipeline_stats_entry(loxi.OFObject):
790
791 def __init__(self, pipeline=None):
792 if pipeline != None:
793 self.pipeline = pipeline
794 else:
795 self.pipeline = ""
796 return
797
798 def pack(self):
799 packed = []
800 packed.append(struct.pack("!256s", self.pipeline))
801 return ''.join(packed)
802
803 @staticmethod
804 def unpack(reader):
805 obj = bsn_switch_pipeline_stats_entry()
806 obj.pipeline = reader.read("!256s")[0].rstrip("\x00")
807 return obj
808
809 def __eq__(self, other):
810 if type(self) != type(other): return False
811 if self.pipeline != other.pipeline: return False
812 return True
813
814 def pretty_print(self, q):
815 q.text("bsn_switch_pipeline_stats_entry {")
816 with q.group():
817 with q.indent(2):
818 q.breakable()
819 q.text("pipeline = ");
820 q.pp(self.pipeline)
821 q.breakable()
822 q.text('}')
823
824
Rich Lane9ec3fca2014-02-26 16:22:56 -0800825class bsn_table_checksum_stats_entry(loxi.OFObject):
826
827 def __init__(self, table_id=None, checksum=None):
828 if table_id != None:
829 self.table_id = table_id
830 else:
831 self.table_id = 0
832 if checksum != None:
833 self.checksum = checksum
834 else:
835 self.checksum = 0
836 return
837
838 def pack(self):
839 packed = []
840 packed.append(struct.pack("!B", self.table_id))
841 packed.append(struct.pack("!Q", self.checksum))
842 return ''.join(packed)
843
844 @staticmethod
845 def unpack(reader):
846 obj = bsn_table_checksum_stats_entry()
847 obj.table_id = reader.read("!B")[0]
848 obj.checksum = reader.read("!Q")[0]
849 return obj
850
851 def __eq__(self, other):
852 if type(self) != type(other): return False
853 if self.table_id != other.table_id: return False
854 if self.checksum != other.checksum: return False
855 return True
856
857 def pretty_print(self, q):
858 q.text("bsn_table_checksum_stats_entry {")
859 with q.group():
860 with q.indent(2):
861 q.breakable()
862 q.text("table_id = ");
863 q.text("%#x" % self.table_id)
864 q.text(","); q.breakable()
865 q.text("checksum = ");
866 q.text("%#x" % self.checksum)
867 q.breakable()
868 q.text('}')
869
870
Rich Lane7dcdf022013-12-11 14:45:27 -0800871class bsn_vport(loxi.OFObject):
872 subtypes = {}
873
Rich Lane95f7fc92014-01-27 17:08:16 -0800874
875 def __init__(self, type=None):
876 if type != None:
877 self.type = type
878 else:
879 self.type = 0
880 return
881
882 def pack(self):
883 packed = []
884 packed.append(struct.pack("!H", self.type))
885 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
886 length = sum([len(x) for x in packed])
887 packed[1] = struct.pack("!H", length)
888 return ''.join(packed)
889
Rich Lane7dcdf022013-12-11 14:45:27 -0800890 @staticmethod
891 def unpack(reader):
892 subtype, = reader.peek('!H', 0)
Rich Lane95f7fc92014-01-27 17:08:16 -0800893 subclass = bsn_vport.subtypes.get(subtype)
894 if subclass:
895 return subclass.unpack(reader)
896
897 obj = bsn_vport()
898 obj.type = reader.read("!H")[0]
899 _length = reader.read("!H")[0]
900 orig_reader = reader
901 reader = orig_reader.slice(_length - (2 + 2))
902 return obj
903
904 def __eq__(self, other):
905 if type(self) != type(other): return False
906 if self.type != other.type: return False
907 return True
908
909 def pretty_print(self, q):
910 q.text("bsn_vport {")
911 with q.group():
912 with q.indent(2):
913 q.breakable()
914 q.breakable()
915 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -0800916
917
Rich Lane93b33132014-04-21 12:20:58 -0700918class bsn_vlan_counter_stats_entry(loxi.OFObject):
919
920 def __init__(self, vlan_vid=None, values=None):
921 if vlan_vid != None:
922 self.vlan_vid = vlan_vid
923 else:
924 self.vlan_vid = 0
925 if values != None:
926 self.values = values
927 else:
928 self.values = []
929 return
930
931 def pack(self):
932 packed = []
933 packed.append(struct.pack("!H", 0)) # placeholder for length at index 0
934 packed.append(struct.pack("!H", self.vlan_vid))
935 packed.append('\x00' * 4)
936 packed.append(loxi.generic_util.pack_list(self.values))
937 length = sum([len(x) for x in packed])
938 packed[0] = struct.pack("!H", length)
939 return ''.join(packed)
940
941 @staticmethod
942 def unpack(reader):
943 obj = bsn_vlan_counter_stats_entry()
944 _length = reader.read("!H")[0]
945 orig_reader = reader
946 reader = orig_reader.slice(_length - (0 + 2))
947 obj.vlan_vid = reader.read("!H")[0]
948 reader.skip(4)
949 obj.values = loxi.generic_util.unpack_list(reader, common.uint64.unpack)
950 return obj
951
952 def __eq__(self, other):
953 if type(self) != type(other): return False
954 if self.vlan_vid != other.vlan_vid: return False
955 if self.values != other.values: return False
956 return True
957
958 def pretty_print(self, q):
959 q.text("bsn_vlan_counter_stats_entry {")
960 with q.group():
961 with q.indent(2):
962 q.breakable()
963 q.text("vlan_vid = ");
964 q.text("%#x" % self.vlan_vid)
965 q.text(","); q.breakable()
966 q.text("values = ");
967 q.pp(self.values)
968 q.breakable()
969 q.text('}')
970
971
972class bsn_vport_l2gre(bsn_vport):
973 type = 1
974
Rich Lanef9530c42014-09-15 09:59:43 -0700975 def __init__(self, flags=None, port_no=None, loopback_port_no=None, local_mac=None, nh_mac=None, src_ip=None, dst_ip=None, dscp=None, ttl=None, vpn=None, rate_limit=None, if_name=None):
Rich Lane93b33132014-04-21 12:20:58 -0700976 if flags != None:
977 self.flags = flags
978 else:
979 self.flags = 0
980 if port_no != None:
981 self.port_no = port_no
982 else:
983 self.port_no = 0
Rich Lane5587ab12014-06-30 11:19:09 -0700984 if loopback_port_no != None:
985 self.loopback_port_no = loopback_port_no
986 else:
987 self.loopback_port_no = 0
Rich Lane93b33132014-04-21 12:20:58 -0700988 if local_mac != None:
989 self.local_mac = local_mac
990 else:
991 self.local_mac = [0,0,0,0,0,0]
992 if nh_mac != None:
993 self.nh_mac = nh_mac
994 else:
995 self.nh_mac = [0,0,0,0,0,0]
996 if src_ip != None:
997 self.src_ip = src_ip
998 else:
999 self.src_ip = 0
1000 if dst_ip != None:
1001 self.dst_ip = dst_ip
1002 else:
1003 self.dst_ip = 0
1004 if dscp != None:
1005 self.dscp = dscp
1006 else:
1007 self.dscp = 0
1008 if ttl != None:
1009 self.ttl = ttl
1010 else:
1011 self.ttl = 0
1012 if vpn != None:
1013 self.vpn = vpn
1014 else:
1015 self.vpn = 0
Rich Lanef9530c42014-09-15 09:59:43 -07001016 if rate_limit != None:
1017 self.rate_limit = rate_limit
1018 else:
1019 self.rate_limit = 0
Rich Lane93b33132014-04-21 12:20:58 -07001020 if if_name != None:
1021 self.if_name = if_name
1022 else:
1023 self.if_name = ""
1024 return
1025
1026 def pack(self):
1027 packed = []
1028 packed.append(struct.pack("!H", self.type))
1029 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1030 packed.append(struct.pack("!L", self.flags))
1031 packed.append(util.pack_port_no(self.port_no))
Rich Lane5587ab12014-06-30 11:19:09 -07001032 packed.append(util.pack_port_no(self.loopback_port_no))
Rich Lane93b33132014-04-21 12:20:58 -07001033 packed.append(struct.pack("!6B", *self.local_mac))
1034 packed.append(struct.pack("!6B", *self.nh_mac))
1035 packed.append(struct.pack("!L", self.src_ip))
1036 packed.append(struct.pack("!L", self.dst_ip))
1037 packed.append(struct.pack("!B", self.dscp))
1038 packed.append(struct.pack("!B", self.ttl))
1039 packed.append('\x00' * 2)
1040 packed.append(struct.pack("!L", self.vpn))
Rich Lanef9530c42014-09-15 09:59:43 -07001041 packed.append(struct.pack("!L", self.rate_limit))
Rich Lane93b33132014-04-21 12:20:58 -07001042 packed.append(struct.pack("!16s", self.if_name))
1043 length = sum([len(x) for x in packed])
1044 packed[1] = struct.pack("!H", length)
1045 return ''.join(packed)
1046
1047 @staticmethod
1048 def unpack(reader):
1049 obj = bsn_vport_l2gre()
1050 _type = reader.read("!H")[0]
1051 assert(_type == 1)
1052 _length = reader.read("!H")[0]
1053 orig_reader = reader
1054 reader = orig_reader.slice(_length - (2 + 2))
1055 obj.flags = reader.read("!L")[0]
1056 obj.port_no = util.unpack_port_no(reader)
Rich Lane5587ab12014-06-30 11:19:09 -07001057 obj.loopback_port_no = util.unpack_port_no(reader)
Rich Lane93b33132014-04-21 12:20:58 -07001058 obj.local_mac = list(reader.read('!6B'))
1059 obj.nh_mac = list(reader.read('!6B'))
1060 obj.src_ip = reader.read("!L")[0]
1061 obj.dst_ip = reader.read("!L")[0]
1062 obj.dscp = reader.read("!B")[0]
1063 obj.ttl = reader.read("!B")[0]
1064 reader.skip(2)
1065 obj.vpn = reader.read("!L")[0]
Rich Lanef9530c42014-09-15 09:59:43 -07001066 obj.rate_limit = reader.read("!L")[0]
Rich Lane93b33132014-04-21 12:20:58 -07001067 obj.if_name = reader.read("!16s")[0].rstrip("\x00")
1068 return obj
1069
1070 def __eq__(self, other):
1071 if type(self) != type(other): return False
1072 if self.flags != other.flags: return False
1073 if self.port_no != other.port_no: return False
Rich Lane5587ab12014-06-30 11:19:09 -07001074 if self.loopback_port_no != other.loopback_port_no: return False
Rich Lane93b33132014-04-21 12:20:58 -07001075 if self.local_mac != other.local_mac: return False
1076 if self.nh_mac != other.nh_mac: return False
1077 if self.src_ip != other.src_ip: return False
1078 if self.dst_ip != other.dst_ip: return False
1079 if self.dscp != other.dscp: return False
1080 if self.ttl != other.ttl: return False
1081 if self.vpn != other.vpn: return False
Rich Lanef9530c42014-09-15 09:59:43 -07001082 if self.rate_limit != other.rate_limit: return False
Rich Lane93b33132014-04-21 12:20:58 -07001083 if self.if_name != other.if_name: return False
1084 return True
1085
1086 def pretty_print(self, q):
1087 q.text("bsn_vport_l2gre {")
1088 with q.group():
1089 with q.indent(2):
1090 q.breakable()
1091 q.text("flags = ");
1092 q.text("%#x" % self.flags)
1093 q.text(","); q.breakable()
1094 q.text("port_no = ");
1095 q.text(util.pretty_port(self.port_no))
1096 q.text(","); q.breakable()
Rich Lane5587ab12014-06-30 11:19:09 -07001097 q.text("loopback_port_no = ");
1098 q.text(util.pretty_port(self.loopback_port_no))
1099 q.text(","); q.breakable()
Rich Lane93b33132014-04-21 12:20:58 -07001100 q.text("local_mac = ");
1101 q.text(util.pretty_mac(self.local_mac))
1102 q.text(","); q.breakable()
1103 q.text("nh_mac = ");
1104 q.text(util.pretty_mac(self.nh_mac))
1105 q.text(","); q.breakable()
1106 q.text("src_ip = ");
1107 q.text(util.pretty_ipv4(self.src_ip))
1108 q.text(","); q.breakable()
1109 q.text("dst_ip = ");
1110 q.text(util.pretty_ipv4(self.dst_ip))
1111 q.text(","); q.breakable()
1112 q.text("dscp = ");
1113 q.text("%#x" % self.dscp)
1114 q.text(","); q.breakable()
1115 q.text("ttl = ");
1116 q.text("%#x" % self.ttl)
1117 q.text(","); q.breakable()
1118 q.text("vpn = ");
1119 q.text("%#x" % self.vpn)
1120 q.text(","); q.breakable()
Rich Lanef9530c42014-09-15 09:59:43 -07001121 q.text("rate_limit = ");
1122 q.text("%#x" % self.rate_limit)
1123 q.text(","); q.breakable()
Rich Lane93b33132014-04-21 12:20:58 -07001124 q.text("if_name = ");
1125 q.pp(self.if_name)
1126 q.breakable()
1127 q.text('}')
1128
1129bsn_vport.subtypes[1] = bsn_vport_l2gre
1130
Rich Lane7dcdf022013-12-11 14:45:27 -08001131class bsn_vport_q_in_q(bsn_vport):
Dan Talaycof6202252013-07-02 01:00:29 -07001132 type = 0
1133
Kiran Poola150d8b02013-09-20 13:30:39 -07001134 def __init__(self, port_no=None, ingress_tpid=None, ingress_vlan_id=None, egress_tpid=None, egress_vlan_id=None, if_name=None):
Dan Talaycof6202252013-07-02 01:00:29 -07001135 if port_no != None:
1136 self.port_no = port_no
1137 else:
1138 self.port_no = 0
1139 if ingress_tpid != None:
1140 self.ingress_tpid = ingress_tpid
1141 else:
1142 self.ingress_tpid = 0
1143 if ingress_vlan_id != None:
1144 self.ingress_vlan_id = ingress_vlan_id
1145 else:
1146 self.ingress_vlan_id = 0
1147 if egress_tpid != None:
1148 self.egress_tpid = egress_tpid
1149 else:
1150 self.egress_tpid = 0
1151 if egress_vlan_id != None:
1152 self.egress_vlan_id = egress_vlan_id
1153 else:
1154 self.egress_vlan_id = 0
Kiran Poola150d8b02013-09-20 13:30:39 -07001155 if if_name != None:
1156 self.if_name = if_name
1157 else:
1158 self.if_name = ""
Dan Talaycof6202252013-07-02 01:00:29 -07001159 return
1160
1161 def pack(self):
1162 packed = []
1163 packed.append(struct.pack("!H", self.type))
Kiran Poola150d8b02013-09-20 13:30:39 -07001164 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
Dan Talaycof6202252013-07-02 01:00:29 -07001165 packed.append(struct.pack("!L", self.port_no))
1166 packed.append(struct.pack("!H", self.ingress_tpid))
1167 packed.append(struct.pack("!H", self.ingress_vlan_id))
1168 packed.append(struct.pack("!H", self.egress_tpid))
1169 packed.append(struct.pack("!H", self.egress_vlan_id))
Kiran Poola150d8b02013-09-20 13:30:39 -07001170 packed.append(struct.pack("!16s", self.if_name))
Dan Talaycof6202252013-07-02 01:00:29 -07001171 length = sum([len(x) for x in packed])
Kiran Poola150d8b02013-09-20 13:30:39 -07001172 packed[1] = struct.pack("!H", length)
Dan Talaycof6202252013-07-02 01:00:29 -07001173 return ''.join(packed)
1174
1175 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001176 def unpack(reader):
Dan Talaycof6202252013-07-02 01:00:29 -07001177 obj = bsn_vport_q_in_q()
Dan Talaycof6202252013-07-02 01:00:29 -07001178 _type = reader.read("!H")[0]
1179 assert(_type == 0)
1180 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001181 orig_reader = reader
1182 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001183 obj.port_no = reader.read("!L")[0]
1184 obj.ingress_tpid = reader.read("!H")[0]
1185 obj.ingress_vlan_id = reader.read("!H")[0]
1186 obj.egress_tpid = reader.read("!H")[0]
1187 obj.egress_vlan_id = reader.read("!H")[0]
Kiran Poola150d8b02013-09-20 13:30:39 -07001188 obj.if_name = reader.read("!16s")[0].rstrip("\x00")
Dan Talaycof6202252013-07-02 01:00:29 -07001189 return obj
1190
1191 def __eq__(self, other):
1192 if type(self) != type(other): return False
1193 if self.port_no != other.port_no: return False
1194 if self.ingress_tpid != other.ingress_tpid: return False
1195 if self.ingress_vlan_id != other.ingress_vlan_id: return False
1196 if self.egress_tpid != other.egress_tpid: return False
1197 if self.egress_vlan_id != other.egress_vlan_id: return False
Kiran Poola150d8b02013-09-20 13:30:39 -07001198 if self.if_name != other.if_name: return False
Dan Talaycof6202252013-07-02 01:00:29 -07001199 return True
1200
Dan Talaycof6202252013-07-02 01:00:29 -07001201 def pretty_print(self, q):
1202 q.text("bsn_vport_q_in_q {")
1203 with q.group():
1204 with q.indent(2):
1205 q.breakable()
1206 q.text("port_no = ");
1207 q.text("%#x" % self.port_no)
1208 q.text(","); q.breakable()
1209 q.text("ingress_tpid = ");
1210 q.text("%#x" % self.ingress_tpid)
1211 q.text(","); q.breakable()
1212 q.text("ingress_vlan_id = ");
1213 q.text("%#x" % self.ingress_vlan_id)
1214 q.text(","); q.breakable()
1215 q.text("egress_tpid = ");
1216 q.text("%#x" % self.egress_tpid)
1217 q.text(","); q.breakable()
1218 q.text("egress_vlan_id = ");
1219 q.text("%#x" % self.egress_vlan_id)
Kiran Poola150d8b02013-09-20 13:30:39 -07001220 q.text(","); q.breakable()
1221 q.text("if_name = ");
1222 q.pp(self.if_name)
Dan Talaycof6202252013-07-02 01:00:29 -07001223 q.breakable()
1224 q.text('}')
1225
Rich Lane7dcdf022013-12-11 14:45:27 -08001226bsn_vport.subtypes[0] = bsn_vport_q_in_q
1227
Rich Lane5587ab12014-06-30 11:19:09 -07001228class bsn_vrf_counter_stats_entry(loxi.OFObject):
1229
1230 def __init__(self, vrf=None, values=None):
1231 if vrf != None:
1232 self.vrf = vrf
1233 else:
1234 self.vrf = 0
1235 if values != None:
1236 self.values = values
1237 else:
1238 self.values = []
1239 return
1240
1241 def pack(self):
1242 packed = []
1243 packed.append(struct.pack("!H", 0)) # placeholder for length at index 0
1244 packed.append('\x00' * 2)
1245 packed.append(struct.pack("!L", self.vrf))
1246 packed.append(loxi.generic_util.pack_list(self.values))
1247 length = sum([len(x) for x in packed])
1248 packed[0] = struct.pack("!H", length)
1249 return ''.join(packed)
1250
1251 @staticmethod
1252 def unpack(reader):
1253 obj = bsn_vrf_counter_stats_entry()
1254 _length = reader.read("!H")[0]
1255 orig_reader = reader
1256 reader = orig_reader.slice(_length - (0 + 2))
1257 reader.skip(2)
1258 obj.vrf = reader.read("!L")[0]
1259 obj.values = loxi.generic_util.unpack_list(reader, common.uint64.unpack)
1260 return obj
1261
1262 def __eq__(self, other):
1263 if type(self) != type(other): return False
1264 if self.vrf != other.vrf: return False
1265 if self.values != other.values: return False
1266 return True
1267
1268 def pretty_print(self, q):
1269 q.text("bsn_vrf_counter_stats_entry {")
1270 with q.group():
1271 with q.indent(2):
1272 q.breakable()
1273 q.text("vrf = ");
1274 q.text("%#x" % self.vrf)
1275 q.text(","); q.breakable()
1276 q.text("values = ");
1277 q.pp(self.values)
1278 q.breakable()
1279 q.text('}')
1280
1281
Rich Lane7dcdf022013-12-11 14:45:27 -08001282class bucket(loxi.OFObject):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001283
1284 def __init__(self, weight=None, watch_port=None, watch_group=None, actions=None):
1285 if weight != None:
1286 self.weight = weight
1287 else:
1288 self.weight = 0
1289 if watch_port != None:
1290 self.watch_port = watch_port
1291 else:
1292 self.watch_port = 0
1293 if watch_group != None:
1294 self.watch_group = watch_group
1295 else:
1296 self.watch_group = 0
1297 if actions != None:
1298 self.actions = actions
1299 else:
1300 self.actions = []
1301 return
1302
1303 def pack(self):
1304 packed = []
1305 packed.append(struct.pack("!H", 0)) # placeholder for len at index 0
1306 packed.append(struct.pack("!H", self.weight))
Dan Talaycof6202252013-07-02 01:00:29 -07001307 packed.append(util.pack_port_no(self.watch_port))
Rich Lanec2ee4b82013-04-24 17:12:38 -07001308 packed.append(struct.pack("!L", self.watch_group))
1309 packed.append('\x00' * 4)
Rich Lane7dcdf022013-12-11 14:45:27 -08001310 packed.append(loxi.generic_util.pack_list(self.actions))
Rich Lanec2ee4b82013-04-24 17:12:38 -07001311 length = sum([len(x) for x in packed])
1312 packed[0] = struct.pack("!H", length)
1313 return ''.join(packed)
1314
1315 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001316 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001317 obj = bucket()
Dan Talaycof6202252013-07-02 01:00:29 -07001318 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001319 orig_reader = reader
1320 reader = orig_reader.slice(_len - (0 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001321 obj.weight = reader.read("!H")[0]
1322 obj.watch_port = util.unpack_port_no(reader)
1323 obj.watch_group = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001324 reader.skip(4)
Rich Lane7dcdf022013-12-11 14:45:27 -08001325 obj.actions = loxi.generic_util.unpack_list(reader, action.action.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -07001326 return obj
1327
1328 def __eq__(self, other):
1329 if type(self) != type(other): return False
1330 if self.weight != other.weight: return False
1331 if self.watch_port != other.watch_port: return False
1332 if self.watch_group != other.watch_group: return False
1333 if self.actions != other.actions: return False
1334 return True
1335
Rich Lanec2ee4b82013-04-24 17:12:38 -07001336 def pretty_print(self, q):
1337 q.text("bucket {")
1338 with q.group():
1339 with q.indent(2):
1340 q.breakable()
1341 q.text("weight = ");
1342 q.text("%#x" % self.weight)
1343 q.text(","); q.breakable()
1344 q.text("watch_port = ");
1345 q.text(util.pretty_port(self.watch_port))
1346 q.text(","); q.breakable()
1347 q.text("watch_group = ");
1348 q.text("%#x" % self.watch_group)
1349 q.text(","); q.breakable()
1350 q.text("actions = ");
1351 q.pp(self.actions)
1352 q.breakable()
1353 q.text('}')
1354
Rich Lane7dcdf022013-12-11 14:45:27 -08001355
1356class bucket_counter(loxi.OFObject):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001357
1358 def __init__(self, packet_count=None, byte_count=None):
1359 if packet_count != None:
1360 self.packet_count = packet_count
1361 else:
1362 self.packet_count = 0
1363 if byte_count != None:
1364 self.byte_count = byte_count
1365 else:
1366 self.byte_count = 0
1367 return
1368
1369 def pack(self):
1370 packed = []
1371 packed.append(struct.pack("!Q", self.packet_count))
1372 packed.append(struct.pack("!Q", self.byte_count))
1373 return ''.join(packed)
1374
1375 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001376 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001377 obj = bucket_counter()
Dan Talaycof6202252013-07-02 01:00:29 -07001378 obj.packet_count = reader.read("!Q")[0]
1379 obj.byte_count = reader.read("!Q")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001380 return obj
1381
1382 def __eq__(self, other):
1383 if type(self) != type(other): return False
1384 if self.packet_count != other.packet_count: return False
1385 if self.byte_count != other.byte_count: return False
1386 return True
1387
Rich Lanec2ee4b82013-04-24 17:12:38 -07001388 def pretty_print(self, q):
1389 q.text("bucket_counter {")
1390 with q.group():
1391 with q.indent(2):
1392 q.breakable()
1393 q.text("packet_count = ");
1394 q.text("%#x" % self.packet_count)
1395 q.text(","); q.breakable()
1396 q.text("byte_count = ");
1397 q.text("%#x" % self.byte_count)
1398 q.breakable()
1399 q.text('}')
1400
Rich Lane7dcdf022013-12-11 14:45:27 -08001401
Rich Lane7dcdf022013-12-11 14:45:27 -08001402class flow_stats_entry(loxi.OFObject):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001403
Kiran Poolaae8fbf12013-09-19 16:32:32 -07001404 def __init__(self, table_id=None, duration_sec=None, duration_nsec=None, priority=None, idle_timeout=None, hard_timeout=None, flags=None, cookie=None, packet_count=None, byte_count=None, match=None, instructions=None):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001405 if table_id != None:
1406 self.table_id = table_id
1407 else:
1408 self.table_id = 0
1409 if duration_sec != None:
1410 self.duration_sec = duration_sec
1411 else:
1412 self.duration_sec = 0
1413 if duration_nsec != None:
1414 self.duration_nsec = duration_nsec
1415 else:
1416 self.duration_nsec = 0
1417 if priority != None:
1418 self.priority = priority
1419 else:
1420 self.priority = 0
1421 if idle_timeout != None:
1422 self.idle_timeout = idle_timeout
1423 else:
1424 self.idle_timeout = 0
1425 if hard_timeout != None:
1426 self.hard_timeout = hard_timeout
1427 else:
1428 self.hard_timeout = 0
Kiran Poolaae8fbf12013-09-19 16:32:32 -07001429 if flags != None:
1430 self.flags = flags
1431 else:
1432 self.flags = 0
Rich Lanec2ee4b82013-04-24 17:12:38 -07001433 if cookie != None:
1434 self.cookie = cookie
1435 else:
1436 self.cookie = 0
1437 if packet_count != None:
1438 self.packet_count = packet_count
1439 else:
1440 self.packet_count = 0
1441 if byte_count != None:
1442 self.byte_count = byte_count
1443 else:
1444 self.byte_count = 0
1445 if match != None:
1446 self.match = match
1447 else:
1448 self.match = common.match()
1449 if instructions != None:
1450 self.instructions = instructions
1451 else:
1452 self.instructions = []
1453 return
1454
1455 def pack(self):
1456 packed = []
1457 packed.append(struct.pack("!H", 0)) # placeholder for length at index 0
1458 packed.append(struct.pack("!B", self.table_id))
1459 packed.append('\x00' * 1)
1460 packed.append(struct.pack("!L", self.duration_sec))
1461 packed.append(struct.pack("!L", self.duration_nsec))
1462 packed.append(struct.pack("!H", self.priority))
1463 packed.append(struct.pack("!H", self.idle_timeout))
1464 packed.append(struct.pack("!H", self.hard_timeout))
Kiran Poolaae8fbf12013-09-19 16:32:32 -07001465 packed.append(struct.pack("!H", self.flags))
1466 packed.append('\x00' * 4)
Rich Lanec2ee4b82013-04-24 17:12:38 -07001467 packed.append(struct.pack("!Q", self.cookie))
1468 packed.append(struct.pack("!Q", self.packet_count))
1469 packed.append(struct.pack("!Q", self.byte_count))
1470 packed.append(self.match.pack())
Rich Lane7dcdf022013-12-11 14:45:27 -08001471 packed.append(loxi.generic_util.pack_list(self.instructions))
Rich Lanec2ee4b82013-04-24 17:12:38 -07001472 length = sum([len(x) for x in packed])
1473 packed[0] = struct.pack("!H", length)
1474 return ''.join(packed)
1475
1476 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001477 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001478 obj = flow_stats_entry()
Dan Talaycof6202252013-07-02 01:00:29 -07001479 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001480 orig_reader = reader
1481 reader = orig_reader.slice(_length - (0 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001482 obj.table_id = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001483 reader.skip(1)
Dan Talaycof6202252013-07-02 01:00:29 -07001484 obj.duration_sec = reader.read("!L")[0]
1485 obj.duration_nsec = reader.read("!L")[0]
1486 obj.priority = reader.read("!H")[0]
1487 obj.idle_timeout = reader.read("!H")[0]
1488 obj.hard_timeout = reader.read("!H")[0]
Kiran Poolaae8fbf12013-09-19 16:32:32 -07001489 obj.flags = reader.read("!H")[0]
1490 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -07001491 obj.cookie = reader.read("!Q")[0]
1492 obj.packet_count = reader.read("!Q")[0]
1493 obj.byte_count = reader.read("!Q")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001494 obj.match = common.match.unpack(reader)
Rich Lane7dcdf022013-12-11 14:45:27 -08001495 obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -07001496 return obj
1497
1498 def __eq__(self, other):
1499 if type(self) != type(other): return False
1500 if self.table_id != other.table_id: return False
1501 if self.duration_sec != other.duration_sec: return False
1502 if self.duration_nsec != other.duration_nsec: return False
1503 if self.priority != other.priority: return False
1504 if self.idle_timeout != other.idle_timeout: return False
1505 if self.hard_timeout != other.hard_timeout: return False
Kiran Poolaae8fbf12013-09-19 16:32:32 -07001506 if self.flags != other.flags: return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07001507 if self.cookie != other.cookie: return False
1508 if self.packet_count != other.packet_count: return False
1509 if self.byte_count != other.byte_count: return False
1510 if self.match != other.match: return False
1511 if self.instructions != other.instructions: return False
1512 return True
1513
Rich Lanec2ee4b82013-04-24 17:12:38 -07001514 def pretty_print(self, q):
1515 q.text("flow_stats_entry {")
1516 with q.group():
1517 with q.indent(2):
1518 q.breakable()
1519 q.text("table_id = ");
1520 q.text("%#x" % self.table_id)
1521 q.text(","); q.breakable()
1522 q.text("duration_sec = ");
1523 q.text("%#x" % self.duration_sec)
1524 q.text(","); q.breakable()
1525 q.text("duration_nsec = ");
1526 q.text("%#x" % self.duration_nsec)
1527 q.text(","); q.breakable()
1528 q.text("priority = ");
1529 q.text("%#x" % self.priority)
1530 q.text(","); q.breakable()
1531 q.text("idle_timeout = ");
1532 q.text("%#x" % self.idle_timeout)
1533 q.text(","); q.breakable()
1534 q.text("hard_timeout = ");
1535 q.text("%#x" % self.hard_timeout)
1536 q.text(","); q.breakable()
Kiran Poolaae8fbf12013-09-19 16:32:32 -07001537 q.text("flags = ");
1538 q.text("%#x" % self.flags)
1539 q.text(","); q.breakable()
Rich Lanec2ee4b82013-04-24 17:12:38 -07001540 q.text("cookie = ");
1541 q.text("%#x" % self.cookie)
1542 q.text(","); q.breakable()
1543 q.text("packet_count = ");
1544 q.text("%#x" % self.packet_count)
1545 q.text(","); q.breakable()
1546 q.text("byte_count = ");
1547 q.text("%#x" % self.byte_count)
1548 q.text(","); q.breakable()
1549 q.text("match = ");
1550 q.pp(self.match)
1551 q.text(","); q.breakable()
1552 q.text("instructions = ");
1553 q.pp(self.instructions)
1554 q.breakable()
1555 q.text('}')
1556
Rich Lane7dcdf022013-12-11 14:45:27 -08001557
1558class group_desc_stats_entry(loxi.OFObject):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001559
Rich Lane6f4978c2013-10-20 21:33:52 -07001560 def __init__(self, group_type=None, group_id=None, buckets=None):
1561 if group_type != None:
1562 self.group_type = group_type
Rich Lanec2ee4b82013-04-24 17:12:38 -07001563 else:
Rich Lane6f4978c2013-10-20 21:33:52 -07001564 self.group_type = 0
Rich Lanec2ee4b82013-04-24 17:12:38 -07001565 if group_id != None:
1566 self.group_id = group_id
1567 else:
1568 self.group_id = 0
1569 if buckets != None:
1570 self.buckets = buckets
1571 else:
1572 self.buckets = []
1573 return
1574
1575 def pack(self):
1576 packed = []
1577 packed.append(struct.pack("!H", 0)) # placeholder for length at index 0
Rich Lane6f4978c2013-10-20 21:33:52 -07001578 packed.append(struct.pack("!B", self.group_type))
Rich Lanec2ee4b82013-04-24 17:12:38 -07001579 packed.append('\x00' * 1)
1580 packed.append(struct.pack("!L", self.group_id))
Rich Lane7dcdf022013-12-11 14:45:27 -08001581 packed.append(loxi.generic_util.pack_list(self.buckets))
Rich Lanec2ee4b82013-04-24 17:12:38 -07001582 length = sum([len(x) for x in packed])
1583 packed[0] = struct.pack("!H", length)
1584 return ''.join(packed)
1585
1586 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001587 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001588 obj = group_desc_stats_entry()
Dan Talaycof6202252013-07-02 01:00:29 -07001589 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001590 orig_reader = reader
1591 reader = orig_reader.slice(_length - (0 + 2))
Rich Lane6f4978c2013-10-20 21:33:52 -07001592 obj.group_type = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001593 reader.skip(1)
Dan Talaycof6202252013-07-02 01:00:29 -07001594 obj.group_id = reader.read("!L")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001595 obj.buckets = loxi.generic_util.unpack_list(reader, common.bucket.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -07001596 return obj
1597
1598 def __eq__(self, other):
1599 if type(self) != type(other): return False
Rich Lane6f4978c2013-10-20 21:33:52 -07001600 if self.group_type != other.group_type: return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07001601 if self.group_id != other.group_id: return False
1602 if self.buckets != other.buckets: return False
1603 return True
1604
Rich Lanec2ee4b82013-04-24 17:12:38 -07001605 def pretty_print(self, q):
1606 q.text("group_desc_stats_entry {")
1607 with q.group():
1608 with q.indent(2):
1609 q.breakable()
Rich Lane6f4978c2013-10-20 21:33:52 -07001610 q.text("group_type = ");
1611 q.text("%#x" % self.group_type)
Rich Lanec2ee4b82013-04-24 17:12:38 -07001612 q.text(","); q.breakable()
1613 q.text("group_id = ");
1614 q.text("%#x" % self.group_id)
1615 q.text(","); q.breakable()
1616 q.text("buckets = ");
1617 q.pp(self.buckets)
1618 q.breakable()
1619 q.text('}')
1620
Rich Lane7dcdf022013-12-11 14:45:27 -08001621
1622class group_stats_entry(loxi.OFObject):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001623
1624 def __init__(self, group_id=None, ref_count=None, packet_count=None, byte_count=None, duration_sec=None, duration_nsec=None, bucket_stats=None):
1625 if group_id != None:
1626 self.group_id = group_id
1627 else:
1628 self.group_id = 0
1629 if ref_count != None:
1630 self.ref_count = ref_count
1631 else:
1632 self.ref_count = 0
1633 if packet_count != None:
1634 self.packet_count = packet_count
1635 else:
1636 self.packet_count = 0
1637 if byte_count != None:
1638 self.byte_count = byte_count
1639 else:
1640 self.byte_count = 0
1641 if duration_sec != None:
1642 self.duration_sec = duration_sec
1643 else:
1644 self.duration_sec = 0
1645 if duration_nsec != None:
1646 self.duration_nsec = duration_nsec
1647 else:
1648 self.duration_nsec = 0
1649 if bucket_stats != None:
1650 self.bucket_stats = bucket_stats
1651 else:
1652 self.bucket_stats = []
1653 return
1654
1655 def pack(self):
1656 packed = []
1657 packed.append(struct.pack("!H", 0)) # placeholder for length at index 0
1658 packed.append('\x00' * 2)
1659 packed.append(struct.pack("!L", self.group_id))
1660 packed.append(struct.pack("!L", self.ref_count))
1661 packed.append('\x00' * 4)
1662 packed.append(struct.pack("!Q", self.packet_count))
1663 packed.append(struct.pack("!Q", self.byte_count))
1664 packed.append(struct.pack("!L", self.duration_sec))
1665 packed.append(struct.pack("!L", self.duration_nsec))
Rich Lane7dcdf022013-12-11 14:45:27 -08001666 packed.append(loxi.generic_util.pack_list(self.bucket_stats))
Rich Lanec2ee4b82013-04-24 17:12:38 -07001667 length = sum([len(x) for x in packed])
1668 packed[0] = struct.pack("!H", length)
1669 return ''.join(packed)
1670
1671 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001672 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001673 obj = group_stats_entry()
Dan Talaycof6202252013-07-02 01:00:29 -07001674 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001675 orig_reader = reader
1676 reader = orig_reader.slice(_length - (0 + 2))
Rich Lanec2ee4b82013-04-24 17:12:38 -07001677 reader.skip(2)
Dan Talaycof6202252013-07-02 01:00:29 -07001678 obj.group_id = reader.read("!L")[0]
1679 obj.ref_count = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001680 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -07001681 obj.packet_count = reader.read("!Q")[0]
1682 obj.byte_count = reader.read("!Q")[0]
1683 obj.duration_sec = reader.read("!L")[0]
1684 obj.duration_nsec = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001685 obj.bucket_stats = loxi.generic_util.unpack_list(reader, common.bucket_counter.unpack)
1686 return obj
1687
1688 def __eq__(self, other):
1689 if type(self) != type(other): return False
1690 if self.group_id != other.group_id: return False
1691 if self.ref_count != other.ref_count: return False
1692 if self.packet_count != other.packet_count: return False
1693 if self.byte_count != other.byte_count: return False
1694 if self.duration_sec != other.duration_sec: return False
1695 if self.duration_nsec != other.duration_nsec: return False
1696 if self.bucket_stats != other.bucket_stats: return False
1697 return True
1698
Rich Lanec2ee4b82013-04-24 17:12:38 -07001699 def pretty_print(self, q):
1700 q.text("group_stats_entry {")
1701 with q.group():
1702 with q.indent(2):
1703 q.breakable()
1704 q.text("group_id = ");
1705 q.text("%#x" % self.group_id)
1706 q.text(","); q.breakable()
1707 q.text("ref_count = ");
1708 q.text("%#x" % self.ref_count)
1709 q.text(","); q.breakable()
1710 q.text("packet_count = ");
1711 q.text("%#x" % self.packet_count)
1712 q.text(","); q.breakable()
1713 q.text("byte_count = ");
1714 q.text("%#x" % self.byte_count)
1715 q.text(","); q.breakable()
1716 q.text("duration_sec = ");
1717 q.text("%#x" % self.duration_sec)
1718 q.text(","); q.breakable()
1719 q.text("duration_nsec = ");
1720 q.text("%#x" % self.duration_nsec)
1721 q.text(","); q.breakable()
1722 q.text("bucket_stats = ");
1723 q.pp(self.bucket_stats)
1724 q.breakable()
1725 q.text('}')
1726
Rich Lane7dcdf022013-12-11 14:45:27 -08001727
1728class hello_elem(loxi.OFObject):
1729 subtypes = {}
1730
Rich Lane95f7fc92014-01-27 17:08:16 -08001731
1732 def __init__(self, type=None):
1733 if type != None:
1734 self.type = type
1735 else:
1736 self.type = 0
1737 return
1738
1739 def pack(self):
1740 packed = []
1741 packed.append(struct.pack("!H", self.type))
1742 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1743 length = sum([len(x) for x in packed])
1744 packed[1] = struct.pack("!H", length)
1745 return ''.join(packed)
1746
Rich Lane7dcdf022013-12-11 14:45:27 -08001747 @staticmethod
1748 def unpack(reader):
1749 subtype, = reader.peek('!H', 0)
Rich Lane95f7fc92014-01-27 17:08:16 -08001750 subclass = hello_elem.subtypes.get(subtype)
1751 if subclass:
1752 return subclass.unpack(reader)
1753
1754 obj = hello_elem()
1755 obj.type = reader.read("!H")[0]
1756 _length = reader.read("!H")[0]
1757 orig_reader = reader
1758 reader = orig_reader.slice(_length - (2 + 2))
1759 return obj
1760
1761 def __eq__(self, other):
1762 if type(self) != type(other): return False
1763 if self.type != other.type: return False
1764 return True
1765
1766 def pretty_print(self, q):
1767 q.text("hello_elem {")
1768 with q.group():
1769 with q.indent(2):
1770 q.breakable()
1771 q.breakable()
1772 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -08001773
1774
1775class hello_elem_versionbitmap(hello_elem):
Dan Talaycof6202252013-07-02 01:00:29 -07001776 type = 1
Rich Lanec2ee4b82013-04-24 17:12:38 -07001777
1778 def __init__(self, bitmaps=None):
1779 if bitmaps != None:
1780 self.bitmaps = bitmaps
1781 else:
1782 self.bitmaps = []
1783 return
1784
1785 def pack(self):
1786 packed = []
1787 packed.append(struct.pack("!H", self.type))
1788 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
Rich Lane7dcdf022013-12-11 14:45:27 -08001789 packed.append(loxi.generic_util.pack_list(self.bitmaps))
Rich Lanec2ee4b82013-04-24 17:12:38 -07001790 length = sum([len(x) for x in packed])
1791 packed[1] = struct.pack("!H", length)
1792 return ''.join(packed)
1793
1794 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001795 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001796 obj = hello_elem_versionbitmap()
Dan Talaycof6202252013-07-02 01:00:29 -07001797 _type = reader.read("!H")[0]
1798 assert(_type == 1)
1799 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001800 orig_reader = reader
1801 reader = orig_reader.slice(_length - (2 + 2))
Rich Lanec2ee4b82013-04-24 17:12:38 -07001802 obj.bitmaps = loxi.generic_util.unpack_list(reader, common.uint32.unpack)
1803 return obj
1804
1805 def __eq__(self, other):
1806 if type(self) != type(other): return False
1807 if self.bitmaps != other.bitmaps: return False
1808 return True
1809
Rich Lanec2ee4b82013-04-24 17:12:38 -07001810 def pretty_print(self, q):
1811 q.text("hello_elem_versionbitmap {")
1812 with q.group():
1813 with q.indent(2):
1814 q.breakable()
1815 q.text("bitmaps = ");
1816 q.pp(self.bitmaps)
1817 q.breakable()
1818 q.text('}')
1819
Rich Lane7dcdf022013-12-11 14:45:27 -08001820hello_elem.subtypes[1] = hello_elem_versionbitmap
1821
1822class match_v3(loxi.OFObject):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001823 type = 1
1824
1825 def __init__(self, oxm_list=None):
1826 if oxm_list != None:
1827 self.oxm_list = oxm_list
1828 else:
1829 self.oxm_list = []
1830 return
1831
1832 def pack(self):
1833 packed = []
1834 packed.append(struct.pack("!H", self.type))
1835 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
Rich Lane7dcdf022013-12-11 14:45:27 -08001836 packed.append(loxi.generic_util.pack_list(self.oxm_list))
Rich Lanec2ee4b82013-04-24 17:12:38 -07001837 length = sum([len(x) for x in packed])
1838 packed[1] = struct.pack("!H", length)
Rich Laned53156a2013-08-05 17:17:33 -07001839 packed.append(loxi.generic_util.pad_to(8, length))
Rich Lanec2ee4b82013-04-24 17:12:38 -07001840 return ''.join(packed)
1841
1842 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001843 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001844 obj = match_v3()
Dan Talaycof6202252013-07-02 01:00:29 -07001845 _type = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001846 assert(_type == 1)
Dan Talaycof6202252013-07-02 01:00:29 -07001847 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001848 orig_reader = reader
1849 reader = orig_reader.slice(_length - (2 + 2))
1850 obj.oxm_list = loxi.generic_util.unpack_list(reader, oxm.oxm.unpack)
1851 orig_reader.skip_align()
Rich Lanec2ee4b82013-04-24 17:12:38 -07001852 return obj
1853
1854 def __eq__(self, other):
1855 if type(self) != type(other): return False
1856 if self.oxm_list != other.oxm_list: return False
1857 return True
1858
Rich Lanec2ee4b82013-04-24 17:12:38 -07001859 def pretty_print(self, q):
1860 q.text("match_v3 {")
1861 with q.group():
1862 with q.indent(2):
1863 q.breakable()
1864 q.text("oxm_list = ");
1865 q.pp(self.oxm_list)
1866 q.breakable()
1867 q.text('}')
1868
Rich Lane7dcdf022013-12-11 14:45:27 -08001869
1870class meter_band_stats(loxi.OFObject):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001871
1872 def __init__(self, packet_band_count=None, byte_band_count=None):
1873 if packet_band_count != None:
1874 self.packet_band_count = packet_band_count
1875 else:
1876 self.packet_band_count = 0
1877 if byte_band_count != None:
1878 self.byte_band_count = byte_band_count
1879 else:
1880 self.byte_band_count = 0
1881 return
1882
1883 def pack(self):
1884 packed = []
1885 packed.append(struct.pack("!Q", self.packet_band_count))
1886 packed.append(struct.pack("!Q", self.byte_band_count))
1887 return ''.join(packed)
1888
1889 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001890 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001891 obj = meter_band_stats()
Dan Talaycof6202252013-07-02 01:00:29 -07001892 obj.packet_band_count = reader.read("!Q")[0]
1893 obj.byte_band_count = reader.read("!Q")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07001894 return obj
1895
1896 def __eq__(self, other):
1897 if type(self) != type(other): return False
1898 if self.packet_band_count != other.packet_band_count: return False
1899 if self.byte_band_count != other.byte_band_count: return False
1900 return True
1901
Rich Lanec2ee4b82013-04-24 17:12:38 -07001902 def pretty_print(self, q):
1903 q.text("meter_band_stats {")
1904 with q.group():
1905 with q.indent(2):
1906 q.breakable()
1907 q.text("packet_band_count = ");
1908 q.text("%#x" % self.packet_band_count)
1909 q.text(","); q.breakable()
1910 q.text("byte_band_count = ");
1911 q.text("%#x" % self.byte_band_count)
1912 q.breakable()
1913 q.text('}')
1914
Rich Lane7dcdf022013-12-11 14:45:27 -08001915
1916class meter_config(loxi.OFObject):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001917
1918 def __init__(self, flags=None, meter_id=None, entries=None):
1919 if flags != None:
1920 self.flags = flags
1921 else:
1922 self.flags = 0
1923 if meter_id != None:
1924 self.meter_id = meter_id
1925 else:
1926 self.meter_id = 0
1927 if entries != None:
1928 self.entries = entries
1929 else:
1930 self.entries = []
1931 return
1932
1933 def pack(self):
1934 packed = []
1935 packed.append(struct.pack("!H", 0)) # placeholder for length at index 0
1936 packed.append(struct.pack("!H", self.flags))
1937 packed.append(struct.pack("!L", self.meter_id))
Rich Lane7dcdf022013-12-11 14:45:27 -08001938 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lanec2ee4b82013-04-24 17:12:38 -07001939 length = sum([len(x) for x in packed])
1940 packed[0] = struct.pack("!H", length)
1941 return ''.join(packed)
1942
1943 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08001944 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001945 obj = meter_config()
Dan Talaycof6202252013-07-02 01:00:29 -07001946 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001947 orig_reader = reader
1948 reader = orig_reader.slice(_length - (0 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07001949 obj.flags = reader.read("!H")[0]
1950 obj.meter_id = reader.read("!L")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08001951 obj.entries = loxi.generic_util.unpack_list(reader, meter_band.meter_band.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -07001952 return obj
1953
1954 def __eq__(self, other):
1955 if type(self) != type(other): return False
1956 if self.flags != other.flags: return False
1957 if self.meter_id != other.meter_id: return False
1958 if self.entries != other.entries: return False
1959 return True
1960
Rich Lanec2ee4b82013-04-24 17:12:38 -07001961 def pretty_print(self, q):
1962 q.text("meter_config {")
1963 with q.group():
1964 with q.indent(2):
1965 q.breakable()
1966 q.text("flags = ");
1967 q.text("%#x" % self.flags)
1968 q.text(","); q.breakable()
1969 q.text("meter_id = ");
1970 q.text("%#x" % self.meter_id)
1971 q.text(","); q.breakable()
1972 q.text("entries = ");
1973 q.pp(self.entries)
1974 q.breakable()
1975 q.text('}')
1976
Rich Lane7dcdf022013-12-11 14:45:27 -08001977
1978class meter_features(loxi.OFObject):
Rich Lanec2ee4b82013-04-24 17:12:38 -07001979
1980 def __init__(self, max_meter=None, band_types=None, capabilities=None, max_bands=None, max_color=None):
1981 if max_meter != None:
1982 self.max_meter = max_meter
1983 else:
1984 self.max_meter = 0
1985 if band_types != None:
1986 self.band_types = band_types
1987 else:
1988 self.band_types = 0
1989 if capabilities != None:
1990 self.capabilities = capabilities
1991 else:
1992 self.capabilities = 0
1993 if max_bands != None:
1994 self.max_bands = max_bands
1995 else:
1996 self.max_bands = 0
1997 if max_color != None:
1998 self.max_color = max_color
1999 else:
2000 self.max_color = 0
2001 return
2002
2003 def pack(self):
2004 packed = []
2005 packed.append(struct.pack("!L", self.max_meter))
2006 packed.append(struct.pack("!L", self.band_types))
2007 packed.append(struct.pack("!L", self.capabilities))
2008 packed.append(struct.pack("!B", self.max_bands))
2009 packed.append(struct.pack("!B", self.max_color))
2010 packed.append('\x00' * 2)
2011 return ''.join(packed)
2012
2013 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002014 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07002015 obj = meter_features()
Dan Talaycof6202252013-07-02 01:00:29 -07002016 obj.max_meter = reader.read("!L")[0]
2017 obj.band_types = reader.read("!L")[0]
2018 obj.capabilities = reader.read("!L")[0]
2019 obj.max_bands = reader.read("!B")[0]
2020 obj.max_color = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07002021 reader.skip(2)
2022 return obj
2023
2024 def __eq__(self, other):
2025 if type(self) != type(other): return False
2026 if self.max_meter != other.max_meter: return False
2027 if self.band_types != other.band_types: return False
2028 if self.capabilities != other.capabilities: return False
2029 if self.max_bands != other.max_bands: return False
2030 if self.max_color != other.max_color: return False
2031 return True
2032
Rich Lanec2ee4b82013-04-24 17:12:38 -07002033 def pretty_print(self, q):
2034 q.text("meter_features {")
2035 with q.group():
2036 with q.indent(2):
2037 q.breakable()
2038 q.text("max_meter = ");
2039 q.text("%#x" % self.max_meter)
2040 q.text(","); q.breakable()
2041 q.text("band_types = ");
2042 q.text("%#x" % self.band_types)
2043 q.text(","); q.breakable()
2044 q.text("capabilities = ");
2045 q.text("%#x" % self.capabilities)
2046 q.text(","); q.breakable()
2047 q.text("max_bands = ");
2048 q.text("%#x" % self.max_bands)
2049 q.text(","); q.breakable()
2050 q.text("max_color = ");
2051 q.text("%#x" % self.max_color)
2052 q.breakable()
2053 q.text('}')
2054
Rich Lane7dcdf022013-12-11 14:45:27 -08002055
2056class meter_stats(loxi.OFObject):
Rich Lanec2ee4b82013-04-24 17:12:38 -07002057
2058 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):
2059 if meter_id != None:
2060 self.meter_id = meter_id
2061 else:
2062 self.meter_id = 0
2063 if flow_count != None:
2064 self.flow_count = flow_count
2065 else:
2066 self.flow_count = 0
2067 if packet_in_count != None:
2068 self.packet_in_count = packet_in_count
2069 else:
2070 self.packet_in_count = 0
2071 if byte_in_count != None:
2072 self.byte_in_count = byte_in_count
2073 else:
2074 self.byte_in_count = 0
2075 if duration_sec != None:
2076 self.duration_sec = duration_sec
2077 else:
2078 self.duration_sec = 0
2079 if duration_nsec != None:
2080 self.duration_nsec = duration_nsec
2081 else:
2082 self.duration_nsec = 0
2083 if band_stats != None:
2084 self.band_stats = band_stats
2085 else:
2086 self.band_stats = []
2087 return
2088
2089 def pack(self):
2090 packed = []
2091 packed.append(struct.pack("!L", self.meter_id))
2092 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
2093 packed.append('\x00' * 6)
2094 packed.append(struct.pack("!L", self.flow_count))
2095 packed.append(struct.pack("!Q", self.packet_in_count))
2096 packed.append(struct.pack("!Q", self.byte_in_count))
2097 packed.append(struct.pack("!L", self.duration_sec))
2098 packed.append(struct.pack("!L", self.duration_nsec))
Rich Lane7dcdf022013-12-11 14:45:27 -08002099 packed.append(loxi.generic_util.pack_list(self.band_stats))
Rich Lanec2ee4b82013-04-24 17:12:38 -07002100 length = sum([len(x) for x in packed])
2101 packed[1] = struct.pack("!H", length)
2102 return ''.join(packed)
2103
2104 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002105 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07002106 obj = meter_stats()
Dan Talaycof6202252013-07-02 01:00:29 -07002107 obj.meter_id = reader.read("!L")[0]
2108 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002109 orig_reader = reader
2110 reader = orig_reader.slice(_len - (4 + 2))
Rich Lanec2ee4b82013-04-24 17:12:38 -07002111 reader.skip(6)
Dan Talaycof6202252013-07-02 01:00:29 -07002112 obj.flow_count = reader.read("!L")[0]
2113 obj.packet_in_count = reader.read("!Q")[0]
2114 obj.byte_in_count = reader.read("!Q")[0]
2115 obj.duration_sec = reader.read("!L")[0]
2116 obj.duration_nsec = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07002117 obj.band_stats = loxi.generic_util.unpack_list(reader, common.meter_band_stats.unpack)
2118 return obj
2119
2120 def __eq__(self, other):
2121 if type(self) != type(other): return False
2122 if self.meter_id != other.meter_id: return False
2123 if self.flow_count != other.flow_count: return False
2124 if self.packet_in_count != other.packet_in_count: return False
2125 if self.byte_in_count != other.byte_in_count: return False
2126 if self.duration_sec != other.duration_sec: return False
2127 if self.duration_nsec != other.duration_nsec: return False
2128 if self.band_stats != other.band_stats: return False
2129 return True
2130
Rich Lanec2ee4b82013-04-24 17:12:38 -07002131 def pretty_print(self, q):
2132 q.text("meter_stats {")
2133 with q.group():
2134 with q.indent(2):
2135 q.breakable()
2136 q.text("meter_id = ");
2137 q.text("%#x" % self.meter_id)
2138 q.text(","); q.breakable()
2139 q.text("flow_count = ");
2140 q.text("%#x" % self.flow_count)
2141 q.text(","); q.breakable()
2142 q.text("packet_in_count = ");
2143 q.text("%#x" % self.packet_in_count)
2144 q.text(","); q.breakable()
2145 q.text("byte_in_count = ");
2146 q.text("%#x" % self.byte_in_count)
2147 q.text(","); q.breakable()
2148 q.text("duration_sec = ");
2149 q.text("%#x" % self.duration_sec)
2150 q.text(","); q.breakable()
2151 q.text("duration_nsec = ");
2152 q.text("%#x" % self.duration_nsec)
2153 q.text(","); q.breakable()
2154 q.text("band_stats = ");
2155 q.pp(self.band_stats)
2156 q.breakable()
2157 q.text('}')
2158
Rich Lane7dcdf022013-12-11 14:45:27 -08002159
2160class packet_queue(loxi.OFObject):
Rich Lanec2ee4b82013-04-24 17:12:38 -07002161
2162 def __init__(self, queue_id=None, port=None, properties=None):
2163 if queue_id != None:
2164 self.queue_id = queue_id
2165 else:
2166 self.queue_id = 0
2167 if port != None:
2168 self.port = port
2169 else:
2170 self.port = 0
2171 if properties != None:
2172 self.properties = properties
2173 else:
2174 self.properties = []
2175 return
2176
2177 def pack(self):
2178 packed = []
2179 packed.append(struct.pack("!L", self.queue_id))
Dan Talaycof6202252013-07-02 01:00:29 -07002180 packed.append(util.pack_port_no(self.port))
Rich Lanec2ee4b82013-04-24 17:12:38 -07002181 packed.append(struct.pack("!H", 0)) # placeholder for len at index 2
2182 packed.append('\x00' * 6)
Rich Lane7dcdf022013-12-11 14:45:27 -08002183 packed.append(loxi.generic_util.pack_list(self.properties))
Rich Lanec2ee4b82013-04-24 17:12:38 -07002184 length = sum([len(x) for x in packed])
2185 packed[2] = struct.pack("!H", length)
2186 return ''.join(packed)
2187
2188 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002189 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07002190 obj = packet_queue()
Dan Talaycof6202252013-07-02 01:00:29 -07002191 obj.queue_id = reader.read("!L")[0]
2192 obj.port = util.unpack_port_no(reader)
2193 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002194 orig_reader = reader
2195 reader = orig_reader.slice(_len - (8 + 2))
Rich Lanec2ee4b82013-04-24 17:12:38 -07002196 reader.skip(6)
Rich Lane7dcdf022013-12-11 14:45:27 -08002197 obj.properties = loxi.generic_util.unpack_list(reader, common.queue_prop.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -07002198 return obj
2199
2200 def __eq__(self, other):
2201 if type(self) != type(other): return False
2202 if self.queue_id != other.queue_id: return False
2203 if self.port != other.port: return False
2204 if self.properties != other.properties: return False
2205 return True
2206
Rich Lanec2ee4b82013-04-24 17:12:38 -07002207 def pretty_print(self, q):
2208 q.text("packet_queue {")
2209 with q.group():
2210 with q.indent(2):
2211 q.breakable()
2212 q.text("queue_id = ");
2213 q.text("%#x" % self.queue_id)
2214 q.text(","); q.breakable()
2215 q.text("port = ");
2216 q.text(util.pretty_port(self.port))
2217 q.text(","); q.breakable()
2218 q.text("properties = ");
2219 q.pp(self.properties)
2220 q.breakable()
2221 q.text('}')
2222
Rich Lane7dcdf022013-12-11 14:45:27 -08002223
2224class port_desc(loxi.OFObject):
Rich Lanec2ee4b82013-04-24 17:12:38 -07002225
2226 def __init__(self, port_no=None, hw_addr=None, name=None, config=None, state=None, curr=None, advertised=None, supported=None, peer=None, curr_speed=None, max_speed=None):
2227 if port_no != None:
2228 self.port_no = port_no
2229 else:
2230 self.port_no = 0
2231 if hw_addr != None:
2232 self.hw_addr = hw_addr
2233 else:
2234 self.hw_addr = [0,0,0,0,0,0]
2235 if name != None:
2236 self.name = name
2237 else:
2238 self.name = ""
2239 if config != None:
2240 self.config = config
2241 else:
2242 self.config = 0
2243 if state != None:
2244 self.state = state
2245 else:
2246 self.state = 0
2247 if curr != None:
2248 self.curr = curr
2249 else:
2250 self.curr = 0
2251 if advertised != None:
2252 self.advertised = advertised
2253 else:
2254 self.advertised = 0
2255 if supported != None:
2256 self.supported = supported
2257 else:
2258 self.supported = 0
2259 if peer != None:
2260 self.peer = peer
2261 else:
2262 self.peer = 0
2263 if curr_speed != None:
2264 self.curr_speed = curr_speed
2265 else:
2266 self.curr_speed = 0
2267 if max_speed != None:
2268 self.max_speed = max_speed
2269 else:
2270 self.max_speed = 0
2271 return
2272
2273 def pack(self):
2274 packed = []
Dan Talaycof6202252013-07-02 01:00:29 -07002275 packed.append(util.pack_port_no(self.port_no))
Rich Lanec2ee4b82013-04-24 17:12:38 -07002276 packed.append('\x00' * 4)
2277 packed.append(struct.pack("!6B", *self.hw_addr))
2278 packed.append('\x00' * 2)
2279 packed.append(struct.pack("!16s", self.name))
2280 packed.append(struct.pack("!L", self.config))
2281 packed.append(struct.pack("!L", self.state))
2282 packed.append(struct.pack("!L", self.curr))
2283 packed.append(struct.pack("!L", self.advertised))
2284 packed.append(struct.pack("!L", self.supported))
2285 packed.append(struct.pack("!L", self.peer))
2286 packed.append(struct.pack("!L", self.curr_speed))
2287 packed.append(struct.pack("!L", self.max_speed))
2288 return ''.join(packed)
2289
2290 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002291 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07002292 obj = port_desc()
Dan Talaycof6202252013-07-02 01:00:29 -07002293 obj.port_no = util.unpack_port_no(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -07002294 reader.skip(4)
2295 obj.hw_addr = list(reader.read('!6B'))
2296 reader.skip(2)
2297 obj.name = reader.read("!16s")[0].rstrip("\x00")
Dan Talaycof6202252013-07-02 01:00:29 -07002298 obj.config = reader.read("!L")[0]
2299 obj.state = reader.read("!L")[0]
2300 obj.curr = reader.read("!L")[0]
2301 obj.advertised = reader.read("!L")[0]
2302 obj.supported = reader.read("!L")[0]
2303 obj.peer = reader.read("!L")[0]
2304 obj.curr_speed = reader.read("!L")[0]
2305 obj.max_speed = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07002306 return obj
2307
2308 def __eq__(self, other):
2309 if type(self) != type(other): return False
2310 if self.port_no != other.port_no: return False
2311 if self.hw_addr != other.hw_addr: return False
2312 if self.name != other.name: return False
2313 if self.config != other.config: return False
2314 if self.state != other.state: return False
2315 if self.curr != other.curr: return False
2316 if self.advertised != other.advertised: return False
2317 if self.supported != other.supported: return False
2318 if self.peer != other.peer: return False
2319 if self.curr_speed != other.curr_speed: return False
2320 if self.max_speed != other.max_speed: return False
2321 return True
2322
Rich Lanec2ee4b82013-04-24 17:12:38 -07002323 def pretty_print(self, q):
2324 q.text("port_desc {")
2325 with q.group():
2326 with q.indent(2):
2327 q.breakable()
2328 q.text("port_no = ");
2329 q.text(util.pretty_port(self.port_no))
2330 q.text(","); q.breakable()
2331 q.text("hw_addr = ");
2332 q.text(util.pretty_mac(self.hw_addr))
2333 q.text(","); q.breakable()
2334 q.text("name = ");
2335 q.pp(self.name)
2336 q.text(","); q.breakable()
2337 q.text("config = ");
2338 q.text("%#x" % self.config)
2339 q.text(","); q.breakable()
2340 q.text("state = ");
2341 q.text("%#x" % self.state)
2342 q.text(","); q.breakable()
2343 q.text("curr = ");
2344 q.text("%#x" % self.curr)
2345 q.text(","); q.breakable()
2346 q.text("advertised = ");
2347 q.text("%#x" % self.advertised)
2348 q.text(","); q.breakable()
2349 q.text("supported = ");
2350 q.text("%#x" % self.supported)
2351 q.text(","); q.breakable()
2352 q.text("peer = ");
2353 q.text("%#x" % self.peer)
2354 q.text(","); q.breakable()
2355 q.text("curr_speed = ");
2356 q.text("%#x" % self.curr_speed)
2357 q.text(","); q.breakable()
2358 q.text("max_speed = ");
2359 q.text("%#x" % self.max_speed)
2360 q.breakable()
2361 q.text('}')
2362
Rich Lane7dcdf022013-12-11 14:45:27 -08002363
2364class port_stats_entry(loxi.OFObject):
Rich Lanec2ee4b82013-04-24 17:12:38 -07002365
2366 def __init__(self, port_no=None, rx_packets=None, tx_packets=None, rx_bytes=None, tx_bytes=None, rx_dropped=None, tx_dropped=None, rx_errors=None, tx_errors=None, rx_frame_err=None, rx_over_err=None, rx_crc_err=None, collisions=None, duration_sec=None, duration_nsec=None):
2367 if port_no != None:
2368 self.port_no = port_no
2369 else:
2370 self.port_no = 0
2371 if rx_packets != None:
2372 self.rx_packets = rx_packets
2373 else:
2374 self.rx_packets = 0
2375 if tx_packets != None:
2376 self.tx_packets = tx_packets
2377 else:
2378 self.tx_packets = 0
2379 if rx_bytes != None:
2380 self.rx_bytes = rx_bytes
2381 else:
2382 self.rx_bytes = 0
2383 if tx_bytes != None:
2384 self.tx_bytes = tx_bytes
2385 else:
2386 self.tx_bytes = 0
2387 if rx_dropped != None:
2388 self.rx_dropped = rx_dropped
2389 else:
2390 self.rx_dropped = 0
2391 if tx_dropped != None:
2392 self.tx_dropped = tx_dropped
2393 else:
2394 self.tx_dropped = 0
2395 if rx_errors != None:
2396 self.rx_errors = rx_errors
2397 else:
2398 self.rx_errors = 0
2399 if tx_errors != None:
2400 self.tx_errors = tx_errors
2401 else:
2402 self.tx_errors = 0
2403 if rx_frame_err != None:
2404 self.rx_frame_err = rx_frame_err
2405 else:
2406 self.rx_frame_err = 0
2407 if rx_over_err != None:
2408 self.rx_over_err = rx_over_err
2409 else:
2410 self.rx_over_err = 0
2411 if rx_crc_err != None:
2412 self.rx_crc_err = rx_crc_err
2413 else:
2414 self.rx_crc_err = 0
2415 if collisions != None:
2416 self.collisions = collisions
2417 else:
2418 self.collisions = 0
2419 if duration_sec != None:
2420 self.duration_sec = duration_sec
2421 else:
2422 self.duration_sec = 0
2423 if duration_nsec != None:
2424 self.duration_nsec = duration_nsec
2425 else:
2426 self.duration_nsec = 0
2427 return
2428
2429 def pack(self):
2430 packed = []
Dan Talaycof6202252013-07-02 01:00:29 -07002431 packed.append(util.pack_port_no(self.port_no))
Rich Lanec2ee4b82013-04-24 17:12:38 -07002432 packed.append('\x00' * 4)
2433 packed.append(struct.pack("!Q", self.rx_packets))
2434 packed.append(struct.pack("!Q", self.tx_packets))
2435 packed.append(struct.pack("!Q", self.rx_bytes))
2436 packed.append(struct.pack("!Q", self.tx_bytes))
2437 packed.append(struct.pack("!Q", self.rx_dropped))
2438 packed.append(struct.pack("!Q", self.tx_dropped))
2439 packed.append(struct.pack("!Q", self.rx_errors))
2440 packed.append(struct.pack("!Q", self.tx_errors))
2441 packed.append(struct.pack("!Q", self.rx_frame_err))
2442 packed.append(struct.pack("!Q", self.rx_over_err))
2443 packed.append(struct.pack("!Q", self.rx_crc_err))
2444 packed.append(struct.pack("!Q", self.collisions))
2445 packed.append(struct.pack("!L", self.duration_sec))
2446 packed.append(struct.pack("!L", self.duration_nsec))
2447 return ''.join(packed)
2448
2449 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002450 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07002451 obj = port_stats_entry()
Dan Talaycof6202252013-07-02 01:00:29 -07002452 obj.port_no = util.unpack_port_no(reader)
Rich Lanec2ee4b82013-04-24 17:12:38 -07002453 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -07002454 obj.rx_packets = reader.read("!Q")[0]
2455 obj.tx_packets = reader.read("!Q")[0]
2456 obj.rx_bytes = reader.read("!Q")[0]
2457 obj.tx_bytes = reader.read("!Q")[0]
2458 obj.rx_dropped = reader.read("!Q")[0]
2459 obj.tx_dropped = reader.read("!Q")[0]
2460 obj.rx_errors = reader.read("!Q")[0]
2461 obj.tx_errors = reader.read("!Q")[0]
2462 obj.rx_frame_err = reader.read("!Q")[0]
2463 obj.rx_over_err = reader.read("!Q")[0]
2464 obj.rx_crc_err = reader.read("!Q")[0]
2465 obj.collisions = reader.read("!Q")[0]
2466 obj.duration_sec = reader.read("!L")[0]
2467 obj.duration_nsec = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07002468 return obj
2469
2470 def __eq__(self, other):
2471 if type(self) != type(other): return False
2472 if self.port_no != other.port_no: return False
2473 if self.rx_packets != other.rx_packets: return False
2474 if self.tx_packets != other.tx_packets: return False
2475 if self.rx_bytes != other.rx_bytes: return False
2476 if self.tx_bytes != other.tx_bytes: return False
2477 if self.rx_dropped != other.rx_dropped: return False
2478 if self.tx_dropped != other.tx_dropped: return False
2479 if self.rx_errors != other.rx_errors: return False
2480 if self.tx_errors != other.tx_errors: return False
2481 if self.rx_frame_err != other.rx_frame_err: return False
2482 if self.rx_over_err != other.rx_over_err: return False
2483 if self.rx_crc_err != other.rx_crc_err: return False
2484 if self.collisions != other.collisions: return False
2485 if self.duration_sec != other.duration_sec: return False
2486 if self.duration_nsec != other.duration_nsec: return False
2487 return True
2488
Rich Lanec2ee4b82013-04-24 17:12:38 -07002489 def pretty_print(self, q):
2490 q.text("port_stats_entry {")
2491 with q.group():
2492 with q.indent(2):
2493 q.breakable()
2494 q.text("port_no = ");
2495 q.text(util.pretty_port(self.port_no))
2496 q.text(","); q.breakable()
2497 q.text("rx_packets = ");
2498 q.text("%#x" % self.rx_packets)
2499 q.text(","); q.breakable()
2500 q.text("tx_packets = ");
2501 q.text("%#x" % self.tx_packets)
2502 q.text(","); q.breakable()
2503 q.text("rx_bytes = ");
2504 q.text("%#x" % self.rx_bytes)
2505 q.text(","); q.breakable()
2506 q.text("tx_bytes = ");
2507 q.text("%#x" % self.tx_bytes)
2508 q.text(","); q.breakable()
2509 q.text("rx_dropped = ");
2510 q.text("%#x" % self.rx_dropped)
2511 q.text(","); q.breakable()
2512 q.text("tx_dropped = ");
2513 q.text("%#x" % self.tx_dropped)
2514 q.text(","); q.breakable()
2515 q.text("rx_errors = ");
2516 q.text("%#x" % self.rx_errors)
2517 q.text(","); q.breakable()
2518 q.text("tx_errors = ");
2519 q.text("%#x" % self.tx_errors)
2520 q.text(","); q.breakable()
2521 q.text("rx_frame_err = ");
2522 q.text("%#x" % self.rx_frame_err)
2523 q.text(","); q.breakable()
2524 q.text("rx_over_err = ");
2525 q.text("%#x" % self.rx_over_err)
2526 q.text(","); q.breakable()
2527 q.text("rx_crc_err = ");
2528 q.text("%#x" % self.rx_crc_err)
2529 q.text(","); q.breakable()
2530 q.text("collisions = ");
2531 q.text("%#x" % self.collisions)
2532 q.text(","); q.breakable()
2533 q.text("duration_sec = ");
2534 q.text("%#x" % self.duration_sec)
2535 q.text(","); q.breakable()
2536 q.text("duration_nsec = ");
2537 q.text("%#x" % self.duration_nsec)
2538 q.breakable()
2539 q.text('}')
2540
Rich Lane7dcdf022013-12-11 14:45:27 -08002541
2542class queue_prop(loxi.OFObject):
2543 subtypes = {}
2544
Rich Lane95f7fc92014-01-27 17:08:16 -08002545
2546 def __init__(self, type=None):
2547 if type != None:
2548 self.type = type
2549 else:
2550 self.type = 0
2551 return
2552
2553 def pack(self):
2554 packed = []
2555 packed.append(struct.pack("!H", self.type))
2556 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
2557 packed.append('\x00' * 4)
2558 length = sum([len(x) for x in packed])
2559 packed[1] = struct.pack("!H", length)
2560 return ''.join(packed)
2561
Rich Lane7dcdf022013-12-11 14:45:27 -08002562 @staticmethod
2563 def unpack(reader):
2564 subtype, = reader.peek('!H', 0)
Rich Lane95f7fc92014-01-27 17:08:16 -08002565 subclass = queue_prop.subtypes.get(subtype)
2566 if subclass:
2567 return subclass.unpack(reader)
2568
2569 obj = queue_prop()
2570 obj.type = reader.read("!H")[0]
2571 _len = reader.read("!H")[0]
2572 orig_reader = reader
2573 reader = orig_reader.slice(_len - (2 + 2))
2574 reader.skip(4)
2575 return obj
2576
2577 def __eq__(self, other):
2578 if type(self) != type(other): return False
2579 if self.type != other.type: return False
2580 return True
2581
2582 def pretty_print(self, q):
2583 q.text("queue_prop {")
2584 with q.group():
2585 with q.indent(2):
2586 q.breakable()
2587 q.breakable()
2588 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -08002589
2590
2591class queue_prop_experimenter(queue_prop):
2592 subtypes = {}
2593
Rich Lane95f7fc92014-01-27 17:08:16 -08002594 type = 65535
2595
2596 def __init__(self, experimenter=None, data=None):
2597 if experimenter != None:
2598 self.experimenter = experimenter
2599 else:
2600 self.experimenter = 0
2601 if data != None:
2602 self.data = data
2603 else:
2604 self.data = ''
2605 return
2606
2607 def pack(self):
2608 packed = []
2609 packed.append(struct.pack("!H", self.type))
2610 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
2611 packed.append('\x00' * 4)
2612 packed.append(struct.pack("!L", self.experimenter))
2613 packed.append('\x00' * 4)
2614 packed.append(self.data)
2615 length = sum([len(x) for x in packed])
2616 packed[1] = struct.pack("!H", length)
2617 return ''.join(packed)
2618
Rich Lane7dcdf022013-12-11 14:45:27 -08002619 @staticmethod
2620 def unpack(reader):
2621 subtype, = reader.peek('!L', 8)
Rich Lane95f7fc92014-01-27 17:08:16 -08002622 subclass = queue_prop_experimenter.subtypes.get(subtype)
2623 if subclass:
2624 return subclass.unpack(reader)
2625
2626 obj = queue_prop_experimenter()
2627 _type = reader.read("!H")[0]
2628 assert(_type == 65535)
2629 _len = reader.read("!H")[0]
2630 orig_reader = reader
2631 reader = orig_reader.slice(_len - (2 + 2))
2632 reader.skip(4)
2633 obj.experimenter = reader.read("!L")[0]
2634 reader.skip(4)
2635 obj.data = str(reader.read_all())
2636 return obj
2637
2638 def __eq__(self, other):
2639 if type(self) != type(other): return False
2640 if self.experimenter != other.experimenter: return False
2641 if self.data != other.data: return False
2642 return True
2643
2644 def pretty_print(self, q):
2645 q.text("queue_prop_experimenter {")
2646 with q.group():
2647 with q.indent(2):
2648 q.breakable()
2649 q.text("data = ");
2650 q.pp(self.data)
2651 q.breakable()
2652 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -08002653
2654queue_prop.subtypes[65535] = queue_prop_experimenter
2655
2656class queue_prop_max_rate(queue_prop):
Dan Talaycof6202252013-07-02 01:00:29 -07002657 type = 2
Rich Lanec2ee4b82013-04-24 17:12:38 -07002658
2659 def __init__(self, rate=None):
2660 if rate != None:
2661 self.rate = rate
2662 else:
2663 self.rate = 0
2664 return
2665
2666 def pack(self):
2667 packed = []
2668 packed.append(struct.pack("!H", self.type))
2669 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
2670 packed.append('\x00' * 4)
2671 packed.append(struct.pack("!H", self.rate))
2672 packed.append('\x00' * 6)
2673 length = sum([len(x) for x in packed])
2674 packed[1] = struct.pack("!H", length)
2675 return ''.join(packed)
2676
2677 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002678 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07002679 obj = queue_prop_max_rate()
Dan Talaycof6202252013-07-02 01:00:29 -07002680 _type = reader.read("!H")[0]
2681 assert(_type == 2)
2682 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002683 orig_reader = reader
2684 reader = orig_reader.slice(_len - (2 + 2))
Rich Lanec2ee4b82013-04-24 17:12:38 -07002685 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -07002686 obj.rate = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07002687 reader.skip(6)
2688 return obj
2689
2690 def __eq__(self, other):
2691 if type(self) != type(other): return False
2692 if self.rate != other.rate: return False
2693 return True
2694
Rich Lanec2ee4b82013-04-24 17:12:38 -07002695 def pretty_print(self, q):
2696 q.text("queue_prop_max_rate {")
2697 with q.group():
2698 with q.indent(2):
2699 q.breakable()
2700 q.text("rate = ");
2701 q.text("%#x" % self.rate)
2702 q.breakable()
2703 q.text('}')
2704
Rich Lane7dcdf022013-12-11 14:45:27 -08002705queue_prop.subtypes[2] = queue_prop_max_rate
2706
2707class queue_prop_min_rate(queue_prop):
Dan Talaycof6202252013-07-02 01:00:29 -07002708 type = 1
Rich Lanec2ee4b82013-04-24 17:12:38 -07002709
2710 def __init__(self, rate=None):
2711 if rate != None:
2712 self.rate = rate
2713 else:
2714 self.rate = 0
2715 return
2716
2717 def pack(self):
2718 packed = []
2719 packed.append(struct.pack("!H", self.type))
2720 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
2721 packed.append('\x00' * 4)
2722 packed.append(struct.pack("!H", self.rate))
2723 packed.append('\x00' * 6)
2724 length = sum([len(x) for x in packed])
2725 packed[1] = struct.pack("!H", length)
2726 return ''.join(packed)
2727
2728 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002729 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07002730 obj = queue_prop_min_rate()
Dan Talaycof6202252013-07-02 01:00:29 -07002731 _type = reader.read("!H")[0]
2732 assert(_type == 1)
2733 _len = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002734 orig_reader = reader
2735 reader = orig_reader.slice(_len - (2 + 2))
Rich Lanec2ee4b82013-04-24 17:12:38 -07002736 reader.skip(4)
Dan Talaycof6202252013-07-02 01:00:29 -07002737 obj.rate = reader.read("!H")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07002738 reader.skip(6)
2739 return obj
2740
2741 def __eq__(self, other):
2742 if type(self) != type(other): return False
2743 if self.rate != other.rate: return False
2744 return True
2745
Rich Lanec2ee4b82013-04-24 17:12:38 -07002746 def pretty_print(self, q):
2747 q.text("queue_prop_min_rate {")
2748 with q.group():
2749 with q.indent(2):
2750 q.breakable()
2751 q.text("rate = ");
2752 q.text("%#x" % self.rate)
2753 q.breakable()
2754 q.text('}')
2755
Rich Lane7dcdf022013-12-11 14:45:27 -08002756queue_prop.subtypes[1] = queue_prop_min_rate
2757
2758class queue_stats_entry(loxi.OFObject):
Rich Lanec2ee4b82013-04-24 17:12:38 -07002759
2760 def __init__(self, port_no=None, queue_id=None, tx_bytes=None, tx_packets=None, tx_errors=None, duration_sec=None, duration_nsec=None):
2761 if port_no != None:
2762 self.port_no = port_no
2763 else:
2764 self.port_no = 0
2765 if queue_id != None:
2766 self.queue_id = queue_id
2767 else:
2768 self.queue_id = 0
2769 if tx_bytes != None:
2770 self.tx_bytes = tx_bytes
2771 else:
2772 self.tx_bytes = 0
2773 if tx_packets != None:
2774 self.tx_packets = tx_packets
2775 else:
2776 self.tx_packets = 0
2777 if tx_errors != None:
2778 self.tx_errors = tx_errors
2779 else:
2780 self.tx_errors = 0
2781 if duration_sec != None:
2782 self.duration_sec = duration_sec
2783 else:
2784 self.duration_sec = 0
2785 if duration_nsec != None:
2786 self.duration_nsec = duration_nsec
2787 else:
2788 self.duration_nsec = 0
2789 return
2790
2791 def pack(self):
2792 packed = []
Dan Talaycof6202252013-07-02 01:00:29 -07002793 packed.append(util.pack_port_no(self.port_no))
Rich Lanec2ee4b82013-04-24 17:12:38 -07002794 packed.append(struct.pack("!L", self.queue_id))
2795 packed.append(struct.pack("!Q", self.tx_bytes))
2796 packed.append(struct.pack("!Q", self.tx_packets))
2797 packed.append(struct.pack("!Q", self.tx_errors))
2798 packed.append(struct.pack("!L", self.duration_sec))
2799 packed.append(struct.pack("!L", self.duration_nsec))
2800 return ''.join(packed)
2801
2802 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002803 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07002804 obj = queue_stats_entry()
Dan Talaycof6202252013-07-02 01:00:29 -07002805 obj.port_no = util.unpack_port_no(reader)
2806 obj.queue_id = reader.read("!L")[0]
2807 obj.tx_bytes = reader.read("!Q")[0]
2808 obj.tx_packets = reader.read("!Q")[0]
2809 obj.tx_errors = reader.read("!Q")[0]
2810 obj.duration_sec = reader.read("!L")[0]
2811 obj.duration_nsec = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07002812 return obj
2813
2814 def __eq__(self, other):
2815 if type(self) != type(other): return False
2816 if self.port_no != other.port_no: return False
2817 if self.queue_id != other.queue_id: return False
2818 if self.tx_bytes != other.tx_bytes: return False
2819 if self.tx_packets != other.tx_packets: return False
2820 if self.tx_errors != other.tx_errors: return False
2821 if self.duration_sec != other.duration_sec: return False
2822 if self.duration_nsec != other.duration_nsec: return False
2823 return True
2824
Rich Lanec2ee4b82013-04-24 17:12:38 -07002825 def pretty_print(self, q):
2826 q.text("queue_stats_entry {")
2827 with q.group():
2828 with q.indent(2):
2829 q.breakable()
2830 q.text("port_no = ");
2831 q.text(util.pretty_port(self.port_no))
2832 q.text(","); q.breakable()
2833 q.text("queue_id = ");
2834 q.text("%#x" % self.queue_id)
2835 q.text(","); q.breakable()
2836 q.text("tx_bytes = ");
2837 q.text("%#x" % self.tx_bytes)
2838 q.text(","); q.breakable()
2839 q.text("tx_packets = ");
2840 q.text("%#x" % self.tx_packets)
2841 q.text(","); q.breakable()
2842 q.text("tx_errors = ");
2843 q.text("%#x" % self.tx_errors)
2844 q.text(","); q.breakable()
2845 q.text("duration_sec = ");
2846 q.text("%#x" % self.duration_sec)
2847 q.text(","); q.breakable()
2848 q.text("duration_nsec = ");
2849 q.text("%#x" % self.duration_nsec)
2850 q.breakable()
2851 q.text('}')
2852
Rich Lane7dcdf022013-12-11 14:45:27 -08002853
2854class table_feature_prop(loxi.OFObject):
2855 subtypes = {}
2856
Rich Lane95f7fc92014-01-27 17:08:16 -08002857
2858 def __init__(self, type=None):
2859 if type != None:
2860 self.type = type
2861 else:
2862 self.type = 0
2863 return
2864
2865 def pack(self):
2866 packed = []
2867 packed.append(struct.pack("!H", self.type))
2868 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2869 length = sum([len(x) for x in packed])
2870 packed[1] = struct.pack("!H", length)
2871 return ''.join(packed)
2872
Rich Lane7dcdf022013-12-11 14:45:27 -08002873 @staticmethod
2874 def unpack(reader):
2875 subtype, = reader.peek('!H', 0)
Rich Lane95f7fc92014-01-27 17:08:16 -08002876 subclass = table_feature_prop.subtypes.get(subtype)
2877 if subclass:
2878 return subclass.unpack(reader)
2879
2880 obj = table_feature_prop()
2881 obj.type = reader.read("!H")[0]
2882 _length = reader.read("!H")[0]
2883 orig_reader = reader
2884 reader = orig_reader.slice(_length - (2 + 2))
2885 return obj
2886
2887 def __eq__(self, other):
2888 if type(self) != type(other): return False
2889 if self.type != other.type: return False
2890 return True
2891
2892 def pretty_print(self, q):
2893 q.text("table_feature_prop {")
2894 with q.group():
2895 with q.indent(2):
2896 q.breakable()
2897 q.breakable()
2898 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -08002899
2900
2901class table_feature_prop_apply_actions(table_feature_prop):
Dan Talaycof6202252013-07-02 01:00:29 -07002902 type = 6
Rich Lanec2ee4b82013-04-24 17:12:38 -07002903
Dan Talaycof6202252013-07-02 01:00:29 -07002904 def __init__(self, action_ids=None):
Rich Lanec2ee4b82013-04-24 17:12:38 -07002905 if action_ids != None:
2906 self.action_ids = action_ids
2907 else:
2908 self.action_ids = []
2909 return
2910
2911 def pack(self):
2912 packed = []
2913 packed.append(struct.pack("!H", self.type))
2914 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
Rich Lane7dcdf022013-12-11 14:45:27 -08002915 packed.append(loxi.generic_util.pack_list(self.action_ids))
Rich Lanec2ee4b82013-04-24 17:12:38 -07002916 length = sum([len(x) for x in packed])
2917 packed[1] = struct.pack("!H", length)
2918 return ''.join(packed)
2919
2920 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002921 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07002922 obj = table_feature_prop_apply_actions()
Dan Talaycof6202252013-07-02 01:00:29 -07002923 _type = reader.read("!H")[0]
2924 assert(_type == 6)
2925 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002926 orig_reader = reader
2927 reader = orig_reader.slice(_length - (2 + 2))
2928 obj.action_ids = loxi.generic_util.unpack_list(reader, action_id.action_id.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -07002929 return obj
2930
2931 def __eq__(self, other):
2932 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07002933 if self.action_ids != other.action_ids: return False
2934 return True
2935
Rich Lanec2ee4b82013-04-24 17:12:38 -07002936 def pretty_print(self, q):
2937 q.text("table_feature_prop_apply_actions {")
2938 with q.group():
2939 with q.indent(2):
2940 q.breakable()
Rich Lanec2ee4b82013-04-24 17:12:38 -07002941 q.text("action_ids = ");
2942 q.pp(self.action_ids)
2943 q.breakable()
2944 q.text('}')
2945
Rich Lane7dcdf022013-12-11 14:45:27 -08002946table_feature_prop.subtypes[6] = table_feature_prop_apply_actions
2947
2948class table_feature_prop_apply_actions_miss(table_feature_prop):
Dan Talaycof6202252013-07-02 01:00:29 -07002949 type = 7
Rich Lanec2ee4b82013-04-24 17:12:38 -07002950
Dan Talaycof6202252013-07-02 01:00:29 -07002951 def __init__(self, action_ids=None):
Rich Lanec2ee4b82013-04-24 17:12:38 -07002952 if action_ids != None:
2953 self.action_ids = action_ids
2954 else:
2955 self.action_ids = []
2956 return
2957
2958 def pack(self):
2959 packed = []
2960 packed.append(struct.pack("!H", self.type))
2961 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
Rich Lane7dcdf022013-12-11 14:45:27 -08002962 packed.append(loxi.generic_util.pack_list(self.action_ids))
Rich Lanec2ee4b82013-04-24 17:12:38 -07002963 length = sum([len(x) for x in packed])
2964 packed[1] = struct.pack("!H", length)
2965 return ''.join(packed)
2966
2967 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08002968 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07002969 obj = table_feature_prop_apply_actions_miss()
Dan Talaycof6202252013-07-02 01:00:29 -07002970 _type = reader.read("!H")[0]
2971 assert(_type == 7)
2972 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08002973 orig_reader = reader
2974 reader = orig_reader.slice(_length - (2 + 2))
2975 obj.action_ids = loxi.generic_util.unpack_list(reader, action_id.action_id.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -07002976 return obj
2977
2978 def __eq__(self, other):
2979 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07002980 if self.action_ids != other.action_ids: return False
2981 return True
2982
Rich Lanec2ee4b82013-04-24 17:12:38 -07002983 def pretty_print(self, q):
2984 q.text("table_feature_prop_apply_actions_miss {")
2985 with q.group():
2986 with q.indent(2):
2987 q.breakable()
Rich Lanec2ee4b82013-04-24 17:12:38 -07002988 q.text("action_ids = ");
2989 q.pp(self.action_ids)
2990 q.breakable()
2991 q.text('}')
2992
Rich Lane7dcdf022013-12-11 14:45:27 -08002993table_feature_prop.subtypes[7] = table_feature_prop_apply_actions_miss
2994
2995class table_feature_prop_apply_setfield(table_feature_prop):
Dan Talaycof6202252013-07-02 01:00:29 -07002996 type = 14
Rich Lanec2ee4b82013-04-24 17:12:38 -07002997
Dan Talaycof6202252013-07-02 01:00:29 -07002998 def __init__(self, oxm_ids=None):
Rich Lanec2ee4b82013-04-24 17:12:38 -07002999 if oxm_ids != None:
3000 self.oxm_ids = oxm_ids
3001 else:
3002 self.oxm_ids = []
3003 return
3004
3005 def pack(self):
3006 packed = []
3007 packed.append(struct.pack("!H", self.type))
3008 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
Rich Lane7dcdf022013-12-11 14:45:27 -08003009 packed.append(loxi.generic_util.pack_list(self.oxm_ids))
Rich Lanec2ee4b82013-04-24 17:12:38 -07003010 length = sum([len(x) for x in packed])
3011 packed[1] = struct.pack("!H", length)
3012 return ''.join(packed)
3013
3014 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003015 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07003016 obj = table_feature_prop_apply_setfield()
Dan Talaycof6202252013-07-02 01:00:29 -07003017 _type = reader.read("!H")[0]
3018 assert(_type == 14)
3019 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003020 orig_reader = reader
3021 reader = orig_reader.slice(_length - (2 + 2))
Rich Lanec2ee4b82013-04-24 17:12:38 -07003022 obj.oxm_ids = loxi.generic_util.unpack_list(reader, common.uint32.unpack)
3023 return obj
3024
3025 def __eq__(self, other):
3026 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07003027 if self.oxm_ids != other.oxm_ids: return False
3028 return True
3029
Rich Lanec2ee4b82013-04-24 17:12:38 -07003030 def pretty_print(self, q):
3031 q.text("table_feature_prop_apply_setfield {")
3032 with q.group():
3033 with q.indent(2):
3034 q.breakable()
Rich Lanec2ee4b82013-04-24 17:12:38 -07003035 q.text("oxm_ids = ");
3036 q.pp(self.oxm_ids)
3037 q.breakable()
3038 q.text('}')
3039
Rich Lane7dcdf022013-12-11 14:45:27 -08003040table_feature_prop.subtypes[14] = table_feature_prop_apply_setfield
3041
3042class table_feature_prop_apply_setfield_miss(table_feature_prop):
Dan Talaycof6202252013-07-02 01:00:29 -07003043 type = 15
Rich Lanec2ee4b82013-04-24 17:12:38 -07003044
Dan Talaycof6202252013-07-02 01:00:29 -07003045 def __init__(self, oxm_ids=None):
Rich Lanec2ee4b82013-04-24 17:12:38 -07003046 if oxm_ids != None:
3047 self.oxm_ids = oxm_ids
3048 else:
3049 self.oxm_ids = []
3050 return
3051
3052 def pack(self):
3053 packed = []
3054 packed.append(struct.pack("!H", self.type))
3055 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
Rich Lane7dcdf022013-12-11 14:45:27 -08003056 packed.append(loxi.generic_util.pack_list(self.oxm_ids))
Rich Lanec2ee4b82013-04-24 17:12:38 -07003057 length = sum([len(x) for x in packed])
3058 packed[1] = struct.pack("!H", length)
3059 return ''.join(packed)
3060
3061 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003062 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07003063 obj = table_feature_prop_apply_setfield_miss()
Dan Talaycof6202252013-07-02 01:00:29 -07003064 _type = reader.read("!H")[0]
3065 assert(_type == 15)
3066 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003067 orig_reader = reader
3068 reader = orig_reader.slice(_length - (2 + 2))
Rich Lanec2ee4b82013-04-24 17:12:38 -07003069 obj.oxm_ids = loxi.generic_util.unpack_list(reader, common.uint32.unpack)
3070 return obj
3071
3072 def __eq__(self, other):
3073 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07003074 if self.oxm_ids != other.oxm_ids: return False
3075 return True
3076
Rich Lanec2ee4b82013-04-24 17:12:38 -07003077 def pretty_print(self, q):
3078 q.text("table_feature_prop_apply_setfield_miss {")
3079 with q.group():
3080 with q.indent(2):
3081 q.breakable()
Rich Lanec2ee4b82013-04-24 17:12:38 -07003082 q.text("oxm_ids = ");
3083 q.pp(self.oxm_ids)
3084 q.breakable()
3085 q.text('}')
3086
Rich Lane7dcdf022013-12-11 14:45:27 -08003087table_feature_prop.subtypes[15] = table_feature_prop_apply_setfield_miss
3088
3089class table_feature_prop_experimenter(table_feature_prop):
Rich Lane9ec3fca2014-02-26 16:22:56 -08003090 type = 65534
Rich Lanec2ee4b82013-04-24 17:12:38 -07003091
Dan Talaycof6202252013-07-02 01:00:29 -07003092 def __init__(self, experimenter=None, subtype=None, experimenter_data=None):
Rich Lanec2ee4b82013-04-24 17:12:38 -07003093 if experimenter != None:
3094 self.experimenter = experimenter
3095 else:
3096 self.experimenter = 0
3097 if subtype != None:
3098 self.subtype = subtype
3099 else:
3100 self.subtype = 0
3101 if experimenter_data != None:
3102 self.experimenter_data = experimenter_data
3103 else:
Dan Talaycof6202252013-07-02 01:00:29 -07003104 self.experimenter_data = ''
Rich Lanec2ee4b82013-04-24 17:12:38 -07003105 return
3106
3107 def pack(self):
3108 packed = []
3109 packed.append(struct.pack("!H", self.type))
3110 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3111 packed.append(struct.pack("!L", self.experimenter))
3112 packed.append(struct.pack("!L", self.subtype))
3113 packed.append(self.experimenter_data)
3114 length = sum([len(x) for x in packed])
3115 packed[1] = struct.pack("!H", length)
3116 return ''.join(packed)
3117
3118 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003119 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07003120 obj = table_feature_prop_experimenter()
Dan Talaycof6202252013-07-02 01:00:29 -07003121 _type = reader.read("!H")[0]
Rich Lane9ec3fca2014-02-26 16:22:56 -08003122 assert(_type == 65534)
Dan Talaycof6202252013-07-02 01:00:29 -07003123 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003124 orig_reader = reader
3125 reader = orig_reader.slice(_length - (2 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07003126 obj.experimenter = reader.read("!L")[0]
3127 obj.subtype = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07003128 obj.experimenter_data = str(reader.read_all())
3129 return obj
3130
3131 def __eq__(self, other):
3132 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07003133 if self.experimenter != other.experimenter: return False
3134 if self.subtype != other.subtype: return False
3135 if self.experimenter_data != other.experimenter_data: return False
3136 return True
3137
Rich Lanec2ee4b82013-04-24 17:12:38 -07003138 def pretty_print(self, q):
3139 q.text("table_feature_prop_experimenter {")
3140 with q.group():
3141 with q.indent(2):
3142 q.breakable()
Rich Lanec2ee4b82013-04-24 17:12:38 -07003143 q.text("experimenter = ");
3144 q.text("%#x" % self.experimenter)
3145 q.text(","); q.breakable()
3146 q.text("subtype = ");
3147 q.text("%#x" % self.subtype)
3148 q.text(","); q.breakable()
3149 q.text("experimenter_data = ");
3150 q.pp(self.experimenter_data)
3151 q.breakable()
3152 q.text('}')
3153
Rich Lane9ec3fca2014-02-26 16:22:56 -08003154table_feature_prop.subtypes[65534] = table_feature_prop_experimenter
3155
3156class table_feature_prop_experimenter_miss(table_feature_prop):
3157 type = 65535
3158
3159 def __init__(self, experimenter=None, subtype=None, experimenter_data=None):
3160 if experimenter != None:
3161 self.experimenter = experimenter
3162 else:
3163 self.experimenter = 0
3164 if subtype != None:
3165 self.subtype = subtype
3166 else:
3167 self.subtype = 0
3168 if experimenter_data != None:
3169 self.experimenter_data = experimenter_data
3170 else:
3171 self.experimenter_data = ''
3172 return
3173
3174 def pack(self):
3175 packed = []
3176 packed.append(struct.pack("!H", self.type))
3177 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3178 packed.append(struct.pack("!L", self.experimenter))
3179 packed.append(struct.pack("!L", self.subtype))
3180 packed.append(self.experimenter_data)
3181 length = sum([len(x) for x in packed])
3182 packed[1] = struct.pack("!H", length)
3183 return ''.join(packed)
3184
3185 @staticmethod
3186 def unpack(reader):
3187 obj = table_feature_prop_experimenter_miss()
3188 _type = reader.read("!H")[0]
3189 assert(_type == 65535)
3190 _length = reader.read("!H")[0]
3191 orig_reader = reader
3192 reader = orig_reader.slice(_length - (2 + 2))
3193 obj.experimenter = reader.read("!L")[0]
3194 obj.subtype = reader.read("!L")[0]
3195 obj.experimenter_data = str(reader.read_all())
3196 return obj
3197
3198 def __eq__(self, other):
3199 if type(self) != type(other): return False
3200 if self.experimenter != other.experimenter: return False
3201 if self.subtype != other.subtype: return False
3202 if self.experimenter_data != other.experimenter_data: return False
3203 return True
3204
3205 def pretty_print(self, q):
3206 q.text("table_feature_prop_experimenter_miss {")
3207 with q.group():
3208 with q.indent(2):
3209 q.breakable()
3210 q.text("experimenter = ");
3211 q.text("%#x" % self.experimenter)
3212 q.text(","); q.breakable()
3213 q.text("subtype = ");
3214 q.text("%#x" % self.subtype)
3215 q.text(","); q.breakable()
3216 q.text("experimenter_data = ");
3217 q.pp(self.experimenter_data)
3218 q.breakable()
3219 q.text('}')
3220
3221table_feature_prop.subtypes[65535] = table_feature_prop_experimenter_miss
Rich Lane7dcdf022013-12-11 14:45:27 -08003222
3223class table_feature_prop_instructions(table_feature_prop):
Dan Talaycof6202252013-07-02 01:00:29 -07003224 type = 0
Rich Lanec2ee4b82013-04-24 17:12:38 -07003225
Dan Talaycof6202252013-07-02 01:00:29 -07003226 def __init__(self, instruction_ids=None):
Rich Lanec2ee4b82013-04-24 17:12:38 -07003227 if instruction_ids != None:
3228 self.instruction_ids = instruction_ids
3229 else:
3230 self.instruction_ids = []
3231 return
3232
3233 def pack(self):
3234 packed = []
3235 packed.append(struct.pack("!H", self.type))
3236 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
Rich Lane7dcdf022013-12-11 14:45:27 -08003237 packed.append(loxi.generic_util.pack_list(self.instruction_ids))
Rich Lanec2ee4b82013-04-24 17:12:38 -07003238 length = sum([len(x) for x in packed])
3239 packed[1] = struct.pack("!H", length)
3240 return ''.join(packed)
3241
3242 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003243 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07003244 obj = table_feature_prop_instructions()
Dan Talaycof6202252013-07-02 01:00:29 -07003245 _type = reader.read("!H")[0]
3246 assert(_type == 0)
3247 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003248 orig_reader = reader
3249 reader = orig_reader.slice(_length - (2 + 2))
Rich Lanec0d05d12014-03-11 18:02:24 -07003250 obj.instruction_ids = loxi.generic_util.unpack_list(reader, instruction_id.instruction_id.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -07003251 return obj
3252
3253 def __eq__(self, other):
3254 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07003255 if self.instruction_ids != other.instruction_ids: return False
3256 return True
3257
Rich Lanec2ee4b82013-04-24 17:12:38 -07003258 def pretty_print(self, q):
3259 q.text("table_feature_prop_instructions {")
3260 with q.group():
3261 with q.indent(2):
3262 q.breakable()
Rich Lanec2ee4b82013-04-24 17:12:38 -07003263 q.text("instruction_ids = ");
3264 q.pp(self.instruction_ids)
3265 q.breakable()
3266 q.text('}')
3267
Rich Lane7dcdf022013-12-11 14:45:27 -08003268table_feature_prop.subtypes[0] = table_feature_prop_instructions
3269
3270class table_feature_prop_instructions_miss(table_feature_prop):
Dan Talaycof6202252013-07-02 01:00:29 -07003271 type = 1
Rich Lanec2ee4b82013-04-24 17:12:38 -07003272
Dan Talaycof6202252013-07-02 01:00:29 -07003273 def __init__(self, instruction_ids=None):
Rich Lanec2ee4b82013-04-24 17:12:38 -07003274 if instruction_ids != None:
3275 self.instruction_ids = instruction_ids
3276 else:
3277 self.instruction_ids = []
3278 return
3279
3280 def pack(self):
3281 packed = []
3282 packed.append(struct.pack("!H", self.type))
3283 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
Rich Lane7dcdf022013-12-11 14:45:27 -08003284 packed.append(loxi.generic_util.pack_list(self.instruction_ids))
Rich Lanec2ee4b82013-04-24 17:12:38 -07003285 length = sum([len(x) for x in packed])
3286 packed[1] = struct.pack("!H", length)
3287 return ''.join(packed)
3288
3289 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003290 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07003291 obj = table_feature_prop_instructions_miss()
Dan Talaycof6202252013-07-02 01:00:29 -07003292 _type = reader.read("!H")[0]
3293 assert(_type == 1)
3294 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003295 orig_reader = reader
3296 reader = orig_reader.slice(_length - (2 + 2))
Rich Lanec0d05d12014-03-11 18:02:24 -07003297 obj.instruction_ids = loxi.generic_util.unpack_list(reader, instruction_id.instruction_id.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -07003298 return obj
3299
3300 def __eq__(self, other):
3301 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07003302 if self.instruction_ids != other.instruction_ids: return False
3303 return True
3304
Rich Lanec2ee4b82013-04-24 17:12:38 -07003305 def pretty_print(self, q):
3306 q.text("table_feature_prop_instructions_miss {")
3307 with q.group():
3308 with q.indent(2):
3309 q.breakable()
Rich Lanec2ee4b82013-04-24 17:12:38 -07003310 q.text("instruction_ids = ");
3311 q.pp(self.instruction_ids)
3312 q.breakable()
3313 q.text('}')
3314
Rich Lane7dcdf022013-12-11 14:45:27 -08003315table_feature_prop.subtypes[1] = table_feature_prop_instructions_miss
3316
3317class table_feature_prop_match(table_feature_prop):
Dan Talaycof6202252013-07-02 01:00:29 -07003318 type = 8
Rich Lanec2ee4b82013-04-24 17:12:38 -07003319
Dan Talaycof6202252013-07-02 01:00:29 -07003320 def __init__(self, oxm_ids=None):
Rich Lanec2ee4b82013-04-24 17:12:38 -07003321 if oxm_ids != None:
3322 self.oxm_ids = oxm_ids
3323 else:
3324 self.oxm_ids = []
3325 return
3326
3327 def pack(self):
3328 packed = []
3329 packed.append(struct.pack("!H", self.type))
3330 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
Rich Lane7dcdf022013-12-11 14:45:27 -08003331 packed.append(loxi.generic_util.pack_list(self.oxm_ids))
Rich Lanec2ee4b82013-04-24 17:12:38 -07003332 length = sum([len(x) for x in packed])
3333 packed[1] = struct.pack("!H", length)
3334 return ''.join(packed)
3335
3336 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003337 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07003338 obj = table_feature_prop_match()
Dan Talaycof6202252013-07-02 01:00:29 -07003339 _type = reader.read("!H")[0]
3340 assert(_type == 8)
3341 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003342 orig_reader = reader
3343 reader = orig_reader.slice(_length - (2 + 2))
Rich Lanec2ee4b82013-04-24 17:12:38 -07003344 obj.oxm_ids = loxi.generic_util.unpack_list(reader, common.uint32.unpack)
3345 return obj
3346
3347 def __eq__(self, other):
3348 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07003349 if self.oxm_ids != other.oxm_ids: return False
3350 return True
3351
Rich Lanec2ee4b82013-04-24 17:12:38 -07003352 def pretty_print(self, q):
3353 q.text("table_feature_prop_match {")
3354 with q.group():
3355 with q.indent(2):
3356 q.breakable()
Rich Lanec2ee4b82013-04-24 17:12:38 -07003357 q.text("oxm_ids = ");
3358 q.pp(self.oxm_ids)
3359 q.breakable()
3360 q.text('}')
3361
Rich Lane7dcdf022013-12-11 14:45:27 -08003362table_feature_prop.subtypes[8] = table_feature_prop_match
3363
3364class table_feature_prop_next_tables(table_feature_prop):
Dan Talaycof6202252013-07-02 01:00:29 -07003365 type = 2
Rich Lanec2ee4b82013-04-24 17:12:38 -07003366
Dan Talaycof6202252013-07-02 01:00:29 -07003367 def __init__(self, next_table_ids=None):
Rich Lanec2ee4b82013-04-24 17:12:38 -07003368 if next_table_ids != None:
3369 self.next_table_ids = next_table_ids
3370 else:
3371 self.next_table_ids = []
3372 return
3373
3374 def pack(self):
3375 packed = []
3376 packed.append(struct.pack("!H", self.type))
3377 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
Rich Lane7dcdf022013-12-11 14:45:27 -08003378 packed.append(loxi.generic_util.pack_list(self.next_table_ids))
Rich Lanec2ee4b82013-04-24 17:12:38 -07003379 length = sum([len(x) for x in packed])
3380 packed[1] = struct.pack("!H", length)
3381 return ''.join(packed)
3382
3383 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003384 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07003385 obj = table_feature_prop_next_tables()
Dan Talaycof6202252013-07-02 01:00:29 -07003386 _type = reader.read("!H")[0]
3387 assert(_type == 2)
3388 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003389 orig_reader = reader
3390 reader = orig_reader.slice(_length - (2 + 2))
Rich Lanec2ee4b82013-04-24 17:12:38 -07003391 obj.next_table_ids = loxi.generic_util.unpack_list(reader, common.uint8.unpack)
3392 return obj
3393
3394 def __eq__(self, other):
3395 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07003396 if self.next_table_ids != other.next_table_ids: return False
3397 return True
3398
Rich Lanec2ee4b82013-04-24 17:12:38 -07003399 def pretty_print(self, q):
3400 q.text("table_feature_prop_next_tables {")
3401 with q.group():
3402 with q.indent(2):
3403 q.breakable()
Rich Lanec2ee4b82013-04-24 17:12:38 -07003404 q.text("next_table_ids = ");
3405 q.pp(self.next_table_ids)
3406 q.breakable()
3407 q.text('}')
3408
Rich Lane7dcdf022013-12-11 14:45:27 -08003409table_feature_prop.subtypes[2] = table_feature_prop_next_tables
3410
3411class table_feature_prop_next_tables_miss(table_feature_prop):
Dan Talaycof6202252013-07-02 01:00:29 -07003412 type = 3
Rich Lanec2ee4b82013-04-24 17:12:38 -07003413
Dan Talaycof6202252013-07-02 01:00:29 -07003414 def __init__(self, next_table_ids=None):
Rich Lanec2ee4b82013-04-24 17:12:38 -07003415 if next_table_ids != None:
3416 self.next_table_ids = next_table_ids
3417 else:
3418 self.next_table_ids = []
3419 return
3420
3421 def pack(self):
3422 packed = []
3423 packed.append(struct.pack("!H", self.type))
3424 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
Rich Lane7dcdf022013-12-11 14:45:27 -08003425 packed.append(loxi.generic_util.pack_list(self.next_table_ids))
Rich Lanec2ee4b82013-04-24 17:12:38 -07003426 length = sum([len(x) for x in packed])
3427 packed[1] = struct.pack("!H", length)
3428 return ''.join(packed)
3429
3430 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003431 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07003432 obj = table_feature_prop_next_tables_miss()
Dan Talaycof6202252013-07-02 01:00:29 -07003433 _type = reader.read("!H")[0]
3434 assert(_type == 3)
3435 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003436 orig_reader = reader
3437 reader = orig_reader.slice(_length - (2 + 2))
Rich Lanec2ee4b82013-04-24 17:12:38 -07003438 obj.next_table_ids = loxi.generic_util.unpack_list(reader, common.uint8.unpack)
3439 return obj
3440
3441 def __eq__(self, other):
3442 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07003443 if self.next_table_ids != other.next_table_ids: return False
3444 return True
3445
Rich Lanec2ee4b82013-04-24 17:12:38 -07003446 def pretty_print(self, q):
3447 q.text("table_feature_prop_next_tables_miss {")
3448 with q.group():
3449 with q.indent(2):
3450 q.breakable()
Rich Lanec2ee4b82013-04-24 17:12:38 -07003451 q.text("next_table_ids = ");
3452 q.pp(self.next_table_ids)
3453 q.breakable()
3454 q.text('}')
3455
Rich Lane7dcdf022013-12-11 14:45:27 -08003456table_feature_prop.subtypes[3] = table_feature_prop_next_tables_miss
3457
3458class table_feature_prop_wildcards(table_feature_prop):
Dan Talaycof6202252013-07-02 01:00:29 -07003459 type = 10
Rich Lanec2ee4b82013-04-24 17:12:38 -07003460
Dan Talaycof6202252013-07-02 01:00:29 -07003461 def __init__(self, oxm_ids=None):
Rich Lanec2ee4b82013-04-24 17:12:38 -07003462 if oxm_ids != None:
3463 self.oxm_ids = oxm_ids
3464 else:
3465 self.oxm_ids = []
3466 return
3467
3468 def pack(self):
3469 packed = []
3470 packed.append(struct.pack("!H", self.type))
3471 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
Rich Lane7dcdf022013-12-11 14:45:27 -08003472 packed.append(loxi.generic_util.pack_list(self.oxm_ids))
Rich Lanec2ee4b82013-04-24 17:12:38 -07003473 length = sum([len(x) for x in packed])
3474 packed[1] = struct.pack("!H", length)
3475 return ''.join(packed)
3476
3477 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003478 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07003479 obj = table_feature_prop_wildcards()
Dan Talaycof6202252013-07-02 01:00:29 -07003480 _type = reader.read("!H")[0]
3481 assert(_type == 10)
3482 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003483 orig_reader = reader
3484 reader = orig_reader.slice(_length - (2 + 2))
Rich Lanec2ee4b82013-04-24 17:12:38 -07003485 obj.oxm_ids = loxi.generic_util.unpack_list(reader, common.uint32.unpack)
3486 return obj
3487
3488 def __eq__(self, other):
3489 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07003490 if self.oxm_ids != other.oxm_ids: return False
3491 return True
3492
Rich Lanec2ee4b82013-04-24 17:12:38 -07003493 def pretty_print(self, q):
3494 q.text("table_feature_prop_wildcards {")
3495 with q.group():
3496 with q.indent(2):
3497 q.breakable()
Rich Lanec2ee4b82013-04-24 17:12:38 -07003498 q.text("oxm_ids = ");
3499 q.pp(self.oxm_ids)
3500 q.breakable()
3501 q.text('}')
3502
Rich Lane7dcdf022013-12-11 14:45:27 -08003503table_feature_prop.subtypes[10] = table_feature_prop_wildcards
3504
3505class table_feature_prop_write_actions(table_feature_prop):
Dan Talaycof6202252013-07-02 01:00:29 -07003506 type = 4
Rich Lanec2ee4b82013-04-24 17:12:38 -07003507
Dan Talaycof6202252013-07-02 01:00:29 -07003508 def __init__(self, action_ids=None):
Rich Lanec2ee4b82013-04-24 17:12:38 -07003509 if action_ids != None:
3510 self.action_ids = action_ids
3511 else:
3512 self.action_ids = []
3513 return
3514
3515 def pack(self):
3516 packed = []
3517 packed.append(struct.pack("!H", self.type))
3518 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
Rich Lane7dcdf022013-12-11 14:45:27 -08003519 packed.append(loxi.generic_util.pack_list(self.action_ids))
Rich Lanec2ee4b82013-04-24 17:12:38 -07003520 length = sum([len(x) for x in packed])
3521 packed[1] = struct.pack("!H", length)
3522 return ''.join(packed)
3523
3524 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003525 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07003526 obj = table_feature_prop_write_actions()
Dan Talaycof6202252013-07-02 01:00:29 -07003527 _type = reader.read("!H")[0]
3528 assert(_type == 4)
3529 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003530 orig_reader = reader
3531 reader = orig_reader.slice(_length - (2 + 2))
3532 obj.action_ids = loxi.generic_util.unpack_list(reader, action_id.action_id.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -07003533 return obj
3534
3535 def __eq__(self, other):
3536 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07003537 if self.action_ids != other.action_ids: return False
3538 return True
3539
Rich Lanec2ee4b82013-04-24 17:12:38 -07003540 def pretty_print(self, q):
3541 q.text("table_feature_prop_write_actions {")
3542 with q.group():
3543 with q.indent(2):
3544 q.breakable()
Rich Lanec2ee4b82013-04-24 17:12:38 -07003545 q.text("action_ids = ");
3546 q.pp(self.action_ids)
3547 q.breakable()
3548 q.text('}')
3549
Rich Lane7dcdf022013-12-11 14:45:27 -08003550table_feature_prop.subtypes[4] = table_feature_prop_write_actions
3551
3552class table_feature_prop_write_actions_miss(table_feature_prop):
Dan Talaycof6202252013-07-02 01:00:29 -07003553 type = 5
Rich Lanec2ee4b82013-04-24 17:12:38 -07003554
Dan Talaycof6202252013-07-02 01:00:29 -07003555 def __init__(self, action_ids=None):
Rich Lanec2ee4b82013-04-24 17:12:38 -07003556 if action_ids != None:
3557 self.action_ids = action_ids
3558 else:
3559 self.action_ids = []
3560 return
3561
3562 def pack(self):
3563 packed = []
3564 packed.append(struct.pack("!H", self.type))
3565 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
Rich Lane7dcdf022013-12-11 14:45:27 -08003566 packed.append(loxi.generic_util.pack_list(self.action_ids))
Rich Lanec2ee4b82013-04-24 17:12:38 -07003567 length = sum([len(x) for x in packed])
3568 packed[1] = struct.pack("!H", length)
3569 return ''.join(packed)
3570
3571 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003572 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07003573 obj = table_feature_prop_write_actions_miss()
Dan Talaycof6202252013-07-02 01:00:29 -07003574 _type = reader.read("!H")[0]
3575 assert(_type == 5)
3576 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003577 orig_reader = reader
3578 reader = orig_reader.slice(_length - (2 + 2))
3579 obj.action_ids = loxi.generic_util.unpack_list(reader, action_id.action_id.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -07003580 return obj
3581
3582 def __eq__(self, other):
3583 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07003584 if self.action_ids != other.action_ids: return False
3585 return True
3586
Rich Lanec2ee4b82013-04-24 17:12:38 -07003587 def pretty_print(self, q):
3588 q.text("table_feature_prop_write_actions_miss {")
3589 with q.group():
3590 with q.indent(2):
3591 q.breakable()
Rich Lanec2ee4b82013-04-24 17:12:38 -07003592 q.text("action_ids = ");
3593 q.pp(self.action_ids)
3594 q.breakable()
3595 q.text('}')
3596
Rich Lane7dcdf022013-12-11 14:45:27 -08003597table_feature_prop.subtypes[5] = table_feature_prop_write_actions_miss
3598
3599class table_feature_prop_write_setfield(table_feature_prop):
Dan Talaycof6202252013-07-02 01:00:29 -07003600 type = 12
Rich Lanec2ee4b82013-04-24 17:12:38 -07003601
Dan Talaycof6202252013-07-02 01:00:29 -07003602 def __init__(self, oxm_ids=None):
Rich Lanec2ee4b82013-04-24 17:12:38 -07003603 if oxm_ids != None:
3604 self.oxm_ids = oxm_ids
3605 else:
3606 self.oxm_ids = []
3607 return
3608
3609 def pack(self):
3610 packed = []
3611 packed.append(struct.pack("!H", self.type))
3612 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
Rich Lane7dcdf022013-12-11 14:45:27 -08003613 packed.append(loxi.generic_util.pack_list(self.oxm_ids))
Rich Lanec2ee4b82013-04-24 17:12:38 -07003614 length = sum([len(x) for x in packed])
3615 packed[1] = struct.pack("!H", length)
3616 return ''.join(packed)
3617
3618 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003619 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07003620 obj = table_feature_prop_write_setfield()
Dan Talaycof6202252013-07-02 01:00:29 -07003621 _type = reader.read("!H")[0]
3622 assert(_type == 12)
3623 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003624 orig_reader = reader
3625 reader = orig_reader.slice(_length - (2 + 2))
Rich Lanec2ee4b82013-04-24 17:12:38 -07003626 obj.oxm_ids = loxi.generic_util.unpack_list(reader, common.uint32.unpack)
3627 return obj
3628
3629 def __eq__(self, other):
3630 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07003631 if self.oxm_ids != other.oxm_ids: return False
3632 return True
3633
Rich Lanec2ee4b82013-04-24 17:12:38 -07003634 def pretty_print(self, q):
3635 q.text("table_feature_prop_write_setfield {")
3636 with q.group():
3637 with q.indent(2):
3638 q.breakable()
Rich Lanec2ee4b82013-04-24 17:12:38 -07003639 q.text("oxm_ids = ");
3640 q.pp(self.oxm_ids)
3641 q.breakable()
3642 q.text('}')
3643
Rich Lane7dcdf022013-12-11 14:45:27 -08003644table_feature_prop.subtypes[12] = table_feature_prop_write_setfield
3645
3646class table_feature_prop_write_setfield_miss(table_feature_prop):
Dan Talaycof6202252013-07-02 01:00:29 -07003647 type = 13
Rich Lanec2ee4b82013-04-24 17:12:38 -07003648
Dan Talaycof6202252013-07-02 01:00:29 -07003649 def __init__(self, oxm_ids=None):
Rich Lanec2ee4b82013-04-24 17:12:38 -07003650 if oxm_ids != None:
3651 self.oxm_ids = oxm_ids
3652 else:
3653 self.oxm_ids = []
3654 return
3655
3656 def pack(self):
3657 packed = []
3658 packed.append(struct.pack("!H", self.type))
3659 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
Rich Lane7dcdf022013-12-11 14:45:27 -08003660 packed.append(loxi.generic_util.pack_list(self.oxm_ids))
Rich Lanec2ee4b82013-04-24 17:12:38 -07003661 length = sum([len(x) for x in packed])
3662 packed[1] = struct.pack("!H", length)
3663 return ''.join(packed)
3664
3665 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003666 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07003667 obj = table_feature_prop_write_setfield_miss()
Dan Talaycof6202252013-07-02 01:00:29 -07003668 _type = reader.read("!H")[0]
3669 assert(_type == 13)
3670 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003671 orig_reader = reader
3672 reader = orig_reader.slice(_length - (2 + 2))
Rich Lanec2ee4b82013-04-24 17:12:38 -07003673 obj.oxm_ids = loxi.generic_util.unpack_list(reader, common.uint32.unpack)
3674 return obj
3675
3676 def __eq__(self, other):
3677 if type(self) != type(other): return False
Rich Lanec2ee4b82013-04-24 17:12:38 -07003678 if self.oxm_ids != other.oxm_ids: return False
3679 return True
3680
Rich Lanec2ee4b82013-04-24 17:12:38 -07003681 def pretty_print(self, q):
3682 q.text("table_feature_prop_write_setfield_miss {")
3683 with q.group():
3684 with q.indent(2):
3685 q.breakable()
Rich Lanec2ee4b82013-04-24 17:12:38 -07003686 q.text("oxm_ids = ");
3687 q.pp(self.oxm_ids)
3688 q.breakable()
3689 q.text('}')
3690
Rich Lane7dcdf022013-12-11 14:45:27 -08003691table_feature_prop.subtypes[13] = table_feature_prop_write_setfield_miss
3692
3693class table_features(loxi.OFObject):
Rich Lanec2ee4b82013-04-24 17:12:38 -07003694
3695 def __init__(self, table_id=None, name=None, metadata_match=None, metadata_write=None, config=None, max_entries=None, properties=None):
3696 if table_id != None:
3697 self.table_id = table_id
3698 else:
3699 self.table_id = 0
3700 if name != None:
3701 self.name = name
3702 else:
3703 self.name = ""
3704 if metadata_match != None:
3705 self.metadata_match = metadata_match
3706 else:
3707 self.metadata_match = 0
3708 if metadata_write != None:
3709 self.metadata_write = metadata_write
3710 else:
3711 self.metadata_write = 0
3712 if config != None:
3713 self.config = config
3714 else:
3715 self.config = 0
3716 if max_entries != None:
3717 self.max_entries = max_entries
3718 else:
3719 self.max_entries = 0
3720 if properties != None:
3721 self.properties = properties
3722 else:
3723 self.properties = []
3724 return
3725
3726 def pack(self):
3727 packed = []
3728 packed.append(struct.pack("!H", 0)) # placeholder for length at index 0
3729 packed.append(struct.pack("!B", self.table_id))
3730 packed.append('\x00' * 5)
3731 packed.append(struct.pack("!32s", self.name))
3732 packed.append(struct.pack("!Q", self.metadata_match))
3733 packed.append(struct.pack("!Q", self.metadata_write))
3734 packed.append(struct.pack("!L", self.config))
3735 packed.append(struct.pack("!L", self.max_entries))
Rich Lane7dcdf022013-12-11 14:45:27 -08003736 packed.append(loxi.generic_util.pack_list(self.properties))
Rich Lanec2ee4b82013-04-24 17:12:38 -07003737 length = sum([len(x) for x in packed])
3738 packed[0] = struct.pack("!H", length)
3739 return ''.join(packed)
3740
3741 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003742 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07003743 obj = table_features()
Dan Talaycof6202252013-07-02 01:00:29 -07003744 _length = reader.read("!H")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003745 orig_reader = reader
3746 reader = orig_reader.slice(_length - (0 + 2))
Dan Talaycof6202252013-07-02 01:00:29 -07003747 obj.table_id = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07003748 reader.skip(5)
3749 obj.name = reader.read("!32s")[0].rstrip("\x00")
Dan Talaycof6202252013-07-02 01:00:29 -07003750 obj.metadata_match = reader.read("!Q")[0]
3751 obj.metadata_write = reader.read("!Q")[0]
3752 obj.config = reader.read("!L")[0]
3753 obj.max_entries = reader.read("!L")[0]
Rich Lane7dcdf022013-12-11 14:45:27 -08003754 obj.properties = loxi.generic_util.unpack_list(reader, common.table_feature_prop.unpack)
Rich Lanec2ee4b82013-04-24 17:12:38 -07003755 return obj
3756
3757 def __eq__(self, other):
3758 if type(self) != type(other): return False
3759 if self.table_id != other.table_id: return False
3760 if self.name != other.name: return False
3761 if self.metadata_match != other.metadata_match: return False
3762 if self.metadata_write != other.metadata_write: return False
3763 if self.config != other.config: return False
3764 if self.max_entries != other.max_entries: return False
3765 if self.properties != other.properties: return False
3766 return True
3767
Rich Lanec2ee4b82013-04-24 17:12:38 -07003768 def pretty_print(self, q):
3769 q.text("table_features {")
3770 with q.group():
3771 with q.indent(2):
3772 q.breakable()
3773 q.text("table_id = ");
3774 q.text("%#x" % self.table_id)
3775 q.text(","); q.breakable()
3776 q.text("name = ");
3777 q.pp(self.name)
3778 q.text(","); q.breakable()
3779 q.text("metadata_match = ");
3780 q.text("%#x" % self.metadata_match)
3781 q.text(","); q.breakable()
3782 q.text("metadata_write = ");
3783 q.text("%#x" % self.metadata_write)
3784 q.text(","); q.breakable()
3785 q.text("config = ");
3786 q.text("%#x" % self.config)
3787 q.text(","); q.breakable()
3788 q.text("max_entries = ");
3789 q.text("%#x" % self.max_entries)
3790 q.text(","); q.breakable()
3791 q.text("properties = ");
3792 q.pp(self.properties)
3793 q.breakable()
3794 q.text('}')
3795
Rich Lane7dcdf022013-12-11 14:45:27 -08003796
3797class table_stats_entry(loxi.OFObject):
Rich Lanec2ee4b82013-04-24 17:12:38 -07003798
3799 def __init__(self, table_id=None, active_count=None, lookup_count=None, matched_count=None):
3800 if table_id != None:
3801 self.table_id = table_id
3802 else:
3803 self.table_id = 0
3804 if active_count != None:
3805 self.active_count = active_count
3806 else:
3807 self.active_count = 0
3808 if lookup_count != None:
3809 self.lookup_count = lookup_count
3810 else:
3811 self.lookup_count = 0
3812 if matched_count != None:
3813 self.matched_count = matched_count
3814 else:
3815 self.matched_count = 0
3816 return
3817
3818 def pack(self):
3819 packed = []
3820 packed.append(struct.pack("!B", self.table_id))
3821 packed.append('\x00' * 3)
3822 packed.append(struct.pack("!L", self.active_count))
3823 packed.append(struct.pack("!Q", self.lookup_count))
3824 packed.append(struct.pack("!Q", self.matched_count))
3825 return ''.join(packed)
3826
3827 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003828 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07003829 obj = table_stats_entry()
Dan Talaycof6202252013-07-02 01:00:29 -07003830 obj.table_id = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07003831 reader.skip(3)
Dan Talaycof6202252013-07-02 01:00:29 -07003832 obj.active_count = reader.read("!L")[0]
3833 obj.lookup_count = reader.read("!Q")[0]
3834 obj.matched_count = reader.read("!Q")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07003835 return obj
3836
3837 def __eq__(self, other):
3838 if type(self) != type(other): return False
3839 if self.table_id != other.table_id: return False
3840 if self.active_count != other.active_count: return False
3841 if self.lookup_count != other.lookup_count: return False
3842 if self.matched_count != other.matched_count: return False
3843 return True
3844
Rich Lanec2ee4b82013-04-24 17:12:38 -07003845 def pretty_print(self, q):
3846 q.text("table_stats_entry {")
3847 with q.group():
3848 with q.indent(2):
3849 q.breakable()
3850 q.text("table_id = ");
3851 q.text("%#x" % self.table_id)
3852 q.text(","); q.breakable()
3853 q.text("active_count = ");
3854 q.text("%#x" % self.active_count)
3855 q.text(","); q.breakable()
3856 q.text("lookup_count = ");
3857 q.text("%#x" % self.lookup_count)
3858 q.text(","); q.breakable()
3859 q.text("matched_count = ");
3860 q.text("%#x" % self.matched_count)
3861 q.breakable()
3862 q.text('}')
3863
Rich Lane7dcdf022013-12-11 14:45:27 -08003864
3865class uint32(loxi.OFObject):
Rich Lanec2ee4b82013-04-24 17:12:38 -07003866
3867 def __init__(self, value=None):
3868 if value != None:
3869 self.value = value
3870 else:
3871 self.value = 0
3872 return
3873
3874 def pack(self):
3875 packed = []
3876 packed.append(struct.pack("!L", self.value))
3877 return ''.join(packed)
3878
3879 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003880 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07003881 obj = uint32()
Dan Talaycof6202252013-07-02 01:00:29 -07003882 obj.value = reader.read("!L")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07003883 return obj
3884
3885 def __eq__(self, other):
3886 if type(self) != type(other): return False
3887 if self.value != other.value: return False
3888 return True
3889
Rich Lanec2ee4b82013-04-24 17:12:38 -07003890 def pretty_print(self, q):
3891 q.text("uint32 {")
3892 with q.group():
3893 with q.indent(2):
3894 q.breakable()
3895 q.text("value = ");
3896 q.text("%#x" % self.value)
3897 q.breakable()
3898 q.text('}')
3899
Rich Lane7dcdf022013-12-11 14:45:27 -08003900
3901class uint64(loxi.OFObject):
3902
3903 def __init__(self, value=None):
3904 if value != None:
3905 self.value = value
3906 else:
3907 self.value = 0
3908 return
3909
3910 def pack(self):
3911 packed = []
3912 packed.append(struct.pack("!Q", self.value))
3913 return ''.join(packed)
3914
3915 @staticmethod
3916 def unpack(reader):
3917 obj = uint64()
3918 obj.value = reader.read("!Q")[0]
3919 return obj
3920
3921 def __eq__(self, other):
3922 if type(self) != type(other): return False
3923 if self.value != other.value: return False
3924 return True
3925
3926 def pretty_print(self, q):
3927 q.text("uint64 {")
3928 with q.group():
3929 with q.indent(2):
3930 q.breakable()
3931 q.text("value = ");
3932 q.text("%#x" % self.value)
3933 q.breakable()
3934 q.text('}')
3935
3936
3937class uint8(loxi.OFObject):
Rich Lanec2ee4b82013-04-24 17:12:38 -07003938
3939 def __init__(self, value=None):
3940 if value != None:
3941 self.value = value
3942 else:
3943 self.value = 0
3944 return
3945
3946 def pack(self):
3947 packed = []
3948 packed.append(struct.pack("!B", self.value))
3949 return ''.join(packed)
3950
3951 @staticmethod
Rich Lane7dcdf022013-12-11 14:45:27 -08003952 def unpack(reader):
Rich Lanec2ee4b82013-04-24 17:12:38 -07003953 obj = uint8()
Dan Talaycof6202252013-07-02 01:00:29 -07003954 obj.value = reader.read("!B")[0]
Rich Lanec2ee4b82013-04-24 17:12:38 -07003955 return obj
3956
3957 def __eq__(self, other):
3958 if type(self) != type(other): return False
3959 if self.value != other.value: return False
3960 return True
3961
Rich Lanec2ee4b82013-04-24 17:12:38 -07003962 def pretty_print(self, q):
3963 q.text("uint8 {")
3964 with q.group():
3965 with q.indent(2):
3966 q.breakable()
3967 q.text("value = ");
3968 q.text("%#x" % self.value)
3969 q.breakable()
3970 q.text('}')
3971
3972
Rich Lane7dcdf022013-12-11 14:45:27 -08003973
Rich Lanec2ee4b82013-04-24 17:12:38 -07003974match = match_v3