locitest: generate tests from the test_data files
The "c" section of the test data file should allocate and populate a LOCI
object. The resulting wire buffer is compared to the "binary" section.
This only tests serialization, but given that we have autogenerated tests that
round-trip each object I think this is sufficient.
I added C sections to the OF 1.0 test data files. OF 1.3 tests will come in a
future pull request.
diff --git a/test_data/of10/port_stats_reply.data b/test_data/of10/port_stats_reply.data
index 45a3532..4378387 100644
--- a/test_data/of10/port_stats_reply.data
+++ b/test_data/of10/port_stats_reply.data
@@ -37,3 +37,47 @@
xid=5, flags=0, entries=[
ofp.port_stats_entry(port_no=1, rx_packets=56, collisions=5),
ofp.port_stats_entry(port_no=ofp.OFPP_LOCAL, rx_packets=1, collisions=1)])
+-- c
+obj = of_port_stats_reply_new(OF_VERSION_1_0);
+{
+ of_object_t list;
+ of_port_stats_reply_entries_bind(obj, &list);
+ {
+ of_object_t *obj = of_port_stats_entry_new(OF_VERSION_1_0);
+ of_port_stats_entry_collisions_set(obj, 5);
+ of_port_stats_entry_port_no_set(obj, 1);
+ of_port_stats_entry_rx_bytes_set(obj, 0);
+ of_port_stats_entry_rx_crc_err_set(obj, 0);
+ of_port_stats_entry_rx_dropped_set(obj, 0);
+ of_port_stats_entry_rx_errors_set(obj, 0);
+ of_port_stats_entry_rx_frame_err_set(obj, 0);
+ of_port_stats_entry_rx_over_err_set(obj, 0);
+ of_port_stats_entry_rx_packets_set(obj, 56);
+ of_port_stats_entry_tx_bytes_set(obj, 0);
+ of_port_stats_entry_tx_dropped_set(obj, 0);
+ of_port_stats_entry_tx_errors_set(obj, 0);
+ of_port_stats_entry_tx_packets_set(obj, 0);
+ of_list_append(&list, obj);
+ of_object_delete(obj);
+ }
+ {
+ of_object_t *obj = of_port_stats_entry_new(OF_VERSION_1_0);
+ of_port_stats_entry_collisions_set(obj, 1);
+ of_port_stats_entry_port_no_set(obj, 65534);
+ of_port_stats_entry_rx_bytes_set(obj, 0);
+ of_port_stats_entry_rx_crc_err_set(obj, 0);
+ of_port_stats_entry_rx_dropped_set(obj, 0);
+ of_port_stats_entry_rx_errors_set(obj, 0);
+ of_port_stats_entry_rx_frame_err_set(obj, 0);
+ of_port_stats_entry_rx_over_err_set(obj, 0);
+ of_port_stats_entry_rx_packets_set(obj, 1);
+ of_port_stats_entry_tx_bytes_set(obj, 0);
+ of_port_stats_entry_tx_dropped_set(obj, 0);
+ of_port_stats_entry_tx_errors_set(obj, 0);
+ of_port_stats_entry_tx_packets_set(obj, 0);
+ of_list_append(&list, obj);
+ of_object_delete(obj);
+ }
+}
+of_port_stats_reply_flags_set(obj, 0);
+of_port_stats_reply_xid_set(obj, 5);