X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=tests%2Ftest-ovsdb.py;h=1350ccdef4d6f4ece0aa8d3e392e2049a808ecac;hb=e0edde6fee279cdbbf3c179f5f50adaf0c7c7f1e;hp=df29fdb0503f5b2bff2900728e2d9ce9498e1e49;hpb=26bb0f31299d3f8eb06551d6a219846929c27149;p=sliver-openvswitch.git diff --git a/tests/test-ovsdb.py b/tests/test-ovsdb.py index df29fdb05..1350ccdef 100644 --- a/tests/test-ovsdb.py +++ b/tests/test-ovsdb.py @@ -1,4 +1,4 @@ -# Copyright (c) 2009, 2010, 2011 Nicira Networks +# Copyright (c) 2009, 2010, 2011, 2012 Nicira, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -292,11 +292,17 @@ def idl_set(idl, commands, step): '"%s"\n' % args[1]) sys.exit(1) elif name == "increment": - if len(args) != 2: - sys.stderr.write('"increment" command requires 2 arguments\n') + if len(args) != 1: + sys.stderr.write('"increment" command requires 1 argument\n') sys.exit(1) - txn.increment(args[0], args[1], []) + s = idltest_find_simple(idl, int(args[0])) + if not s: + sys.stderr.write('"set" command asks for nonexistent i=%d\n' + % int(args[0])) + sys.exit(1) + + s.increment("i") increment = True elif name == "abort": txn.abort() @@ -320,8 +326,9 @@ def idl_set(idl, commands, step): def do_idl(schema_file, remote, *commands): - schema = ovs.db.schema.DbSchema.from_json(ovs.json.from_file(schema_file)) - idl = ovs.db.idl.Idl(remote, schema) + schema_helper = ovs.db.idl.SchemaHelper(schema_file) + schema_helper.register_all() + idl = ovs.db.idl.Idl(remote, schema_helper) if commands: error, stream = ovs.stream.Stream.open_block( @@ -375,6 +382,11 @@ def do_idl(schema_file, remote, *commands): sys.stderr.write("jsonrpc transaction failed: %s" % os.strerror(error)) sys.exit(1) + elif reply.error is not None: + sys.stderr.write("jsonrpc transaction failed: %s" + % reply.error) + sys.exit(1) + sys.stdout.write("%03d: " % step) sys.stdout.flush() step += 1