From patchwork Tue Oct 6 07:08:42 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Ansari, Shad" X-Patchwork-Id: 526630 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 41C8F140D7C for ; Tue, 6 Oct 2015 18:09:11 +1100 (AEDT) Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id 03E421056E; Tue, 6 Oct 2015 00:09:11 -0700 (PDT) X-Original-To: dev@openvswitch.org Delivered-To: dev@openvswitch.org Received: from mx1e4.cudamail.com (mx1.cudamail.com [69.90.118.67]) by archives.nicira.com (Postfix) with ESMTPS id B0FB410559 for ; Tue, 6 Oct 2015 00:09:09 -0700 (PDT) Received: from bar5.cudamail.com (unknown [192.168.21.12]) by mx1e4.cudamail.com (Postfix) with ESMTPS id 091EA1E004F for ; Tue, 6 Oct 2015 01:09:09 -0600 (MDT) X-ASG-Debug-ID: 1444115347-09eadd1416300250001-byXFYA Received: from mx1-pf2.cudamail.com ([192.168.24.2]) by bar5.cudamail.com with ESMTP id gWY3sJDiJ26h05xH (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 06 Oct 2015 01:09:07 -0600 (MDT) X-Barracuda-Envelope-From: shad.ansari@hpe.com X-Barracuda-RBL-Trusted-Forwarder: 192.168.24.2 Received: from unknown (HELO g9t5009.houston.hp.com) (15.240.92.67) by mx1-pf2.cudamail.com with ESMTPS (DHE-RSA-AES256-SHA encrypted); 6 Oct 2015 07:09:06 -0000 Received-SPF: none (mx1-pf2.cudamail.com: domain at hpe.com does not designate permitted sender hosts) X-Barracuda-Apparent-Source-IP: 15.240.92.67 X-Barracuda-RBL-IP: 15.240.92.67 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 g9t5009.houston.hp.com (Postfix) with ESMTPS id 768C967 for ; Tue, 6 Oct 2015 07:09:04 +0000 (UTC) Received: from G4W6303.americas.hpqcorp.net (16.210.26.228) by G4W6310.americas.hpqcorp.net (16.210.26.217) with Microsoft SMTP Server (TLS) id 14.3.169.1; Tue, 6 Oct 2015 07:08:43 +0000 Received: from G9W0717.americas.hpqcorp.net ([169.254.4.55]) by G4W6303.americas.hpqcorp.net ([16.210.26.228]) with mapi id 14.03.0169.001; Tue, 6 Oct 2015 07:08:43 +0000 X-CudaMail-Envelope-Sender: shad.ansari@hpe.com From: "Ansari, Shad" To: "dev@openvswitch.org" X-CudaMail-MID: CM-E2-1005001111 X-CudaMail-DTE: 100615 X-CudaMail-Originating-IP: 15.240.92.67 Thread-Topic: ovsdb-idl: Test case for Python register_columns function X-ASG-Orig-Subj: [##CM-E2-1005001111##]ovsdb-idl: Test case for Python register_columns function Thread-Index: AdEABdQehQqHlcWGQLuf4BNxHjpDlA== Date: Tue, 6 Oct 2015 07:08:42 +0000 Message-ID: <8CA204A851B7B14E86E75054661E41750F97EFDA@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.192.235] MIME-Version: 1.0 X-GBUdb-Analysis: 0, 15.240.92.67, Ugly c=0.237282 p=-0.2 Source Normal X-MessageSniffer-Rules: 0-0-0-26929-c X-Barracuda-Connect: UNKNOWN[192.168.24.2] X-Barracuda-Start-Time: 1444115347 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=HTML_MESSAGE, RDNS_NONE X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.23224 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.00 HTML_MESSAGE BODY: HTML included in message 0.10 RDNS_NONE Delivered to trusted network by a host with no rDNS X-Content-Filtered-By: Mailman/MimeDel 2.1.16 Subject: [ovs-dev] ovsdb-idl: 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" 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(-) 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 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- + m4_if([$2], [], [], + [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore], + AT_CHECK([$PYTHON $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema + [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]