From patchwork Tue Oct 6 13:21:33 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Ansari, Shad" X-Patchwork-Id: 526761 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from archives.nicira.com (unknown [IPv6:2600:3c00::f03c:91ff:fe6e:bdf7]) by ozlabs.org (Postfix) with ESMTP id 2103B1400CB for ; Wed, 7 Oct 2015 00:22:31 +1100 (AEDT) Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id 825D21076B; Tue, 6 Oct 2015 06:22:29 -0700 (PDT) X-Original-To: dev@openvswitch.org Delivered-To: dev@openvswitch.org Received: from mx3v1.cudamail.com (mx3.cudamail.com [64.34.241.5]) by archives.nicira.com (Postfix) with ESMTPS id D0BBF106FC for ; Tue, 6 Oct 2015 06:22:28 -0700 (PDT) Received: from bar3.cudamail.com (bar1 [192.168.15.1]) by mx3v1.cudamail.com (Postfix) with ESMTP id 7022E6186D1 for ; Tue, 6 Oct 2015 07:22:26 -0600 (MDT) X-ASG-Debug-ID: 1444137733-03dd7b7c26378b0001-byXFYA Received: from mx3-pf2.cudamail.com ([192.168.14.1]) by bar3.cudamail.com with ESMTP id QxFnsFFiePjI4Sab (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 06 Oct 2015 07:22:13 -0600 (MDT) X-Barracuda-Envelope-From: shad.ansari@hpe.com X-Barracuda-RBL-Trusted-Forwarder: 192.168.14.1 Received: from unknown (HELO g4t3426.houston.hp.com) (15.201.208.54) by mx3-pf2.cudamail.com with ESMTPS (DHE-RSA-AES256-SHA encrypted); 6 Oct 2015 13:22:03 -0000 Received-SPF: none (mx3-pf2.cudamail.com: domain at hpe.com does not designate permitted sender hosts) X-Barracuda-Apparent-Source-IP: 15.201.208.54 X-Barracuda-RBL-IP: 15.201.208.54 Received: from G4W6310.americas.hpqcorp.net (g4w6310.houston.hp.com [16.210.26.217]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by g4t3426.houston.hp.com (Postfix) with ESMTPS id 1010859 for ; Tue, 6 Oct 2015 13:22:01 +0000 (UTC) Received: from G9W3614.americas.hpqcorp.net (16.216.186.49) by G4W6310.americas.hpqcorp.net (16.210.26.217) with Microsoft SMTP Server (TLS) id 14.3.169.1; Tue, 6 Oct 2015 13:21:34 +0000 Received: from G9W0717.americas.hpqcorp.net ([169.254.4.55]) by G9W3614.americas.hpqcorp.net ([16.216.186.49]) with mapi id 14.03.0169.001; Tue, 6 Oct 2015 13:21:34 +0000 X-CudaMail-Envelope-Sender: shad.ansari@hpe.com From: "Ansari, Shad" To: "dev@openvswitch.org" X-CudaMail-MID: CM-V2-1005012867 X-CudaMail-DTE: 100615 X-CudaMail-Originating-IP: 15.201.208.54 Thread-Topic: [ovs-dev] ovsdb-idl: [v3] Test case for Python register_columns function X-ASG-Orig-Subj: [##CM-V2-1005012867##][ovs-dev] ovsdb-idl: [v3] Test case for Python register_columns function Thread-Index: AdEAOXYEaOkAbBu2TeuKyP8nwBRF0A== Date: Tue, 6 Oct 2015 13:21:33 +0000 Message-ID: <8CA204A851B7B14E86E75054661E41750F97F08C@G9W0717.americas.hpqcorp.net> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [16.210.48.17] MIME-Version: 1.0 X-GBUdb-Analysis: 0, 15.201.208.54, Ugly c=0.403135 p=-0.08 Source Normal X-MessageSniffer-Rules: 0-0-0-6553-c X-Barracuda-Connect: UNKNOWN[192.168.14.1] X-Barracuda-Start-Time: 1444137733 X-Barracuda-Encrypted: DHE-RSA-AES256-SHA X-Barracuda-URL: https://web.cudamail.com:443/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at cudamail.com X-Barracuda-BRTS-Status: 1 X-Barracuda-Spam-Score: 0.10 X-Barracuda-Spam-Status: No, SCORE=0.10 using per-user scores of TAG_LEVEL=3.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=3.0 tests=RDNS_NONE X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.23231 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.10 RDNS_NONE Delivered to trusted network by a host with no rDNS Subject: [ovs-dev] ovsdb-idl: [v3] Test case for Python register_columns function X-BeenThere: dev@openvswitch.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@openvswitch.org Sender: "dev" ovsdb-idl: Test script for Python register_columns function Add test scripts to exercise the register_columns() function of the Python IDL. Add ability to specify columns in the "idl" command of test-ovsdb.py. All columns of all tables are monitored by default. The new "?" option can be used to monitor specific Table:Column(s). The table and their columns are listed as a string of the form starting with "?": ?:,,... e.g.: ?simple:b - Monitor column "b" in table "simple" Entries for multiple tables are seperated by "?": ?:,...?:,... e.g.: ?simple:b?link1:i,k - Monitor column "b" in table "simple", and column "i", "k" in table "link1" Signed-off-by: Shad Ansari --- tests/ovsdb-idl.at | 17 +++++++++++++++++ tests/test-ovsdb.py | 23 +++++++++++++++++++++-- 2 files changed, 38 insertions(+), 2 deletions(-) dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev diff --git a/tests/ovsdb-idl.at b/tests/ovsdb-idl.at index f4d03f8..d3d2aeb 100644 --- a/tests/ovsdb-idl.at +++ b/tests/ovsdb-idl.at @@ -48,6 +48,22 @@ m4_define([OVSDB_CHECK_IDL_PY], OVSDB_SERVER_SHUTDOWN AT_CLEANUP]) +m4_define([OVSDB_CHECK_IDL_REGISTER_COLUMNS_PY], + [AT_SETUP([$1 - Python register_columns]) + AT_SKIP_IF([test $HAVE_PYTHON = no]) + AT_KEYWORDS([ovsdb server idl positive Python register_columns $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 --no-chdir --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 ?simple:b,ba,i,ia,r,ra,s,sa,u,ua?link1:i,k,ka,l2?link2:i,l1 $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 with tcp m4_define([OVSDB_CHECK_IDL_TCP_PY], [AT_SETUP([$1 - Python tcp]) @@ -91,6 +107,7 @@ m4_define([OVSDB_CHECK_IDL_TCP6_PY], m4_define([OVSDB_CHECK_IDL], [OVSDB_CHECK_IDL_C($@) OVSDB_CHECK_IDL_PY($@) + OVSDB_CHECK_IDL_REGISTER_COLUMNS_PY($@) OVSDB_CHECK_IDL_TCP_PY($@) OVSDB_CHECK_IDL_TCP6_PY($@)]) diff --git a/tests/test-ovsdb.py b/tests/test-ovsdb.py index 4f8d7ca..ab951f9 100644 --- a/tests/test-ovsdb.py +++ b/tests/test-ovsdb.py @@ -364,7 +364,15 @@ def idl_set(idl, commands, step): def do_idl(schema_file, remote, *commands): schema_helper = ovs.db.idl.SchemaHelper(schema_file) - schema_helper.register_all() + if commands and commands[0].startswith("?"): + monitor = {} + for x in commands[0][1:].split("?"): + table, columns = x.split(":") + monitor[table] = columns.split(",") + schema_helper.register_columns(table, monitor[table]) + commands = commands[1:] + else: + schema_helper.register_all() idl = ovs.db.idl.Idl(remote, schema_helper) if commands: @@ -475,11 +483,22 @@ parse-table NAME OBJECT [DEFAULT-IS-ROOT] parse table NAME with info OBJECT parse-schema JSON parse JSON as an OVSDB schema, and re-serialize -idl SCHEMA SERVER [TRANSACTION...] +idl SCHEMA SERVER [?T1:C1,C2...[?T2:C1,C2,...]...] [TRANSACTION...] connect to SERVER (which has the specified SCHEMA) and dump the contents of the database as seen initially by the IDL implementation and after executing each TRANSACTION. (Each TRANSACTION must modify the database or this command will hang.) + By default, all columns of all tables are monitored. The "?" option + can be used to monitor specific Table:Column(s). The table and their + columns are listed as a string of the form starting with "?": + ?:,,... + e.g.: + ?simple:b - Monitor column "b" in table "simple" + Entries for multiple tables are seperated by "?": + ?:,...?:,... + e.g.: + ?simple:b?link1:i,k - Monitor column "b" in table "simple", + and column "i", "k" in table "link1" The following options are also available: -t, --timeout=SECS give up after SECS seconds _______________________________________________