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 <b...@nicira.com> --- 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 @@ <dd> Lists all existing switches on standard output, one per line. </dd> - - <dt><code>lswitch-set-external-id</code> <var>lswitch</var> <var>key</var> [<var>value</var>]</dt> - <dd> - <p>Sets or clears an ``external ID'' value on <var>lswitch</var>. - These values are intended to identify entities external to OVN - with which <var>lswitch</var> is associated. The OVN Northbound - database schema may specify well-known <var>key</var> values, - but <var>key</var> and <var>value</var> are otherwise arbitrary - strings.</p> - - <p>If <var>value</var> is specified, then <var>key</var> is set to - <var>value</var> for <var>lswitch</var>, overwriting any - previous value. If <var>value</var> is omitted, then - <var>key</var> is removed from <var>lswitch</var>'s set of - external IDs (if it was present.</p> - </dd> - - <dt><code>lswitch-get-external-id</code> <var>lswitch</var> [<var>key</var>]</dt> - <dd> - Queries the external IDs on <var>lswitch</var>. If - <var>key</var> is specified, the output is the value for that - <var>key</var> or the empty string if <var>key</var> is unset. - If <var>key</var> is omitted, the output is - <var>key</var><code>=</code><var>value</var>, one per line, for - each key-value pair. - </dd> </dl> <h1>ACL Commands</h1> @@ -135,32 +109,6 @@ nothing. </dd> - <dt><code>lport-set-external-id</code> <var>lport</var> <var>key</var> [<var>value</var>]</dt> - <dd> - <p>Sets or clears an ``external ID'' value on <var>lport</var>. - These values are intended to identify entities external to OVN - with which <var>lport</var> is associated. The OVN Northbound - database schema may specify well-known <var>key</var> values, - but <var>key</var> and <var>value</var> are otherwise arbitrary - strings.</p> - - <p>If <var>value</var> is specified, then <var>key</var> is set to - <var>value</var> for <var>lport</var>, overwriting any - previous value. If <var>value</var> is omitted, then - <var>key</var> is removed from <var>lport</var>'s set of - external IDs (if it was present.</p> - </dd> - - <dt><code>lport-get-external-id</code> <var>lport</var> [<var>key</var>]</dt> - <dd> - Queries the external IDs on <var>lport</var>. If - <var>key</var> is specified, the output is the value for that - <var>key</var> or the empty string if <var>key</var> is unset. - If <var>key</var> is omitted, the output is - <var>key</var><code>=</code><var>value</var>, one per line, for - each key-value pair. - </dd> - <dt><code>lport-set-macs</code> <var>lport</var> [<var>mac</var>]...</dt> <dd> Sets the MACs associated with <var>lport</var> 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, -- 2.1.3 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev