ir: add class_by_name method to OFProtocol
diff --git a/loxi_ir.py b/loxi_ir.py
index ec8056f..4176303 100644
--- a/loxi_ir.py
+++ b/loxi_ir.py
@@ -62,7 +62,9 @@
@param classes List of OFClass objects
@param enums List of Enum objects
"""
-OFProtocol = namedtuple('OFProtocol', ['wire_version', 'classes', 'enums'])
+class OFProtocol(namedtuple('OFProtocol', ['wire_version', 'classes', 'enums'])):
+ def class_by_name(self, name):
+ return find(lambda ofclass: ofclass.name == name, self.classes)
"""
An OpenFlow class