I don't have a particular use for this but it allows ovsdb-client to do all the things with schemas that ovsdb-tool can.
Signed-off-by: Ben Pfaff <[email protected]> --- NEWS | 1 + ovsdb/ovsdb-client.c | 13 +++++++++++++ tests/ovsdb-client.at | 4 +++- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index be9884eadeb9..49d2fa597b97 100644 --- a/NEWS +++ b/NEWS @@ -5,6 +5,7 @@ Post-v2.8.0 * New high-level documentation in ovsdb(7). * New file format documentation for developers in ovsdb(5). * Protocol documentation moved from ovsdb-server(1) to ovsdb-server(7). + * ovsdb-client: New "get-schema-cksum" command. - OVN: * The "requested-chassis" option for a logical switch port now accepts a chassis "hostname" in addition to a chassis "name". diff --git a/ovsdb/ovsdb-client.c b/ovsdb/ovsdb-client.c index 7d90183843ee..c37302ef96f6 100644 --- a/ovsdb/ovsdb-client.c +++ b/ovsdb/ovsdb-client.c @@ -251,6 +251,9 @@ usage(void) "\n get-schema-version [SERVER] [DATABASE]\n" " retrieve schema for DATABASE from SERVER and report only its\n" " version number on stdout\n" + "\n get-schema-cksum [SERVER] [DATABASE]\n" + " retrieve schema for DATABASE from SERVER and report only its\n" + " checksum on stdout\n" "\n list-tables [SERVER] [DATABASE]\n" " list tables for DATABASE on SERVER\n" "\n list-columns [SERVER] [DATABASE] [TABLE]\n" @@ -448,6 +451,15 @@ do_get_schema_version(struct jsonrpc *rpc, const char *database, } static void +do_get_schema_cksum(struct jsonrpc *rpc, const char *database, + int argc OVS_UNUSED, char *argv[] OVS_UNUSED) +{ + struct ovsdb_schema *schema = fetch_schema(rpc, database); + puts(schema->cksum); + ovsdb_schema_destroy(schema); +} + +static void do_list_tables(struct jsonrpc *rpc, const char *database, int argc OVS_UNUSED, char *argv[] OVS_UNUSED) { @@ -1575,6 +1587,7 @@ static const struct ovsdb_client_command all_commands[] = { { "list-dbs", NEED_RPC, 0, 0, do_list_dbs }, { "get-schema", NEED_DATABASE, 0, 0, do_get_schema }, { "get-schema-version", NEED_DATABASE, 0, 0, do_get_schema_version }, + { "get-schema-cksum", NEED_DATABASE, 0, 0, do_get_schema_cksum }, { "list-tables", NEED_DATABASE, 0, 0, do_list_tables }, { "list-columns", NEED_DATABASE, 0, 1, do_list_columns }, { "transact", NEED_RPC, 1, 1, do_transact }, diff --git a/tests/ovsdb-client.at b/tests/ovsdb-client.at index 0f787fac851c..903929550ec2 100644 --- a/tests/ovsdb-client.at +++ b/tests/ovsdb-client.at @@ -1,11 +1,13 @@ AT_BANNER([OVSDB -- ovsdb-client commands]) -AT_SETUP([ovsdb-client get-schema-version]) +AT_SETUP([ovsdb-client get-schema-version and get-schema-cksum]) AT_KEYWORDS([ovsdb client positive]) ordinal_schema > schema AT_CHECK([ovsdb-tool create db schema], [0], [ignore], [ignore]) AT_CHECK([ovsdb-server --detach --no-chdir --pidfile --remote=punix:socket db], [0], [ignore], [ignore]) AT_CHECK([ovsdb-client get-schema-version unix:socket ordinals], [0], [5.1.3 ]) +AT_CHECK([ovsdb-client get-schema-cksum unix:socket ordinals], [0], [12345678 9 +]) OVSDB_SERVER_SHUTDOWN AT_CLEANUP -- 2.10.2 _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
