group_mod: add subclass structure
the subclass structure is hidden from the c_gen of_g
diff --git a/py_gen/templates/message.py b/py_gen/templates/message.py
index 96b68cc..23f28dc 100644
--- a/py_gen/templates/message.py
+++ b/py_gen/templates/message.py
@@ -147,6 +147,18 @@
else:
raise loxi.ProtocolError("unexpected flow mod cmd %u" % cmd)
+:: if version >= OFVersions.VERSION_1_0:
+def parse_group_mod(buf):
+:: offset = 8
+ if len(buf) < ${offset} + 2:
+ raise loxi.ProtocolError("message too short")
+ cmd, = struct.unpack_from("!H", buf, ${offset})
+ if cmd in flow_mod_parsers:
+ return group_mod_parsers[cmd](buf)
+ else:
+ raise loxi.ProtocolError("unexpected group mod cmd %u" % cmd)
+:: #endif
+
def parse_stats_reply(buf):
if len(buf) < 8 + 2:
raise loxi.ProtocolError("message too short")
@@ -228,6 +240,14 @@
const.OFPFC_DELETE_STRICT : flow_delete_strict.unpack,
}
+:: if version >= OFVersions.VERSION_1_1:
+group_mod_parsers = {
+ const.OFPGC_ADD : group_add.unpack,
+ const.OFPGC_MODIFY : group_modify.unpack,
+ const.OFPGC_DELETE : group_delete.unpack,
+}
+:: #endif
+
stats_reply_parsers = {
const.OFPST_DESC : desc_stats_reply.unpack,
const.OFPST_FLOW : flow_stats_reply.unpack,