2009-07-08 13:19:16 -07:00
|
|
|
|
/*
|
ofp-actions: Fix variable length meta-flow OXMs.
Previously, if a flow action that involves a tunnel metadata meta-flow
field is dumped from vswitchd, the replied field length in the OXM header
is filled with the maximum possible field length, instead of the length
configured in the tunnel TLV mapping table. To solve this issue, this patch
introduces the following changes.
In order to maintain the correct length of variable length mf_fields (i.e.
tun_metadata), this patch creates a per-switch based map (struct vl_mff_map)
that hosts the variable length mf_fields. This map is updated when a
controller adds/deletes tlv-mapping entries to/from a switch. Although the
per-swtch based vl_mff_map only hosts tun_metadata for now, it is able to
support new variable length mf_fields in the future.
With this commit, when a switch decodes a flow action with mf_field, the switch
firstly looks up the global mf_fields map to identify the mf_field type. For
the variable length mf_fields, the switch uses the vl_mff_map to get the
configured mf_field entries. By lookig up vl_mff_map, the switch can check
if the added flow action access beyond the configured size of a variable
length mf_field, and the switch reports an ofperr if the controller adds a flow
with unmapped variable length mf_field. Later on, when a controller request
flows from the switch, with the per-switch based mf_fields, the switch will
encode the OXM header with correct length for variable length mf_fields.
To use the vl_mff_map for decoding flow actions, extract-ofp-actions is
updated to pass the vl_mff_map to the required action decoding functions.
Also, a new error code is introduced to identify a flow with an invalid
variable length mf_field. Moreover, a testcase is added to prevent future
regressions.
Committer notes:
- Factor out common code
- Style fixups
- Rename OFPERR_NXFMFC_INVALID_VL_MFF -> OFPERR_NXFMFC_INVALID_TLV_FIELD
VMWare-BZ: #1768370
Reported-by: Harold Lim <haroldl@vmware.com>
Suggested-by: Joe Stringer <joe@ovn.org>
Suggested-by: Jarno Rajahalme <jarno@ovn.org>
Signed-off-by: Yi-Hung Wei <yihung.wei@gmail.com>
Signed-off-by: Joe Stringer <joe@ovn.org>
2017-01-20 15:12:21 -08:00
|
|
|
|
* Copyright (c) 2008-2017 Nicira, Inc.
|
2009-07-08 13:19:16 -07:00
|
|
|
|
*
|
2009-06-15 15:11:30 -07:00
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
|
* You may obtain a copy of the License at:
|
2009-07-08 13:19:16 -07:00
|
|
|
|
*
|
2009-06-15 15:11:30 -07:00
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
*
|
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
|
* limitations under the License.
|
2009-07-08 13:19:16 -07:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
2017-08-08 16:11:46 -07:00
|
|
|
|
#include "openvswitch/ofp-print.h"
|
|
|
|
|
|
2009-07-08 13:19:16 -07:00
|
|
|
|
#include <errno.h>
|
|
|
|
|
#include <inttypes.h>
|
2010-02-12 12:51:36 -08:00
|
|
|
|
#include <sys/types.h>
|
2009-07-08 13:19:16 -07:00
|
|
|
|
#include <netinet/in.h>
|
|
|
|
|
#include <sys/wait.h>
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include <ctype.h>
|
|
|
|
|
|
2011-06-10 17:45:45 -07:00
|
|
|
|
#include "bundle.h"
|
2010-10-28 17:13:18 -07:00
|
|
|
|
#include "byte-order.h"
|
2016-03-02 15:56:18 +01:00
|
|
|
|
#include "colors.h"
|
2009-07-08 13:19:16 -07:00
|
|
|
|
#include "compiler.h"
|
2016-04-14 15:20:21 -07:00
|
|
|
|
#include "dp-packet.h"
|
2009-07-08 13:19:16 -07:00
|
|
|
|
#include "flow.h"
|
2011-09-12 16:19:57 -07:00
|
|
|
|
#include "learn.h"
|
2010-12-17 14:38:50 -08:00
|
|
|
|
#include "multipath.h"
|
2012-02-15 16:33:04 -08:00
|
|
|
|
#include "netdev.h"
|
2010-12-07 13:22:46 -08:00
|
|
|
|
#include "nx-match.h"
|
2016-04-14 15:20:21 -07:00
|
|
|
|
#include "odp-util.h"
|
2009-07-08 13:19:16 -07:00
|
|
|
|
#include "openflow/nicira-ext.h"
|
2016-04-14 15:20:19 -07:00
|
|
|
|
#include "openflow/openflow.h"
|
2016-04-04 21:32:10 -04:00
|
|
|
|
#include "openvswitch/dynamic-string.h"
|
|
|
|
|
#include "openvswitch/meta-flow.h"
|
2016-04-14 15:20:19 -07:00
|
|
|
|
#include "openvswitch/ofp-actions.h"
|
2018-02-09 10:04:26 -08:00
|
|
|
|
#include "openvswitch/ofp-bundle.h"
|
|
|
|
|
#include "openvswitch/ofp-connection.h"
|
2016-03-03 10:20:43 -08:00
|
|
|
|
#include "openvswitch/ofp-errors.h"
|
2018-02-09 10:04:26 -08:00
|
|
|
|
#include "openvswitch/ofp-group.h"
|
|
|
|
|
#include "openvswitch/ofp-ipfix.h"
|
|
|
|
|
#include "openvswitch/ofp-match.h"
|
|
|
|
|
#include "openvswitch/ofp-meter.h"
|
|
|
|
|
#include "openvswitch/ofp-monitor.h"
|
2016-04-04 21:32:10 -04:00
|
|
|
|
#include "openvswitch/ofp-msgs.h"
|
2018-02-09 10:04:26 -08:00
|
|
|
|
#include "openvswitch/ofp-port.h"
|
|
|
|
|
#include "openvswitch/ofp-queue.h"
|
|
|
|
|
#include "openvswitch/ofp-switch.h"
|
|
|
|
|
#include "openvswitch/ofp-table.h"
|
2016-04-04 21:32:10 -04:00
|
|
|
|
#include "openvswitch/ofp-util.h"
|
|
|
|
|
#include "openvswitch/ofpbuf.h"
|
|
|
|
|
#include "openvswitch/type-props.h"
|
2009-07-08 13:19:16 -07:00
|
|
|
|
#include "packets.h"
|
2011-01-18 11:50:56 -08:00
|
|
|
|
#include "unaligned.h"
|
2009-07-08 13:19:16 -07:00
|
|
|
|
#include "util.h"
|
2016-04-04 21:32:04 -04:00
|
|
|
|
#include "uuid.h"
|
2009-07-08 13:19:16 -07:00
|
|
|
|
|
2012-01-12 15:48:19 -08:00
|
|
|
|
static void ofp_print_error(struct ds *, enum ofperr);
|
2009-07-08 13:19:16 -07:00
|
|
|
|
|
|
|
|
|
/* Returns a string that represents the contents of the Ethernet frame in the
|
2011-12-21 12:59:28 -08:00
|
|
|
|
* 'len' bytes starting at 'data'. The caller must free the returned string.*/
|
2009-07-08 13:19:16 -07:00
|
|
|
|
char *
|
2017-04-25 16:29:59 +00:00
|
|
|
|
ofp_packet_to_string(const void *data, size_t len, ovs_be32 packet_type)
|
2009-07-08 13:19:16 -07:00
|
|
|
|
{
|
|
|
|
|
struct ds ds = DS_EMPTY_INITIALIZER;
|
2015-02-22 03:21:09 -08:00
|
|
|
|
struct dp_packet buf;
|
2011-12-21 12:59:28 -08:00
|
|
|
|
struct flow flow;
|
2014-03-25 15:26:23 -07:00
|
|
|
|
size_t l4_size;
|
2009-07-08 13:19:16 -07:00
|
|
|
|
|
2015-02-22 03:21:09 -08:00
|
|
|
|
dp_packet_use_const(&buf, data, len);
|
2017-04-25 16:29:59 +00:00
|
|
|
|
buf.packet_type = packet_type;
|
2015-02-22 03:21:09 -08:00
|
|
|
|
flow_extract(&buf, &flow);
|
2017-05-31 16:06:12 -07:00
|
|
|
|
flow_format(&ds, &flow, NULL);
|
2011-12-20 19:56:43 -08:00
|
|
|
|
|
2015-02-22 03:21:09 -08:00
|
|
|
|
l4_size = dp_packet_l4_size(&buf);
|
2014-03-25 15:26:23 -07:00
|
|
|
|
|
|
|
|
|
if (flow.nw_proto == IPPROTO_TCP && l4_size >= TCP_HEADER_LEN) {
|
2015-02-22 03:21:09 -08:00
|
|
|
|
struct tcp_header *th = dp_packet_l4(&buf);
|
2014-03-25 15:26:23 -07:00
|
|
|
|
ds_put_format(&ds, " tcp_csum:%"PRIx16, ntohs(th->tcp_csum));
|
|
|
|
|
} else if (flow.nw_proto == IPPROTO_UDP && l4_size >= UDP_HEADER_LEN) {
|
2015-02-22 03:21:09 -08:00
|
|
|
|
struct udp_header *uh = dp_packet_l4(&buf);
|
2014-03-25 15:26:23 -07:00
|
|
|
|
ds_put_format(&ds, " udp_csum:%"PRIx16, ntohs(uh->udp_csum));
|
|
|
|
|
} else if (flow.nw_proto == IPPROTO_SCTP && l4_size >= SCTP_HEADER_LEN) {
|
2015-02-22 03:21:09 -08:00
|
|
|
|
struct sctp_header *sh = dp_packet_l4(&buf);
|
2014-04-04 20:21:15 -07:00
|
|
|
|
ds_put_format(&ds, " sctp_csum:%"PRIx32,
|
|
|
|
|
ntohl(get_16aligned_be32(&sh->sctp_csum)));
|
2014-12-23 23:42:05 +00:00
|
|
|
|
} else if (flow.nw_proto == IPPROTO_ICMP && l4_size >= ICMP_HEADER_LEN) {
|
2015-02-22 03:21:09 -08:00
|
|
|
|
struct icmp_header *icmph = dp_packet_l4(&buf);
|
2014-12-23 23:42:05 +00:00
|
|
|
|
ds_put_format(&ds, " icmp_csum:%"PRIx16,
|
|
|
|
|
ntohs(icmph->icmp_csum));
|
|
|
|
|
} else if (flow.nw_proto == IPPROTO_ICMPV6 && l4_size >= ICMP6_HEADER_LEN) {
|
2015-02-22 03:21:09 -08:00
|
|
|
|
struct icmp6_header *icmp6h = dp_packet_l4(&buf);
|
2014-12-23 23:42:05 +00:00
|
|
|
|
ds_put_format(&ds, " icmp6_csum:%"PRIx16,
|
|
|
|
|
ntohs(icmp6h->icmp6_cksum));
|
2011-12-20 19:56:43 -08:00
|
|
|
|
}
|
|
|
|
|
|
2011-12-21 12:59:28 -08:00
|
|
|
|
ds_put_char(&ds, '\n');
|
2009-07-08 13:19:16 -07:00
|
|
|
|
|
|
|
|
|
return ds_cstr(&ds);
|
|
|
|
|
}
|
|
|
|
|
|
2017-04-25 16:29:59 +00:00
|
|
|
|
char *
|
|
|
|
|
ofp_dp_packet_to_string(const struct dp_packet *packet)
|
|
|
|
|
{
|
|
|
|
|
return ofp_packet_to_string(dp_packet_data(packet),
|
|
|
|
|
dp_packet_size(packet),
|
|
|
|
|
packet->packet_type);
|
|
|
|
|
}
|
|
|
|
|
|
2018-01-04 22:40:01 -08:00
|
|
|
|
static enum ofperr
|
2011-12-22 16:35:23 -08:00
|
|
|
|
ofp_print_packet_in(struct ds *string, const struct ofp_header *oh,
|
Support accepting and displaying table names in OVS tools.
OpenFlow has little-known support for naming tables. Open vSwitch has
supported table names for ages, but it has never used or displayed them
outside of commands dedicated to table manipulation. This commit adds
support for table names in ovs-ofctl. When a table has a name, it displays
that name in flows and actions, so that, for example, the following:
table=1, arp, actions=resubmit(,2)
might become:
table=ingress_acl, arp, actions=resubmit(,mac_learning)
given appropriately named tables.
For backward compatibility, only interactive ovs-ofctl commands by default
display table names; to display them in scripts, use the new --names
option.
This feature was inspired by a talk that Kei Nohguchi presented at Open
vSwitch 2017 Fall Conference.
CC: Kei Nohguchi <kei@nohguchi.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Mark Michelson <mmichels@redhat.com>
Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
2018-01-05 16:59:13 -08:00
|
|
|
|
const struct ofputil_port_map *port_map,
|
|
|
|
|
const struct ofputil_table_map *table_map, int verbosity)
|
2009-07-08 13:19:16 -07:00
|
|
|
|
{
|
Implement serializing the state of packet traversal in "continuations".
One purpose of OpenFlow packet-in messages is to allow a controller to
interpose on the path of a packet through the flow tables. If, for
example, the controller needs to modify a packet in some way that the
switch doesn't directly support, the controller should be able to
program the switch to send it the packet, then modify the packet and
send it back to the switch to continue through the flow table.
That's the theory. In practice, this doesn't work with any but the
simplest flow tables. Packet-in messages simply don't include enough
context to allow the flow table traversal to continue. For example:
* Via "resubmit" actions, an Open vSwitch packet can have an
effective "call stack", but a packet-in can't describe it, and
so it would be lost.
* A packet-in can't preserve the stack used by NXAST_PUSH and
NXAST_POP actions.
* A packet-in can't preserve the OpenFlow 1.1+ action set.
* A packet-in can't preserve the state of Open vSwitch mirroring
or connection tracking.
This commit introduces a solution called "continuations". A continuation
is the state of a packet's traversal through OpenFlow flow tables. A
"controller" action with the "pause" flag, which is newly implemented in
this commit, generates a continuation and sends it to the OpenFlow
controller in a packet-in asynchronous message (only NXT_PACKET_IN2
supports continuations, so the controller must configure them with
NXT_SET_PACKET_IN_FORMAT). The controller processes the packet-in,
possibly modifying some of its data, and sends it back to the switch with
an NXT_RESUME request, which causes flow table traversal to continue. In
principle, a single packet can be paused and resumed multiple times.
Another way to look at it is:
- "pause" is an extension of the existing OFPAT_CONTROLLER
action. It sends the packet to the controller, with full
pipeline context (some of which is switch implementation
dependent, and may thus vary from switch to switch).
- A continuation is an extension of OFPT_PACKET_IN, allowing for
implementation dependent metadata.
- NXT_RESUME is an extension of OFPT_PACKET_OUT, with the
semantics that the pipeline processing is continued with the
original translation context from where it was left at the time
it was paused.
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
2016-02-19 16:10:06 -08:00
|
|
|
|
struct ofputil_packet_in_private pin;
|
openflow: Better abstract handling of packet-in messages.
Packet-in messages have been a bit of a mess. First, their abstraction
in the form of struct ofputil_packet_in has some fields that are used
in a clear way for incoming and outgoing packet-ins, and others
(packet_len, total_len, buffer_id) have have confusing meanings or
usage pattern depending on their direction.
Second, it's very confusing how a packet-in has both a reason (OFPR_*)
and a miss type (OFPROTO_PACKET_IN_*) and how those add up to the
actual reason that is used "on the wire" for each OpenFlow version (and
even whether the packet-in is sent at all!).
Finally, there's all kind of low-level detail randomly scattered between
connmgr, ofproto-dpif-xlate, and ofp-util.
This commit attempts to clear up some of the confusion. It simplifies
the struct ofputil_packet_in abstraction by removing the members that
didn't have a clear and consistent meaning between incoming and outgoing
packet-ins. It gets rid of OFPROTO_PACKET_IN_*, instead adding a couple
of nonstandard OFPR_* reasons that add up to what OFPROTO_PACKET_IN_*
was meant to say (in what I hope is a clearer way). And it consolidates
the tricky parts into ofp-util, where I hope it will be easier to
understand all in one place.
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
2016-01-20 09:57:16 -08:00
|
|
|
|
uint32_t buffer_id;
|
|
|
|
|
size_t total_len;
|
2018-02-16 14:03:51 -08:00
|
|
|
|
enum ofperr error = ofputil_decode_packet_in_private(oh, true, NULL, NULL,
|
|
|
|
|
&pin, &total_len,
|
|
|
|
|
&buffer_id);
|
|
|
|
|
if (!error) {
|
|
|
|
|
ofputil_packet_in_private_format(string, &pin, total_len, buffer_id,
|
|
|
|
|
port_map, table_map, verbosity);
|
|
|
|
|
ofputil_packet_in_private_destroy(&pin);
|
2013-05-17 14:14:14 +09:00
|
|
|
|
}
|
2018-02-16 14:03:51 -08:00
|
|
|
|
return error;
|
2009-07-08 13:19:16 -07:00
|
|
|
|
}
|
|
|
|
|
|
2018-01-04 22:40:01 -08:00
|
|
|
|
static enum ofperr
|
2012-07-19 23:23:17 -07:00
|
|
|
|
ofp_print_packet_out(struct ds *string, const struct ofp_header *oh,
|
Support accepting and displaying table names in OVS tools.
OpenFlow has little-known support for naming tables. Open vSwitch has
supported table names for ages, but it has never used or displayed them
outside of commands dedicated to table manipulation. This commit adds
support for table names in ovs-ofctl. When a table has a name, it displays
that name in flows and actions, so that, for example, the following:
table=1, arp, actions=resubmit(,2)
might become:
table=ingress_acl, arp, actions=resubmit(,mac_learning)
given appropriately named tables.
For backward compatibility, only interactive ovs-ofctl commands by default
display table names; to display them in scripts, use the new --names
option.
This feature was inspired by a talk that Kei Nohguchi presented at Open
vSwitch 2017 Fall Conference.
CC: Kei Nohguchi <kei@nohguchi.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Mark Michelson <mmichels@redhat.com>
Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
2018-01-05 16:59:13 -08:00
|
|
|
|
const struct ofputil_port_map *port_map,
|
|
|
|
|
const struct ofputil_table_map *table_map, int verbosity)
|
2009-07-08 13:19:16 -07:00
|
|
|
|
{
|
2012-02-06 14:17:49 -08:00
|
|
|
|
struct ofputil_packet_out po;
|
2012-07-03 22:17:14 -07:00
|
|
|
|
struct ofpbuf ofpacts;
|
2012-02-06 14:17:49 -08:00
|
|
|
|
enum ofperr error;
|
2009-07-08 13:19:16 -07:00
|
|
|
|
|
2012-07-03 22:17:14 -07:00
|
|
|
|
ofpbuf_init(&ofpacts, 64);
|
2017-05-15 10:04:59 -07:00
|
|
|
|
error = ofputil_decode_packet_out(&po, oh, NULL, &ofpacts);
|
2018-02-16 14:03:51 -08:00
|
|
|
|
if (!error) {
|
|
|
|
|
ofputil_packet_out_format(string, &po, port_map, table_map, verbosity);
|
2009-07-08 13:19:16 -07:00
|
|
|
|
}
|
2012-07-03 22:17:14 -07:00
|
|
|
|
ofpbuf_uninit(&ofpacts);
|
2018-02-16 14:03:51 -08:00
|
|
|
|
return error;
|
2009-07-08 13:19:16 -07:00
|
|
|
|
}
|
|
|
|
|
|
2018-02-16 14:03:51 -08:00
|
|
|
|
void
|
2011-07-14 15:17:33 -07:00
|
|
|
|
ofp_print_bit_names(struct ds *string, uint32_t bits,
|
2012-06-29 16:23:43 -07:00
|
|
|
|
const char *(*bit_to_name)(uint32_t bit),
|
|
|
|
|
char separator)
|
2009-07-08 13:19:16 -07:00
|
|
|
|
{
|
2011-07-14 15:17:33 -07:00
|
|
|
|
int n = 0;
|
2012-02-15 16:33:04 -08:00
|
|
|
|
int i;
|
2011-07-14 15:17:33 -07:00
|
|
|
|
|
|
|
|
|
if (!bits) {
|
|
|
|
|
ds_put_cstr(string, "0");
|
2009-07-08 13:19:16 -07:00
|
|
|
|
return;
|
|
|
|
|
}
|
2011-07-14 15:17:33 -07:00
|
|
|
|
|
2012-02-15 16:33:04 -08:00
|
|
|
|
for (i = 0; i < 32; i++) {
|
|
|
|
|
uint32_t bit = UINT32_C(1) << i;
|
|
|
|
|
|
|
|
|
|
if (bits & bit) {
|
|
|
|
|
const char *name = bit_to_name(bit);
|
|
|
|
|
if (name) {
|
|
|
|
|
if (n++) {
|
2012-06-29 16:23:43 -07:00
|
|
|
|
ds_put_char(string, separator);
|
2012-02-15 16:33:04 -08:00
|
|
|
|
}
|
|
|
|
|
ds_put_cstr(string, name);
|
|
|
|
|
bits &= ~bit;
|
2011-07-14 15:17:33 -07:00
|
|
|
|
}
|
|
|
|
|
}
|
2009-07-08 13:19:16 -07:00
|
|
|
|
}
|
2011-07-14 15:17:33 -07:00
|
|
|
|
|
|
|
|
|
if (bits) {
|
2012-05-13 16:34:49 -07:00
|
|
|
|
if (n) {
|
2012-06-29 16:23:43 -07:00
|
|
|
|
ds_put_char(string, separator);
|
2011-07-14 15:17:33 -07:00
|
|
|
|
}
|
|
|
|
|
ds_put_format(string, "0x%"PRIx32, bits);
|
2009-07-08 13:19:16 -07:00
|
|
|
|
}
|
2011-07-14 15:17:33 -07:00
|
|
|
|
}
|
|
|
|
|
|
2018-01-04 22:40:01 -08:00
|
|
|
|
static enum ofperr
|
2012-07-19 23:23:17 -07:00
|
|
|
|
ofp_print_switch_features(struct ds *string, const struct ofp_header *oh)
|
2009-07-08 13:19:16 -07:00
|
|
|
|
{
|
2012-02-15 16:33:04 -08:00
|
|
|
|
struct ofputil_switch_features features;
|
2016-02-18 15:13:09 -08:00
|
|
|
|
struct ofpbuf b = ofpbuf_const_initializer(oh, ntohs(oh->length));
|
|
|
|
|
enum ofperr error = ofputil_pull_switch_features(&b, &features);
|
2018-02-16 14:03:51 -08:00
|
|
|
|
if (!error) {
|
|
|
|
|
ofputil_switch_features_format(string, &features);
|
|
|
|
|
error = ofputil_phy_ports_format(string, oh->version, &b);
|
2012-01-13 17:54:04 -08:00
|
|
|
|
}
|
2018-02-16 14:03:51 -08:00
|
|
|
|
return error;
|
2015-12-21 15:39:10 -08:00
|
|
|
|
}
|
|
|
|
|
|
2018-01-04 22:40:01 -08:00
|
|
|
|
static enum ofperr
|
2015-12-21 15:39:10 -08:00
|
|
|
|
ofp_print_set_config(struct ds *string, const struct ofp_header *oh)
|
|
|
|
|
{
|
|
|
|
|
struct ofputil_switch_config config;
|
|
|
|
|
enum ofperr error;
|
|
|
|
|
|
|
|
|
|
error = ofputil_decode_set_config(oh, &config);
|
|
|
|
|
if (error) {
|
2018-01-04 22:40:01 -08:00
|
|
|
|
return error;
|
2009-07-08 13:19:16 -07:00
|
|
|
|
}
|
2018-02-16 14:03:51 -08:00
|
|
|
|
ofputil_switch_config_format(string, &config);
|
2018-01-04 22:40:01 -08:00
|
|
|
|
return 0;
|
2015-12-21 15:39:10 -08:00
|
|
|
|
}
|
2009-07-08 13:19:16 -07:00
|
|
|
|
|
2018-01-04 22:40:01 -08:00
|
|
|
|
static enum ofperr
|
2015-12-21 15:39:10 -08:00
|
|
|
|
ofp_print_get_config_reply(struct ds *string, const struct ofp_header *oh)
|
|
|
|
|
{
|
|
|
|
|
struct ofputil_switch_config config;
|
|
|
|
|
ofputil_decode_get_config_reply(oh, &config);
|
2018-02-16 14:03:51 -08:00
|
|
|
|
ofputil_switch_config_format(string, &config);
|
2018-01-04 22:40:01 -08:00
|
|
|
|
return 0;
|
2009-07-08 13:19:16 -07:00
|
|
|
|
}
|
|
|
|
|
|
2018-01-04 22:40:01 -08:00
|
|
|
|
static enum ofperr
|
2018-08-30 11:03:12 -07:00
|
|
|
|
ofp_print_table_features_reply(struct ds *s, const struct ofp_header *oh)
|
2009-07-08 13:19:16 -07:00
|
|
|
|
{
|
2018-02-16 14:03:51 -08:00
|
|
|
|
struct ofpbuf b = ofpbuf_const_initializer(oh, ntohs(oh->length));
|
2010-12-14 11:36:04 -08:00
|
|
|
|
|
2018-02-16 14:03:51 -08:00
|
|
|
|
struct ofputil_table_features prev;
|
2018-08-27 14:43:39 -07:00
|
|
|
|
int first_ditto = -1, last_ditto = -1;
|
2018-02-16 14:03:51 -08:00
|
|
|
|
for (int i = 0; ; i++) {
|
|
|
|
|
struct ofputil_table_features tf;
|
2018-08-29 11:30:13 -07:00
|
|
|
|
struct ofpbuf raw_properties;
|
|
|
|
|
int retval = ofputil_decode_table_features(&b, &tf, &raw_properties);
|
2018-02-16 14:03:51 -08:00
|
|
|
|
if (retval) {
|
2018-08-27 14:43:39 -07:00
|
|
|
|
ofputil_table_features_format_finish(s, first_ditto, last_ditto);
|
2018-02-16 14:03:51 -08:00
|
|
|
|
return retval != EOF ? retval : 0;
|
|
|
|
|
}
|
2013-08-26 16:23:50 -07:00
|
|
|
|
|
2018-02-16 14:03:51 -08:00
|
|
|
|
ofputil_table_features_format(s, &tf, i ? &prev : NULL, NULL, NULL,
|
2018-08-30 11:03:12 -07:00
|
|
|
|
&first_ditto, &last_ditto);
|
2018-02-16 14:03:51 -08:00
|
|
|
|
prev = tf;
|
2010-12-07 13:22:46 -08:00
|
|
|
|
}
|
2009-07-08 13:19:16 -07:00
|
|
|
|
}
|
|
|
|
|
|
2018-02-16 14:03:51 -08:00
|
|
|
|
void
|
2010-12-07 15:45:10 -08:00
|
|
|
|
ofp_print_duration(struct ds *string, unsigned int sec, unsigned int nsec)
|
|
|
|
|
{
|
|
|
|
|
ds_put_format(string, "%u", sec);
|
ofp-print: Print durations with at least three decimals.
Occasionally I run a command like this:
watch -n.1 ovs-ofctl dump-flows br0
to see how flows change over time. Until now, it has been more difficult
than necessary to spot real changes, because flows "jump around" as the
number of decimals printed for duration changes from moment to moment.
That is, you might see
cookie=0x0, duration=4.566s, table=0, n_packets=0, ...
one moment, and then
cookie=0x0, duration=4.8s, table=0, n_packets=0, ...
the next moment. Shortening 4.8 to 4.800 shifts everything following it
two places to the left, creating a visual jump.
This commit avoids that problem by always printing at least three decimals
if we print any. There can still be an occasional jump if a duration is
exactly on a second boundary, but that only happens 1/1000 of the time.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
2013-12-20 08:39:27 -08:00
|
|
|
|
|
|
|
|
|
/* If there are no fractional seconds, don't print any decimals.
|
|
|
|
|
*
|
|
|
|
|
* If the fractional seconds can be expressed exactly as milliseconds,
|
|
|
|
|
* print 3 decimals. Open vSwitch provides millisecond precision for most
|
|
|
|
|
* time measurements, so printing 3 decimals every time makes it easier to
|
2018-02-16 14:03:51 -08:00
|
|
|
|
* spot real changes in flow dumps that refresh themselves quickly.
|
|
|
|
|
*
|
|
|
|
|
* If the fractional seconds are more precise than milliseconds, print the
|
|
|
|
|
* number of decimals needed to express them exactly.
|
|
|
|
|
*/
|
|
|
|
|
if (nsec > 0) {
|
|
|
|
|
unsigned int msec = nsec / 1000000;
|
|
|
|
|
if (msec * 1000000 == nsec) {
|
|
|
|
|
ds_put_format(string, ".%03u", msec);
|
|
|
|
|
} else {
|
|
|
|
|
ds_put_format(string, ".%09u", nsec);
|
|
|
|
|
while (string->string[string->length - 1] == '0') {
|
|
|
|
|
string->length--;
|
|
|
|
|
}
|
|
|
|
|
}
|
2015-07-02 20:33:08 -07:00
|
|
|
|
}
|
2018-02-16 14:03:51 -08:00
|
|
|
|
ds_put_char(string, 's');
|
2015-07-02 20:33:08 -07:00
|
|
|
|
}
|
|
|
|
|
|
2018-02-16 14:03:51 -08:00
|
|
|
|
static enum ofperr
|
|
|
|
|
ofp_print_flow_removed(struct ds *string, const struct ofp_header *oh,
|
|
|
|
|
const struct ofputil_port_map *port_map,
|
|
|
|
|
const struct ofputil_table_map *table_map)
|
2015-07-02 20:33:08 -07:00
|
|
|
|
{
|
2018-02-16 14:03:51 -08:00
|
|
|
|
struct ofputil_flow_removed fr;
|
|
|
|
|
enum ofperr error = ofputil_decode_flow_removed(&fr, oh);
|
|
|
|
|
if (!error) {
|
|
|
|
|
ofputil_flow_removed_format(string, &fr, port_map, table_map);
|
2013-09-07 03:02:32 -07:00
|
|
|
|
}
|
2018-02-16 14:03:51 -08:00
|
|
|
|
return error;
|
2013-09-07 03:02:32 -07:00
|
|
|
|
}
|
|
|
|
|
|
2018-02-16 14:03:51 -08:00
|
|
|
|
static enum ofperr
|
|
|
|
|
ofp_print_port_mod(struct ds *string, const struct ofp_header *oh,
|
|
|
|
|
const struct ofputil_port_map *port_map)
|
2015-11-24 17:49:42 +05:30
|
|
|
|
{
|
2018-02-16 14:03:51 -08:00
|
|
|
|
struct ofputil_port_mod pm;
|
|
|
|
|
enum ofperr error = ofputil_decode_port_mod(oh, &pm, true);
|
|
|
|
|
if (!error) {
|
|
|
|
|
ofputil_port_mod_format(string, &pm, port_map);
|
2015-11-24 17:49:42 +05:30
|
|
|
|
}
|
2018-02-16 14:03:51 -08:00
|
|
|
|
return error;
|
2015-11-24 17:49:42 +05:30
|
|
|
|
}
|
|
|
|
|
|
2018-01-04 22:40:01 -08:00
|
|
|
|
static enum ofperr
|
Support accepting and displaying table names in OVS tools.
OpenFlow has little-known support for naming tables. Open vSwitch has
supported table names for ages, but it has never used or displayed them
outside of commands dedicated to table manipulation. This commit adds
support for table names in ovs-ofctl. When a table has a name, it displays
that name in flows and actions, so that, for example, the following:
table=1, arp, actions=resubmit(,2)
might become:
table=ingress_acl, arp, actions=resubmit(,mac_learning)
given appropriately named tables.
For backward compatibility, only interactive ovs-ofctl commands by default
display table names; to display them in scripts, use the new --names
option.
This feature was inspired by a talk that Kei Nohguchi presented at Open
vSwitch 2017 Fall Conference.
CC: Kei Nohguchi <kei@nohguchi.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Mark Michelson <mmichels@redhat.com>
Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
2018-01-05 16:59:13 -08:00
|
|
|
|
ofp_print_table_mod(struct ds *string, const struct ofp_header *oh,
|
|
|
|
|
const struct ofputil_table_map *table_map)
|
2013-09-07 03:02:32 -07:00
|
|
|
|
{
|
2018-02-16 14:03:51 -08:00
|
|
|
|
struct ofputil_table_mod tm;
|
|
|
|
|
enum ofperr error = ofputil_decode_table_mod(oh, &tm);
|
|
|
|
|
if (!error) {
|
|
|
|
|
ofputil_table_mod_format(string, &tm, table_map);
|
2015-11-24 17:50:22 +05:30
|
|
|
|
}
|
2018-02-16 14:03:51 -08:00
|
|
|
|
return error;
|
2015-07-02 20:35:44 -07:00
|
|
|
|
}
|
|
|
|
|
|
2018-01-04 22:40:01 -08:00
|
|
|
|
static enum ofperr
|
Support accepting and displaying table names in OVS tools.
OpenFlow has little-known support for naming tables. Open vSwitch has
supported table names for ages, but it has never used or displayed them
outside of commands dedicated to table manipulation. This commit adds
support for table names in ovs-ofctl. When a table has a name, it displays
that name in flows and actions, so that, for example, the following:
table=1, arp, actions=resubmit(,2)
might become:
table=ingress_acl, arp, actions=resubmit(,mac_learning)
given appropriately named tables.
For backward compatibility, only interactive ovs-ofctl commands by default
display table names; to display them in scripts, use the new --names
option.
This feature was inspired by a talk that Kei Nohguchi presented at Open
vSwitch 2017 Fall Conference.
CC: Kei Nohguchi <kei@nohguchi.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Mark Michelson <mmichels@redhat.com>
Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
2018-01-05 16:59:13 -08:00
|
|
|
|
ofp_print_table_status_message(struct ds *string, const struct ofp_header *oh,
|
|
|
|
|
const struct ofputil_table_map *table_map)
|
2016-02-18 15:54:26 +05:30
|
|
|
|
{
|
|
|
|
|
struct ofputil_table_status ts;
|
2018-06-15 17:06:56 -07:00
|
|
|
|
enum ofperr error = ofputil_decode_table_status(oh, &ts);
|
|
|
|
|
if (!error) {
|
|
|
|
|
ofputil_format_table_status(string, &ts, table_map);
|
2013-06-20 17:26:18 +03:00
|
|
|
|
}
|
2018-06-15 17:06:56 -07:00
|
|
|
|
return error;
|
2015-09-09 17:33:42 +05:30
|
|
|
|
}
|
|
|
|
|
|
2018-01-04 22:40:01 -08:00
|
|
|
|
static enum ofperr
|
2015-09-09 17:33:42 +05:30
|
|
|
|
ofp_print_meter_mod(struct ds *s, const struct ofp_header *oh)
|
|
|
|
|
{
|
|
|
|
|
struct ofputil_meter_mod mm;
|
|
|
|
|
struct ofpbuf bands;
|
|
|
|
|
|
|
|
|
|
ofpbuf_init(&bands, 64);
|
2018-06-15 17:06:56 -07:00
|
|
|
|
enum ofperr error = ofputil_decode_meter_mod(oh, &mm, &bands);
|
2018-01-04 22:40:01 -08:00
|
|
|
|
if (!error) {
|
2018-06-15 17:06:56 -07:00
|
|
|
|
ofputil_format_meter_mod(s, &mm);
|
2015-09-09 17:33:42 +05:30
|
|
|
|
}
|
2013-06-20 17:26:18 +03:00
|
|
|
|
ofpbuf_uninit(&bands);
|
2018-01-04 22:40:01 -08:00
|
|
|
|
|
|
|
|
|
return error;
|
2013-06-20 17:26:18 +03:00
|
|
|
|
}
|
|
|
|
|
|
2018-01-04 22:40:01 -08:00
|
|
|
|
static enum ofperr
|
2013-06-20 17:26:18 +03:00
|
|
|
|
ofp_print_meter_stats_request(struct ds *s, const struct ofp_header *oh)
|
|
|
|
|
{
|
|
|
|
|
uint32_t meter_id;
|
|
|
|
|
|
|
|
|
|
ofputil_decode_meter_request(oh, &meter_id);
|
2017-04-05 16:16:12 -07:00
|
|
|
|
ds_put_char(s, ' ');
|
2013-06-20 17:26:18 +03:00
|
|
|
|
|
2018-06-15 17:06:56 -07:00
|
|
|
|
ofputil_format_meter_id(s, meter_id, '=');
|
2018-01-04 22:40:01 -08:00
|
|
|
|
|
|
|
|
|
return 0;
|
2013-06-20 17:26:18 +03:00
|
|
|
|
}
|
|
|
|
|
|
2018-01-04 22:40:01 -08:00
|
|
|
|
static enum ofperr
|
2013-06-20 17:26:18 +03:00
|
|
|
|
ofp_print_meter_features_reply(struct ds *s, const struct ofp_header *oh)
|
|
|
|
|
{
|
|
|
|
|
struct ofputil_meter_features mf;
|
|
|
|
|
ofputil_decode_meter_features(oh, &mf);
|
2018-06-15 17:06:56 -07:00
|
|
|
|
ofputil_format_meter_features(s, &mf);
|
2018-01-04 22:40:01 -08:00
|
|
|
|
return 0;
|
2013-06-20 17:26:18 +03:00
|
|
|
|
}
|
|
|
|
|
|
2018-01-04 22:40:01 -08:00
|
|
|
|
static enum ofperr
|
2013-06-20 17:26:18 +03:00
|
|
|
|
ofp_print_meter_config_reply(struct ds *s, const struct ofp_header *oh)
|
|
|
|
|
{
|
2016-02-18 15:13:09 -08:00
|
|
|
|
struct ofpbuf b = ofpbuf_const_initializer(oh, ntohs(oh->length));
|
2013-06-20 17:26:18 +03:00
|
|
|
|
struct ofpbuf bands;
|
2018-01-04 22:40:01 -08:00
|
|
|
|
int retval;
|
2013-06-20 17:26:18 +03:00
|
|
|
|
|
|
|
|
|
ofpbuf_init(&bands, 64);
|
|
|
|
|
for (;;) {
|
|
|
|
|
struct ofputil_meter_config mc;
|
|
|
|
|
|
|
|
|
|
retval = ofputil_decode_meter_config(&b, &mc, &bands);
|
|
|
|
|
if (retval) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
ds_put_char(s, '\n');
|
2018-06-15 17:06:56 -07:00
|
|
|
|
ofputil_format_meter_config(s, &mc);
|
2013-06-20 17:26:18 +03:00
|
|
|
|
}
|
|
|
|
|
ofpbuf_uninit(&bands);
|
2018-01-04 22:40:01 -08:00
|
|
|
|
|
|
|
|
|
return retval != EOF ? retval : 0;
|
2013-06-20 17:26:18 +03:00
|
|
|
|
}
|
|
|
|
|
|
2018-01-04 22:40:01 -08:00
|
|
|
|
static enum ofperr
|
2013-06-20 17:26:18 +03:00
|
|
|
|
ofp_print_meter_stats_reply(struct ds *s, const struct ofp_header *oh)
|
|
|
|
|
{
|
2016-02-18 15:13:09 -08:00
|
|
|
|
struct ofpbuf b = ofpbuf_const_initializer(oh, ntohs(oh->length));
|
2013-06-20 17:26:18 +03:00
|
|
|
|
struct ofpbuf bands;
|
2018-01-04 22:40:01 -08:00
|
|
|
|
int retval;
|
2013-06-20 17:26:18 +03:00
|
|
|
|
|
|
|
|
|
ofpbuf_init(&bands, 64);
|
|
|
|
|
for (;;) {
|
|
|
|
|
struct ofputil_meter_stats ms;
|
|
|
|
|
|
|
|
|
|
retval = ofputil_decode_meter_stats(&b, &ms, &bands);
|
|
|
|
|
if (retval) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
ds_put_char(s, '\n');
|
2018-06-15 17:06:56 -07:00
|
|
|
|
ofputil_format_meter_stats(s, &ms);
|
2013-06-20 17:26:18 +03:00
|
|
|
|
}
|
|
|
|
|
ofpbuf_uninit(&bands);
|
2018-01-04 22:40:01 -08:00
|
|
|
|
|
|
|
|
|
return retval != EOF ? retval : 0;
|
2013-06-20 17:26:18 +03:00
|
|
|
|
}
|
|
|
|
|
|
2010-12-07 13:22:46 -08:00
|
|
|
|
static void
|
2012-01-12 15:48:19 -08:00
|
|
|
|
ofp_print_error(struct ds *string, enum ofperr error)
|
2010-12-07 13:22:46 -08:00
|
|
|
|
{
|
2012-01-12 15:48:19 -08:00
|
|
|
|
ds_put_format(string, "***decode error: %s***\n", ofperr_get_name(error));
|
2010-12-07 21:57:09 -08:00
|
|
|
|
}
|
|
|
|
|
|
2018-01-04 22:40:01 -08:00
|
|
|
|
static enum ofperr
|
2012-11-04 22:04:55 -08:00
|
|
|
|
ofp_print_hello(struct ds *string, const struct ofp_header *oh)
|
|
|
|
|
{
|
2018-02-16 14:03:51 -08:00
|
|
|
|
ofputil_hello_format(string, oh);
|
2018-01-04 22:40:01 -08:00
|
|
|
|
return 0;
|
2012-11-04 22:04:55 -08:00
|
|
|
|
}
|
|
|
|
|
|
2018-01-04 22:40:01 -08:00
|
|
|
|
static enum ofperr
|
2017-05-31 16:06:12 -07:00
|
|
|
|
ofp_print_error_msg(struct ds *string, const struct ofp_header *oh,
|
Support accepting and displaying table names in OVS tools.
OpenFlow has little-known support for naming tables. Open vSwitch has
supported table names for ages, but it has never used or displayed them
outside of commands dedicated to table manipulation. This commit adds
support for table names in ovs-ofctl. When a table has a name, it displays
that name in flows and actions, so that, for example, the following:
table=1, arp, actions=resubmit(,2)
might become:
table=ingress_acl, arp, actions=resubmit(,mac_learning)
given appropriately named tables.
For backward compatibility, only interactive ovs-ofctl commands by default
display table names; to display them in scripts, use the new --names
option.
This feature was inspired by a talk that Kei Nohguchi presented at Open
vSwitch 2017 Fall Conference.
CC: Kei Nohguchi <kei@nohguchi.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Mark Michelson <mmichels@redhat.com>
Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
2018-01-05 16:59:13 -08:00
|
|
|
|
const struct ofputil_port_map *port_map,
|
|
|
|
|
const struct ofputil_table_map *table_map)
|
2009-07-08 13:19:16 -07:00
|
|
|
|
{
|
2012-07-19 23:23:17 -07:00
|
|
|
|
struct ofpbuf payload;
|
2018-02-16 14:03:51 -08:00
|
|
|
|
enum ofperr error = ofperr_decode_msg(oh, &payload);
|
2012-01-12 15:48:19 -08:00
|
|
|
|
if (!error) {
|
2018-01-04 22:40:01 -08:00
|
|
|
|
return OFPERR_OFPBRC_BAD_LEN;
|
2010-12-07 21:57:09 -08:00
|
|
|
|
}
|
2018-02-16 14:03:51 -08:00
|
|
|
|
ofperr_msg_format(string, error, &payload, port_map, table_map);
|
2014-04-04 19:26:22 -07:00
|
|
|
|
ofpbuf_uninit(&payload);
|
2018-01-04 22:40:01 -08:00
|
|
|
|
|
|
|
|
|
return 0;
|
2009-07-08 13:19:16 -07:00
|
|
|
|
}
|
|
|
|
|
|
2018-01-04 22:40:01 -08:00
|
|
|
|
static enum ofperr
|
2012-07-19 23:23:17 -07:00
|
|
|
|
ofp_print_port_status(struct ds *string, const struct ofp_header *oh)
|
2009-07-08 13:19:16 -07:00
|
|
|
|
{
|
2012-02-15 16:33:04 -08:00
|
|
|
|
struct ofputil_port_status ps;
|
2018-02-16 14:03:51 -08:00
|
|
|
|
enum ofperr error = ofputil_decode_port_status(oh, &ps);
|
|
|
|
|
if (!error) {
|
|
|
|
|
ofputil_port_status_format(string, &ps);
|
2009-07-08 13:19:16 -07:00
|
|
|
|
}
|
2018-02-16 14:03:51 -08:00
|
|
|
|
return error;
|
2009-07-08 13:19:16 -07:00
|
|
|
|
}
|
|
|
|
|
|
2018-01-04 22:40:01 -08:00
|
|
|
|
static enum ofperr
|
2012-07-19 23:23:17 -07:00
|
|
|
|
ofp_print_ofpst_desc_reply(struct ds *string, const struct ofp_header *oh)
|
2009-07-08 13:19:16 -07:00
|
|
|
|
{
|
2012-07-19 23:23:17 -07:00
|
|
|
|
const struct ofp_desc_stats *ods = ofpmsg_body(oh);
|
|
|
|
|
|
2010-12-13 16:19:19 -08:00
|
|
|
|
ds_put_char(string, '\n');
|
2010-08-30 00:24:53 -07:00
|
|
|
|
ds_put_format(string, "Manufacturer: %.*s\n",
|
2010-01-22 15:12:34 -08:00
|
|
|
|
(int) sizeof ods->mfr_desc, ods->mfr_desc);
|
|
|
|
|
ds_put_format(string, "Hardware: %.*s\n",
|
|
|
|
|
(int) sizeof ods->hw_desc, ods->hw_desc);
|
|
|
|
|
ds_put_format(string, "Software: %.*s\n",
|
|
|
|
|
(int) sizeof ods->sw_desc, ods->sw_desc);
|
|
|
|
|
ds_put_format(string, "Serial Num: %.*s\n",
|
|
|
|
|
(int) sizeof ods->serial_num, ods->serial_num);
|
|
|
|
|
ds_put_format(string, "DP Description: %.*s\n",
|
|
|
|
|
(int) sizeof ods->dp_desc, ods->dp_desc);
|
2018-01-04 22:40:01 -08:00
|
|
|
|
|
|
|
|
|
return 0;
|
2009-07-08 13:19:16 -07:00
|
|
|
|
}
|
|
|
|
|
|
2018-01-04 22:40:01 -08:00
|
|
|
|
static enum ofperr
|
2017-05-31 16:06:12 -07:00
|
|
|
|
ofp_print_flow_stats_request(struct ds *string, const struct ofp_header *oh,
|
Support accepting and displaying table names in OVS tools.
OpenFlow has little-known support for naming tables. Open vSwitch has
supported table names for ages, but it has never used or displayed them
outside of commands dedicated to table manipulation. This commit adds
support for table names in ovs-ofctl. When a table has a name, it displays
that name in flows and actions, so that, for example, the following:
table=1, arp, actions=resubmit(,2)
might become:
table=ingress_acl, arp, actions=resubmit(,mac_learning)
given appropriately named tables.
For backward compatibility, only interactive ovs-ofctl commands by default
display table names; to display them in scripts, use the new --names
option.
This feature was inspired by a talk that Kei Nohguchi presented at Open
vSwitch 2017 Fall Conference.
CC: Kei Nohguchi <kei@nohguchi.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Mark Michelson <mmichels@redhat.com>
Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
2018-01-05 16:59:13 -08:00
|
|
|
|
const struct ofputil_port_map *port_map,
|
|
|
|
|
const struct ofputil_table_map *table_map)
|
2009-07-08 13:19:16 -07:00
|
|
|
|
{
|
2011-08-08 14:48:48 -07:00
|
|
|
|
struct ofputil_flow_stats_request fsr;
|
2018-02-16 14:03:51 -08:00
|
|
|
|
enum ofperr error = ofputil_decode_flow_stats_request(&fsr, oh, NULL,
|
|
|
|
|
NULL);
|
|
|
|
|
if (!error) {
|
|
|
|
|
ofputil_flow_stats_request_format(string, &fsr, port_map, table_map);
|
2012-07-12 13:32:47 -07:00
|
|
|
|
}
|
2018-02-16 14:03:51 -08:00
|
|
|
|
return error;
|
2012-07-12 13:32:47 -07:00
|
|
|
|
}
|
|
|
|
|
|
2018-01-04 22:40:01 -08:00
|
|
|
|
static enum ofperr
|
2017-05-31 16:06:12 -07:00
|
|
|
|
ofp_print_flow_stats_reply(struct ds *string, const struct ofp_header *oh,
|
Support accepting and displaying table names in OVS tools.
OpenFlow has little-known support for naming tables. Open vSwitch has
supported table names for ages, but it has never used or displayed them
outside of commands dedicated to table manipulation. This commit adds
support for table names in ovs-ofctl. When a table has a name, it displays
that name in flows and actions, so that, for example, the following:
table=1, arp, actions=resubmit(,2)
might become:
table=ingress_acl, arp, actions=resubmit(,mac_learning)
given appropriately named tables.
For backward compatibility, only interactive ovs-ofctl commands by default
display table names; to display them in scripts, use the new --names
option.
This feature was inspired by a talk that Kei Nohguchi presented at Open
vSwitch 2017 Fall Conference.
CC: Kei Nohguchi <kei@nohguchi.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Mark Michelson <mmichels@redhat.com>
Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
2018-01-05 16:59:13 -08:00
|
|
|
|
const struct ofputil_port_map *port_map,
|
|
|
|
|
const struct ofputil_table_map *table_map)
|
2009-07-08 13:19:16 -07:00
|
|
|
|
{
|
2016-02-18 15:13:09 -08:00
|
|
|
|
struct ofpbuf b = ofpbuf_const_initializer(oh, ntohs(oh->length));
|
2012-07-03 22:17:14 -07:00
|
|
|
|
struct ofpbuf ofpacts;
|
2018-01-04 22:40:01 -08:00
|
|
|
|
int retval;
|
2009-07-08 13:19:16 -07:00
|
|
|
|
|
2012-07-03 22:17:14 -07:00
|
|
|
|
ofpbuf_init(&ofpacts, 64);
|
2011-03-10 15:02:05 -08:00
|
|
|
|
for (;;) {
|
|
|
|
|
struct ofputil_flow_stats fs;
|
2010-12-08 12:05:20 -08:00
|
|
|
|
|
2012-07-03 22:17:14 -07:00
|
|
|
|
retval = ofputil_decode_flow_stats_reply(&fs, &b, true, &ofpacts);
|
2011-03-10 15:02:05 -08:00
|
|
|
|
if (retval) {
|
2009-07-08 13:19:16 -07:00
|
|
|
|
break;
|
|
|
|
|
}
|
2017-06-13 17:09:05 -07:00
|
|
|
|
ds_put_cstr(string, "\n ");
|
2018-02-16 14:03:51 -08:00
|
|
|
|
ofputil_flow_stats_format(string, &fs, port_map, table_map, true);
|
2012-07-12 13:32:47 -07:00
|
|
|
|
}
|
2012-08-17 13:59:15 -07:00
|
|
|
|
ofpbuf_uninit(&ofpacts);
|
2018-01-04 22:40:01 -08:00
|
|
|
|
|
|
|
|
|
return retval != EOF ? retval : 0;
|
2010-12-07 14:21:38 -08:00
|
|
|
|
}
|
|
|
|
|
|
2018-01-04 22:40:01 -08:00
|
|
|
|
static enum ofperr
|
2012-07-19 23:23:17 -07:00
|
|
|
|
ofp_print_aggregate_stats_reply(struct ds *string, const struct ofp_header *oh)
|
2009-07-08 13:19:16 -07:00
|
|
|
|
{
|
2012-07-19 23:23:17 -07:00
|
|
|
|
struct ofputil_aggregate_stats as;
|
|
|
|
|
enum ofperr error;
|
2009-07-08 13:19:16 -07:00
|
|
|
|
|
2012-07-19 23:23:17 -07:00
|
|
|
|
error = ofputil_decode_aggregate_stats_reply(&as, oh);
|
2018-02-16 14:03:51 -08:00
|
|
|
|
if (!error) {
|
|
|
|
|
ofputil_aggregate_stats_format(string, &as);
|
2012-07-19 23:23:17 -07:00
|
|
|
|
}
|
2018-02-16 14:03:51 -08:00
|
|
|
|
return error;
|
2010-12-07 15:07:54 -08:00
|
|
|
|
}
|
|
|
|
|
|
2018-01-04 22:40:01 -08:00
|
|
|
|
static enum ofperr
|
2017-05-31 16:06:12 -07:00
|
|
|
|
ofp_print_ofpst_port_request(struct ds *string, const struct ofp_header *oh,
|
|
|
|
|
const struct ofputil_port_map *port_map)
|
2010-01-19 22:35:18 -08:00
|
|
|
|
{
|
2013-06-19 16:58:44 -07:00
|
|
|
|
ofp_port_t ofp10_port;
|
2012-10-06 19:39:49 +09:00
|
|
|
|
enum ofperr error;
|
|
|
|
|
|
|
|
|
|
error = ofputil_decode_port_stats_request(oh, &ofp10_port);
|
|
|
|
|
if (error) {
|
2018-01-04 22:40:01 -08:00
|
|
|
|
return error;
|
2012-10-06 19:39:49 +09:00
|
|
|
|
}
|
|
|
|
|
|
2013-01-14 14:43:53 +02:00
|
|
|
|
ds_put_cstr(string, " port_no=");
|
2017-05-31 16:06:12 -07:00
|
|
|
|
ofputil_format_port(ofp10_port, port_map, string);
|
2018-01-04 22:40:01 -08:00
|
|
|
|
|
|
|
|
|
return 0;
|
2010-01-19 22:35:18 -08:00
|
|
|
|
}
|
|
|
|
|
|
2018-01-04 22:40:01 -08:00
|
|
|
|
static enum ofperr
|
2010-12-06 10:20:20 -08:00
|
|
|
|
ofp_print_ofpst_port_reply(struct ds *string, const struct ofp_header *oh,
|
2017-05-31 16:06:12 -07:00
|
|
|
|
const struct ofputil_port_map *port_map,
|
2010-12-06 10:20:20 -08:00
|
|
|
|
int verbosity)
|
2009-07-08 13:19:16 -07:00
|
|
|
|
{
|
2018-06-15 17:06:56 -07:00
|
|
|
|
ds_put_format(string, " %"PRIuSIZE" ports\n",
|
|
|
|
|
ofputil_count_port_stats(oh));
|
2009-07-08 13:19:16 -07:00
|
|
|
|
if (verbosity < 1) {
|
2018-01-04 22:40:01 -08:00
|
|
|
|
return 0;
|
2009-07-08 13:19:16 -07:00
|
|
|
|
}
|
|
|
|
|
|
2016-02-18 15:13:09 -08:00
|
|
|
|
struct ofpbuf b = ofpbuf_const_initializer(oh, ntohs(oh->length));
|
2012-07-19 23:23:17 -07:00
|
|
|
|
for (;;) {
|
2012-10-06 19:39:49 +09:00
|
|
|
|
struct ofputil_port_stats ps;
|
|
|
|
|
int retval;
|
|
|
|
|
|
|
|
|
|
retval = ofputil_decode_port_stats(&ps, &b);
|
|
|
|
|
if (retval) {
|
2018-01-04 22:40:01 -08:00
|
|
|
|
return retval != EOF ? retval : 0;
|
2012-07-19 23:23:17 -07:00
|
|
|
|
}
|
2018-06-15 17:06:56 -07:00
|
|
|
|
ofputil_format_port_stats(string, &ps, port_map);
|
2018-08-30 13:58:49 -07:00
|
|
|
|
netdev_free_custom_stats_counters(&ps.custom_stats);
|
2009-07-08 13:19:16 -07:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-01-04 22:40:01 -08:00
|
|
|
|
static enum ofperr
|
2018-08-30 11:03:12 -07:00
|
|
|
|
ofp_print_table_stats_reply(struct ds *string, const struct ofp_header *oh)
|
2012-08-09 17:49:34 +09:00
|
|
|
|
{
|
2016-02-18 15:13:09 -08:00
|
|
|
|
struct ofpbuf b = ofpbuf_const_initializer(oh, ntohs(oh->length));
|
2012-08-09 17:49:34 +09:00
|
|
|
|
ofpraw_pull_assert(&b);
|
|
|
|
|
|
2015-07-06 22:15:40 -07:00
|
|
|
|
struct ofputil_table_features prev_features;
|
|
|
|
|
struct ofputil_table_stats prev_stats;
|
2018-08-27 14:43:39 -07:00
|
|
|
|
int first_ditto = -1, last_ditto = -1;
|
2015-07-06 22:15:40 -07:00
|
|
|
|
for (int i = 0;; i++) {
|
2014-08-11 11:31:45 -07:00
|
|
|
|
struct ofputil_table_features features;
|
|
|
|
|
struct ofputil_table_stats stats;
|
|
|
|
|
int retval;
|
2012-07-19 23:23:17 -07:00
|
|
|
|
|
2014-08-11 11:31:45 -07:00
|
|
|
|
retval = ofputil_decode_table_stats_reply(&b, &stats, &features);
|
|
|
|
|
if (retval) {
|
2018-08-27 14:43:39 -07:00
|
|
|
|
ofputil_table_features_format_finish(string,
|
|
|
|
|
first_ditto, last_ditto);
|
2018-01-04 22:40:01 -08:00
|
|
|
|
return retval != EOF ? retval : 0;
|
2012-07-19 23:23:17 -07:00
|
|
|
|
}
|
|
|
|
|
|
2018-02-16 14:03:51 -08:00
|
|
|
|
ofputil_table_features_format(string,
|
|
|
|
|
&features, i ? &prev_features : NULL,
|
|
|
|
|
&stats, i ? &prev_stats : NULL,
|
2018-08-30 11:03:12 -07:00
|
|
|
|
&first_ditto, &last_ditto);
|
2015-07-06 22:15:40 -07:00
|
|
|
|
prev_features = features;
|
|
|
|
|
prev_stats = stats;
|
2012-08-09 17:49:34 +09:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-01-04 22:40:01 -08:00
|
|
|
|
static enum ofperr
|
2014-05-07 23:18:46 -07:00
|
|
|
|
ofp_print_ofpst_port_desc_request(struct ds *string,
|
2017-05-31 16:06:12 -07:00
|
|
|
|
const struct ofp_header *oh,
|
|
|
|
|
const struct ofputil_port_map *port_map)
|
2014-05-07 23:18:46 -07:00
|
|
|
|
{
|
|
|
|
|
enum ofperr error;
|
|
|
|
|
ofp_port_t port;
|
|
|
|
|
|
|
|
|
|
error = ofputil_decode_port_desc_stats_request(oh, &port);
|
|
|
|
|
if (error) {
|
2018-01-04 22:40:01 -08:00
|
|
|
|
return error;
|
2014-05-07 23:18:46 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ds_put_cstr(string, " port=");
|
2017-05-31 16:06:12 -07:00
|
|
|
|
ofputil_format_port(port, port_map, string);
|
2018-01-04 22:40:01 -08:00
|
|
|
|
|
|
|
|
|
return 0;
|
2014-05-07 23:18:46 -07:00
|
|
|
|
}
|
|
|
|
|
|
2018-01-04 22:40:01 -08:00
|
|
|
|
static enum ofperr
|
2012-05-04 14:42:04 -07:00
|
|
|
|
ofp_print_ofpst_port_desc_reply(struct ds *string,
|
|
|
|
|
const struct ofp_header *oh)
|
|
|
|
|
{
|
2016-02-18 15:13:09 -08:00
|
|
|
|
struct ofpbuf b = ofpbuf_const_initializer(oh, ntohs(oh->length));
|
2012-07-19 23:23:17 -07:00
|
|
|
|
ofpraw_pull_assert(&b);
|
2012-05-04 14:42:04 -07:00
|
|
|
|
ds_put_char(string, '\n');
|
2018-02-16 14:03:51 -08:00
|
|
|
|
return ofputil_phy_ports_format(string, oh->version, &b);
|
2012-05-04 14:42:04 -07:00
|
|
|
|
}
|
|
|
|
|
|
2009-07-08 13:19:16 -07:00
|
|
|
|
static void
|
2014-05-27 18:05:37 +09:00
|
|
|
|
ofp_print_stats(struct ds *string, const struct ofp_header *oh)
|
2009-07-08 13:19:16 -07:00
|
|
|
|
{
|
2012-07-19 23:23:17 -07:00
|
|
|
|
uint16_t flags = ofpmp_flags(oh);
|
2010-12-06 10:20:20 -08:00
|
|
|
|
|
2012-07-19 23:23:17 -07:00
|
|
|
|
if (flags) {
|
2010-12-06 10:20:20 -08:00
|
|
|
|
ds_put_cstr(string, " flags=");
|
2014-05-27 18:05:37 +09:00
|
|
|
|
if ((!ofpmsg_is_stat_request(oh) || oh->version >= OFP13_VERSION)
|
|
|
|
|
&& (flags & OFPSF_REPLY_MORE)) {
|
2009-07-08 13:19:16 -07:00
|
|
|
|
ds_put_cstr(string, "[more]");
|
|
|
|
|
flags &= ~OFPSF_REPLY_MORE;
|
|
|
|
|
}
|
|
|
|
|
if (flags) {
|
2010-12-06 10:20:20 -08:00
|
|
|
|
ds_put_format(string, "[***unknown flags 0x%04"PRIx16"***]",
|
|
|
|
|
flags);
|
2009-07-08 13:19:16 -07:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-01-04 22:40:01 -08:00
|
|
|
|
static enum ofperr
|
2010-12-06 10:20:20 -08:00
|
|
|
|
ofp_print_echo(struct ds *string, const struct ofp_header *oh, int verbosity)
|
2009-07-08 13:19:16 -07:00
|
|
|
|
{
|
2010-12-06 10:20:20 -08:00
|
|
|
|
size_t len = ntohs(oh->length);
|
2009-07-08 13:19:16 -07:00
|
|
|
|
|
2013-11-25 23:38:48 -08:00
|
|
|
|
ds_put_format(string, " %"PRIuSIZE" bytes of payload\n", len - sizeof *oh);
|
2009-07-08 13:19:16 -07:00
|
|
|
|
if (verbosity > 1) {
|
2010-12-06 10:20:20 -08:00
|
|
|
|
ds_put_hex_dump(string, oh + 1, len - sizeof *oh, 0, true);
|
2009-07-08 13:19:16 -07:00
|
|
|
|
}
|
2018-01-04 22:40:01 -08:00
|
|
|
|
|
|
|
|
|
return 0;
|
2009-07-08 13:19:16 -07:00
|
|
|
|
}
|
|
|
|
|
|
2018-01-04 22:40:01 -08:00
|
|
|
|
static enum ofperr
|
2013-10-22 11:40:03 +03:00
|
|
|
|
ofp_print_role_message(struct ds *string, const struct ofp_header *oh)
|
|
|
|
|
{
|
|
|
|
|
struct ofputil_role_request rr;
|
2018-06-15 17:06:56 -07:00
|
|
|
|
enum ofperr error = ofputil_decode_role_message(oh, &rr);
|
|
|
|
|
if (!error) {
|
|
|
|
|
ofputil_format_role_message(string, &rr);
|
2013-10-22 11:40:03 +03:00
|
|
|
|
}
|
2018-06-15 17:06:56 -07:00
|
|
|
|
return error;
|
2013-10-22 11:40:03 +03:00
|
|
|
|
}
|
|
|
|
|
|
2018-01-04 22:40:01 -08:00
|
|
|
|
static enum ofperr
|
2013-10-22 11:40:03 +03:00
|
|
|
|
ofp_print_role_status_message(struct ds *string, const struct ofp_header *oh)
|
|
|
|
|
{
|
|
|
|
|
struct ofputil_role_status rs;
|
2018-06-15 17:06:56 -07:00
|
|
|
|
enum ofperr error = ofputil_decode_role_status(oh, &rs);
|
|
|
|
|
if (!error) {
|
|
|
|
|
ofputil_format_role_status(string, &rs);
|
2010-12-07 14:36:18 -08:00
|
|
|
|
}
|
2018-06-15 17:06:56 -07:00
|
|
|
|
return error;
|
2010-12-07 14:36:18 -08:00
|
|
|
|
}
|
|
|
|
|
|
2018-01-04 22:40:01 -08:00
|
|
|
|
static enum ofperr
|
2018-02-15 14:38:28 -08:00
|
|
|
|
ofp_print_nxt_flow_mod_table_id(struct ds *string, const struct ofp_header *oh)
|
2011-05-12 09:58:01 -07:00
|
|
|
|
{
|
2018-02-15 14:38:28 -08:00
|
|
|
|
bool enable = ofputil_decode_nx_flow_mod_table_id(oh);
|
|
|
|
|
ds_put_format(string, " %s", enable ? "enable" : "disable");
|
2018-01-04 22:40:01 -08:00
|
|
|
|
return 0;
|
2011-05-12 09:58:01 -07:00
|
|
|
|
}
|
|
|
|
|
|
2018-01-04 22:40:01 -08:00
|
|
|
|
static enum ofperr
|
2018-02-15 14:38:28 -08:00
|
|
|
|
ofp_print_nxt_set_flow_format(struct ds *string, const struct ofp_header *oh)
|
2010-12-07 13:22:46 -08:00
|
|
|
|
{
|
2018-02-15 14:38:28 -08:00
|
|
|
|
enum ofputil_protocol p = ofputil_decode_nx_set_flow_format(oh);
|
|
|
|
|
ds_put_format(string, " format=%s",
|
|
|
|
|
p == OFPUTIL_P_OF10_STD ? "openflow10"
|
|
|
|
|
: p == OFPUTIL_P_OF10_NXM ? "nxm"
|
|
|
|
|
: "(unknown)");
|
2018-01-04 22:40:01 -08:00
|
|
|
|
return 0;
|
2010-12-07 13:22:46 -08:00
|
|
|
|
}
|
|
|
|
|
|
2018-01-04 22:40:01 -08:00
|
|
|
|
static enum ofperr
|
2011-12-09 15:48:26 -08:00
|
|
|
|
ofp_print_nxt_set_packet_in_format(struct ds *string,
|
2018-02-16 11:43:56 -08:00
|
|
|
|
const struct ofp_header *oh)
|
2011-12-09 15:48:26 -08:00
|
|
|
|
{
|
2018-02-16 11:43:56 -08:00
|
|
|
|
enum ofputil_packet_in_format format;
|
|
|
|
|
enum ofperr error = ofputil_decode_set_packet_in_format(oh, &format);
|
|
|
|
|
if (!error) {
|
|
|
|
|
ds_put_format(string, " format=%s",
|
|
|
|
|
ofputil_packet_in_format_to_string(format));
|
2011-12-09 15:48:26 -08:00
|
|
|
|
}
|
2018-02-16 11:43:56 -08:00
|
|
|
|
return error;
|
2011-12-09 15:48:26 -08:00
|
|
|
|
}
|
|
|
|
|
|
2018-01-04 22:40:01 -08:00
|
|
|
|
static enum ofperr
|
2016-01-14 22:16:34 -08:00
|
|
|
|
ofp_print_set_async_config(struct ds *string, const struct ofp_header *oh,
|
2017-08-02 15:03:06 -07:00
|
|
|
|
enum ofptype ofptype)
|
2012-02-09 14:06:35 -08:00
|
|
|
|
{
|
2016-01-14 22:16:34 -08:00
|
|
|
|
struct ofputil_async_cfg basis = OFPUTIL_ASYNC_CFG_INIT;
|
|
|
|
|
struct ofputil_async_cfg ac;
|
2012-02-09 14:06:35 -08:00
|
|
|
|
|
2017-08-02 15:03:06 -07:00
|
|
|
|
bool is_reply = ofptype == OFPTYPE_GET_ASYNC_REPLY;
|
2016-01-14 22:16:34 -08:00
|
|
|
|
enum ofperr error = ofputil_decode_set_async_config(oh, is_reply,
|
|
|
|
|
&basis, &ac);
|
|
|
|
|
if (error) {
|
2018-01-04 22:40:01 -08:00
|
|
|
|
return error;
|
2016-01-14 22:16:34 -08:00
|
|
|
|
}
|
2018-06-15 17:06:56 -07:00
|
|
|
|
ofputil_format_set_async_config(string, &ac);
|
2018-01-04 22:40:01 -08:00
|
|
|
|
return 0;
|
2012-02-09 14:06:35 -08:00
|
|
|
|
}
|
|
|
|
|
|
2018-01-04 22:40:01 -08:00
|
|
|
|
static enum ofperr
|
2012-02-09 14:17:33 -08:00
|
|
|
|
ofp_print_nxt_set_controller_id(struct ds *string,
|
|
|
|
|
const struct nx_controller_id *nci)
|
|
|
|
|
{
|
|
|
|
|
ds_put_format(string, " id=%"PRIu16, ntohs(nci->controller_id));
|
2018-01-04 22:40:01 -08:00
|
|
|
|
return 0;
|
2012-02-09 14:17:33 -08:00
|
|
|
|
}
|
|
|
|
|
|
2018-01-04 22:40:01 -08:00
|
|
|
|
static enum ofperr
|
2012-07-12 14:18:05 -07:00
|
|
|
|
ofp_print_nxt_flow_monitor_cancel(struct ds *string,
|
|
|
|
|
const struct ofp_header *oh)
|
|
|
|
|
{
|
|
|
|
|
ds_put_format(string, " id=%"PRIu32,
|
|
|
|
|
ofputil_decode_flow_monitor_cancel(oh));
|
2018-01-04 22:40:01 -08:00
|
|
|
|
return 0;
|
2012-07-12 14:18:05 -07:00
|
|
|
|
}
|
|
|
|
|
|
2018-01-04 22:40:01 -08:00
|
|
|
|
static enum ofperr
|
2012-07-12 14:18:05 -07:00
|
|
|
|
ofp_print_nxst_flow_monitor_request(struct ds *string,
|
2017-05-31 16:06:12 -07:00
|
|
|
|
const struct ofp_header *oh,
|
Support accepting and displaying table names in OVS tools.
OpenFlow has little-known support for naming tables. Open vSwitch has
supported table names for ages, but it has never used or displayed them
outside of commands dedicated to table manipulation. This commit adds
support for table names in ovs-ofctl. When a table has a name, it displays
that name in flows and actions, so that, for example, the following:
table=1, arp, actions=resubmit(,2)
might become:
table=ingress_acl, arp, actions=resubmit(,mac_learning)
given appropriately named tables.
For backward compatibility, only interactive ovs-ofctl commands by default
display table names; to display them in scripts, use the new --names
option.
This feature was inspired by a talk that Kei Nohguchi presented at Open
vSwitch 2017 Fall Conference.
CC: Kei Nohguchi <kei@nohguchi.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Mark Michelson <mmichels@redhat.com>
Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
2018-01-05 16:59:13 -08:00
|
|
|
|
const struct ofputil_port_map *port_map,
|
|
|
|
|
const struct ofputil_table_map *table_map)
|
2012-07-12 14:18:05 -07:00
|
|
|
|
{
|
2016-02-18 15:13:09 -08:00
|
|
|
|
struct ofpbuf b = ofpbuf_const_initializer(oh, ntohs(oh->length));
|
2012-07-12 14:18:05 -07:00
|
|
|
|
for (;;) {
|
|
|
|
|
struct ofputil_flow_monitor_request request;
|
|
|
|
|
int retval;
|
|
|
|
|
|
|
|
|
|
retval = ofputil_decode_flow_monitor_request(&request, &b);
|
|
|
|
|
if (retval) {
|
2018-01-04 22:40:01 -08:00
|
|
|
|
return retval != EOF ? retval : 0;
|
2012-07-12 14:18:05 -07:00
|
|
|
|
}
|
|
|
|
|
|
2018-02-16 14:03:51 -08:00
|
|
|
|
ofputil_flow_monitor_request_format(string, &request,
|
|
|
|
|
port_map, table_map);
|
2012-07-12 14:18:05 -07:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-01-04 22:40:01 -08:00
|
|
|
|
static enum ofperr
|
2012-07-12 14:18:05 -07:00
|
|
|
|
ofp_print_nxst_flow_monitor_reply(struct ds *string,
|
2017-05-31 16:06:12 -07:00
|
|
|
|
const struct ofp_header *oh,
|
Support accepting and displaying table names in OVS tools.
OpenFlow has little-known support for naming tables. Open vSwitch has
supported table names for ages, but it has never used or displayed them
outside of commands dedicated to table manipulation. This commit adds
support for table names in ovs-ofctl. When a table has a name, it displays
that name in flows and actions, so that, for example, the following:
table=1, arp, actions=resubmit(,2)
might become:
table=ingress_acl, arp, actions=resubmit(,mac_learning)
given appropriately named tables.
For backward compatibility, only interactive ovs-ofctl commands by default
display table names; to display them in scripts, use the new --names
option.
This feature was inspired by a talk that Kei Nohguchi presented at Open
vSwitch 2017 Fall Conference.
CC: Kei Nohguchi <kei@nohguchi.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Mark Michelson <mmichels@redhat.com>
Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
2018-01-05 16:59:13 -08:00
|
|
|
|
const struct ofputil_port_map *port_map,
|
|
|
|
|
const struct ofputil_table_map *table_map)
|
2012-07-12 14:18:05 -07:00
|
|
|
|
{
|
|
|
|
|
uint64_t ofpacts_stub[1024 / 8];
|
2016-02-18 15:13:09 -08:00
|
|
|
|
struct ofpbuf ofpacts = OFPBUF_STUB_INITIALIZER(ofpacts_stub);
|
|
|
|
|
struct ofpbuf b = ofpbuf_const_initializer(oh, ntohs(oh->length));
|
2012-07-12 14:18:05 -07:00
|
|
|
|
|
|
|
|
|
for (;;) {
|
|
|
|
|
struct ofputil_flow_update update;
|
2018-02-16 14:03:51 -08:00
|
|
|
|
int retval = ofputil_decode_flow_update(&update, &b, &ofpacts);
|
2012-07-12 14:18:05 -07:00
|
|
|
|
if (retval) {
|
|
|
|
|
ofpbuf_uninit(&ofpacts);
|
2018-01-04 22:40:01 -08:00
|
|
|
|
return retval != EOF ? retval : 0;
|
2012-07-12 14:18:05 -07:00
|
|
|
|
}
|
2018-02-16 14:03:51 -08:00
|
|
|
|
ofputil_flow_update_format(string, &update, port_map, table_map);
|
2012-07-12 14:18:05 -07:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2012-07-12 13:32:47 -07:00
|
|
|
|
void
|
|
|
|
|
ofp_print_version(const struct ofp_header *oh,
|
|
|
|
|
struct ds *string)
|
2010-12-06 10:20:20 -08:00
|
|
|
|
{
|
2012-02-15 15:28:25 -08:00
|
|
|
|
switch (oh->version) {
|
|
|
|
|
case OFP10_VERSION:
|
|
|
|
|
break;
|
|
|
|
|
case OFP11_VERSION:
|
|
|
|
|
ds_put_cstr(string, " (OF1.1)");
|
2012-06-27 17:19:52 +09:00
|
|
|
|
break;
|
|
|
|
|
case OFP12_VERSION:
|
|
|
|
|
ds_put_cstr(string, " (OF1.2)");
|
2012-02-15 15:28:25 -08:00
|
|
|
|
break;
|
2012-11-27 17:44:22 +02:00
|
|
|
|
case OFP13_VERSION:
|
|
|
|
|
ds_put_cstr(string, " (OF1.3)");
|
|
|
|
|
break;
|
2014-05-01 13:22:20 +03:00
|
|
|
|
case OFP14_VERSION:
|
|
|
|
|
ds_put_cstr(string, " (OF1.4)");
|
|
|
|
|
break;
|
2014-05-07 13:42:24 -07:00
|
|
|
|
case OFP15_VERSION:
|
|
|
|
|
ds_put_cstr(string, " (OF1.5)");
|
|
|
|
|
break;
|
2012-02-15 15:28:25 -08:00
|
|
|
|
default:
|
|
|
|
|
ds_put_format(string, " (OF 0x%02"PRIx8")", oh->version);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
ds_put_format(string, " (xid=0x%"PRIx32"):", ntohl(oh->xid));
|
2012-07-12 13:32:47 -07:00
|
|
|
|
}
|
2010-12-06 10:20:20 -08:00
|
|
|
|
|
2012-05-23 09:33:22 -07:00
|
|
|
|
static void
|
2012-07-19 23:23:17 -07:00
|
|
|
|
ofp_header_to_string__(const struct ofp_header *oh, enum ofpraw raw,
|
|
|
|
|
struct ds *string)
|
2012-05-23 09:33:22 -07:00
|
|
|
|
{
|
2012-07-19 23:23:17 -07:00
|
|
|
|
ds_put_cstr(string, ofpraw_get_name(raw));
|
2012-05-23 09:33:22 -07:00
|
|
|
|
ofp_print_version(oh, string);
|
|
|
|
|
}
|
|
|
|
|
|
2018-01-04 22:40:01 -08:00
|
|
|
|
static enum ofperr
|
Support accepting and displaying table names in OVS tools.
OpenFlow has little-known support for naming tables. Open vSwitch has
supported table names for ages, but it has never used or displayed them
outside of commands dedicated to table manipulation. This commit adds
support for table names in ovs-ofctl. When a table has a name, it displays
that name in flows and actions, so that, for example, the following:
table=1, arp, actions=resubmit(,2)
might become:
table=ingress_acl, arp, actions=resubmit(,mac_learning)
given appropriately named tables.
For backward compatibility, only interactive ovs-ofctl commands by default
display table names; to display them in scripts, use the new --names
option.
This feature was inspired by a talk that Kei Nohguchi presented at Open
vSwitch 2017 Fall Conference.
CC: Kei Nohguchi <kei@nohguchi.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Mark Michelson <mmichels@redhat.com>
Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
2018-01-05 16:59:13 -08:00
|
|
|
|
ofp_print_table_desc_reply(struct ds *s, const struct ofp_header *oh,
|
|
|
|
|
const struct ofputil_table_map *table_map)
|
2015-07-02 20:35:44 -07:00
|
|
|
|
{
|
2016-02-18 15:13:09 -08:00
|
|
|
|
struct ofpbuf b = ofpbuf_const_initializer(oh, ntohs(oh->length));
|
2015-07-02 20:35:44 -07:00
|
|
|
|
for (;;) {
|
|
|
|
|
struct ofputil_table_desc td;
|
|
|
|
|
int retval;
|
|
|
|
|
|
|
|
|
|
retval = ofputil_decode_table_desc(&b, &td, oh->version);
|
|
|
|
|
if (retval) {
|
2018-01-04 22:40:01 -08:00
|
|
|
|
return retval != EOF ? retval : 0;
|
2015-07-02 20:35:44 -07:00
|
|
|
|
}
|
2018-02-16 14:03:51 -08:00
|
|
|
|
ofputil_table_desc_format(s, &td, table_map);
|
2015-07-02 20:35:44 -07:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-01-04 22:40:01 -08:00
|
|
|
|
static enum ofperr
|
2014-05-02 09:54:27 +03:00
|
|
|
|
ofp_print_bundle_ctrl(struct ds *s, const struct ofp_header *oh)
|
|
|
|
|
{
|
|
|
|
|
int error;
|
|
|
|
|
struct ofputil_bundle_ctrl_msg bctrl;
|
|
|
|
|
|
|
|
|
|
error = ofputil_decode_bundle_ctrl(oh, &bctrl);
|
|
|
|
|
if (error) {
|
2018-01-04 22:40:01 -08:00
|
|
|
|
return error;
|
2014-05-02 09:54:27 +03:00
|
|
|
|
}
|
2018-06-15 17:06:56 -07:00
|
|
|
|
ofputil_format_bundle_ctrl_request(s, &bctrl);
|
2018-01-04 22:40:01 -08:00
|
|
|
|
return 0;
|
2014-05-02 09:54:27 +03:00
|
|
|
|
}
|
|
|
|
|
|
2018-01-04 22:40:01 -08:00
|
|
|
|
static enum ofperr
|
2017-05-31 16:06:12 -07:00
|
|
|
|
ofp_print_bundle_add(struct ds *s, const struct ofp_header *oh,
|
Support accepting and displaying table names in OVS tools.
OpenFlow has little-known support for naming tables. Open vSwitch has
supported table names for ages, but it has never used or displayed them
outside of commands dedicated to table manipulation. This commit adds
support for table names in ovs-ofctl. When a table has a name, it displays
that name in flows and actions, so that, for example, the following:
table=1, arp, actions=resubmit(,2)
might become:
table=ingress_acl, arp, actions=resubmit(,mac_learning)
given appropriately named tables.
For backward compatibility, only interactive ovs-ofctl commands by default
display table names; to display them in scripts, use the new --names
option.
This feature was inspired by a talk that Kei Nohguchi presented at Open
vSwitch 2017 Fall Conference.
CC: Kei Nohguchi <kei@nohguchi.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Mark Michelson <mmichels@redhat.com>
Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
2018-01-05 16:59:13 -08:00
|
|
|
|
const struct ofputil_port_map *port_map,
|
|
|
|
|
const struct ofputil_table_map *table_map,
|
|
|
|
|
int verbosity)
|
2014-05-02 09:54:27 +03:00
|
|
|
|
{
|
|
|
|
|
struct ofputil_bundle_add_msg badd;
|
2018-06-15 17:06:56 -07:00
|
|
|
|
int error = ofputil_decode_bundle_add(oh, &badd, NULL);
|
|
|
|
|
if (!error) {
|
|
|
|
|
ofputil_format_bundle_add(s, &badd, port_map, table_map, verbosity);
|
openflow: Table maintenance commands for Geneve options.
In order to work with Geneve options, we need to maintain a mapping
table between an option (defined by <class, type, length>) and
an NXM field that can be operated on for the purposes of matches,
actions, etc. This mapping must be explicitly specified by the
user.
Conceptually, this table could be communicated using either OpenFlow
or OVSDB. Using OVSDB requires less code and definition of extensions
than OpenFlow but introduces the possibility that mapping table
updates and flow modifications are desynchronized from each other.
This is dangerous because the mapping table signifcantly impacts the
way that flows using Geneve options are installed and processed by
OVS. Therefore, the mapping table is maintained using OpenFlow commands
instead, which opens the possibility of using synchronization between
table changes and flow modifications through barriers, bundles, etc.
There are two primary groups of OpenFlow messages that are introduced
as Nicira extensions: modification commands (add, delete, clear mappings)
and table status request/reply to dump the current table along with switch
information.
Note that mappings should not be changed while they are in active use by
a flow. The result of doing so is undefined.
This only adds the OpenFlow infrastructure but doesn't actually
do anything with the information yet after the messages have been
decoded.
Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2015-06-02 15:11:00 -07:00
|
|
|
|
}
|
2018-06-15 17:06:56 -07:00
|
|
|
|
return error;
|
openflow: Table maintenance commands for Geneve options.
In order to work with Geneve options, we need to maintain a mapping
table between an option (defined by <class, type, length>) and
an NXM field that can be operated on for the purposes of matches,
actions, etc. This mapping must be explicitly specified by the
user.
Conceptually, this table could be communicated using either OpenFlow
or OVSDB. Using OVSDB requires less code and definition of extensions
than OpenFlow but introduces the possibility that mapping table
updates and flow modifications are desynchronized from each other.
This is dangerous because the mapping table signifcantly impacts the
way that flows using Geneve options are installed and processed by
OVS. Therefore, the mapping table is maintained using OpenFlow commands
instead, which opens the possibility of using synchronization between
table changes and flow modifications through barriers, bundles, etc.
There are two primary groups of OpenFlow messages that are introduced
as Nicira extensions: modification commands (add, delete, clear mappings)
and table status request/reply to dump the current table along with switch
information.
Note that mappings should not be changed while they are in active use by
a flow. The result of doing so is undefined.
This only adds the OpenFlow infrastructure but doesn't actually
do anything with the information yet after the messages have been
decoded.
Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2015-06-02 15:11:00 -07:00
|
|
|
|
}
|
|
|
|
|
|
2018-01-04 22:40:01 -08:00
|
|
|
|
static enum ofperr
|
2015-12-16 02:47:50 +08:00
|
|
|
|
ofp_print_tlv_table_mod(struct ds *s, const struct ofp_header *oh)
|
openflow: Table maintenance commands for Geneve options.
In order to work with Geneve options, we need to maintain a mapping
table between an option (defined by <class, type, length>) and
an NXM field that can be operated on for the purposes of matches,
actions, etc. This mapping must be explicitly specified by the
user.
Conceptually, this table could be communicated using either OpenFlow
or OVSDB. Using OVSDB requires less code and definition of extensions
than OpenFlow but introduces the possibility that mapping table
updates and flow modifications are desynchronized from each other.
This is dangerous because the mapping table signifcantly impacts the
way that flows using Geneve options are installed and processed by
OVS. Therefore, the mapping table is maintained using OpenFlow commands
instead, which opens the possibility of using synchronization between
table changes and flow modifications through barriers, bundles, etc.
There are two primary groups of OpenFlow messages that are introduced
as Nicira extensions: modification commands (add, delete, clear mappings)
and table status request/reply to dump the current table along with switch
information.
Note that mappings should not be changed while they are in active use by
a flow. The result of doing so is undefined.
This only adds the OpenFlow infrastructure but doesn't actually
do anything with the information yet after the messages have been
decoded.
Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2015-06-02 15:11:00 -07:00
|
|
|
|
{
|
2015-12-16 02:47:50 +08:00
|
|
|
|
struct ofputil_tlv_table_mod ttm;
|
2018-06-15 17:06:56 -07:00
|
|
|
|
int error = ofputil_decode_tlv_table_mod(oh, &ttm);
|
|
|
|
|
if (!error) {
|
|
|
|
|
ofputil_format_tlv_table_mod(s, &ttm);
|
|
|
|
|
ofputil_uninit_tlv_table(&ttm.mappings);
|
openflow: Table maintenance commands for Geneve options.
In order to work with Geneve options, we need to maintain a mapping
table between an option (defined by <class, type, length>) and
an NXM field that can be operated on for the purposes of matches,
actions, etc. This mapping must be explicitly specified by the
user.
Conceptually, this table could be communicated using either OpenFlow
or OVSDB. Using OVSDB requires less code and definition of extensions
than OpenFlow but introduces the possibility that mapping table
updates and flow modifications are desynchronized from each other.
This is dangerous because the mapping table signifcantly impacts the
way that flows using Geneve options are installed and processed by
OVS. Therefore, the mapping table is maintained using OpenFlow commands
instead, which opens the possibility of using synchronization between
table changes and flow modifications through barriers, bundles, etc.
There are two primary groups of OpenFlow messages that are introduced
as Nicira extensions: modification commands (add, delete, clear mappings)
and table status request/reply to dump the current table along with switch
information.
Note that mappings should not be changed while they are in active use by
a flow. The result of doing so is undefined.
This only adds the OpenFlow infrastructure but doesn't actually
do anything with the information yet after the messages have been
decoded.
Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2015-06-02 15:11:00 -07:00
|
|
|
|
}
|
2018-06-15 17:06:56 -07:00
|
|
|
|
return error;
|
openflow: Table maintenance commands for Geneve options.
In order to work with Geneve options, we need to maintain a mapping
table between an option (defined by <class, type, length>) and
an NXM field that can be operated on for the purposes of matches,
actions, etc. This mapping must be explicitly specified by the
user.
Conceptually, this table could be communicated using either OpenFlow
or OVSDB. Using OVSDB requires less code and definition of extensions
than OpenFlow but introduces the possibility that mapping table
updates and flow modifications are desynchronized from each other.
This is dangerous because the mapping table signifcantly impacts the
way that flows using Geneve options are installed and processed by
OVS. Therefore, the mapping table is maintained using OpenFlow commands
instead, which opens the possibility of using synchronization between
table changes and flow modifications through barriers, bundles, etc.
There are two primary groups of OpenFlow messages that are introduced
as Nicira extensions: modification commands (add, delete, clear mappings)
and table status request/reply to dump the current table along with switch
information.
Note that mappings should not be changed while they are in active use by
a flow. The result of doing so is undefined.
This only adds the OpenFlow infrastructure but doesn't actually
do anything with the information yet after the messages have been
decoded.
Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2015-06-02 15:11:00 -07:00
|
|
|
|
}
|
|
|
|
|
|
2018-01-04 22:40:01 -08:00
|
|
|
|
static enum ofperr
|
2015-12-16 02:47:50 +08:00
|
|
|
|
ofp_print_tlv_table_reply(struct ds *s, const struct ofp_header *oh)
|
openflow: Table maintenance commands for Geneve options.
In order to work with Geneve options, we need to maintain a mapping
table between an option (defined by <class, type, length>) and
an NXM field that can be operated on for the purposes of matches,
actions, etc. This mapping must be explicitly specified by the
user.
Conceptually, this table could be communicated using either OpenFlow
or OVSDB. Using OVSDB requires less code and definition of extensions
than OpenFlow but introduces the possibility that mapping table
updates and flow modifications are desynchronized from each other.
This is dangerous because the mapping table signifcantly impacts the
way that flows using Geneve options are installed and processed by
OVS. Therefore, the mapping table is maintained using OpenFlow commands
instead, which opens the possibility of using synchronization between
table changes and flow modifications through barriers, bundles, etc.
There are two primary groups of OpenFlow messages that are introduced
as Nicira extensions: modification commands (add, delete, clear mappings)
and table status request/reply to dump the current table along with switch
information.
Note that mappings should not be changed while they are in active use by
a flow. The result of doing so is undefined.
This only adds the OpenFlow infrastructure but doesn't actually
do anything with the information yet after the messages have been
decoded.
Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2015-06-02 15:11:00 -07:00
|
|
|
|
{
|
2015-12-16 02:47:50 +08:00
|
|
|
|
struct ofputil_tlv_table_reply ttr;
|
2018-06-15 17:06:56 -07:00
|
|
|
|
int error = ofputil_decode_tlv_table_reply(oh, &ttr);
|
|
|
|
|
if (!error) {
|
|
|
|
|
ofputil_format_tlv_table_reply(s, &ttr);
|
|
|
|
|
ofputil_uninit_tlv_table(&ttr.mappings);
|
openflow: Table maintenance commands for Geneve options.
In order to work with Geneve options, we need to maintain a mapping
table between an option (defined by <class, type, length>) and
an NXM field that can be operated on for the purposes of matches,
actions, etc. This mapping must be explicitly specified by the
user.
Conceptually, this table could be communicated using either OpenFlow
or OVSDB. Using OVSDB requires less code and definition of extensions
than OpenFlow but introduces the possibility that mapping table
updates and flow modifications are desynchronized from each other.
This is dangerous because the mapping table signifcantly impacts the
way that flows using Geneve options are installed and processed by
OVS. Therefore, the mapping table is maintained using OpenFlow commands
instead, which opens the possibility of using synchronization between
table changes and flow modifications through barriers, bundles, etc.
There are two primary groups of OpenFlow messages that are introduced
as Nicira extensions: modification commands (add, delete, clear mappings)
and table status request/reply to dump the current table along with switch
information.
Note that mappings should not be changed while they are in active use by
a flow. The result of doing so is undefined.
This only adds the OpenFlow infrastructure but doesn't actually
do anything with the information yet after the messages have been
decoded.
Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2015-06-02 15:11:00 -07:00
|
|
|
|
}
|
2018-06-15 17:06:56 -07:00
|
|
|
|
return error;
|
openflow: Table maintenance commands for Geneve options.
In order to work with Geneve options, we need to maintain a mapping
table between an option (defined by <class, type, length>) and
an NXM field that can be operated on for the purposes of matches,
actions, etc. This mapping must be explicitly specified by the
user.
Conceptually, this table could be communicated using either OpenFlow
or OVSDB. Using OVSDB requires less code and definition of extensions
than OpenFlow but introduces the possibility that mapping table
updates and flow modifications are desynchronized from each other.
This is dangerous because the mapping table signifcantly impacts the
way that flows using Geneve options are installed and processed by
OVS. Therefore, the mapping table is maintained using OpenFlow commands
instead, which opens the possibility of using synchronization between
table changes and flow modifications through barriers, bundles, etc.
There are two primary groups of OpenFlow messages that are introduced
as Nicira extensions: modification commands (add, delete, clear mappings)
and table status request/reply to dump the current table along with switch
information.
Note that mappings should not be changed while they are in active use by
a flow. The result of doing so is undefined.
This only adds the OpenFlow infrastructure but doesn't actually
do anything with the information yet after the messages have been
decoded.
Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2015-06-02 15:11:00 -07:00
|
|
|
|
}
|
|
|
|
|
|
2015-09-09 17:33:42 +05:30
|
|
|
|
/* This function will print the request forward message. The reason for
|
|
|
|
|
* request forward is taken from rf.request.type */
|
2018-01-04 22:40:01 -08:00
|
|
|
|
static enum ofperr
|
2017-05-31 16:06:12 -07:00
|
|
|
|
ofp_print_requestforward(struct ds *string, const struct ofp_header *oh,
|
Support accepting and displaying table names in OVS tools.
OpenFlow has little-known support for naming tables. Open vSwitch has
supported table names for ages, but it has never used or displayed them
outside of commands dedicated to table manipulation. This commit adds
support for table names in ovs-ofctl. When a table has a name, it displays
that name in flows and actions, so that, for example, the following:
table=1, arp, actions=resubmit(,2)
might become:
table=ingress_acl, arp, actions=resubmit(,mac_learning)
given appropriately named tables.
For backward compatibility, only interactive ovs-ofctl commands by default
display table names; to display them in scripts, use the new --names
option.
This feature was inspired by a talk that Kei Nohguchi presented at Open
vSwitch 2017 Fall Conference.
CC: Kei Nohguchi <kei@nohguchi.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Mark Michelson <mmichels@redhat.com>
Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
2018-01-05 16:59:13 -08:00
|
|
|
|
const struct ofputil_port_map *port_map,
|
|
|
|
|
const struct ofputil_table_map *table_map)
|
2015-09-09 17:33:42 +05:30
|
|
|
|
{
|
|
|
|
|
struct ofputil_requestforward rf;
|
2018-06-15 17:06:56 -07:00
|
|
|
|
enum ofperr error = ofputil_decode_requestforward(oh, &rf);
|
|
|
|
|
if (!error) {
|
|
|
|
|
ofputil_format_requestforward(string, oh->version,
|
|
|
|
|
&rf, port_map, table_map);
|
|
|
|
|
ofputil_destroy_requestforward(&rf);
|
ipfix: Add support for exporting ipfix statistics.
It is meaningful for user to check the stats of IPFIX.
Using IPFIX stats, user can know how much flows the system
can support. It is also can be used for performance check
of IPFIX.
IPFIX stats is added for per IPFIX exporter. If bridge IPFIX is
enabled on the bridge, the whole bridge will have one exporter.
For flow IPFIX, the system keeps per id (column in
Flow_Sample_Collector_Set) per exporter.
1) Add 'ovs-ofctl dump-ipfix-bridge SWITCH' to export IPFIX stats of
the bridge which enable bridge IPFIX. The output format:
NXST_IPFIX_BRIDGE reply (xid=0x2):
bridge ipfix: flows=0, current flows=0, sampled pkts=0, \
ipv4 ok=0, ipv6 ok=0, tx pkts=0
pkts errs=0, ipv4 errs=0, ipv6 errs=0, tx errs=0
2) Add 'ovs-ofctl dump-ipfix-flow SWITCH' to export IPFIX stats of
the bridge which enable flow IPFIX. The output format:
NXST_IPFIX_FLOW reply (xid=0x2): 2 ids
id 1: flows=4, current flows=4, sampled pkts=14, ipv4 ok=13, \
ipv6 ok=0, tx pkts=0
pkts errs=0, ipv4 errs=0, ipv6 errs=0, tx errs=0
id 2: flows=0, current flows=0, sampled pkts=0, ipv4 ok=0, \
ipv6 ok=0, tx pkts=0
pkts errs=0, ipv4 errs=0, ipv6 errs=0, tx errs=0
flows: the number of total flow records, including those exported.
current flows: the number of current flow records cached.
sampled pkts: Successfully sampled packet count.
ipv4 ok: successfully sampled IPv4 flow packet count.
ipv6 ok: Successfully sampled IPv6 flow packet count.
tx pkts: the count of IPFIX exported packets sent to the collector(s).
pkts errs: count of packets failed when sampling, maybe not supported or other error.
ipv4 errs: Count of IPV4 flow packet in the error packets.
ipv6 errs: Count of IPV6 flow packet in the error packets.
tx errs: the count of IPFIX exported packets failed when sending to the collector(s).
Signed-off-by: Benli Ye <daniely@vmware.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2016-06-13 14:44:09 -07:00
|
|
|
|
}
|
2018-06-15 17:06:56 -07:00
|
|
|
|
return error;
|
ipfix: Add support for exporting ipfix statistics.
It is meaningful for user to check the stats of IPFIX.
Using IPFIX stats, user can know how much flows the system
can support. It is also can be used for performance check
of IPFIX.
IPFIX stats is added for per IPFIX exporter. If bridge IPFIX is
enabled on the bridge, the whole bridge will have one exporter.
For flow IPFIX, the system keeps per id (column in
Flow_Sample_Collector_Set) per exporter.
1) Add 'ovs-ofctl dump-ipfix-bridge SWITCH' to export IPFIX stats of
the bridge which enable bridge IPFIX. The output format:
NXST_IPFIX_BRIDGE reply (xid=0x2):
bridge ipfix: flows=0, current flows=0, sampled pkts=0, \
ipv4 ok=0, ipv6 ok=0, tx pkts=0
pkts errs=0, ipv4 errs=0, ipv6 errs=0, tx errs=0
2) Add 'ovs-ofctl dump-ipfix-flow SWITCH' to export IPFIX stats of
the bridge which enable flow IPFIX. The output format:
NXST_IPFIX_FLOW reply (xid=0x2): 2 ids
id 1: flows=4, current flows=4, sampled pkts=14, ipv4 ok=13, \
ipv6 ok=0, tx pkts=0
pkts errs=0, ipv4 errs=0, ipv6 errs=0, tx errs=0
id 2: flows=0, current flows=0, sampled pkts=0, ipv4 ok=0, \
ipv6 ok=0, tx pkts=0
pkts errs=0, ipv4 errs=0, ipv6 errs=0, tx errs=0
flows: the number of total flow records, including those exported.
current flows: the number of current flow records cached.
sampled pkts: Successfully sampled packet count.
ipv4 ok: successfully sampled IPv4 flow packet count.
ipv6 ok: Successfully sampled IPv6 flow packet count.
tx pkts: the count of IPFIX exported packets sent to the collector(s).
pkts errs: count of packets failed when sampling, maybe not supported or other error.
ipv4 errs: Count of IPV4 flow packet in the error packets.
ipv6 errs: Count of IPV6 flow packet in the error packets.
tx errs: the count of IPFIX exported packets failed when sending to the collector(s).
Signed-off-by: Benli Ye <daniely@vmware.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2016-06-13 14:44:09 -07:00
|
|
|
|
}
|
|
|
|
|
|
2018-01-04 22:40:01 -08:00
|
|
|
|
static enum ofperr
|
ipfix: Add support for exporting ipfix statistics.
It is meaningful for user to check the stats of IPFIX.
Using IPFIX stats, user can know how much flows the system
can support. It is also can be used for performance check
of IPFIX.
IPFIX stats is added for per IPFIX exporter. If bridge IPFIX is
enabled on the bridge, the whole bridge will have one exporter.
For flow IPFIX, the system keeps per id (column in
Flow_Sample_Collector_Set) per exporter.
1) Add 'ovs-ofctl dump-ipfix-bridge SWITCH' to export IPFIX stats of
the bridge which enable bridge IPFIX. The output format:
NXST_IPFIX_BRIDGE reply (xid=0x2):
bridge ipfix: flows=0, current flows=0, sampled pkts=0, \
ipv4 ok=0, ipv6 ok=0, tx pkts=0
pkts errs=0, ipv4 errs=0, ipv6 errs=0, tx errs=0
2) Add 'ovs-ofctl dump-ipfix-flow SWITCH' to export IPFIX stats of
the bridge which enable flow IPFIX. The output format:
NXST_IPFIX_FLOW reply (xid=0x2): 2 ids
id 1: flows=4, current flows=4, sampled pkts=14, ipv4 ok=13, \
ipv6 ok=0, tx pkts=0
pkts errs=0, ipv4 errs=0, ipv6 errs=0, tx errs=0
id 2: flows=0, current flows=0, sampled pkts=0, ipv4 ok=0, \
ipv6 ok=0, tx pkts=0
pkts errs=0, ipv4 errs=0, ipv6 errs=0, tx errs=0
flows: the number of total flow records, including those exported.
current flows: the number of current flow records cached.
sampled pkts: Successfully sampled packet count.
ipv4 ok: successfully sampled IPv4 flow packet count.
ipv6 ok: Successfully sampled IPv6 flow packet count.
tx pkts: the count of IPFIX exported packets sent to the collector(s).
pkts errs: count of packets failed when sampling, maybe not supported or other error.
ipv4 errs: Count of IPV4 flow packet in the error packets.
ipv6 errs: Count of IPV6 flow packet in the error packets.
tx errs: the count of IPFIX exported packets failed when sending to the collector(s).
Signed-off-by: Benli Ye <daniely@vmware.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2016-06-13 14:44:09 -07:00
|
|
|
|
ofp_print_nxst_ipfix_bridge_reply(struct ds *string, const struct ofp_header *oh)
|
|
|
|
|
{
|
|
|
|
|
struct ofpbuf b = ofpbuf_const_initializer(oh, ntohs(oh->length));
|
|
|
|
|
for (;;) {
|
|
|
|
|
struct ofputil_ipfix_stats is;
|
|
|
|
|
int retval;
|
|
|
|
|
|
|
|
|
|
retval = ofputil_pull_ipfix_stats(&is, &b);
|
|
|
|
|
if (retval) {
|
2018-01-04 22:40:01 -08:00
|
|
|
|
return retval != EOF ? retval : 0;
|
ipfix: Add support for exporting ipfix statistics.
It is meaningful for user to check the stats of IPFIX.
Using IPFIX stats, user can know how much flows the system
can support. It is also can be used for performance check
of IPFIX.
IPFIX stats is added for per IPFIX exporter. If bridge IPFIX is
enabled on the bridge, the whole bridge will have one exporter.
For flow IPFIX, the system keeps per id (column in
Flow_Sample_Collector_Set) per exporter.
1) Add 'ovs-ofctl dump-ipfix-bridge SWITCH' to export IPFIX stats of
the bridge which enable bridge IPFIX. The output format:
NXST_IPFIX_BRIDGE reply (xid=0x2):
bridge ipfix: flows=0, current flows=0, sampled pkts=0, \
ipv4 ok=0, ipv6 ok=0, tx pkts=0
pkts errs=0, ipv4 errs=0, ipv6 errs=0, tx errs=0
2) Add 'ovs-ofctl dump-ipfix-flow SWITCH' to export IPFIX stats of
the bridge which enable flow IPFIX. The output format:
NXST_IPFIX_FLOW reply (xid=0x2): 2 ids
id 1: flows=4, current flows=4, sampled pkts=14, ipv4 ok=13, \
ipv6 ok=0, tx pkts=0
pkts errs=0, ipv4 errs=0, ipv6 errs=0, tx errs=0
id 2: flows=0, current flows=0, sampled pkts=0, ipv4 ok=0, \
ipv6 ok=0, tx pkts=0
pkts errs=0, ipv4 errs=0, ipv6 errs=0, tx errs=0
flows: the number of total flow records, including those exported.
current flows: the number of current flow records cached.
sampled pkts: Successfully sampled packet count.
ipv4 ok: successfully sampled IPv4 flow packet count.
ipv6 ok: Successfully sampled IPv6 flow packet count.
tx pkts: the count of IPFIX exported packets sent to the collector(s).
pkts errs: count of packets failed when sampling, maybe not supported or other error.
ipv4 errs: Count of IPV4 flow packet in the error packets.
ipv6 errs: Count of IPV6 flow packet in the error packets.
tx errs: the count of IPFIX exported packets failed when sending to the collector(s).
Signed-off-by: Benli Ye <daniely@vmware.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2016-06-13 14:44:09 -07:00
|
|
|
|
}
|
2018-06-15 17:06:56 -07:00
|
|
|
|
ofputil_format_ipfix_stats_bridge(string, &is);
|
ipfix: Add support for exporting ipfix statistics.
It is meaningful for user to check the stats of IPFIX.
Using IPFIX stats, user can know how much flows the system
can support. It is also can be used for performance check
of IPFIX.
IPFIX stats is added for per IPFIX exporter. If bridge IPFIX is
enabled on the bridge, the whole bridge will have one exporter.
For flow IPFIX, the system keeps per id (column in
Flow_Sample_Collector_Set) per exporter.
1) Add 'ovs-ofctl dump-ipfix-bridge SWITCH' to export IPFIX stats of
the bridge which enable bridge IPFIX. The output format:
NXST_IPFIX_BRIDGE reply (xid=0x2):
bridge ipfix: flows=0, current flows=0, sampled pkts=0, \
ipv4 ok=0, ipv6 ok=0, tx pkts=0
pkts errs=0, ipv4 errs=0, ipv6 errs=0, tx errs=0
2) Add 'ovs-ofctl dump-ipfix-flow SWITCH' to export IPFIX stats of
the bridge which enable flow IPFIX. The output format:
NXST_IPFIX_FLOW reply (xid=0x2): 2 ids
id 1: flows=4, current flows=4, sampled pkts=14, ipv4 ok=13, \
ipv6 ok=0, tx pkts=0
pkts errs=0, ipv4 errs=0, ipv6 errs=0, tx errs=0
id 2: flows=0, current flows=0, sampled pkts=0, ipv4 ok=0, \
ipv6 ok=0, tx pkts=0
pkts errs=0, ipv4 errs=0, ipv6 errs=0, tx errs=0
flows: the number of total flow records, including those exported.
current flows: the number of current flow records cached.
sampled pkts: Successfully sampled packet count.
ipv4 ok: successfully sampled IPv4 flow packet count.
ipv6 ok: Successfully sampled IPv6 flow packet count.
tx pkts: the count of IPFIX exported packets sent to the collector(s).
pkts errs: count of packets failed when sampling, maybe not supported or other error.
ipv4 errs: Count of IPV4 flow packet in the error packets.
ipv6 errs: Count of IPV6 flow packet in the error packets.
tx errs: the count of IPFIX exported packets failed when sending to the collector(s).
Signed-off-by: Benli Ye <daniely@vmware.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2016-06-13 14:44:09 -07:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-01-04 22:40:01 -08:00
|
|
|
|
static enum ofperr
|
ipfix: Add support for exporting ipfix statistics.
It is meaningful for user to check the stats of IPFIX.
Using IPFIX stats, user can know how much flows the system
can support. It is also can be used for performance check
of IPFIX.
IPFIX stats is added for per IPFIX exporter. If bridge IPFIX is
enabled on the bridge, the whole bridge will have one exporter.
For flow IPFIX, the system keeps per id (column in
Flow_Sample_Collector_Set) per exporter.
1) Add 'ovs-ofctl dump-ipfix-bridge SWITCH' to export IPFIX stats of
the bridge which enable bridge IPFIX. The output format:
NXST_IPFIX_BRIDGE reply (xid=0x2):
bridge ipfix: flows=0, current flows=0, sampled pkts=0, \
ipv4 ok=0, ipv6 ok=0, tx pkts=0
pkts errs=0, ipv4 errs=0, ipv6 errs=0, tx errs=0
2) Add 'ovs-ofctl dump-ipfix-flow SWITCH' to export IPFIX stats of
the bridge which enable flow IPFIX. The output format:
NXST_IPFIX_FLOW reply (xid=0x2): 2 ids
id 1: flows=4, current flows=4, sampled pkts=14, ipv4 ok=13, \
ipv6 ok=0, tx pkts=0
pkts errs=0, ipv4 errs=0, ipv6 errs=0, tx errs=0
id 2: flows=0, current flows=0, sampled pkts=0, ipv4 ok=0, \
ipv6 ok=0, tx pkts=0
pkts errs=0, ipv4 errs=0, ipv6 errs=0, tx errs=0
flows: the number of total flow records, including those exported.
current flows: the number of current flow records cached.
sampled pkts: Successfully sampled packet count.
ipv4 ok: successfully sampled IPv4 flow packet count.
ipv6 ok: Successfully sampled IPv6 flow packet count.
tx pkts: the count of IPFIX exported packets sent to the collector(s).
pkts errs: count of packets failed when sampling, maybe not supported or other error.
ipv4 errs: Count of IPV4 flow packet in the error packets.
ipv6 errs: Count of IPV6 flow packet in the error packets.
tx errs: the count of IPFIX exported packets failed when sending to the collector(s).
Signed-off-by: Benli Ye <daniely@vmware.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2016-06-13 14:44:09 -07:00
|
|
|
|
ofp_print_nxst_ipfix_flow_reply(struct ds *string, const struct ofp_header *oh)
|
|
|
|
|
{
|
|
|
|
|
ds_put_format(string, " %"PRIuSIZE" ids\n", ofputil_count_ipfix_stats(oh));
|
|
|
|
|
|
|
|
|
|
struct ofpbuf b = ofpbuf_const_initializer(oh, ntohs(oh->length));
|
|
|
|
|
for (;;) {
|
|
|
|
|
struct ofputil_ipfix_stats is;
|
|
|
|
|
int retval;
|
|
|
|
|
|
|
|
|
|
retval = ofputil_pull_ipfix_stats(&is, &b);
|
|
|
|
|
if (retval) {
|
2018-01-04 22:40:01 -08:00
|
|
|
|
return retval != EOF ? retval : 0;
|
ipfix: Add support for exporting ipfix statistics.
It is meaningful for user to check the stats of IPFIX.
Using IPFIX stats, user can know how much flows the system
can support. It is also can be used for performance check
of IPFIX.
IPFIX stats is added for per IPFIX exporter. If bridge IPFIX is
enabled on the bridge, the whole bridge will have one exporter.
For flow IPFIX, the system keeps per id (column in
Flow_Sample_Collector_Set) per exporter.
1) Add 'ovs-ofctl dump-ipfix-bridge SWITCH' to export IPFIX stats of
the bridge which enable bridge IPFIX. The output format:
NXST_IPFIX_BRIDGE reply (xid=0x2):
bridge ipfix: flows=0, current flows=0, sampled pkts=0, \
ipv4 ok=0, ipv6 ok=0, tx pkts=0
pkts errs=0, ipv4 errs=0, ipv6 errs=0, tx errs=0
2) Add 'ovs-ofctl dump-ipfix-flow SWITCH' to export IPFIX stats of
the bridge which enable flow IPFIX. The output format:
NXST_IPFIX_FLOW reply (xid=0x2): 2 ids
id 1: flows=4, current flows=4, sampled pkts=14, ipv4 ok=13, \
ipv6 ok=0, tx pkts=0
pkts errs=0, ipv4 errs=0, ipv6 errs=0, tx errs=0
id 2: flows=0, current flows=0, sampled pkts=0, ipv4 ok=0, \
ipv6 ok=0, tx pkts=0
pkts errs=0, ipv4 errs=0, ipv6 errs=0, tx errs=0
flows: the number of total flow records, including those exported.
current flows: the number of current flow records cached.
sampled pkts: Successfully sampled packet count.
ipv4 ok: successfully sampled IPv4 flow packet count.
ipv6 ok: Successfully sampled IPv6 flow packet count.
tx pkts: the count of IPFIX exported packets sent to the collector(s).
pkts errs: count of packets failed when sampling, maybe not supported or other error.
ipv4 errs: Count of IPV4 flow packet in the error packets.
ipv6 errs: Count of IPV6 flow packet in the error packets.
tx errs: the count of IPFIX exported packets failed when sending to the collector(s).
Signed-off-by: Benli Ye <daniely@vmware.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2016-06-13 14:44:09 -07:00
|
|
|
|
}
|
2018-06-15 17:06:56 -07:00
|
|
|
|
ofputil_format_ipfix_stats_flow(string, &is);
|
ipfix: Add support for exporting ipfix statistics.
It is meaningful for user to check the stats of IPFIX.
Using IPFIX stats, user can know how much flows the system
can support. It is also can be used for performance check
of IPFIX.
IPFIX stats is added for per IPFIX exporter. If bridge IPFIX is
enabled on the bridge, the whole bridge will have one exporter.
For flow IPFIX, the system keeps per id (column in
Flow_Sample_Collector_Set) per exporter.
1) Add 'ovs-ofctl dump-ipfix-bridge SWITCH' to export IPFIX stats of
the bridge which enable bridge IPFIX. The output format:
NXST_IPFIX_BRIDGE reply (xid=0x2):
bridge ipfix: flows=0, current flows=0, sampled pkts=0, \
ipv4 ok=0, ipv6 ok=0, tx pkts=0
pkts errs=0, ipv4 errs=0, ipv6 errs=0, tx errs=0
2) Add 'ovs-ofctl dump-ipfix-flow SWITCH' to export IPFIX stats of
the bridge which enable flow IPFIX. The output format:
NXST_IPFIX_FLOW reply (xid=0x2): 2 ids
id 1: flows=4, current flows=4, sampled pkts=14, ipv4 ok=13, \
ipv6 ok=0, tx pkts=0
pkts errs=0, ipv4 errs=0, ipv6 errs=0, tx errs=0
id 2: flows=0, current flows=0, sampled pkts=0, ipv4 ok=0, \
ipv6 ok=0, tx pkts=0
pkts errs=0, ipv4 errs=0, ipv6 errs=0, tx errs=0
flows: the number of total flow records, including those exported.
current flows: the number of current flow records cached.
sampled pkts: Successfully sampled packet count.
ipv4 ok: successfully sampled IPv4 flow packet count.
ipv6 ok: Successfully sampled IPv6 flow packet count.
tx pkts: the count of IPFIX exported packets sent to the collector(s).
pkts errs: count of packets failed when sampling, maybe not supported or other error.
ipv4 errs: Count of IPV4 flow packet in the error packets.
ipv6 errs: Count of IPV6 flow packet in the error packets.
tx errs: the count of IPFIX exported packets failed when sending to the collector(s).
Signed-off-by: Benli Ye <daniely@vmware.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2016-06-13 14:44:09 -07:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-01-04 22:40:01 -08:00
|
|
|
|
static enum ofperr
|
2016-08-18 14:09:41 -07:00
|
|
|
|
ofp_print_nxt_ct_flush_zone(struct ds *string, const struct nx_zone_id *nzi)
|
|
|
|
|
{
|
|
|
|
|
ds_put_format(string, " zone_id=%"PRIu16, ntohs(nzi->zone_id));
|
2018-01-04 22:40:01 -08:00
|
|
|
|
return 0;
|
2016-08-18 14:09:41 -07:00
|
|
|
|
}
|
|
|
|
|
|
2018-01-04 22:40:01 -08:00
|
|
|
|
static enum ofperr
|
2017-05-31 16:06:12 -07:00
|
|
|
|
ofp_to_string__(const struct ofp_header *oh,
|
Support accepting and displaying table names in OVS tools.
OpenFlow has little-known support for naming tables. Open vSwitch has
supported table names for ages, but it has never used or displayed them
outside of commands dedicated to table manipulation. This commit adds
support for table names in ovs-ofctl. When a table has a name, it displays
that name in flows and actions, so that, for example, the following:
table=1, arp, actions=resubmit(,2)
might become:
table=ingress_acl, arp, actions=resubmit(,mac_learning)
given appropriately named tables.
For backward compatibility, only interactive ovs-ofctl commands by default
display table names; to display them in scripts, use the new --names
option.
This feature was inspired by a talk that Kei Nohguchi presented at Open
vSwitch 2017 Fall Conference.
CC: Kei Nohguchi <kei@nohguchi.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Mark Michelson <mmichels@redhat.com>
Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
2018-01-05 16:59:13 -08:00
|
|
|
|
const struct ofputil_port_map *port_map,
|
|
|
|
|
const struct ofputil_table_map *table_map, enum ofpraw raw,
|
2012-07-19 23:23:17 -07:00
|
|
|
|
struct ds *string, int verbosity)
|
2012-07-12 13:32:47 -07:00
|
|
|
|
{
|
2018-05-10 13:21:29 -07:00
|
|
|
|
if (ofpmsg_is_stat(oh)) {
|
|
|
|
|
ofp_print_stats(string, oh);
|
|
|
|
|
}
|
|
|
|
|
|
2012-07-12 13:32:47 -07:00
|
|
|
|
const void *msg = oh;
|
2016-01-14 22:16:34 -08:00
|
|
|
|
enum ofptype type = ofptype_from_ofpraw(raw);
|
|
|
|
|
switch (type) {
|
2013-06-28 13:41:53 -07:00
|
|
|
|
case OFPTYPE_GROUP_STATS_REQUEST:
|
2018-05-10 13:07:45 -07:00
|
|
|
|
return ofputil_group_stats_request_format(string, oh);
|
2013-09-01 18:30:17 -07:00
|
|
|
|
|
2013-06-28 13:41:53 -07:00
|
|
|
|
case OFPTYPE_GROUP_STATS_REPLY:
|
2018-05-10 13:07:45 -07:00
|
|
|
|
return ofputil_group_stats_format(string, oh);
|
2013-09-01 18:30:17 -07:00
|
|
|
|
|
2013-06-28 13:41:53 -07:00
|
|
|
|
case OFPTYPE_GROUP_DESC_STATS_REQUEST:
|
2018-05-10 13:07:45 -07:00
|
|
|
|
return ofputil_group_desc_request_format(string, oh);
|
2013-09-01 18:30:17 -07:00
|
|
|
|
|
2013-06-28 13:41:53 -07:00
|
|
|
|
case OFPTYPE_GROUP_DESC_STATS_REPLY:
|
2018-05-10 13:07:45 -07:00
|
|
|
|
return ofputil_group_desc_format(string, oh, port_map, table_map);
|
2013-09-01 18:30:17 -07:00
|
|
|
|
|
2013-06-28 13:41:53 -07:00
|
|
|
|
case OFPTYPE_GROUP_FEATURES_STATS_REQUEST:
|
2013-09-01 18:30:17 -07:00
|
|
|
|
break;
|
|
|
|
|
|
2013-06-28 13:41:53 -07:00
|
|
|
|
case OFPTYPE_GROUP_FEATURES_STATS_REPLY:
|
2018-05-10 13:07:45 -07:00
|
|
|
|
return ofputil_group_features_format(string, oh);
|
2013-09-01 18:30:17 -07:00
|
|
|
|
|
|
|
|
|
case OFPTYPE_GROUP_MOD:
|
2018-05-10 13:07:45 -07:00
|
|
|
|
return ofputil_group_mod_format(string, oh, port_map, table_map);
|
2013-09-01 18:30:17 -07:00
|
|
|
|
|
2013-06-28 13:41:53 -07:00
|
|
|
|
case OFPTYPE_TABLE_FEATURES_STATS_REQUEST:
|
|
|
|
|
case OFPTYPE_TABLE_FEATURES_STATS_REPLY:
|
2018-08-30 11:03:12 -07:00
|
|
|
|
return ofp_print_table_features_reply(string, oh);
|
2012-11-27 17:44:22 +02:00
|
|
|
|
|
2015-07-02 20:35:44 -07:00
|
|
|
|
case OFPTYPE_TABLE_DESC_REQUEST:
|
|
|
|
|
case OFPTYPE_TABLE_DESC_REPLY:
|
Support accepting and displaying table names in OVS tools.
OpenFlow has little-known support for naming tables. Open vSwitch has
supported table names for ages, but it has never used or displayed them
outside of commands dedicated to table manipulation. This commit adds
support for table names in ovs-ofctl. When a table has a name, it displays
that name in flows and actions, so that, for example, the following:
table=1, arp, actions=resubmit(,2)
might become:
table=ingress_acl, arp, actions=resubmit(,mac_learning)
given appropriately named tables.
For backward compatibility, only interactive ovs-ofctl commands by default
display table names; to display them in scripts, use the new --names
option.
This feature was inspired by a talk that Kei Nohguchi presented at Open
vSwitch 2017 Fall Conference.
CC: Kei Nohguchi <kei@nohguchi.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Mark Michelson <mmichels@redhat.com>
Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
2018-01-05 16:59:13 -08:00
|
|
|
|
return ofp_print_table_desc_reply(string, oh, table_map);
|
2015-07-02 20:35:44 -07:00
|
|
|
|
|
2012-07-19 23:23:17 -07:00
|
|
|
|
case OFPTYPE_HELLO:
|
2018-01-04 22:40:01 -08:00
|
|
|
|
return ofp_print_hello(string, oh);
|
2010-12-06 10:20:20 -08:00
|
|
|
|
|
2012-07-19 23:23:17 -07:00
|
|
|
|
case OFPTYPE_ERROR:
|
Support accepting and displaying table names in OVS tools.
OpenFlow has little-known support for naming tables. Open vSwitch has
supported table names for ages, but it has never used or displayed them
outside of commands dedicated to table manipulation. This commit adds
support for table names in ovs-ofctl. When a table has a name, it displays
that name in flows and actions, so that, for example, the following:
table=1, arp, actions=resubmit(,2)
might become:
table=ingress_acl, arp, actions=resubmit(,mac_learning)
given appropriately named tables.
For backward compatibility, only interactive ovs-ofctl commands by default
display table names; to display them in scripts, use the new --names
option.
This feature was inspired by a talk that Kei Nohguchi presented at Open
vSwitch 2017 Fall Conference.
CC: Kei Nohguchi <kei@nohguchi.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Mark Michelson <mmichels@redhat.com>
Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
2018-01-05 16:59:13 -08:00
|
|
|
|
return ofp_print_error_msg(string, oh, port_map, table_map);
|
2010-12-06 10:20:20 -08:00
|
|
|
|
|
2012-07-19 23:23:17 -07:00
|
|
|
|
case OFPTYPE_ECHO_REQUEST:
|
|
|
|
|
case OFPTYPE_ECHO_REPLY:
|
2018-01-04 22:40:01 -08:00
|
|
|
|
return ofp_print_echo(string, oh, verbosity);
|
2010-12-06 10:20:20 -08:00
|
|
|
|
|
2012-07-19 23:23:17 -07:00
|
|
|
|
case OFPTYPE_FEATURES_REQUEST:
|
2010-12-06 10:20:20 -08:00
|
|
|
|
break;
|
|
|
|
|
|
2012-07-19 23:23:17 -07:00
|
|
|
|
case OFPTYPE_FEATURES_REPLY:
|
2018-01-04 22:40:01 -08:00
|
|
|
|
return ofp_print_switch_features(string, oh);
|
2010-12-06 10:20:20 -08:00
|
|
|
|
|
2012-07-19 23:23:17 -07:00
|
|
|
|
case OFPTYPE_GET_CONFIG_REQUEST:
|
2010-12-06 10:20:20 -08:00
|
|
|
|
break;
|
|
|
|
|
|
2012-07-19 23:23:17 -07:00
|
|
|
|
case OFPTYPE_GET_CONFIG_REPLY:
|
2018-01-04 22:40:01 -08:00
|
|
|
|
return ofp_print_get_config_reply(string, oh);
|
2015-12-21 15:39:10 -08:00
|
|
|
|
|
2012-07-19 23:23:17 -07:00
|
|
|
|
case OFPTYPE_SET_CONFIG:
|
2018-01-04 22:40:01 -08:00
|
|
|
|
return ofp_print_set_config(string, oh);
|
2010-12-06 10:20:20 -08:00
|
|
|
|
|
2012-07-19 23:23:17 -07:00
|
|
|
|
case OFPTYPE_PACKET_IN:
|
Support accepting and displaying table names in OVS tools.
OpenFlow has little-known support for naming tables. Open vSwitch has
supported table names for ages, but it has never used or displayed them
outside of commands dedicated to table manipulation. This commit adds
support for table names in ovs-ofctl. When a table has a name, it displays
that name in flows and actions, so that, for example, the following:
table=1, arp, actions=resubmit(,2)
might become:
table=ingress_acl, arp, actions=resubmit(,mac_learning)
given appropriately named tables.
For backward compatibility, only interactive ovs-ofctl commands by default
display table names; to display them in scripts, use the new --names
option.
This feature was inspired by a talk that Kei Nohguchi presented at Open
vSwitch 2017 Fall Conference.
CC: Kei Nohguchi <kei@nohguchi.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Mark Michelson <mmichels@redhat.com>
Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
2018-01-05 16:59:13 -08:00
|
|
|
|
return ofp_print_packet_in(string, oh, port_map, table_map, verbosity);
|
2010-12-06 10:20:20 -08:00
|
|
|
|
|
2012-07-19 23:23:17 -07:00
|
|
|
|
case OFPTYPE_FLOW_REMOVED:
|
Support accepting and displaying table names in OVS tools.
OpenFlow has little-known support for naming tables. Open vSwitch has
supported table names for ages, but it has never used or displayed them
outside of commands dedicated to table manipulation. This commit adds
support for table names in ovs-ofctl. When a table has a name, it displays
that name in flows and actions, so that, for example, the following:
table=1, arp, actions=resubmit(,2)
might become:
table=ingress_acl, arp, actions=resubmit(,mac_learning)
given appropriately named tables.
For backward compatibility, only interactive ovs-ofctl commands by default
display table names; to display them in scripts, use the new --names
option.
This feature was inspired by a talk that Kei Nohguchi presented at Open
vSwitch 2017 Fall Conference.
CC: Kei Nohguchi <kei@nohguchi.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Mark Michelson <mmichels@redhat.com>
Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
2018-01-05 16:59:13 -08:00
|
|
|
|
return ofp_print_flow_removed(string, oh, port_map, table_map);
|
2010-12-06 10:20:20 -08:00
|
|
|
|
|
2012-07-19 23:23:17 -07:00
|
|
|
|
case OFPTYPE_PORT_STATUS:
|
2018-01-04 22:40:01 -08:00
|
|
|
|
return ofp_print_port_status(string, oh);
|
2010-12-06 10:20:20 -08:00
|
|
|
|
|
2012-07-19 23:23:17 -07:00
|
|
|
|
case OFPTYPE_PACKET_OUT:
|
Support accepting and displaying table names in OVS tools.
OpenFlow has little-known support for naming tables. Open vSwitch has
supported table names for ages, but it has never used or displayed them
outside of commands dedicated to table manipulation. This commit adds
support for table names in ovs-ofctl. When a table has a name, it displays
that name in flows and actions, so that, for example, the following:
table=1, arp, actions=resubmit(,2)
might become:
table=ingress_acl, arp, actions=resubmit(,mac_learning)
given appropriately named tables.
For backward compatibility, only interactive ovs-ofctl commands by default
display table names; to display them in scripts, use the new --names
option.
This feature was inspired by a talk that Kei Nohguchi presented at Open
vSwitch 2017 Fall Conference.
CC: Kei Nohguchi <kei@nohguchi.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Mark Michelson <mmichels@redhat.com>
Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
2018-01-05 16:59:13 -08:00
|
|
|
|
return ofp_print_packet_out(string, oh, port_map, table_map,
|
|
|
|
|
verbosity);
|
2010-12-06 10:20:20 -08:00
|
|
|
|
|
2012-07-19 23:23:17 -07:00
|
|
|
|
case OFPTYPE_FLOW_MOD:
|
2018-02-16 14:03:51 -08:00
|
|
|
|
return ofputil_flow_mod_format(string, oh, port_map, table_map,
|
|
|
|
|
verbosity);
|
2010-12-06 10:20:20 -08:00
|
|
|
|
|
2012-07-19 23:23:17 -07:00
|
|
|
|
case OFPTYPE_PORT_MOD:
|
2018-01-04 22:40:01 -08:00
|
|
|
|
return ofp_print_port_mod(string, oh, port_map);
|
2010-12-06 10:20:20 -08:00
|
|
|
|
|
2013-09-07 03:02:32 -07:00
|
|
|
|
case OFPTYPE_TABLE_MOD:
|
Support accepting and displaying table names in OVS tools.
OpenFlow has little-known support for naming tables. Open vSwitch has
supported table names for ages, but it has never used or displayed them
outside of commands dedicated to table manipulation. This commit adds
support for table names in ovs-ofctl. When a table has a name, it displays
that name in flows and actions, so that, for example, the following:
table=1, arp, actions=resubmit(,2)
might become:
table=ingress_acl, arp, actions=resubmit(,mac_learning)
given appropriately named tables.
For backward compatibility, only interactive ovs-ofctl commands by default
display table names; to display them in scripts, use the new --names
option.
This feature was inspired by a talk that Kei Nohguchi presented at Open
vSwitch 2017 Fall Conference.
CC: Kei Nohguchi <kei@nohguchi.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Mark Michelson <mmichels@redhat.com>
Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
2018-01-05 16:59:13 -08:00
|
|
|
|
return ofp_print_table_mod(string, oh, table_map);
|
2013-09-07 03:02:32 -07:00
|
|
|
|
|
2013-06-20 17:26:18 +03:00
|
|
|
|
case OFPTYPE_METER_MOD:
|
2018-01-04 22:40:01 -08:00
|
|
|
|
return ofp_print_meter_mod(string, oh);
|
2013-06-20 17:26:18 +03:00
|
|
|
|
|
2012-07-19 23:23:17 -07:00
|
|
|
|
case OFPTYPE_BARRIER_REQUEST:
|
|
|
|
|
case OFPTYPE_BARRIER_REPLY:
|
2010-12-06 10:20:20 -08:00
|
|
|
|
break;
|
|
|
|
|
|
2013-10-24 15:54:03 -07:00
|
|
|
|
case OFPTYPE_QUEUE_GET_CONFIG_REQUEST:
|
2018-06-15 17:06:56 -07:00
|
|
|
|
return ofputil_queue_get_config_request_format(string, oh, port_map);
|
2013-10-24 15:54:03 -07:00
|
|
|
|
|
|
|
|
|
case OFPTYPE_QUEUE_GET_CONFIG_REPLY:
|
2018-06-15 17:06:56 -07:00
|
|
|
|
return ofputil_queue_get_config_reply_format(string, oh, port_map);
|
2013-10-24 15:54:03 -07:00
|
|
|
|
|
2012-12-28 18:28:49 +02:00
|
|
|
|
case OFPTYPE_ROLE_REQUEST:
|
|
|
|
|
case OFPTYPE_ROLE_REPLY:
|
2018-01-04 22:40:01 -08:00
|
|
|
|
return ofp_print_role_message(string, oh);
|
2013-10-22 11:40:02 +03:00
|
|
|
|
case OFPTYPE_ROLE_STATUS:
|
2018-01-04 22:40:01 -08:00
|
|
|
|
return ofp_print_role_status_message(string, oh);
|
2012-12-28 18:28:49 +02:00
|
|
|
|
|
2015-09-09 17:33:42 +05:30
|
|
|
|
case OFPTYPE_REQUESTFORWARD:
|
Support accepting and displaying table names in OVS tools.
OpenFlow has little-known support for naming tables. Open vSwitch has
supported table names for ages, but it has never used or displayed them
outside of commands dedicated to table manipulation. This commit adds
support for table names in ovs-ofctl. When a table has a name, it displays
that name in flows and actions, so that, for example, the following:
table=1, arp, actions=resubmit(,2)
might become:
table=ingress_acl, arp, actions=resubmit(,mac_learning)
given appropriately named tables.
For backward compatibility, only interactive ovs-ofctl commands by default
display table names; to display them in scripts, use the new --names
option.
This feature was inspired by a talk that Kei Nohguchi presented at Open
vSwitch 2017 Fall Conference.
CC: Kei Nohguchi <kei@nohguchi.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Mark Michelson <mmichels@redhat.com>
Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
2018-01-05 16:59:13 -08:00
|
|
|
|
return ofp_print_requestforward(string, oh, port_map, table_map);
|
2015-09-09 17:33:42 +05:30
|
|
|
|
|
2016-02-18 15:54:26 +05:30
|
|
|
|
case OFPTYPE_TABLE_STATUS:
|
Support accepting and displaying table names in OVS tools.
OpenFlow has little-known support for naming tables. Open vSwitch has
supported table names for ages, but it has never used or displayed them
outside of commands dedicated to table manipulation. This commit adds
support for table names in ovs-ofctl. When a table has a name, it displays
that name in flows and actions, so that, for example, the following:
table=1, arp, actions=resubmit(,2)
might become:
table=ingress_acl, arp, actions=resubmit(,mac_learning)
given appropriately named tables.
For backward compatibility, only interactive ovs-ofctl commands by default
display table names; to display them in scripts, use the new --names
option.
This feature was inspired by a talk that Kei Nohguchi presented at Open
vSwitch 2017 Fall Conference.
CC: Kei Nohguchi <kei@nohguchi.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Mark Michelson <mmichels@redhat.com>
Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
2018-01-05 16:59:13 -08:00
|
|
|
|
return ofp_print_table_status_message(string, oh, table_map);
|
2016-02-18 15:54:26 +05:30
|
|
|
|
|
2013-06-28 13:41:53 -07:00
|
|
|
|
case OFPTYPE_METER_STATS_REQUEST:
|
|
|
|
|
case OFPTYPE_METER_CONFIG_STATS_REQUEST:
|
2018-01-04 22:40:01 -08:00
|
|
|
|
return ofp_print_meter_stats_request(string, oh);
|
2013-06-20 17:26:18 +03:00
|
|
|
|
|
2013-06-28 13:41:53 -07:00
|
|
|
|
case OFPTYPE_METER_STATS_REPLY:
|
2018-01-04 22:40:01 -08:00
|
|
|
|
return ofp_print_meter_stats_reply(string, oh);
|
2013-06-20 17:26:18 +03:00
|
|
|
|
|
2013-06-28 13:41:53 -07:00
|
|
|
|
case OFPTYPE_METER_CONFIG_STATS_REPLY:
|
2018-01-04 22:40:01 -08:00
|
|
|
|
return ofp_print_meter_config_reply(string, oh);
|
2013-06-20 17:26:18 +03:00
|
|
|
|
|
2013-06-28 13:41:53 -07:00
|
|
|
|
case OFPTYPE_METER_FEATURES_STATS_REPLY:
|
2018-01-04 22:40:01 -08:00
|
|
|
|
return ofp_print_meter_features_reply(string, oh);
|
2013-06-20 17:26:18 +03:00
|
|
|
|
|
2012-07-19 23:23:17 -07:00
|
|
|
|
case OFPTYPE_DESC_STATS_REQUEST:
|
2013-06-28 13:41:53 -07:00
|
|
|
|
case OFPTYPE_METER_FEATURES_STATS_REQUEST:
|
2010-12-06 10:20:20 -08:00
|
|
|
|
break;
|
|
|
|
|
|
2012-07-19 23:23:17 -07:00
|
|
|
|
case OFPTYPE_FLOW_STATS_REQUEST:
|
|
|
|
|
case OFPTYPE_AGGREGATE_STATS_REQUEST:
|
Support accepting and displaying table names in OVS tools.
OpenFlow has little-known support for naming tables. Open vSwitch has
supported table names for ages, but it has never used or displayed them
outside of commands dedicated to table manipulation. This commit adds
support for table names in ovs-ofctl. When a table has a name, it displays
that name in flows and actions, so that, for example, the following:
table=1, arp, actions=resubmit(,2)
might become:
table=ingress_acl, arp, actions=resubmit(,mac_learning)
given appropriately named tables.
For backward compatibility, only interactive ovs-ofctl commands by default
display table names; to display them in scripts, use the new --names
option.
This feature was inspired by a talk that Kei Nohguchi presented at Open
vSwitch 2017 Fall Conference.
CC: Kei Nohguchi <kei@nohguchi.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Mark Michelson <mmichels@redhat.com>
Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
2018-01-05 16:59:13 -08:00
|
|
|
|
return ofp_print_flow_stats_request(string, oh, port_map, table_map);
|
2010-12-06 10:20:20 -08:00
|
|
|
|
|
2012-07-19 23:23:17 -07:00
|
|
|
|
case OFPTYPE_TABLE_STATS_REQUEST:
|
2010-12-06 10:20:20 -08:00
|
|
|
|
break;
|
|
|
|
|
|
2012-07-19 23:23:17 -07:00
|
|
|
|
case OFPTYPE_PORT_STATS_REQUEST:
|
2018-01-04 22:40:01 -08:00
|
|
|
|
return ofp_print_ofpst_port_request(string, oh, port_map);
|
2010-12-06 10:20:20 -08:00
|
|
|
|
|
2012-07-19 23:23:17 -07:00
|
|
|
|
case OFPTYPE_QUEUE_STATS_REQUEST:
|
2018-06-15 17:06:56 -07:00
|
|
|
|
return ofputil_queue_stats_request_format(string, oh, port_map);
|
2010-12-06 10:20:20 -08:00
|
|
|
|
|
2012-07-19 23:23:17 -07:00
|
|
|
|
case OFPTYPE_DESC_STATS_REPLY:
|
2018-01-04 22:40:01 -08:00
|
|
|
|
return ofp_print_ofpst_desc_reply(string, oh);
|
2010-12-06 10:20:20 -08:00
|
|
|
|
|
2012-07-19 23:23:17 -07:00
|
|
|
|
case OFPTYPE_FLOW_STATS_REPLY:
|
Support accepting and displaying table names in OVS tools.
OpenFlow has little-known support for naming tables. Open vSwitch has
supported table names for ages, but it has never used or displayed them
outside of commands dedicated to table manipulation. This commit adds
support for table names in ovs-ofctl. When a table has a name, it displays
that name in flows and actions, so that, for example, the following:
table=1, arp, actions=resubmit(,2)
might become:
table=ingress_acl, arp, actions=resubmit(,mac_learning)
given appropriately named tables.
For backward compatibility, only interactive ovs-ofctl commands by default
display table names; to display them in scripts, use the new --names
option.
This feature was inspired by a talk that Kei Nohguchi presented at Open
vSwitch 2017 Fall Conference.
CC: Kei Nohguchi <kei@nohguchi.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Mark Michelson <mmichels@redhat.com>
Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
2018-01-05 16:59:13 -08:00
|
|
|
|
return ofp_print_flow_stats_reply(string, oh, port_map, table_map);
|
2010-12-06 10:20:20 -08:00
|
|
|
|
|
2012-07-19 23:23:17 -07:00
|
|
|
|
case OFPTYPE_QUEUE_STATS_REPLY:
|
2018-06-15 17:06:56 -07:00
|
|
|
|
return ofputil_queue_stats_reply_format(string, oh, port_map,
|
|
|
|
|
verbosity);
|
2010-12-06 10:20:20 -08:00
|
|
|
|
|
2012-07-19 23:23:17 -07:00
|
|
|
|
case OFPTYPE_PORT_STATS_REPLY:
|
2018-01-04 22:40:01 -08:00
|
|
|
|
return ofp_print_ofpst_port_reply(string, oh, port_map, verbosity);
|
2010-12-06 10:20:20 -08:00
|
|
|
|
|
2012-07-19 23:23:17 -07:00
|
|
|
|
case OFPTYPE_TABLE_STATS_REPLY:
|
2018-08-30 11:03:12 -07:00
|
|
|
|
return ofp_print_table_stats_reply(string, oh);
|
2010-12-06 10:20:20 -08:00
|
|
|
|
|
2012-07-19 23:23:17 -07:00
|
|
|
|
case OFPTYPE_AGGREGATE_STATS_REPLY:
|
2018-01-04 22:40:01 -08:00
|
|
|
|
return ofp_print_aggregate_stats_reply(string, oh);
|
2009-07-08 13:19:16 -07:00
|
|
|
|
|
2014-05-07 23:18:46 -07:00
|
|
|
|
case OFPTYPE_PORT_DESC_STATS_REQUEST:
|
2018-01-04 22:40:01 -08:00
|
|
|
|
return ofp_print_ofpst_port_desc_request(string, oh, port_map);
|
2014-05-07 23:18:46 -07:00
|
|
|
|
|
2012-07-19 23:23:17 -07:00
|
|
|
|
case OFPTYPE_PORT_DESC_STATS_REPLY:
|
2018-01-04 22:40:01 -08:00
|
|
|
|
return ofp_print_ofpst_port_desc_reply(string, oh);
|
2012-05-04 14:42:04 -07:00
|
|
|
|
|
2012-07-19 23:23:17 -07:00
|
|
|
|
case OFPTYPE_FLOW_MOD_TABLE_ID:
|
2018-02-15 14:38:28 -08:00
|
|
|
|
return ofp_print_nxt_flow_mod_table_id(string, oh);
|
2011-05-12 09:58:01 -07:00
|
|
|
|
|
2012-07-19 23:23:17 -07:00
|
|
|
|
case OFPTYPE_SET_FLOW_FORMAT:
|
2018-02-15 14:38:28 -08:00
|
|
|
|
return ofp_print_nxt_set_flow_format(string, oh);
|
2010-12-07 13:22:46 -08:00
|
|
|
|
|
2012-07-19 23:23:17 -07:00
|
|
|
|
case OFPTYPE_SET_PACKET_IN_FORMAT:
|
2018-02-16 11:43:56 -08:00
|
|
|
|
return ofp_print_nxt_set_packet_in_format(string, oh);
|
2011-12-09 15:48:26 -08:00
|
|
|
|
|
2012-07-19 23:23:17 -07:00
|
|
|
|
case OFPTYPE_FLOW_AGE:
|
2012-02-07 10:13:52 -08:00
|
|
|
|
break;
|
|
|
|
|
|
2012-07-19 23:23:17 -07:00
|
|
|
|
case OFPTYPE_SET_CONTROLLER_ID:
|
2018-01-04 22:40:01 -08:00
|
|
|
|
return ofp_print_nxt_set_controller_id(string, ofpmsg_body(oh));
|
2012-02-09 14:17:33 -08:00
|
|
|
|
|
2013-09-07 15:36:22 +03:00
|
|
|
|
case OFPTYPE_GET_ASYNC_REPLY:
|
2012-07-19 23:23:17 -07:00
|
|
|
|
case OFPTYPE_SET_ASYNC_CONFIG:
|
2018-01-04 22:40:01 -08:00
|
|
|
|
return ofp_print_set_async_config(string, oh, type);
|
2013-09-07 15:36:22 +03:00
|
|
|
|
case OFPTYPE_GET_ASYNC_REQUEST:
|
|
|
|
|
break;
|
2012-07-19 23:23:17 -07:00
|
|
|
|
case OFPTYPE_FLOW_MONITOR_CANCEL:
|
2018-01-04 22:40:01 -08:00
|
|
|
|
return ofp_print_nxt_flow_monitor_cancel(string, msg);
|
2012-07-12 14:18:05 -07:00
|
|
|
|
|
2012-07-19 23:23:17 -07:00
|
|
|
|
case OFPTYPE_FLOW_MONITOR_PAUSED:
|
|
|
|
|
case OFPTYPE_FLOW_MONITOR_RESUMED:
|
2012-07-12 14:18:05 -07:00
|
|
|
|
break;
|
|
|
|
|
|
2012-07-19 23:23:17 -07:00
|
|
|
|
case OFPTYPE_FLOW_MONITOR_STATS_REQUEST:
|
Support accepting and displaying table names in OVS tools.
OpenFlow has little-known support for naming tables. Open vSwitch has
supported table names for ages, but it has never used or displayed them
outside of commands dedicated to table manipulation. This commit adds
support for table names in ovs-ofctl. When a table has a name, it displays
that name in flows and actions, so that, for example, the following:
table=1, arp, actions=resubmit(,2)
might become:
table=ingress_acl, arp, actions=resubmit(,mac_learning)
given appropriately named tables.
For backward compatibility, only interactive ovs-ofctl commands by default
display table names; to display them in scripts, use the new --names
option.
This feature was inspired by a talk that Kei Nohguchi presented at Open
vSwitch 2017 Fall Conference.
CC: Kei Nohguchi <kei@nohguchi.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Mark Michelson <mmichels@redhat.com>
Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
2018-01-05 16:59:13 -08:00
|
|
|
|
return ofp_print_nxst_flow_monitor_request(string, msg, port_map,
|
|
|
|
|
table_map);
|
2012-07-12 14:18:05 -07:00
|
|
|
|
|
2012-07-19 23:23:17 -07:00
|
|
|
|
case OFPTYPE_FLOW_MONITOR_STATS_REPLY:
|
Support accepting and displaying table names in OVS tools.
OpenFlow has little-known support for naming tables. Open vSwitch has
supported table names for ages, but it has never used or displayed them
outside of commands dedicated to table manipulation. This commit adds
support for table names in ovs-ofctl. When a table has a name, it displays
that name in flows and actions, so that, for example, the following:
table=1, arp, actions=resubmit(,2)
might become:
table=ingress_acl, arp, actions=resubmit(,mac_learning)
given appropriately named tables.
For backward compatibility, only interactive ovs-ofctl commands by default
display table names; to display them in scripts, use the new --names
option.
This feature was inspired by a talk that Kei Nohguchi presented at Open
vSwitch 2017 Fall Conference.
CC: Kei Nohguchi <kei@nohguchi.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Mark Michelson <mmichels@redhat.com>
Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
2018-01-05 16:59:13 -08:00
|
|
|
|
return ofp_print_nxst_flow_monitor_reply(string, msg, port_map,
|
|
|
|
|
table_map);
|
2014-05-02 09:54:27 +03:00
|
|
|
|
|
|
|
|
|
case OFPTYPE_BUNDLE_CONTROL:
|
2018-01-04 22:40:01 -08:00
|
|
|
|
return ofp_print_bundle_ctrl(string, msg);
|
2014-05-02 09:54:27 +03:00
|
|
|
|
|
|
|
|
|
case OFPTYPE_BUNDLE_ADD_MESSAGE:
|
Support accepting and displaying table names in OVS tools.
OpenFlow has little-known support for naming tables. Open vSwitch has
supported table names for ages, but it has never used or displayed them
outside of commands dedicated to table manipulation. This commit adds
support for table names in ovs-ofctl. When a table has a name, it displays
that name in flows and actions, so that, for example, the following:
table=1, arp, actions=resubmit(,2)
might become:
table=ingress_acl, arp, actions=resubmit(,mac_learning)
given appropriately named tables.
For backward compatibility, only interactive ovs-ofctl commands by default
display table names; to display them in scripts, use the new --names
option.
This feature was inspired by a talk that Kei Nohguchi presented at Open
vSwitch 2017 Fall Conference.
CC: Kei Nohguchi <kei@nohguchi.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Mark Michelson <mmichels@redhat.com>
Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
2018-01-05 16:59:13 -08:00
|
|
|
|
return ofp_print_bundle_add(string, msg, port_map, table_map,
|
|
|
|
|
verbosity);
|
openflow: Table maintenance commands for Geneve options.
In order to work with Geneve options, we need to maintain a mapping
table between an option (defined by <class, type, length>) and
an NXM field that can be operated on for the purposes of matches,
actions, etc. This mapping must be explicitly specified by the
user.
Conceptually, this table could be communicated using either OpenFlow
or OVSDB. Using OVSDB requires less code and definition of extensions
than OpenFlow but introduces the possibility that mapping table
updates and flow modifications are desynchronized from each other.
This is dangerous because the mapping table signifcantly impacts the
way that flows using Geneve options are installed and processed by
OVS. Therefore, the mapping table is maintained using OpenFlow commands
instead, which opens the possibility of using synchronization between
table changes and flow modifications through barriers, bundles, etc.
There are two primary groups of OpenFlow messages that are introduced
as Nicira extensions: modification commands (add, delete, clear mappings)
and table status request/reply to dump the current table along with switch
information.
Note that mappings should not be changed while they are in active use by
a flow. The result of doing so is undefined.
This only adds the OpenFlow infrastructure but doesn't actually
do anything with the information yet after the messages have been
decoded.
Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2015-06-02 15:11:00 -07:00
|
|
|
|
|
2015-12-16 02:47:50 +08:00
|
|
|
|
case OFPTYPE_NXT_TLV_TABLE_MOD:
|
2018-01-04 22:40:01 -08:00
|
|
|
|
return ofp_print_tlv_table_mod(string, msg);
|
openflow: Table maintenance commands for Geneve options.
In order to work with Geneve options, we need to maintain a mapping
table between an option (defined by <class, type, length>) and
an NXM field that can be operated on for the purposes of matches,
actions, etc. This mapping must be explicitly specified by the
user.
Conceptually, this table could be communicated using either OpenFlow
or OVSDB. Using OVSDB requires less code and definition of extensions
than OpenFlow but introduces the possibility that mapping table
updates and flow modifications are desynchronized from each other.
This is dangerous because the mapping table signifcantly impacts the
way that flows using Geneve options are installed and processed by
OVS. Therefore, the mapping table is maintained using OpenFlow commands
instead, which opens the possibility of using synchronization between
table changes and flow modifications through barriers, bundles, etc.
There are two primary groups of OpenFlow messages that are introduced
as Nicira extensions: modification commands (add, delete, clear mappings)
and table status request/reply to dump the current table along with switch
information.
Note that mappings should not be changed while they are in active use by
a flow. The result of doing so is undefined.
This only adds the OpenFlow infrastructure but doesn't actually
do anything with the information yet after the messages have been
decoded.
Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2015-06-02 15:11:00 -07:00
|
|
|
|
|
2015-12-16 02:47:50 +08:00
|
|
|
|
case OFPTYPE_NXT_TLV_TABLE_REQUEST:
|
openflow: Table maintenance commands for Geneve options.
In order to work with Geneve options, we need to maintain a mapping
table between an option (defined by <class, type, length>) and
an NXM field that can be operated on for the purposes of matches,
actions, etc. This mapping must be explicitly specified by the
user.
Conceptually, this table could be communicated using either OpenFlow
or OVSDB. Using OVSDB requires less code and definition of extensions
than OpenFlow but introduces the possibility that mapping table
updates and flow modifications are desynchronized from each other.
This is dangerous because the mapping table signifcantly impacts the
way that flows using Geneve options are installed and processed by
OVS. Therefore, the mapping table is maintained using OpenFlow commands
instead, which opens the possibility of using synchronization between
table changes and flow modifications through barriers, bundles, etc.
There are two primary groups of OpenFlow messages that are introduced
as Nicira extensions: modification commands (add, delete, clear mappings)
and table status request/reply to dump the current table along with switch
information.
Note that mappings should not be changed while they are in active use by
a flow. The result of doing so is undefined.
This only adds the OpenFlow infrastructure but doesn't actually
do anything with the information yet after the messages have been
decoded.
Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2015-06-02 15:11:00 -07:00
|
|
|
|
break;
|
|
|
|
|
|
2015-12-16 02:47:50 +08:00
|
|
|
|
case OFPTYPE_NXT_TLV_TABLE_REPLY:
|
2018-01-04 22:40:01 -08:00
|
|
|
|
return ofp_print_tlv_table_reply(string, msg);
|
openflow: Table maintenance commands for Geneve options.
In order to work with Geneve options, we need to maintain a mapping
table between an option (defined by <class, type, length>) and
an NXM field that can be operated on for the purposes of matches,
actions, etc. This mapping must be explicitly specified by the
user.
Conceptually, this table could be communicated using either OpenFlow
or OVSDB. Using OVSDB requires less code and definition of extensions
than OpenFlow but introduces the possibility that mapping table
updates and flow modifications are desynchronized from each other.
This is dangerous because the mapping table signifcantly impacts the
way that flows using Geneve options are installed and processed by
OVS. Therefore, the mapping table is maintained using OpenFlow commands
instead, which opens the possibility of using synchronization between
table changes and flow modifications through barriers, bundles, etc.
There are two primary groups of OpenFlow messages that are introduced
as Nicira extensions: modification commands (add, delete, clear mappings)
and table status request/reply to dump the current table along with switch
information.
Note that mappings should not be changed while they are in active use by
a flow. The result of doing so is undefined.
This only adds the OpenFlow infrastructure but doesn't actually
do anything with the information yet after the messages have been
decoded.
Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2015-06-02 15:11:00 -07:00
|
|
|
|
|
Implement serializing the state of packet traversal in "continuations".
One purpose of OpenFlow packet-in messages is to allow a controller to
interpose on the path of a packet through the flow tables. If, for
example, the controller needs to modify a packet in some way that the
switch doesn't directly support, the controller should be able to
program the switch to send it the packet, then modify the packet and
send it back to the switch to continue through the flow table.
That's the theory. In practice, this doesn't work with any but the
simplest flow tables. Packet-in messages simply don't include enough
context to allow the flow table traversal to continue. For example:
* Via "resubmit" actions, an Open vSwitch packet can have an
effective "call stack", but a packet-in can't describe it, and
so it would be lost.
* A packet-in can't preserve the stack used by NXAST_PUSH and
NXAST_POP actions.
* A packet-in can't preserve the OpenFlow 1.1+ action set.
* A packet-in can't preserve the state of Open vSwitch mirroring
or connection tracking.
This commit introduces a solution called "continuations". A continuation
is the state of a packet's traversal through OpenFlow flow tables. A
"controller" action with the "pause" flag, which is newly implemented in
this commit, generates a continuation and sends it to the OpenFlow
controller in a packet-in asynchronous message (only NXT_PACKET_IN2
supports continuations, so the controller must configure them with
NXT_SET_PACKET_IN_FORMAT). The controller processes the packet-in,
possibly modifying some of its data, and sends it back to the switch with
an NXT_RESUME request, which causes flow table traversal to continue. In
principle, a single packet can be paused and resumed multiple times.
Another way to look at it is:
- "pause" is an extension of the existing OFPAT_CONTROLLER
action. It sends the packet to the controller, with full
pipeline context (some of which is switch implementation
dependent, and may thus vary from switch to switch).
- A continuation is an extension of OFPT_PACKET_IN, allowing for
implementation dependent metadata.
- NXT_RESUME is an extension of OFPT_PACKET_OUT, with the
semantics that the pipeline processing is continued with the
original translation context from where it was left at the time
it was paused.
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
2016-02-19 16:10:06 -08:00
|
|
|
|
case OFPTYPE_NXT_RESUME:
|
Support accepting and displaying table names in OVS tools.
OpenFlow has little-known support for naming tables. Open vSwitch has
supported table names for ages, but it has never used or displayed them
outside of commands dedicated to table manipulation. This commit adds
support for table names in ovs-ofctl. When a table has a name, it displays
that name in flows and actions, so that, for example, the following:
table=1, arp, actions=resubmit(,2)
might become:
table=ingress_acl, arp, actions=resubmit(,mac_learning)
given appropriately named tables.
For backward compatibility, only interactive ovs-ofctl commands by default
display table names; to display them in scripts, use the new --names
option.
This feature was inspired by a talk that Kei Nohguchi presented at Open
vSwitch 2017 Fall Conference.
CC: Kei Nohguchi <kei@nohguchi.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Mark Michelson <mmichels@redhat.com>
Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
2018-01-05 16:59:13 -08:00
|
|
|
|
return ofp_print_packet_in(string, msg, port_map, table_map,
|
|
|
|
|
verbosity);
|
ipfix: Add support for exporting ipfix statistics.
It is meaningful for user to check the stats of IPFIX.
Using IPFIX stats, user can know how much flows the system
can support. It is also can be used for performance check
of IPFIX.
IPFIX stats is added for per IPFIX exporter. If bridge IPFIX is
enabled on the bridge, the whole bridge will have one exporter.
For flow IPFIX, the system keeps per id (column in
Flow_Sample_Collector_Set) per exporter.
1) Add 'ovs-ofctl dump-ipfix-bridge SWITCH' to export IPFIX stats of
the bridge which enable bridge IPFIX. The output format:
NXST_IPFIX_BRIDGE reply (xid=0x2):
bridge ipfix: flows=0, current flows=0, sampled pkts=0, \
ipv4 ok=0, ipv6 ok=0, tx pkts=0
pkts errs=0, ipv4 errs=0, ipv6 errs=0, tx errs=0
2) Add 'ovs-ofctl dump-ipfix-flow SWITCH' to export IPFIX stats of
the bridge which enable flow IPFIX. The output format:
NXST_IPFIX_FLOW reply (xid=0x2): 2 ids
id 1: flows=4, current flows=4, sampled pkts=14, ipv4 ok=13, \
ipv6 ok=0, tx pkts=0
pkts errs=0, ipv4 errs=0, ipv6 errs=0, tx errs=0
id 2: flows=0, current flows=0, sampled pkts=0, ipv4 ok=0, \
ipv6 ok=0, tx pkts=0
pkts errs=0, ipv4 errs=0, ipv6 errs=0, tx errs=0
flows: the number of total flow records, including those exported.
current flows: the number of current flow records cached.
sampled pkts: Successfully sampled packet count.
ipv4 ok: successfully sampled IPv4 flow packet count.
ipv6 ok: Successfully sampled IPv6 flow packet count.
tx pkts: the count of IPFIX exported packets sent to the collector(s).
pkts errs: count of packets failed when sampling, maybe not supported or other error.
ipv4 errs: Count of IPV4 flow packet in the error packets.
ipv6 errs: Count of IPV6 flow packet in the error packets.
tx errs: the count of IPFIX exported packets failed when sending to the collector(s).
Signed-off-by: Benli Ye <daniely@vmware.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2016-06-13 14:44:09 -07:00
|
|
|
|
case OFPTYPE_IPFIX_BRIDGE_STATS_REQUEST:
|
|
|
|
|
break;
|
|
|
|
|
case OFPTYPE_IPFIX_BRIDGE_STATS_REPLY:
|
2018-01-04 22:40:01 -08:00
|
|
|
|
return ofp_print_nxst_ipfix_bridge_reply(string, oh);
|
ipfix: Add support for exporting ipfix statistics.
It is meaningful for user to check the stats of IPFIX.
Using IPFIX stats, user can know how much flows the system
can support. It is also can be used for performance check
of IPFIX.
IPFIX stats is added for per IPFIX exporter. If bridge IPFIX is
enabled on the bridge, the whole bridge will have one exporter.
For flow IPFIX, the system keeps per id (column in
Flow_Sample_Collector_Set) per exporter.
1) Add 'ovs-ofctl dump-ipfix-bridge SWITCH' to export IPFIX stats of
the bridge which enable bridge IPFIX. The output format:
NXST_IPFIX_BRIDGE reply (xid=0x2):
bridge ipfix: flows=0, current flows=0, sampled pkts=0, \
ipv4 ok=0, ipv6 ok=0, tx pkts=0
pkts errs=0, ipv4 errs=0, ipv6 errs=0, tx errs=0
2) Add 'ovs-ofctl dump-ipfix-flow SWITCH' to export IPFIX stats of
the bridge which enable flow IPFIX. The output format:
NXST_IPFIX_FLOW reply (xid=0x2): 2 ids
id 1: flows=4, current flows=4, sampled pkts=14, ipv4 ok=13, \
ipv6 ok=0, tx pkts=0
pkts errs=0, ipv4 errs=0, ipv6 errs=0, tx errs=0
id 2: flows=0, current flows=0, sampled pkts=0, ipv4 ok=0, \
ipv6 ok=0, tx pkts=0
pkts errs=0, ipv4 errs=0, ipv6 errs=0, tx errs=0
flows: the number of total flow records, including those exported.
current flows: the number of current flow records cached.
sampled pkts: Successfully sampled packet count.
ipv4 ok: successfully sampled IPv4 flow packet count.
ipv6 ok: Successfully sampled IPv6 flow packet count.
tx pkts: the count of IPFIX exported packets sent to the collector(s).
pkts errs: count of packets failed when sampling, maybe not supported or other error.
ipv4 errs: Count of IPV4 flow packet in the error packets.
ipv6 errs: Count of IPV6 flow packet in the error packets.
tx errs: the count of IPFIX exported packets failed when sending to the collector(s).
Signed-off-by: Benli Ye <daniely@vmware.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2016-06-13 14:44:09 -07:00
|
|
|
|
case OFPTYPE_IPFIX_FLOW_STATS_REQUEST:
|
|
|
|
|
break;
|
|
|
|
|
case OFPTYPE_IPFIX_FLOW_STATS_REPLY:
|
2018-01-04 22:40:01 -08:00
|
|
|
|
return ofp_print_nxst_ipfix_flow_reply(string, oh);
|
2016-08-18 14:09:41 -07:00
|
|
|
|
|
|
|
|
|
case OFPTYPE_CT_FLUSH_ZONE:
|
2018-01-04 22:40:01 -08:00
|
|
|
|
return ofp_print_nxt_ct_flush_zone(string, ofpmsg_body(oh));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
add_newline(struct ds *s)
|
|
|
|
|
{
|
|
|
|
|
if (s->length && s->string[s->length - 1] != '\n') {
|
|
|
|
|
ds_put_char(s, '\n');
|
2009-11-13 12:41:57 -08:00
|
|
|
|
}
|
2010-12-06 10:20:20 -08:00
|
|
|
|
}
|
2009-07-08 13:19:16 -07:00
|
|
|
|
|
|
|
|
|
/* Composes and returns a string representing the OpenFlow packet of 'len'
|
|
|
|
|
* bytes at 'oh' at the given 'verbosity' level. 0 is a minimal amount of
|
|
|
|
|
* verbosity and higher numbers increase verbosity. The caller is responsible
|
|
|
|
|
* for freeing the string. */
|
|
|
|
|
char *
|
2017-05-31 16:06:12 -07:00
|
|
|
|
ofp_to_string(const void *oh_, size_t len,
|
Support accepting and displaying table names in OVS tools.
OpenFlow has little-known support for naming tables. Open vSwitch has
supported table names for ages, but it has never used or displayed them
outside of commands dedicated to table manipulation. This commit adds
support for table names in ovs-ofctl. When a table has a name, it displays
that name in flows and actions, so that, for example, the following:
table=1, arp, actions=resubmit(,2)
might become:
table=ingress_acl, arp, actions=resubmit(,mac_learning)
given appropriately named tables.
For backward compatibility, only interactive ovs-ofctl commands by default
display table names; to display them in scripts, use the new --names
option.
This feature was inspired by a talk that Kei Nohguchi presented at Open
vSwitch 2017 Fall Conference.
CC: Kei Nohguchi <kei@nohguchi.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Mark Michelson <mmichels@redhat.com>
Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
2018-01-05 16:59:13 -08:00
|
|
|
|
const struct ofputil_port_map *port_map,
|
|
|
|
|
const struct ofputil_table_map *table_map,
|
|
|
|
|
int verbosity)
|
2009-07-08 13:19:16 -07:00
|
|
|
|
{
|
|
|
|
|
struct ds string = DS_EMPTY_INITIALIZER;
|
|
|
|
|
const struct ofp_header *oh = oh_;
|
|
|
|
|
|
2010-12-13 16:27:20 -08:00
|
|
|
|
if (!len) {
|
|
|
|
|
ds_put_cstr(&string, "OpenFlow message is empty\n");
|
|
|
|
|
} else if (len < sizeof(struct ofp_header)) {
|
2013-11-25 23:38:48 -08:00
|
|
|
|
ds_put_format(&string, "OpenFlow packet too short (only %"PRIuSIZE" bytes):\n",
|
2010-12-13 16:27:20 -08:00
|
|
|
|
len);
|
2010-12-06 10:20:20 -08:00
|
|
|
|
} else if (ntohs(oh->length) > len) {
|
2012-05-23 09:33:22 -07:00
|
|
|
|
enum ofperr error;
|
2012-07-19 23:23:17 -07:00
|
|
|
|
enum ofpraw raw;
|
2012-05-23 09:33:22 -07:00
|
|
|
|
|
2012-07-19 23:23:17 -07:00
|
|
|
|
error = ofpraw_decode_partial(&raw, oh, len);
|
2012-05-23 09:33:22 -07:00
|
|
|
|
if (!error) {
|
2012-07-19 23:23:17 -07:00
|
|
|
|
ofp_header_to_string__(oh, raw, &string);
|
2012-05-23 09:33:22 -07:00
|
|
|
|
ds_put_char(&string, '\n');
|
|
|
|
|
}
|
|
|
|
|
|
2010-12-06 10:20:20 -08:00
|
|
|
|
ds_put_format(&string,
|
2013-11-25 23:38:48 -08:00
|
|
|
|
"(***truncated to %"PRIuSIZE" bytes from %"PRIu16"***)\n",
|
2010-12-06 10:20:20 -08:00
|
|
|
|
len, ntohs(oh->length));
|
|
|
|
|
} else if (ntohs(oh->length) < len) {
|
|
|
|
|
ds_put_format(&string,
|
2013-11-25 23:38:48 -08:00
|
|
|
|
"(***only uses %"PRIu16" bytes out of %"PRIuSIZE"***)\n",
|
2010-12-06 10:20:20 -08:00
|
|
|
|
ntohs(oh->length), len);
|
|
|
|
|
} else {
|
2012-01-12 15:48:19 -08:00
|
|
|
|
enum ofperr error;
|
2012-07-19 23:23:17 -07:00
|
|
|
|
enum ofpraw raw;
|
2010-12-06 10:20:20 -08:00
|
|
|
|
|
2012-07-19 23:23:17 -07:00
|
|
|
|
error = ofpraw_decode(&raw, oh);
|
2010-12-06 10:20:20 -08:00
|
|
|
|
if (!error) {
|
2018-01-04 22:40:01 -08:00
|
|
|
|
ofp_header_to_string__(oh, raw, &string);
|
|
|
|
|
size_t header_len = string.length;
|
|
|
|
|
|
Support accepting and displaying table names in OVS tools.
OpenFlow has little-known support for naming tables. Open vSwitch has
supported table names for ages, but it has never used or displayed them
outside of commands dedicated to table manipulation. This commit adds
support for table names in ovs-ofctl. When a table has a name, it displays
that name in flows and actions, so that, for example, the following:
table=1, arp, actions=resubmit(,2)
might become:
table=ingress_acl, arp, actions=resubmit(,mac_learning)
given appropriately named tables.
For backward compatibility, only interactive ovs-ofctl commands by default
display table names; to display them in scripts, use the new --names
option.
This feature was inspired by a talk that Kei Nohguchi presented at Open
vSwitch 2017 Fall Conference.
CC: Kei Nohguchi <kei@nohguchi.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Mark Michelson <mmichels@redhat.com>
Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
2018-01-05 16:59:13 -08:00
|
|
|
|
error = ofp_to_string__(oh, port_map, table_map,
|
|
|
|
|
raw, &string, verbosity);
|
2018-01-04 22:40:01 -08:00
|
|
|
|
if (error) {
|
|
|
|
|
if (string.length > header_len) {
|
|
|
|
|
ds_chomp(&string, ' ');
|
|
|
|
|
add_newline(&string);
|
|
|
|
|
} else {
|
|
|
|
|
ds_put_char(&string, ' ');
|
2010-12-07 13:22:46 -08:00
|
|
|
|
}
|
2018-01-04 22:40:01 -08:00
|
|
|
|
ofp_print_error(&string, error);
|
|
|
|
|
} else {
|
|
|
|
|
ds_chomp(&string, ' ');
|
2010-12-06 10:20:20 -08:00
|
|
|
|
}
|
2018-01-04 22:40:01 -08:00
|
|
|
|
} else {
|
|
|
|
|
ofp_print_error(&string, error);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (verbosity >= 5 || error) {
|
|
|
|
|
add_newline(&string);
|
|
|
|
|
ds_put_hex_dump(&string, oh, len, 0, true);
|
2009-07-08 13:19:16 -07:00
|
|
|
|
}
|
|
|
|
|
|
2018-01-04 22:40:01 -08:00
|
|
|
|
add_newline(&string);
|
|
|
|
|
return ds_steal_cstr(&string);
|
2009-07-08 13:19:16 -07:00
|
|
|
|
}
|
2010-12-06 10:20:20 -08:00
|
|
|
|
ds_put_hex_dump(&string, oh, len, 0, true);
|
|
|
|
|
return ds_steal_cstr(&string);
|
2009-07-08 13:19:16 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2010-08-30 00:24:53 -07:00
|
|
|
|
print_and_free(FILE *stream, char *string)
|
2009-07-08 13:19:16 -07:00
|
|
|
|
{
|
|
|
|
|
fputs(string, stream);
|
|
|
|
|
free(string);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Pretty-print the OpenFlow packet of 'len' bytes at 'oh' to 'stream' at the
|
|
|
|
|
* given 'verbosity' level. 0 is a minimal amount of verbosity and higher
|
|
|
|
|
* numbers increase verbosity. */
|
|
|
|
|
void
|
2017-05-31 16:06:12 -07:00
|
|
|
|
ofp_print(FILE *stream, const void *oh, size_t len,
|
Support accepting and displaying table names in OVS tools.
OpenFlow has little-known support for naming tables. Open vSwitch has
supported table names for ages, but it has never used or displayed them
outside of commands dedicated to table manipulation. This commit adds
support for table names in ovs-ofctl. When a table has a name, it displays
that name in flows and actions, so that, for example, the following:
table=1, arp, actions=resubmit(,2)
might become:
table=ingress_acl, arp, actions=resubmit(,mac_learning)
given appropriately named tables.
For backward compatibility, only interactive ovs-ofctl commands by default
display table names; to display them in scripts, use the new --names
option.
This feature was inspired by a talk that Kei Nohguchi presented at Open
vSwitch 2017 Fall Conference.
CC: Kei Nohguchi <kei@nohguchi.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Mark Michelson <mmichels@redhat.com>
Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
2018-01-05 16:59:13 -08:00
|
|
|
|
const struct ofputil_port_map *port_map,
|
|
|
|
|
const struct ofputil_table_map *table_map, int verbosity)
|
2009-07-08 13:19:16 -07:00
|
|
|
|
{
|
Support accepting and displaying table names in OVS tools.
OpenFlow has little-known support for naming tables. Open vSwitch has
supported table names for ages, but it has never used or displayed them
outside of commands dedicated to table manipulation. This commit adds
support for table names in ovs-ofctl. When a table has a name, it displays
that name in flows and actions, so that, for example, the following:
table=1, arp, actions=resubmit(,2)
might become:
table=ingress_acl, arp, actions=resubmit(,mac_learning)
given appropriately named tables.
For backward compatibility, only interactive ovs-ofctl commands by default
display table names; to display them in scripts, use the new --names
option.
This feature was inspired by a talk that Kei Nohguchi presented at Open
vSwitch 2017 Fall Conference.
CC: Kei Nohguchi <kei@nohguchi.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Mark Michelson <mmichels@redhat.com>
Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
2018-01-05 16:59:13 -08:00
|
|
|
|
print_and_free(stream, ofp_to_string(oh, len, port_map, table_map,
|
|
|
|
|
verbosity));
|
2009-07-08 13:19:16 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Dumps the contents of the Ethernet frame in the 'len' bytes starting at
|
2011-12-21 12:59:28 -08:00
|
|
|
|
* 'data' to 'stream'. */
|
2009-07-08 13:19:16 -07:00
|
|
|
|
void
|
2017-04-25 16:29:59 +00:00
|
|
|
|
ofp_print_packet(FILE *stream, const void *data, size_t len,
|
|
|
|
|
ovs_be32 packet_type)
|
|
|
|
|
{
|
|
|
|
|
print_and_free(stream, ofp_packet_to_string(data, len, packet_type));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
ofp_print_dp_packet(FILE *stream, const struct dp_packet *packet)
|
2009-07-08 13:19:16 -07:00
|
|
|
|
{
|
2017-04-25 16:29:59 +00:00
|
|
|
|
print_and_free(stream, ofp_dp_packet_to_string(packet));
|
2009-07-08 13:19:16 -07:00
|
|
|
|
}
|