From patchwork Sat Oct 10 04:15:25 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Pfaff X-Patchwork-Id: 528524 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from archives.nicira.com (unknown [IPv6:2600:3c00::f03c:91ff:fe6e:bdf7]) by ozlabs.org (Postfix) with ESMTP id AF10A140E3D for ; Sat, 10 Oct 2015 15:16:19 +1100 (AEDT) Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id 03E9810B04; Fri, 9 Oct 2015 21:16:00 -0700 (PDT) X-Original-To: dev@openvswitch.org Delivered-To: dev@openvswitch.org Received: from mx3v1.cudamail.com (mx3.cudamail.com [64.34.241.5]) by archives.nicira.com (Postfix) with ESMTPS id B231E10B02 for ; Fri, 9 Oct 2015 21:15:57 -0700 (PDT) Received: from bar4.cudamail.com (bar2 [192.168.15.2]) by mx3v1.cudamail.com (Postfix) with ESMTP id 3B879619817 for ; Fri, 9 Oct 2015 22:15:57 -0600 (MDT) X-ASG-Debug-ID: 1444450556-03dc213abc8e770001-byXFYA Received: from mx3-pf2.cudamail.com ([192.168.14.1]) by bar4.cudamail.com with ESMTP id 7XB2RTZ3WOvnB7Cd (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Fri, 09 Oct 2015 22:15:56 -0600 (MDT) X-Barracuda-Envelope-From: blp@nicira.com X-Barracuda-RBL-Trusted-Forwarder: 192.168.14.1 Received: from unknown (HELO mail-pa0-f44.google.com) (209.85.220.44) by mx3-pf2.cudamail.com with ESMTPS (RC4-SHA encrypted); 10 Oct 2015 04:15:55 -0000 Received-SPF: unknown (mx3-pf2.cudamail.com: Multiple SPF records returned) X-Barracuda-RBL-Trusted-Forwarder: 209.85.220.44 Received: by pabve7 with SMTP id ve7so45409351pab.2 for ; Fri, 09 Oct 2015 21:15:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Zp9mGtmwTOw1m9PK6XRSwAr1LdF3UQ0zJoq40wcf8dE=; b=ZtYatuCQs3VWuXFyzDfmRplpAuwsZuF3/C8ufaPqz9j8w5xfCvXPHMQT14lreSwL9q twYJjEH5VNeDwr5rYP12NFApof9XEE4LW5qytRwsIQMLg6ymCAuct1NyXfcl3kdJzXUR FulwJqmdU0kFDC90rMur23sGj1Ayv9cxLXV/aK2lUIXHZ/W5a+wnYq0RhdOqGElzeOup vavej8p00ZpjosBAJWgul+4rFcobmg/beZN0U7r1jVYxz9Yj7+ib7zO665jmTtF2sc1d qzlN7TtK7zsGB7II5q0V729XkF/Da2Eag2ktEcz0siKn3sUwJOvMTguIpn4QS+lDqFYS 7gwg== X-Gm-Message-State: ALoCoQnkz4T6KZHIPqt7SYVktZ3fYNVghxssYM15EFuFuB6ErxSS3vfZTnjmgKu1OAB+3VyoKNtW X-Received: by 10.67.7.71 with SMTP id da7mr19951223pad.69.1444450555700; Fri, 09 Oct 2015 21:15:55 -0700 (PDT) Received: from sigabrt.gateway.sonic.net (173-228-112-112.dsl.dynamic.fusionbroadband.com. [173.228.112.112]) by smtp.gmail.com with ESMTPSA id bk8sm5386937pad.18.2015.10.09.21.15.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 09 Oct 2015 21:15:54 -0700 (PDT) X-CudaMail-Envelope-Sender: blp@nicira.com X-Barracuda-Apparent-Source-IP: 173.228.112.112 From: Ben Pfaff To: dev@openvswitch.org X-CudaMail-Whitelist-To: dev@openvswitch.org X-CudaMail-MID: CM-V2-1008076602 X-CudaMail-DTE: 100915 X-CudaMail-Originating-IP: 209.85.220.44 Date: Fri, 9 Oct 2015 21:15:25 -0700 X-ASG-Orig-Subj: [##CM-V2-1008076602##][PATCH 04/23] ovn-nbctl: Remove external-ids commands. Message-Id: <1444450544-11845-5-git-send-email-blp@nicira.com> X-Mailer: git-send-email 2.1.3 In-Reply-To: <1444450544-11845-1-git-send-email-blp@nicira.com> References: <1444450544-11845-1-git-send-email-blp@nicira.com> X-Barracuda-Connect: UNKNOWN[192.168.14.1] X-Barracuda-Start-Time: 1444450556 X-Barracuda-Encrypted: DHE-RSA-AES256-SHA X-Barracuda-URL: https://web.cudamail.com:443/cgi-mod/mark.cgi X-ASG-Whitelist: Header =?UTF-8?B?eFwtY3VkYW1haWxcLXdoaXRlbGlzdFwtdG8=?= X-Virus-Scanned: by bsmtpd at cudamail.com X-Barracuda-BRTS-Status: 1 Cc: Ben Pfaff Subject: [ovs-dev] [PATCH 04/23] ovn-nbctl: Remove external-ids commands. X-BeenThere: dev@openvswitch.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dev-bounces@openvswitch.org Sender: "dev" Users are served just as well through the general-purpose "set" and "get" database commands, so avoid the additional code and documentation. (ovs-vsctl does have special external-ids commands for bridges, but those exist because of special handling for "fake bridges".) Signed-off-by: Ben Pfaff Acked-by: Justin Pettit --- ovn/utilities/ovn-nbctl.8.xml | 52 ----------------- ovn/utilities/ovn-nbctl.c | 126 ------------------------------------------ 2 files changed, 178 deletions(-) diff --git a/ovn/utilities/ovn-nbctl.8.xml b/ovn/utilities/ovn-nbctl.8.xml index 83245f0..1526e61 100644 --- a/ovn/utilities/ovn-nbctl.8.xml +++ b/ovn/utilities/ovn-nbctl.8.xml @@ -38,32 +38,6 @@
Lists all existing switches on standard output, one per line.
- -
lswitch-set-external-id lswitch key [value]
-
-

Sets or clears an ``external ID'' value on lswitch. - These values are intended to identify entities external to OVN - with which lswitch is associated. The OVN Northbound - database schema may specify well-known key values, - but key and value are otherwise arbitrary - strings.

- -

If value is specified, then key is set to - value for lswitch, overwriting any - previous value. If value is omitted, then - key is removed from lswitch's set of - external IDs (if it was present.

-
- -
lswitch-get-external-id lswitch [key]
-
- Queries the external IDs on lswitch. If - key is specified, the output is the value for that - key or the empty string if key is unset. - If key is omitted, the output is - key=value, one per line, for - each key-value pair. -

ACL Commands

@@ -135,32 +109,6 @@ nothing. -
lport-set-external-id lport key [value]
-
-

Sets or clears an ``external ID'' value on lport. - These values are intended to identify entities external to OVN - with which lport is associated. The OVN Northbound - database schema may specify well-known key values, - but key and value are otherwise arbitrary - strings.

- -

If value is specified, then key is set to - value for lport, overwriting any - previous value. If value is omitted, then - key is removed from lport's set of - external IDs (if it was present.

-
- -
lport-get-external-id lport [key]
-
- Queries the external IDs on lport. If - key is specified, the output is the value for that - key or the empty string if key is unset. - If key is omitted, the output is - key=value, one per line, for - each key-value pair. -
-
lport-set-macs lport [mac]...
Sets the MACs associated with lport to diff --git a/ovn/utilities/ovn-nbctl.c b/ovn/utilities/ovn-nbctl.c index 1d8f745..9a274fb 100644 --- a/ovn/utilities/ovn-nbctl.c +++ b/ovn/utilities/ovn-nbctl.c @@ -294,10 +294,6 @@ Logical switch commands:\n\ lswitch-add [LSWITCH] create a logical switch named LSWITCH\n\ lswitch-del LSWITCH delete LSWITCH and all its ports\n\ lswitch-list print the names of all logical switches\n\ - lswitch-set-external-id LSWITCH KEY [VALUE]\n\ - set or delete an external-id on LSWITCH\n\ - lswitch-get-external-id LSWITCH [KEY]\n\ - list one or all external-ids on LSWITCH\n\ \n\ ACL commands:\n\ acl-add LSWITCH DIRECTION PRIORITY MATCH ACTION [log]\n\ @@ -315,10 +311,6 @@ Logical port commands:\n\ lport-list LSWITCH print the names of all logical ports on LSWITCH\n\ lport-get-parent LPORT get the parent of LPORT if set\n\ lport-get-tag LPORT get the LPORT's tag if set\n\ - lport-set-external-id LPORT KEY [VALUE]\n\ - set or delete an external-id on LPORT\n\ - lport-get-external-id LPORT [KEY]\n\ - list one or all external-ids on LPORT\n\ lport-set-macs LPORT [MAC]...\n\ set MAC addresses for LPORT.\n\ lport-get-macs LPORT get a list of MAC addresses on LPORT\n\ @@ -481,61 +473,6 @@ nbctl_lswitch_list(struct ctl_context *ctx) smap_destroy(&lswitches); free(nodes); } - -static void -nbctl_lswitch_set_external_id(struct ctl_context *ctx) -{ - const char *id = ctx->argv[1]; - const struct nbrec_logical_switch *lswitch; - struct smap new_external_ids; - - lswitch = lswitch_by_name_or_uuid(ctx, id); - if (!lswitch) { - return; - } - - smap_init(&new_external_ids); - smap_clone(&new_external_ids, &lswitch->external_ids); - if (ctx->argc == 4) { - smap_replace(&new_external_ids, ctx->argv[2], ctx->argv[3]); - } else { - smap_remove(&new_external_ids, ctx->argv[2]); - } - nbrec_logical_switch_set_external_ids(lswitch, &new_external_ids); - smap_destroy(&new_external_ids); -} - -static void -nbctl_lswitch_get_external_id(struct ctl_context *ctx) -{ - const char *id = ctx->argv[1]; - const struct nbrec_logical_switch *lswitch; - - lswitch = lswitch_by_name_or_uuid(ctx, id); - if (!lswitch) { - return; - } - - if (ctx->argc == 3) { - const char *key = ctx->argv[2]; - const char *value; - - /* List one external ID */ - - value = smap_get(&lswitch->external_ids, key); - if (value) { - ds_put_format(&ctx->output, "%s\n", value); - } - } else { - struct smap_node *node; - - /* List all external IDs */ - - SMAP_FOR_EACH(node, &lswitch->external_ids) { - ds_put_format(&ctx->output, "%s=%s\n", node->key, node->value); - } - } -} static const struct nbrec_logical_port * lport_by_name_or_uuid(struct ctl_context *ctx, const char *id) @@ -715,61 +652,6 @@ nbctl_lport_get_tag(struct ctl_context *ctx) } static void -nbctl_lport_set_external_id(struct ctl_context *ctx) -{ - const char *id = ctx->argv[1]; - const struct nbrec_logical_port *lport; - struct smap new_external_ids; - - lport = lport_by_name_or_uuid(ctx, id); - if (!lport) { - return; - } - - smap_init(&new_external_ids); - smap_clone(&new_external_ids, &lport->external_ids); - if (ctx->argc == 4) { - smap_replace(&new_external_ids, ctx->argv[2], ctx->argv[3]); - } else { - smap_remove(&new_external_ids, ctx->argv[2]); - } - nbrec_logical_port_set_external_ids(lport, &new_external_ids); - smap_destroy(&new_external_ids); -} - -static void -nbctl_lport_get_external_id(struct ctl_context *ctx) -{ - const char *id = ctx->argv[1]; - const struct nbrec_logical_port *lport; - - lport = lport_by_name_or_uuid(ctx, id); - if (!lport) { - return; - } - - if (ctx->argc == 3) { - const char *key = ctx->argv[2]; - const char *value; - - /* List one external ID */ - - value = smap_get(&lport->external_ids, key); - if (value) { - ds_put_format(&ctx->output, "%s\n", value); - } - } else { - struct smap_node *node; - - /* List all external IDs */ - - SMAP_FOR_EACH(node, &lport->external_ids) { - ds_put_format(&ctx->output, "%s=%s\n", node->key, node->value); - } - } -} - -static void nbctl_lport_set_macs(struct ctl_context *ctx) { const char *id = ctx->argv[1]; @@ -1409,10 +1291,6 @@ static const struct ctl_command_syntax nbctl_commands[] = { { "lswitch-del", 1, 1, "LSWITCH", NULL, nbctl_lswitch_del, NULL, "", RW }, { "lswitch-list", 0, 0, "", NULL, nbctl_lswitch_list, NULL, "", RO }, - { "lswitch-set-external-id", 2, 3, "LSWITCH KEY [VALUE]", NULL, - nbctl_lswitch_set_external_id, NULL, "", RW }, - { "lswitch-get-external-id", 1, 2, "LSWITCH [KEY]", NULL, - nbctl_lswitch_get_external_id, NULL, "", RO }, /* acl commands. */ { "acl-add", 5, 5, "LSWITCH DIRECTION PRIORITY MATCH ACTION", NULL, @@ -1430,10 +1308,6 @@ static const struct ctl_command_syntax nbctl_commands[] = { "", RO }, { "lport-get-tag", 1, 1, "LPORT", NULL, nbctl_lport_get_tag, NULL, "", RO }, - { "lport-set-external-id", 2, 3, "LPORT KEY [VALUE]", NULL, - nbctl_lport_set_external_id, NULL, "", RW }, - { "lport-get-external-id", 1, 2, "LPORT [KEY]", NULL, - nbctl_lport_get_external_id, NULL, "", RO }, { "lport-set-macs", 1, INT_MAX, "LPORT [MAC]...", NULL, nbctl_lport_set_macs, NULL, "", RW }, { "lport-get-macs", 1, 1, "LPORT", NULL, nbctl_lport_get_macs, NULL,