#include "util.h"
#include "vlog.h"
-VLOG_DEFINE_THIS_MODULE(dpctl);
-
/* -s, --statistics: Print port/flow statistics? */
static bool print_statistics;
/* --may-create: Allow mod-flows command to create a new flow? */
static bool may_create;
-/* -m, --more: Output verbosity.
- *
- * So far only undocumented commands honor this option, so we don't document
- * the option itself. */
+/* -m, --more: Increase output verbosity. */
static int verbosity;
static const struct command *get_all_commands(void);
" dump-dps display names of all datapaths\n"
" show show basic info on all datapaths\n"
" show DP... show basic info on each DP\n"
- " dump-flows DP display flows in DP\n"
- " add-flow DP FLOW ACTIONS add FLOW with ACTIONS to DP\n"
- " mod-flow DP FLOW ACTIONS change FLOW actions to ACTIONS in DP\n"
- " del-flow DP FLOW delete FLOW from DP\n"
- " del-flows DP delete all flows from DP\n"
+ " dump-flows [DP] display flows in DP\n"
+ " add-flow [DP] FLOW ACTIONS add FLOW with ACTIONS to DP\n"
+ " mod-flow [DP] FLOW ACTIONS change FLOW actions to ACTIONS in DP\n"
+ " del-flow [DP] FLOW delete FLOW from DP\n"
+ " del-flows [DP] delete all flows from DP\n"
"Each IFACE on add-dp, add-if, and set-if may be followed by\n"
"comma-separated options. See ovs-dpctl(8) for syntax, or the\n"
- "Interface table in ovs-vswitchd.conf.db(5) for an options list.\n",
+ "Interface table in ovs-vswitchd.conf.db(5) for an options list.\n"
+ "For COMMAND dump-flows, add-flow, mod-flow, del-flow and\n"
+ "del-flows, DP is optional if there is only one datapath.\n",
program_name, program_name);
vlog_usage();
printf("\nOptions for show and mod-flow:\n"
" -s, --statistics print statistics for port or flow\n"
+ "\nOptions for dump-flows:\n"
+ " -m, --more increase verbosity of output\n"
"\nOptions for mod-flow:\n"
" --may-create create flow if it doesn't exist\n"
" --clear reset existing stats to zero\n"
&mask, &mask_len,
&actions, &actions_len, &stats)) {
ds_clear(&ds);
- odp_flow_format(key, key_len, mask, mask_len, &ds);
+ odp_flow_format(key, key_len, mask, mask_len, &ds, verbosity);
ds_put_cstr(&ds, ", ");
dpif_flow_stats_format(stats, &ds);
ofpbuf_init(&mask, 0);
run(odp_flow_from_string(key_s, NULL, &key, &mask), "parsing flow key");
- dp_name = argc == 2 ? xstrdup(argv[1]) : get_one_dp();
+ dp_name = argc == 3 ? xstrdup(argv[1]) : get_one_dp();
run(parsed_dpif_open(dp_name, false, &dpif), "opening datapath");
free(dp_name);
}
if (first_output) {
uint8_t *end = (uint8_t *) actions + length;
- sort_output_actions__(first_output, (struct nlattr *) end);
+ sort_output_actions__(first_output,
+ ALIGNED_CAST(struct nlattr *, end));
}
}
"odp_flow_key_from_string");
ds_clear(&s);
- odp_flow_format(keybuf.data, keybuf.size, NULL, 0, &s);
+ odp_flow_format(keybuf.data, keybuf.size, NULL, 0, &s, verbosity);
printf("input flow: %s\n", ds_cstr(&s));
run(odp_flow_key_to_flow(keybuf.data, keybuf.size, &flow),
ofpbuf_init(&odp_actions, 0);
run(odp_actions_from_string(argv[2], &port_names, &odp_actions),
"odp_actions_from_string");
+ simap_destroy(&port_names);
if (verbosity) {
ds_clear(&s);
printf("no vlan: ");
}
- if (af->flow.mpls_depth) {
+ if (eth_type_mpls(af->flow.dl_type)) {
printf("mpls(label=%"PRIu32",tc=%d,ttl=%d): ",
mpls_lse_to_label(af->flow.mpls_lse),
mpls_lse_to_tc(af->flow.mpls_lse),