update pyloxi to floodlight/loxigen-artifacts@5c5ec9b3142bf91524c29a00a26d464dab1f21d9
diff --git a/src/python/loxi/of13/common.py b/src/python/loxi/of13/common.py
index 8d86467..8080503 100644
--- a/src/python/loxi/of13/common.py
+++ b/src/python/loxi/of13/common.py
@@ -16,9 +16,366 @@
import action_id
import instruction_id
import meter_band
+import bsn_tlv
import util
import loxi.generic_util
+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_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 - (0 + 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 - (0 + 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), bsn_tlv.bsn_tlv.unpack)
+ obj.value = loxi.generic_util.unpack_list(reader, 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 - (0 + 2))
+ _key_length = reader.read("!H")[0]
+ obj.key = loxi.generic_util.unpack_list(reader.slice(_key_length), bsn_tlv.bsn_tlv.unpack)
+ obj.stats = loxi.generic_util.unpack_list(reader, 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):