2 * Copyright (c) 2008, 2009, 2010 Nicira Networks.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at:
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
29 #include "byte-order.h"
30 #include "classifier.h"
31 #include "command-line.h"
35 #include "dynamic-string.h"
39 #include "ofp-parse.h"
40 #include "ofp-print.h"
43 #include "openflow/nicira-ext.h"
44 #include "openflow/openflow.h"
46 #include "stream-ssl.h"
52 VLOG_DEFINE_THIS_MODULE(ofctl);
55 #define MOD_PORT_CMD_UP "up"
56 #define MOD_PORT_CMD_DOWN "down"
57 #define MOD_PORT_CMD_FLOOD "flood"
58 #define MOD_PORT_CMD_NOFLOOD "noflood"
60 /* Use strict matching for flow mod commands? */
63 static const struct command all_commands[];
65 static void usage(void) NO_RETURN;
66 static void parse_options(int argc, char *argv[]);
69 main(int argc, char *argv[])
71 set_program_name(argv[0]);
72 parse_options(argc, argv);
73 signal(SIGPIPE, SIG_IGN);
74 run_command(argc - optind, argv + optind, all_commands);
79 parse_options(int argc, char *argv[])
82 OPT_STRICT = UCHAR_MAX + 1,
85 static struct option long_options[] = {
86 {"timeout", required_argument, 0, 't'},
87 {"strict", no_argument, 0, OPT_STRICT},
88 {"help", no_argument, 0, 'h'},
89 {"version", no_argument, 0, 'V'},
91 STREAM_SSL_LONG_OPTIONS
94 char *short_options = long_options_to_short_options(long_options);
97 unsigned long int timeout;
100 c = getopt_long(argc, argv, short_options, long_options, NULL);
107 timeout = strtoul(optarg, NULL, 10);
109 ovs_fatal(0, "value %s on -t or --timeout is not at least 1",
120 OVS_PRINT_VERSION(OFP_VERSION, OFP_VERSION);
128 STREAM_SSL_OPTION_HANDLERS
143 printf("%s: OpenFlow switch management utility\n"
144 "usage: %s [OPTIONS] COMMAND [ARG...]\n"
145 "\nFor OpenFlow switches:\n"
146 " show SWITCH show OpenFlow information\n"
147 " status SWITCH [KEY] report statistics (about KEY)\n"
148 " dump-desc SWITCH print switch description\n"
149 " dump-tables SWITCH print table stats\n"
150 " mod-port SWITCH IFACE ACT modify port behavior\n"
151 " dump-ports SWITCH [PORT] print port statistics\n"
152 " dump-flows SWITCH print all flow entries\n"
153 " dump-flows SWITCH FLOW print matching FLOWs\n"
154 " dump-aggregate SWITCH print aggregate flow statistics\n"
155 " dump-aggregate SWITCH FLOW print aggregate stats for FLOWs\n"
156 " queue-stats SWITCH [PORT [QUEUE]] dump queue stats\n"
157 " add-flow SWITCH FLOW add flow described by FLOW\n"
158 " add-flows SWITCH FILE add flows from FILE\n"
159 " mod-flows SWITCH FLOW modify actions of matching FLOWs\n"
160 " del-flows SWITCH [FLOW] delete matching FLOWs\n"
161 " monitor SWITCH [MISSLEN] print packets received from SWITCH\n"
162 "\nFor OpenFlow switches and controllers:\n"
163 " probe VCONN probe whether VCONN is up\n"
164 " ping VCONN [N] latency of N-byte echos\n"
165 " benchmark VCONN N COUNT bandwidth of COUNT N-byte echos\n"
166 "where each SWITCH is an active OpenFlow connection method.\n",
167 program_name, program_name);
168 vconn_usage(true, false, false);
170 printf("\nOther options:\n"
171 " --strict use strict match for flow commands\n"
172 " -t, --timeout=SECS give up after SECS seconds\n"
173 " -h, --help display this help message\n"
174 " -V, --version display version information\n");
178 static void run(int retval, const char *message, ...)
181 static void run(int retval, const char *message, ...)
186 fprintf(stderr, "%s: ", program_name);
187 va_start(args, message);
188 vfprintf(stderr, message, args);
191 fputs(": unexpected end of file\n", stderr);
193 fprintf(stderr, ": %s\n", strerror(retval));
200 /* Generic commands. */
203 open_vconn_socket(const char *name, struct vconn **vconnp)
205 char *vconn_name = xasprintf("unix:%s", name);
206 VLOG_INFO("connecting to %s", vconn_name);
207 run(vconn_open_block(vconn_name, OFP_VERSION, vconnp),
208 "connecting to %s", vconn_name);
213 open_vconn__(const char *name, const char *default_suffix,
214 struct vconn **vconnp)
218 char *bridge_path, *datapath_name, *datapath_type;
220 bridge_path = xasprintf("%s/%s.%s", ovs_rundir, name, default_suffix);
221 dp_parse_name(name, &datapath_name, &datapath_type);
223 if (strstr(name, ":")) {
224 run(vconn_open_block(name, OFP_VERSION, vconnp),
225 "connecting to %s", name);
226 } else if (!stat(name, &s) && S_ISSOCK(s.st_mode)) {
227 open_vconn_socket(name, vconnp);
228 } else if (!stat(bridge_path, &s) && S_ISSOCK(s.st_mode)) {
229 open_vconn_socket(bridge_path, vconnp);
230 } else if (!dpif_open(datapath_name, datapath_type, &dpif)) {
231 char dpif_name[IF_NAMESIZE + 1];
234 run(dpif_port_get_name(dpif, ODPP_LOCAL, dpif_name, sizeof dpif_name),
235 "obtaining name of %s", dpif_name);
237 if (strcmp(dpif_name, name)) {
238 VLOG_INFO("datapath %s is named %s", name, dpif_name);
241 socket_name = xasprintf("%s/%s.%s",
242 ovs_rundir, dpif_name, default_suffix);
243 if (stat(socket_name, &s)) {
244 ovs_fatal(errno, "cannot connect to %s: stat failed on %s",
246 } else if (!S_ISSOCK(s.st_mode)) {
247 ovs_fatal(0, "cannot connect to %s: %s is not a socket",
251 open_vconn_socket(socket_name, vconnp);
254 ovs_fatal(0, "%s is not a valid connection method", name);
263 open_vconn(const char *name, struct vconn **vconnp)
265 return open_vconn__(name, "mgmt", vconnp);
269 alloc_stats_request(size_t body_len, uint16_t type, struct ofpbuf **bufferp)
271 struct ofp_stats_request *rq;
272 rq = make_openflow((offsetof(struct ofp_stats_request, body)
273 + body_len), OFPT_STATS_REQUEST, bufferp);
274 rq->type = htons(type);
275 rq->flags = htons(0);
280 send_openflow_buffer(struct vconn *vconn, struct ofpbuf *buffer)
282 update_openflow_length(buffer);
283 run(vconn_send_block(vconn, buffer), "failed to send packet to switch");
287 dump_transaction(const char *vconn_name, struct ofpbuf *request)
290 struct ofpbuf *reply;
292 update_openflow_length(request);
293 open_vconn(vconn_name, &vconn);
294 run(vconn_transact(vconn, request, &reply), "talking to %s", vconn_name);
295 ofp_print(stdout, reply->data, reply->size, 1);
300 dump_trivial_transaction(const char *vconn_name, uint8_t request_type)
302 struct ofpbuf *request;
303 make_openflow(sizeof(struct ofp_header), request_type, &request);
304 dump_transaction(vconn_name, request);
308 dump_stats_transaction(const char *vconn_name, struct ofpbuf *request)
310 uint32_t send_xid = ((struct ofp_header *) request->data)->xid;
314 open_vconn(vconn_name, &vconn);
315 send_openflow_buffer(vconn, request);
318 struct ofpbuf *reply;
320 run(vconn_recv_block(vconn, &reply), "OpenFlow packet receive failed");
321 recv_xid = ((struct ofp_header *) reply->data)->xid;
322 if (send_xid == recv_xid) {
323 struct ofp_stats_reply *osr;
325 ofp_print(stdout, reply->data, reply->size, 1);
327 osr = ofpbuf_at(reply, 0, sizeof *osr);
328 done = !osr || !(ntohs(osr->flags) & OFPSF_REPLY_MORE);
330 VLOG_DBG("received reply with xid %08"PRIx32" "
331 "!= expected %08"PRIx32, recv_xid, send_xid);
333 ofpbuf_delete(reply);
339 dump_trivial_stats_transaction(const char *vconn_name, uint8_t stats_type)
341 struct ofpbuf *request;
342 alloc_stats_request(0, stats_type, &request);
343 dump_stats_transaction(vconn_name, request);
347 do_show(int argc OVS_UNUSED, char *argv[])
349 dump_trivial_transaction(argv[1], OFPT_FEATURES_REQUEST);
350 dump_trivial_transaction(argv[1], OFPT_GET_CONFIG_REQUEST);
354 do_status(int argc, char *argv[])
356 struct nicira_header *request, *reply;
360 request = make_nxmsg(sizeof *request, NXT_STATUS_REQUEST, &b);
362 ofpbuf_put(b, argv[2], strlen(argv[2]));
363 update_openflow_length(b);
365 open_vconn(argv[1], &vconn);
366 run(vconn_transact(vconn, b, &b), "talking to %s", argv[1]);
369 if (b->size < sizeof *reply) {
370 ovs_fatal(0, "short reply (%zu bytes)", b->size);
373 if (reply->header.type != OFPT_VENDOR
374 || reply->vendor != ntohl(NX_VENDOR_ID)
375 || reply->subtype != ntohl(NXT_STATUS_REPLY)) {
376 ofp_print(stderr, b->data, b->size, 2);
377 ovs_fatal(0, "bad reply");
380 fwrite(reply + 1, b->size - sizeof *reply, 1, stdout);
384 do_dump_desc(int argc OVS_UNUSED, char *argv[])
386 dump_trivial_stats_transaction(argv[1], OFPST_DESC);
390 do_dump_tables(int argc OVS_UNUSED, char *argv[])
392 dump_trivial_stats_transaction(argv[1], OFPST_TABLE);
396 str_to_port_no(const char *vconn_name, const char *str)
398 struct ofpbuf *request, *reply;
399 struct ofp_switch_features *osf;
403 unsigned int port_no;
406 /* Check if the argument is a port index. Otherwise, treat it as
408 if (str_to_uint(str, 10, &port_no)) {
412 /* Send a "Features Request" to resolve the name into a number. */
413 make_openflow(sizeof(struct ofp_header), OFPT_FEATURES_REQUEST, &request);
414 open_vconn(vconn_name, &vconn);
415 run(vconn_transact(vconn, request, &reply), "talking to %s", vconn_name);
418 n_ports = (reply->size - sizeof *osf) / sizeof *osf->ports;
420 for (port_idx = 0; port_idx < n_ports; port_idx++) {
421 /* Check argument as an interface name */
422 if (!strncmp((char *)osf->ports[port_idx].name, str,
423 sizeof osf->ports[0].name)) {
427 if (port_idx == n_ports) {
428 ovs_fatal(0, "couldn't find monitored port: %s", str);
431 ofpbuf_delete(reply);
434 return ntohs(osf->ports[port_idx].port_no);
438 do_dump_flows(int argc, char *argv[])
440 struct ofp_flow_stats_request *req;
441 struct parsed_flow pf;
442 struct ofpbuf *request;
444 req = alloc_stats_request(sizeof *req, OFPST_FLOW, &request);
445 parse_ofp_str(&pf, NULL, argc > 2 ? argv[2] : "");
446 flow_to_match(&pf.rule.flow, pf.rule.wc.wildcards, NXFF_OPENFLOW10,
448 memset(&req->pad, 0, sizeof req->pad);
449 req->out_port = htons(pf.out_port);
451 dump_stats_transaction(argv[1], request);
455 do_dump_aggregate(int argc, char *argv[])
457 struct ofp_aggregate_stats_request *req;
458 struct ofpbuf *request;
459 struct parsed_flow pf;
461 req = alloc_stats_request(sizeof *req, OFPST_AGGREGATE, &request);
462 parse_ofp_str(&pf, NULL, argc > 2 ? argv[2] : "");
463 flow_to_match(&pf.rule.flow, pf.rule.wc.wildcards, NXFF_OPENFLOW10,
465 memset(&req->pad, 0, sizeof req->pad);
466 req->out_port = htons(pf.out_port);
468 dump_stats_transaction(argv[1], request);
472 do_queue_stats(int argc, char *argv[])
474 struct ofp_queue_stats_request *req;
475 struct ofpbuf *request;
477 req = alloc_stats_request(sizeof *req, OFPST_QUEUE, &request);
479 if (argc > 2 && argv[2][0] && strcasecmp(argv[2], "all")) {
480 req->port_no = htons(str_to_port_no(argv[1], argv[2]));
482 req->port_no = htons(OFPP_ALL);
484 if (argc > 3 && argv[3][0] && strcasecmp(argv[3], "all")) {
485 req->queue_id = htonl(atoi(argv[3]));
487 req->queue_id = htonl(OFPQ_ALL);
490 memset(req->pad, 0, sizeof req->pad);
492 dump_stats_transaction(argv[1], request);
496 do_add_flow(int argc OVS_UNUSED, char *argv[])
499 struct ofpbuf *buffer;
501 buffer = parse_ofp_flow_mod_str(argv[2], OFPFC_ADD);
503 open_vconn(argv[1], &vconn);
504 send_openflow_buffer(vconn, buffer);
509 do_add_flows(int argc OVS_UNUSED, char *argv[])
515 file = fopen(argv[2], "r");
517 ovs_fatal(errno, "%s: open", argv[2]);
520 open_vconn(argv[1], &vconn);
521 while ((b = parse_ofp_add_flow_file(file)) != NULL) {
522 send_openflow_buffer(vconn, b);
529 do_mod_flows(int argc OVS_UNUSED, char *argv[])
532 struct ofpbuf *buffer;
535 command = strict ? OFPFC_MODIFY_STRICT : OFPFC_MODIFY;
536 buffer = parse_ofp_flow_mod_str(argv[2], command);
537 open_vconn(argv[1], &vconn);
538 send_openflow_buffer(vconn, buffer);
542 static void do_del_flows(int argc, char *argv[])
545 struct ofpbuf *buffer;
548 command = strict ? OFPFC_DELETE_STRICT : OFPFC_DELETE;
549 buffer = parse_ofp_flow_mod_str(argc > 2 ? argv[2] : "", command);
551 open_vconn(argv[1], &vconn);
552 send_openflow_buffer(vconn, buffer);
557 do_tun_cookie(int argc OVS_UNUSED, char *argv[])
559 struct nxt_tun_id_cookie *tun_id_cookie;
560 struct ofpbuf *buffer;
563 tun_id_cookie = make_nxmsg(sizeof *tun_id_cookie, NXT_TUN_ID_FROM_COOKIE,
565 tun_id_cookie->set = !strcmp(argv[2], "true");
567 open_vconn(argv[1], &vconn);
568 send_openflow_buffer(vconn, buffer);
573 monitor_vconn(struct vconn *vconn)
577 run(vconn_recv_block(vconn, &b), "vconn_recv");
578 ofp_print(stderr, b->data, b->size, 2);
584 do_monitor(int argc, char *argv[])
588 open_vconn(argv[1], &vconn);
590 int miss_send_len = atoi(argv[2]);
591 struct ofp_switch_config *osc;
594 osc = make_openflow(sizeof *osc, OFPT_SET_CONFIG, &buf);
595 osc->miss_send_len = htons(miss_send_len);
596 send_openflow_buffer(vconn, buf);
598 monitor_vconn(vconn);
602 do_snoop(int argc OVS_UNUSED, char *argv[])
606 open_vconn__(argv[1], "snoop", &vconn);
607 monitor_vconn(vconn);
611 do_dump_ports(int argc, char *argv[])
613 struct ofp_port_stats_request *req;
614 struct ofpbuf *request;
617 req = alloc_stats_request(sizeof *req, OFPST_PORT, &request);
618 port = argc > 2 ? str_to_port_no(argv[1], argv[2]) : OFPP_NONE;
619 req->port_no = htons(port);
620 dump_stats_transaction(argv[1], request);
624 do_probe(int argc OVS_UNUSED, char *argv[])
626 struct ofpbuf *request;
628 struct ofpbuf *reply;
630 make_openflow(sizeof(struct ofp_header), OFPT_ECHO_REQUEST, &request);
631 open_vconn(argv[1], &vconn);
632 run(vconn_transact(vconn, request, &reply), "talking to %s", argv[1]);
633 if (reply->size != sizeof(struct ofp_header)) {
634 ovs_fatal(0, "reply does not match request");
636 ofpbuf_delete(reply);
641 do_mod_port(int argc OVS_UNUSED, char *argv[])
643 struct ofpbuf *request, *reply;
644 struct ofp_switch_features *osf;
645 struct ofp_port_mod *opm;
653 /* Check if the argument is a port index. Otherwise, treat it as
655 port_no = strtol(argv[2], &endptr, 10);
656 if (port_no == 0 && endptr == argv[2]) {
660 /* Send a "Features Request" to get the information we need in order
661 * to modify the port. */
662 make_openflow(sizeof(struct ofp_header), OFPT_FEATURES_REQUEST, &request);
663 open_vconn(argv[1], &vconn);
664 run(vconn_transact(vconn, request, &reply), "talking to %s", argv[1]);
667 n_ports = (reply->size - sizeof *osf) / sizeof *osf->ports;
669 for (port_idx = 0; port_idx < n_ports; port_idx++) {
671 /* Check argument as a port index */
672 if (osf->ports[port_idx].port_no == htons(port_no)) {
676 /* Check argument as an interface name */
677 if (!strncmp((char *)osf->ports[port_idx].name, argv[2],
678 sizeof osf->ports[0].name)) {
684 if (port_idx == n_ports) {
685 ovs_fatal(0, "couldn't find monitored port: %s", argv[2]);
688 opm = make_openflow(sizeof(struct ofp_port_mod), OFPT_PORT_MOD, &request);
689 opm->port_no = osf->ports[port_idx].port_no;
690 memcpy(opm->hw_addr, osf->ports[port_idx].hw_addr, sizeof opm->hw_addr);
691 opm->config = htonl(0);
692 opm->mask = htonl(0);
693 opm->advertise = htonl(0);
695 printf("modifying port: %s\n", osf->ports[port_idx].name);
697 if (!strncasecmp(argv[3], MOD_PORT_CMD_UP, sizeof MOD_PORT_CMD_UP)) {
698 opm->mask |= htonl(OFPPC_PORT_DOWN);
699 } else if (!strncasecmp(argv[3], MOD_PORT_CMD_DOWN,
700 sizeof MOD_PORT_CMD_DOWN)) {
701 opm->mask |= htonl(OFPPC_PORT_DOWN);
702 opm->config |= htonl(OFPPC_PORT_DOWN);
703 } else if (!strncasecmp(argv[3], MOD_PORT_CMD_FLOOD,
704 sizeof MOD_PORT_CMD_FLOOD)) {
705 opm->mask |= htonl(OFPPC_NO_FLOOD);
706 } else if (!strncasecmp(argv[3], MOD_PORT_CMD_NOFLOOD,
707 sizeof MOD_PORT_CMD_NOFLOOD)) {
708 opm->mask |= htonl(OFPPC_NO_FLOOD);
709 opm->config |= htonl(OFPPC_NO_FLOOD);
711 ovs_fatal(0, "unknown mod-port command '%s'", argv[3]);
714 send_openflow_buffer(vconn, request);
716 ofpbuf_delete(reply);
721 do_ping(int argc, char *argv[])
723 size_t max_payload = 65535 - sizeof(struct ofp_header);
724 unsigned int payload;
728 payload = argc > 2 ? atoi(argv[2]) : 64;
729 if (payload > max_payload) {
730 ovs_fatal(0, "payload must be between 0 and %zu bytes", max_payload);
733 open_vconn(argv[1], &vconn);
734 for (i = 0; i < 10; i++) {
735 struct timeval start, end;
736 struct ofpbuf *request, *reply;
737 struct ofp_header *rq_hdr, *rpy_hdr;
739 rq_hdr = make_openflow(sizeof(struct ofp_header) + payload,
740 OFPT_ECHO_REQUEST, &request);
741 random_bytes(rq_hdr + 1, payload);
743 gettimeofday(&start, NULL);
744 run(vconn_transact(vconn, ofpbuf_clone(request), &reply), "transact");
745 gettimeofday(&end, NULL);
747 rpy_hdr = reply->data;
748 if (reply->size != request->size
749 || memcmp(rpy_hdr + 1, rq_hdr + 1, payload)
750 || rpy_hdr->xid != rq_hdr->xid
751 || rpy_hdr->type != OFPT_ECHO_REPLY) {
752 printf("Reply does not match request. Request:\n");
753 ofp_print(stdout, request, request->size, 2);
755 ofp_print(stdout, reply, reply->size, 2);
757 printf("%zu bytes from %s: xid=%08"PRIx32" time=%.1f ms\n",
758 reply->size - sizeof *rpy_hdr, argv[1], rpy_hdr->xid,
759 (1000*(double)(end.tv_sec - start.tv_sec))
760 + (.001*(end.tv_usec - start.tv_usec)));
761 ofpbuf_delete(request);
762 ofpbuf_delete(reply);
768 do_benchmark(int argc OVS_UNUSED, char *argv[])
770 size_t max_payload = 65535 - sizeof(struct ofp_header);
771 struct timeval start, end;
772 unsigned int payload_size, message_size;
778 payload_size = atoi(argv[2]);
779 if (payload_size > max_payload) {
780 ovs_fatal(0, "payload must be between 0 and %zu bytes", max_payload);
782 message_size = sizeof(struct ofp_header) + payload_size;
784 count = atoi(argv[3]);
786 printf("Sending %d packets * %u bytes (with header) = %u bytes total\n",
787 count, message_size, count * message_size);
789 open_vconn(argv[1], &vconn);
790 gettimeofday(&start, NULL);
791 for (i = 0; i < count; i++) {
792 struct ofpbuf *request, *reply;
793 struct ofp_header *rq_hdr;
795 rq_hdr = make_openflow(message_size, OFPT_ECHO_REQUEST, &request);
796 memset(rq_hdr + 1, 0, payload_size);
797 run(vconn_transact(vconn, request, &reply), "transact");
798 ofpbuf_delete(reply);
800 gettimeofday(&end, NULL);
803 duration = ((1000*(double)(end.tv_sec - start.tv_sec))
804 + (.001*(end.tv_usec - start.tv_usec)));
805 printf("Finished in %.1f ms (%.0f packets/s) (%.0f bytes/s)\n",
806 duration, count / (duration / 1000.0),
807 count * message_size / (duration / 1000.0));
811 do_help(int argc OVS_UNUSED, char *argv[] OVS_UNUSED)
816 /* Undocumented commands for unit testing. */
819 do_parse_flows(int argc OVS_UNUSED, char *argv[])
824 file = fopen(argv[1], "r");
826 ovs_fatal(errno, "%s: open", argv[2]);
829 while ((b = parse_ofp_add_flow_file(file)) != NULL) {
830 ofp_print(stdout, b->data, b->size, 0);
837 do_parse_nx_match(int argc OVS_UNUSED, char *argv[] OVS_UNUSED)
842 while (!ds_get_line(&in, stdin)) {
843 struct ofpbuf nx_match;
844 struct cls_rule rule;
849 /* Delete comments, skip blank lines. */
855 if (strchr(s, '#')) {
856 *strchr(s, '#') = '\0';
858 if (s[strspn(s, " ")] == '\0') {
863 /* Convert string to nx_match. */
864 ofpbuf_init(&nx_match, 0);
865 match_len = nx_match_from_string(ds_cstr(&in), &nx_match);
867 /* Convert nx_match to cls_rule. */
868 error = nx_pull_match(&nx_match, match_len, 0, &rule);
872 /* Convert cls_rule back to nx_match. */
873 ofpbuf_uninit(&nx_match);
874 ofpbuf_init(&nx_match, 0);
875 match_len = nx_put_match(&nx_match, &rule);
877 /* Convert nx_match to string. */
878 out = nx_match_to_string(nx_match.data, match_len);
882 printf("nx_pull_match() returned error %x\n", error);
885 ofpbuf_uninit(&nx_match);
890 static const struct command all_commands[] = {
891 { "show", 1, 1, do_show },
892 { "status", 1, 2, do_status },
893 { "monitor", 1, 2, do_monitor },
894 { "snoop", 1, 1, do_snoop },
895 { "dump-desc", 1, 1, do_dump_desc },
896 { "dump-tables", 1, 1, do_dump_tables },
897 { "dump-flows", 1, 2, do_dump_flows },
898 { "dump-aggregate", 1, 2, do_dump_aggregate },
899 { "queue-stats", 1, 3, do_queue_stats },
900 { "add-flow", 2, 2, do_add_flow },
901 { "add-flows", 2, 2, do_add_flows },
902 { "mod-flows", 2, 2, do_mod_flows },
903 { "del-flows", 1, 2, do_del_flows },
904 { "tun-cookie", 2, 2, do_tun_cookie },
905 { "dump-ports", 1, 2, do_dump_ports },
906 { "mod-port", 3, 3, do_mod_port },
907 { "probe", 1, 1, do_probe },
908 { "ping", 1, 2, do_ping },
909 { "benchmark", 3, 3, do_benchmark },
910 { "help", 0, INT_MAX, do_help },
912 /* Undocumented commands for testing. */
913 { "parse-flows", 1, 1, do_parse_flows },
914 { "parse-nx-match", 0, 0, do_parse_nx_match },
916 { NULL, 0, 0, NULL },