From 30f41d5fc5f8f4410a187f7562091bae538316c8 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Tue, 6 Oct 2015 22:11:44 -0700 Subject: [PATCH] ovn-nbctl: Remove external-ids commands. 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 1a93aa3ac..102e97cb9 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 1d8f7456e..9a274fb62 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) @@ -714,61 +651,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) { @@ -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, -- 2.20.1