summaryrefslogtreecommitdiff
path: root/utilities
diff options
context:
space:
mode:
authorBen Pfaff <blp@nicira.com>2014-05-07 23:18:46 -0700
committerBen Pfaff <blp@nicira.com>2014-05-14 10:31:44 -0700
commit70ae4f930cf99d0604f5e724f8f79bf08d11f263 (patch)
tree9f0870972bd2c81cd7f138a3d561a1e8a2afb8e5 /utilities
parent19187a715fcaf09840cbf9e994972152d0cb9880 (diff)
downloadopenvswitch-70ae4f930cf99d0604f5e724f8f79bf08d11f263.tar.gz
Implement OpenFlow 1.5 port desc stats request.
OpenFlow 1.4 and earlier always send the description of every port in response to an OFPMP_PORT_DESC request. OpenFlow 1.5 proposes allowing the controller to request a description of a single port. This commit implements a prototype. EXT-69. Signed-off-by: Ben Pfaff <blp@nicira.com>
Diffstat (limited to 'utilities')
-rw-r--r--utilities/ovs-ofctl.8.in16
-rw-r--r--utilities/ovs-ofctl.c21
2 files changed, 27 insertions, 10 deletions
diff --git a/utilities/ovs-ofctl.8.in b/utilities/ovs-ofctl.8.in
index 16d6d930e..fc264c72c 100644
--- a/utilities/ovs-ofctl.8.in
+++ b/utilities/ovs-ofctl.8.in
@@ -70,11 +70,19 @@ Prints to the console statistics for network devices associated with
associated with that device will be printed. \fInetdev\fR can be an
OpenFlow assigned port number or device name, e.g. \fBeth0\fR.
.
-.TP
-\fBdump\-ports\-desc \fIswitch\fR
+.IP "\fBdump\-ports\-desc \fIswitch\fR [\fIport\fR]"
Prints to the console detailed information about network devices
-associated with \fIswitch\fR (version 1.7 or later). This is a subset
-of the information provided by the \fBshow\fR command.
+associated with \fIswitch\fR. To dump only a specific port, specify
+its number as \fIport\fR. Otherwise, if \fIport\fR is omitted, or if
+it is specified as \fBANY\fR, then all ports are printed. This is a
+subset of the information provided by the \fBshow\fR command.
+.IP
+If the connection to \fIswitch\fR negotiates OpenFlow 1.0, 1.2, or
+1.2, this command uses an OpenFlow extension only implemented in Open
+vSwitch (version 1.7 and later).
+.IP
+Only OpenFlow 1.5 and later support dumping a specific port. Earlier
+versions of OpenFlow always dump all ports.
.
.IP "\fBmod\-port \fIswitch\fR \fIport\fR \fIaction\fR"
Modify characteristics of port \fBport\fR in \fIswitch\fR. \fIport\fR
diff --git a/utilities/ovs-ofctl.c b/utilities/ovs-ofctl.c
index 3b78ca587..986c18f7b 100644
--- a/utilities/ovs-ofctl.c
+++ b/utilities/ovs-ofctl.c
@@ -305,7 +305,7 @@ usage(void)
" 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-ports-desc SWITCH [PORT] 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"
@@ -648,7 +648,7 @@ ofctl_show(int argc OVS_UNUSED, char *argv[])
ofpbuf_delete(reply);
if (!has_ports) {
- request = ofpraw_alloc(OFPRAW_OFPST_PORT_DESC_REQUEST, version, 0);
+ request = ofputil_encode_port_desc_stats_request(version, OFPP_ANY);
dump_stats_transaction(vconn, request);
}
dump_trivial_transaction(vconn_name, OFPRAW_OFPT_GET_CONFIG_REQUEST);
@@ -761,8 +761,8 @@ fetch_port_by_stats(struct vconn *vconn,
bool done = false;
bool found = false;
- request = ofpraw_alloc(OFPRAW_OFPST_PORT_DESC_REQUEST,
- vconn_get_version(vconn), 0);
+ request = ofputil_encode_port_desc_stats_request(vconn_get_version(vconn),
+ port_no);
send_xid = ((struct ofp_header *) ofpbuf_data(request))->xid;
send_openflow_buffer(vconn, request);
@@ -1620,7 +1620,16 @@ ofctl_dump_ports(int argc, char *argv[])
static void
ofctl_dump_ports_desc(int argc OVS_UNUSED, char *argv[])
{
- dump_trivial_stats_transaction(argv[1], OFPRAW_OFPST_PORT_DESC_REQUEST);
+ struct ofpbuf *request;
+ struct vconn *vconn;
+ ofp_port_t port;
+
+ open_vconn(argv[1], &vconn);
+ port = argc > 2 ? str_to_port_no(argv[1], argv[2]) : OFPP_ANY;
+ request = ofputil_encode_port_desc_stats_request(vconn_get_version(vconn),
+ port);
+ dump_stats_transaction(vconn, request);
+ vconn_close(vconn);
}
static void
@@ -3504,7 +3513,7 @@ static const struct command all_commands[] = {
{ "meter-features", 1, 1, ofctl_meter_features },
{ "packet-out", 4, INT_MAX, ofctl_packet_out },
{ "dump-ports", 1, 2, ofctl_dump_ports },
- { "dump-ports-desc", 1, 1, ofctl_dump_ports_desc },
+ { "dump-ports-desc", 1, 2, ofctl_dump_ports_desc },
{ "mod-port", 3, 3, ofctl_mod_port },
{ "mod-table", 3, 3, ofctl_mod_table },
{ "get-frags", 1, 1, ofctl_get_frags },