pyloxi: remove automatic conversion from str to OFReader

User code shouldn't call these methods directly.
diff --git a/py_gen/templates/_ofclass.py b/py_gen/templates/_ofclass.py
index c84ceea..f902ae8 100644
--- a/py_gen/templates/_ofclass.py
+++ b/py_gen/templates/_ofclass.py
@@ -28,7 +28,7 @@
         return ''.join(packed)
 
     @staticmethod
-    def unpack(buf):
+    def unpack(reader):
         obj = ${ofclass.pyname}()
 :: include("_unpack.py", ofclass=ofclass)
         return obj
diff --git a/py_gen/templates/_unpack.py b/py_gen/templates/_unpack.py
index c3d3fd3..b762a9c 100644
--- a/py_gen/templates/_unpack.py
+++ b/py_gen/templates/_unpack.py
@@ -28,10 +28,6 @@
 :: # TODO coalesce format strings
 :: from loxi_ir import *
 :: from py_gen.oftype import gen_unpack_expr
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
 :: field_length_members = {}
 :: for m in ofclass.members:
 ::     if type(m) == OFPadMember:
diff --git a/py_gen/tests/of10.py b/py_gen/tests/of10.py
index 74f3d2c..e08a2b3 100644
--- a/py_gen/tests/of10.py
+++ b/py_gen/tests/of10.py
@@ -130,7 +130,7 @@
         self.assertEquals(match.wildcards, ofp.OFPFW_ALL)
         self.assertEquals(match.tcp_src, 0)
         buf = match.pack()
-        match2 = ofp.match.unpack(buf)
+        match2 = ofp.match.unpack(OFReader(buf))
         self.assertEquals(match, match2)
 
 class TestMessages(unittest.TestCase):
@@ -154,7 +154,7 @@
     def test_echo_request_invalid_length(self):
         buf = "\x01\x02\x00\x07\x12\x34\x56"
         with self.assertRaisesRegexp(ofp.ProtocolError, "Buffer too short"):
-            ofp.message.echo_request.unpack(buf)
+            ofp.message.echo_request.unpack(OFReader(buf))
 
     def test_echo_request_equality(self):
         msg = ofp.message.echo_request(xid=0x12345678, data="abc")
@@ -241,7 +241,7 @@
                 obj = klass()
                 if hasattr(obj, "xid"): obj.xid = 42
                 buf = obj.pack()
-                obj2 = klass.unpack(buf)
+                obj2 = klass.unpack(OFReader(buf))
                 self.assertEquals(obj, obj2)
             if klass in expected_failures:
                 self.assertRaises(Exception, fn)
diff --git a/py_gen/tests/of11.py b/py_gen/tests/of11.py
index b30a40c..d620509 100644
--- a/py_gen/tests/of11.py
+++ b/py_gen/tests/of11.py
@@ -30,6 +30,7 @@
 try:
     import loxi
     import loxi.of11 as ofp
+    from loxi.generic_util import OFReader
 except ImportError:
     exit("loxi package not found. Try setting PYTHONPATH.")
 
@@ -78,7 +79,7 @@
                 obj = klass()
                 if hasattr(obj, "xid"): obj.xid = 42
                 buf = obj.pack()
-                obj2 = klass.unpack(buf)
+                obj2 = klass.unpack(OFReader(buf))
                 self.assertEquals(obj, obj2)
             if klass in expected_failures:
                 self.assertRaises(Exception, fn)
diff --git a/py_gen/tests/of12.py b/py_gen/tests/of12.py
index fcdb0cf..4774672 100644
--- a/py_gen/tests/of12.py
+++ b/py_gen/tests/of12.py
@@ -31,6 +31,7 @@
 try:
     import loxi
     import loxi.of12 as ofp
+    from loxi.generic_util import OFReader
 except ImportError:
     exit("loxi package not found. Try setting PYTHONPATH.")
 
@@ -89,7 +90,7 @@
                 obj = klass()
                 if hasattr(obj, "xid"): obj.xid = 42
                 buf = obj.pack()
-                obj2 = klass.unpack(buf)
+                obj2 = klass.unpack(OFReader(buf))
                 self.assertEquals(obj, obj2)
             if klass in expected_failures:
                 self.assertRaises(Exception, fn)
diff --git a/py_gen/tests/of13.py b/py_gen/tests/of13.py
index 503a307..54a0629 100644
--- a/py_gen/tests/of13.py
+++ b/py_gen/tests/of13.py
@@ -110,7 +110,7 @@
                 obj = klass()
                 if hasattr(obj, "xid"): obj.xid = 42
                 buf = obj.pack()
-                obj2 = klass.unpack(buf)
+                obj2 = klass.unpack(OFReader(buf))
                 self.assertEquals(obj, obj2)
             if klass in expected_failures:
                 self.assertRaises(Exception, fn)
diff --git a/py_gen/tests/testutil.py b/py_gen/tests/testutil.py
index ea30902..f8d5543 100644
--- a/py_gen/tests/testutil.py
+++ b/py_gen/tests/testutil.py
@@ -32,6 +32,7 @@
 import os
 import unittest
 import test_data
+from loxi.generic_util import OFReader
 
 # Human-friendly format for binary strings. 8 bytes per line.
 def format_binary(buf):
@@ -55,7 +56,7 @@
         b = format_binary(packed)
         raise AssertionError("Serialization of %s failed\nExpected:\n%s\nActual:\n%s\nDiff:\n%s" % \
             (type(obj).__name__, a, b, diff(a, b)))
-    unpacked = type(obj).unpack(buf)
+    unpacked = type(obj).unpack(OFReader(buf))
     if obj != unpacked:
         a = obj.show()
         b = unpacked.show()