pyloxi: use OFClass directly
It now includes everything we need except pyname.
diff --git a/py_gen/templates/message.py b/py_gen/templates/message.py
index b781bc1..2106ce7 100644
--- a/py_gen/templates/message.py
+++ b/py_gen/templates/message.py
@@ -170,7 +170,7 @@
raise loxi.ProtocolError("unexpected experimenter %#x subtype %#x" % (experimenter, subtype))
parsers = {
-:: sort_key = lambda x: x.type_members[1].value
+:: sort_key = lambda x: x.member_by_name('type').value
:: msgtype_groups = itertools.groupby(sorted(ofclasses, key=sort_key), sort_key)
:: for (k, v) in msgtype_groups:
:: k = util.constant_for_value(version, "ofp_type", k)
@@ -271,15 +271,15 @@
:: #endif
}
-:: experimenter_ofclasses = [x for x in ofclasses if x.type_members[1].value == 4]
-:: sort_key = lambda x: x.type_members[2].value
+:: experimenter_ofclasses = [x for x in ofclasses if x.member_by_name('type').value == 4]
+:: sort_key = lambda x: x.member_by_name('experimenter').value
:: experimenter_ofclasses.sort(key=sort_key)
:: grouped = itertools.groupby(experimenter_ofclasses, sort_key)
experimenter_parsers = {
:: for (experimenter, v) in grouped:
${experimenter} : {
:: for ofclass in v:
- ${ofclass.type_members[3].value}: ${ofclass.pyname}.unpack,
+ ${ofclass.member_by_name('subtype').value}: ${ofclass.pyname}.unpack,
:: #endfor
},
:: #endfor