summaryrefslogtreecommitdiff
path: root/tests/ovsdb-idl.at
diff options
context:
space:
mode:
authorBen Pfaff <blp@nicira.com>2011-09-21 10:43:03 -0700
committerBen Pfaff <blp@nicira.com>2011-09-23 14:23:16 -0700
commit8cdf0349740c3e1a73af9aa6209bb22be952cd37 (patch)
tree866331f253cf075ff4c5b5b83d510897a27dbb17 /tests/ovsdb-idl.at
parent7cba02e442012a7ae6cfdfe67f858a18057e5470 (diff)
downloadopenvswitch-8cdf0349740c3e1a73af9aa6209bb22be952cd37.tar.gz
python: Implement write support in Python IDL for OVSDB.
Until now, the Python bindings for OVSDB have not supported writing to the database. Instead, writes had to be done with "ovs-vsctl" subprocesses. This commit adds write support and brings the Python bindings in line with the C bindings. This commit deletes the Python-specific IDL tests in favor of using the same tests as the C version of the IDL, which now pass with both implementations. This commit updates the two users of the Python IDL to use the new write support. I tested this updates only by writing unit tests for them, which appear in upcoming commits.
Diffstat (limited to 'tests/ovsdb-idl.at')
-rw-r--r--tests/ovsdb-idl.at39
1 files changed, 30 insertions, 9 deletions
diff --git a/tests/ovsdb-idl.at b/tests/ovsdb-idl.at
index f9c8286f7..cce6197e0 100644
--- a/tests/ovsdb-idl.at
+++ b/tests/ovsdb-idl.at
@@ -1,7 +1,7 @@
AT_BANNER([OVSDB -- interface description language (IDL)])
-# OVSDB_CHECK_IDL(TITLE, [PRE-IDL-TXN], TRANSACTIONS, OUTPUT, [KEYWORDS],
-# [FILTER])
+# OVSDB_CHECK_IDL_C(TITLE, [PRE-IDL-TXN], TRANSACTIONS, OUTPUT, [KEYWORDS],
+# [FILTER])
#
# Creates a database with a schema derived from idltest.ovsidl, runs
# each PRE-IDL-TXN (if any), starts an ovsdb-server on that database,
@@ -16,21 +16,42 @@ AT_BANNER([OVSDB -- interface description language (IDL)])
# through the specified program.
#
# TITLE is provided to AT_SETUP and KEYWORDS to AT_KEYWORDS.
-m4_define([OVSDB_CHECK_IDL],
- [AT_SETUP([$1])
+m4_define([OVSDB_CHECK_IDL_C],
+ [AT_SETUP([$1 - C])
AT_KEYWORDS([ovsdb server idl positive $5])
AT_CHECK([ovsdb-tool create db $abs_srcdir/idltest.ovsschema],
[0], [stdout], [ignore])
AT_CHECK([ovsdb-server '-vPATTERN:console:ovsdb-server|%c|%m' --detach --pidfile=$PWD/pid --remote=punix:socket --unixctl=$PWD/unixctl db], [0], [ignore], [ignore])
m4_if([$2], [], [],
[AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore], [kill `cat pid`])])
- AT_CHECK([test-ovsdb '-vPATTERN:console:test-ovsdb|%c|%m' -vjsonrpc -t10 idl unix:socket $3],
+ AT_CHECK([test-ovsdb '-vPATTERN:console:test-ovsdb|%c|%m' -vjsonrpc -t10 idl unix:socket $3],
[0], [stdout], [ignore], [kill `cat pid`])
AT_CHECK([sort stdout | perl $srcdir/uuidfilt.pl]m4_if([$6],,, [[| $6]]),
[0], [$4], [], [kill `cat pid`])
OVSDB_SERVER_SHUTDOWN
AT_CLEANUP])
+# same as OVSDB_CHECK_IDL but uses the Python IDL implementation.
+m4_define([OVSDB_CHECK_IDL_PY],
+ [AT_SETUP([$1 - Python])
+ AT_SKIP_IF([test $HAVE_PYTHON = no])
+ AT_KEYWORDS([ovsdb server idl positive Python $5])
+ AT_CHECK([ovsdb-tool create db $abs_srcdir/idltest.ovsschema],
+ [0], [stdout], [ignore])
+ AT_CHECK([ovsdb-server '-vPATTERN:console:ovsdb-server|%c|%m' --detach --pidfile=$PWD/pid --remote=punix:socket --unixctl=$PWD/unixctl db], [0], [ignore], [ignore])
+ m4_if([$2], [], [],
+ [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore], [kill `cat pid`])])
+ AT_CHECK([$PYTHON $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema unix:socket $3],
+ [0], [stdout], [ignore], [kill `cat pid`])
+ AT_CHECK([sort stdout | perl $srcdir/uuidfilt.pl]m4_if([$6],,, [[| $6]]),
+ [0], [$4], [], [kill `cat pid`])
+ OVSDB_SERVER_SHUTDOWN
+ AT_CLEANUP])
+
+m4_define([OVSDB_CHECK_IDL],
+ [OVSDB_CHECK_IDL_C($@)
+ OVSDB_CHECK_IDL_PY($@)])
+
OVSDB_CHECK_IDL([simple idl, initially empty, no ops],
[],
[],
@@ -51,7 +72,7 @@ OVSDB_CHECK_IDL([simple idl, initially empty, various ops],
"ia": ["set", [1, 2, 3]],
"ra": ["set", [-0.5]],
"ba": ["set", [true]],
- "sa": ["set", ["abc", "def"]],
+ "sa": ["set", ["abc", "def"]],
"ua": ["set", [["uuid", "69443985-7806-45e2-b35f-574a04e720f9"],
["uuid", "aad11ef0-816a-4b01-93e6-03b8b4256b98"]]]}},
{"op": "insert",
@@ -77,7 +98,7 @@ OVSDB_CHECK_IDL([simple idl, initially empty, various ops],
"ia": ["set", [1]],
"ra": ["set", [1.5]],
"ba": ["set", [false]],
- "sa": ["set", []],
+ "sa": ["set", []],
"ua": ["set", []]}}]' \
'["idltest",
{"op": "update",
@@ -128,7 +149,7 @@ OVSDB_CHECK_IDL([simple idl, initially populated],
"ia": ["set", [1, 2, 3]],
"ra": ["set", [-0.5]],
"ba": ["set", [true]],
- "sa": ["set", ["abc", "def"]],
+ "sa": ["set", ["abc", "def"]],
"ua": ["set", [["uuid", "69443985-7806-45e2-b35f-574a04e720f9"],
["uuid", "aad11ef0-816a-4b01-93e6-03b8b4256b98"]]]}},
{"op": "insert",
@@ -159,7 +180,7 @@ OVSDB_CHECK_IDL([simple idl, writing via IDL],
"ia": ["set", [1, 2, 3]],
"ra": ["set", [-0.5]],
"ba": ["set", [true]],
- "sa": ["set", ["abc", "def"]],
+ "sa": ["set", ["abc", "def"]],
"ua": ["set", [["uuid", "69443985-7806-45e2-b35f-574a04e720f9"],
["uuid", "aad11ef0-816a-4b01-93e6-03b8b4256b98"]]]}},
{"op": "insert",