pyloxi: add tests for parse_message
diff --git a/py_gen/tests/of11.py b/py_gen/tests/of11.py
index dd76b0d..d2c2aa7 100644
--- a/py_gen/tests/of11.py
+++ b/py_gen/tests/of11.py
@@ -82,6 +82,43 @@
else:
fn()
+ def test_parse_message(self):
+ expected_failures = [
+ ofp.message.bsn_bw_clear_data_reply,
+ ofp.message.bsn_bw_clear_data_request,
+ ofp.message.bsn_bw_enable_get_reply,
+ ofp.message.bsn_bw_enable_get_request,
+ ofp.message.bsn_bw_enable_set_reply,
+ ofp.message.bsn_bw_enable_set_request,
+ ofp.message.bsn_get_interfaces_reply,
+ ofp.message.bsn_get_interfaces_request,
+ ofp.message.bsn_get_mirroring_reply,
+ ofp.message.bsn_get_mirroring_request,
+ ofp.message.bsn_set_mirroring,
+ ofp.message.bsn_set_pktin_suppression_reply,
+ ofp.message.bsn_set_pktin_suppression_request,
+ ofp.message.bsn_virtual_port_create_reply,
+ ofp.message.bsn_virtual_port_create_request,
+ ofp.message.bsn_virtual_port_remove_reply,
+ ofp.message.bsn_virtual_port_remove_request,
+ ofp.message.flow_delete,
+ ofp.message.flow_delete_strict,
+ ofp.message.flow_modify,
+ ofp.message.flow_modify_strict,
+ ]
+ for klass in self.klasses:
+ if not issubclass(klass, ofp.message.Message):
+ continue
+ def fn():
+ obj = klass(xid=42)
+ buf = obj.pack()
+ obj2 = ofp.message.parse_message(buf)
+ self.assertEquals(obj, obj2)
+ if klass in expected_failures:
+ self.assertRaises(Exception, fn)
+ else:
+ fn()
+
def test_show(self):
expected_failures = []
for klass in self.klasses: