" dump-ports SWITCH print port statistics\n"
" dump-flows SWITCH print all flow entries\n"
" dump-flows SWITCH FLOW print matching FLOWs\n"
+ " dump-aggregate SWITCH print aggregate flow statistics\n"
+ " dump-aggregate SWITCH FLOW print aggregate stats for FLOWs\n"
" add-flows SWITCH FILE add flows from FILE\n"
" del-flows SWITCH FLOW delete matching FLOWs\n"
"where each SWITCH is an active OpenFlow connection method.\n",
program_name, program_name);
vconn_usage(true, false);
printf("\nOptions:\n"
+ " -v, --verbose=MODULE:FACILITY:LEVEL configure logging levels\n"
" -v, --verbose set maximum verbosity level\n"
" -h, --help display this help message\n"
" -V, --version display version information\n");
{
uint16_t port;
- if (!strcasecmp(str, "flood")) {
+ if (!strcasecmp(str, "normal")) {
+ port = OFPP_NORMAL;
+ } else if (!strcasecmp(str, "flood")) {
port = OFPP_FLOOD;
+ } else if (!strcasecmp(str, "all")) {
+ port = OFPP_ALL;
} else if (!strcasecmp(str, "controller")) {
port = OFPP_CONTROLLER;
+ } else if (!strcasecmp(str, "local")) {
+ port = OFPP_LOCAL;
} else {
port = str_to_int(str);
}
}
memset(match, 0, sizeof *match);
wildcards = OFPFW_ALL;
- for (name = strtok(string, "="), value = strtok(NULL, " \t\n");
+ for (name = strtok(string, "="), value = strtok(NULL, ", \t\r\n");
name && value;
- name = strtok(NULL, "="), value = strtok(NULL, " \t\n"))
+ name = strtok(NULL, "="), value = strtok(NULL, ", \t\r\n"))
{
const struct field *f;
void *data;
found:
data = (char *) match + f->offset;
- if (!strcmp(value, "*")) {
+ if (!strcmp(value, "*") || !strcmp(value, "ANY")) {
wildcards |= f->wildcard;
} else {
wildcards &= ~f->wildcard;
req = alloc_stats_request(sizeof *req, OFPST_FLOW, &request);
str_to_flow(argc > 2 ? argv[2] : "", &req->match, NULL, &req->table_id,
NULL);
- req->type = OFPFS_INDIV;
- req->pad = 0;
+ memset(req->pad, 0, sizeof req->pad);
+
+ dump_stats_transaction(argv[1], request);
+}
+
+static void do_dump_aggregate(int argc, char *argv[])
+{
+ struct ofp_aggregate_stats_request *req;
+ struct buffer *request;
+
+ req = alloc_stats_request(sizeof *req, OFPST_AGGREGATE, &request);
+ str_to_flow(argc > 2 ? argv[2] : "", &req->match, NULL, &req->table_id,
+ NULL);
+ memset(req->pad, 0, sizeof req->pad);
dump_stats_transaction(argv[1], request);
}
static void do_del_flows(int argc, char *argv[])
{
struct vconn *vconn;
+ uint16_t priority;
run(vconn_open_block(argv[1], &vconn), "connecting to %s", argv[1]);
struct buffer *buffer;
/* Parse and send. */
size = sizeof *ofm;
ofm = alloc_openflow_buffer(size, OFPT_FLOW_MOD, &buffer);
+ str_to_flow(argc > 2 ? argv[2] : "", &ofm->match, NULL, NULL, &priority);
ofm->command = htons(OFPFC_DELETE);
ofm->max_idle = htons(0);
ofm->buffer_id = htonl(UINT32_MAX);
- ofm->priority = htons(0);
+ ofm->priority = htons(priority);
ofm->reserved = htonl(0);
- str_to_flow(argc > 2 ? argv[2] : "", &ofm->match, NULL, NULL, NULL);
send_openflow_buffer(vconn, buffer);
{ "monitor", 1, 1, do_monitor },
{ "dump-tables", 1, 1, do_dump_tables },
{ "dump-flows", 1, 2, do_dump_flows },
+ { "dump-aggregate", 1, 2, do_dump_aggregate },
{ "add-flows", 2, 2, do_add_flows },
{ "del-flows", 1, 2, do_del_flows },
{ "dump-ports", 1, 1, do_dump_ports },