pyloxi: unpack of_list_group_stats_entry
diff --git a/py_gen/oftype.py b/py_gen/oftype.py
index be8611e..ca3106e 100644
--- a/py_gen/oftype.py
+++ b/py_gen/oftype.py
@@ -132,6 +132,8 @@
return 'common.unpack_list_bucket(%s)' % (reader_expr)
elif self.base == 'of_list_group_desc_stats_entry_t':
return 'common.unpack_list_group_desc_stats_entry(%s)' % (reader_expr)
+ elif self.base == 'of_list_group_stats_entry_t':
+ return 'common.unpack_list_group_stats_entry(%s)' % (reader_expr)
elif self.base == 'of_port_name_t':
return self._gen_string_unpack_expr(reader_expr, 16)
elif self.base == 'of_table_name_t' or self.base == 'of_serial_num_t':
diff --git a/py_gen/templates/common.py b/py_gen/templates/common.py
index beeaa01..737ed64 100644
--- a/py_gen/templates/common.py
+++ b/py_gen/templates/common.py
@@ -74,6 +74,9 @@
def unpack_list_group_desc_stats_entry(reader):
return loxi.generic_util.unpack_list_lv16(reader, group_desc_stats_entry.unpack)
+def unpack_list_group_stats_entry(reader):
+ return loxi.generic_util.unpack_list_lv16(reader, group_stats_entry.unpack)
+
:: for ofclass in ofclasses:
:: include('_ofclass.py', ofclass=ofclass, superclass="object")
diff --git a/py_gen/tests/of11.py b/py_gen/tests/of11.py
index b1acd12..3b1b584 100644
--- a/py_gen/tests/of11.py
+++ b/py_gen/tests/of11.py
@@ -77,7 +77,6 @@
ofp.message.flow_modify_strict,
ofp.message.flow_delete,
ofp.message.flow_delete_strict,
- ofp.message.group_stats_reply,
]
for klass in self.klasses:
def fn():
diff --git a/py_gen/tests/of12.py b/py_gen/tests/of12.py
index 743d244..92dbe70 100644
--- a/py_gen/tests/of12.py
+++ b/py_gen/tests/of12.py
@@ -165,7 +165,6 @@
ofp.message.flow_modify_strict,
ofp.message.flow_delete,
ofp.message.flow_delete_strict,
- ofp.message.group_stats_reply,
]
for klass in self.klasses:
def fn():
diff --git a/py_gen/tests/of13.py b/py_gen/tests/of13.py
index 5484fe2..814dfd6 100644
--- a/py_gen/tests/of13.py
+++ b/py_gen/tests/of13.py
@@ -533,8 +533,59 @@
pass
def test_group_stats_reply(self):
- # TODO
- pass
+ obj = ofp.message.group_stats_reply(
+ xid=0x12345678,
+ flags=0,
+ entries=[
+ ofp.group_stats_entry(
+ group_id=1,
+ ref_count=8,
+ packet_count=16,
+ byte_count=32,
+ duration_sec=20,
+ duration_nsec=100,
+ bucket_stats=[
+ ofp.bucket_counter(packet_count=1, byte_count=2),
+ ofp.bucket_counter(packet_count=3, byte_count=4)]),
+ ofp.group_stats_entry(
+ group_id=1,
+ ref_count=8,
+ packet_count=16,
+ byte_count=32,
+ duration_sec=20,
+ duration_nsec=100,
+ bucket_stats=[])])
+ buf = ''.join([
+ '\x04', '\x13', # version, type
+ '\x00\x80', # length
+ '\x12\x34\x56\x78', # xid
+ '\x00\x06', # stats_type
+ '\x00\x00', # flags
+ '\x00' * 4, # pad
+ '\x00\x48', # entries[0].length
+ '\x00' * 2, # pad
+ '\x00\x00\x00\x01', # entries[0].group_id
+ '\x00\x00\x00\x08', # entries[0].ref_count
+ '\x00' * 4, # pad
+ '\x00\x00\x00\x00\x00\x00\x00\x10', # entries[0].packet_count
+ '\x00\x00\x00\x00\x00\x00\x00\x20', # entries[0].byte_count
+ '\x00\x00\x00\x14', # entries[0].duration_sec
+ '\x00\x00\x00\x64', # entries[0].duration_nsec
+ '\x00\x00\x00\x00\x00\x00\x00\x01', # entries[0].bucket_stats[0].packet_count
+ '\x00\x00\x00\x00\x00\x00\x00\x02', # entries[0].bucket_stats[0].byte_count
+ '\x00\x00\x00\x00\x00\x00\x00\x03', # entries[0].bucket_stats[1].packet_count
+ '\x00\x00\x00\x00\x00\x00\x00\x04', # entries[0].bucket_stats[1].byte_count
+ '\x00\x28', # entries[0].length
+ '\x00' * 2, # pad
+ '\x00\x00\x00\x01', # entries[0].group_id
+ '\x00\x00\x00\x08', # entries[0].ref_count
+ '\x00' * 4, # pad
+ '\x00\x00\x00\x00\x00\x00\x00\x10', # entries[0].packet_count
+ '\x00\x00\x00\x00\x00\x00\x00\x20', # entries[0].byte_count
+ '\x00\x00\x00\x14', # entries[0].duration_sec
+ '\x00\x00\x00\x64', # entries[0].duration_nsec
+ ])
+ test_serialization(obj, buf)
def test_group_desc_stats_request(self):
# TODO
@@ -769,7 +820,6 @@
ofp.message.flow_delete_strict,
ofp.message.flow_modify,
ofp.message.flow_modify_strict,
- ofp.message.group_stats_reply,
ofp.message.meter_config_stats_reply,
ofp.message.meter_features_stats_reply,
ofp.message.meter_mod,