+static void
+print_packet_list(struct list *packets)
+{
+ struct ofpbuf *packet, *next;
+
+ LIST_FOR_EACH_SAFE (packet, next, list_node, packets) {
+ ofp_print(stdout, packet->data, packet->size, verbosity);
+ list_remove(&packet->list_node);
+ ofpbuf_delete(packet);
+ }
+}
+
+/* "parse-flow FLOW": parses the argument as a flow (like add-flow) and prints
+ * it back to stdout. */
+static void
+do_parse_flow(int argc OVS_UNUSED, char *argv[])
+{
+ enum nx_flow_format flow_format;
+ struct list packets;
+
+ flow_format = NXFF_OPENFLOW10;
+ if (preferred_flow_format > 0) {
+ flow_format = preferred_flow_format;
+ }
+
+ list_init(&packets);
+ parse_ofp_flow_mod_str(&packets, &flow_format, argv[1], OFPFC_ADD);
+ print_packet_list(&packets);
+}
+
+/* "parse-flows FILENAME": reads the named file as a sequence of flows (like
+ * add-flows) and prints each of the flows back to stdout. */