pyloxi: move list unpack functions into util
The goal is to make all module templates identical.
diff --git a/py_gen/tests/of10.py b/py_gen/tests/of10.py
index 876926e..74f3d2c 100644
--- a/py_gen/tests/of10.py
+++ b/py_gen/tests/of10.py
@@ -88,34 +88,34 @@
add(ofp.action.bsn_set_tunnel_dst(dst=0x12345678))
add(ofp.action.nicira_dec_ttl())
- actions = ofp.action.unpack_list(OFReader(''.join(bufs)))
+ actions = ofp.util.unpack_list_action(OFReader(''.join(bufs)))
self.assertEquals(actions, expected)
def test_empty_list(self):
- self.assertEquals(ofp.action.unpack_list(OFReader('')), [])
+ self.assertEquals(ofp.util.unpack_list_action(OFReader('')), [])
def test_invalid_list_length(self):
buf = '\x00' * 9
with self.assertRaisesRegexp(ofp.ProtocolError, 'Buffer too short'):
- ofp.action.unpack_list(OFReader(buf))
+ ofp.util.unpack_list_action(OFReader(buf))
def test_invalid_action_length(self):
buf = '\x00' * 8
with self.assertRaisesRegexp(ofp.ProtocolError, 'Buffer too short'):
- ofp.action.unpack_list(OFReader(buf))
+ ofp.util.unpack_list_action(OFReader(buf))
buf = '\x00\x00\x00\x04'
with self.assertRaisesRegexp(ofp.ProtocolError, 'Buffer too short'):
- ofp.action.unpack_list(OFReader(buf))
+ ofp.util.unpack_list_action(OFReader(buf))
buf = '\x00\x00\x00\x10\x00\x00\x00\x00'
with self.assertRaisesRegexp(ofp.ProtocolError, 'Buffer too short'):
- ofp.action.unpack_list(OFReader(buf))
+ ofp.util.unpack_list_action(OFReader(buf))
def test_invalid_action_type(self):
buf = '\xff\xfe\x00\x08\x00\x00\x00\x00'
with self.assertRaisesRegexp(ofp.ProtocolError, 'unknown action subtype'):
- ofp.action.unpack_list(OFReader(buf))
+ ofp.util.unpack_list_action(OFReader(buf))
class TestConstants(unittest.TestCase):
def test_ports(self):
diff --git a/py_gen/tests/of13.py b/py_gen/tests/of13.py
index 07b0ef0..503a307 100644
--- a/py_gen/tests/of13.py
+++ b/py_gen/tests/of13.py
@@ -67,7 +67,7 @@
'\x00\x00\x00\x04', # unknown type
'\x00\x01\x00\x04', # versionbitmap
])
- l = ofp.unpack_list_hello_elem(OFReader(buf))
+ l = ofp.util.unpack_list_hello_elem(OFReader(buf))
self.assertEquals(len(l), 2)
self.assertTrue(isinstance(l[0], ofp.hello_elem_versionbitmap))
self.assertTrue(isinstance(l[1], ofp.hello_elem_versionbitmap))