X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=utilities%2Fovs-ofctl.c;h=13f583e7e3a1bbb064cb4bac1e03d37115370642;hb=c5cd8b2ef14fa258f57ac5046ca3e85d97cd7650;hp=c21c4f982e3f7a53031f4f62516d536ae1ce5748;hpb=15f1f1b63ab5514f8dfafa8f4c90ecee44693e1d;p=openvswitch diff --git a/utilities/ovs-ofctl.c b/utilities/ovs-ofctl.c index c21c4f98..13f583e7 100644 --- a/utilities/ovs-ofctl.c +++ b/utilities/ovs-ofctl.c @@ -859,6 +859,26 @@ do_benchmark(int argc OVS_UNUSED, char *argv[]) count * message_size / (duration / 1000.0)); } +/* This command is really only useful for testing the flow parser (ofp_parse), + * so it is undocumented. */ +static void +do_parse_flows(int argc OVS_UNUSED, char *argv[]) +{ + struct ofpbuf *b; + FILE *file; + + file = fopen(argv[1], "r"); + if (file == NULL) { + ovs_fatal(errno, "%s: open", argv[2]); + } + + while ((b = parse_ofp_add_flow_file(file)) != NULL) { + ofp_print(stdout, b->data, b->size, 0); + ofpbuf_delete(b); + } + fclose(file); +} + static void do_help(int argc OVS_UNUSED, char *argv[] OVS_UNUSED) { @@ -885,6 +905,7 @@ static const struct command all_commands[] = { { "probe", 1, 1, do_probe }, { "ping", 1, 2, do_ping }, { "benchmark", 3, 3, do_benchmark }, + { "parse-flows", 1, 1, do_parse_flows }, { "help", 0, INT_MAX, do_help }, { NULL, 0, 0, NULL }, };