aboutsummaryrefslogtreecommitdiff
path: root/utilities
diff options
context:
space:
mode:
authorBen Pfaff <blp@nicira.com>2011-11-11 15:22:56 -0800
committerBen Pfaff <blp@nicira.com>2011-11-17 10:11:54 -0800
commit7202cbe5521ed327ea0c9c959493a08ad2bf8d01 (patch)
tree69c6d02f5105c3d4a7e8cceea4d4304e65c9482c /utilities
parentb2a60db8e407196d0e6634379e8aedbfe2ec774c (diff)
odp-util: New function odp_actions_from_string().
An upcoming commit will add a user. The only planned users for now are part of unit tests themselves, so it doesn't seem important to unit test it.
Diffstat (limited to 'utilities')
-rw-r--r--utilities/ovs-dpctl.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/utilities/ovs-dpctl.c b/utilities/ovs-dpctl.c
index 499d4945..69a66b69 100644
--- a/utilities/ovs-dpctl.c
+++ b/utilities/ovs-dpctl.c
@@ -37,6 +37,7 @@
#include "dynamic-string.h"
#include "netdev.h"
#include "odp-util.h"
+#include "ofpbuf.h"
#include "shash.h"
#include "sset.h"
#include "timeval.h"
@@ -692,6 +693,30 @@ do_help(int argc OVS_UNUSED, char *argv[] OVS_UNUSED)
{
usage();
}
+
+/* Undocumented commands for unit testing. */
+
+static void
+do_parse_actions(int argc, char *argv[])
+{
+ int i;
+
+ for (i = 1; i < argc; i++) {
+ struct ofpbuf actions;
+ struct ds s;
+
+ ofpbuf_init(&actions, 0);
+ run(odp_actions_from_string(argv[i], NULL, &actions),
+ "odp_actions_from_string");
+
+ ds_init(&s);
+ format_odp_actions(&s, actions.data, actions.size);
+ puts(ds_cstr(&s));
+ ds_destroy(&s);
+
+ ofpbuf_uninit(&actions);
+ }
+}
static const struct command all_commands[] = {
{ "add-dp", 1, INT_MAX, do_add_dp },
@@ -704,5 +729,9 @@ static const struct command all_commands[] = {
{ "dump-flows", 1, 1, do_dump_flows },
{ "del-flows", 1, 1, do_del_flows },
{ "help", 0, INT_MAX, do_help },
+
+ /* Undocumented commands for testing. */
+ { "parse-actions", 1, INT_MAX, do_parse_actions },
+
{ NULL, 0, 0, NULL },
};