summaryrefslogtreecommitdiff
path: root/utilities
diff options
context:
space:
mode:
authorWilliam Tu <u9012063@gmail.com>2019-10-04 13:48:58 -0700
committerWilliam Tu <u9012063@gmail.com>2019-11-21 09:19:59 -0800
commit27501802d09f782b8133031c1eae3394ae5ce147 (patch)
tree93fa74d893f9a0b57cd86eeed9504044a87e424c /utilities
parentacb691e15e3110bd2c063c740ae8d9a5e271238d (diff)
downloadopenvswitch-27501802d09f782b8133031c1eae3394ae5ce147.tar.gz
ofproto-dpif: Expose datapath capability to ovsdb.
The patch adds support for fetching the datapath's capabilities from the result of 'check_support()', and write the supported capability to a new database column, called 'capabilities' under Datapath table. To see how it works, run: # ovs-vsctl -- add-br br0 -- set Bridge br0 datapath_type=netdev # ovs-vsctl -- --id=@m create Datapath datapath_version=0 \ 'ct_zones={}' 'capabilities={}' \ -- set Open_vSwitch . datapaths:"netdev"=@m # ovs-vsctl list-dp-cap netdev ufid=true sample_nesting=true clone=true tnl_push_pop=true \ ct_orig_tuple=true ct_eventmask=true ct_state=true \ ct_clear=true max_vlan_headers=1 recirc=true ct_label=true \ max_hash_alg=1 ct_state_nat=true ct_timeout=true \ ct_mark=true ct_orig_tuple6=true check_pkt_len=true \ masked_set_action=true max_mpls_depth=3 trunc=true ct_zone=true Signed-off-by: William Tu <u9012063@gmail.com> Tested-by: Greg Rose <gvrose8192@gmail.com> Reviewed-by: Greg Rose <gvrose8192@gmail.com> --- v5: Add improved documentation from Ben and fix checkpatch error (tab and line 79 char) v4: rebase to master v3: fix 32-bit build, reported by Greg travis: https://travis-ci.org/williamtu/ovs-travis/builds/599276267 v2: rebase to master
Diffstat (limited to 'utilities')
-rw-r--r--utilities/ovs-vsctl.8.in6
-rw-r--r--utilities/ovs-vsctl.c28
2 files changed, 34 insertions, 0 deletions
diff --git a/utilities/ovs-vsctl.8.in b/utilities/ovs-vsctl.8.in
index 14a8aa4a4..ff97922dd 100644
--- a/utilities/ovs-vsctl.8.in
+++ b/utilities/ovs-vsctl.8.in
@@ -379,6 +379,12 @@ delete a zone that does not exist has no effect.
.IP "\fBlist\-zone\-tp \fIdatapath\fR"
Prints the timeout policies of all zones in \fIdatapath\fR.
.
+.SS "Datapath Capabilities Command"
+The command query datapath capabilities.
+.
+.IP "\fBlist\-dp\-cap \fIdatapath\fR"
+Prints the datapath's capabilities.
+.
.SS "OpenFlow Controller Connectivity"
.
\fBovs\-vswitchd\fR can perform all configured bridging and switching
diff --git a/utilities/ovs-vsctl.c b/utilities/ovs-vsctl.c
index 7232471e6..bd3972636 100644
--- a/utilities/ovs-vsctl.c
+++ b/utilities/ovs-vsctl.c
@@ -1363,6 +1363,31 @@ pre_get_zone(struct ctl_context *ctx)
}
static void
+pre_get_dp_cap(struct ctl_context *ctx)
+{
+ ovsdb_idl_add_column(ctx->idl, &ovsrec_open_vswitch_col_datapaths);
+ ovsdb_idl_add_column(ctx->idl, &ovsrec_datapath_col_capabilities);
+}
+
+static void
+cmd_list_dp_cap(struct ctl_context *ctx)
+{
+ struct vsctl_context *vsctl_ctx = vsctl_context_cast(ctx);
+ struct smap_node *node;
+
+ struct ovsrec_datapath *dp = find_datapath(vsctl_ctx, ctx->argv[1]);
+ if (!dp) {
+ ctl_fatal("datapath \"%s\" record not found", ctx->argv[1]);
+ }
+
+ SMAP_FOR_EACH (node, &dp->capabilities) {
+ ds_put_format(&ctx->output, "%s=%s ",node->key, node->value);
+ }
+ ds_chomp(&ctx->output, ' ');
+ ds_put_char(&ctx->output, '\n');
+}
+
+static void
cmd_add_br(struct ctl_context *ctx)
{
struct vsctl_context *vsctl_ctx = vsctl_context_cast(ctx);
@@ -3112,6 +3137,9 @@ static const struct ctl_command_syntax vsctl_commands[] = {
"--if-exists", RW},
{"list-zone-tp", 1, 1, "", pre_get_zone, cmd_list_zone_tp, NULL, "", RO},
+ /* Datapath capabilities. */
+ {"list-dp-cap", 1, 1, "", pre_get_dp_cap, cmd_list_dp_cap, NULL, "", RO},
+
{NULL, 0, 0, NULL, NULL, NULL, NULL, NULL, RO},
};