update pyloxi to floodlight/loxigen-artifacts @ f9dd10108ee6f7f770b4433e23eaf875a8abf1df
diff --git a/src/python/loxi/of13/common.py b/src/python/loxi/of13/common.py
index 361865d..72f6f85 100644
--- a/src/python/loxi/of13/common.py
+++ b/src/python/loxi/of13/common.py
@@ -227,6 +227,48 @@
         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, 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):
@@ -301,7 +343,7 @@
         obj = bsn_gentable_desc_stats_entry()
         _length = reader.read("!H")[0]
         orig_reader = reader
-        reader = orig_reader.slice(_length - (0 + 2))
+        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]
@@ -371,7 +413,7 @@
         obj = bsn_gentable_entry_desc_stats_entry()
         _length = reader.read("!H")[0]
         orig_reader = reader
-        reader = orig_reader.slice(_length - (0 + 2))
+        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), bsn_tlv.bsn_tlv.unpack)
@@ -431,7 +473,7 @@
         obj = bsn_gentable_entry_stats_entry()
         _length = reader.read("!H")[0]
         orig_reader = reader
-        reader = orig_reader.slice(_length - (0 + 2))
+        reader = orig_reader.slice(_length, 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)
@@ -761,7 +803,7 @@
         obj = bsn_port_counter_stats_entry()
         _length = reader.read("!H")[0]
         orig_reader = reader
-        reader = orig_reader.slice(_length - (0 + 2))
+        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, common.uint64.unpack)
@@ -899,7 +941,7 @@
         obj.type = reader.read("!H")[0]
         _length = reader.read("!H")[0]
         orig_reader = reader
-        reader = orig_reader.slice(_length - (2 + 2))
+        reader = orig_reader.slice(_length, 4)
         return obj
 
     def __eq__(self, other):
@@ -944,7 +986,7 @@
         obj = bsn_vlan_counter_stats_entry()
         _length = reader.read("!H")[0]
         orig_reader = reader
-        reader = orig_reader.slice(_length - (0 + 2))
+        reader = orig_reader.slice(_length, 2)
         obj.vlan_vid = reader.read("!H")[0]
         reader.skip(4)
         obj.values = loxi.generic_util.unpack_list(reader, common.uint64.unpack)
@@ -1052,7 +1094,7 @@
         assert(_type == 1)
         _length = reader.read("!H")[0]
         orig_reader = reader
-        reader = orig_reader.slice(_length - (2 + 2))
+        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)
@@ -1180,7 +1222,7 @@
         assert(_type == 0)
         _length = reader.read("!H")[0]
         orig_reader = reader
-        reader = orig_reader.slice(_length - (2 + 2))
+        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]
@@ -1254,7 +1296,7 @@
         obj = bsn_vrf_counter_stats_entry()
         _length = reader.read("!H")[0]
         orig_reader = reader
-        reader = orig_reader.slice(_length - (0 + 2))
+        reader = orig_reader.slice(_length, 2)
         reader.skip(2)
         obj.vrf = reader.read("!L")[0]
         obj.values = loxi.generic_util.unpack_list(reader, common.uint64.unpack)
@@ -1318,7 +1360,7 @@
         obj = bucket()
         _len = reader.read("!H")[0]
         orig_reader = reader
-        reader = orig_reader.slice(_len - (0 + 2))
+        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]
@@ -1479,7 +1521,7 @@
         obj = flow_stats_entry()
         _length = reader.read("!H")[0]
         orig_reader = reader
-        reader = orig_reader.slice(_length - (0 + 2))
+        reader = orig_reader.slice(_length, 2)
         obj.table_id = reader.read("!B")[0]
         reader.skip(1)
         obj.duration_sec = reader.read("!L")[0]
@@ -1589,7 +1631,7 @@
         obj = group_desc_stats_entry()
         _length = reader.read("!H")[0]
         orig_reader = reader
-        reader = orig_reader.slice(_length - (0 + 2))
+        reader = orig_reader.slice(_length, 2)
         obj.group_type = reader.read("!B")[0]
         reader.skip(1)
         obj.group_id = reader.read("!L")[0]
@@ -1674,7 +1716,7 @@
         obj = group_stats_entry()
         _length = reader.read("!H")[0]
         orig_reader = reader
-        reader = orig_reader.slice(_length - (0 + 2))
+        reader = orig_reader.slice(_length, 2)
         reader.skip(2)
         obj.group_id = reader.read("!L")[0]
         obj.ref_count = reader.read("!L")[0]
@@ -1756,7 +1798,7 @@
         obj.type = reader.read("!H")[0]
         _length = reader.read("!H")[0]
         orig_reader = reader
-        reader = orig_reader.slice(_length - (2 + 2))
+        reader = orig_reader.slice(_length, 4)
         return obj
 
     def __eq__(self, other):
@@ -1799,7 +1841,7 @@
         assert(_type == 1)
         _length = reader.read("!H")[0]
         orig_reader = reader
-        reader = orig_reader.slice(_length - (2 + 2))
+        reader = orig_reader.slice(_length, 4)
         obj.bitmaps = loxi.generic_util.unpack_list(reader, common.uint32.unpack)
         return obj
 
@@ -1847,7 +1889,7 @@
         assert(_type == 1)
         _length = reader.read("!H")[0]
         orig_reader = reader
-        reader = orig_reader.slice(_length - (2 + 2))
+        reader = orig_reader.slice(_length, 4)
         obj.oxm_list = loxi.generic_util.unpack_list(reader, oxm.oxm.unpack)
         orig_reader.skip_align()
         return obj
@@ -1946,7 +1988,7 @@
         obj = meter_config()
         _length = reader.read("!H")[0]
         orig_reader = reader
-        reader = orig_reader.slice(_length - (0 + 2))
+        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, meter_band.meter_band.unpack)
@@ -2108,7 +2150,7 @@
         obj.meter_id = reader.read("!L")[0]
         _len = reader.read("!H")[0]
         orig_reader = reader
-        reader = orig_reader.slice(_len - (4 + 2))
+        reader = orig_reader.slice(_len, 6)
         reader.skip(6)
         obj.flow_count = reader.read("!L")[0]
         obj.packet_in_count = reader.read("!Q")[0]
@@ -2193,7 +2235,7 @@
         obj.port = util.unpack_port_no(reader)
         _len = reader.read("!H")[0]
         orig_reader = reader
-        reader = orig_reader.slice(_len - (8 + 2))
+        reader = orig_reader.slice(_len, 10)
         reader.skip(6)
         obj.properties = loxi.generic_util.unpack_list(reader, common.queue_prop.unpack)
         return obj
@@ -2571,7 +2613,7 @@
         obj.type = reader.read("!H")[0]
         _len = reader.read("!H")[0]
         orig_reader = reader
-        reader = orig_reader.slice(_len - (2 + 2))
+        reader = orig_reader.slice(_len, 4)
         reader.skip(4)
         return obj
 
@@ -2629,7 +2671,7 @@
         assert(_type == 65535)
         _len = reader.read("!H")[0]
         orig_reader = reader
-        reader = orig_reader.slice(_len - (2 + 2))
+        reader = orig_reader.slice(_len, 4)
         reader.skip(4)
         obj.experimenter = reader.read("!L")[0]
         reader.skip(4)
@@ -2682,7 +2724,7 @@
         assert(_type == 2)
         _len = reader.read("!H")[0]
         orig_reader = reader
-        reader = orig_reader.slice(_len - (2 + 2))
+        reader = orig_reader.slice(_len, 4)
         reader.skip(4)
         obj.rate = reader.read("!H")[0]
         reader.skip(6)
@@ -2733,7 +2775,7 @@
         assert(_type == 1)
         _len = reader.read("!H")[0]
         orig_reader = reader
-        reader = orig_reader.slice(_len - (2 + 2))
+        reader = orig_reader.slice(_len, 4)
         reader.skip(4)
         obj.rate = reader.read("!H")[0]
         reader.skip(6)
@@ -2882,7 +2924,7 @@
         obj.type = reader.read("!H")[0]
         _length = reader.read("!H")[0]
         orig_reader = reader
-        reader = orig_reader.slice(_length - (2 + 2))
+        reader = orig_reader.slice(_length, 4)
         return obj
 
     def __eq__(self, other):
@@ -2925,7 +2967,7 @@
         assert(_type == 6)
         _length = reader.read("!H")[0]
         orig_reader = reader
-        reader = orig_reader.slice(_length - (2 + 2))
+        reader = orig_reader.slice(_length, 4)
         obj.action_ids = loxi.generic_util.unpack_list(reader, action_id.action_id.unpack)
         return obj
 
@@ -2972,7 +3014,7 @@
         assert(_type == 7)
         _length = reader.read("!H")[0]
         orig_reader = reader
-        reader = orig_reader.slice(_length - (2 + 2))
+        reader = orig_reader.slice(_length, 4)
         obj.action_ids = loxi.generic_util.unpack_list(reader, action_id.action_id.unpack)
         return obj
 
@@ -3019,7 +3061,7 @@
         assert(_type == 14)
         _length = reader.read("!H")[0]
         orig_reader = reader
-        reader = orig_reader.slice(_length - (2 + 2))
+        reader = orig_reader.slice(_length, 4)
         obj.oxm_ids = loxi.generic_util.unpack_list(reader, common.uint32.unpack)
         return obj
 
@@ -3066,7 +3108,7 @@
         assert(_type == 15)
         _length = reader.read("!H")[0]
         orig_reader = reader
-        reader = orig_reader.slice(_length - (2 + 2))
+        reader = orig_reader.slice(_length, 4)
         obj.oxm_ids = loxi.generic_util.unpack_list(reader, common.uint32.unpack)
         return obj
 
@@ -3130,7 +3172,7 @@
         assert(_type == 65534)
         _length = reader.read("!H")[0]
         orig_reader = reader
-        reader = orig_reader.slice(_length - (2 + 2))
+        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())
@@ -3201,7 +3243,7 @@
         assert(_type == 65535)
         _length = reader.read("!H")[0]
         orig_reader = reader
-        reader = orig_reader.slice(_length - (2 + 2))
+        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())
@@ -3255,7 +3297,7 @@
         assert(_type == 0)
         _length = reader.read("!H")[0]
         orig_reader = reader
-        reader = orig_reader.slice(_length - (2 + 2))
+        reader = orig_reader.slice(_length, 4)
         obj.instruction_ids = loxi.generic_util.unpack_list(reader, instruction_id.instruction_id.unpack)
         return obj
 
@@ -3302,7 +3344,7 @@
         assert(_type == 1)
         _length = reader.read("!H")[0]
         orig_reader = reader
-        reader = orig_reader.slice(_length - (2 + 2))
+        reader = orig_reader.slice(_length, 4)
         obj.instruction_ids = loxi.generic_util.unpack_list(reader, instruction_id.instruction_id.unpack)
         return obj
 
@@ -3349,7 +3391,7 @@
         assert(_type == 8)
         _length = reader.read("!H")[0]
         orig_reader = reader
-        reader = orig_reader.slice(_length - (2 + 2))
+        reader = orig_reader.slice(_length, 4)
         obj.oxm_ids = loxi.generic_util.unpack_list(reader, common.uint32.unpack)
         return obj
 
@@ -3396,7 +3438,7 @@
         assert(_type == 2)
         _length = reader.read("!H")[0]
         orig_reader = reader
-        reader = orig_reader.slice(_length - (2 + 2))
+        reader = orig_reader.slice(_length, 4)
         obj.next_table_ids = loxi.generic_util.unpack_list(reader, common.uint8.unpack)
         return obj
 
@@ -3443,7 +3485,7 @@
         assert(_type == 3)
         _length = reader.read("!H")[0]
         orig_reader = reader
-        reader = orig_reader.slice(_length - (2 + 2))
+        reader = orig_reader.slice(_length, 4)
         obj.next_table_ids = loxi.generic_util.unpack_list(reader, common.uint8.unpack)
         return obj
 
@@ -3490,7 +3532,7 @@
         assert(_type == 10)
         _length = reader.read("!H")[0]
         orig_reader = reader
-        reader = orig_reader.slice(_length - (2 + 2))
+        reader = orig_reader.slice(_length, 4)
         obj.oxm_ids = loxi.generic_util.unpack_list(reader, common.uint32.unpack)
         return obj
 
@@ -3537,7 +3579,7 @@
         assert(_type == 4)
         _length = reader.read("!H")[0]
         orig_reader = reader
-        reader = orig_reader.slice(_length - (2 + 2))
+        reader = orig_reader.slice(_length, 4)
         obj.action_ids = loxi.generic_util.unpack_list(reader, action_id.action_id.unpack)
         return obj
 
@@ -3584,7 +3626,7 @@
         assert(_type == 5)
         _length = reader.read("!H")[0]
         orig_reader = reader
-        reader = orig_reader.slice(_length - (2 + 2))
+        reader = orig_reader.slice(_length, 4)
         obj.action_ids = loxi.generic_util.unpack_list(reader, action_id.action_id.unpack)
         return obj
 
@@ -3631,7 +3673,7 @@
         assert(_type == 12)
         _length = reader.read("!H")[0]
         orig_reader = reader
-        reader = orig_reader.slice(_length - (2 + 2))
+        reader = orig_reader.slice(_length, 4)
         obj.oxm_ids = loxi.generic_util.unpack_list(reader, common.uint32.unpack)
         return obj
 
@@ -3678,7 +3720,7 @@
         assert(_type == 13)
         _length = reader.read("!H")[0]
         orig_reader = reader
-        reader = orig_reader.slice(_length - (2 + 2))
+        reader = orig_reader.slice(_length, 4)
         obj.oxm_ids = loxi.generic_util.unpack_list(reader, common.uint32.unpack)
         return obj
 
@@ -3752,7 +3794,7 @@
         obj = table_features()
         _length = reader.read("!H")[0]
         orig_reader = reader
-        reader = orig_reader.slice(_length - (0 + 2))
+        reader = orig_reader.slice(_length, 2)
         obj.table_id = reader.read("!B")[0]
         reader.skip(5)
         obj.name = reader.read("!32s")[0].rstrip("\x00")