/*
- * Copyright (c) 2008, 2009, 2010, 2011, 2012 Nicira Networks.
+ * Copyright (c) 2008, 2009, 2010, 2011, 2012 Nicira, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
" get-frags SWITCH print fragment handling behavior\n"
" set-frags SWITCH FRAG_MODE set fragment handling behavior\n"
" dump-ports SWITCH [PORT] print port statistics\n"
+ " dump-ports-desc SWITCH print port descriptions\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"
open_vconn(vconn_name, &vconn);
run(vconn_transact(vconn, request, &reply), "talking to %s", vconn_name);
ofp_print(stdout, reply->data, reply->size, verbosity + 1);
+ ofpbuf_delete(reply);
vconn_close(vconn);
}
vconn_name, ofperr_to_string(error));
}
- while (!ofputil_pull_switch_features_port(&b, pp)) {
+ while (!ofputil_pull_phy_port(osf->header.version, &b, pp)) {
if (port_no != UINT_MAX
? port_no == pp->port_no
: !strcmp(pp->name, port_name)) {
}
msg = ofputil_encode_barrier_request();
- fprintf(stderr, "send: ");
- ofp_print(stderr, msg->data, msg->size, verbosity);
-
error = vconn_send_block(aux->vconn, msg);
if (error) {
ofpbuf_delete(msg);
dump_stats_transaction(argv[1], request);
}
+static void
+do_dump_ports_desc(int argc OVS_UNUSED, char *argv[])
+{
+ dump_trivial_stats_transaction(argv[1], OFPST_PORT_DESC);
+}
+
static void
do_probe(int argc OVS_UNUSED, char *argv[])
{
ofpbuf_delete(packet);
}
vconn_close(vconn);
+ ofpbuf_uninit(&actions);
}
static void
classifier_remove(cls, &fte->rule);
fte_free(fte);
}
+ classifier_destroy(cls);
}
/* Searches 'cls' for an FTE matching 'rule', inserting a new one if
ds_destroy(&in);
}
+/* "print-error ENUM": Prints the type and code of ENUM for every OpenFlow
+ * version. */
+static void
+do_print_error(int argc OVS_UNUSED, char *argv[])
+{
+ enum ofperr error;
+ int version;
+
+ error = ofperr_from_name(argv[1]);
+ if (!error) {
+ ovs_fatal(0, "unknown error \"%s\"", argv[1]);
+ }
+
+ for (version = 0; version <= UINT8_MAX; version++) {
+ const struct ofperr_domain *domain;
+
+ domain = ofperr_domain_from_version(version);
+ if (!domain) {
+ continue;
+ }
+
+ printf("%s: %d,%d\n",
+ ofperr_domain_get_name(domain),
+ ofperr_get_type(error, domain),
+ ofperr_get_code(error, domain));
+ }
+}
+
/* "ofp-print HEXSTRING [VERBOSITY]": Converts the hex digits in HEXSTRING into
* binary data, interpreting them as an OpenFlow message, and prints the
* OpenFlow message on stdout, at VERBOSITY (level 2 by default). */
{ "diff-flows", 2, 2, do_diff_flows },
{ "packet-out", 4, INT_MAX, do_packet_out },
{ "dump-ports", 1, 2, do_dump_ports },
+ { "dump-ports-desc", 1, 1, do_dump_ports_desc },
{ "mod-port", 3, 3, do_mod_port },
{ "get-frags", 1, 1, do_get_frags },
{ "set-frags", 2, 2, do_set_frags },
{ "parse-flow", 1, 1, do_parse_flow },
{ "parse-flows", 1, 1, do_parse_flows },
{ "parse-nx-match", 0, 0, do_parse_nx_match },
+ { "print-error", 1, 1, do_print_error },
{ "ofp-print", 1, 2, do_ofp_print },
{ NULL, 0, 0, NULL },