Initial set of Fabric switch test cases
Change-Id: I86fd2b67d3b773aa496f5ef61f1e1fdf51fd9925
diff --git a/Fabric/Utilities/src/python/loxi/of13/common.py b/Fabric/Utilities/src/python/loxi/of13/common.py
new file mode 100644
index 0000000..f5c06a4
--- /dev/null
+++ b/Fabric/Utilities/src/python/loxi/of13/common.py
@@ -0,0 +1,4066 @@
+
+# Copyright 2017-present Open Networking Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+
+# Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
+# Copyright (c) 2011, 2012 Open Networking Foundation
+# Copyright (c) 2012, 2013 Big Switch Networks, Inc.
+# See the file LICENSE.pyloxi which should have been included in the source distribution
+
+# Automatically generated by LOXI from template module.py
+# Do not modify
+
+import struct
+import loxi
+import util
+import loxi.generic_util
+
+import sys
+ofp = sys.modules['loxi.of13']
+
+class bsn_controller_connection(loxi.OFObject):
+
+ def __init__(self, state=None, auxiliary_id=None, role=None, uri=None):
+ if state != None:
+ self.state = state
+ else:
+ self.state = 0
+ if auxiliary_id != None:
+ self.auxiliary_id = auxiliary_id
+ else:
+ self.auxiliary_id = 0
+ if role != None:
+ self.role = role
+ else:
+ self.role = 0
+ if uri != None:
+ self.uri = uri
+ else:
+ self.uri = ""
+ return
+
+ def pack(self):
+ packed = []
+ packed.append(struct.pack("!B", self.state))
+ packed.append(struct.pack("!B", self.auxiliary_id))
+ packed.append('\x00' * 2)
+ packed.append(struct.pack("!L", self.role))
+ packed.append(struct.pack("!256s", self.uri))
+ return ''.join(packed)
+
+ @staticmethod
+ def unpack(reader):
+ obj = bsn_controller_connection()
+ obj.state = reader.read("!B")[0]
+ obj.auxiliary_id = reader.read("!B")[0]
+ reader.skip(2)
+ obj.role = reader.read("!L")[0]
+ obj.uri = reader.read("!256s")[0].rstrip("\x00")
+ return obj
+
+ def __eq__(self, other):
+ if type(self) != type(other): return False
+ if self.state != other.state: return False
+ if self.auxiliary_id != other.auxiliary_id: return False
+ if self.role != other.role: return False
+ if self.uri != other.uri: return False
+ return True
+
+ def pretty_print(self, q):
+ q.text("bsn_controller_connection {")
+ with q.group():
+ with q.indent(2):
+ q.breakable()
+ q.text("state = ");
+ q.text("%#x" % self.state)
+ q.text(","); q.breakable()
+ q.text("auxiliary_id = ");
+ q.text("%#x" % self.auxiliary_id)
+ q.text(","); q.breakable()
+ q.text("role = ");
+ q.text("%#x" % self.role)
+ q.text(","); q.breakable()
+ q.text("uri = ");
+ q.pp(self.uri)
+ q.breakable()
+ q.text('}')
+
+
+class bsn_debug_counter_desc_stats_entry(loxi.OFObject):
+
+ def __init__(self, counter_id=None, name=None, description=None):
+ if counter_id != None:
+ self.counter_id = counter_id
+ else:
+ self.counter_id = 0
+ if name != None:
+ self.name = name
+ else:
+ self.name = ""
+ if description != None:
+ self.description = description
+ else:
+ self.description = ""
+ return
+
+ def pack(self):
+ packed = []
+ packed.append(struct.pack("!Q", self.counter_id))
+ packed.append(struct.pack("!64s", self.name))
+ packed.append(struct.pack("!256s", self.description))
+ return ''.join(packed)
+
+ @staticmethod
+ def unpack(reader):
+ obj = bsn_debug_counter_desc_stats_entry()
+ obj.counter_id = reader.read("!Q")[0]
+ obj.name = reader.read("!64s")[0].rstrip("\x00")
+ obj.description = reader.read("!256s")[0].rstrip("\x00")
+ return obj
+
+ def __eq__(self, other):
+ if type(self) != type(other): return False
+ if self.counter_id != other.counter_id: return False
+ if self.name != other.name: return False
+ if self.description != other.description: return False
+ return True
+
+ def pretty_print(self, q):
+ q.text("bsn_debug_counter_desc_stats_entry {")
+ with q.group():
+ with q.indent(2):
+ q.breakable()
+ q.text("counter_id = ");
+ q.text("%#x" % self.counter_id)
+ q.text(","); q.breakable()
+ q.text("name = ");
+ q.pp(self.name)
+ q.text(","); q.breakable()
+ q.text("description = ");
+ q.pp(self.description)
+ q.breakable()
+ q.text('}')
+
+
+class bsn_debug_counter_stats_entry(loxi.OFObject):
+
+ def __init__(self, counter_id=None, value=None):
+ if counter_id != None:
+ self.counter_id = counter_id
+ else:
+ self.counter_id = 0
+ if value != None:
+ self.value = value
+ else:
+ self.value = 0
+ return
+
+ def pack(self):
+ packed = []
+ packed.append(struct.pack("!Q", self.counter_id))
+ packed.append(struct.pack("!Q", self.value))
+ return ''.join(packed)
+
+ @staticmethod
+ def unpack(reader):
+ obj = bsn_debug_counter_stats_entry()
+ obj.counter_id = reader.read("!Q")[0]
+ obj.value = reader.read("!Q")[0]
+ return obj
+
+ def __eq__(self, other):
+ if type(self) != type(other): return False
+ if self.counter_id != other.counter_id: return False
+ if self.value != other.value: return False
+ return True
+
+ def pretty_print(self, q):
+ q.text("bsn_debug_counter_stats_entry {")
+ with q.group():
+ with q.indent(2):
+ q.breakable()
+ q.text("counter_id = ");
+ q.text("%#x" % self.counter_id)
+ q.text(","); q.breakable()
+ q.text("value = ");
+ q.text("%#x" % self.value)
+ q.breakable()
+ q.text('}')
+
+
+class bsn_flow_checksum_bucket_stats_entry(loxi.OFObject):
+
+ def __init__(self, checksum=None):
+ if checksum != None:
+ self.checksum = checksum
+ else:
+ self.checksum = 0
+ return
+
+ def pack(self):
+ packed = []
+ packed.append(struct.pack("!Q", self.checksum))
+ return ''.join(packed)
+
+ @staticmethod
+ def unpack(reader):
+ obj = bsn_flow_checksum_bucket_stats_entry()
+ obj.checksum = reader.read("!Q")[0]
+ return obj
+
+ def __eq__(self, other):
+ if type(self) != type(other): return False
+ if self.checksum != other.checksum: return False
+ return True
+
+ def pretty_print(self, q):
+ q.text("bsn_flow_checksum_bucket_stats_entry {")
+ with q.group():
+ with q.indent(2):
+ q.breakable()
+ q.text("checksum = ");
+ q.text("%#x" % self.checksum)
+ q.breakable()
+ q.text('}')
+
+
+class bsn_generic_stats_entry(loxi.OFObject):
+
+ def __init__(self, tlvs=None):
+ if tlvs != None:
+ self.tlvs = tlvs
+ else:
+ self.tlvs = []
+ return
+
+ def pack(self):
+ packed = []
+ packed.append(struct.pack("!H", 0)) # placeholder for length at index 0
+ packed.append(loxi.generic_util.pack_list(self.tlvs))
+ length = sum([len(x) for x in packed])
+ packed[0] = struct.pack("!H", length)
+ return ''.join(packed)
+
+ @staticmethod
+ def unpack(reader):
+ obj = bsn_generic_stats_entry()
+ _length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length, 2)
+ obj.tlvs = loxi.generic_util.unpack_list(reader, ofp.bsn_tlv.bsn_tlv.unpack)
+ return obj
+
+ def __eq__(self, other):
+ if type(self) != type(other): return False
+ if self.tlvs != other.tlvs: return False
+ return True
+
+ def pretty_print(self, q):
+ q.text("bsn_generic_stats_entry {")
+ with q.group():
+ with q.indent(2):
+ q.breakable()
+ q.text("tlvs = ");
+ q.pp(self.tlvs)
+ q.breakable()
+ q.text('}')
+
+
+class bsn_gentable_bucket_stats_entry(loxi.OFObject):
+
+ def __init__(self, checksum=None):
+ if checksum != None:
+ self.checksum = checksum
+ else:
+ self.checksum = 0
+ return
+
+ def pack(self):
+ packed = []
+ packed.append(util.pack_checksum_128(self.checksum))
+ return ''.join(packed)
+
+ @staticmethod
+ def unpack(reader):
+ obj = bsn_gentable_bucket_stats_entry()
+ obj.checksum = util.unpack_checksum_128(reader)
+ return obj
+
+ def __eq__(self, other):
+ if type(self) != type(other): return False
+ if self.checksum != other.checksum: return False
+ return True
+
+ def pretty_print(self, q):
+ q.text("bsn_gentable_bucket_stats_entry {")
+ with q.group():
+ with q.indent(2):
+ q.breakable()
+ q.text("checksum = ");
+ q.pp(self.checksum)
+ q.breakable()
+ q.text('}')
+
+
+class bsn_gentable_desc_stats_entry(loxi.OFObject):
+
+ def __init__(self, table_id=None, name=None, buckets_size=None, max_entries=None):
+ if table_id != None:
+ self.table_id = table_id
+ else:
+ self.table_id = 0
+ if name != None:
+ self.name = name
+ else:
+ self.name = ""
+ if buckets_size != None:
+ self.buckets_size = buckets_size
+ else:
+ self.buckets_size = 0
+ if max_entries != None:
+ self.max_entries = max_entries
+ else:
+ self.max_entries = 0
+ return
+
+ def pack(self):
+ packed = []
+ packed.append(struct.pack("!H", 0)) # placeholder for length at index 0
+ packed.append(struct.pack("!H", self.table_id))
+ packed.append(struct.pack("!32s", self.name))
+ packed.append(struct.pack("!L", self.buckets_size))
+ packed.append(struct.pack("!L", self.max_entries))
+ packed.append('\x00' * 4)
+ length = sum([len(x) for x in packed])
+ packed[0] = struct.pack("!H", length)
+ return ''.join(packed)
+
+ @staticmethod
+ def unpack(reader):
+ obj = bsn_gentable_desc_stats_entry()
+ _length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length, 2)
+ obj.table_id = reader.read("!H")[0]
+ obj.name = reader.read("!32s")[0].rstrip("\x00")
+ obj.buckets_size = reader.read("!L")[0]
+ obj.max_entries = reader.read("!L")[0]
+ reader.skip(4)
+ return obj
+
+ def __eq__(self, other):
+ if type(self) != type(other): return False
+ if self.table_id != other.table_id: return False
+ if self.name != other.name: return False
+ if self.buckets_size != other.buckets_size: return False
+ if self.max_entries != other.max_entries: return False
+ return True
+
+ def pretty_print(self, q):
+ q.text("bsn_gentable_desc_stats_entry {")
+ with q.group():
+ with q.indent(2):
+ q.breakable()
+ q.text("table_id = ");
+ q.text("%#x" % self.table_id)
+ q.text(","); q.breakable()
+ q.text("name = ");
+ q.pp(self.name)
+ q.text(","); q.breakable()
+ q.text("buckets_size = ");
+ q.text("%#x" % self.buckets_size)
+ q.text(","); q.breakable()
+ q.text("max_entries = ");
+ q.text("%#x" % self.max_entries)
+ q.breakable()
+ q.text('}')
+
+
+class bsn_gentable_entry_desc_stats_entry(loxi.OFObject):
+
+ def __init__(self, checksum=None, key=None, value=None):
+ if checksum != None:
+ self.checksum = checksum
+ else:
+ self.checksum = 0
+ if key != None:
+ self.key = key
+ else:
+ self.key = []
+ if value != None:
+ self.value = value
+ else:
+ self.value = []
+ return
+
+ def pack(self):
+ packed = []
+ packed.append(struct.pack("!H", 0)) # placeholder for length at index 0
+ packed.append(struct.pack("!H", 0)) # placeholder for key_length at index 1
+ packed.append(util.pack_checksum_128(self.checksum))
+ packed.append(loxi.generic_util.pack_list(self.key))
+ packed[1] = struct.pack("!H", len(packed[-1]))
+ packed.append(loxi.generic_util.pack_list(self.value))
+ length = sum([len(x) for x in packed])
+ packed[0] = struct.pack("!H", length)
+ return ''.join(packed)
+
+ @staticmethod
+ def unpack(reader):
+ obj = bsn_gentable_entry_desc_stats_entry()
+ _length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length, 2)
+ _key_length = reader.read("!H")[0]
+ obj.checksum = util.unpack_checksum_128(reader)
+ obj.key = loxi.generic_util.unpack_list(reader.slice(_key_length), ofp.bsn_tlv.bsn_tlv.unpack)
+ obj.value = loxi.generic_util.unpack_list(reader, ofp.bsn_tlv.bsn_tlv.unpack)
+ return obj
+
+ def __eq__(self, other):
+ if type(self) != type(other): return False
+ if self.checksum != other.checksum: return False
+ if self.key != other.key: return False
+ if self.value != other.value: return False
+ return True
+
+ def pretty_print(self, q):
+ q.text("bsn_gentable_entry_desc_stats_entry {")
+ with q.group():
+ with q.indent(2):
+ q.breakable()
+ q.text("checksum = ");
+ q.pp(self.checksum)
+ q.text(","); q.breakable()
+ q.text("key = ");
+ q.pp(self.key)
+ q.text(","); q.breakable()
+ q.text("value = ");
+ q.pp(self.value)
+ q.breakable()
+ q.text('}')
+
+
+class bsn_gentable_entry_stats_entry(loxi.OFObject):
+
+ def __init__(self, key=None, stats=None):
+ if key != None:
+ self.key = key
+ else:
+ self.key = []
+ if stats != None:
+ self.stats = stats
+ else:
+ self.stats = []
+ return
+
+ def pack(self):
+ packed = []
+ packed.append(struct.pack("!H", 0)) # placeholder for length at index 0
+ packed.append(struct.pack("!H", 0)) # placeholder for key_length at index 1
+ packed.append(loxi.generic_util.pack_list(self.key))
+ packed[1] = struct.pack("!H", len(packed[-1]))
+ packed.append(loxi.generic_util.pack_list(self.stats))
+ length = sum([len(x) for x in packed])
+ packed[0] = struct.pack("!H", length)
+ return ''.join(packed)
+
+ @staticmethod
+ def unpack(reader):
+ obj = bsn_gentable_entry_stats_entry()
+ _length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length, 2)
+ _key_length = reader.read("!H")[0]
+ obj.key = loxi.generic_util.unpack_list(reader.slice(_key_length), ofp.bsn_tlv.bsn_tlv.unpack)
+ obj.stats = loxi.generic_util.unpack_list(reader, ofp.bsn_tlv.bsn_tlv.unpack)
+ return obj
+
+ def __eq__(self, other):
+ if type(self) != type(other): return False
+ if self.key != other.key: return False
+ if self.stats != other.stats: return False
+ return True
+
+ def pretty_print(self, q):
+ q.text("bsn_gentable_entry_stats_entry {")
+ with q.group():
+ with q.indent(2):
+ q.breakable()
+ q.text("key = ");
+ q.pp(self.key)
+ q.text(","); q.breakable()
+ q.text("stats = ");
+ q.pp(self.stats)
+ q.breakable()
+ q.text('}')
+
+
+class bsn_gentable_stats_entry(loxi.OFObject):
+
+ def __init__(self, table_id=None, entry_count=None, checksum=None):
+ if table_id != None:
+ self.table_id = table_id
+ else:
+ self.table_id = 0
+ if entry_count != None:
+ self.entry_count = entry_count
+ else:
+ self.entry_count = 0
+ if checksum != None:
+ self.checksum = checksum
+ else:
+ self.checksum = 0
+ return
+
+ def pack(self):
+ packed = []
+ packed.append(struct.pack("!H", self.table_id))
+ packed.append('\x00' * 2)
+ packed.append(struct.pack("!L", self.entry_count))
+ packed.append(util.pack_checksum_128(self.checksum))
+ return ''.join(packed)
+
+ @staticmethod
+ def unpack(reader):
+ obj = bsn_gentable_stats_entry()
+ obj.table_id = reader.read("!H")[0]
+ reader.skip(2)
+ obj.entry_count = reader.read("!L")[0]
+ obj.checksum = util.unpack_checksum_128(reader)
+ return obj
+
+ def __eq__(self, other):
+ if type(self) != type(other): return False
+ if self.table_id != other.table_id: return False
+ if self.entry_count != other.entry_count: return False
+ if self.checksum != other.checksum: return False
+ return True
+
+ def pretty_print(self, q):
+ q.text("bsn_gentable_stats_entry {")
+ with q.group():
+ with q.indent(2):
+ q.breakable()
+ q.text("table_id = ");
+ q.text("%#x" % self.table_id)
+ q.text(","); q.breakable()
+ q.text("entry_count = ");
+ q.text("%#x" % self.entry_count)
+ q.text(","); q.breakable()
+ q.text("checksum = ");
+ q.pp(self.checksum)
+ q.breakable()
+ q.text('}')
+
+
+class bsn_interface(loxi.OFObject):
+
+ def __init__(self, hw_addr=None, name=None, ipv4_addr=None, ipv4_netmask=None):
+ if hw_addr != None:
+ self.hw_addr = hw_addr
+ else:
+ self.hw_addr = [0,0,0,0,0,0]
+ if name != None:
+ self.name = name
+ else:
+ self.name = ""
+ if ipv4_addr != None:
+ self.ipv4_addr = ipv4_addr
+ else:
+ self.ipv4_addr = 0
+ if ipv4_netmask != None:
+ self.ipv4_netmask = ipv4_netmask
+ else:
+ self.ipv4_netmask = 0
+ return
+
+ def pack(self):
+ packed = []
+ packed.append(struct.pack("!6B", *self.hw_addr))
+ packed.append('\x00' * 2)
+ packed.append(struct.pack("!16s", self.name))
+ packed.append(struct.pack("!L", self.ipv4_addr))
+ packed.append(struct.pack("!L", self.ipv4_netmask))
+ return ''.join(packed)
+
+ @staticmethod
+ def unpack(reader):
+ obj = bsn_interface()
+ obj.hw_addr = list(reader.read('!6B'))
+ reader.skip(2)
+ obj.name = reader.read("!16s")[0].rstrip("\x00")
+ obj.ipv4_addr = reader.read("!L")[0]
+ obj.ipv4_netmask = reader.read("!L")[0]
+ return obj
+
+ def __eq__(self, other):
+ if type(self) != type(other): return False
+ if self.hw_addr != other.hw_addr: return False
+ if self.name != other.name: return False
+ if self.ipv4_addr != other.ipv4_addr: return False
+ if self.ipv4_netmask != other.ipv4_netmask: return False
+ return True
+
+ def pretty_print(self, q):
+ q.text("bsn_interface {")
+ with q.group():
+ with q.indent(2):
+ q.breakable()
+ q.text("hw_addr = ");
+ q.text(util.pretty_mac(self.hw_addr))
+ q.text(","); q.breakable()
+ q.text("name = ");
+ q.pp(self.name)
+ q.text(","); q.breakable()
+ q.text("ipv4_addr = ");
+ q.text(util.pretty_ipv4(self.ipv4_addr))
+ q.text(","); q.breakable()
+ q.text("ipv4_netmask = ");
+ q.text(util.pretty_ipv4(self.ipv4_netmask))
+ q.breakable()
+ q.text('}')
+
+
+class bsn_lacp_stats_entry(loxi.OFObject):
+
+ 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):
+ if port_no != None:
+ self.port_no = port_no
+ else:
+ self.port_no = 0
+ if actor_sys_priority != None:
+ self.actor_sys_priority = actor_sys_priority
+ else:
+ self.actor_sys_priority = 0
+ if actor_sys_mac != None:
+ self.actor_sys_mac = actor_sys_mac
+ else:
+ self.actor_sys_mac = [0,0,0,0,0,0]
+ if actor_port_priority != None:
+ self.actor_port_priority = actor_port_priority
+ else:
+ self.actor_port_priority = 0
+ if actor_port_num != None:
+ self.actor_port_num = actor_port_num
+ else:
+ self.actor_port_num = 0
+ if actor_key != None:
+ self.actor_key = actor_key
+ else:
+ self.actor_key = 0
+ if convergence_status != None:
+ self.convergence_status = convergence_status
+ else:
+ self.convergence_status = 0
+ if partner_sys_priority != None:
+ self.partner_sys_priority = partner_sys_priority
+ else:
+ self.partner_sys_priority = 0
+ if partner_sys_mac != None:
+ self.partner_sys_mac = partner_sys_mac
+ else:
+ self.partner_sys_mac = [0,0,0,0,0,0]
+ if partner_port_priority != None:
+ self.partner_port_priority = partner_port_priority
+ else:
+ self.partner_port_priority = 0
+ if partner_port_num != None:
+ self.partner_port_num = partner_port_num
+ else:
+ self.partner_port_num = 0
+ if partner_key != None:
+ self.partner_key = partner_key
+ else:
+ self.partner_key = 0
+ return
+
+ def pack(self):
+ packed = []
+ packed.append(util.pack_port_no(self.port_no))
+ packed.append(struct.pack("!H", self.actor_sys_priority))
+ packed.append(struct.pack("!6B", *self.actor_sys_mac))
+ packed.append(struct.pack("!H", self.actor_port_priority))
+ packed.append(struct.pack("!H", self.actor_port_num))
+ packed.append(struct.pack("!H", self.actor_key))
+ packed.append(struct.pack("!B", self.convergence_status))
+ packed.append('\x00' * 1)
+ packed.append(struct.pack("!H", self.partner_sys_priority))
+ packed.append(struct.pack("!6B", *self.partner_sys_mac))
+ packed.append(struct.pack("!H", self.partner_port_priority))
+ packed.append(struct.pack("!H", self.partner_port_num))
+ packed.append(struct.pack("!H", self.partner_key))
+ packed.append('\x00' * 2)
+ return ''.join(packed)
+
+ @staticmethod
+ def unpack(reader):
+ obj = bsn_lacp_stats_entry()
+ obj.port_no = util.unpack_port_no(reader)
+ obj.actor_sys_priority = reader.read("!H")[0]
+ obj.actor_sys_mac = list(reader.read('!6B'))
+ obj.actor_port_priority = reader.read("!H")[0]
+ obj.actor_port_num = reader.read("!H")[0]
+ obj.actor_key = reader.read("!H")[0]
+ obj.convergence_status = reader.read("!B")[0]
+ reader.skip(1)
+ obj.partner_sys_priority = reader.read("!H")[0]
+ obj.partner_sys_mac = list(reader.read('!6B'))
+ obj.partner_port_priority = reader.read("!H")[0]
+ obj.partner_port_num = reader.read("!H")[0]
+ obj.partner_key = reader.read("!H")[0]
+ reader.skip(2)
+ return obj
+
+ def __eq__(self, other):
+ if type(self) != type(other): return False
+ if self.port_no != other.port_no: return False
+ if self.actor_sys_priority != other.actor_sys_priority: return False
+ if self.actor_sys_mac != other.actor_sys_mac: return False
+ if self.actor_port_priority != other.actor_port_priority: return False
+ if self.actor_port_num != other.actor_port_num: return False
+ if self.actor_key != other.actor_key: return False
+ if self.convergence_status != other.convergence_status: return False
+ if self.partner_sys_priority != other.partner_sys_priority: return False
+ if self.partner_sys_mac != other.partner_sys_mac: return False
+ if self.partner_port_priority != other.partner_port_priority: return False
+ if self.partner_port_num != other.partner_port_num: return False
+ if self.partner_key != other.partner_key: return False
+ return True
+
+ def pretty_print(self, q):
+ q.text("bsn_lacp_stats_entry {")
+ with q.group():
+ with q.indent(2):
+ q.breakable()
+ q.text("port_no = ");
+ q.text(util.pretty_port(self.port_no))
+ q.text(","); q.breakable()
+ q.text("actor_sys_priority = ");
+ q.text("%#x" % self.actor_sys_priority)
+ q.text(","); q.breakable()
+ q.text("actor_sys_mac = ");
+ q.text(util.pretty_mac(self.actor_sys_mac))
+ q.text(","); q.breakable()
+ q.text("actor_port_priority = ");
+ q.text("%#x" % self.actor_port_priority)
+ q.text(","); q.breakable()
+ q.text("actor_port_num = ");
+ q.text("%#x" % self.actor_port_num)
+ q.text(","); q.breakable()
+ q.text("actor_key = ");
+ q.text("%#x" % self.actor_key)
+ q.text(","); q.breakable()
+ q.text("convergence_status = ");
+ q.text("%#x" % self.convergence_status)
+ q.text(","); q.breakable()
+ q.text("partner_sys_priority = ");
+ q.text("%#x" % self.partner_sys_priority)
+ q.text(","); q.breakable()
+ q.text("partner_sys_mac = ");
+ q.text(util.pretty_mac(self.partner_sys_mac))
+ q.text(","); q.breakable()
+ q.text("partner_port_priority = ");
+ q.text("%#x" % self.partner_port_priority)
+ q.text(","); q.breakable()
+ q.text("partner_port_num = ");
+ q.text("%#x" % self.partner_port_num)
+ q.text(","); q.breakable()
+ q.text("partner_key = ");
+ q.text("%#x" % self.partner_key)
+ q.breakable()
+ q.text('}')
+
+
+class bsn_port_counter_stats_entry(loxi.OFObject):
+
+ def __init__(self, port_no=None, values=None):
+ if port_no != None:
+ self.port_no = port_no
+ else:
+ self.port_no = 0
+ if values != None:
+ self.values = values
+ else:
+ self.values = []
+ return
+
+ def pack(self):
+ packed = []
+ packed.append(struct.pack("!H", 0)) # placeholder for length at index 0
+ packed.append('\x00' * 2)
+ packed.append(util.pack_port_no(self.port_no))
+ packed.append(loxi.generic_util.pack_list(self.values))
+ length = sum([len(x) for x in packed])
+ packed[0] = struct.pack("!H", length)
+ return ''.join(packed)
+
+ @staticmethod
+ def unpack(reader):
+ obj = bsn_port_counter_stats_entry()
+ _length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length, 2)
+ reader.skip(2)
+ obj.port_no = util.unpack_port_no(reader)
+ obj.values = loxi.generic_util.unpack_list(reader, ofp.common.uint64.unpack)
+ return obj
+
+ def __eq__(self, other):
+ if type(self) != type(other): return False
+ if self.port_no != other.port_no: return False
+ if self.values != other.values: return False
+ return True
+
+ def pretty_print(self, q):
+ q.text("bsn_port_counter_stats_entry {")
+ with q.group():
+ with q.indent(2):
+ q.breakable()
+ q.text("port_no = ");
+ q.text(util.pretty_port(self.port_no))
+ q.text(","); q.breakable()
+ q.text("values = ");
+ q.pp(self.values)
+ q.breakable()
+ q.text('}')
+
+
+class bsn_switch_pipeline_stats_entry(loxi.OFObject):
+
+ def __init__(self, pipeline=None):
+ if pipeline != None:
+ self.pipeline = pipeline
+ else:
+ self.pipeline = ""
+ return
+
+ def pack(self):
+ packed = []
+ packed.append(struct.pack("!256s", self.pipeline))
+ return ''.join(packed)
+
+ @staticmethod
+ def unpack(reader):
+ obj = bsn_switch_pipeline_stats_entry()
+ obj.pipeline = reader.read("!256s")[0].rstrip("\x00")
+ return obj
+
+ def __eq__(self, other):
+ if type(self) != type(other): return False
+ if self.pipeline != other.pipeline: return False
+ return True
+
+ def pretty_print(self, q):
+ q.text("bsn_switch_pipeline_stats_entry {")
+ with q.group():
+ with q.indent(2):
+ q.breakable()
+ q.text("pipeline = ");
+ q.pp(self.pipeline)
+ q.breakable()
+ q.text('}')
+
+
+class bsn_table_checksum_stats_entry(loxi.OFObject):
+
+ def __init__(self, table_id=None, checksum=None):
+ if table_id != None:
+ self.table_id = table_id
+ else:
+ self.table_id = 0
+ if checksum != None:
+ self.checksum = checksum
+ else:
+ self.checksum = 0
+ return
+
+ def pack(self):
+ packed = []
+ packed.append(struct.pack("!B", self.table_id))
+ packed.append(struct.pack("!Q", self.checksum))
+ return ''.join(packed)
+
+ @staticmethod
+ def unpack(reader):
+ obj = bsn_table_checksum_stats_entry()
+ obj.table_id = reader.read("!B")[0]
+ obj.checksum = reader.read("!Q")[0]
+ return obj
+
+ def __eq__(self, other):
+ if type(self) != type(other): return False
+ if self.table_id != other.table_id: return False
+ if self.checksum != other.checksum: return False
+ return True
+
+ def pretty_print(self, q):
+ q.text("bsn_table_checksum_stats_entry {")
+ with q.group():
+ with q.indent(2):
+ q.breakable()
+ q.text("table_id = ");
+ q.text("%#x" % self.table_id)
+ q.text(","); q.breakable()
+ q.text("checksum = ");
+ q.text("%#x" % self.checksum)
+ q.breakable()
+ q.text('}')
+
+
+class bsn_vport(loxi.OFObject):
+ subtypes = {}
+
+
+ def __init__(self, type=None):
+ if type != None:
+ self.type = type
+ else:
+ self.type = 0
+ return
+
+ def pack(self):
+ packed = []
+ packed.append(struct.pack("!H", self.type))
+ packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
+ length = sum([len(x) for x in packed])
+ packed[1] = struct.pack("!H", length)
+ return ''.join(packed)
+
+ @staticmethod
+ def unpack(reader):
+ subtype, = reader.peek('!H', 0)
+ subclass = bsn_vport.subtypes.get(subtype)
+ if subclass:
+ return subclass.unpack(reader)
+
+ obj = bsn_vport()
+ obj.type = reader.read("!H")[0]
+ _length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length, 4)
+ return obj
+
+ def __eq__(self, other):
+ if type(self) != type(other): return False
+ if self.type != other.type: return False
+ return True
+
+ def pretty_print(self, q):
+ q.text("bsn_vport {")
+ with q.group():
+ with q.indent(2):
+ q.breakable()
+ q.breakable()
+ q.text('}')
+
+
+class bsn_vlan_counter_stats_entry(loxi.OFObject):
+
+ def __init__(self, vlan_vid=None, values=None):
+ if vlan_vid != None:
+ self.vlan_vid = vlan_vid
+ else:
+ self.vlan_vid = 0
+ if values != None:
+ self.values = values
+ else:
+ self.values = []
+ return
+
+ def pack(self):
+ packed = []
+ packed.append(struct.pack("!H", 0)) # placeholder for length at index 0
+ packed.append(struct.pack("!H", self.vlan_vid))
+ packed.append('\x00' * 4)
+ packed.append(loxi.generic_util.pack_list(self.values))
+ length = sum([len(x) for x in packed])
+ packed[0] = struct.pack("!H", length)
+ return ''.join(packed)
+
+ @staticmethod
+ def unpack(reader):
+ obj = bsn_vlan_counter_stats_entry()
+ _length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length, 2)
+ obj.vlan_vid = reader.read("!H")[0]
+ reader.skip(4)
+ obj.values = loxi.generic_util.unpack_list(reader, ofp.common.uint64.unpack)
+ return obj
+
+ def __eq__(self, other):
+ if type(self) != type(other): return False
+ if self.vlan_vid != other.vlan_vid: return False
+ if self.values != other.values: return False
+ return True
+
+ def pretty_print(self, q):
+ q.text("bsn_vlan_counter_stats_entry {")
+ with q.group():
+ with q.indent(2):
+ q.breakable()
+ q.text("vlan_vid = ");
+ q.text("%#x" % self.vlan_vid)
+ q.text(","); q.breakable()
+ q.text("values = ");
+ q.pp(self.values)
+ q.breakable()
+ q.text('}')
+
+
+class bsn_vport_l2gre(bsn_vport):
+ type = 1
+
+ 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):
+ if flags != None:
+ self.flags = flags
+ else:
+ self.flags = 0
+ if port_no != None:
+ self.port_no = port_no
+ else:
+ self.port_no = 0
+ if loopback_port_no != None:
+ self.loopback_port_no = loopback_port_no
+ else:
+ self.loopback_port_no = 0
+ if local_mac != None:
+ self.local_mac = local_mac
+ else:
+ self.local_mac = [0,0,0,0,0,0]
+ if nh_mac != None:
+ self.nh_mac = nh_mac
+ else:
+ self.nh_mac = [0,0,0,0,0,0]
+ if src_ip != None:
+ self.src_ip = src_ip
+ else:
+ self.src_ip = 0
+ if dst_ip != None:
+ self.dst_ip = dst_ip
+ else:
+ self.dst_ip = 0
+ if dscp != None:
+ self.dscp = dscp
+ else:
+ self.dscp = 0
+ if ttl != None:
+ self.ttl = ttl
+ else:
+ self.ttl = 0
+ if vpn != None:
+ self.vpn = vpn
+ else:
+ self.vpn = 0
+ if rate_limit != None:
+ self.rate_limit = rate_limit
+ else:
+ self.rate_limit = 0
+ if if_name != None:
+ self.if_name = if_name
+ else:
+ self.if_name = ""
+ return
+
+ def pack(self):
+ packed = []
+ packed.append(struct.pack("!H", self.type))
+ packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
+ packed.append(struct.pack("!L", self.flags))
+ packed.append(util.pack_port_no(self.port_no))
+ packed.append(util.pack_port_no(self.loopback_port_no))
+ packed.append(struct.pack("!6B", *self.local_mac))
+ packed.append(struct.pack("!6B", *self.nh_mac))
+ packed.append(struct.pack("!L", self.src_ip))
+ packed.append(struct.pack("!L", self.dst_ip))
+ packed.append(struct.pack("!B", self.dscp))
+ packed.append(struct.pack("!B", self.ttl))
+ packed.append('\x00' * 2)
+ packed.append(struct.pack("!L", self.vpn))
+ packed.append(struct.pack("!L", self.rate_limit))
+ packed.append(struct.pack("!16s", self.if_name))
+ length = sum([len(x) for x in packed])
+ packed[1] = struct.pack("!H", length)
+ return ''.join(packed)
+
+ @staticmethod
+ def unpack(reader):
+ obj = bsn_vport_l2gre()
+ _type = reader.read("!H")[0]
+ assert(_type == 1)
+ _length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length, 4)
+ obj.flags = reader.read("!L")[0]
+ obj.port_no = util.unpack_port_no(reader)
+ obj.loopback_port_no = util.unpack_port_no(reader)
+ obj.local_mac = list(reader.read('!6B'))
+ obj.nh_mac = list(reader.read('!6B'))
+ obj.src_ip = reader.read("!L")[0]
+ obj.dst_ip = reader.read("!L")[0]
+ obj.dscp = reader.read("!B")[0]
+ obj.ttl = reader.read("!B")[0]
+ reader.skip(2)
+ obj.vpn = reader.read("!L")[0]
+ obj.rate_limit = reader.read("!L")[0]
+ obj.if_name = reader.read("!16s")[0].rstrip("\x00")
+ return obj
+
+ def __eq__(self, other):
+ if type(self) != type(other): return False
+ if self.flags != other.flags: return False
+ if self.port_no != other.port_no: return False
+ if self.loopback_port_no != other.loopback_port_no: return False
+ if self.local_mac != other.local_mac: return False
+ if self.nh_mac != other.nh_mac: return False
+ if self.src_ip != other.src_ip: return False
+ if self.dst_ip != other.dst_ip: return False
+ if self.dscp != other.dscp: return False
+ if self.ttl != other.ttl: return False
+ if self.vpn != other.vpn: return False
+ if self.rate_limit != other.rate_limit: return False
+ if self.if_name != other.if_name: return False
+ return True
+
+ def pretty_print(self, q):
+ q.text("bsn_vport_l2gre {")
+ with q.group():
+ with q.indent(2):
+ q.breakable()
+ q.text("flags = ");
+ q.text("%#x" % self.flags)
+ q.text(","); q.breakable()
+ q.text("port_no = ");
+ q.text(util.pretty_port(self.port_no))
+ q.text(","); q.breakable()
+ q.text("loopback_port_no = ");
+ q.text(util.pretty_port(self.loopback_port_no))
+ q.text(","); q.breakable()
+ q.text("local_mac = ");
+ q.text(util.pretty_mac(self.local_mac))
+ q.text(","); q.breakable()
+ q.text("nh_mac = ");
+ q.text(util.pretty_mac(self.nh_mac))
+ q.text(","); q.breakable()
+ q.text("src_ip = ");
+ q.text(util.pretty_ipv4(self.src_ip))
+ q.text(","); q.breakable()
+ q.text("dst_ip = ");
+ q.text(util.pretty_ipv4(self.dst_ip))
+ q.text(","); q.breakable()
+ q.text("dscp = ");
+ q.text("%#x" % self.dscp)
+ q.text(","); q.breakable()
+ q.text("ttl = ");
+ q.text("%#x" % self.ttl)
+ q.text(","); q.breakable()
+ q.text("vpn = ");
+ q.text("%#x" % self.vpn)
+ q.text(","); q.breakable()
+ q.text("rate_limit = ");
+ q.text("%#x" % self.rate_limit)
+ q.text(","); q.breakable()
+ q.text("if_name = ");
+ q.pp(self.if_name)
+ q.breakable()
+ q.text('}')
+
+bsn_vport.subtypes[1] = bsn_vport_l2gre
+
+class bsn_vport_q_in_q(bsn_vport):
+ type = 0
+
+ def __init__(self, port_no=None, ingress_tpid=None, ingress_vlan_id=None, egress_tpid=None, egress_vlan_id=None, if_name=None):
+ if port_no != None:
+ self.port_no = port_no
+ else:
+ self.port_no = 0
+ if ingress_tpid != None:
+ self.ingress_tpid = ingress_tpid
+ else:
+ self.ingress_tpid = 0
+ if ingress_vlan_id != None:
+ self.ingress_vlan_id = ingress_vlan_id
+ else:
+ self.ingress_vlan_id = 0
+ if egress_tpid != None:
+ self.egress_tpid = egress_tpid
+ else:
+ self.egress_tpid = 0
+ if egress_vlan_id != None:
+ self.egress_vlan_id = egress_vlan_id
+ else:
+ self.egress_vlan_id = 0
+ if if_name != None:
+ self.if_name = if_name
+ else:
+ self.if_name = ""
+ return
+
+ def pack(self):
+ packed = []
+ packed.append(struct.pack("!H", self.type))
+ packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
+ packed.append(struct.pack("!L", self.port_no))
+ packed.append(struct.pack("!H", self.ingress_tpid))
+ packed.append(struct.pack("!H", self.ingress_vlan_id))
+ packed.append(struct.pack("!H", self.egress_tpid))
+ packed.append(struct.pack("!H", self.egress_vlan_id))
+ packed.append(struct.pack("!16s", self.if_name))
+ length = sum([len(x) for x in packed])
+ packed[1] = struct.pack("!H", length)
+ return ''.join(packed)
+
+ @staticmethod
+ def unpack(reader):
+ obj = bsn_vport_q_in_q()
+ _type = reader.read("!H")[0]
+ assert(_type == 0)
+ _length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length, 4)
+ obj.port_no = reader.read("!L")[0]
+ obj.ingress_tpid = reader.read("!H")[0]
+ obj.ingress_vlan_id = reader.read("!H")[0]
+ obj.egress_tpid = reader.read("!H")[0]
+ obj.egress_vlan_id = reader.read("!H")[0]
+ obj.if_name = reader.read("!16s")[0].rstrip("\x00")
+ return obj
+
+ def __eq__(self, other):
+ if type(self) != type(other): return False
+ if self.port_no != other.port_no: return False
+ if self.ingress_tpid != other.ingress_tpid: return False
+ if self.ingress_vlan_id != other.ingress_vlan_id: return False
+ if self.egress_tpid != other.egress_tpid: return False
+ if self.egress_vlan_id != other.egress_vlan_id: return False
+ if self.if_name != other.if_name: return False
+ return True
+
+ def pretty_print(self, q):
+ q.text("bsn_vport_q_in_q {")
+ with q.group():
+ with q.indent(2):
+ q.breakable()
+ q.text("port_no = ");
+ q.text("%#x" % self.port_no)
+ q.text(","); q.breakable()
+ q.text("ingress_tpid = ");
+ q.text("%#x" % self.ingress_tpid)
+ q.text(","); q.breakable()
+ q.text("ingress_vlan_id = ");
+ q.text("%#x" % self.ingress_vlan_id)
+ q.text(","); q.breakable()
+ q.text("egress_tpid = ");
+ q.text("%#x" % self.egress_tpid)
+ q.text(","); q.breakable()
+ q.text("egress_vlan_id = ");
+ q.text("%#x" % self.egress_vlan_id)
+ q.text(","); q.breakable()
+ q.text("if_name = ");
+ q.pp(self.if_name)
+ q.breakable()
+ q.text('}')
+
+bsn_vport.subtypes[0] = bsn_vport_q_in_q
+
+class bsn_vrf_counter_stats_entry(loxi.OFObject):
+
+ def __init__(self, vrf=None, values=None):
+ if vrf != None:
+ self.vrf = vrf
+ else:
+ self.vrf = 0
+ if values != None:
+ self.values = values
+ else:
+ self.values = []
+ return
+
+ def pack(self):
+ packed = []
+ packed.append(struct.pack("!H", 0)) # placeholder for length at index 0
+ packed.append('\x00' * 2)
+ packed.append(struct.pack("!L", self.vrf))
+ packed.append(loxi.generic_util.pack_list(self.values))
+ length = sum([len(x) for x in packed])
+ packed[0] = struct.pack("!H", length)
+ return ''.join(packed)
+
+ @staticmethod
+ def unpack(reader):
+ obj = bsn_vrf_counter_stats_entry()
+ _length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length, 2)
+ reader.skip(2)
+ obj.vrf = reader.read("!L")[0]
+ obj.values = loxi.generic_util.unpack_list(reader, ofp.common.uint64.unpack)
+ return obj
+
+ def __eq__(self, other):
+ if type(self) != type(other): return False
+ if self.vrf != other.vrf: return False
+ if self.values != other.values: return False
+ return True
+
+ def pretty_print(self, q):
+ q.text("bsn_vrf_counter_stats_entry {")
+ with q.group():
+ with q.indent(2):
+ q.breakable()
+ q.text("vrf = ");
+ q.text("%#x" % self.vrf)
+ q.text(","); q.breakable()
+ q.text("values = ");
+ q.pp(self.values)
+ q.breakable()
+ q.text('}')
+
+
+class bucket(loxi.OFObject):
+
+ def __init__(self, weight=None, watch_port=None, watch_group=None, actions=None):
+ if weight != None:
+ self.weight = weight
+ else:
+ self.weight = 0
+ if watch_port != None:
+ self.watch_port = watch_port
+ else:
+ self.watch_port = 0
+ if watch_group != None:
+ self.watch_group = watch_group
+ else:
+ self.watch_group = 0
+ if actions != None:
+ self.actions = actions
+ else:
+ self.actions = []
+ return
+
+ def pack(self):
+ packed = []
+ packed.append(struct.pack("!H", 0)) # placeholder for len at index 0
+ packed.append(struct.pack("!H", self.weight))
+ packed.append(util.pack_port_no(self.watch_port))
+ packed.append(struct.pack("!L", self.watch_group))
+ packed.append('\x00' * 4)
+ packed.append(loxi.generic_util.pack_list(self.actions))
+ length = sum([len(x) for x in packed])
+ packed[0] = struct.pack("!H", length)
+ return ''.join(packed)
+
+ @staticmethod
+ def unpack(reader):
+ obj = bucket()
+ _len = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_len, 2)
+ obj.weight = reader.read("!H")[0]
+ obj.watch_port = util.unpack_port_no(reader)
+ obj.watch_group = reader.read("!L")[0]
+ reader.skip(4)
+ obj.actions = loxi.generic_util.unpack_list(reader, ofp.action.action.unpack)
+ return obj
+
+ def __eq__(self, other):
+ if type(self) != type(other): return False
+ if self.weight != other.weight: return False
+ if self.watch_port != other.watch_port: return False
+ if self.watch_group != other.watch_group: return False
+ if self.actions != other.actions: return False
+ return True
+
+ def pretty_print(self, q):
+ q.text("bucket {")
+ with q.group():
+ with q.indent(2):
+ q.breakable()
+ q.text("weight = ");
+ q.text("%#x" % self.weight)
+ q.text(","); q.breakable()
+ q.text("watch_port = ");
+ q.text(util.pretty_port(self.watch_port))
+ q.text(","); q.breakable()
+ q.text("watch_group = ");
+ q.text("%#x" % self.watch_group)
+ q.text(","); q.breakable()
+ q.text("actions = ");
+ q.pp(self.actions)
+ q.breakable()
+ q.text('}')
+
+
+class bucket_counter(loxi.OFObject):
+
+ def __init__(self, packet_count=None, byte_count=None):
+ if packet_count != None:
+ self.packet_count = packet_count
+ else:
+ self.packet_count = 0
+ if byte_count != None:
+ self.byte_count = byte_count
+ else:
+ self.byte_count = 0
+ return
+
+ def pack(self):
+ packed = []
+ packed.append(struct.pack("!Q", self.packet_count))
+ packed.append(struct.pack("!Q", self.byte_count))
+ return ''.join(packed)
+
+ @staticmethod
+ def unpack(reader):
+ obj = bucket_counter()
+ obj.packet_count = reader.read("!Q")[0]
+ obj.byte_count = reader.read("!Q")[0]
+ return obj
+
+ def __eq__(self, other):
+ if type(self) != type(other): return False
+ if self.packet_count != other.packet_count: return False
+ if self.byte_count != other.byte_count: return False
+ return True
+
+ def pretty_print(self, q):
+ q.text("bucket_counter {")
+ with q.group():
+ with q.indent(2):
+ q.breakable()
+ q.text("packet_count = ");
+ q.text("%#x" % self.packet_count)
+ q.text(","); q.breakable()
+ q.text("byte_count = ");
+ q.text("%#x" % self.byte_count)
+ q.breakable()
+ q.text('}')
+
+
+class flow_stats_entry(loxi.OFObject):
+
+ def __init__(self, table_id=None, duration_sec=None, duration_nsec=None, priority=None, idle_timeout=None, hard_timeout=None, flags=None, cookie=None, packet_count=None, byte_count=None, match=None, instructions=None):
+ if table_id != None:
+ self.table_id = table_id
+ else:
+ self.table_id = 0
+ if duration_sec != None:
+ self.duration_sec = duration_sec
+ else:
+ self.duration_sec = 0
+ if duration_nsec != None:
+ self.duration_nsec = duration_nsec
+ else:
+ self.duration_nsec = 0
+ if priority != None:
+ self.priority = priority
+ else:
+ self.priority = 0
+ if idle_timeout != None:
+ self.idle_timeout = idle_timeout
+ else:
+ self.idle_timeout = 0
+ if hard_timeout != None:
+ self.hard_timeout = hard_timeout
+ else:
+ self.hard_timeout = 0
+ if flags != None:
+ self.flags = flags
+ else:
+ self.flags = 0
+ if cookie != None:
+ self.cookie = cookie
+ else:
+ self.cookie = 0
+ if packet_count != None:
+ self.packet_count = packet_count
+ else:
+ self.packet_count = 0
+ if byte_count != None:
+ self.byte_count = byte_count
+ else:
+ self.byte_count = 0
+ if match != None:
+ self.match = match
+ else:
+ self.match = ofp.match()
+ if instructions != None:
+ self.instructions = instructions
+ else:
+ self.instructions = []
+ return
+
+ def pack(self):
+ packed = []
+ packed.append(struct.pack("!H", 0)) # placeholder for length at index 0
+ packed.append(struct.pack("!B", self.table_id))
+ packed.append('\x00' * 1)
+ packed.append(struct.pack("!L", self.duration_sec))
+ packed.append(struct.pack("!L", self.duration_nsec))
+ packed.append(struct.pack("!H", self.priority))
+ packed.append(struct.pack("!H", self.idle_timeout))
+ packed.append(struct.pack("!H", self.hard_timeout))
+ packed.append(struct.pack("!H", self.flags))
+ packed.append('\x00' * 4)
+ packed.append(struct.pack("!Q", self.cookie))
+ packed.append(struct.pack("!Q", self.packet_count))
+ packed.append(struct.pack("!Q", self.byte_count))
+ packed.append(self.match.pack())
+ packed.append(loxi.generic_util.pack_list(self.instructions))
+ length = sum([len(x) for x in packed])
+ packed[0] = struct.pack("!H", length)
+ return ''.join(packed)
+
+ @staticmethod
+ def unpack(reader):
+ obj = flow_stats_entry()
+ _length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length, 2)
+ obj.table_id = reader.read("!B")[0]
+ reader.skip(1)
+ obj.duration_sec = reader.read("!L")[0]
+ obj.duration_nsec = reader.read("!L")[0]
+ obj.priority = reader.read("!H")[0]
+ obj.idle_timeout = reader.read("!H")[0]
+ obj.hard_timeout = reader.read("!H")[0]
+ obj.flags = reader.read("!H")[0]
+ reader.skip(4)
+ obj.cookie = reader.read("!Q")[0]
+ obj.packet_count = reader.read("!Q")[0]
+ obj.byte_count = reader.read("!Q")[0]
+ obj.match = ofp.match.unpack(reader)
+ obj.instructions = loxi.generic_util.unpack_list(reader, ofp.instruction.instruction.unpack)
+ return obj
+
+ def __eq__(self, other):
+ if type(self) != type(other): return False
+ if self.table_id != other.table_id: return False
+ if self.duration_sec != other.duration_sec: return False
+ if self.duration_nsec != other.duration_nsec: return False
+ if self.priority != other.priority: return False
+ if self.idle_timeout != other.idle_timeout: return False
+ if self.hard_timeout != other.hard_timeout: return False
+ if self.flags != other.flags: return False
+ if self.cookie != other.cookie: return False
+ if self.packet_count != other.packet_count: return False
+ if self.byte_count != other.byte_count: return False
+ if self.match != other.match: return False
+ if self.instructions != other.instructions: return False
+ return True
+
+ def pretty_print(self, q):
+ q.text("flow_stats_entry {")
+ with q.group():
+ with q.indent(2):
+ q.breakable()
+ q.text("table_id = ");
+ q.text("%#x" % self.table_id)
+ q.text(","); q.breakable()
+ q.text("duration_sec = ");
+ q.text("%#x" % self.duration_sec)
+ q.text(","); q.breakable()
+ q.text("duration_nsec = ");
+ q.text("%#x" % self.duration_nsec)
+ q.text(","); q.breakable()
+ q.text("priority = ");
+ q.text("%#x" % self.priority)
+ q.text(","); q.breakable()
+ q.text("idle_timeout = ");
+ q.text("%#x" % self.idle_timeout)
+ q.text(","); q.breakable()
+ q.text("hard_timeout = ");
+ q.text("%#x" % self.hard_timeout)
+ q.text(","); q.breakable()
+ q.text("flags = ");
+ q.text("%#x" % self.flags)
+ q.text(","); q.breakable()
+ q.text("cookie = ");
+ q.text("%#x" % self.cookie)
+ q.text(","); q.breakable()
+ q.text("packet_count = ");
+ q.text("%#x" % self.packet_count)
+ q.text(","); q.breakable()
+ q.text("byte_count = ");
+ q.text("%#x" % self.byte_count)
+ q.text(","); q.breakable()
+ q.text("match = ");
+ q.pp(self.match)
+ q.text(","); q.breakable()
+ q.text("instructions = ");
+ q.pp(self.instructions)
+ q.breakable()
+ q.text('}')
+
+
+class group_desc_stats_entry(loxi.OFObject):
+
+ def __init__(self, group_type=None, group_id=None, buckets=None):
+ if group_type != None:
+ self.group_type = group_type
+ else:
+ self.group_type = 0
+ if group_id != None:
+ self.group_id = group_id
+ else:
+ self.group_id = 0
+ if buckets != None:
+ self.buckets = buckets
+ else:
+ self.buckets = []
+ return
+
+ def pack(self):
+ packed = []
+ packed.append(struct.pack("!H", 0)) # placeholder for length at index 0
+ packed.append(struct.pack("!B", self.group_type))
+ packed.append('\x00' * 1)
+ packed.append(struct.pack("!L", self.group_id))
+ packed.append(loxi.generic_util.pack_list(self.buckets))
+ length = sum([len(x) for x in packed])
+ packed[0] = struct.pack("!H", length)
+ return ''.join(packed)
+
+ @staticmethod
+ def unpack(reader):
+ obj = group_desc_stats_entry()
+ _length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length, 2)
+ obj.group_type = reader.read("!B")[0]
+ reader.skip(1)
+ obj.group_id = reader.read("!L")[0]
+ obj.buckets = loxi.generic_util.unpack_list(reader, ofp.common.bucket.unpack)
+ return obj
+
+ def __eq__(self, other):
+ if type(self) != type(other): return False
+ if self.group_type != other.group_type: return False
+ if self.group_id != other.group_id: return False
+ if self.buckets != other.buckets: return False
+ return True
+
+ def pretty_print(self, q):
+ q.text("group_desc_stats_entry {")
+ with q.group():
+ with q.indent(2):
+ q.breakable()
+ q.text("group_type = ");
+ q.text("%#x" % self.group_type)
+ q.text(","); q.breakable()
+ q.text("group_id = ");
+ q.text("%#x" % self.group_id)
+ q.text(","); q.breakable()
+ q.text("buckets = ");
+ q.pp(self.buckets)
+ q.breakable()
+ q.text('}')
+
+
+class group_stats_entry(loxi.OFObject):
+
+ def __init__(self, group_id=None, ref_count=None, packet_count=None, byte_count=None, duration_sec=None, duration_nsec=None, bucket_stats=None):
+ if group_id != None:
+ self.group_id = group_id
+ else:
+ self.group_id = 0
+ if ref_count != None:
+ self.ref_count = ref_count
+ else:
+ self.ref_count = 0
+ if packet_count != None:
+ self.packet_count = packet_count
+ else:
+ self.packet_count = 0
+ if byte_count != None:
+ self.byte_count = byte_count
+ else:
+ self.byte_count = 0
+ if duration_sec != None:
+ self.duration_sec = duration_sec
+ else:
+ self.duration_sec = 0
+ if duration_nsec != None:
+ self.duration_nsec = duration_nsec
+ else:
+ self.duration_nsec = 0
+ if bucket_stats != None:
+ self.bucket_stats = bucket_stats
+ else:
+ self.bucket_stats = []
+ return
+
+ def pack(self):
+ packed = []
+ packed.append(struct.pack("!H", 0)) # placeholder for length at index 0
+ packed.append('\x00' * 2)
+ packed.append(struct.pack("!L", self.group_id))
+ packed.append(struct.pack("!L", self.ref_count))
+ packed.append('\x00' * 4)
+ packed.append(struct.pack("!Q", self.packet_count))
+ packed.append(struct.pack("!Q", self.byte_count))
+ packed.append(struct.pack("!L", self.duration_sec))
+ packed.append(struct.pack("!L", self.duration_nsec))
+ packed.append(loxi.generic_util.pack_list(self.bucket_stats))
+ length = sum([len(x) for x in packed])
+ packed[0] = struct.pack("!H", length)
+ return ''.join(packed)
+
+ @staticmethod
+ def unpack(reader):
+ obj = group_stats_entry()
+ _length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length, 2)
+ reader.skip(2)
+ obj.group_id = reader.read("!L")[0]
+ obj.ref_count = reader.read("!L")[0]
+ reader.skip(4)
+ obj.packet_count = reader.read("!Q")[0]
+ obj.byte_count = reader.read("!Q")[0]
+ obj.duration_sec = reader.read("!L")[0]
+ obj.duration_nsec = reader.read("!L")[0]
+ obj.bucket_stats = loxi.generic_util.unpack_list(reader, ofp.common.bucket_counter.unpack)
+ return obj
+
+ def __eq__(self, other):
+ if type(self) != type(other): return False
+ if self.group_id != other.group_id: return False
+ if self.ref_count != other.ref_count: return False
+ if self.packet_count != other.packet_count: return False
+ if self.byte_count != other.byte_count: return False
+ if self.duration_sec != other.duration_sec: return False
+ if self.duration_nsec != other.duration_nsec: return False
+ if self.bucket_stats != other.bucket_stats: return False
+ return True
+
+ def pretty_print(self, q):
+ q.text("group_stats_entry {")
+ with q.group():
+ with q.indent(2):
+ q.breakable()
+ q.text("group_id = ");
+ q.text("%#x" % self.group_id)
+ q.text(","); q.breakable()
+ q.text("ref_count = ");
+ q.text("%#x" % self.ref_count)
+ q.text(","); q.breakable()
+ q.text("packet_count = ");
+ q.text("%#x" % self.packet_count)
+ q.text(","); q.breakable()
+ q.text("byte_count = ");
+ q.text("%#x" % self.byte_count)
+ q.text(","); q.breakable()
+ q.text("duration_sec = ");
+ q.text("%#x" % self.duration_sec)
+ q.text(","); q.breakable()
+ q.text("duration_nsec = ");
+ q.text("%#x" % self.duration_nsec)
+ q.text(","); q.breakable()
+ q.text("bucket_stats = ");
+ q.pp(self.bucket_stats)
+ q.breakable()
+ q.text('}')
+
+
+class hello_elem(loxi.OFObject):
+ subtypes = {}
+
+
+ def __init__(self, type=None):
+ if type != None:
+ self.type = type
+ else:
+ self.type = 0
+ return
+
+ def pack(self):
+ packed = []
+ packed.append(struct.pack("!H", self.type))
+ packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
+ length = sum([len(x) for x in packed])
+ packed[1] = struct.pack("!H", length)
+ return ''.join(packed)
+
+ @staticmethod
+ def unpack(reader):
+ subtype, = reader.peek('!H', 0)
+ subclass = hello_elem.subtypes.get(subtype)
+ if subclass:
+ return subclass.unpack(reader)
+
+ obj = hello_elem()
+ obj.type = reader.read("!H")[0]
+ _length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length, 4)
+ return obj
+
+ def __eq__(self, other):
+ if type(self) != type(other): return False
+ if self.type != other.type: return False
+ return True
+
+ def pretty_print(self, q):
+ q.text("hello_elem {")
+ with q.group():
+ with q.indent(2):
+ q.breakable()
+ q.breakable()
+ q.text('}')
+
+
+class hello_elem_versionbitmap(hello_elem):
+ type = 1
+
+ def __init__(self, bitmaps=None):
+ if bitmaps != None:
+ self.bitmaps = bitmaps
+ else:
+ self.bitmaps = []
+ return
+
+ def pack(self):
+ packed = []
+ packed.append(struct.pack("!H", self.type))
+ packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
+ packed.append(loxi.generic_util.pack_list(self.bitmaps))
+ length = sum([len(x) for x in packed])
+ packed[1] = struct.pack("!H", length)
+ return ''.join(packed)
+
+ @staticmethod
+ def unpack(reader):
+ obj = hello_elem_versionbitmap()
+ _type = reader.read("!H")[0]
+ assert(_type == 1)
+ _length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length, 4)
+ obj.bitmaps = loxi.generic_util.unpack_list(reader, ofp.common.uint32.unpack)
+ return obj
+
+ def __eq__(self, other):
+ if type(self) != type(other): return False
+ if self.bitmaps != other.bitmaps: return False
+ return True
+
+ def pretty_print(self, q):
+ q.text("hello_elem_versionbitmap {")
+ with q.group():
+ with q.indent(2):
+ q.breakable()
+ q.text("bitmaps = ");
+ q.pp(self.bitmaps)
+ q.breakable()
+ q.text('}')
+
+hello_elem.subtypes[1] = hello_elem_versionbitmap
+
+class match_v3(loxi.OFObject):
+ type = 1
+
+ def __init__(self, oxm_list=None):
+ if oxm_list != None:
+ self.oxm_list = oxm_list
+ else:
+ self.oxm_list = []
+ return
+
+ def pack(self):
+ packed = []
+ packed.append(struct.pack("!H", self.type))
+ packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
+ packed.append(loxi.generic_util.pack_list(self.oxm_list))
+ length = sum([len(x) for x in packed])
+ packed[1] = struct.pack("!H", length)
+ packed.append(loxi.generic_util.pad_to(8, length))
+ return ''.join(packed)
+
+ @staticmethod
+ def unpack(reader):
+ obj = match_v3()
+ _type = reader.read("!H")[0]
+ assert(_type == 1)
+ _length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length, 4)
+ obj.oxm_list = loxi.generic_util.unpack_list(reader, ofp.oxm.oxm.unpack)
+ orig_reader.skip_align()
+ return obj
+
+ def __eq__(self, other):
+ if type(self) != type(other): return False
+ if self.oxm_list != other.oxm_list: return False
+ return True
+
+ def pretty_print(self, q):
+ q.text("match_v3 {")
+ with q.group():
+ with q.indent(2):
+ q.breakable()
+ q.text("oxm_list = ");
+ q.pp(self.oxm_list)
+ q.breakable()
+ q.text('}')
+
+
+class meter_band_stats(loxi.OFObject):
+
+ def __init__(self, packet_band_count=None, byte_band_count=None):
+ if packet_band_count != None:
+ self.packet_band_count = packet_band_count
+ else:
+ self.packet_band_count = 0
+ if byte_band_count != None:
+ self.byte_band_count = byte_band_count
+ else:
+ self.byte_band_count = 0
+ return
+
+ def pack(self):
+ packed = []
+ packed.append(struct.pack("!Q", self.packet_band_count))
+ packed.append(struct.pack("!Q", self.byte_band_count))
+ return ''.join(packed)
+
+ @staticmethod
+ def unpack(reader):
+ obj = meter_band_stats()
+ obj.packet_band_count = reader.read("!Q")[0]
+ obj.byte_band_count = reader.read("!Q")[0]
+ return obj
+
+ def __eq__(self, other):
+ if type(self) != type(other): return False
+ if self.packet_band_count != other.packet_band_count: return False
+ if self.byte_band_count != other.byte_band_count: return False
+ return True
+
+ def pretty_print(self, q):
+ q.text("meter_band_stats {")
+ with q.group():
+ with q.indent(2):
+ q.breakable()
+ q.text("packet_band_count = ");
+ q.text("%#x" % self.packet_band_count)
+ q.text(","); q.breakable()
+ q.text("byte_band_count = ");
+ q.text("%#x" % self.byte_band_count)
+ q.breakable()
+ q.text('}')
+
+
+class meter_config(loxi.OFObject):
+
+ def __init__(self, flags=None, meter_id=None, entries=None):
+ if flags != None:
+ self.flags = flags
+ else:
+ self.flags = 0
+ if meter_id != None:
+ self.meter_id = meter_id
+ else:
+ self.meter_id = 0
+ if entries != None:
+ self.entries = entries
+ else:
+ self.entries = []
+ return
+
+ def pack(self):
+ packed = []
+ packed.append(struct.pack("!H", 0)) # placeholder for length at index 0
+ packed.append(struct.pack("!H", self.flags))
+ packed.append(struct.pack("!L", self.meter_id))
+ packed.append(loxi.generic_util.pack_list(self.entries))
+ length = sum([len(x) for x in packed])
+ packed[0] = struct.pack("!H", length)
+ return ''.join(packed)
+
+ @staticmethod
+ def unpack(reader):
+ obj = meter_config()
+ _length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length, 2)
+ obj.flags = reader.read("!H")[0]
+ obj.meter_id = reader.read("!L")[0]
+ obj.entries = loxi.generic_util.unpack_list(reader, ofp.meter_band.meter_band.unpack)
+ return obj
+
+ def __eq__(self, other):
+ if type(self) != type(other): return False
+ if self.flags != other.flags: return False
+ if self.meter_id != other.meter_id: return False
+ if self.entries != other.entries: return False
+ return True
+
+ def pretty_print(self, q):
+ q.text("meter_config {")
+ with q.group():
+ with q.indent(2):
+ q.breakable()
+ q.text("flags = ");
+ q.text("%#x" % self.flags)
+ q.text(","); q.breakable()
+ q.text("meter_id = ");
+ q.text("%#x" % self.meter_id)
+ q.text(","); q.breakable()
+ q.text("entries = ");
+ q.pp(self.entries)
+ q.breakable()
+ q.text('}')
+
+
+class meter_features(loxi.OFObject):
+
+ def __init__(self, max_meter=None, band_types=None, capabilities=None, max_bands=None, max_color=None):
+ if max_meter != None:
+ self.max_meter = max_meter
+ else:
+ self.max_meter = 0
+ if band_types != None:
+ self.band_types = band_types
+ else:
+ self.band_types = 0
+ if capabilities != None:
+ self.capabilities = capabilities
+ else:
+ self.capabilities = 0
+ if max_bands != None:
+ self.max_bands = max_bands
+ else:
+ self.max_bands = 0
+ if max_color != None:
+ self.max_color = max_color
+ else:
+ self.max_color = 0
+ return
+
+ def pack(self):
+ packed = []
+ packed.append(struct.pack("!L", self.max_meter))
+ packed.append(struct.pack("!L", self.band_types))
+ packed.append(struct.pack("!L", self.capabilities))
+ packed.append(struct.pack("!B", self.max_bands))
+ packed.append(struct.pack("!B", self.max_color))
+ packed.append('\x00' * 2)
+ return ''.join(packed)
+
+ @staticmethod
+ def unpack(reader):
+ obj = meter_features()
+ obj.max_meter = reader.read("!L")[0]
+ obj.band_types = reader.read("!L")[0]
+ obj.capabilities = reader.read("!L")[0]
+ obj.max_bands = reader.read("!B")[0]
+ obj.max_color = reader.read("!B")[0]
+ reader.skip(2)
+ return obj
+
+ def __eq__(self, other):
+ if type(self) != type(other): return False
+ if self.max_meter != other.max_meter: return False
+ if self.band_types != other.band_types: return False
+ if self.capabilities != other.capabilities: return False
+ if self.max_bands != other.max_bands: return False
+ if self.max_color != other.max_color: return False
+ return True
+
+ def pretty_print(self, q):
+ q.text("meter_features {")
+ with q.group():
+ with q.indent(2):
+ q.breakable()
+ q.text("max_meter = ");
+ q.text("%#x" % self.max_meter)
+ q.text(","); q.breakable()
+ q.text("band_types = ");
+ q.text("%#x" % self.band_types)
+ q.text(","); q.breakable()
+ q.text("capabilities = ");
+ q.text("%#x" % self.capabilities)
+ q.text(","); q.breakable()
+ q.text("max_bands = ");
+ q.text("%#x" % self.max_bands)
+ q.text(","); q.breakable()
+ q.text("max_color = ");
+ q.text("%#x" % self.max_color)
+ q.breakable()
+ q.text('}')
+
+
+class meter_stats(loxi.OFObject):
+
+ 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):
+ if meter_id != None:
+ self.meter_id = meter_id
+ else:
+ self.meter_id = 0
+ if flow_count != None:
+ self.flow_count = flow_count
+ else:
+ self.flow_count = 0
+ if packet_in_count != None:
+ self.packet_in_count = packet_in_count
+ else:
+ self.packet_in_count = 0
+ if byte_in_count != None:
+ self.byte_in_count = byte_in_count
+ else:
+ self.byte_in_count = 0
+ if duration_sec != None:
+ self.duration_sec = duration_sec
+ else:
+ self.duration_sec = 0
+ if duration_nsec != None:
+ self.duration_nsec = duration_nsec
+ else:
+ self.duration_nsec = 0
+ if band_stats != None:
+ self.band_stats = band_stats
+ else:
+ self.band_stats = []
+ return
+
+ def pack(self):
+ packed = []
+ packed.append(struct.pack("!L", self.meter_id))
+ packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
+ packed.append('\x00' * 6)
+ packed.append(struct.pack("!L", self.flow_count))
+ packed.append(struct.pack("!Q", self.packet_in_count))
+ packed.append(struct.pack("!Q", self.byte_in_count))
+ packed.append(struct.pack("!L", self.duration_sec))
+ packed.append(struct.pack("!L", self.duration_nsec))
+ packed.append(loxi.generic_util.pack_list(self.band_stats))
+ length = sum([len(x) for x in packed])
+ packed[1] = struct.pack("!H", length)
+ return ''.join(packed)
+
+ @staticmethod
+ def unpack(reader):
+ obj = meter_stats()
+ obj.meter_id = reader.read("!L")[0]
+ _len = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_len, 6)
+ reader.skip(6)
+ obj.flow_count = reader.read("!L")[0]
+ obj.packet_in_count = reader.read("!Q")[0]
+ obj.byte_in_count = reader.read("!Q")[0]
+ obj.duration_sec = reader.read("!L")[0]
+ obj.duration_nsec = reader.read("!L")[0]
+ obj.band_stats = loxi.generic_util.unpack_list(reader, ofp.common.meter_band_stats.unpack)
+ return obj
+
+ def __eq__(self, other):
+ if type(self) != type(other): return False
+ if self.meter_id != other.meter_id: return False
+ if self.flow_count != other.flow_count: return False
+ if self.packet_in_count != other.packet_in_count: return False
+ if self.byte_in_count != other.byte_in_count: return False
+ if self.duration_sec != other.duration_sec: return False
+ if self.duration_nsec != other.duration_nsec: return False
+ if self.band_stats != other.band_stats: return False
+ return True
+
+ def pretty_print(self, q):
+ q.text("meter_stats {")
+ with q.group():
+ with q.indent(2):
+ q.breakable()
+ q.text("meter_id = ");
+ q.text("%#x" % self.meter_id)
+ q.text(","); q.breakable()
+ q.text("flow_count = ");
+ q.text("%#x" % self.flow_count)
+ q.text(","); q.breakable()
+ q.text("packet_in_count = ");
+ q.text("%#x" % self.packet_in_count)
+ q.text(","); q.breakable()
+ q.text("byte_in_count = ");
+ q.text("%#x" % self.byte_in_count)
+ q.text(","); q.breakable()
+ q.text("duration_sec = ");
+ q.text("%#x" % self.duration_sec)
+ q.text(","); q.breakable()
+ q.text("duration_nsec = ");
+ q.text("%#x" % self.duration_nsec)
+ q.text(","); q.breakable()
+ q.text("band_stats = ");
+ q.pp(self.band_stats)
+ q.breakable()
+ q.text('}')
+
+
+class packet_queue(loxi.OFObject):
+
+ def __init__(self, queue_id=None, port=None, properties=None):
+ if queue_id != None:
+ self.queue_id = queue_id
+ else:
+ self.queue_id = 0
+ if port != None:
+ self.port = port
+ else:
+ self.port = 0
+ if properties != None:
+ self.properties = properties
+ else:
+ self.properties = []
+ return
+
+ def pack(self):
+ packed = []
+ packed.append(struct.pack("!L", self.queue_id))
+ packed.append(util.pack_port_no(self.port))
+ packed.append(struct.pack("!H", 0)) # placeholder for len at index 2
+ packed.append('\x00' * 6)
+ packed.append(loxi.generic_util.pack_list(self.properties))
+ length = sum([len(x) for x in packed])
+ packed[2] = struct.pack("!H", length)
+ return ''.join(packed)
+
+ @staticmethod
+ def unpack(reader):
+ obj = packet_queue()
+ obj.queue_id = reader.read("!L")[0]
+ obj.port = util.unpack_port_no(reader)
+ _len = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_len, 10)
+ reader.skip(6)
+ obj.properties = loxi.generic_util.unpack_list(reader, ofp.common.queue_prop.unpack)
+ return obj
+
+ def __eq__(self, other):
+ if type(self) != type(other): return False
+ if self.queue_id != other.queue_id: return False
+ if self.port != other.port: return False
+ if self.properties != other.properties: return False
+ return True
+
+ def pretty_print(self, q):
+ q.text("packet_queue {")
+ with q.group():
+ with q.indent(2):
+ q.breakable()
+ q.text("queue_id = ");
+ q.text("%#x" % self.queue_id)
+ q.text(","); q.breakable()
+ q.text("port = ");
+ q.text(util.pretty_port(self.port))
+ q.text(","); q.breakable()
+ q.text("properties = ");
+ q.pp(self.properties)
+ q.breakable()
+ q.text('}')
+
+
+class port_desc(loxi.OFObject):
+
+ def __init__(self, port_no=None, hw_addr=None, name=None, config=None, state=None, curr=None, advertised=None, supported=None, peer=None, curr_speed=None, max_speed=None):
+ if port_no != None:
+ self.port_no = port_no
+ else:
+ self.port_no = 0
+ if hw_addr != None:
+ self.hw_addr = hw_addr
+ else:
+ self.hw_addr = [0,0,0,0,0,0]
+ if name != None:
+ self.name = name
+ else:
+ self.name = ""
+ if config != None:
+ self.config = config
+ else:
+ self.config = 0
+ if state != None:
+ self.state = state
+ else:
+ self.state = 0
+ if curr != None:
+ self.curr = curr
+ else:
+ self.curr = 0
+ if advertised != None:
+ self.advertised = advertised
+ else:
+ self.advertised = 0
+ if supported != None:
+ self.supported = supported
+ else:
+ self.supported = 0
+ if peer != None:
+ self.peer = peer
+ else:
+ self.peer = 0
+ if curr_speed != None:
+ self.curr_speed = curr_speed
+ else:
+ self.curr_speed = 0
+ if max_speed != None:
+ self.max_speed = max_speed
+ else:
+ self.max_speed = 0
+ return
+
+ def pack(self):
+ packed = []
+ packed.append(util.pack_port_no(self.port_no))
+ packed.append('\x00' * 4)
+ packed.append(struct.pack("!6B", *self.hw_addr))
+ packed.append('\x00' * 2)
+ packed.append(struct.pack("!16s", self.name))
+ packed.append(struct.pack("!L", self.config))
+ packed.append(struct.pack("!L", self.state))
+ packed.append(struct.pack("!L", self.curr))
+ packed.append(struct.pack("!L", self.advertised))
+ packed.append(struct.pack("!L", self.supported))
+ packed.append(struct.pack("!L", self.peer))
+ packed.append(struct.pack("!L", self.curr_speed))
+ packed.append(struct.pack("!L", self.max_speed))
+ return ''.join(packed)
+
+ @staticmethod
+ def unpack(reader):
+ obj = port_desc()
+ obj.port_no = util.unpack_port_no(reader)
+ reader.skip(4)
+ obj.hw_addr = list(reader.read('!6B'))
+ reader.skip(2)
+ obj.name = reader.read("!16s")[0].rstrip("\x00")
+ obj.config = reader.read("!L")[0]
+ obj.state = reader.read("!L")[0]
+ obj.curr = reader.read("!L")[0]
+ obj.advertised = reader.read("!L")[0]
+ obj.supported = reader.read("!L")[0]
+ obj.peer = reader.read("!L")[0]
+ obj.curr_speed = reader.read("!L")[0]
+ obj.max_speed = reader.read("!L")[0]
+ return obj
+
+ def __eq__(self, other):
+ if type(self) != type(other): return False
+ if self.port_no != other.port_no: return False
+ if self.hw_addr != other.hw_addr: return False
+ if self.name != other.name: return False
+ if self.config != other.config: return False
+ if self.state != other.state: return False
+ if self.curr != other.curr: return False
+ if self.advertised != other.advertised: return False
+ if self.supported != other.supported: return False
+ if self.peer != other.peer: return False
+ if self.curr_speed != other.curr_speed: return False
+ if self.max_speed != other.max_speed: return False
+ return True
+
+ def pretty_print(self, q):
+ q.text("port_desc {")
+ with q.group():
+ with q.indent(2):
+ q.breakable()
+ q.text("port_no = ");
+ q.text(util.pretty_port(self.port_no))
+ q.text(","); q.breakable()
+ q.text("hw_addr = ");
+ q.text(util.pretty_mac(self.hw_addr))
+ q.text(","); q.breakable()
+ q.text("name = ");
+ q.pp(self.name)
+ q.text(","); q.breakable()
+ q.text("config = ");
+ q.text("%#x" % self.config)
+ q.text(","); q.breakable()
+ q.text("state = ");
+ q.text("%#x" % self.state)
+ q.text(","); q.breakable()
+ q.text("curr = ");
+ q.text("%#x" % self.curr)
+ q.text(","); q.breakable()
+ q.text("advertised = ");
+ q.text("%#x" % self.advertised)
+ q.text(","); q.breakable()
+ q.text("supported = ");
+ q.text("%#x" % self.supported)
+ q.text(","); q.breakable()
+ q.text("peer = ");
+ q.text("%#x" % self.peer)
+ q.text(","); q.breakable()
+ q.text("curr_speed = ");
+ q.text("%#x" % self.curr_speed)
+ q.text(","); q.breakable()
+ q.text("max_speed = ");
+ q.text("%#x" % self.max_speed)
+ q.breakable()
+ q.text('}')
+
+
+class port_stats_entry(loxi.OFObject):
+
+ def __init__(self, port_no=None, rx_packets=None, tx_packets=None, rx_bytes=None, tx_bytes=None, rx_dropped=None, tx_dropped=None, rx_errors=None, tx_errors=None, rx_frame_err=None, rx_over_err=None, rx_crc_err=None, collisions=None, duration_sec=None, duration_nsec=None):
+ if port_no != None:
+ self.port_no = port_no
+ else:
+ self.port_no = 0
+ if rx_packets != None:
+ self.rx_packets = rx_packets
+ else:
+ self.rx_packets = 0
+ if tx_packets != None:
+ self.tx_packets = tx_packets
+ else:
+ self.tx_packets = 0
+ if rx_bytes != None:
+ self.rx_bytes = rx_bytes
+ else:
+ self.rx_bytes = 0
+ if tx_bytes != None:
+ self.tx_bytes = tx_bytes
+ else:
+ self.tx_bytes = 0
+ if rx_dropped != None:
+ self.rx_dropped = rx_dropped
+ else:
+ self.rx_dropped = 0
+ if tx_dropped != None:
+ self.tx_dropped = tx_dropped
+ else:
+ self.tx_dropped = 0
+ if rx_errors != None:
+ self.rx_errors = rx_errors
+ else:
+ self.rx_errors = 0
+ if tx_errors != None:
+ self.tx_errors = tx_errors
+ else:
+ self.tx_errors = 0
+ if rx_frame_err != None:
+ self.rx_frame_err = rx_frame_err
+ else:
+ self.rx_frame_err = 0
+ if rx_over_err != None:
+ self.rx_over_err = rx_over_err
+ else:
+ self.rx_over_err = 0
+ if rx_crc_err != None:
+ self.rx_crc_err = rx_crc_err
+ else:
+ self.rx_crc_err = 0
+ if collisions != None:
+ self.collisions = collisions
+ else:
+ self.collisions = 0
+ if duration_sec != None:
+ self.duration_sec = duration_sec
+ else:
+ self.duration_sec = 0
+ if duration_nsec != None:
+ self.duration_nsec = duration_nsec
+ else:
+ self.duration_nsec = 0
+ return
+
+ def pack(self):
+ packed = []
+ packed.append(util.pack_port_no(self.port_no))
+ packed.append('\x00' * 4)
+ packed.append(struct.pack("!Q", self.rx_packets))
+ packed.append(struct.pack("!Q", self.tx_packets))
+ packed.append(struct.pack("!Q", self.rx_bytes))
+ packed.append(struct.pack("!Q", self.tx_bytes))
+ packed.append(struct.pack("!Q", self.rx_dropped))
+ packed.append(struct.pack("!Q", self.tx_dropped))
+ packed.append(struct.pack("!Q", self.rx_errors))
+ packed.append(struct.pack("!Q", self.tx_errors))
+ packed.append(struct.pack("!Q", self.rx_frame_err))
+ packed.append(struct.pack("!Q", self.rx_over_err))
+ packed.append(struct.pack("!Q", self.rx_crc_err))
+ packed.append(struct.pack("!Q", self.collisions))
+ packed.append(struct.pack("!L", self.duration_sec))
+ packed.append(struct.pack("!L", self.duration_nsec))
+ return ''.join(packed)
+
+ @staticmethod
+ def unpack(reader):
+ obj = port_stats_entry()
+ obj.port_no = util.unpack_port_no(reader)
+ reader.skip(4)
+ obj.rx_packets = reader.read("!Q")[0]
+ obj.tx_packets = reader.read("!Q")[0]
+ obj.rx_bytes = reader.read("!Q")[0]
+ obj.tx_bytes = reader.read("!Q")[0]
+ obj.rx_dropped = reader.read("!Q")[0]
+ obj.tx_dropped = reader.read("!Q")[0]
+ obj.rx_errors = reader.read("!Q")[0]
+ obj.tx_errors = reader.read("!Q")[0]
+ obj.rx_frame_err = reader.read("!Q")[0]
+ obj.rx_over_err = reader.read("!Q")[0]
+ obj.rx_crc_err = reader.read("!Q")[0]
+ obj.collisions = reader.read("!Q")[0]
+ obj.duration_sec = reader.read("!L")[0]
+ obj.duration_nsec = reader.read("!L")[0]
+ return obj
+
+ def __eq__(self, other):
+ if type(self) != type(other): return False
+ if self.port_no != other.port_no: return False
+ if self.rx_packets != other.rx_packets: return False
+ if self.tx_packets != other.tx_packets: return False
+ if self.rx_bytes != other.rx_bytes: return False
+ if self.tx_bytes != other.tx_bytes: return False
+ if self.rx_dropped != other.rx_dropped: return False
+ if self.tx_dropped != other.tx_dropped: return False
+ if self.rx_errors != other.rx_errors: return False
+ if self.tx_errors != other.tx_errors: return False
+ if self.rx_frame_err != other.rx_frame_err: return False
+ if self.rx_over_err != other.rx_over_err: return False
+ if self.rx_crc_err != other.rx_crc_err: return False
+ if self.collisions != other.collisions: return False
+ if self.duration_sec != other.duration_sec: return False
+ if self.duration_nsec != other.duration_nsec: return False
+ return True
+
+ def pretty_print(self, q):
+ q.text("port_stats_entry {")
+ with q.group():
+ with q.indent(2):
+ q.breakable()
+ q.text("port_no = ");
+ q.text(util.pretty_port(self.port_no))
+ q.text(","); q.breakable()
+ q.text("rx_packets = ");
+ q.text("%#x" % self.rx_packets)
+ q.text(","); q.breakable()
+ q.text("tx_packets = ");
+ q.text("%#x" % self.tx_packets)
+ q.text(","); q.breakable()
+ q.text("rx_bytes = ");
+ q.text("%#x" % self.rx_bytes)
+ q.text(","); q.breakable()
+ q.text("tx_bytes = ");
+ q.text("%#x" % self.tx_bytes)
+ q.text(","); q.breakable()
+ q.text("rx_dropped = ");
+ q.text("%#x" % self.rx_dropped)
+ q.text(","); q.breakable()
+ q.text("tx_dropped = ");
+ q.text("%#x" % self.tx_dropped)
+ q.text(","); q.breakable()
+ q.text("rx_errors = ");
+ q.text("%#x" % self.rx_errors)
+ q.text(","); q.breakable()
+ q.text("tx_errors = ");
+ q.text("%#x" % self.tx_errors)
+ q.text(","); q.breakable()
+ q.text("rx_frame_err = ");
+ q.text("%#x" % self.rx_frame_err)
+ q.text(","); q.breakable()
+ q.text("rx_over_err = ");
+ q.text("%#x" % self.rx_over_err)
+ q.text(","); q.breakable()
+ q.text("rx_crc_err = ");
+ q.text("%#x" % self.rx_crc_err)
+ q.text(","); q.breakable()
+ q.text("collisions = ");
+ q.text("%#x" % self.collisions)
+ q.text(","); q.breakable()
+ q.text("duration_sec = ");
+ q.text("%#x" % self.duration_sec)
+ q.text(","); q.breakable()
+ q.text("duration_nsec = ");
+ q.text("%#x" % self.duration_nsec)
+ q.breakable()
+ q.text('}')
+
+
+class queue_prop(loxi.OFObject):
+ subtypes = {}
+
+
+ def __init__(self, type=None):
+ if type != None:
+ self.type = type
+ else:
+ self.type = 0
+ return
+
+ def pack(self):
+ packed = []
+ packed.append(struct.pack("!H", self.type))
+ packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
+ packed.append('\x00' * 4)
+ length = sum([len(x) for x in packed])
+ packed[1] = struct.pack("!H", length)
+ return ''.join(packed)
+
+ @staticmethod
+ def unpack(reader):
+ subtype, = reader.peek('!H', 0)
+ subclass = queue_prop.subtypes.get(subtype)
+ if subclass:
+ return subclass.unpack(reader)
+
+ obj = queue_prop()
+ obj.type = reader.read("!H")[0]
+ _len = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_len, 4)
+ reader.skip(4)
+ return obj
+
+ def __eq__(self, other):
+ if type(self) != type(other): return False
+ if self.type != other.type: return False
+ return True
+
+ def pretty_print(self, q):
+ q.text("queue_prop {")
+ with q.group():
+ with q.indent(2):
+ q.breakable()
+ q.breakable()
+ q.text('}')
+
+
+class queue_prop_experimenter(queue_prop):
+ subtypes = {}
+
+ type = 65535
+
+ def __init__(self, experimenter=None, data=None):
+ if experimenter != None:
+ self.experimenter = experimenter
+ else:
+ self.experimenter = 0
+ if data != None:
+ self.data = data
+ else:
+ self.data = ''
+ return
+
+ def pack(self):
+ packed = []
+ packed.append(struct.pack("!H", self.type))
+ packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
+ packed.append('\x00' * 4)
+ packed.append(struct.pack("!L", self.experimenter))
+ packed.append('\x00' * 4)
+ packed.append(self.data)
+ length = sum([len(x) for x in packed])
+ packed[1] = struct.pack("!H", length)
+ return ''.join(packed)
+
+ @staticmethod
+ def unpack(reader):
+ subtype, = reader.peek('!L', 8)
+ subclass = queue_prop_experimenter.subtypes.get(subtype)
+ if subclass:
+ return subclass.unpack(reader)
+
+ obj = queue_prop_experimenter()
+ _type = reader.read("!H")[0]
+ assert(_type == 65535)
+ _len = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_len, 4)
+ reader.skip(4)
+ obj.experimenter = reader.read("!L")[0]
+ reader.skip(4)
+ obj.data = str(reader.read_all())
+ return obj
+
+ def __eq__(self, other):
+ if type(self) != type(other): return False
+ if self.experimenter != other.experimenter: return False
+ if self.data != other.data: return False
+ return True
+
+ def pretty_print(self, q):
+ q.text("queue_prop_experimenter {")
+ with q.group():
+ with q.indent(2):
+ q.breakable()
+ q.text("data = ");
+ q.pp(self.data)
+ q.breakable()
+ q.text('}')
+
+queue_prop.subtypes[65535] = queue_prop_experimenter
+
+class queue_prop_max_rate(queue_prop):
+ type = 2
+
+ def __init__(self, rate=None):
+ if rate != None:
+ self.rate = rate
+ else:
+ self.rate = 0
+ return
+
+ def pack(self):
+ packed = []
+ packed.append(struct.pack("!H", self.type))
+ packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
+ packed.append('\x00' * 4)
+ packed.append(struct.pack("!H", self.rate))
+ packed.append('\x00' * 6)
+ length = sum([len(x) for x in packed])
+ packed[1] = struct.pack("!H", length)
+ return ''.join(packed)
+
+ @staticmethod
+ def unpack(reader):
+ obj = queue_prop_max_rate()
+ _type = reader.read("!H")[0]
+ assert(_type == 2)
+ _len = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_len, 4)
+ reader.skip(4)
+ obj.rate = reader.read("!H")[0]
+ reader.skip(6)
+ return obj
+
+ def __eq__(self, other):
+ if type(self) != type(other): return False
+ if self.rate != other.rate: return False
+ return True
+
+ def pretty_print(self, q):
+ q.text("queue_prop_max_rate {")
+ with q.group():
+ with q.indent(2):
+ q.breakable()
+ q.text("rate = ");
+ q.text("%#x" % self.rate)
+ q.breakable()
+ q.text('}')
+
+queue_prop.subtypes[2] = queue_prop_max_rate
+
+class queue_prop_min_rate(queue_prop):
+ type = 1
+
+ def __init__(self, rate=None):
+ if rate != None:
+ self.rate = rate
+ else:
+ self.rate = 0
+ return
+
+ def pack(self):
+ packed = []
+ packed.append(struct.pack("!H", self.type))
+ packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
+ packed.append('\x00' * 4)
+ packed.append(struct.pack("!H", self.rate))
+ packed.append('\x00' * 6)
+ length = sum([len(x) for x in packed])
+ packed[1] = struct.pack("!H", length)
+ return ''.join(packed)
+
+ @staticmethod
+ def unpack(reader):
+ obj = queue_prop_min_rate()
+ _type = reader.read("!H")[0]
+ assert(_type == 1)
+ _len = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_len, 4)
+ reader.skip(4)
+ obj.rate = reader.read("!H")[0]
+ reader.skip(6)
+ return obj
+
+ def __eq__(self, other):
+ if type(self) != type(other): return False
+ if self.rate != other.rate: return False
+ return True
+
+ def pretty_print(self, q):
+ q.text("queue_prop_min_rate {")
+ with q.group():
+ with q.indent(2):
+ q.breakable()
+ q.text("rate = ");
+ q.text("%#x" % self.rate)
+ q.breakable()
+ q.text('}')
+
+queue_prop.subtypes[1] = queue_prop_min_rate
+
+class queue_stats_entry(loxi.OFObject):
+
+ def __init__(self, port_no=None, queue_id=None, tx_bytes=None, tx_packets=None, tx_errors=None, duration_sec=None, duration_nsec=None):
+ if port_no != None:
+ self.port_no = port_no
+ else:
+ self.port_no = 0
+ if queue_id != None:
+ self.queue_id = queue_id
+ else:
+ self.queue_id = 0
+ if tx_bytes != None:
+ self.tx_bytes = tx_bytes
+ else:
+ self.tx_bytes = 0
+ if tx_packets != None:
+ self.tx_packets = tx_packets
+ else:
+ self.tx_packets = 0
+ if tx_errors != None:
+ self.tx_errors = tx_errors
+ else:
+ self.tx_errors = 0
+ if duration_sec != None:
+ self.duration_sec = duration_sec
+ else:
+ self.duration_sec = 0
+ if duration_nsec != None:
+ self.duration_nsec = duration_nsec
+ else:
+ self.duration_nsec = 0
+ return
+
+ def pack(self):
+ packed = []
+ packed.append(util.pack_port_no(self.port_no))
+ packed.append(struct.pack("!L", self.queue_id))
+ packed.append(struct.pack("!Q", self.tx_bytes))
+ packed.append(struct.pack("!Q", self.tx_packets))
+ packed.append(struct.pack("!Q", self.tx_errors))
+ packed.append(struct.pack("!L", self.duration_sec))
+ packed.append(struct.pack("!L", self.duration_nsec))
+ return ''.join(packed)
+
+ @staticmethod
+ def unpack(reader):
+ obj = queue_stats_entry()
+ obj.port_no = util.unpack_port_no(reader)
+ obj.queue_id = reader.read("!L")[0]
+ obj.tx_bytes = reader.read("!Q")[0]
+ obj.tx_packets = reader.read("!Q")[0]
+ obj.tx_errors = reader.read("!Q")[0]
+ obj.duration_sec = reader.read("!L")[0]
+ obj.duration_nsec = reader.read("!L")[0]
+ return obj
+
+ def __eq__(self, other):
+ if type(self) != type(other): return False
+ if self.port_no != other.port_no: return False
+ if self.queue_id != other.queue_id: return False
+ if self.tx_bytes != other.tx_bytes: return False
+ if self.tx_packets != other.tx_packets: return False
+ if self.tx_errors != other.tx_errors: return False
+ if self.duration_sec != other.duration_sec: return False
+ if self.duration_nsec != other.duration_nsec: return False
+ return True
+
+ def pretty_print(self, q):
+ q.text("queue_stats_entry {")
+ with q.group():
+ with q.indent(2):
+ q.breakable()
+ q.text("port_no = ");
+ q.text(util.pretty_port(self.port_no))
+ q.text(","); q.breakable()
+ q.text("queue_id = ");
+ q.text("%#x" % self.queue_id)
+ q.text(","); q.breakable()
+ q.text("tx_bytes = ");
+ q.text("%#x" % self.tx_bytes)
+ q.text(","); q.breakable()
+ q.text("tx_packets = ");
+ q.text("%#x" % self.tx_packets)
+ q.text(","); q.breakable()
+ q.text("tx_errors = ");
+ q.text("%#x" % self.tx_errors)
+ q.text(","); q.breakable()
+ q.text("duration_sec = ");
+ q.text("%#x" % self.duration_sec)
+ q.text(","); q.breakable()
+ q.text("duration_nsec = ");
+ q.text("%#x" % self.duration_nsec)
+ q.breakable()
+ q.text('}')
+
+
+class table_feature_prop(loxi.OFObject):
+ subtypes = {}
+
+
+ def __init__(self, type=None):
+ if type != None:
+ self.type = type
+ else:
+ self.type = 0
+ return
+
+ def pack(self):
+ packed = []
+ packed.append(struct.pack("!H", self.type))
+ packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
+ length = sum([len(x) for x in packed])
+ packed[1] = struct.pack("!H", length)
+ return ''.join(packed)
+
+ @staticmethod
+ def unpack(reader):
+ subtype, = reader.peek('!H', 0)
+ subclass = table_feature_prop.subtypes.get(subtype)
+ if subclass:
+ return subclass.unpack(reader)
+
+ obj = table_feature_prop()
+ obj.type = reader.read("!H")[0]
+ _length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length, 4)
+ return obj
+
+ def __eq__(self, other):
+ if type(self) != type(other): return False
+ if self.type != other.type: return False
+ return True
+
+ def pretty_print(self, q):
+ q.text("table_feature_prop {")
+ with q.group():
+ with q.indent(2):
+ q.breakable()
+ q.breakable()
+ q.text('}')
+
+
+class table_feature_prop_apply_actions(table_feature_prop):
+ type = 6
+
+ def __init__(self, action_ids=None):
+ if action_ids != None:
+ self.action_ids = action_ids
+ else:
+ self.action_ids = []
+ return
+
+ def pack(self):
+ packed = []
+ packed.append(struct.pack("!H", self.type))
+ packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
+ packed.append(loxi.generic_util.pack_list(self.action_ids))
+ length = sum([len(x) for x in packed])
+ packed[1] = struct.pack("!H", length)
+ packed.append(loxi.generic_util.pad_to(8, length))
+ return ''.join(packed)
+
+ @staticmethod
+ def unpack(reader):
+ obj = table_feature_prop_apply_actions()
+ _type = reader.read("!H")[0]
+ assert(_type == 6)
+ _length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length, 4)
+ obj.action_ids = loxi.generic_util.unpack_list(reader, ofp.action_id.action_id.unpack)
+ orig_reader.skip_align()
+ return obj
+
+ def __eq__(self, other):
+ if type(self) != type(other): return False
+ if self.action_ids != other.action_ids: return False
+ return True
+
+ def pretty_print(self, q):
+ q.text("table_feature_prop_apply_actions {")
+ with q.group():
+ with q.indent(2):
+ q.breakable()
+ q.text("action_ids = ");
+ q.pp(self.action_ids)
+ q.breakable()
+ q.text('}')
+
+table_feature_prop.subtypes[6] = table_feature_prop_apply_actions
+
+class table_feature_prop_apply_actions_miss(table_feature_prop):
+ type = 7
+
+ def __init__(self, action_ids=None):
+ if action_ids != None:
+ self.action_ids = action_ids
+ else:
+ self.action_ids = []
+ return
+
+ def pack(self):
+ packed = []
+ packed.append(struct.pack("!H", self.type))
+ packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
+ packed.append(loxi.generic_util.pack_list(self.action_ids))
+ length = sum([len(x) for x in packed])
+ packed[1] = struct.pack("!H", length)
+ packed.append(loxi.generic_util.pad_to(8, length))
+ return ''.join(packed)
+
+ @staticmethod
+ def unpack(reader):
+ obj = table_feature_prop_apply_actions_miss()
+ _type = reader.read("!H")[0]
+ assert(_type == 7)
+ _length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length, 4)
+ obj.action_ids = loxi.generic_util.unpack_list(reader, ofp.action_id.action_id.unpack)
+ orig_reader.skip_align()
+ return obj
+
+ def __eq__(self, other):
+ if type(self) != type(other): return False
+ if self.action_ids != other.action_ids: return False
+ return True
+
+ def pretty_print(self, q):
+ q.text("table_feature_prop_apply_actions_miss {")
+ with q.group():
+ with q.indent(2):
+ q.breakable()
+ q.text("action_ids = ");
+ q.pp(self.action_ids)
+ q.breakable()
+ q.text('}')
+
+table_feature_prop.subtypes[7] = table_feature_prop_apply_actions_miss
+
+class table_feature_prop_apply_setfield(table_feature_prop):
+ type = 14
+
+ def __init__(self, oxm_ids=None):
+ if oxm_ids != None:
+ self.oxm_ids = oxm_ids
+ else:
+ self.oxm_ids = []
+ return
+
+ def pack(self):
+ packed = []
+ packed.append(struct.pack("!H", self.type))
+ packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
+ packed.append(loxi.generic_util.pack_list(self.oxm_ids))
+ length = sum([len(x) for x in packed])
+ packed[1] = struct.pack("!H", length)
+ packed.append(loxi.generic_util.pad_to(8, length))
+ return ''.join(packed)
+
+ @staticmethod
+ def unpack(reader):
+ obj = table_feature_prop_apply_setfield()
+ _type = reader.read("!H")[0]
+ assert(_type == 14)
+ _length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length, 4)
+ obj.oxm_ids = loxi.generic_util.unpack_list(reader, ofp.common.uint32.unpack)
+ orig_reader.skip_align()
+ return obj
+
+ def __eq__(self, other):
+ if type(self) != type(other): return False
+ if self.oxm_ids != other.oxm_ids: return False
+ return True
+
+ def pretty_print(self, q):
+ q.text("table_feature_prop_apply_setfield {")
+ with q.group():
+ with q.indent(2):
+ q.breakable()
+ q.text("oxm_ids = ");
+ q.pp(self.oxm_ids)
+ q.breakable()
+ q.text('}')
+
+table_feature_prop.subtypes[14] = table_feature_prop_apply_setfield
+
+class table_feature_prop_apply_setfield_miss(table_feature_prop):
+ type = 15
+
+ def __init__(self, oxm_ids=None):
+ if oxm_ids != None:
+ self.oxm_ids = oxm_ids
+ else:
+ self.oxm_ids = []
+ return
+
+ def pack(self):
+ packed = []
+ packed.append(struct.pack("!H", self.type))
+ packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
+ packed.append(loxi.generic_util.pack_list(self.oxm_ids))
+ length = sum([len(x) for x in packed])
+ packed[1] = struct.pack("!H", length)
+ packed.append(loxi.generic_util.pad_to(8, length))
+ return ''.join(packed)
+
+ @staticmethod
+ def unpack(reader):
+ obj = table_feature_prop_apply_setfield_miss()
+ _type = reader.read("!H")[0]
+ assert(_type == 15)
+ _length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length, 4)
+ obj.oxm_ids = loxi.generic_util.unpack_list(reader, ofp.common.uint32.unpack)
+ orig_reader.skip_align()
+ return obj
+
+ def __eq__(self, other):
+ if type(self) != type(other): return False
+ if self.oxm_ids != other.oxm_ids: return False
+ return True
+
+ def pretty_print(self, q):
+ q.text("table_feature_prop_apply_setfield_miss {")
+ with q.group():
+ with q.indent(2):
+ q.breakable()
+ q.text("oxm_ids = ");
+ q.pp(self.oxm_ids)
+ q.breakable()
+ q.text('}')
+
+table_feature_prop.subtypes[15] = table_feature_prop_apply_setfield_miss
+
+class table_feature_prop_experimenter(table_feature_prop):
+ subtypes = {}
+
+ type = 65534
+
+ def __init__(self, experimenter=None, subtype=None, experimenter_data=None):
+ if experimenter != None:
+ self.experimenter = experimenter
+ else:
+ self.experimenter = 0
+ if subtype != None:
+ self.subtype = subtype
+ else:
+ self.subtype = 0
+ if experimenter_data != None:
+ self.experimenter_data = experimenter_data
+ else:
+ self.experimenter_data = ''
+ return
+
+ def pack(self):
+ packed = []
+ packed.append(struct.pack("!H", self.type))
+ packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
+ packed.append(struct.pack("!L", self.experimenter))
+ packed.append(struct.pack("!L", self.subtype))
+ packed.append(self.experimenter_data)
+ length = sum([len(x) for x in packed])
+ packed[1] = struct.pack("!H", length)
+ packed.append(loxi.generic_util.pad_to(8, length))
+ return ''.join(packed)
+
+ @staticmethod
+ def unpack(reader):
+ subtype, = reader.peek('!L', 4)
+ subclass = table_feature_prop_experimenter.subtypes.get(subtype)
+ if subclass:
+ return subclass.unpack(reader)
+
+ obj = table_feature_prop_experimenter()
+ _type = reader.read("!H")[0]
+ assert(_type == 65534)
+ _length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length, 4)
+ obj.experimenter = reader.read("!L")[0]
+ obj.subtype = reader.read("!L")[0]
+ obj.experimenter_data = str(reader.read_all())
+ orig_reader.skip_align()
+ return obj
+
+ def __eq__(self, other):
+ if type(self) != type(other): return False
+ if self.experimenter != other.experimenter: return False
+ if self.subtype != other.subtype: return False
+ if self.experimenter_data != other.experimenter_data: return False
+ return True
+
+ def pretty_print(self, q):
+ q.text("table_feature_prop_experimenter {")
+ with q.group():
+ with q.indent(2):
+ q.breakable()
+ q.text("subtype = ");
+ q.text("%#x" % self.subtype)
+ q.text(","); q.breakable()
+ q.text("experimenter_data = ");
+ q.pp(self.experimenter_data)
+ q.breakable()
+ q.text('}')
+
+table_feature_prop.subtypes[65534] = table_feature_prop_experimenter
+
+class table_feature_prop_experimenter_miss(table_feature_prop):
+ subtypes = {}
+
+ type = 65535
+
+ def __init__(self, experimenter=None, subtype=None, experimenter_data=None):
+ if experimenter != None:
+ self.experimenter = experimenter
+ else:
+ self.experimenter = 0
+ if subtype != None:
+ self.subtype = subtype
+ else:
+ self.subtype = 0
+ if experimenter_data != None:
+ self.experimenter_data = experimenter_data
+ else:
+ self.experimenter_data = ''
+ return
+
+ def pack(self):
+ packed = []
+ packed.append(struct.pack("!H", self.type))
+ packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
+ packed.append(struct.pack("!L", self.experimenter))
+ packed.append(struct.pack("!L", self.subtype))
+ packed.append(self.experimenter_data)
+ length = sum([len(x) for x in packed])
+ packed[1] = struct.pack("!H", length)
+ packed.append(loxi.generic_util.pad_to(8, length))
+ return ''.join(packed)
+
+ @staticmethod
+ def unpack(reader):
+ subtype, = reader.peek('!L', 4)
+ subclass = table_feature_prop_experimenter_miss.subtypes.get(subtype)
+ if subclass:
+ return subclass.unpack(reader)
+
+ obj = table_feature_prop_experimenter_miss()
+ _type = reader.read("!H")[0]
+ assert(_type == 65535)
+ _length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length, 4)
+ obj.experimenter = reader.read("!L")[0]
+ obj.subtype = reader.read("!L")[0]
+ obj.experimenter_data = str(reader.read_all())
+ orig_reader.skip_align()
+ return obj
+
+ def __eq__(self, other):
+ if type(self) != type(other): return False
+ if self.experimenter != other.experimenter: return False
+ if self.subtype != other.subtype: return False
+ if self.experimenter_data != other.experimenter_data: return False
+ return True
+
+ def pretty_print(self, q):
+ q.text("table_feature_prop_experimenter_miss {")
+ with q.group():
+ with q.indent(2):
+ q.breakable()
+ q.text("subtype = ");
+ q.text("%#x" % self.subtype)
+ q.text(","); q.breakable()
+ q.text("experimenter_data = ");
+ q.pp(self.experimenter_data)
+ q.breakable()
+ q.text('}')
+
+table_feature_prop.subtypes[65535] = table_feature_prop_experimenter_miss
+
+class table_feature_prop_instructions(table_feature_prop):
+ type = 0
+
+ def __init__(self, instruction_ids=None):
+ if instruction_ids != None:
+ self.instruction_ids = instruction_ids
+ else:
+ self.instruction_ids = []
+ return
+
+ def pack(self):
+ packed = []
+ packed.append(struct.pack("!H", self.type))
+ packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
+ packed.append(loxi.generic_util.pack_list(self.instruction_ids))
+ length = sum([len(x) for x in packed])
+ packed[1] = struct.pack("!H", length)
+ packed.append(loxi.generic_util.pad_to(8, length))
+ return ''.join(packed)
+
+ @staticmethod
+ def unpack(reader):
+ obj = table_feature_prop_instructions()
+ _type = reader.read("!H")[0]
+ assert(_type == 0)
+ _length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length, 4)
+ obj.instruction_ids = loxi.generic_util.unpack_list(reader, ofp.instruction_id.instruction_id.unpack)
+ orig_reader.skip_align()
+ return obj
+
+ def __eq__(self, other):
+ if type(self) != type(other): return False
+ if self.instruction_ids != other.instruction_ids: return False
+ return True
+
+ def pretty_print(self, q):
+ q.text("table_feature_prop_instructions {")
+ with q.group():
+ with q.indent(2):
+ q.breakable()
+ q.text("instruction_ids = ");
+ q.pp(self.instruction_ids)
+ q.breakable()
+ q.text('}')
+
+table_feature_prop.subtypes[0] = table_feature_prop_instructions
+
+class table_feature_prop_instructions_miss(table_feature_prop):
+ type = 1
+
+ def __init__(self, instruction_ids=None):
+ if instruction_ids != None:
+ self.instruction_ids = instruction_ids
+ else:
+ self.instruction_ids = []
+ return
+
+ def pack(self):
+ packed = []
+ packed.append(struct.pack("!H", self.type))
+ packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
+ packed.append(loxi.generic_util.pack_list(self.instruction_ids))
+ length = sum([len(x) for x in packed])
+ packed[1] = struct.pack("!H", length)
+ packed.append(loxi.generic_util.pad_to(8, length))
+ return ''.join(packed)
+
+ @staticmethod
+ def unpack(reader):
+ obj = table_feature_prop_instructions_miss()
+ _type = reader.read("!H")[0]
+ assert(_type == 1)
+ _length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length, 4)
+ obj.instruction_ids = loxi.generic_util.unpack_list(reader, ofp.instruction_id.instruction_id.unpack)
+ orig_reader.skip_align()
+ return obj
+
+ def __eq__(self, other):
+ if type(self) != type(other): return False
+ if self.instruction_ids != other.instruction_ids: return False
+ return True
+
+ def pretty_print(self, q):
+ q.text("table_feature_prop_instructions_miss {")
+ with q.group():
+ with q.indent(2):
+ q.breakable()
+ q.text("instruction_ids = ");
+ q.pp(self.instruction_ids)
+ q.breakable()
+ q.text('}')
+
+table_feature_prop.subtypes[1] = table_feature_prop_instructions_miss
+
+class table_feature_prop_match(table_feature_prop):
+ type = 8
+
+ def __init__(self, oxm_ids=None):
+ if oxm_ids != None:
+ self.oxm_ids = oxm_ids
+ else:
+ self.oxm_ids = []
+ return
+
+ def pack(self):
+ packed = []
+ packed.append(struct.pack("!H", self.type))
+ packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
+ packed.append(loxi.generic_util.pack_list(self.oxm_ids))
+ length = sum([len(x) for x in packed])
+ packed[1] = struct.pack("!H", length)
+ packed.append(loxi.generic_util.pad_to(8, length))
+ return ''.join(packed)
+
+ @staticmethod
+ def unpack(reader):
+ obj = table_feature_prop_match()
+ _type = reader.read("!H")[0]
+ assert(_type == 8)
+ _length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length, 4)
+ obj.oxm_ids = loxi.generic_util.unpack_list(reader, ofp.common.uint32.unpack)
+ orig_reader.skip_align()
+ return obj
+
+ def __eq__(self, other):
+ if type(self) != type(other): return False
+ if self.oxm_ids != other.oxm_ids: return False
+ return True
+
+ def pretty_print(self, q):
+ q.text("table_feature_prop_match {")
+ with q.group():
+ with q.indent(2):
+ q.breakable()
+ q.text("oxm_ids = ");
+ q.pp(self.oxm_ids)
+ q.breakable()
+ q.text('}')
+
+table_feature_prop.subtypes[8] = table_feature_prop_match
+
+class table_feature_prop_next_tables(table_feature_prop):
+ type = 2
+
+ def __init__(self, next_table_ids=None):
+ if next_table_ids != None:
+ self.next_table_ids = next_table_ids
+ else:
+ self.next_table_ids = []
+ return
+
+ def pack(self):
+ packed = []
+ packed.append(struct.pack("!H", self.type))
+ packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
+ packed.append(loxi.generic_util.pack_list(self.next_table_ids))
+ length = sum([len(x) for x in packed])
+ packed[1] = struct.pack("!H", length)
+ packed.append(loxi.generic_util.pad_to(8, length))
+ return ''.join(packed)
+
+ @staticmethod
+ def unpack(reader):
+ obj = table_feature_prop_next_tables()
+ _type = reader.read("!H")[0]
+ assert(_type == 2)
+ _length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length, 4)
+ obj.next_table_ids = loxi.generic_util.unpack_list(reader, ofp.common.uint8.unpack)
+ orig_reader.skip_align()
+ return obj
+
+ def __eq__(self, other):
+ if type(self) != type(other): return False
+ if self.next_table_ids != other.next_table_ids: return False
+ return True
+
+ def pretty_print(self, q):
+ q.text("table_feature_prop_next_tables {")
+ with q.group():
+ with q.indent(2):
+ q.breakable()
+ q.text("next_table_ids = ");
+ q.pp(self.next_table_ids)
+ q.breakable()
+ q.text('}')
+
+table_feature_prop.subtypes[2] = table_feature_prop_next_tables
+
+class table_feature_prop_next_tables_miss(table_feature_prop):
+ type = 3
+
+ def __init__(self, next_table_ids=None):
+ if next_table_ids != None:
+ self.next_table_ids = next_table_ids
+ else:
+ self.next_table_ids = []
+ return
+
+ def pack(self):
+ packed = []
+ packed.append(struct.pack("!H", self.type))
+ packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
+ packed.append(loxi.generic_util.pack_list(self.next_table_ids))
+ length = sum([len(x) for x in packed])
+ packed[1] = struct.pack("!H", length)
+ packed.append(loxi.generic_util.pad_to(8, length))
+ return ''.join(packed)
+
+ @staticmethod
+ def unpack(reader):
+ obj = table_feature_prop_next_tables_miss()
+ _type = reader.read("!H")[0]
+ assert(_type == 3)
+ _length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length, 4)
+ obj.next_table_ids = loxi.generic_util.unpack_list(reader, ofp.common.uint8.unpack)
+ orig_reader.skip_align()
+ return obj
+
+ def __eq__(self, other):
+ if type(self) != type(other): return False
+ if self.next_table_ids != other.next_table_ids: return False
+ return True
+
+ def pretty_print(self, q):
+ q.text("table_feature_prop_next_tables_miss {")
+ with q.group():
+ with q.indent(2):
+ q.breakable()
+ q.text("next_table_ids = ");
+ q.pp(self.next_table_ids)
+ q.breakable()
+ q.text('}')
+
+table_feature_prop.subtypes[3] = table_feature_prop_next_tables_miss
+
+class table_feature_prop_wildcards(table_feature_prop):
+ type = 10
+
+ def __init__(self, oxm_ids=None):
+ if oxm_ids != None:
+ self.oxm_ids = oxm_ids
+ else:
+ self.oxm_ids = []
+ return
+
+ def pack(self):
+ packed = []
+ packed.append(struct.pack("!H", self.type))
+ packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
+ packed.append(loxi.generic_util.pack_list(self.oxm_ids))
+ length = sum([len(x) for x in packed])
+ packed[1] = struct.pack("!H", length)
+ packed.append(loxi.generic_util.pad_to(8, length))
+ return ''.join(packed)
+
+ @staticmethod
+ def unpack(reader):
+ obj = table_feature_prop_wildcards()
+ _type = reader.read("!H")[0]
+ assert(_type == 10)
+ _length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length, 4)
+ obj.oxm_ids = loxi.generic_util.unpack_list(reader, ofp.common.uint32.unpack)
+ orig_reader.skip_align()
+ return obj
+
+ def __eq__(self, other):
+ if type(self) != type(other): return False
+ if self.oxm_ids != other.oxm_ids: return False
+ return True
+
+ def pretty_print(self, q):
+ q.text("table_feature_prop_wildcards {")
+ with q.group():
+ with q.indent(2):
+ q.breakable()
+ q.text("oxm_ids = ");
+ q.pp(self.oxm_ids)
+ q.breakable()
+ q.text('}')
+
+table_feature_prop.subtypes[10] = table_feature_prop_wildcards
+
+class table_feature_prop_write_actions(table_feature_prop):
+ type = 4
+
+ def __init__(self, action_ids=None):
+ if action_ids != None:
+ self.action_ids = action_ids
+ else:
+ self.action_ids = []
+ return
+
+ def pack(self):
+ packed = []
+ packed.append(struct.pack("!H", self.type))
+ packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
+ packed.append(loxi.generic_util.pack_list(self.action_ids))
+ length = sum([len(x) for x in packed])
+ packed[1] = struct.pack("!H", length)
+ packed.append(loxi.generic_util.pad_to(8, length))
+ return ''.join(packed)
+
+ @staticmethod
+ def unpack(reader):
+ obj = table_feature_prop_write_actions()
+ _type = reader.read("!H")[0]
+ assert(_type == 4)
+ _length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length, 4)
+ obj.action_ids = loxi.generic_util.unpack_list(reader, ofp.action_id.action_id.unpack)
+ orig_reader.skip_align()
+ return obj
+
+ def __eq__(self, other):
+ if type(self) != type(other): return False
+ if self.action_ids != other.action_ids: return False
+ return True
+
+ def pretty_print(self, q):
+ q.text("table_feature_prop_write_actions {")
+ with q.group():
+ with q.indent(2):
+ q.breakable()
+ q.text("action_ids = ");
+ q.pp(self.action_ids)
+ q.breakable()
+ q.text('}')
+
+table_feature_prop.subtypes[4] = table_feature_prop_write_actions
+
+class table_feature_prop_write_actions_miss(table_feature_prop):
+ type = 5
+
+ def __init__(self, action_ids=None):
+ if action_ids != None:
+ self.action_ids = action_ids
+ else:
+ self.action_ids = []
+ return
+
+ def pack(self):
+ packed = []
+ packed.append(struct.pack("!H", self.type))
+ packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
+ packed.append(loxi.generic_util.pack_list(self.action_ids))
+ length = sum([len(x) for x in packed])
+ packed[1] = struct.pack("!H", length)
+ packed.append(loxi.generic_util.pad_to(8, length))
+ return ''.join(packed)
+
+ @staticmethod
+ def unpack(reader):
+ obj = table_feature_prop_write_actions_miss()
+ _type = reader.read("!H")[0]
+ assert(_type == 5)
+ _length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length, 4)
+ obj.action_ids = loxi.generic_util.unpack_list(reader, ofp.action_id.action_id.unpack)
+ orig_reader.skip_align()
+ return obj
+
+ def __eq__(self, other):
+ if type(self) != type(other): return False
+ if self.action_ids != other.action_ids: return False
+ return True
+
+ def pretty_print(self, q):
+ q.text("table_feature_prop_write_actions_miss {")
+ with q.group():
+ with q.indent(2):
+ q.breakable()
+ q.text("action_ids = ");
+ q.pp(self.action_ids)
+ q.breakable()
+ q.text('}')
+
+table_feature_prop.subtypes[5] = table_feature_prop_write_actions_miss
+
+class table_feature_prop_write_setfield(table_feature_prop):
+ type = 12
+
+ def __init__(self, oxm_ids=None):
+ if oxm_ids != None:
+ self.oxm_ids = oxm_ids
+ else:
+ self.oxm_ids = []
+ return
+
+ def pack(self):
+ packed = []
+ packed.append(struct.pack("!H", self.type))
+ packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
+ packed.append(loxi.generic_util.pack_list(self.oxm_ids))
+ length = sum([len(x) for x in packed])
+ packed[1] = struct.pack("!H", length)
+ packed.append(loxi.generic_util.pad_to(8, length))
+ return ''.join(packed)
+
+ @staticmethod
+ def unpack(reader):
+ obj = table_feature_prop_write_setfield()
+ _type = reader.read("!H")[0]
+ assert(_type == 12)
+ _length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length, 4)
+ obj.oxm_ids = loxi.generic_util.unpack_list(reader, ofp.common.uint32.unpack)
+ orig_reader.skip_align()
+ return obj
+
+ def __eq__(self, other):
+ if type(self) != type(other): return False
+ if self.oxm_ids != other.oxm_ids: return False
+ return True
+
+ def pretty_print(self, q):
+ q.text("table_feature_prop_write_setfield {")
+ with q.group():
+ with q.indent(2):
+ q.breakable()
+ q.text("oxm_ids = ");
+ q.pp(self.oxm_ids)
+ q.breakable()
+ q.text('}')
+
+table_feature_prop.subtypes[12] = table_feature_prop_write_setfield
+
+class table_feature_prop_write_setfield_miss(table_feature_prop):
+ type = 13
+
+ def __init__(self, oxm_ids=None):
+ if oxm_ids != None:
+ self.oxm_ids = oxm_ids
+ else:
+ self.oxm_ids = []
+ return
+
+ def pack(self):
+ packed = []
+ packed.append(struct.pack("!H", self.type))
+ packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
+ packed.append(loxi.generic_util.pack_list(self.oxm_ids))
+ length = sum([len(x) for x in packed])
+ packed[1] = struct.pack("!H", length)
+ packed.append(loxi.generic_util.pad_to(8, length))
+ return ''.join(packed)
+
+ @staticmethod
+ def unpack(reader):
+ obj = table_feature_prop_write_setfield_miss()
+ _type = reader.read("!H")[0]
+ assert(_type == 13)
+ _length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length, 4)
+ obj.oxm_ids = loxi.generic_util.unpack_list(reader, ofp.common.uint32.unpack)
+ orig_reader.skip_align()
+ return obj
+
+ def __eq__(self, other):
+ if type(self) != type(other): return False
+ if self.oxm_ids != other.oxm_ids: return False
+ return True
+
+ def pretty_print(self, q):
+ q.text("table_feature_prop_write_setfield_miss {")
+ with q.group():
+ with q.indent(2):
+ q.breakable()
+ q.text("oxm_ids = ");
+ q.pp(self.oxm_ids)
+ q.breakable()
+ q.text('}')
+
+table_feature_prop.subtypes[13] = table_feature_prop_write_setfield_miss
+
+class table_features(loxi.OFObject):
+
+ def __init__(self, table_id=None, name=None, metadata_match=None, metadata_write=None, config=None, max_entries=None, properties=None):
+ if table_id != None:
+ self.table_id = table_id
+ else:
+ self.table_id = 0
+ if name != None:
+ self.name = name
+ else:
+ self.name = ""
+ if metadata_match != None:
+ self.metadata_match = metadata_match
+ else:
+ self.metadata_match = 0
+ if metadata_write != None:
+ self.metadata_write = metadata_write
+ else:
+ self.metadata_write = 0
+ if config != None:
+ self.config = config
+ else:
+ self.config = 0
+ if max_entries != None:
+ self.max_entries = max_entries
+ else:
+ self.max_entries = 0
+ if properties != None:
+ self.properties = properties
+ else:
+ self.properties = []
+ return
+
+ def pack(self):
+ packed = []
+ packed.append(struct.pack("!H", 0)) # placeholder for length at index 0
+ packed.append(struct.pack("!B", self.table_id))
+ packed.append('\x00' * 5)
+ packed.append(struct.pack("!32s", self.name))
+ packed.append(struct.pack("!Q", self.metadata_match))
+ packed.append(struct.pack("!Q", self.metadata_write))
+ packed.append(struct.pack("!L", self.config))
+ packed.append(struct.pack("!L", self.max_entries))
+ packed.append(loxi.generic_util.pack_list(self.properties))
+ length = sum([len(x) for x in packed])
+ packed[0] = struct.pack("!H", length)
+ return ''.join(packed)
+
+ @staticmethod
+ def unpack(reader):
+ obj = table_features()
+ _length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length, 2)
+ obj.table_id = reader.read("!B")[0]
+ reader.skip(5)
+ obj.name = reader.read("!32s")[0].rstrip("\x00")
+ obj.metadata_match = reader.read("!Q")[0]
+ obj.metadata_write = reader.read("!Q")[0]
+ obj.config = reader.read("!L")[0]
+ obj.max_entries = reader.read("!L")[0]
+ obj.properties = loxi.generic_util.unpack_list(reader, ofp.common.table_feature_prop.unpack)
+ return obj
+
+ def __eq__(self, other):
+ if type(self) != type(other): return False
+ if self.table_id != other.table_id: return False
+ if self.name != other.name: return False
+ if self.metadata_match != other.metadata_match: return False
+ if self.metadata_write != other.metadata_write: return False
+ if self.config != other.config: return False
+ if self.max_entries != other.max_entries: return False
+ if self.properties != other.properties: return False
+ return True
+
+ def pretty_print(self, q):
+ q.text("table_features {")
+ with q.group():
+ with q.indent(2):
+ q.breakable()
+ q.text("table_id = ");
+ q.text("%#x" % self.table_id)
+ q.text(","); q.breakable()
+ q.text("name = ");
+ q.pp(self.name)
+ q.text(","); q.breakable()
+ q.text("metadata_match = ");
+ q.text("%#x" % self.metadata_match)
+ q.text(","); q.breakable()
+ q.text("metadata_write = ");
+ q.text("%#x" % self.metadata_write)
+ q.text(","); q.breakable()
+ q.text("config = ");
+ q.text("%#x" % self.config)
+ q.text(","); q.breakable()
+ q.text("max_entries = ");
+ q.text("%#x" % self.max_entries)
+ q.text(","); q.breakable()
+ q.text("properties = ");
+ q.pp(self.properties)
+ q.breakable()
+ q.text('}')
+
+
+class table_stats_entry(loxi.OFObject):
+
+ def __init__(self, table_id=None, active_count=None, lookup_count=None, matched_count=None):
+ if table_id != None:
+ self.table_id = table_id
+ else:
+ self.table_id = 0
+ if active_count != None:
+ self.active_count = active_count
+ else:
+ self.active_count = 0
+ if lookup_count != None:
+ self.lookup_count = lookup_count
+ else:
+ self.lookup_count = 0
+ if matched_count != None:
+ self.matched_count = matched_count
+ else:
+ self.matched_count = 0
+ return
+
+ def pack(self):
+ packed = []
+ packed.append(struct.pack("!B", self.table_id))
+ packed.append('\x00' * 3)
+ packed.append(struct.pack("!L", self.active_count))
+ packed.append(struct.pack("!Q", self.lookup_count))
+ packed.append(struct.pack("!Q", self.matched_count))
+ return ''.join(packed)
+
+ @staticmethod
+ def unpack(reader):
+ obj = table_stats_entry()
+ obj.table_id = reader.read("!B")[0]
+ reader.skip(3)
+ obj.active_count = reader.read("!L")[0]
+ obj.lookup_count = reader.read("!Q")[0]
+ obj.matched_count = reader.read("!Q")[0]
+ return obj
+
+ def __eq__(self, other):
+ if type(self) != type(other): return False
+ if self.table_id != other.table_id: return False
+ if self.active_count != other.active_count: return False
+ if self.lookup_count != other.lookup_count: return False
+ if self.matched_count != other.matched_count: return False
+ return True
+
+ def pretty_print(self, q):
+ q.text("table_stats_entry {")
+ with q.group():
+ with q.indent(2):
+ q.breakable()
+ q.text("table_id = ");
+ q.text("%#x" % self.table_id)
+ q.text(","); q.breakable()
+ q.text("active_count = ");
+ q.text("%#x" % self.active_count)
+ q.text(","); q.breakable()
+ q.text("lookup_count = ");
+ q.text("%#x" % self.lookup_count)
+ q.text(","); q.breakable()
+ q.text("matched_count = ");
+ q.text("%#x" % self.matched_count)
+ q.breakable()
+ q.text('}')
+
+
+class uint32(loxi.OFObject):
+
+ def __init__(self, value=None):
+ if value != None:
+ self.value = value
+ else:
+ self.value = 0
+ return
+
+ def pack(self):
+ packed = []
+ packed.append(struct.pack("!L", self.value))
+ return ''.join(packed)
+
+ @staticmethod
+ def unpack(reader):
+ obj = uint32()
+ obj.value = reader.read("!L")[0]
+ return obj
+
+ def __eq__(self, other):
+ if type(self) != type(other): return False
+ if self.value != other.value: return False
+ return True
+
+ def pretty_print(self, q):
+ q.text("uint32 {")
+ with q.group():
+ with q.indent(2):
+ q.breakable()
+ q.text("value = ");
+ q.text("%#x" % self.value)
+ q.breakable()
+ q.text('}')
+
+
+class uint64(loxi.OFObject):
+
+ def __init__(self, value=None):
+ if value != None:
+ self.value = value
+ else:
+ self.value = 0
+ return
+
+ def pack(self):
+ packed = []
+ packed.append(struct.pack("!Q", self.value))
+ return ''.join(packed)
+
+ @staticmethod
+ def unpack(reader):
+ obj = uint64()
+ obj.value = reader.read("!Q")[0]
+ return obj
+
+ def __eq__(self, other):
+ if type(self) != type(other): return False
+ if self.value != other.value: return False
+ return True
+
+ def pretty_print(self, q):
+ q.text("uint64 {")
+ with q.group():
+ with q.indent(2):
+ q.breakable()
+ q.text("value = ");
+ q.text("%#x" % self.value)
+ q.breakable()
+ q.text('}')
+
+
+class uint8(loxi.OFObject):
+
+ def __init__(self, value=None):
+ if value != None:
+ self.value = value
+ else:
+ self.value = 0
+ return
+
+ def pack(self):
+ packed = []
+ packed.append(struct.pack("!B", self.value))
+ return ''.join(packed)
+
+ @staticmethod
+ def unpack(reader):
+ obj = uint8()
+ obj.value = reader.read("!B")[0]
+ return obj
+
+ def __eq__(self, other):
+ if type(self) != type(other): return False
+ if self.value != other.value: return False
+ return True
+
+ def pretty_print(self, q):
+ q.text("uint8 {")
+ with q.group():
+ with q.indent(2):
+ q.breakable()
+ q.text("value = ");
+ q.text("%#x" % self.value)
+ q.breakable()
+ q.text('}')
+
+
+
+match = match_v3