blob: 124b26a79c846e058bd29ed6aa076ca43825e509 [file] [log] [blame]
Stephane Barbarie6e1bd502018-11-05 22:44:45 -05001# Copyright 2017-present Open Networking Foundation
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14# Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
15# Copyright (c) 2011, 2012 Open Networking Foundation
16# Copyright (c) 2012, 2013 Big Switch Networks, Inc.
17# See the file LICENSE.pyloxi which should have been included in the source distribution
18
19# Automatically generated by LOXI from template module.py
20# Do not modify
21
22import struct
23import loxi
24import util
25import loxi.generic_util
26
27import sys
28ofp = sys.modules['loxi.of14']
29
30class bsn_controller_connection(loxi.OFObject):
31
32 def __init__(self, state=None, auxiliary_id=None, role=None, uri=None):
33 if state != None:
34 self.state = state
35 else:
36 self.state = 0
37 if auxiliary_id != None:
38 self.auxiliary_id = auxiliary_id
39 else:
40 self.auxiliary_id = 0
41 if role != None:
42 self.role = role
43 else:
44 self.role = 0
45 if uri != None:
46 self.uri = uri
47 else:
48 self.uri = ""
49 return
50
51 def pack(self):
52 packed = []
53 packed.append(struct.pack("!B", self.state))
54 packed.append(struct.pack("!B", self.auxiliary_id))
55 packed.append('\x00' * 2)
56 packed.append(struct.pack("!L", self.role))
57 packed.append(struct.pack("!256s", self.uri))
58 return ''.join(packed)
59
60 @staticmethod
61 def unpack(reader):
62 obj = bsn_controller_connection()
63 obj.state = reader.read("!B")[0]
64 obj.auxiliary_id = reader.read("!B")[0]
65 reader.skip(2)
66 obj.role = reader.read("!L")[0]
67 obj.uri = reader.read("!256s")[0].rstrip("\x00")
68 return obj
69
70 def __eq__(self, other):
71 if type(self) != type(other): return False
72 if self.state != other.state: return False
73 if self.auxiliary_id != other.auxiliary_id: return False
74 if self.role != other.role: return False
75 if self.uri != other.uri: return False
76 return True
77
78 def pretty_print(self, q):
79 q.text("bsn_controller_connection {")
80 with q.group():
81 with q.indent(2):
82 q.breakable()
83 q.text("state = ");
84 q.text("%#x" % self.state)
85 q.text(","); q.breakable()
86 q.text("auxiliary_id = ");
87 q.text("%#x" % self.auxiliary_id)
88 q.text(","); q.breakable()
89 q.text("role = ");
90 q.text("%#x" % self.role)
91 q.text(","); q.breakable()
92 q.text("uri = ");
93 q.pp(self.uri)
94 q.breakable()
95 q.text('}')
96
97
98class bsn_debug_counter_desc_stats_entry(loxi.OFObject):
99
100 def __init__(self, counter_id=None, name=None, description=None):
101 if counter_id != None:
102 self.counter_id = counter_id
103 else:
104 self.counter_id = 0
105 if name != None:
106 self.name = name
107 else:
108 self.name = ""
109 if description != None:
110 self.description = description
111 else:
112 self.description = ""
113 return
114
115 def pack(self):
116 packed = []
117 packed.append(struct.pack("!Q", self.counter_id))
118 packed.append(struct.pack("!64s", self.name))
119 packed.append(struct.pack("!256s", self.description))
120 return ''.join(packed)
121
122 @staticmethod
123 def unpack(reader):
124 obj = bsn_debug_counter_desc_stats_entry()
125 obj.counter_id = reader.read("!Q")[0]
126 obj.name = reader.read("!64s")[0].rstrip("\x00")
127 obj.description = reader.read("!256s")[0].rstrip("\x00")
128 return obj
129
130 def __eq__(self, other):
131 if type(self) != type(other): return False
132 if self.counter_id != other.counter_id: return False
133 if self.name != other.name: return False
134 if self.description != other.description: return False
135 return True
136
137 def pretty_print(self, q):
138 q.text("bsn_debug_counter_desc_stats_entry {")
139 with q.group():
140 with q.indent(2):
141 q.breakable()
142 q.text("counter_id = ");
143 q.text("%#x" % self.counter_id)
144 q.text(","); q.breakable()
145 q.text("name = ");
146 q.pp(self.name)
147 q.text(","); q.breakable()
148 q.text("description = ");
149 q.pp(self.description)
150 q.breakable()
151 q.text('}')
152
153
154class bsn_debug_counter_stats_entry(loxi.OFObject):
155
156 def __init__(self, counter_id=None, value=None):
157 if counter_id != None:
158 self.counter_id = counter_id
159 else:
160 self.counter_id = 0
161 if value != None:
162 self.value = value
163 else:
164 self.value = 0
165 return
166
167 def pack(self):
168 packed = []
169 packed.append(struct.pack("!Q", self.counter_id))
170 packed.append(struct.pack("!Q", self.value))
171 return ''.join(packed)
172
173 @staticmethod
174 def unpack(reader):
175 obj = bsn_debug_counter_stats_entry()
176 obj.counter_id = reader.read("!Q")[0]
177 obj.value = reader.read("!Q")[0]
178 return obj
179
180 def __eq__(self, other):
181 if type(self) != type(other): return False
182 if self.counter_id != other.counter_id: return False
183 if self.value != other.value: return False
184 return True
185
186 def pretty_print(self, q):
187 q.text("bsn_debug_counter_stats_entry {")
188 with q.group():
189 with q.indent(2):
190 q.breakable()
191 q.text("counter_id = ");
192 q.text("%#x" % self.counter_id)
193 q.text(","); q.breakable()
194 q.text("value = ");
195 q.text("%#x" % self.value)
196 q.breakable()
197 q.text('}')
198
199
200class bsn_flow_checksum_bucket_stats_entry(loxi.OFObject):
201
202 def __init__(self, checksum=None):
203 if checksum != None:
204 self.checksum = checksum
205 else:
206 self.checksum = 0
207 return
208
209 def pack(self):
210 packed = []
211 packed.append(struct.pack("!Q", self.checksum))
212 return ''.join(packed)
213
214 @staticmethod
215 def unpack(reader):
216 obj = bsn_flow_checksum_bucket_stats_entry()
217 obj.checksum = reader.read("!Q")[0]
218 return obj
219
220 def __eq__(self, other):
221 if type(self) != type(other): return False
222 if self.checksum != other.checksum: return False
223 return True
224
225 def pretty_print(self, q):
226 q.text("bsn_flow_checksum_bucket_stats_entry {")
227 with q.group():
228 with q.indent(2):
229 q.breakable()
230 q.text("checksum = ");
231 q.text("%#x" % self.checksum)
232 q.breakable()
233 q.text('}')
234
235
236class bsn_generic_stats_entry(loxi.OFObject):
237
238 def __init__(self, tlvs=None):
239 if tlvs != None:
240 self.tlvs = tlvs
241 else:
242 self.tlvs = []
243 return
244
245 def pack(self):
246 packed = []
247 packed.append(struct.pack("!H", 0)) # placeholder for length at index 0
248 packed.append(loxi.generic_util.pack_list(self.tlvs))
249 length = sum([len(x) for x in packed])
250 packed[0] = struct.pack("!H", length)
251 return ''.join(packed)
252
253 @staticmethod
254 def unpack(reader):
255 obj = bsn_generic_stats_entry()
256 _length = reader.read("!H")[0]
257 orig_reader = reader
258 reader = orig_reader.slice(_length, 2)
259 obj.tlvs = loxi.generic_util.unpack_list(reader, ofp.bsn_tlv.bsn_tlv.unpack)
260 return obj
261
262 def __eq__(self, other):
263 if type(self) != type(other): return False
264 if self.tlvs != other.tlvs: return False
265 return True
266
267 def pretty_print(self, q):
268 q.text("bsn_generic_stats_entry {")
269 with q.group():
270 with q.indent(2):
271 q.breakable()
272 q.text("tlvs = ");
273 q.pp(self.tlvs)
274 q.breakable()
275 q.text('}')
276
277
278class bsn_gentable_bucket_stats_entry(loxi.OFObject):
279
280 def __init__(self, checksum=None):
281 if checksum != None:
282 self.checksum = checksum
283 else:
284 self.checksum = 0
285 return
286
287 def pack(self):
288 packed = []
289 packed.append(util.pack_checksum_128(self.checksum))
290 return ''.join(packed)
291
292 @staticmethod
293 def unpack(reader):
294 obj = bsn_gentable_bucket_stats_entry()
295 obj.checksum = util.unpack_checksum_128(reader)
296 return obj
297
298 def __eq__(self, other):
299 if type(self) != type(other): return False
300 if self.checksum != other.checksum: return False
301 return True
302
303 def pretty_print(self, q):
304 q.text("bsn_gentable_bucket_stats_entry {")
305 with q.group():
306 with q.indent(2):
307 q.breakable()
308 q.text("checksum = ");
309 q.pp(self.checksum)
310 q.breakable()
311 q.text('}')
312
313
314class bsn_gentable_desc_stats_entry(loxi.OFObject):
315
316 def __init__(self, table_id=None, name=None, buckets_size=None, max_entries=None):
317 if table_id != None:
318 self.table_id = table_id
319 else:
320 self.table_id = 0
321 if name != None:
322 self.name = name
323 else:
324 self.name = ""
325 if buckets_size != None:
326 self.buckets_size = buckets_size
327 else:
328 self.buckets_size = 0
329 if max_entries != None:
330 self.max_entries = max_entries
331 else:
332 self.max_entries = 0
333 return
334
335 def pack(self):
336 packed = []
337 packed.append(struct.pack("!H", 0)) # placeholder for length at index 0
338 packed.append(struct.pack("!H", self.table_id))
339 packed.append(struct.pack("!32s", self.name))
340 packed.append(struct.pack("!L", self.buckets_size))
341 packed.append(struct.pack("!L", self.max_entries))
342 packed.append('\x00' * 4)
343 length = sum([len(x) for x in packed])
344 packed[0] = struct.pack("!H", length)
345 return ''.join(packed)
346
347 @staticmethod
348 def unpack(reader):
349 obj = bsn_gentable_desc_stats_entry()
350 _length = reader.read("!H")[0]
351 orig_reader = reader
352 reader = orig_reader.slice(_length, 2)
353 obj.table_id = reader.read("!H")[0]
354 obj.name = reader.read("!32s")[0].rstrip("\x00")
355 obj.buckets_size = reader.read("!L")[0]
356 obj.max_entries = reader.read("!L")[0]
357 reader.skip(4)
358 return obj
359
360 def __eq__(self, other):
361 if type(self) != type(other): return False
362 if self.table_id != other.table_id: return False
363 if self.name != other.name: return False
364 if self.buckets_size != other.buckets_size: return False
365 if self.max_entries != other.max_entries: return False
366 return True
367
368 def pretty_print(self, q):
369 q.text("bsn_gentable_desc_stats_entry {")
370 with q.group():
371 with q.indent(2):
372 q.breakable()
373 q.text("table_id = ");
374 q.text("%#x" % self.table_id)
375 q.text(","); q.breakable()
376 q.text("name = ");
377 q.pp(self.name)
378 q.text(","); q.breakable()
379 q.text("buckets_size = ");
380 q.text("%#x" % self.buckets_size)
381 q.text(","); q.breakable()
382 q.text("max_entries = ");
383 q.text("%#x" % self.max_entries)
384 q.breakable()
385 q.text('}')
386
387
388class bsn_gentable_entry_desc_stats_entry(loxi.OFObject):
389
390 def __init__(self, checksum=None, key=None, value=None):
391 if checksum != None:
392 self.checksum = checksum
393 else:
394 self.checksum = 0
395 if key != None:
396 self.key = key
397 else:
398 self.key = []
399 if value != None:
400 self.value = value
401 else:
402 self.value = []
403 return
404
405 def pack(self):
406 packed = []
407 packed.append(struct.pack("!H", 0)) # placeholder for length at index 0
408 packed.append(struct.pack("!H", 0)) # placeholder for key_length at index 1
409 packed.append(util.pack_checksum_128(self.checksum))
410 packed.append(loxi.generic_util.pack_list(self.key))
411 packed[1] = struct.pack("!H", len(packed[-1]))
412 packed.append(loxi.generic_util.pack_list(self.value))
413 length = sum([len(x) for x in packed])
414 packed[0] = struct.pack("!H", length)
415 return ''.join(packed)
416
417 @staticmethod
418 def unpack(reader):
419 obj = bsn_gentable_entry_desc_stats_entry()
420 _length = reader.read("!H")[0]
421 orig_reader = reader
422 reader = orig_reader.slice(_length, 2)
423 _key_length = reader.read("!H")[0]
424 obj.checksum = util.unpack_checksum_128(reader)
425 obj.key = loxi.generic_util.unpack_list(reader.slice(_key_length), ofp.bsn_tlv.bsn_tlv.unpack)
426 obj.value = loxi.generic_util.unpack_list(reader, ofp.bsn_tlv.bsn_tlv.unpack)
427 return obj
428
429 def __eq__(self, other):
430 if type(self) != type(other): return False
431 if self.checksum != other.checksum: return False
432 if self.key != other.key: return False
433 if self.value != other.value: return False
434 return True
435
436 def pretty_print(self, q):
437 q.text("bsn_gentable_entry_desc_stats_entry {")
438 with q.group():
439 with q.indent(2):
440 q.breakable()
441 q.text("checksum = ");
442 q.pp(self.checksum)
443 q.text(","); q.breakable()
444 q.text("key = ");
445 q.pp(self.key)
446 q.text(","); q.breakable()
447 q.text("value = ");
448 q.pp(self.value)
449 q.breakable()
450 q.text('}')
451
452
453class bsn_gentable_entry_stats_entry(loxi.OFObject):
454
455 def __init__(self, key=None, stats=None):
456 if key != None:
457 self.key = key
458 else:
459 self.key = []
460 if stats != None:
461 self.stats = stats
462 else:
463 self.stats = []
464 return
465
466 def pack(self):
467 packed = []
468 packed.append(struct.pack("!H", 0)) # placeholder for length at index 0
469 packed.append(struct.pack("!H", 0)) # placeholder for key_length at index 1
470 packed.append(loxi.generic_util.pack_list(self.key))
471 packed[1] = struct.pack("!H", len(packed[-1]))
472 packed.append(loxi.generic_util.pack_list(self.stats))
473 length = sum([len(x) for x in packed])
474 packed[0] = struct.pack("!H", length)
475 return ''.join(packed)
476
477 @staticmethod
478 def unpack(reader):
479 obj = bsn_gentable_entry_stats_entry()
480 _length = reader.read("!H")[0]
481 orig_reader = reader
482 reader = orig_reader.slice(_length, 2)
483 _key_length = reader.read("!H")[0]
484 obj.key = loxi.generic_util.unpack_list(reader.slice(_key_length), ofp.bsn_tlv.bsn_tlv.unpack)
485 obj.stats = loxi.generic_util.unpack_list(reader, ofp.bsn_tlv.bsn_tlv.unpack)
486 return obj
487
488 def __eq__(self, other):
489 if type(self) != type(other): return False
490 if self.key != other.key: return False
491 if self.stats != other.stats: return False
492 return True
493
494 def pretty_print(self, q):
495 q.text("bsn_gentable_entry_stats_entry {")
496 with q.group():
497 with q.indent(2):
498 q.breakable()
499 q.text("key = ");
500 q.pp(self.key)
501 q.text(","); q.breakable()
502 q.text("stats = ");
503 q.pp(self.stats)
504 q.breakable()
505 q.text('}')
506
507
508class bsn_gentable_stats_entry(loxi.OFObject):
509
510 def __init__(self, table_id=None, entry_count=None, checksum=None):
511 if table_id != None:
512 self.table_id = table_id
513 else:
514 self.table_id = 0
515 if entry_count != None:
516 self.entry_count = entry_count
517 else:
518 self.entry_count = 0
519 if checksum != None:
520 self.checksum = checksum
521 else:
522 self.checksum = 0
523 return
524
525 def pack(self):
526 packed = []
527 packed.append(struct.pack("!H", self.table_id))
528 packed.append('\x00' * 2)
529 packed.append(struct.pack("!L", self.entry_count))
530 packed.append(util.pack_checksum_128(self.checksum))
531 return ''.join(packed)
532
533 @staticmethod
534 def unpack(reader):
535 obj = bsn_gentable_stats_entry()
536 obj.table_id = reader.read("!H")[0]
537 reader.skip(2)
538 obj.entry_count = reader.read("!L")[0]
539 obj.checksum = util.unpack_checksum_128(reader)
540 return obj
541
542 def __eq__(self, other):
543 if type(self) != type(other): return False
544 if self.table_id != other.table_id: return False
545 if self.entry_count != other.entry_count: return False
546 if self.checksum != other.checksum: return False
547 return True
548
549 def pretty_print(self, q):
550 q.text("bsn_gentable_stats_entry {")
551 with q.group():
552 with q.indent(2):
553 q.breakable()
554 q.text("table_id = ");
555 q.text("%#x" % self.table_id)
556 q.text(","); q.breakable()
557 q.text("entry_count = ");
558 q.text("%#x" % self.entry_count)
559 q.text(","); q.breakable()
560 q.text("checksum = ");
561 q.pp(self.checksum)
562 q.breakable()
563 q.text('}')
564
565
566class bsn_interface(loxi.OFObject):
567
568 def __init__(self, hw_addr=None, name=None, ipv4_addr=None, ipv4_netmask=None):
569 if hw_addr != None:
570 self.hw_addr = hw_addr
571 else:
572 self.hw_addr = [0,0,0,0,0,0]
573 if name != None:
574 self.name = name
575 else:
576 self.name = ""
577 if ipv4_addr != None:
578 self.ipv4_addr = ipv4_addr
579 else:
580 self.ipv4_addr = 0
581 if ipv4_netmask != None:
582 self.ipv4_netmask = ipv4_netmask
583 else:
584 self.ipv4_netmask = 0
585 return
586
587 def pack(self):
588 packed = []
589 packed.append(struct.pack("!6B", *self.hw_addr))
590 packed.append('\x00' * 2)
591 packed.append(struct.pack("!16s", self.name))
592 packed.append(struct.pack("!L", self.ipv4_addr))
593 packed.append(struct.pack("!L", self.ipv4_netmask))
594 return ''.join(packed)
595
596 @staticmethod
597 def unpack(reader):
598 obj = bsn_interface()
599 obj.hw_addr = list(reader.read('!6B'))
600 reader.skip(2)
601 obj.name = reader.read("!16s")[0].rstrip("\x00")
602 obj.ipv4_addr = reader.read("!L")[0]
603 obj.ipv4_netmask = reader.read("!L")[0]
604 return obj
605
606 def __eq__(self, other):
607 if type(self) != type(other): return False
608 if self.hw_addr != other.hw_addr: return False
609 if self.name != other.name: return False
610 if self.ipv4_addr != other.ipv4_addr: return False
611 if self.ipv4_netmask != other.ipv4_netmask: return False
612 return True
613
614 def pretty_print(self, q):
615 q.text("bsn_interface {")
616 with q.group():
617 with q.indent(2):
618 q.breakable()
619 q.text("hw_addr = ");
620 q.text(util.pretty_mac(self.hw_addr))
621 q.text(","); q.breakable()
622 q.text("name = ");
623 q.pp(self.name)
624 q.text(","); q.breakable()
625 q.text("ipv4_addr = ");
626 q.text(util.pretty_ipv4(self.ipv4_addr))
627 q.text(","); q.breakable()
628 q.text("ipv4_netmask = ");
629 q.text(util.pretty_ipv4(self.ipv4_netmask))
630 q.breakable()
631 q.text('}')
632
633
634class bsn_lacp_stats_entry(loxi.OFObject):
635
636 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):
637 if port_no != None:
638 self.port_no = port_no
639 else:
640 self.port_no = 0
641 if actor_sys_priority != None:
642 self.actor_sys_priority = actor_sys_priority
643 else:
644 self.actor_sys_priority = 0
645 if actor_sys_mac != None:
646 self.actor_sys_mac = actor_sys_mac
647 else:
648 self.actor_sys_mac = [0,0,0,0,0,0]
649 if actor_port_priority != None:
650 self.actor_port_priority = actor_port_priority
651 else:
652 self.actor_port_priority = 0
653 if actor_port_num != None:
654 self.actor_port_num = actor_port_num
655 else:
656 self.actor_port_num = 0
657 if actor_key != None:
658 self.actor_key = actor_key
659 else:
660 self.actor_key = 0
661 if convergence_status != None:
662 self.convergence_status = convergence_status
663 else:
664 self.convergence_status = 0
665 if partner_sys_priority != None:
666 self.partner_sys_priority = partner_sys_priority
667 else:
668 self.partner_sys_priority = 0
669 if partner_sys_mac != None:
670 self.partner_sys_mac = partner_sys_mac
671 else:
672 self.partner_sys_mac = [0,0,0,0,0,0]
673 if partner_port_priority != None:
674 self.partner_port_priority = partner_port_priority
675 else:
676 self.partner_port_priority = 0
677 if partner_port_num != None:
678 self.partner_port_num = partner_port_num
679 else:
680 self.partner_port_num = 0
681 if partner_key != None:
682 self.partner_key = partner_key
683 else:
684 self.partner_key = 0
685 return
686
687 def pack(self):
688 packed = []
689 packed.append(util.pack_port_no(self.port_no))
690 packed.append(struct.pack("!H", self.actor_sys_priority))
691 packed.append(struct.pack("!6B", *self.actor_sys_mac))
692 packed.append(struct.pack("!H", self.actor_port_priority))
693 packed.append(struct.pack("!H", self.actor_port_num))
694 packed.append(struct.pack("!H", self.actor_key))
695 packed.append(struct.pack("!B", self.convergence_status))
696 packed.append('\x00' * 1)
697 packed.append(struct.pack("!H", self.partner_sys_priority))
698 packed.append(struct.pack("!6B", *self.partner_sys_mac))
699 packed.append(struct.pack("!H", self.partner_port_priority))
700 packed.append(struct.pack("!H", self.partner_port_num))
701 packed.append(struct.pack("!H", self.partner_key))
702 packed.append('\x00' * 2)
703 return ''.join(packed)
704
705 @staticmethod
706 def unpack(reader):
707 obj = bsn_lacp_stats_entry()
708 obj.port_no = util.unpack_port_no(reader)
709 obj.actor_sys_priority = reader.read("!H")[0]
710 obj.actor_sys_mac = list(reader.read('!6B'))
711 obj.actor_port_priority = reader.read("!H")[0]
712 obj.actor_port_num = reader.read("!H")[0]
713 obj.actor_key = reader.read("!H")[0]
714 obj.convergence_status = reader.read("!B")[0]
715 reader.skip(1)
716 obj.partner_sys_priority = reader.read("!H")[0]
717 obj.partner_sys_mac = list(reader.read('!6B'))
718 obj.partner_port_priority = reader.read("!H")[0]
719 obj.partner_port_num = reader.read("!H")[0]
720 obj.partner_key = reader.read("!H")[0]
721 reader.skip(2)
722 return obj
723
724 def __eq__(self, other):
725 if type(self) != type(other): return False
726 if self.port_no != other.port_no: return False
727 if self.actor_sys_priority != other.actor_sys_priority: return False
728 if self.actor_sys_mac != other.actor_sys_mac: return False
729 if self.actor_port_priority != other.actor_port_priority: return False
730 if self.actor_port_num != other.actor_port_num: return False
731 if self.actor_key != other.actor_key: return False
732 if self.convergence_status != other.convergence_status: return False
733 if self.partner_sys_priority != other.partner_sys_priority: return False
734 if self.partner_sys_mac != other.partner_sys_mac: return False
735 if self.partner_port_priority != other.partner_port_priority: return False
736 if self.partner_port_num != other.partner_port_num: return False
737 if self.partner_key != other.partner_key: return False
738 return True
739
740 def pretty_print(self, q):
741 q.text("bsn_lacp_stats_entry {")
742 with q.group():
743 with q.indent(2):
744 q.breakable()
745 q.text("port_no = ");
746 q.text(util.pretty_port(self.port_no))
747 q.text(","); q.breakable()
748 q.text("actor_sys_priority = ");
749 q.text("%#x" % self.actor_sys_priority)
750 q.text(","); q.breakable()
751 q.text("actor_sys_mac = ");
752 q.text(util.pretty_mac(self.actor_sys_mac))
753 q.text(","); q.breakable()
754 q.text("actor_port_priority = ");
755 q.text("%#x" % self.actor_port_priority)
756 q.text(","); q.breakable()
757 q.text("actor_port_num = ");
758 q.text("%#x" % self.actor_port_num)
759 q.text(","); q.breakable()
760 q.text("actor_key = ");
761 q.text("%#x" % self.actor_key)
762 q.text(","); q.breakable()
763 q.text("convergence_status = ");
764 q.text("%#x" % self.convergence_status)
765 q.text(","); q.breakable()
766 q.text("partner_sys_priority = ");
767 q.text("%#x" % self.partner_sys_priority)
768 q.text(","); q.breakable()
769 q.text("partner_sys_mac = ");
770 q.text(util.pretty_mac(self.partner_sys_mac))
771 q.text(","); q.breakable()
772 q.text("partner_port_priority = ");
773 q.text("%#x" % self.partner_port_priority)
774 q.text(","); q.breakable()
775 q.text("partner_port_num = ");
776 q.text("%#x" % self.partner_port_num)
777 q.text(","); q.breakable()
778 q.text("partner_key = ");
779 q.text("%#x" % self.partner_key)
780 q.breakable()
781 q.text('}')
782
783
784class bsn_port_counter_stats_entry(loxi.OFObject):
785
786 def __init__(self, port_no=None, values=None):
787 if port_no != None:
788 self.port_no = port_no
789 else:
790 self.port_no = 0
791 if values != None:
792 self.values = values
793 else:
794 self.values = []
795 return
796
797 def pack(self):
798 packed = []
799 packed.append(struct.pack("!H", 0)) # placeholder for length at index 0
800 packed.append('\x00' * 2)
801 packed.append(util.pack_port_no(self.port_no))
802 packed.append(loxi.generic_util.pack_list(self.values))
803 length = sum([len(x) for x in packed])
804 packed[0] = struct.pack("!H", length)
805 return ''.join(packed)
806
807 @staticmethod
808 def unpack(reader):
809 obj = bsn_port_counter_stats_entry()
810 _length = reader.read("!H")[0]
811 orig_reader = reader
812 reader = orig_reader.slice(_length, 2)
813 reader.skip(2)
814 obj.port_no = util.unpack_port_no(reader)
815 obj.values = loxi.generic_util.unpack_list(reader, ofp.common.uint64.unpack)
816 return obj
817
818 def __eq__(self, other):
819 if type(self) != type(other): return False
820 if self.port_no != other.port_no: return False
821 if self.values != other.values: return False
822 return True
823
824 def pretty_print(self, q):
825 q.text("bsn_port_counter_stats_entry {")
826 with q.group():
827 with q.indent(2):
828 q.breakable()
829 q.text("port_no = ");
830 q.text(util.pretty_port(self.port_no))
831 q.text(","); q.breakable()
832 q.text("values = ");
833 q.pp(self.values)
834 q.breakable()
835 q.text('}')
836
837
838class bsn_switch_pipeline_stats_entry(loxi.OFObject):
839
840 def __init__(self, pipeline=None):
841 if pipeline != None:
842 self.pipeline = pipeline
843 else:
844 self.pipeline = ""
845 return
846
847 def pack(self):
848 packed = []
849 packed.append(struct.pack("!256s", self.pipeline))
850 return ''.join(packed)
851
852 @staticmethod
853 def unpack(reader):
854 obj = bsn_switch_pipeline_stats_entry()
855 obj.pipeline = reader.read("!256s")[0].rstrip("\x00")
856 return obj
857
858 def __eq__(self, other):
859 if type(self) != type(other): return False
860 if self.pipeline != other.pipeline: return False
861 return True
862
863 def pretty_print(self, q):
864 q.text("bsn_switch_pipeline_stats_entry {")
865 with q.group():
866 with q.indent(2):
867 q.breakable()
868 q.text("pipeline = ");
869 q.pp(self.pipeline)
870 q.breakable()
871 q.text('}')
872
873
874class bsn_table_checksum_stats_entry(loxi.OFObject):
875
876 def __init__(self, table_id=None, checksum=None):
877 if table_id != None:
878 self.table_id = table_id
879 else:
880 self.table_id = 0
881 if checksum != None:
882 self.checksum = checksum
883 else:
884 self.checksum = 0
885 return
886
887 def pack(self):
888 packed = []
889 packed.append(struct.pack("!B", self.table_id))
890 packed.append(struct.pack("!Q", self.checksum))
891 return ''.join(packed)
892
893 @staticmethod
894 def unpack(reader):
895 obj = bsn_table_checksum_stats_entry()
896 obj.table_id = reader.read("!B")[0]
897 obj.checksum = reader.read("!Q")[0]
898 return obj
899
900 def __eq__(self, other):
901 if type(self) != type(other): return False
902 if self.table_id != other.table_id: return False
903 if self.checksum != other.checksum: return False
904 return True
905
906 def pretty_print(self, q):
907 q.text("bsn_table_checksum_stats_entry {")
908 with q.group():
909 with q.indent(2):
910 q.breakable()
911 q.text("table_id = ");
912 q.text("%#x" % self.table_id)
913 q.text(","); q.breakable()
914 q.text("checksum = ");
915 q.text("%#x" % self.checksum)
916 q.breakable()
917 q.text('}')
918
919
920class bsn_tlv_vlan_mac_list(loxi.OFObject):
921 type = 98
922
923 def __init__(self, key=None):
924 if key != None:
925 self.key = key
926 else:
927 self.key = []
928 return
929
930 def pack(self):
931 packed = []
932 packed.append(struct.pack("!H", self.type))
933 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
934 packed.append(loxi.generic_util.pack_list(self.key))
935 length = sum([len(x) for x in packed])
936 packed[1] = struct.pack("!H", length)
937 return ''.join(packed)
938
939 @staticmethod
940 def unpack(reader):
941 obj = bsn_tlv_vlan_mac_list()
942 _type = reader.read("!H")[0]
943 assert(_type == 98)
944 _length = reader.read("!H")[0]
945 orig_reader = reader
946 reader = orig_reader.slice(_length, 4)
947 obj.key = loxi.generic_util.unpack_list(reader, ofp.common.bsn_vlan_mac.unpack)
948 return obj
949
950 def __eq__(self, other):
951 if type(self) != type(other): return False
952 if self.key != other.key: return False
953 return True
954
955 def pretty_print(self, q):
956 q.text("bsn_tlv_vlan_mac_list {")
957 with q.group():
958 with q.indent(2):
959 q.breakable()
960 q.text("key = ");
961 q.pp(self.key)
962 q.breakable()
963 q.text('}')
964
965
966class bsn_vport(loxi.OFObject):
967 subtypes = {}
968
969
970 def __init__(self, type=None):
971 if type != None:
972 self.type = type
973 else:
974 self.type = 0
975 return
976
977 def pack(self):
978 packed = []
979 packed.append(struct.pack("!H", self.type))
980 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
981 length = sum([len(x) for x in packed])
982 packed[1] = struct.pack("!H", length)
983 return ''.join(packed)
984
985 @staticmethod
986 def unpack(reader):
987 subtype, = reader.peek('!H', 0)
988 subclass = bsn_vport.subtypes.get(subtype)
989 if subclass:
990 return subclass.unpack(reader)
991
992 obj = bsn_vport()
993 obj.type = reader.read("!H")[0]
994 _length = reader.read("!H")[0]
995 orig_reader = reader
996 reader = orig_reader.slice(_length, 4)
997 return obj
998
999 def __eq__(self, other):
1000 if type(self) != type(other): return False
1001 if self.type != other.type: return False
1002 return True
1003
1004 def pretty_print(self, q):
1005 q.text("bsn_vport {")
1006 with q.group():
1007 with q.indent(2):
1008 q.breakable()
1009 q.breakable()
1010 q.text('}')
1011
1012
1013class bsn_vlan_counter_stats_entry(loxi.OFObject):
1014
1015 def __init__(self, vlan_vid=None, values=None):
1016 if vlan_vid != None:
1017 self.vlan_vid = vlan_vid
1018 else:
1019 self.vlan_vid = 0
1020 if values != None:
1021 self.values = values
1022 else:
1023 self.values = []
1024 return
1025
1026 def pack(self):
1027 packed = []
1028 packed.append(struct.pack("!H", 0)) # placeholder for length at index 0
1029 packed.append(struct.pack("!H", self.vlan_vid))
1030 packed.append('\x00' * 4)
1031 packed.append(loxi.generic_util.pack_list(self.values))
1032 length = sum([len(x) for x in packed])
1033 packed[0] = struct.pack("!H", length)
1034 return ''.join(packed)
1035
1036 @staticmethod
1037 def unpack(reader):
1038 obj = bsn_vlan_counter_stats_entry()
1039 _length = reader.read("!H")[0]
1040 orig_reader = reader
1041 reader = orig_reader.slice(_length, 2)
1042 obj.vlan_vid = reader.read("!H")[0]
1043 reader.skip(4)
1044 obj.values = loxi.generic_util.unpack_list(reader, ofp.common.uint64.unpack)
1045 return obj
1046
1047 def __eq__(self, other):
1048 if type(self) != type(other): return False
1049 if self.vlan_vid != other.vlan_vid: return False
1050 if self.values != other.values: return False
1051 return True
1052
1053 def pretty_print(self, q):
1054 q.text("bsn_vlan_counter_stats_entry {")
1055 with q.group():
1056 with q.indent(2):
1057 q.breakable()
1058 q.text("vlan_vid = ");
1059 q.text("%#x" % self.vlan_vid)
1060 q.text(","); q.breakable()
1061 q.text("values = ");
1062 q.pp(self.values)
1063 q.breakable()
1064 q.text('}')
1065
1066
1067class bsn_vlan_mac(loxi.OFObject):
1068
1069 def __init__(self, vlan_vid=None, mac=None):
1070 if vlan_vid != None:
1071 self.vlan_vid = vlan_vid
1072 else:
1073 self.vlan_vid = 0
1074 if mac != None:
1075 self.mac = mac
1076 else:
1077 self.mac = [0,0,0,0,0,0]
1078 return
1079
1080 def pack(self):
1081 packed = []
1082 packed.append(struct.pack("!H", self.vlan_vid))
1083 packed.append(struct.pack("!6B", *self.mac))
1084 return ''.join(packed)
1085
1086 @staticmethod
1087 def unpack(reader):
1088 obj = bsn_vlan_mac()
1089 obj.vlan_vid = reader.read("!H")[0]
1090 obj.mac = list(reader.read('!6B'))
1091 return obj
1092
1093 def __eq__(self, other):
1094 if type(self) != type(other): return False
1095 if self.vlan_vid != other.vlan_vid: return False
1096 if self.mac != other.mac: return False
1097 return True
1098
1099 def pretty_print(self, q):
1100 q.text("bsn_vlan_mac {")
1101 with q.group():
1102 with q.indent(2):
1103 q.breakable()
1104 q.text("vlan_vid = ");
1105 q.text("%#x" % self.vlan_vid)
1106 q.text(","); q.breakable()
1107 q.text("mac = ");
1108 q.text(util.pretty_mac(self.mac))
1109 q.breakable()
1110 q.text('}')
1111
1112
1113class bsn_vport_l2gre(bsn_vport):
1114 type = 1
1115
1116 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):
1117 if flags != None:
1118 self.flags = flags
1119 else:
1120 self.flags = 0
1121 if port_no != None:
1122 self.port_no = port_no
1123 else:
1124 self.port_no = 0
1125 if loopback_port_no != None:
1126 self.loopback_port_no = loopback_port_no
1127 else:
1128 self.loopback_port_no = 0
1129 if local_mac != None:
1130 self.local_mac = local_mac
1131 else:
1132 self.local_mac = [0,0,0,0,0,0]
1133 if nh_mac != None:
1134 self.nh_mac = nh_mac
1135 else:
1136 self.nh_mac = [0,0,0,0,0,0]
1137 if src_ip != None:
1138 self.src_ip = src_ip
1139 else:
1140 self.src_ip = 0
1141 if dst_ip != None:
1142 self.dst_ip = dst_ip
1143 else:
1144 self.dst_ip = 0
1145 if dscp != None:
1146 self.dscp = dscp
1147 else:
1148 self.dscp = 0
1149 if ttl != None:
1150 self.ttl = ttl
1151 else:
1152 self.ttl = 0
1153 if vpn != None:
1154 self.vpn = vpn
1155 else:
1156 self.vpn = 0
1157 if rate_limit != None:
1158 self.rate_limit = rate_limit
1159 else:
1160 self.rate_limit = 0
1161 if if_name != None:
1162 self.if_name = if_name
1163 else:
1164 self.if_name = ""
1165 return
1166
1167 def pack(self):
1168 packed = []
1169 packed.append(struct.pack("!H", self.type))
1170 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1171 packed.append(struct.pack("!L", self.flags))
1172 packed.append(util.pack_port_no(self.port_no))
1173 packed.append(util.pack_port_no(self.loopback_port_no))
1174 packed.append(struct.pack("!6B", *self.local_mac))
1175 packed.append(struct.pack("!6B", *self.nh_mac))
1176 packed.append(struct.pack("!L", self.src_ip))
1177 packed.append(struct.pack("!L", self.dst_ip))
1178 packed.append(struct.pack("!B", self.dscp))
1179 packed.append(struct.pack("!B", self.ttl))
1180 packed.append('\x00' * 2)
1181 packed.append(struct.pack("!L", self.vpn))
1182 packed.append(struct.pack("!L", self.rate_limit))
1183 packed.append(struct.pack("!16s", self.if_name))
1184 length = sum([len(x) for x in packed])
1185 packed[1] = struct.pack("!H", length)
1186 return ''.join(packed)
1187
1188 @staticmethod
1189 def unpack(reader):
1190 obj = bsn_vport_l2gre()
1191 _type = reader.read("!H")[0]
1192 assert(_type == 1)
1193 _length = reader.read("!H")[0]
1194 orig_reader = reader
1195 reader = orig_reader.slice(_length, 4)
1196 obj.flags = reader.read("!L")[0]
1197 obj.port_no = util.unpack_port_no(reader)
1198 obj.loopback_port_no = util.unpack_port_no(reader)
1199 obj.local_mac = list(reader.read('!6B'))
1200 obj.nh_mac = list(reader.read('!6B'))
1201 obj.src_ip = reader.read("!L")[0]
1202 obj.dst_ip = reader.read("!L")[0]
1203 obj.dscp = reader.read("!B")[0]
1204 obj.ttl = reader.read("!B")[0]
1205 reader.skip(2)
1206 obj.vpn = reader.read("!L")[0]
1207 obj.rate_limit = reader.read("!L")[0]
1208 obj.if_name = reader.read("!16s")[0].rstrip("\x00")
1209 return obj
1210
1211 def __eq__(self, other):
1212 if type(self) != type(other): return False
1213 if self.flags != other.flags: return False
1214 if self.port_no != other.port_no: return False
1215 if self.loopback_port_no != other.loopback_port_no: return False
1216 if self.local_mac != other.local_mac: return False
1217 if self.nh_mac != other.nh_mac: return False
1218 if self.src_ip != other.src_ip: return False
1219 if self.dst_ip != other.dst_ip: return False
1220 if self.dscp != other.dscp: return False
1221 if self.ttl != other.ttl: return False
1222 if self.vpn != other.vpn: return False
1223 if self.rate_limit != other.rate_limit: return False
1224 if self.if_name != other.if_name: return False
1225 return True
1226
1227 def pretty_print(self, q):
1228 q.text("bsn_vport_l2gre {")
1229 with q.group():
1230 with q.indent(2):
1231 q.breakable()
1232 q.text("flags = ");
1233 q.text("%#x" % self.flags)
1234 q.text(","); q.breakable()
1235 q.text("port_no = ");
1236 q.text(util.pretty_port(self.port_no))
1237 q.text(","); q.breakable()
1238 q.text("loopback_port_no = ");
1239 q.text(util.pretty_port(self.loopback_port_no))
1240 q.text(","); q.breakable()
1241 q.text("local_mac = ");
1242 q.text(util.pretty_mac(self.local_mac))
1243 q.text(","); q.breakable()
1244 q.text("nh_mac = ");
1245 q.text(util.pretty_mac(self.nh_mac))
1246 q.text(","); q.breakable()
1247 q.text("src_ip = ");
1248 q.text(util.pretty_ipv4(self.src_ip))
1249 q.text(","); q.breakable()
1250 q.text("dst_ip = ");
1251 q.text(util.pretty_ipv4(self.dst_ip))
1252 q.text(","); q.breakable()
1253 q.text("dscp = ");
1254 q.text("%#x" % self.dscp)
1255 q.text(","); q.breakable()
1256 q.text("ttl = ");
1257 q.text("%#x" % self.ttl)
1258 q.text(","); q.breakable()
1259 q.text("vpn = ");
1260 q.text("%#x" % self.vpn)
1261 q.text(","); q.breakable()
1262 q.text("rate_limit = ");
1263 q.text("%#x" % self.rate_limit)
1264 q.text(","); q.breakable()
1265 q.text("if_name = ");
1266 q.pp(self.if_name)
1267 q.breakable()
1268 q.text('}')
1269
1270bsn_vport.subtypes[1] = bsn_vport_l2gre
1271
1272class bsn_vport_q_in_q(bsn_vport):
1273 type = 0
1274
1275 def __init__(self, port_no=None, ingress_tpid=None, ingress_vlan_id=None, egress_tpid=None, egress_vlan_id=None, if_name=None):
1276 if port_no != None:
1277 self.port_no = port_no
1278 else:
1279 self.port_no = 0
1280 if ingress_tpid != None:
1281 self.ingress_tpid = ingress_tpid
1282 else:
1283 self.ingress_tpid = 0
1284 if ingress_vlan_id != None:
1285 self.ingress_vlan_id = ingress_vlan_id
1286 else:
1287 self.ingress_vlan_id = 0
1288 if egress_tpid != None:
1289 self.egress_tpid = egress_tpid
1290 else:
1291 self.egress_tpid = 0
1292 if egress_vlan_id != None:
1293 self.egress_vlan_id = egress_vlan_id
1294 else:
1295 self.egress_vlan_id = 0
1296 if if_name != None:
1297 self.if_name = if_name
1298 else:
1299 self.if_name = ""
1300 return
1301
1302 def pack(self):
1303 packed = []
1304 packed.append(struct.pack("!H", self.type))
1305 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1306 packed.append(struct.pack("!L", self.port_no))
1307 packed.append(struct.pack("!H", self.ingress_tpid))
1308 packed.append(struct.pack("!H", self.ingress_vlan_id))
1309 packed.append(struct.pack("!H", self.egress_tpid))
1310 packed.append(struct.pack("!H", self.egress_vlan_id))
1311 packed.append(struct.pack("!16s", self.if_name))
1312 length = sum([len(x) for x in packed])
1313 packed[1] = struct.pack("!H", length)
1314 return ''.join(packed)
1315
1316 @staticmethod
1317 def unpack(reader):
1318 obj = bsn_vport_q_in_q()
1319 _type = reader.read("!H")[0]
1320 assert(_type == 0)
1321 _length = reader.read("!H")[0]
1322 orig_reader = reader
1323 reader = orig_reader.slice(_length, 4)
1324 obj.port_no = reader.read("!L")[0]
1325 obj.ingress_tpid = reader.read("!H")[0]
1326 obj.ingress_vlan_id = reader.read("!H")[0]
1327 obj.egress_tpid = reader.read("!H")[0]
1328 obj.egress_vlan_id = reader.read("!H")[0]
1329 obj.if_name = reader.read("!16s")[0].rstrip("\x00")
1330 return obj
1331
1332 def __eq__(self, other):
1333 if type(self) != type(other): return False
1334 if self.port_no != other.port_no: return False
1335 if self.ingress_tpid != other.ingress_tpid: return False
1336 if self.ingress_vlan_id != other.ingress_vlan_id: return False
1337 if self.egress_tpid != other.egress_tpid: return False
1338 if self.egress_vlan_id != other.egress_vlan_id: return False
1339 if self.if_name != other.if_name: return False
1340 return True
1341
1342 def pretty_print(self, q):
1343 q.text("bsn_vport_q_in_q {")
1344 with q.group():
1345 with q.indent(2):
1346 q.breakable()
1347 q.text("port_no = ");
1348 q.text("%#x" % self.port_no)
1349 q.text(","); q.breakable()
1350 q.text("ingress_tpid = ");
1351 q.text("%#x" % self.ingress_tpid)
1352 q.text(","); q.breakable()
1353 q.text("ingress_vlan_id = ");
1354 q.text("%#x" % self.ingress_vlan_id)
1355 q.text(","); q.breakable()
1356 q.text("egress_tpid = ");
1357 q.text("%#x" % self.egress_tpid)
1358 q.text(","); q.breakable()
1359 q.text("egress_vlan_id = ");
1360 q.text("%#x" % self.egress_vlan_id)
1361 q.text(","); q.breakable()
1362 q.text("if_name = ");
1363 q.pp(self.if_name)
1364 q.breakable()
1365 q.text('}')
1366
1367bsn_vport.subtypes[0] = bsn_vport_q_in_q
1368
1369class bsn_vrf_counter_stats_entry(loxi.OFObject):
1370
1371 def __init__(self, vrf=None, values=None):
1372 if vrf != None:
1373 self.vrf = vrf
1374 else:
1375 self.vrf = 0
1376 if values != None:
1377 self.values = values
1378 else:
1379 self.values = []
1380 return
1381
1382 def pack(self):
1383 packed = []
1384 packed.append(struct.pack("!H", 0)) # placeholder for length at index 0
1385 packed.append('\x00' * 2)
1386 packed.append(struct.pack("!L", self.vrf))
1387 packed.append(loxi.generic_util.pack_list(self.values))
1388 length = sum([len(x) for x in packed])
1389 packed[0] = struct.pack("!H", length)
1390 return ''.join(packed)
1391
1392 @staticmethod
1393 def unpack(reader):
1394 obj = bsn_vrf_counter_stats_entry()
1395 _length = reader.read("!H")[0]
1396 orig_reader = reader
1397 reader = orig_reader.slice(_length, 2)
1398 reader.skip(2)
1399 obj.vrf = reader.read("!L")[0]
1400 obj.values = loxi.generic_util.unpack_list(reader, ofp.common.uint64.unpack)
1401 return obj
1402
1403 def __eq__(self, other):
1404 if type(self) != type(other): return False
1405 if self.vrf != other.vrf: return False
1406 if self.values != other.values: return False
1407 return True
1408
1409 def pretty_print(self, q):
1410 q.text("bsn_vrf_counter_stats_entry {")
1411 with q.group():
1412 with q.indent(2):
1413 q.breakable()
1414 q.text("vrf = ");
1415 q.text("%#x" % self.vrf)
1416 q.text(","); q.breakable()
1417 q.text("values = ");
1418 q.pp(self.values)
1419 q.breakable()
1420 q.text('}')
1421
1422
1423class bucket(loxi.OFObject):
1424
1425 def __init__(self, weight=None, watch_port=None, watch_group=None, actions=None):
1426 if weight != None:
1427 self.weight = weight
1428 else:
1429 self.weight = 0
1430 if watch_port != None:
1431 self.watch_port = watch_port
1432 else:
1433 self.watch_port = 0
1434 if watch_group != None:
1435 self.watch_group = watch_group
1436 else:
1437 self.watch_group = 0
1438 if actions != None:
1439 self.actions = actions
1440 else:
1441 self.actions = []
1442 return
1443
1444 def pack(self):
1445 packed = []
1446 packed.append(struct.pack("!H", 0)) # placeholder for len at index 0
1447 packed.append(struct.pack("!H", self.weight))
1448 packed.append(util.pack_port_no(self.watch_port))
1449 packed.append(struct.pack("!L", self.watch_group))
1450 packed.append('\x00' * 4)
1451 packed.append(loxi.generic_util.pack_list(self.actions))
1452 length = sum([len(x) for x in packed])
1453 packed[0] = struct.pack("!H", length)
1454 return ''.join(packed)
1455
1456 @staticmethod
1457 def unpack(reader):
1458 obj = bucket()
1459 _len = reader.read("!H")[0]
1460 orig_reader = reader
1461 reader = orig_reader.slice(_len, 2)
1462 obj.weight = reader.read("!H")[0]
1463 obj.watch_port = util.unpack_port_no(reader)
1464 obj.watch_group = reader.read("!L")[0]
1465 reader.skip(4)
1466 obj.actions = loxi.generic_util.unpack_list(reader, ofp.action.action.unpack)
1467 return obj
1468
1469 def __eq__(self, other):
1470 if type(self) != type(other): return False
1471 if self.weight != other.weight: return False
1472 if self.watch_port != other.watch_port: return False
1473 if self.watch_group != other.watch_group: return False
1474 if self.actions != other.actions: return False
1475 return True
1476
1477 def pretty_print(self, q):
1478 q.text("bucket {")
1479 with q.group():
1480 with q.indent(2):
1481 q.breakable()
1482 q.text("weight = ");
1483 q.text("%#x" % self.weight)
1484 q.text(","); q.breakable()
1485 q.text("watch_port = ");
1486 q.text(util.pretty_port(self.watch_port))
1487 q.text(","); q.breakable()
1488 q.text("watch_group = ");
1489 q.text("%#x" % self.watch_group)
1490 q.text(","); q.breakable()
1491 q.text("actions = ");
1492 q.pp(self.actions)
1493 q.breakable()
1494 q.text('}')
1495
1496
1497class bucket_counter(loxi.OFObject):
1498
1499 def __init__(self, packet_count=None, byte_count=None):
1500 if packet_count != None:
1501 self.packet_count = packet_count
1502 else:
1503 self.packet_count = 0
1504 if byte_count != None:
1505 self.byte_count = byte_count
1506 else:
1507 self.byte_count = 0
1508 return
1509
1510 def pack(self):
1511 packed = []
1512 packed.append(struct.pack("!Q", self.packet_count))
1513 packed.append(struct.pack("!Q", self.byte_count))
1514 return ''.join(packed)
1515
1516 @staticmethod
1517 def unpack(reader):
1518 obj = bucket_counter()
1519 obj.packet_count = reader.read("!Q")[0]
1520 obj.byte_count = reader.read("!Q")[0]
1521 return obj
1522
1523 def __eq__(self, other):
1524 if type(self) != type(other): return False
1525 if self.packet_count != other.packet_count: return False
1526 if self.byte_count != other.byte_count: return False
1527 return True
1528
1529 def pretty_print(self, q):
1530 q.text("bucket_counter {")
1531 with q.group():
1532 with q.indent(2):
1533 q.breakable()
1534 q.text("packet_count = ");
1535 q.text("%#x" % self.packet_count)
1536 q.text(","); q.breakable()
1537 q.text("byte_count = ");
1538 q.text("%#x" % self.byte_count)
1539 q.breakable()
1540 q.text('}')
1541
1542
1543class flow_stats_entry(loxi.OFObject):
1544
1545 def __init__(self, table_id=None, duration_sec=None, duration_nsec=None, priority=None, idle_timeout=None, hard_timeout=None, flags=None, importance=None, cookie=None, packet_count=None, byte_count=None, match=None, instructions=None):
1546 if table_id != None:
1547 self.table_id = table_id
1548 else:
1549 self.table_id = 0
1550 if duration_sec != None:
1551 self.duration_sec = duration_sec
1552 else:
1553 self.duration_sec = 0
1554 if duration_nsec != None:
1555 self.duration_nsec = duration_nsec
1556 else:
1557 self.duration_nsec = 0
1558 if priority != None:
1559 self.priority = priority
1560 else:
1561 self.priority = 0
1562 if idle_timeout != None:
1563 self.idle_timeout = idle_timeout
1564 else:
1565 self.idle_timeout = 0
1566 if hard_timeout != None:
1567 self.hard_timeout = hard_timeout
1568 else:
1569 self.hard_timeout = 0
1570 if flags != None:
1571 self.flags = flags
1572 else:
1573 self.flags = 0
1574 if importance != None:
1575 self.importance = importance
1576 else:
1577 self.importance = 0
1578 if cookie != None:
1579 self.cookie = cookie
1580 else:
1581 self.cookie = 0
1582 if packet_count != None:
1583 self.packet_count = packet_count
1584 else:
1585 self.packet_count = 0
1586 if byte_count != None:
1587 self.byte_count = byte_count
1588 else:
1589 self.byte_count = 0
1590 if match != None:
1591 self.match = match
1592 else:
1593 self.match = ofp.match()
1594 if instructions != None:
1595 self.instructions = instructions
1596 else:
1597 self.instructions = []
1598 return
1599
1600 def pack(self):
1601 packed = []
1602 packed.append(struct.pack("!H", 0)) # placeholder for length at index 0
1603 packed.append(struct.pack("!B", self.table_id))
1604 packed.append('\x00' * 1)
1605 packed.append(struct.pack("!L", self.duration_sec))
1606 packed.append(struct.pack("!L", self.duration_nsec))
1607 packed.append(struct.pack("!H", self.priority))
1608 packed.append(struct.pack("!H", self.idle_timeout))
1609 packed.append(struct.pack("!H", self.hard_timeout))
1610 packed.append(struct.pack("!H", self.flags))
1611 packed.append(struct.pack("!H", self.importance))
1612 packed.append('\x00' * 2)
1613 packed.append(struct.pack("!Q", self.cookie))
1614 packed.append(struct.pack("!Q", self.packet_count))
1615 packed.append(struct.pack("!Q", self.byte_count))
1616 packed.append(self.match.pack())
1617 packed.append(loxi.generic_util.pack_list(self.instructions))
1618 length = sum([len(x) for x in packed])
1619 packed[0] = struct.pack("!H", length)
1620 return ''.join(packed)
1621
1622 @staticmethod
1623 def unpack(reader):
1624 obj = flow_stats_entry()
1625 _length = reader.read("!H")[0]
1626 orig_reader = reader
1627 reader = orig_reader.slice(_length, 2)
1628 obj.table_id = reader.read("!B")[0]
1629 reader.skip(1)
1630 obj.duration_sec = reader.read("!L")[0]
1631 obj.duration_nsec = reader.read("!L")[0]
1632 obj.priority = reader.read("!H")[0]
1633 obj.idle_timeout = reader.read("!H")[0]
1634 obj.hard_timeout = reader.read("!H")[0]
1635 obj.flags = reader.read("!H")[0]
1636 obj.importance = reader.read("!H")[0]
1637 reader.skip(2)
1638 obj.cookie = reader.read("!Q")[0]
1639 obj.packet_count = reader.read("!Q")[0]
1640 obj.byte_count = reader.read("!Q")[0]
1641 obj.match = ofp.match.unpack(reader)
1642 obj.instructions = loxi.generic_util.unpack_list(reader, ofp.instruction.instruction.unpack)
1643 return obj
1644
1645 def __eq__(self, other):
1646 if type(self) != type(other): return False
1647 if self.table_id != other.table_id: return False
1648 if self.duration_sec != other.duration_sec: return False
1649 if self.duration_nsec != other.duration_nsec: return False
1650 if self.priority != other.priority: return False
1651 if self.idle_timeout != other.idle_timeout: return False
1652 if self.hard_timeout != other.hard_timeout: return False
1653 if self.flags != other.flags: return False
1654 if self.importance != other.importance: return False
1655 if self.cookie != other.cookie: return False
1656 if self.packet_count != other.packet_count: return False
1657 if self.byte_count != other.byte_count: return False
1658 if self.match != other.match: return False
1659 if self.instructions != other.instructions: return False
1660 return True
1661
1662 def pretty_print(self, q):
1663 q.text("flow_stats_entry {")
1664 with q.group():
1665 with q.indent(2):
1666 q.breakable()
1667 q.text("table_id = ");
1668 q.text("%#x" % self.table_id)
1669 q.text(","); q.breakable()
1670 q.text("duration_sec = ");
1671 q.text("%#x" % self.duration_sec)
1672 q.text(","); q.breakable()
1673 q.text("duration_nsec = ");
1674 q.text("%#x" % self.duration_nsec)
1675 q.text(","); q.breakable()
1676 q.text("priority = ");
1677 q.text("%#x" % self.priority)
1678 q.text(","); q.breakable()
1679 q.text("idle_timeout = ");
1680 q.text("%#x" % self.idle_timeout)
1681 q.text(","); q.breakable()
1682 q.text("hard_timeout = ");
1683 q.text("%#x" % self.hard_timeout)
1684 q.text(","); q.breakable()
1685 q.text("flags = ");
1686 q.text("%#x" % self.flags)
1687 q.text(","); q.breakable()
1688 q.text("importance = ");
1689 q.text("%#x" % self.importance)
1690 q.text(","); q.breakable()
1691 q.text("cookie = ");
1692 q.text("%#x" % self.cookie)
1693 q.text(","); q.breakable()
1694 q.text("packet_count = ");
1695 q.text("%#x" % self.packet_count)
1696 q.text(","); q.breakable()
1697 q.text("byte_count = ");
1698 q.text("%#x" % self.byte_count)
1699 q.text(","); q.breakable()
1700 q.text("match = ");
1701 q.pp(self.match)
1702 q.text(","); q.breakable()
1703 q.text("instructions = ");
1704 q.pp(self.instructions)
1705 q.breakable()
1706 q.text('}')
1707
1708
1709class group_desc_stats_entry(loxi.OFObject):
1710
1711 def __init__(self, group_type=None, group_id=None, buckets=None):
1712 if group_type != None:
1713 self.group_type = group_type
1714 else:
1715 self.group_type = 0
1716 if group_id != None:
1717 self.group_id = group_id
1718 else:
1719 self.group_id = 0
1720 if buckets != None:
1721 self.buckets = buckets
1722 else:
1723 self.buckets = []
1724 return
1725
1726 def pack(self):
1727 packed = []
1728 packed.append(struct.pack("!H", 0)) # placeholder for length at index 0
1729 packed.append(struct.pack("!B", self.group_type))
1730 packed.append('\x00' * 1)
1731 packed.append(struct.pack("!L", self.group_id))
1732 packed.append(loxi.generic_util.pack_list(self.buckets))
1733 length = sum([len(x) for x in packed])
1734 packed[0] = struct.pack("!H", length)
1735 return ''.join(packed)
1736
1737 @staticmethod
1738 def unpack(reader):
1739 obj = group_desc_stats_entry()
1740 _length = reader.read("!H")[0]
1741 orig_reader = reader
1742 reader = orig_reader.slice(_length, 2)
1743 obj.group_type = reader.read("!B")[0]
1744 reader.skip(1)
1745 obj.group_id = reader.read("!L")[0]
1746 obj.buckets = loxi.generic_util.unpack_list(reader, ofp.common.bucket.unpack)
1747 return obj
1748
1749 def __eq__(self, other):
1750 if type(self) != type(other): return False
1751 if self.group_type != other.group_type: return False
1752 if self.group_id != other.group_id: return False
1753 if self.buckets != other.buckets: return False
1754 return True
1755
1756 def pretty_print(self, q):
1757 q.text("group_desc_stats_entry {")
1758 with q.group():
1759 with q.indent(2):
1760 q.breakable()
1761 q.text("group_type = ");
1762 q.text("%#x" % self.group_type)
1763 q.text(","); q.breakable()
1764 q.text("group_id = ");
1765 q.text("%#x" % self.group_id)
1766 q.text(","); q.breakable()
1767 q.text("buckets = ");
1768 q.pp(self.buckets)
1769 q.breakable()
1770 q.text('}')
1771
1772
1773class group_stats_entry(loxi.OFObject):
1774
1775 def __init__(self, group_id=None, ref_count=None, packet_count=None, byte_count=None, duration_sec=None, duration_nsec=None, bucket_stats=None):
1776 if group_id != None:
1777 self.group_id = group_id
1778 else:
1779 self.group_id = 0
1780 if ref_count != None:
1781 self.ref_count = ref_count
1782 else:
1783 self.ref_count = 0
1784 if packet_count != None:
1785 self.packet_count = packet_count
1786 else:
1787 self.packet_count = 0
1788 if byte_count != None:
1789 self.byte_count = byte_count
1790 else:
1791 self.byte_count = 0
1792 if duration_sec != None:
1793 self.duration_sec = duration_sec
1794 else:
1795 self.duration_sec = 0
1796 if duration_nsec != None:
1797 self.duration_nsec = duration_nsec
1798 else:
1799 self.duration_nsec = 0
1800 if bucket_stats != None:
1801 self.bucket_stats = bucket_stats
1802 else:
1803 self.bucket_stats = []
1804 return
1805
1806 def pack(self):
1807 packed = []
1808 packed.append(struct.pack("!H", 0)) # placeholder for length at index 0
1809 packed.append('\x00' * 2)
1810 packed.append(struct.pack("!L", self.group_id))
1811 packed.append(struct.pack("!L", self.ref_count))
1812 packed.append('\x00' * 4)
1813 packed.append(struct.pack("!Q", self.packet_count))
1814 packed.append(struct.pack("!Q", self.byte_count))
1815 packed.append(struct.pack("!L", self.duration_sec))
1816 packed.append(struct.pack("!L", self.duration_nsec))
1817 packed.append(loxi.generic_util.pack_list(self.bucket_stats))
1818 length = sum([len(x) for x in packed])
1819 packed[0] = struct.pack("!H", length)
1820 return ''.join(packed)
1821
1822 @staticmethod
1823 def unpack(reader):
1824 obj = group_stats_entry()
1825 _length = reader.read("!H")[0]
1826 orig_reader = reader
1827 reader = orig_reader.slice(_length, 2)
1828 reader.skip(2)
1829 obj.group_id = reader.read("!L")[0]
1830 obj.ref_count = reader.read("!L")[0]
1831 reader.skip(4)
1832 obj.packet_count = reader.read("!Q")[0]
1833 obj.byte_count = reader.read("!Q")[0]
1834 obj.duration_sec = reader.read("!L")[0]
1835 obj.duration_nsec = reader.read("!L")[0]
1836 obj.bucket_stats = loxi.generic_util.unpack_list(reader, ofp.common.bucket_counter.unpack)
1837 return obj
1838
1839 def __eq__(self, other):
1840 if type(self) != type(other): return False
1841 if self.group_id != other.group_id: return False
1842 if self.ref_count != other.ref_count: return False
1843 if self.packet_count != other.packet_count: return False
1844 if self.byte_count != other.byte_count: return False
1845 if self.duration_sec != other.duration_sec: return False
1846 if self.duration_nsec != other.duration_nsec: return False
1847 if self.bucket_stats != other.bucket_stats: return False
1848 return True
1849
1850 def pretty_print(self, q):
1851 q.text("group_stats_entry {")
1852 with q.group():
1853 with q.indent(2):
1854 q.breakable()
1855 q.text("group_id = ");
1856 q.text("%#x" % self.group_id)
1857 q.text(","); q.breakable()
1858 q.text("ref_count = ");
1859 q.text("%#x" % self.ref_count)
1860 q.text(","); q.breakable()
1861 q.text("packet_count = ");
1862 q.text("%#x" % self.packet_count)
1863 q.text(","); q.breakable()
1864 q.text("byte_count = ");
1865 q.text("%#x" % self.byte_count)
1866 q.text(","); q.breakable()
1867 q.text("duration_sec = ");
1868 q.text("%#x" % self.duration_sec)
1869 q.text(","); q.breakable()
1870 q.text("duration_nsec = ");
1871 q.text("%#x" % self.duration_nsec)
1872 q.text(","); q.breakable()
1873 q.text("bucket_stats = ");
1874 q.pp(self.bucket_stats)
1875 q.breakable()
1876 q.text('}')
1877
1878
1879class hello_elem(loxi.OFObject):
1880 subtypes = {}
1881
1882
1883 def __init__(self, type=None):
1884 if type != None:
1885 self.type = type
1886 else:
1887 self.type = 0
1888 return
1889
1890 def pack(self):
1891 packed = []
1892 packed.append(struct.pack("!H", self.type))
1893 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1894 length = sum([len(x) for x in packed])
1895 packed[1] = struct.pack("!H", length)
1896 return ''.join(packed)
1897
1898 @staticmethod
1899 def unpack(reader):
1900 subtype, = reader.peek('!H', 0)
1901 subclass = hello_elem.subtypes.get(subtype)
1902 if subclass:
1903 return subclass.unpack(reader)
1904
1905 obj = hello_elem()
1906 obj.type = reader.read("!H")[0]
1907 _length = reader.read("!H")[0]
1908 orig_reader = reader
1909 reader = orig_reader.slice(_length, 4)
1910 return obj
1911
1912 def __eq__(self, other):
1913 if type(self) != type(other): return False
1914 if self.type != other.type: return False
1915 return True
1916
1917 def pretty_print(self, q):
1918 q.text("hello_elem {")
1919 with q.group():
1920 with q.indent(2):
1921 q.breakable()
1922 q.breakable()
1923 q.text('}')
1924
1925
1926class hello_elem_versionbitmap(hello_elem):
1927 type = 1
1928
1929 def __init__(self, bitmaps=None):
1930 if bitmaps != None:
1931 self.bitmaps = bitmaps
1932 else:
1933 self.bitmaps = []
1934 return
1935
1936 def pack(self):
1937 packed = []
1938 packed.append(struct.pack("!H", self.type))
1939 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1940 packed.append(loxi.generic_util.pack_list(self.bitmaps))
1941 length = sum([len(x) for x in packed])
1942 packed[1] = struct.pack("!H", length)
1943 return ''.join(packed)
1944
1945 @staticmethod
1946 def unpack(reader):
1947 obj = hello_elem_versionbitmap()
1948 _type = reader.read("!H")[0]
1949 assert(_type == 1)
1950 _length = reader.read("!H")[0]
1951 orig_reader = reader
1952 reader = orig_reader.slice(_length, 4)
1953 obj.bitmaps = loxi.generic_util.unpack_list(reader, ofp.common.uint32.unpack)
1954 return obj
1955
1956 def __eq__(self, other):
1957 if type(self) != type(other): return False
1958 if self.bitmaps != other.bitmaps: return False
1959 return True
1960
1961 def pretty_print(self, q):
1962 q.text("hello_elem_versionbitmap {")
1963 with q.group():
1964 with q.indent(2):
1965 q.breakable()
1966 q.text("bitmaps = ");
1967 q.pp(self.bitmaps)
1968 q.breakable()
1969 q.text('}')
1970
1971hello_elem.subtypes[1] = hello_elem_versionbitmap
1972
1973class match_v3(loxi.OFObject):
1974 type = 1
1975
1976 def __init__(self, oxm_list=None):
1977 if oxm_list != None:
1978 self.oxm_list = oxm_list
1979 else:
1980 self.oxm_list = []
1981 return
1982
1983 def pack(self):
1984 packed = []
1985 packed.append(struct.pack("!H", self.type))
1986 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1987 packed.append(loxi.generic_util.pack_list(self.oxm_list))
1988 length = sum([len(x) for x in packed])
1989 packed[1] = struct.pack("!H", length)
1990 packed.append(loxi.generic_util.pad_to(8, length))
1991 return ''.join(packed)
1992
1993 @staticmethod
1994 def unpack(reader):
1995 obj = match_v3()
1996 _type = reader.read("!H")[0]
1997 assert(_type == 1)
1998 _length = reader.read("!H")[0]
1999 orig_reader = reader
2000 reader = orig_reader.slice(_length, 4)
2001 obj.oxm_list = loxi.generic_util.unpack_list(reader, ofp.oxm.oxm.unpack)
2002 orig_reader.skip_align()
2003 return obj
2004
2005 def __eq__(self, other):
2006 if type(self) != type(other): return False
2007 if self.oxm_list != other.oxm_list: return False
2008 return True
2009
2010 def pretty_print(self, q):
2011 q.text("match_v3 {")
2012 with q.group():
2013 with q.indent(2):
2014 q.breakable()
2015 q.text("oxm_list = ");
2016 q.pp(self.oxm_list)
2017 q.breakable()
2018 q.text('}')
2019
2020
2021class meter_band_stats(loxi.OFObject):
2022
2023 def __init__(self, packet_band_count=None, byte_band_count=None):
2024 if packet_band_count != None:
2025 self.packet_band_count = packet_band_count
2026 else:
2027 self.packet_band_count = 0
2028 if byte_band_count != None:
2029 self.byte_band_count = byte_band_count
2030 else:
2031 self.byte_band_count = 0
2032 return
2033
2034 def pack(self):
2035 packed = []
2036 packed.append(struct.pack("!Q", self.packet_band_count))
2037 packed.append(struct.pack("!Q", self.byte_band_count))
2038 return ''.join(packed)
2039
2040 @staticmethod
2041 def unpack(reader):
2042 obj = meter_band_stats()
2043 obj.packet_band_count = reader.read("!Q")[0]
2044 obj.byte_band_count = reader.read("!Q")[0]
2045 return obj
2046
2047 def __eq__(self, other):
2048 if type(self) != type(other): return False
2049 if self.packet_band_count != other.packet_band_count: return False
2050 if self.byte_band_count != other.byte_band_count: return False
2051 return True
2052
2053 def pretty_print(self, q):
2054 q.text("meter_band_stats {")
2055 with q.group():
2056 with q.indent(2):
2057 q.breakable()
2058 q.text("packet_band_count = ");
2059 q.text("%#x" % self.packet_band_count)
2060 q.text(","); q.breakable()
2061 q.text("byte_band_count = ");
2062 q.text("%#x" % self.byte_band_count)
2063 q.breakable()
2064 q.text('}')
2065
2066
2067class meter_config(loxi.OFObject):
2068
2069 def __init__(self, flags=None, meter_id=None, entries=None):
2070 if flags != None:
2071 self.flags = flags
2072 else:
2073 self.flags = 0
2074 if meter_id != None:
2075 self.meter_id = meter_id
2076 else:
2077 self.meter_id = 0
2078 if entries != None:
2079 self.entries = entries
2080 else:
2081 self.entries = []
2082 return
2083
2084 def pack(self):
2085 packed = []
2086 packed.append(struct.pack("!H", 0)) # placeholder for length at index 0
2087 packed.append(struct.pack("!H", self.flags))
2088 packed.append(struct.pack("!L", self.meter_id))
2089 packed.append(loxi.generic_util.pack_list(self.entries))
2090 length = sum([len(x) for x in packed])
2091 packed[0] = struct.pack("!H", length)
2092 return ''.join(packed)
2093
2094 @staticmethod
2095 def unpack(reader):
2096 obj = meter_config()
2097 _length = reader.read("!H")[0]
2098 orig_reader = reader
2099 reader = orig_reader.slice(_length, 2)
2100 obj.flags = reader.read("!H")[0]
2101 obj.meter_id = reader.read("!L")[0]
2102 obj.entries = loxi.generic_util.unpack_list(reader, ofp.meter_band.meter_band.unpack)
2103 return obj
2104
2105 def __eq__(self, other):
2106 if type(self) != type(other): return False
2107 if self.flags != other.flags: return False
2108 if self.meter_id != other.meter_id: return False
2109 if self.entries != other.entries: return False
2110 return True
2111
2112 def pretty_print(self, q):
2113 q.text("meter_config {")
2114 with q.group():
2115 with q.indent(2):
2116 q.breakable()
2117 q.text("flags = ");
2118 q.text("%#x" % self.flags)
2119 q.text(","); q.breakable()
2120 q.text("meter_id = ");
2121 q.text("%#x" % self.meter_id)
2122 q.text(","); q.breakable()
2123 q.text("entries = ");
2124 q.pp(self.entries)
2125 q.breakable()
2126 q.text('}')
2127
2128
2129class meter_features(loxi.OFObject):
2130
2131 def __init__(self, max_meter=None, band_types=None, capabilities=None, max_bands=None, max_color=None):
2132 if max_meter != None:
2133 self.max_meter = max_meter
2134 else:
2135 self.max_meter = 0
2136 if band_types != None:
2137 self.band_types = band_types
2138 else:
2139 self.band_types = 0
2140 if capabilities != None:
2141 self.capabilities = capabilities
2142 else:
2143 self.capabilities = 0
2144 if max_bands != None:
2145 self.max_bands = max_bands
2146 else:
2147 self.max_bands = 0
2148 if max_color != None:
2149 self.max_color = max_color
2150 else:
2151 self.max_color = 0
2152 return
2153
2154 def pack(self):
2155 packed = []
2156 packed.append(struct.pack("!L", self.max_meter))
2157 packed.append(struct.pack("!L", self.band_types))
2158 packed.append(struct.pack("!L", self.capabilities))
2159 packed.append(struct.pack("!B", self.max_bands))
2160 packed.append(struct.pack("!B", self.max_color))
2161 packed.append('\x00' * 2)
2162 return ''.join(packed)
2163
2164 @staticmethod
2165 def unpack(reader):
2166 obj = meter_features()
2167 obj.max_meter = reader.read("!L")[0]
2168 obj.band_types = reader.read("!L")[0]
2169 obj.capabilities = reader.read("!L")[0]
2170 obj.max_bands = reader.read("!B")[0]
2171 obj.max_color = reader.read("!B")[0]
2172 reader.skip(2)
2173 return obj
2174
2175 def __eq__(self, other):
2176 if type(self) != type(other): return False
2177 if self.max_meter != other.max_meter: return False
2178 if self.band_types != other.band_types: return False
2179 if self.capabilities != other.capabilities: return False
2180 if self.max_bands != other.max_bands: return False
2181 if self.max_color != other.max_color: return False
2182 return True
2183
2184 def pretty_print(self, q):
2185 q.text("meter_features {")
2186 with q.group():
2187 with q.indent(2):
2188 q.breakable()
2189 q.text("max_meter = ");
2190 q.text("%#x" % self.max_meter)
2191 q.text(","); q.breakable()
2192 q.text("band_types = ");
2193 q.text("%#x" % self.band_types)
2194 q.text(","); q.breakable()
2195 q.text("capabilities = ");
2196 q.text("%#x" % self.capabilities)
2197 q.text(","); q.breakable()
2198 q.text("max_bands = ");
2199 q.text("%#x" % self.max_bands)
2200 q.text(","); q.breakable()
2201 q.text("max_color = ");
2202 q.text("%#x" % self.max_color)
2203 q.breakable()
2204 q.text('}')
2205
2206
2207class meter_stats(loxi.OFObject):
2208
2209 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):
2210 if meter_id != None:
2211 self.meter_id = meter_id
2212 else:
2213 self.meter_id = 0
2214 if flow_count != None:
2215 self.flow_count = flow_count
2216 else:
2217 self.flow_count = 0
2218 if packet_in_count != None:
2219 self.packet_in_count = packet_in_count
2220 else:
2221 self.packet_in_count = 0
2222 if byte_in_count != None:
2223 self.byte_in_count = byte_in_count
2224 else:
2225 self.byte_in_count = 0
2226 if duration_sec != None:
2227 self.duration_sec = duration_sec
2228 else:
2229 self.duration_sec = 0
2230 if duration_nsec != None:
2231 self.duration_nsec = duration_nsec
2232 else:
2233 self.duration_nsec = 0
2234 if band_stats != None:
2235 self.band_stats = band_stats
2236 else:
2237 self.band_stats = []
2238 return
2239
2240 def pack(self):
2241 packed = []
2242 packed.append(struct.pack("!L", self.meter_id))
2243 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
2244 packed.append('\x00' * 6)
2245 packed.append(struct.pack("!L", self.flow_count))
2246 packed.append(struct.pack("!Q", self.packet_in_count))
2247 packed.append(struct.pack("!Q", self.byte_in_count))
2248 packed.append(struct.pack("!L", self.duration_sec))
2249 packed.append(struct.pack("!L", self.duration_nsec))
2250 packed.append(loxi.generic_util.pack_list(self.band_stats))
2251 length = sum([len(x) for x in packed])
2252 packed[1] = struct.pack("!H", length)
2253 return ''.join(packed)
2254
2255 @staticmethod
2256 def unpack(reader):
2257 obj = meter_stats()
2258 obj.meter_id = reader.read("!L")[0]
2259 _len = reader.read("!H")[0]
2260 orig_reader = reader
2261 reader = orig_reader.slice(_len, 6)
2262 reader.skip(6)
2263 obj.flow_count = reader.read("!L")[0]
2264 obj.packet_in_count = reader.read("!Q")[0]
2265 obj.byte_in_count = reader.read("!Q")[0]
2266 obj.duration_sec = reader.read("!L")[0]
2267 obj.duration_nsec = reader.read("!L")[0]
2268 obj.band_stats = loxi.generic_util.unpack_list(reader, ofp.common.meter_band_stats.unpack)
2269 return obj
2270
2271 def __eq__(self, other):
2272 if type(self) != type(other): return False
2273 if self.meter_id != other.meter_id: return False
2274 if self.flow_count != other.flow_count: return False
2275 if self.packet_in_count != other.packet_in_count: return False
2276 if self.byte_in_count != other.byte_in_count: return False
2277 if self.duration_sec != other.duration_sec: return False
2278 if self.duration_nsec != other.duration_nsec: return False
2279 if self.band_stats != other.band_stats: return False
2280 return True
2281
2282 def pretty_print(self, q):
2283 q.text("meter_stats {")
2284 with q.group():
2285 with q.indent(2):
2286 q.breakable()
2287 q.text("meter_id = ");
2288 q.text("%#x" % self.meter_id)
2289 q.text(","); q.breakable()
2290 q.text("flow_count = ");
2291 q.text("%#x" % self.flow_count)
2292 q.text(","); q.breakable()
2293 q.text("packet_in_count = ");
2294 q.text("%#x" % self.packet_in_count)
2295 q.text(","); q.breakable()
2296 q.text("byte_in_count = ");
2297 q.text("%#x" % self.byte_in_count)
2298 q.text(","); q.breakable()
2299 q.text("duration_sec = ");
2300 q.text("%#x" % self.duration_sec)
2301 q.text(","); q.breakable()
2302 q.text("duration_nsec = ");
2303 q.text("%#x" % self.duration_nsec)
2304 q.text(","); q.breakable()
2305 q.text("band_stats = ");
2306 q.pp(self.band_stats)
2307 q.breakable()
2308 q.text('}')
2309
2310
2311class packet_queue(loxi.OFObject):
2312
2313 def __init__(self, queue_id=None, port=None, properties=None):
2314 if queue_id != None:
2315 self.queue_id = queue_id
2316 else:
2317 self.queue_id = 0
2318 if port != None:
2319 self.port = port
2320 else:
2321 self.port = 0
2322 if properties != None:
2323 self.properties = properties
2324 else:
2325 self.properties = []
2326 return
2327
2328 def pack(self):
2329 packed = []
2330 packed.append(struct.pack("!L", self.queue_id))
2331 packed.append(util.pack_port_no(self.port))
2332 packed.append(struct.pack("!H", 0)) # placeholder for len at index 2
2333 packed.append('\x00' * 6)
2334 packed.append(loxi.generic_util.pack_list(self.properties))
2335 length = sum([len(x) for x in packed])
2336 packed[2] = struct.pack("!H", length)
2337 return ''.join(packed)
2338
2339 @staticmethod
2340 def unpack(reader):
2341 obj = packet_queue()
2342 obj.queue_id = reader.read("!L")[0]
2343 obj.port = util.unpack_port_no(reader)
2344 _len = reader.read("!H")[0]
2345 orig_reader = reader
2346 reader = orig_reader.slice(_len, 10)
2347 reader.skip(6)
2348 obj.properties = loxi.generic_util.unpack_list(reader, ofp.common.queue_prop.unpack)
2349 return obj
2350
2351 def __eq__(self, other):
2352 if type(self) != type(other): return False
2353 if self.queue_id != other.queue_id: return False
2354 if self.port != other.port: return False
2355 if self.properties != other.properties: return False
2356 return True
2357
2358 def pretty_print(self, q):
2359 q.text("packet_queue {")
2360 with q.group():
2361 with q.indent(2):
2362 q.breakable()
2363 q.text("queue_id = ");
2364 q.text("%#x" % self.queue_id)
2365 q.text(","); q.breakable()
2366 q.text("port = ");
2367 q.text(util.pretty_port(self.port))
2368 q.text(","); q.breakable()
2369 q.text("properties = ");
2370 q.pp(self.properties)
2371 q.breakable()
2372 q.text('}')
2373
2374
2375class port_desc(loxi.OFObject):
2376
2377 def __init__(self, port_no=None, hw_addr=None, name=None, config=None, state=None, properties=None):
2378 if port_no != None:
2379 self.port_no = port_no
2380 else:
2381 self.port_no = 0
2382 if hw_addr != None:
2383 self.hw_addr = hw_addr
2384 else:
2385 self.hw_addr = [0,0,0,0,0,0]
2386 if name != None:
2387 self.name = name
2388 else:
2389 self.name = ""
2390 if config != None:
2391 self.config = config
2392 else:
2393 self.config = 0
2394 if state != None:
2395 self.state = state
2396 else:
2397 self.state = 0
2398 if properties != None:
2399 self.properties = properties
2400 else:
2401 self.properties = []
2402 return
2403
2404 def pack(self):
2405 packed = []
2406 packed.append(util.pack_port_no(self.port_no))
2407 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2408 packed.append('\x00' * 2)
2409 packed.append(struct.pack("!6B", *self.hw_addr))
2410 packed.append('\x00' * 2)
2411 packed.append(struct.pack("!16s", self.name))
2412 packed.append(struct.pack("!L", self.config))
2413 packed.append(struct.pack("!L", self.state))
2414 packed.append(loxi.generic_util.pack_list(self.properties))
2415 length = sum([len(x) for x in packed])
2416 packed[1] = struct.pack("!H", length)
2417 return ''.join(packed)
2418
2419 @staticmethod
2420 def unpack(reader):
2421 obj = port_desc()
2422 obj.port_no = util.unpack_port_no(reader)
2423 _length = reader.read("!H")[0]
2424 orig_reader = reader
2425 reader = orig_reader.slice(_length, 6)
2426 reader.skip(2)
2427 obj.hw_addr = list(reader.read('!6B'))
2428 reader.skip(2)
2429 obj.name = reader.read("!16s")[0].rstrip("\x00")
2430 obj.config = reader.read("!L")[0]
2431 obj.state = reader.read("!L")[0]
2432 obj.properties = loxi.generic_util.unpack_list(reader, ofp.port_desc_prop.port_desc_prop.unpack)
2433 return obj
2434
2435 def __eq__(self, other):
2436 if type(self) != type(other): return False
2437 if self.port_no != other.port_no: return False
2438 if self.hw_addr != other.hw_addr: return False
2439 if self.name != other.name: return False
2440 if self.config != other.config: return False
2441 if self.state != other.state: return False
2442 if self.properties != other.properties: return False
2443 return True
2444
2445 def pretty_print(self, q):
2446 q.text("port_desc {")
2447 with q.group():
2448 with q.indent(2):
2449 q.breakable()
2450 q.text("port_no = ");
2451 q.text(util.pretty_port(self.port_no))
2452 q.text(","); q.breakable()
2453 q.text("hw_addr = ");
2454 q.text(util.pretty_mac(self.hw_addr))
2455 q.text(","); q.breakable()
2456 q.text("name = ");
2457 q.pp(self.name)
2458 q.text(","); q.breakable()
2459 q.text("config = ");
2460 q.text("%#x" % self.config)
2461 q.text(","); q.breakable()
2462 q.text("state = ");
2463 q.text("%#x" % self.state)
2464 q.text(","); q.breakable()
2465 q.text("properties = ");
2466 q.pp(self.properties)
2467 q.breakable()
2468 q.text('}')
2469
2470
2471class port_stats_entry(loxi.OFObject):
2472
2473 def __init__(self, port_no=None, duration_sec=None, duration_nsec=None, rx_packets=None, tx_packets=None, rx_bytes=None, tx_bytes=None, rx_dropped=None, tx_dropped=None, rx_errors=None, tx_errors=None, properties=None):
2474 if port_no != None:
2475 self.port_no = port_no
2476 else:
2477 self.port_no = 0
2478 if duration_sec != None:
2479 self.duration_sec = duration_sec
2480 else:
2481 self.duration_sec = 0
2482 if duration_nsec != None:
2483 self.duration_nsec = duration_nsec
2484 else:
2485 self.duration_nsec = 0
2486 if rx_packets != None:
2487 self.rx_packets = rx_packets
2488 else:
2489 self.rx_packets = 0
2490 if tx_packets != None:
2491 self.tx_packets = tx_packets
2492 else:
2493 self.tx_packets = 0
2494 if rx_bytes != None:
2495 self.rx_bytes = rx_bytes
2496 else:
2497 self.rx_bytes = 0
2498 if tx_bytes != None:
2499 self.tx_bytes = tx_bytes
2500 else:
2501 self.tx_bytes = 0
2502 if rx_dropped != None:
2503 self.rx_dropped = rx_dropped
2504 else:
2505 self.rx_dropped = 0
2506 if tx_dropped != None:
2507 self.tx_dropped = tx_dropped
2508 else:
2509 self.tx_dropped = 0
2510 if rx_errors != None:
2511 self.rx_errors = rx_errors
2512 else:
2513 self.rx_errors = 0
2514 if tx_errors != None:
2515 self.tx_errors = tx_errors
2516 else:
2517 self.tx_errors = 0
2518 if properties != None:
2519 self.properties = properties
2520 else:
2521 self.properties = []
2522 return
2523
2524 def pack(self):
2525 packed = []
2526 packed.append(struct.pack("!H", 0)) # placeholder for length at index 0
2527 packed.append('\x00' * 2)
2528 packed.append(util.pack_port_no(self.port_no))
2529 packed.append(struct.pack("!L", self.duration_sec))
2530 packed.append(struct.pack("!L", self.duration_nsec))
2531 packed.append(struct.pack("!Q", self.rx_packets))
2532 packed.append(struct.pack("!Q", self.tx_packets))
2533 packed.append(struct.pack("!Q", self.rx_bytes))
2534 packed.append(struct.pack("!Q", self.tx_bytes))
2535 packed.append(struct.pack("!Q", self.rx_dropped))
2536 packed.append(struct.pack("!Q", self.tx_dropped))
2537 packed.append(struct.pack("!Q", self.rx_errors))
2538 packed.append(struct.pack("!Q", self.tx_errors))
2539 packed.append(loxi.generic_util.pack_list(self.properties))
2540 length = sum([len(x) for x in packed])
2541 packed[0] = struct.pack("!H", length)
2542 return ''.join(packed)
2543
2544 @staticmethod
2545 def unpack(reader):
2546 obj = port_stats_entry()
2547 _length = reader.read("!H")[0]
2548 orig_reader = reader
2549 reader = orig_reader.slice(_length, 2)
2550 reader.skip(2)
2551 obj.port_no = util.unpack_port_no(reader)
2552 obj.duration_sec = reader.read("!L")[0]
2553 obj.duration_nsec = reader.read("!L")[0]
2554 obj.rx_packets = reader.read("!Q")[0]
2555 obj.tx_packets = reader.read("!Q")[0]
2556 obj.rx_bytes = reader.read("!Q")[0]
2557 obj.tx_bytes = reader.read("!Q")[0]
2558 obj.rx_dropped = reader.read("!Q")[0]
2559 obj.tx_dropped = reader.read("!Q")[0]
2560 obj.rx_errors = reader.read("!Q")[0]
2561 obj.tx_errors = reader.read("!Q")[0]
2562 obj.properties = loxi.generic_util.unpack_list(reader, ofp.port_stats_prop.port_stats_prop.unpack)
2563 return obj
2564
2565 def __eq__(self, other):
2566 if type(self) != type(other): return False
2567 if self.port_no != other.port_no: return False
2568 if self.duration_sec != other.duration_sec: return False
2569 if self.duration_nsec != other.duration_nsec: return False
2570 if self.rx_packets != other.rx_packets: return False
2571 if self.tx_packets != other.tx_packets: return False
2572 if self.rx_bytes != other.rx_bytes: return False
2573 if self.tx_bytes != other.tx_bytes: return False
2574 if self.rx_dropped != other.rx_dropped: return False
2575 if self.tx_dropped != other.tx_dropped: return False
2576 if self.rx_errors != other.rx_errors: return False
2577 if self.tx_errors != other.tx_errors: return False
2578 if self.properties != other.properties: return False
2579 return True
2580
2581 def pretty_print(self, q):
2582 q.text("port_stats_entry {")
2583 with q.group():
2584 with q.indent(2):
2585 q.breakable()
2586 q.text("port_no = ");
2587 q.text(util.pretty_port(self.port_no))
2588 q.text(","); q.breakable()
2589 q.text("duration_sec = ");
2590 q.text("%#x" % self.duration_sec)
2591 q.text(","); q.breakable()
2592 q.text("duration_nsec = ");
2593 q.text("%#x" % self.duration_nsec)
2594 q.text(","); q.breakable()
2595 q.text("rx_packets = ");
2596 q.text("%#x" % self.rx_packets)
2597 q.text(","); q.breakable()
2598 q.text("tx_packets = ");
2599 q.text("%#x" % self.tx_packets)
2600 q.text(","); q.breakable()
2601 q.text("rx_bytes = ");
2602 q.text("%#x" % self.rx_bytes)
2603 q.text(","); q.breakable()
2604 q.text("tx_bytes = ");
2605 q.text("%#x" % self.tx_bytes)
2606 q.text(","); q.breakable()
2607 q.text("rx_dropped = ");
2608 q.text("%#x" % self.rx_dropped)
2609 q.text(","); q.breakable()
2610 q.text("tx_dropped = ");
2611 q.text("%#x" % self.tx_dropped)
2612 q.text(","); q.breakable()
2613 q.text("rx_errors = ");
2614 q.text("%#x" % self.rx_errors)
2615 q.text(","); q.breakable()
2616 q.text("tx_errors = ");
2617 q.text("%#x" % self.tx_errors)
2618 q.text(","); q.breakable()
2619 q.text("properties = ");
2620 q.pp(self.properties)
2621 q.breakable()
2622 q.text('}')
2623
2624
2625class queue_desc(loxi.OFObject):
2626
2627 def __init__(self, port_no=None, queue_id=None, properties=None):
2628 if port_no != None:
2629 self.port_no = port_no
2630 else:
2631 self.port_no = 0
2632 if queue_id != None:
2633 self.queue_id = queue_id
2634 else:
2635 self.queue_id = 0
2636 if properties != None:
2637 self.properties = properties
2638 else:
2639 self.properties = []
2640 return
2641
2642 def pack(self):
2643 packed = []
2644 packed.append(struct.pack("!L", self.port_no))
2645 packed.append(struct.pack("!L", self.queue_id))
2646 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2647 packed.append('\x00' * 6)
2648 packed.append(loxi.generic_util.pack_list(self.properties))
2649 length = sum([len(x) for x in packed])
2650 packed[2] = struct.pack("!H", length)
2651 return ''.join(packed)
2652
2653 @staticmethod
2654 def unpack(reader):
2655 obj = queue_desc()
2656 obj.port_no = reader.read("!L")[0]
2657 obj.queue_id = reader.read("!L")[0]
2658 _length = reader.read("!H")[0]
2659 orig_reader = reader
2660 reader = orig_reader.slice(_length, 10)
2661 reader.skip(6)
2662 obj.properties = loxi.generic_util.unpack_list(reader, ofp.queue_desc_prop.queue_desc_prop.unpack)
2663 return obj
2664
2665 def __eq__(self, other):
2666 if type(self) != type(other): return False
2667 if self.port_no != other.port_no: return False
2668 if self.queue_id != other.queue_id: return False
2669 if self.properties != other.properties: return False
2670 return True
2671
2672 def pretty_print(self, q):
2673 q.text("queue_desc {")
2674 with q.group():
2675 with q.indent(2):
2676 q.breakable()
2677 q.text("port_no = ");
2678 q.text("%#x" % self.port_no)
2679 q.text(","); q.breakable()
2680 q.text("queue_id = ");
2681 q.text("%#x" % self.queue_id)
2682 q.text(","); q.breakable()
2683 q.text("properties = ");
2684 q.pp(self.properties)
2685 q.breakable()
2686 q.text('}')
2687
2688
2689class queue_prop(loxi.OFObject):
2690 subtypes = {}
2691
2692
2693 def __init__(self, type=None):
2694 if type != None:
2695 self.type = type
2696 else:
2697 self.type = 0
2698 return
2699
2700 def pack(self):
2701 packed = []
2702 packed.append(struct.pack("!H", self.type))
2703 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
2704 packed.append('\x00' * 4)
2705 length = sum([len(x) for x in packed])
2706 packed[1] = struct.pack("!H", length)
2707 return ''.join(packed)
2708
2709 @staticmethod
2710 def unpack(reader):
2711 subtype, = reader.peek('!H', 0)
2712 subclass = queue_prop.subtypes.get(subtype)
2713 if subclass:
2714 return subclass.unpack(reader)
2715
2716 obj = queue_prop()
2717 obj.type = reader.read("!H")[0]
2718 _len = reader.read("!H")[0]
2719 orig_reader = reader
2720 reader = orig_reader.slice(_len, 4)
2721 reader.skip(4)
2722 return obj
2723
2724 def __eq__(self, other):
2725 if type(self) != type(other): return False
2726 if self.type != other.type: return False
2727 return True
2728
2729 def pretty_print(self, q):
2730 q.text("queue_prop {")
2731 with q.group():
2732 with q.indent(2):
2733 q.breakable()
2734 q.breakable()
2735 q.text('}')
2736
2737
2738class queue_prop_experimenter(queue_prop):
2739 subtypes = {}
2740
2741 type = 65535
2742
2743 def __init__(self, experimenter=None, data=None):
2744 if experimenter != None:
2745 self.experimenter = experimenter
2746 else:
2747 self.experimenter = 0
2748 if data != None:
2749 self.data = data
2750 else:
2751 self.data = ''
2752 return
2753
2754 def pack(self):
2755 packed = []
2756 packed.append(struct.pack("!H", self.type))
2757 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
2758 packed.append('\x00' * 4)
2759 packed.append(struct.pack("!L", self.experimenter))
2760 packed.append('\x00' * 4)
2761 packed.append(self.data)
2762 length = sum([len(x) for x in packed])
2763 packed[1] = struct.pack("!H", length)
2764 return ''.join(packed)
2765
2766 @staticmethod
2767 def unpack(reader):
2768 subtype, = reader.peek('!L', 8)
2769 subclass = queue_prop_experimenter.subtypes.get(subtype)
2770 if subclass:
2771 return subclass.unpack(reader)
2772
2773 obj = queue_prop_experimenter()
2774 _type = reader.read("!H")[0]
2775 assert(_type == 65535)
2776 _len = reader.read("!H")[0]
2777 orig_reader = reader
2778 reader = orig_reader.slice(_len, 4)
2779 reader.skip(4)
2780 obj.experimenter = reader.read("!L")[0]
2781 reader.skip(4)
2782 obj.data = str(reader.read_all())
2783 return obj
2784
2785 def __eq__(self, other):
2786 if type(self) != type(other): return False
2787 if self.experimenter != other.experimenter: return False
2788 if self.data != other.data: return False
2789 return True
2790
2791 def pretty_print(self, q):
2792 q.text("queue_prop_experimenter {")
2793 with q.group():
2794 with q.indent(2):
2795 q.breakable()
2796 q.text("data = ");
2797 q.pp(self.data)
2798 q.breakable()
2799 q.text('}')
2800
2801queue_prop.subtypes[65535] = queue_prop_experimenter
2802
2803class queue_prop_max_rate(queue_prop):
2804 type = 2
2805
2806 def __init__(self, rate=None):
2807 if rate != None:
2808 self.rate = rate
2809 else:
2810 self.rate = 0
2811 return
2812
2813 def pack(self):
2814 packed = []
2815 packed.append(struct.pack("!H", self.type))
2816 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
2817 packed.append('\x00' * 4)
2818 packed.append(struct.pack("!H", self.rate))
2819 packed.append('\x00' * 6)
2820 length = sum([len(x) for x in packed])
2821 packed[1] = struct.pack("!H", length)
2822 return ''.join(packed)
2823
2824 @staticmethod
2825 def unpack(reader):
2826 obj = queue_prop_max_rate()
2827 _type = reader.read("!H")[0]
2828 assert(_type == 2)
2829 _len = reader.read("!H")[0]
2830 orig_reader = reader
2831 reader = orig_reader.slice(_len, 4)
2832 reader.skip(4)
2833 obj.rate = reader.read("!H")[0]
2834 reader.skip(6)
2835 return obj
2836
2837 def __eq__(self, other):
2838 if type(self) != type(other): return False
2839 if self.rate != other.rate: return False
2840 return True
2841
2842 def pretty_print(self, q):
2843 q.text("queue_prop_max_rate {")
2844 with q.group():
2845 with q.indent(2):
2846 q.breakable()
2847 q.text("rate = ");
2848 q.text("%#x" % self.rate)
2849 q.breakable()
2850 q.text('}')
2851
2852queue_prop.subtypes[2] = queue_prop_max_rate
2853
2854class queue_prop_min_rate(queue_prop):
2855 type = 1
2856
2857 def __init__(self, rate=None):
2858 if rate != None:
2859 self.rate = rate
2860 else:
2861 self.rate = 0
2862 return
2863
2864 def pack(self):
2865 packed = []
2866 packed.append(struct.pack("!H", self.type))
2867 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
2868 packed.append('\x00' * 4)
2869 packed.append(struct.pack("!H", self.rate))
2870 packed.append('\x00' * 6)
2871 length = sum([len(x) for x in packed])
2872 packed[1] = struct.pack("!H", length)
2873 return ''.join(packed)
2874
2875 @staticmethod
2876 def unpack(reader):
2877 obj = queue_prop_min_rate()
2878 _type = reader.read("!H")[0]
2879 assert(_type == 1)
2880 _len = reader.read("!H")[0]
2881 orig_reader = reader
2882 reader = orig_reader.slice(_len, 4)
2883 reader.skip(4)
2884 obj.rate = reader.read("!H")[0]
2885 reader.skip(6)
2886 return obj
2887
2888 def __eq__(self, other):
2889 if type(self) != type(other): return False
2890 if self.rate != other.rate: return False
2891 return True
2892
2893 def pretty_print(self, q):
2894 q.text("queue_prop_min_rate {")
2895 with q.group():
2896 with q.indent(2):
2897 q.breakable()
2898 q.text("rate = ");
2899 q.text("%#x" % self.rate)
2900 q.breakable()
2901 q.text('}')
2902
2903queue_prop.subtypes[1] = queue_prop_min_rate
2904
2905class queue_stats_entry(loxi.OFObject):
2906
2907 def __init__(self, port_no=None, queue_id=None, tx_bytes=None, tx_packets=None, tx_errors=None, duration_sec=None, duration_nsec=None, properties=None):
2908 if port_no != None:
2909 self.port_no = port_no
2910 else:
2911 self.port_no = 0
2912 if queue_id != None:
2913 self.queue_id = queue_id
2914 else:
2915 self.queue_id = 0
2916 if tx_bytes != None:
2917 self.tx_bytes = tx_bytes
2918 else:
2919 self.tx_bytes = 0
2920 if tx_packets != None:
2921 self.tx_packets = tx_packets
2922 else:
2923 self.tx_packets = 0
2924 if tx_errors != None:
2925 self.tx_errors = tx_errors
2926 else:
2927 self.tx_errors = 0
2928 if duration_sec != None:
2929 self.duration_sec = duration_sec
2930 else:
2931 self.duration_sec = 0
2932 if duration_nsec != None:
2933 self.duration_nsec = duration_nsec
2934 else:
2935 self.duration_nsec = 0
2936 if properties != None:
2937 self.properties = properties
2938 else:
2939 self.properties = []
2940 return
2941
2942 def pack(self):
2943 packed = []
2944 packed.append(struct.pack("!H", 0)) # placeholder for length at index 0
2945 packed.append('\x00' * 6)
2946 packed.append(util.pack_port_no(self.port_no))
2947 packed.append(struct.pack("!L", self.queue_id))
2948 packed.append(struct.pack("!Q", self.tx_bytes))
2949 packed.append(struct.pack("!Q", self.tx_packets))
2950 packed.append(struct.pack("!Q", self.tx_errors))
2951 packed.append(struct.pack("!L", self.duration_sec))
2952 packed.append(struct.pack("!L", self.duration_nsec))
2953 packed.append(loxi.generic_util.pack_list(self.properties))
2954 length = sum([len(x) for x in packed])
2955 packed[0] = struct.pack("!H", length)
2956 return ''.join(packed)
2957
2958 @staticmethod
2959 def unpack(reader):
2960 obj = queue_stats_entry()
2961 _length = reader.read("!H")[0]
2962 orig_reader = reader
2963 reader = orig_reader.slice(_length, 2)
2964 reader.skip(6)
2965 obj.port_no = util.unpack_port_no(reader)
2966 obj.queue_id = reader.read("!L")[0]
2967 obj.tx_bytes = reader.read("!Q")[0]
2968 obj.tx_packets = reader.read("!Q")[0]
2969 obj.tx_errors = reader.read("!Q")[0]
2970 obj.duration_sec = reader.read("!L")[0]
2971 obj.duration_nsec = reader.read("!L")[0]
2972 obj.properties = loxi.generic_util.unpack_list(reader, ofp.queue_stats_prop.queue_stats_prop.unpack)
2973 return obj
2974
2975 def __eq__(self, other):
2976 if type(self) != type(other): return False
2977 if self.port_no != other.port_no: return False
2978 if self.queue_id != other.queue_id: return False
2979 if self.tx_bytes != other.tx_bytes: return False
2980 if self.tx_packets != other.tx_packets: return False
2981 if self.tx_errors != other.tx_errors: return False
2982 if self.duration_sec != other.duration_sec: return False
2983 if self.duration_nsec != other.duration_nsec: return False
2984 if self.properties != other.properties: return False
2985 return True
2986
2987 def pretty_print(self, q):
2988 q.text("queue_stats_entry {")
2989 with q.group():
2990 with q.indent(2):
2991 q.breakable()
2992 q.text("port_no = ");
2993 q.text(util.pretty_port(self.port_no))
2994 q.text(","); q.breakable()
2995 q.text("queue_id = ");
2996 q.text("%#x" % self.queue_id)
2997 q.text(","); q.breakable()
2998 q.text("tx_bytes = ");
2999 q.text("%#x" % self.tx_bytes)
3000 q.text(","); q.breakable()
3001 q.text("tx_packets = ");
3002 q.text("%#x" % self.tx_packets)
3003 q.text(","); q.breakable()
3004 q.text("tx_errors = ");
3005 q.text("%#x" % self.tx_errors)
3006 q.text(","); q.breakable()
3007 q.text("duration_sec = ");
3008 q.text("%#x" % self.duration_sec)
3009 q.text(","); q.breakable()
3010 q.text("duration_nsec = ");
3011 q.text("%#x" % self.duration_nsec)
3012 q.text(","); q.breakable()
3013 q.text("properties = ");
3014 q.pp(self.properties)
3015 q.breakable()
3016 q.text('}')
3017
3018
3019class table_desc(loxi.OFObject):
3020
3021 def __init__(self, table_id=None, config=None):
3022 if table_id != None:
3023 self.table_id = table_id
3024 else:
3025 self.table_id = 0
3026 if config != None:
3027 self.config = config
3028 else:
3029 self.config = 0
3030 return
3031
3032 def pack(self):
3033 packed = []
3034 packed.append(struct.pack("!H", 0)) # placeholder for length at index 0
3035 packed.append(struct.pack("!B", self.table_id))
3036 packed.append('\x00' * 1)
3037 packed.append(struct.pack("!L", self.config))
3038 length = sum([len(x) for x in packed])
3039 packed[0] = struct.pack("!H", length)
3040 return ''.join(packed)
3041
3042 @staticmethod
3043 def unpack(reader):
3044 obj = table_desc()
3045 _length = reader.read("!H")[0]
3046 orig_reader = reader
3047 reader = orig_reader.slice(_length, 2)
3048 obj.table_id = reader.read("!B")[0]
3049 reader.skip(1)
3050 obj.config = reader.read("!L")[0]
3051 return obj
3052
3053 def __eq__(self, other):
3054 if type(self) != type(other): return False
3055 if self.table_id != other.table_id: return False
3056 if self.config != other.config: return False
3057 return True
3058
3059 def pretty_print(self, q):
3060 q.text("table_desc {")
3061 with q.group():
3062 with q.indent(2):
3063 q.breakable()
3064 q.text("table_id = ");
3065 q.text("%#x" % self.table_id)
3066 q.text(","); q.breakable()
3067 q.text("config = ");
3068 q.text("%#x" % self.config)
3069 q.breakable()
3070 q.text('}')
3071
3072
3073class table_feature_prop(loxi.OFObject):
3074 subtypes = {}
3075
3076
3077 def __init__(self, type=None):
3078 if type != None:
3079 self.type = type
3080 else:
3081 self.type = 0
3082 return
3083
3084 def pack(self):
3085 packed = []
3086 packed.append(struct.pack("!H", self.type))
3087 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3088 length = sum([len(x) for x in packed])
3089 packed[1] = struct.pack("!H", length)
3090 return ''.join(packed)
3091
3092 @staticmethod
3093 def unpack(reader):
3094 subtype, = reader.peek('!H', 0)
3095 subclass = table_feature_prop.subtypes.get(subtype)
3096 if subclass:
3097 return subclass.unpack(reader)
3098
3099 obj = table_feature_prop()
3100 obj.type = reader.read("!H")[0]
3101 _length = reader.read("!H")[0]
3102 orig_reader = reader
3103 reader = orig_reader.slice(_length, 4)
3104 return obj
3105
3106 def __eq__(self, other):
3107 if type(self) != type(other): return False
3108 if self.type != other.type: return False
3109 return True
3110
3111 def pretty_print(self, q):
3112 q.text("table_feature_prop {")
3113 with q.group():
3114 with q.indent(2):
3115 q.breakable()
3116 q.breakable()
3117 q.text('}')
3118
3119
3120class table_feature_prop_apply_actions(table_feature_prop):
3121 type = 6
3122
3123 def __init__(self, action_ids=None):
3124 if action_ids != None:
3125 self.action_ids = action_ids
3126 else:
3127 self.action_ids = []
3128 return
3129
3130 def pack(self):
3131 packed = []
3132 packed.append(struct.pack("!H", self.type))
3133 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3134 packed.append(loxi.generic_util.pack_list(self.action_ids))
3135 length = sum([len(x) for x in packed])
3136 packed[1] = struct.pack("!H", length)
3137 packed.append(loxi.generic_util.pad_to(8, length))
3138 return ''.join(packed)
3139
3140 @staticmethod
3141 def unpack(reader):
3142 obj = table_feature_prop_apply_actions()
3143 _type = reader.read("!H")[0]
3144 assert(_type == 6)
3145 _length = reader.read("!H")[0]
3146 orig_reader = reader
3147 reader = orig_reader.slice(_length, 4)
3148 obj.action_ids = loxi.generic_util.unpack_list(reader, ofp.action_id.action_id.unpack)
3149 orig_reader.skip_align()
3150 return obj
3151
3152 def __eq__(self, other):
3153 if type(self) != type(other): return False
3154 if self.action_ids != other.action_ids: return False
3155 return True
3156
3157 def pretty_print(self, q):
3158 q.text("table_feature_prop_apply_actions {")
3159 with q.group():
3160 with q.indent(2):
3161 q.breakable()
3162 q.text("action_ids = ");
3163 q.pp(self.action_ids)
3164 q.breakable()
3165 q.text('}')
3166
3167table_feature_prop.subtypes[6] = table_feature_prop_apply_actions
3168
3169class table_feature_prop_apply_actions_miss(table_feature_prop):
3170 type = 7
3171
3172 def __init__(self, action_ids=None):
3173 if action_ids != None:
3174 self.action_ids = action_ids
3175 else:
3176 self.action_ids = []
3177 return
3178
3179 def pack(self):
3180 packed = []
3181 packed.append(struct.pack("!H", self.type))
3182 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3183 packed.append(loxi.generic_util.pack_list(self.action_ids))
3184 length = sum([len(x) for x in packed])
3185 packed[1] = struct.pack("!H", length)
3186 packed.append(loxi.generic_util.pad_to(8, length))
3187 return ''.join(packed)
3188
3189 @staticmethod
3190 def unpack(reader):
3191 obj = table_feature_prop_apply_actions_miss()
3192 _type = reader.read("!H")[0]
3193 assert(_type == 7)
3194 _length = reader.read("!H")[0]
3195 orig_reader = reader
3196 reader = orig_reader.slice(_length, 4)
3197 obj.action_ids = loxi.generic_util.unpack_list(reader, ofp.action_id.action_id.unpack)
3198 orig_reader.skip_align()
3199 return obj
3200
3201 def __eq__(self, other):
3202 if type(self) != type(other): return False
3203 if self.action_ids != other.action_ids: return False
3204 return True
3205
3206 def pretty_print(self, q):
3207 q.text("table_feature_prop_apply_actions_miss {")
3208 with q.group():
3209 with q.indent(2):
3210 q.breakable()
3211 q.text("action_ids = ");
3212 q.pp(self.action_ids)
3213 q.breakable()
3214 q.text('}')
3215
3216table_feature_prop.subtypes[7] = table_feature_prop_apply_actions_miss
3217
3218class table_feature_prop_apply_setfield(table_feature_prop):
3219 type = 14
3220
3221 def __init__(self, oxm_ids=None):
3222 if oxm_ids != None:
3223 self.oxm_ids = oxm_ids
3224 else:
3225 self.oxm_ids = []
3226 return
3227
3228 def pack(self):
3229 packed = []
3230 packed.append(struct.pack("!H", self.type))
3231 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3232 packed.append(loxi.generic_util.pack_list(self.oxm_ids))
3233 length = sum([len(x) for x in packed])
3234 packed[1] = struct.pack("!H", length)
3235 packed.append(loxi.generic_util.pad_to(8, length))
3236 return ''.join(packed)
3237
3238 @staticmethod
3239 def unpack(reader):
3240 obj = table_feature_prop_apply_setfield()
3241 _type = reader.read("!H")[0]
3242 assert(_type == 14)
3243 _length = reader.read("!H")[0]
3244 orig_reader = reader
3245 reader = orig_reader.slice(_length, 4)
3246 obj.oxm_ids = loxi.generic_util.unpack_list(reader, ofp.common.uint32.unpack)
3247 orig_reader.skip_align()
3248 return obj
3249
3250 def __eq__(self, other):
3251 if type(self) != type(other): return False
3252 if self.oxm_ids != other.oxm_ids: return False
3253 return True
3254
3255 def pretty_print(self, q):
3256 q.text("table_feature_prop_apply_setfield {")
3257 with q.group():
3258 with q.indent(2):
3259 q.breakable()
3260 q.text("oxm_ids = ");
3261 q.pp(self.oxm_ids)
3262 q.breakable()
3263 q.text('}')
3264
3265table_feature_prop.subtypes[14] = table_feature_prop_apply_setfield
3266
3267class table_feature_prop_apply_setfield_miss(table_feature_prop):
3268 type = 15
3269
3270 def __init__(self, oxm_ids=None):
3271 if oxm_ids != None:
3272 self.oxm_ids = oxm_ids
3273 else:
3274 self.oxm_ids = []
3275 return
3276
3277 def pack(self):
3278 packed = []
3279 packed.append(struct.pack("!H", self.type))
3280 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3281 packed.append(loxi.generic_util.pack_list(self.oxm_ids))
3282 length = sum([len(x) for x in packed])
3283 packed[1] = struct.pack("!H", length)
3284 packed.append(loxi.generic_util.pad_to(8, length))
3285 return ''.join(packed)
3286
3287 @staticmethod
3288 def unpack(reader):
3289 obj = table_feature_prop_apply_setfield_miss()
3290 _type = reader.read("!H")[0]
3291 assert(_type == 15)
3292 _length = reader.read("!H")[0]
3293 orig_reader = reader
3294 reader = orig_reader.slice(_length, 4)
3295 obj.oxm_ids = loxi.generic_util.unpack_list(reader, ofp.common.uint32.unpack)
3296 orig_reader.skip_align()
3297 return obj
3298
3299 def __eq__(self, other):
3300 if type(self) != type(other): return False
3301 if self.oxm_ids != other.oxm_ids: return False
3302 return True
3303
3304 def pretty_print(self, q):
3305 q.text("table_feature_prop_apply_setfield_miss {")
3306 with q.group():
3307 with q.indent(2):
3308 q.breakable()
3309 q.text("oxm_ids = ");
3310 q.pp(self.oxm_ids)
3311 q.breakable()
3312 q.text('}')
3313
3314table_feature_prop.subtypes[15] = table_feature_prop_apply_setfield_miss
3315
3316class table_feature_prop_experimenter(table_feature_prop):
3317 subtypes = {}
3318
3319 type = 65534
3320
3321 def __init__(self, experimenter=None, subtype=None, experimenter_data=None):
3322 if experimenter != None:
3323 self.experimenter = experimenter
3324 else:
3325 self.experimenter = 0
3326 if subtype != None:
3327 self.subtype = subtype
3328 else:
3329 self.subtype = 0
3330 if experimenter_data != None:
3331 self.experimenter_data = experimenter_data
3332 else:
3333 self.experimenter_data = ''
3334 return
3335
3336 def pack(self):
3337 packed = []
3338 packed.append(struct.pack("!H", self.type))
3339 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3340 packed.append(struct.pack("!L", self.experimenter))
3341 packed.append(struct.pack("!L", self.subtype))
3342 packed.append(self.experimenter_data)
3343 length = sum([len(x) for x in packed])
3344 packed[1] = struct.pack("!H", length)
3345 packed.append(loxi.generic_util.pad_to(8, length))
3346 return ''.join(packed)
3347
3348 @staticmethod
3349 def unpack(reader):
3350 subtype, = reader.peek('!L', 4)
3351 subclass = table_feature_prop_experimenter.subtypes.get(subtype)
3352 if subclass:
3353 return subclass.unpack(reader)
3354
3355 obj = table_feature_prop_experimenter()
3356 _type = reader.read("!H")[0]
3357 assert(_type == 65534)
3358 _length = reader.read("!H")[0]
3359 orig_reader = reader
3360 reader = orig_reader.slice(_length, 4)
3361 obj.experimenter = reader.read("!L")[0]
3362 obj.subtype = reader.read("!L")[0]
3363 obj.experimenter_data = str(reader.read_all())
3364 orig_reader.skip_align()
3365 return obj
3366
3367 def __eq__(self, other):
3368 if type(self) != type(other): return False
3369 if self.experimenter != other.experimenter: return False
3370 if self.subtype != other.subtype: return False
3371 if self.experimenter_data != other.experimenter_data: return False
3372 return True
3373
3374 def pretty_print(self, q):
3375 q.text("table_feature_prop_experimenter {")
3376 with q.group():
3377 with q.indent(2):
3378 q.breakable()
3379 q.text("subtype = ");
3380 q.text("%#x" % self.subtype)
3381 q.text(","); q.breakable()
3382 q.text("experimenter_data = ");
3383 q.pp(self.experimenter_data)
3384 q.breakable()
3385 q.text('}')
3386
3387table_feature_prop.subtypes[65534] = table_feature_prop_experimenter
3388
3389class table_feature_prop_experimenter_miss(table_feature_prop):
3390 subtypes = {}
3391
3392 type = 65535
3393
3394 def __init__(self, experimenter=None, subtype=None, experimenter_data=None):
3395 if experimenter != None:
3396 self.experimenter = experimenter
3397 else:
3398 self.experimenter = 0
3399 if subtype != None:
3400 self.subtype = subtype
3401 else:
3402 self.subtype = 0
3403 if experimenter_data != None:
3404 self.experimenter_data = experimenter_data
3405 else:
3406 self.experimenter_data = ''
3407 return
3408
3409 def pack(self):
3410 packed = []
3411 packed.append(struct.pack("!H", self.type))
3412 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3413 packed.append(struct.pack("!L", self.experimenter))
3414 packed.append(struct.pack("!L", self.subtype))
3415 packed.append(self.experimenter_data)
3416 length = sum([len(x) for x in packed])
3417 packed[1] = struct.pack("!H", length)
3418 packed.append(loxi.generic_util.pad_to(8, length))
3419 return ''.join(packed)
3420
3421 @staticmethod
3422 def unpack(reader):
3423 subtype, = reader.peek('!L', 4)
3424 subclass = table_feature_prop_experimenter_miss.subtypes.get(subtype)
3425 if subclass:
3426 return subclass.unpack(reader)
3427
3428 obj = table_feature_prop_experimenter_miss()
3429 _type = reader.read("!H")[0]
3430 assert(_type == 65535)
3431 _length = reader.read("!H")[0]
3432 orig_reader = reader
3433 reader = orig_reader.slice(_length, 4)
3434 obj.experimenter = reader.read("!L")[0]
3435 obj.subtype = reader.read("!L")[0]
3436 obj.experimenter_data = str(reader.read_all())
3437 orig_reader.skip_align()
3438 return obj
3439
3440 def __eq__(self, other):
3441 if type(self) != type(other): return False
3442 if self.experimenter != other.experimenter: return False
3443 if self.subtype != other.subtype: return False
3444 if self.experimenter_data != other.experimenter_data: return False
3445 return True
3446
3447 def pretty_print(self, q):
3448 q.text("table_feature_prop_experimenter_miss {")
3449 with q.group():
3450 with q.indent(2):
3451 q.breakable()
3452 q.text("subtype = ");
3453 q.text("%#x" % self.subtype)
3454 q.text(","); q.breakable()
3455 q.text("experimenter_data = ");
3456 q.pp(self.experimenter_data)
3457 q.breakable()
3458 q.text('}')
3459
3460table_feature_prop.subtypes[65535] = table_feature_prop_experimenter_miss
3461
3462class table_feature_prop_instructions(table_feature_prop):
3463 type = 0
3464
3465 def __init__(self, instruction_ids=None):
3466 if instruction_ids != None:
3467 self.instruction_ids = instruction_ids
3468 else:
3469 self.instruction_ids = []
3470 return
3471
3472 def pack(self):
3473 packed = []
3474 packed.append(struct.pack("!H", self.type))
3475 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3476 packed.append(loxi.generic_util.pack_list(self.instruction_ids))
3477 length = sum([len(x) for x in packed])
3478 packed[1] = struct.pack("!H", length)
3479 packed.append(loxi.generic_util.pad_to(8, length))
3480 return ''.join(packed)
3481
3482 @staticmethod
3483 def unpack(reader):
3484 obj = table_feature_prop_instructions()
3485 _type = reader.read("!H")[0]
3486 assert(_type == 0)
3487 _length = reader.read("!H")[0]
3488 orig_reader = reader
3489 reader = orig_reader.slice(_length, 4)
3490 obj.instruction_ids = loxi.generic_util.unpack_list(reader, ofp.instruction_id.instruction_id.unpack)
3491 orig_reader.skip_align()
3492 return obj
3493
3494 def __eq__(self, other):
3495 if type(self) != type(other): return False
3496 if self.instruction_ids != other.instruction_ids: return False
3497 return True
3498
3499 def pretty_print(self, q):
3500 q.text("table_feature_prop_instructions {")
3501 with q.group():
3502 with q.indent(2):
3503 q.breakable()
3504 q.text("instruction_ids = ");
3505 q.pp(self.instruction_ids)
3506 q.breakable()
3507 q.text('}')
3508
3509table_feature_prop.subtypes[0] = table_feature_prop_instructions
3510
3511class table_feature_prop_instructions_miss(table_feature_prop):
3512 type = 1
3513
3514 def __init__(self, instruction_ids=None):
3515 if instruction_ids != None:
3516 self.instruction_ids = instruction_ids
3517 else:
3518 self.instruction_ids = []
3519 return
3520
3521 def pack(self):
3522 packed = []
3523 packed.append(struct.pack("!H", self.type))
3524 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3525 packed.append(loxi.generic_util.pack_list(self.instruction_ids))
3526 length = sum([len(x) for x in packed])
3527 packed[1] = struct.pack("!H", length)
3528 packed.append(loxi.generic_util.pad_to(8, length))
3529 return ''.join(packed)
3530
3531 @staticmethod
3532 def unpack(reader):
3533 obj = table_feature_prop_instructions_miss()
3534 _type = reader.read("!H")[0]
3535 assert(_type == 1)
3536 _length = reader.read("!H")[0]
3537 orig_reader = reader
3538 reader = orig_reader.slice(_length, 4)
3539 obj.instruction_ids = loxi.generic_util.unpack_list(reader, ofp.instruction_id.instruction_id.unpack)
3540 orig_reader.skip_align()
3541 return obj
3542
3543 def __eq__(self, other):
3544 if type(self) != type(other): return False
3545 if self.instruction_ids != other.instruction_ids: return False
3546 return True
3547
3548 def pretty_print(self, q):
3549 q.text("table_feature_prop_instructions_miss {")
3550 with q.group():
3551 with q.indent(2):
3552 q.breakable()
3553 q.text("instruction_ids = ");
3554 q.pp(self.instruction_ids)
3555 q.breakable()
3556 q.text('}')
3557
3558table_feature_prop.subtypes[1] = table_feature_prop_instructions_miss
3559
3560class table_feature_prop_match(table_feature_prop):
3561 type = 8
3562
3563 def __init__(self, oxm_ids=None):
3564 if oxm_ids != None:
3565 self.oxm_ids = oxm_ids
3566 else:
3567 self.oxm_ids = []
3568 return
3569
3570 def pack(self):
3571 packed = []
3572 packed.append(struct.pack("!H", self.type))
3573 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3574 packed.append(loxi.generic_util.pack_list(self.oxm_ids))
3575 length = sum([len(x) for x in packed])
3576 packed[1] = struct.pack("!H", length)
3577 packed.append(loxi.generic_util.pad_to(8, length))
3578 return ''.join(packed)
3579
3580 @staticmethod
3581 def unpack(reader):
3582 obj = table_feature_prop_match()
3583 _type = reader.read("!H")[0]
3584 assert(_type == 8)
3585 _length = reader.read("!H")[0]
3586 orig_reader = reader
3587 reader = orig_reader.slice(_length, 4)
3588 obj.oxm_ids = loxi.generic_util.unpack_list(reader, ofp.common.uint32.unpack)
3589 orig_reader.skip_align()
3590 return obj
3591
3592 def __eq__(self, other):
3593 if type(self) != type(other): return False
3594 if self.oxm_ids != other.oxm_ids: return False
3595 return True
3596
3597 def pretty_print(self, q):
3598 q.text("table_feature_prop_match {")
3599 with q.group():
3600 with q.indent(2):
3601 q.breakable()
3602 q.text("oxm_ids = ");
3603 q.pp(self.oxm_ids)
3604 q.breakable()
3605 q.text('}')
3606
3607table_feature_prop.subtypes[8] = table_feature_prop_match
3608
3609class table_feature_prop_next_tables(table_feature_prop):
3610 type = 2
3611
3612 def __init__(self, next_table_ids=None):
3613 if next_table_ids != None:
3614 self.next_table_ids = next_table_ids
3615 else:
3616 self.next_table_ids = []
3617 return
3618
3619 def pack(self):
3620 packed = []
3621 packed.append(struct.pack("!H", self.type))
3622 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3623 packed.append(loxi.generic_util.pack_list(self.next_table_ids))
3624 length = sum([len(x) for x in packed])
3625 packed[1] = struct.pack("!H", length)
3626 packed.append(loxi.generic_util.pad_to(8, length))
3627 return ''.join(packed)
3628
3629 @staticmethod
3630 def unpack(reader):
3631 obj = table_feature_prop_next_tables()
3632 _type = reader.read("!H")[0]
3633 assert(_type == 2)
3634 _length = reader.read("!H")[0]
3635 orig_reader = reader
3636 reader = orig_reader.slice(_length, 4)
3637 obj.next_table_ids = loxi.generic_util.unpack_list(reader, ofp.common.uint8.unpack)
3638 orig_reader.skip_align()
3639 return obj
3640
3641 def __eq__(self, other):
3642 if type(self) != type(other): return False
3643 if self.next_table_ids != other.next_table_ids: return False
3644 return True
3645
3646 def pretty_print(self, q):
3647 q.text("table_feature_prop_next_tables {")
3648 with q.group():
3649 with q.indent(2):
3650 q.breakable()
3651 q.text("next_table_ids = ");
3652 q.pp(self.next_table_ids)
3653 q.breakable()
3654 q.text('}')
3655
3656table_feature_prop.subtypes[2] = table_feature_prop_next_tables
3657
3658class table_feature_prop_next_tables_miss(table_feature_prop):
3659 type = 3
3660
3661 def __init__(self, next_table_ids=None):
3662 if next_table_ids != None:
3663 self.next_table_ids = next_table_ids
3664 else:
3665 self.next_table_ids = []
3666 return
3667
3668 def pack(self):
3669 packed = []
3670 packed.append(struct.pack("!H", self.type))
3671 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3672 packed.append(loxi.generic_util.pack_list(self.next_table_ids))
3673 length = sum([len(x) for x in packed])
3674 packed[1] = struct.pack("!H", length)
3675 packed.append(loxi.generic_util.pad_to(8, length))
3676 return ''.join(packed)
3677
3678 @staticmethod
3679 def unpack(reader):
3680 obj = table_feature_prop_next_tables_miss()
3681 _type = reader.read("!H")[0]
3682 assert(_type == 3)
3683 _length = reader.read("!H")[0]
3684 orig_reader = reader
3685 reader = orig_reader.slice(_length, 4)
3686 obj.next_table_ids = loxi.generic_util.unpack_list(reader, ofp.common.uint8.unpack)
3687 orig_reader.skip_align()
3688 return obj
3689
3690 def __eq__(self, other):
3691 if type(self) != type(other): return False
3692 if self.next_table_ids != other.next_table_ids: return False
3693 return True
3694
3695 def pretty_print(self, q):
3696 q.text("table_feature_prop_next_tables_miss {")
3697 with q.group():
3698 with q.indent(2):
3699 q.breakable()
3700 q.text("next_table_ids = ");
3701 q.pp(self.next_table_ids)
3702 q.breakable()
3703 q.text('}')
3704
3705table_feature_prop.subtypes[3] = table_feature_prop_next_tables_miss
3706
3707class table_feature_prop_table_sync_from(table_feature_prop):
3708 type = 16
3709
3710 def __init__(self, table_ids=None):
3711 if table_ids != None:
3712 self.table_ids = table_ids
3713 else:
3714 self.table_ids = []
3715 return
3716
3717 def pack(self):
3718 packed = []
3719 packed.append(struct.pack("!H", self.type))
3720 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3721 packed.append(loxi.generic_util.pack_list(self.table_ids))
3722 length = sum([len(x) for x in packed])
3723 packed[1] = struct.pack("!H", length)
3724 packed.append(loxi.generic_util.pad_to(8, length))
3725 return ''.join(packed)
3726
3727 @staticmethod
3728 def unpack(reader):
3729 obj = table_feature_prop_table_sync_from()
3730 _type = reader.read("!H")[0]
3731 assert(_type == 16)
3732 _length = reader.read("!H")[0]
3733 orig_reader = reader
3734 reader = orig_reader.slice(_length, 4)
3735 obj.table_ids = loxi.generic_util.unpack_list(reader, ofp.common.uint8.unpack)
3736 orig_reader.skip_align()
3737 return obj
3738
3739 def __eq__(self, other):
3740 if type(self) != type(other): return False
3741 if self.table_ids != other.table_ids: return False
3742 return True
3743
3744 def pretty_print(self, q):
3745 q.text("table_feature_prop_table_sync_from {")
3746 with q.group():
3747 with q.indent(2):
3748 q.breakable()
3749 q.text("table_ids = ");
3750 q.pp(self.table_ids)
3751 q.breakable()
3752 q.text('}')
3753
3754table_feature_prop.subtypes[16] = table_feature_prop_table_sync_from
3755
3756class table_feature_prop_wildcards(table_feature_prop):
3757 type = 10
3758
3759 def __init__(self, oxm_ids=None):
3760 if oxm_ids != None:
3761 self.oxm_ids = oxm_ids
3762 else:
3763 self.oxm_ids = []
3764 return
3765
3766 def pack(self):
3767 packed = []
3768 packed.append(struct.pack("!H", self.type))
3769 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3770 packed.append(loxi.generic_util.pack_list(self.oxm_ids))
3771 length = sum([len(x) for x in packed])
3772 packed[1] = struct.pack("!H", length)
3773 packed.append(loxi.generic_util.pad_to(8, length))
3774 return ''.join(packed)
3775
3776 @staticmethod
3777 def unpack(reader):
3778 obj = table_feature_prop_wildcards()
3779 _type = reader.read("!H")[0]
3780 assert(_type == 10)
3781 _length = reader.read("!H")[0]
3782 orig_reader = reader
3783 reader = orig_reader.slice(_length, 4)
3784 obj.oxm_ids = loxi.generic_util.unpack_list(reader, ofp.common.uint32.unpack)
3785 orig_reader.skip_align()
3786 return obj
3787
3788 def __eq__(self, other):
3789 if type(self) != type(other): return False
3790 if self.oxm_ids != other.oxm_ids: return False
3791 return True
3792
3793 def pretty_print(self, q):
3794 q.text("table_feature_prop_wildcards {")
3795 with q.group():
3796 with q.indent(2):
3797 q.breakable()
3798 q.text("oxm_ids = ");
3799 q.pp(self.oxm_ids)
3800 q.breakable()
3801 q.text('}')
3802
3803table_feature_prop.subtypes[10] = table_feature_prop_wildcards
3804
3805class table_feature_prop_write_actions(table_feature_prop):
3806 type = 4
3807
3808 def __init__(self, action_ids=None):
3809 if action_ids != None:
3810 self.action_ids = action_ids
3811 else:
3812 self.action_ids = []
3813 return
3814
3815 def pack(self):
3816 packed = []
3817 packed.append(struct.pack("!H", self.type))
3818 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3819 packed.append(loxi.generic_util.pack_list(self.action_ids))
3820 length = sum([len(x) for x in packed])
3821 packed[1] = struct.pack("!H", length)
3822 packed.append(loxi.generic_util.pad_to(8, length))
3823 return ''.join(packed)
3824
3825 @staticmethod
3826 def unpack(reader):
3827 obj = table_feature_prop_write_actions()
3828 _type = reader.read("!H")[0]
3829 assert(_type == 4)
3830 _length = reader.read("!H")[0]
3831 orig_reader = reader
3832 reader = orig_reader.slice(_length, 4)
3833 obj.action_ids = loxi.generic_util.unpack_list(reader, ofp.action_id.action_id.unpack)
3834 orig_reader.skip_align()
3835 return obj
3836
3837 def __eq__(self, other):
3838 if type(self) != type(other): return False
3839 if self.action_ids != other.action_ids: return False
3840 return True
3841
3842 def pretty_print(self, q):
3843 q.text("table_feature_prop_write_actions {")
3844 with q.group():
3845 with q.indent(2):
3846 q.breakable()
3847 q.text("action_ids = ");
3848 q.pp(self.action_ids)
3849 q.breakable()
3850 q.text('}')
3851
3852table_feature_prop.subtypes[4] = table_feature_prop_write_actions
3853
3854class table_feature_prop_write_actions_miss(table_feature_prop):
3855 type = 5
3856
3857 def __init__(self, action_ids=None):
3858 if action_ids != None:
3859 self.action_ids = action_ids
3860 else:
3861 self.action_ids = []
3862 return
3863
3864 def pack(self):
3865 packed = []
3866 packed.append(struct.pack("!H", self.type))
3867 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3868 packed.append(loxi.generic_util.pack_list(self.action_ids))
3869 length = sum([len(x) for x in packed])
3870 packed[1] = struct.pack("!H", length)
3871 packed.append(loxi.generic_util.pad_to(8, length))
3872 return ''.join(packed)
3873
3874 @staticmethod
3875 def unpack(reader):
3876 obj = table_feature_prop_write_actions_miss()
3877 _type = reader.read("!H")[0]
3878 assert(_type == 5)
3879 _length = reader.read("!H")[0]
3880 orig_reader = reader
3881 reader = orig_reader.slice(_length, 4)
3882 obj.action_ids = loxi.generic_util.unpack_list(reader, ofp.action_id.action_id.unpack)
3883 orig_reader.skip_align()
3884 return obj
3885
3886 def __eq__(self, other):
3887 if type(self) != type(other): return False
3888 if self.action_ids != other.action_ids: return False
3889 return True
3890
3891 def pretty_print(self, q):
3892 q.text("table_feature_prop_write_actions_miss {")
3893 with q.group():
3894 with q.indent(2):
3895 q.breakable()
3896 q.text("action_ids = ");
3897 q.pp(self.action_ids)
3898 q.breakable()
3899 q.text('}')
3900
3901table_feature_prop.subtypes[5] = table_feature_prop_write_actions_miss
3902
3903class table_feature_prop_write_setfield(table_feature_prop):
3904 type = 12
3905
3906 def __init__(self, oxm_ids=None):
3907 if oxm_ids != None:
3908 self.oxm_ids = oxm_ids
3909 else:
3910 self.oxm_ids = []
3911 return
3912
3913 def pack(self):
3914 packed = []
3915 packed.append(struct.pack("!H", self.type))
3916 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3917 packed.append(loxi.generic_util.pack_list(self.oxm_ids))
3918 length = sum([len(x) for x in packed])
3919 packed[1] = struct.pack("!H", length)
3920 packed.append(loxi.generic_util.pad_to(8, length))
3921 return ''.join(packed)
3922
3923 @staticmethod
3924 def unpack(reader):
3925 obj = table_feature_prop_write_setfield()
3926 _type = reader.read("!H")[0]
3927 assert(_type == 12)
3928 _length = reader.read("!H")[0]
3929 orig_reader = reader
3930 reader = orig_reader.slice(_length, 4)
3931 obj.oxm_ids = loxi.generic_util.unpack_list(reader, ofp.common.uint32.unpack)
3932 orig_reader.skip_align()
3933 return obj
3934
3935 def __eq__(self, other):
3936 if type(self) != type(other): return False
3937 if self.oxm_ids != other.oxm_ids: return False
3938 return True
3939
3940 def pretty_print(self, q):
3941 q.text("table_feature_prop_write_setfield {")
3942 with q.group():
3943 with q.indent(2):
3944 q.breakable()
3945 q.text("oxm_ids = ");
3946 q.pp(self.oxm_ids)
3947 q.breakable()
3948 q.text('}')
3949
3950table_feature_prop.subtypes[12] = table_feature_prop_write_setfield
3951
3952class table_feature_prop_write_setfield_miss(table_feature_prop):
3953 type = 13
3954
3955 def __init__(self, oxm_ids=None):
3956 if oxm_ids != None:
3957 self.oxm_ids = oxm_ids
3958 else:
3959 self.oxm_ids = []
3960 return
3961
3962 def pack(self):
3963 packed = []
3964 packed.append(struct.pack("!H", self.type))
3965 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3966 packed.append(loxi.generic_util.pack_list(self.oxm_ids))
3967 length = sum([len(x) for x in packed])
3968 packed[1] = struct.pack("!H", length)
3969 packed.append(loxi.generic_util.pad_to(8, length))
3970 return ''.join(packed)
3971
3972 @staticmethod
3973 def unpack(reader):
3974 obj = table_feature_prop_write_setfield_miss()
3975 _type = reader.read("!H")[0]
3976 assert(_type == 13)
3977 _length = reader.read("!H")[0]
3978 orig_reader = reader
3979 reader = orig_reader.slice(_length, 4)
3980 obj.oxm_ids = loxi.generic_util.unpack_list(reader, ofp.common.uint32.unpack)
3981 orig_reader.skip_align()
3982 return obj
3983
3984 def __eq__(self, other):
3985 if type(self) != type(other): return False
3986 if self.oxm_ids != other.oxm_ids: return False
3987 return True
3988
3989 def pretty_print(self, q):
3990 q.text("table_feature_prop_write_setfield_miss {")
3991 with q.group():
3992 with q.indent(2):
3993 q.breakable()
3994 q.text("oxm_ids = ");
3995 q.pp(self.oxm_ids)
3996 q.breakable()
3997 q.text('}')
3998
3999table_feature_prop.subtypes[13] = table_feature_prop_write_setfield_miss
4000
4001class table_features(loxi.OFObject):
4002
4003 def __init__(self, table_id=None, name=None, metadata_match=None, metadata_write=None, config=None, max_entries=None, properties=None):
4004 if table_id != None:
4005 self.table_id = table_id
4006 else:
4007 self.table_id = 0
4008 if name != None:
4009 self.name = name
4010 else:
4011 self.name = ""
4012 if metadata_match != None:
4013 self.metadata_match = metadata_match
4014 else:
4015 self.metadata_match = 0
4016 if metadata_write != None:
4017 self.metadata_write = metadata_write
4018 else:
4019 self.metadata_write = 0
4020 if config != None:
4021 self.config = config
4022 else:
4023 self.config = 0
4024 if max_entries != None:
4025 self.max_entries = max_entries
4026 else:
4027 self.max_entries = 0
4028 if properties != None:
4029 self.properties = properties
4030 else:
4031 self.properties = []
4032 return
4033
4034 def pack(self):
4035 packed = []
4036 packed.append(struct.pack("!H", 0)) # placeholder for length at index 0
4037 packed.append(struct.pack("!B", self.table_id))
4038 packed.append('\x00' * 5)
4039 packed.append(struct.pack("!32s", self.name))
4040 packed.append(struct.pack("!Q", self.metadata_match))
4041 packed.append(struct.pack("!Q", self.metadata_write))
4042 packed.append(struct.pack("!L", self.config))
4043 packed.append(struct.pack("!L", self.max_entries))
4044 packed.append(loxi.generic_util.pack_list(self.properties))
4045 length = sum([len(x) for x in packed])
4046 packed[0] = struct.pack("!H", length)
4047 return ''.join(packed)
4048
4049 @staticmethod
4050 def unpack(reader):
4051 obj = table_features()
4052 _length = reader.read("!H")[0]
4053 orig_reader = reader
4054 reader = orig_reader.slice(_length, 2)
4055 obj.table_id = reader.read("!B")[0]
4056 reader.skip(5)
4057 obj.name = reader.read("!32s")[0].rstrip("\x00")
4058 obj.metadata_match = reader.read("!Q")[0]
4059 obj.metadata_write = reader.read("!Q")[0]
4060 obj.config = reader.read("!L")[0]
4061 obj.max_entries = reader.read("!L")[0]
4062 obj.properties = loxi.generic_util.unpack_list(reader, ofp.common.table_feature_prop.unpack)
4063 return obj
4064
4065 def __eq__(self, other):
4066 if type(self) != type(other): return False
4067 if self.table_id != other.table_id: return False
4068 if self.name != other.name: return False
4069 if self.metadata_match != other.metadata_match: return False
4070 if self.metadata_write != other.metadata_write: return False
4071 if self.config != other.config: return False
4072 if self.max_entries != other.max_entries: return False
4073 if self.properties != other.properties: return False
4074 return True
4075
4076 def pretty_print(self, q):
4077 q.text("table_features {")
4078 with q.group():
4079 with q.indent(2):
4080 q.breakable()
4081 q.text("table_id = ");
4082 q.text("%#x" % self.table_id)
4083 q.text(","); q.breakable()
4084 q.text("name = ");
4085 q.pp(self.name)
4086 q.text(","); q.breakable()
4087 q.text("metadata_match = ");
4088 q.text("%#x" % self.metadata_match)
4089 q.text(","); q.breakable()
4090 q.text("metadata_write = ");
4091 q.text("%#x" % self.metadata_write)
4092 q.text(","); q.breakable()
4093 q.text("config = ");
4094 q.text("%#x" % self.config)
4095 q.text(","); q.breakable()
4096 q.text("max_entries = ");
4097 q.text("%#x" % self.max_entries)
4098 q.text(","); q.breakable()
4099 q.text("properties = ");
4100 q.pp(self.properties)
4101 q.breakable()
4102 q.text('}')
4103
4104
4105class table_mod_prop_eviction(loxi.OFObject):
4106 type = 2
4107
4108 def __init__(self, flags=None):
4109 if flags != None:
4110 self.flags = flags
4111 else:
4112 self.flags = 0
4113 return
4114
4115 def pack(self):
4116 packed = []
4117 packed.append(struct.pack("!H", self.type))
4118 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
4119 packed.append(struct.pack("!L", self.flags))
4120 length = sum([len(x) for x in packed])
4121 packed[1] = struct.pack("!H", length)
4122 return ''.join(packed)
4123
4124 @staticmethod
4125 def unpack(reader):
4126 obj = table_mod_prop_eviction()
4127 _type = reader.read("!H")[0]
4128 assert(_type == 2)
4129 _length = reader.read("!H")[0]
4130 orig_reader = reader
4131 reader = orig_reader.slice(_length, 4)
4132 obj.flags = reader.read("!L")[0]
4133 return obj
4134
4135 def __eq__(self, other):
4136 if type(self) != type(other): return False
4137 if self.flags != other.flags: return False
4138 return True
4139
4140 def pretty_print(self, q):
4141 q.text("table_mod_prop_eviction {")
4142 with q.group():
4143 with q.indent(2):
4144 q.breakable()
4145 q.text("flags = ");
4146 q.text("%#x" % self.flags)
4147 q.breakable()
4148 q.text('}')
4149
4150
4151class table_mod_prop_experimenter(loxi.OFObject):
4152 subtypes = {}
4153
4154 type = 65535
4155
4156 def __init__(self, experimenter=None, exp_type=None):
4157 if experimenter != None:
4158 self.experimenter = experimenter
4159 else:
4160 self.experimenter = 0
4161 if exp_type != None:
4162 self.exp_type = exp_type
4163 else:
4164 self.exp_type = 0
4165 return
4166
4167 def pack(self):
4168 packed = []
4169 packed.append(struct.pack("!H", self.type))
4170 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
4171 packed.append(struct.pack("!L", self.experimenter))
4172 packed.append(struct.pack("!L", self.exp_type))
4173 length = sum([len(x) for x in packed])
4174 packed[1] = struct.pack("!H", length)
4175 return ''.join(packed)
4176
4177 @staticmethod
4178 def unpack(reader):
4179 subtype, = reader.peek('!L', 4)
4180 subclass = table_mod_prop_experimenter.subtypes.get(subtype)
4181 if subclass:
4182 return subclass.unpack(reader)
4183
4184 obj = table_mod_prop_experimenter()
4185 _type = reader.read("!H")[0]
4186 assert(_type == 65535)
4187 _length = reader.read("!H")[0]
4188 orig_reader = reader
4189 reader = orig_reader.slice(_length, 4)
4190 obj.experimenter = reader.read("!L")[0]
4191 obj.exp_type = reader.read("!L")[0]
4192 return obj
4193
4194 def __eq__(self, other):
4195 if type(self) != type(other): return False
4196 if self.experimenter != other.experimenter: return False
4197 if self.exp_type != other.exp_type: return False
4198 return True
4199
4200 def pretty_print(self, q):
4201 q.text("table_mod_prop_experimenter {")
4202 with q.group():
4203 with q.indent(2):
4204 q.breakable()
4205 q.text("exp_type = ");
4206 q.text("%#x" % self.exp_type)
4207 q.breakable()
4208 q.text('}')
4209
4210
4211class table_mod_prop_vacancy(loxi.OFObject):
4212 type = 3
4213
4214 def __init__(self, vacancy_down=None, vacancy_up=None, vacancy=None):
4215 if vacancy_down != None:
4216 self.vacancy_down = vacancy_down
4217 else:
4218 self.vacancy_down = 0
4219 if vacancy_up != None:
4220 self.vacancy_up = vacancy_up
4221 else:
4222 self.vacancy_up = 0
4223 if vacancy != None:
4224 self.vacancy = vacancy
4225 else:
4226 self.vacancy = 0
4227 return
4228
4229 def pack(self):
4230 packed = []
4231 packed.append(struct.pack("!H", self.type))
4232 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
4233 packed.append(struct.pack("!B", self.vacancy_down))
4234 packed.append(struct.pack("!B", self.vacancy_up))
4235 packed.append(struct.pack("!B", self.vacancy))
4236 packed.append('\x00' * 1)
4237 length = sum([len(x) for x in packed])
4238 packed[1] = struct.pack("!H", length)
4239 return ''.join(packed)
4240
4241 @staticmethod
4242 def unpack(reader):
4243 obj = table_mod_prop_vacancy()
4244 _type = reader.read("!H")[0]
4245 assert(_type == 3)
4246 _length = reader.read("!H")[0]
4247 orig_reader = reader
4248 reader = orig_reader.slice(_length, 4)
4249 obj.vacancy_down = reader.read("!B")[0]
4250 obj.vacancy_up = reader.read("!B")[0]
4251 obj.vacancy = reader.read("!B")[0]
4252 reader.skip(1)
4253 return obj
4254
4255 def __eq__(self, other):
4256 if type(self) != type(other): return False
4257 if self.vacancy_down != other.vacancy_down: return False
4258 if self.vacancy_up != other.vacancy_up: return False
4259 if self.vacancy != other.vacancy: return False
4260 return True
4261
4262 def pretty_print(self, q):
4263 q.text("table_mod_prop_vacancy {")
4264 with q.group():
4265 with q.indent(2):
4266 q.breakable()
4267 q.text("vacancy_down = ");
4268 q.text("%#x" % self.vacancy_down)
4269 q.text(","); q.breakable()
4270 q.text("vacancy_up = ");
4271 q.text("%#x" % self.vacancy_up)
4272 q.text(","); q.breakable()
4273 q.text("vacancy = ");
4274 q.text("%#x" % self.vacancy)
4275 q.breakable()
4276 q.text('}')
4277
4278
4279class table_stats_entry(loxi.OFObject):
4280
4281 def __init__(self, table_id=None, active_count=None, lookup_count=None, matched_count=None):
4282 if table_id != None:
4283 self.table_id = table_id
4284 else:
4285 self.table_id = 0
4286 if active_count != None:
4287 self.active_count = active_count
4288 else:
4289 self.active_count = 0
4290 if lookup_count != None:
4291 self.lookup_count = lookup_count
4292 else:
4293 self.lookup_count = 0
4294 if matched_count != None:
4295 self.matched_count = matched_count
4296 else:
4297 self.matched_count = 0
4298 return
4299
4300 def pack(self):
4301 packed = []
4302 packed.append(struct.pack("!B", self.table_id))
4303 packed.append('\x00' * 3)
4304 packed.append(struct.pack("!L", self.active_count))
4305 packed.append(struct.pack("!Q", self.lookup_count))
4306 packed.append(struct.pack("!Q", self.matched_count))
4307 return ''.join(packed)
4308
4309 @staticmethod
4310 def unpack(reader):
4311 obj = table_stats_entry()
4312 obj.table_id = reader.read("!B")[0]
4313 reader.skip(3)
4314 obj.active_count = reader.read("!L")[0]
4315 obj.lookup_count = reader.read("!Q")[0]
4316 obj.matched_count = reader.read("!Q")[0]
4317 return obj
4318
4319 def __eq__(self, other):
4320 if type(self) != type(other): return False
4321 if self.table_id != other.table_id: return False
4322 if self.active_count != other.active_count: return False
4323 if self.lookup_count != other.lookup_count: return False
4324 if self.matched_count != other.matched_count: return False
4325 return True
4326
4327 def pretty_print(self, q):
4328 q.text("table_stats_entry {")
4329 with q.group():
4330 with q.indent(2):
4331 q.breakable()
4332 q.text("table_id = ");
4333 q.text("%#x" % self.table_id)
4334 q.text(","); q.breakable()
4335 q.text("active_count = ");
4336 q.text("%#x" % self.active_count)
4337 q.text(","); q.breakable()
4338 q.text("lookup_count = ");
4339 q.text("%#x" % self.lookup_count)
4340 q.text(","); q.breakable()
4341 q.text("matched_count = ");
4342 q.text("%#x" % self.matched_count)
4343 q.breakable()
4344 q.text('}')
4345
4346
4347class uint32(loxi.OFObject):
4348
4349 def __init__(self, value=None):
4350 if value != None:
4351 self.value = value
4352 else:
4353 self.value = 0
4354 return
4355
4356 def pack(self):
4357 packed = []
4358 packed.append(struct.pack("!L", self.value))
4359 return ''.join(packed)
4360
4361 @staticmethod
4362 def unpack(reader):
4363 obj = uint32()
4364 obj.value = reader.read("!L")[0]
4365 return obj
4366
4367 def __eq__(self, other):
4368 if type(self) != type(other): return False
4369 if self.value != other.value: return False
4370 return True
4371
4372 def pretty_print(self, q):
4373 q.text("uint32 {")
4374 with q.group():
4375 with q.indent(2):
4376 q.breakable()
4377 q.text("value = ");
4378 q.text("%#x" % self.value)
4379 q.breakable()
4380 q.text('}')
4381
4382
4383class uint64(loxi.OFObject):
4384
4385 def __init__(self, value=None):
4386 if value != None:
4387 self.value = value
4388 else:
4389 self.value = 0
4390 return
4391
4392 def pack(self):
4393 packed = []
4394 packed.append(struct.pack("!Q", self.value))
4395 return ''.join(packed)
4396
4397 @staticmethod
4398 def unpack(reader):
4399 obj = uint64()
4400 obj.value = reader.read("!Q")[0]
4401 return obj
4402
4403 def __eq__(self, other):
4404 if type(self) != type(other): return False
4405 if self.value != other.value: return False
4406 return True
4407
4408 def pretty_print(self, q):
4409 q.text("uint64 {")
4410 with q.group():
4411 with q.indent(2):
4412 q.breakable()
4413 q.text("value = ");
4414 q.text("%#x" % self.value)
4415 q.breakable()
4416 q.text('}')
4417
4418
4419class uint8(loxi.OFObject):
4420
4421 def __init__(self, value=None):
4422 if value != None:
4423 self.value = value
4424 else:
4425 self.value = 0
4426 return
4427
4428 def pack(self):
4429 packed = []
4430 packed.append(struct.pack("!B", self.value))
4431 return ''.join(packed)
4432
4433 @staticmethod
4434 def unpack(reader):
4435 obj = uint8()
4436 obj.value = reader.read("!B")[0]
4437 return obj
4438
4439 def __eq__(self, other):
4440 if type(self) != type(other): return False
4441 if self.value != other.value: return False
4442 return True
4443
4444 def pretty_print(self, q):
4445 q.text("uint8 {")
4446 with q.group():
4447 with q.indent(2):
4448 q.breakable()
4449 q.text("value = ");
4450 q.text("%#x" % self.value)
4451 q.breakable()
4452 q.text('}')
4453
4454
4455
4456match = match_v3