From patchwork Tue Aug 30 12:00:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Boca X-Patchwork-Id: 664122 X-Patchwork-Delegate: guru@ovn.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from archives.nicira.com (archives.nicira.com [96.126.127.54]) by ozlabs.org (Postfix) with ESMTP id 3sNnDt3nMbz9s4n for ; Tue, 30 Aug 2016 22:01:50 +1000 (AEST) Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id C865E1065D; Tue, 30 Aug 2016 05:01:46 -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 EC8EC10659 for ; Tue, 30 Aug 2016 05:01:45 -0700 (PDT) Received: from bar5.cudamail.com (unknown [192.168.21.12]) by mx1e4.cudamail.com (Postfix) with ESMTPS id 8218B1E05D3 for ; Tue, 30 Aug 2016 06:01:45 -0600 (MDT) X-ASG-Debug-ID: 1472558504-09eadd2fc5203b0001-byXFYA Received: from mx3-pf1.cudamail.com ([192.168.14.2]) by bar5.cudamail.com with ESMTP id EBFsulGb3jRvrgge (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 30 Aug 2016 06:01:44 -0600 (MDT) X-Barracuda-Envelope-From: pboca@cloudbasesolutions.com X-Barracuda-RBL-Trusted-Forwarder: 192.168.14.2 Received: from unknown (HELO cbssmtp1.cloudbase.local) (91.232.152.5) by mx3-pf1.cudamail.com with SMTP; 30 Aug 2016 12:01:43 -0000 Received-SPF: pass (mx3-pf1.cudamail.com: SPF record at cloudbasesolutions.com designates 91.232.152.5 as permitted sender) X-Barracuda-Apparent-Source-IP: 91.232.152.5 X-Barracuda-RBL-IP: 91.232.152.5 Received: from localhost (localhost [127.0.0.1]) by cbssmtp1.cloudbase.local (Postfix) with ESMTP id 99E1941A52 for ; Tue, 30 Aug 2016 15:01:42 +0300 (EEST) X-Virus-Scanned: amavisd-new at cloudbasesolutions.com Received: from cbssmtp1.cloudbase.local ([127.0.0.1]) by localhost (cbssmtp1.cloudbase.local [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Y4lpgq4TGSgZ for ; Tue, 30 Aug 2016 15:01:22 +0300 (EEST) Received: from CBSEX1.cloudbase.local (unknown [10.77.78.3]) by cbssmtp1.cloudbase.local (Postfix) with ESMTP id 21F8E41A54 for ; Tue, 30 Aug 2016 15:01:00 +0300 (EEST) Received: from CBSEX1.cloudbase.local ([10.77.78.3]) by CBSEX1.cloudbase.local ([10.77.78.3]) with mapi id 14.03.0301.000; Tue, 30 Aug 2016 14:00:59 +0200 X-CudaMail-Envelope-Sender: pboca@cloudbasesolutions.com From: Paul Boca To: "dev@openvswitch.org" X-CudaMail-MID: CM-V1-829007080 X-CudaMail-DTE: 083016 X-CudaMail-Originating-IP: 91.232.152.5 Thread-Topic: [PATCH V2 03/10] python tests: Rename stream.py to stream_unix.py X-ASG-Orig-Subj: [##CM-V1-829007080##][PATCH V2 03/10] python tests: Rename stream.py to stream_unix.py Thread-Index: AQHSArYrgbjZTWyHREqELIQ1LtGVFw== Date: Tue, 30 Aug 2016 12:00:59 +0000 Message-ID: <1472558417-2016-4-git-send-email-pboca@cloudbasesolutions.com> References: <1472558417-2016-1-git-send-email-pboca@cloudbasesolutions.com> In-Reply-To: <1472558417-2016-1-git-send-email-pboca@cloudbasesolutions.com> Accept-Language: en-US, it-IT Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.77.78.1] MIME-Version: 1.0 X-GBUdb-Analysis: 0, 91.232.152.5, Ugly c=0.25607 p=-0.333333 Source Normal X-MessageSniffer-Rules: 0-0-0-16369-c X-Barracuda-Connect: UNKNOWN[192.168.14.2] X-Barracuda-Start-Time: 1472558504 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 global scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=4.0 tests=RDNS_NONE X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.32454 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.10 RDNS_NONE Delivered to trusted network by a host with no rDNS Subject: [ovs-dev] [PATCH V2 03/10] python tests: Rename stream.py to stream_unix.py 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" Prepare for porting unix sockets to Windows named-pipes. Signed-off-by: Paul-Daniel Boca --- V2: Moved test-jsonrpc.py changes from next patch to current one. --- python/automake.mk | 2 +- python/ovs/jsonrpc.py | 14 +++++++------- python/ovs/{stream.py => stream_unix.py} | 0 python/ovs/unixctl/client.py | 6 +++--- python/ovs/unixctl/server.py | 10 +++++----- tests/test-jsonrpc.py | 10 +++++----- 6 files changed, 21 insertions(+), 21 deletions(-) rename python/ovs/{stream.py => stream_unix.py} (100%) diff --git a/python/automake.mk b/python/automake.mk index 1c8fa38..3fe9519 100644 --- a/python/automake.mk +++ b/python/automake.mk @@ -27,7 +27,7 @@ ovs_pyfiles = \ python/ovs/process.py \ python/ovs/reconnect.py \ python/ovs/socket_util.py \ - python/ovs/stream.py \ + python/ovs/stream_unix.py \ python/ovs/timeval.py \ python/ovs/unixctl/__init__.py \ python/ovs/unixctl/client.py \ diff --git a/python/ovs/jsonrpc.py b/python/ovs/jsonrpc.py index 6300c67..8ca01a0 100644 --- a/python/ovs/jsonrpc.py +++ b/python/ovs/jsonrpc.py @@ -20,7 +20,7 @@ import six import ovs.json import ovs.poller import ovs.reconnect -import ovs.stream +import ovs.stream_unix as ovs_stream import ovs.timeval import ovs.util import ovs.vlog @@ -372,8 +372,8 @@ class Session(object): @staticmethod def open(name): """Creates and returns a Session that maintains a JSON-RPC session to - 'name', which should be a string acceptable to ovs.stream.Stream or - ovs.stream.PassiveStream's initializer. + 'name', which should be a string acceptable to ovs_stream.Stream or + ovs_stream.PassiveStream's initializer. If 'name' is an active connection method, e.g. "tcp:127.1.2.3", the new session connects and reconnects, with back-off, to 'name'. @@ -386,10 +386,10 @@ class Session(object): reconnect.set_name(name) reconnect.enable(ovs.timeval.msec()) - if ovs.stream.PassiveStream.is_valid_name(name): + if ovs_stream.PassiveStream.is_valid_name(name): reconnect.set_passive(True, ovs.timeval.msec()) - if not ovs.stream.stream_or_pstream_needs_probes(name): + if not ovs_stream.stream_or_pstream_needs_probes(name): reconnect.set_probe_interval(0) return Session(reconnect, None) @@ -430,13 +430,13 @@ class Session(object): name = self.reconnect.get_name() if not self.reconnect.is_passive(): - error, self.stream = ovs.stream.Stream.open(name) + error, self.stream = ovs_stream.Stream.open(name) if not error: self.reconnect.connecting(ovs.timeval.msec()) else: self.reconnect.connect_failed(ovs.timeval.msec(), error) elif self.pstream is None: - error, self.pstream = ovs.stream.PassiveStream.open(name) + error, self.pstream = ovs_stream.PassiveStream.open(name) if not error: self.reconnect.listening(ovs.timeval.msec()) else: diff --git a/python/ovs/stream.py b/python/ovs/stream_unix.py similarity index 100% rename from python/ovs/stream.py rename to python/ovs/stream_unix.py diff --git a/python/ovs/unixctl/client.py b/python/ovs/unixctl/client.py index 1b247c4..fde674e 100644 --- a/python/ovs/unixctl/client.py +++ b/python/ovs/unixctl/client.py @@ -17,7 +17,7 @@ import os import six import ovs.jsonrpc -import ovs.stream +import ovs.stream_unix as ovs_stream import ovs.util @@ -59,8 +59,8 @@ class UnixctlClient(object): assert isinstance(path, str) unix = "unix:%s" % ovs.util.abs_file_name(ovs.dirs.RUNDIR, path) - error, stream = ovs.stream.Stream.open_block( - ovs.stream.Stream.open(unix)) + error, stream = ovs_stream.Stream.open_block( + ovs_stream.Stream.open(unix)) if error: vlog.warn("failed to connect to %s" % path) diff --git a/python/ovs/unixctl/server.py b/python/ovs/unixctl/server.py index 8595ed8..50a11d4 100644 --- a/python/ovs/unixctl/server.py +++ b/python/ovs/unixctl/server.py @@ -22,7 +22,7 @@ from six.moves import range import ovs.dirs import ovs.jsonrpc -import ovs.stream +import ovs.stream_unix as ovs_stream import ovs.unixctl import ovs.util import ovs.version @@ -141,7 +141,7 @@ def _unixctl_version(conn, unused_argv, version): class UnixctlServer(object): def __init__(self, listener): - assert isinstance(listener, ovs.stream.PassiveStream) + assert isinstance(listener, ovs_stream.PassiveStream) self._listener = listener self._conns = [] @@ -200,7 +200,7 @@ class UnixctlServer(object): if version is None: version = ovs.version.VERSION - error, listener = ovs.stream.PassiveStream.open(path) + error, listener = ovs_stream.PassiveStream.open(path) if error: ovs.util.ovs_error(error, "could not initialize control socket %s" % path) @@ -246,8 +246,8 @@ class UnixctlClient(object): assert isinstance(path, str) unix = "unix:%s" % ovs.util.abs_file_name(ovs.dirs.RUNDIR, path) - error, stream = ovs.stream.Stream.open_block( - ovs.stream.Stream.open(unix)) + error, stream = ovs_stream.Stream.open_block( + ovs_stream.Stream.open(unix)) if error: vlog.warn("failed to connect to %s" % path) diff --git a/tests/test-jsonrpc.py b/tests/test-jsonrpc.py index 18634e6..a6c387a 100644 --- a/tests/test-jsonrpc.py +++ b/tests/test-jsonrpc.py @@ -23,7 +23,7 @@ import ovs.daemon import ovs.json import ovs.jsonrpc import ovs.poller -import ovs.stream +import ovs.stream_unix as ovs_stream def handle_rpc(rpc, msg): @@ -53,7 +53,7 @@ def handle_rpc(rpc, msg): def do_listen(name): - error, pstream = ovs.stream.PassiveStream.open(name) + error, pstream = ovs_stream.PassiveStream.open(name) if error: sys.stderr.write("could not listen on \"%s\": %s\n" % (name, os.strerror(error))) @@ -111,7 +111,7 @@ def do_request(name, method, params_string): sys.stderr.write("not a valid JSON-RPC request: %s\n" % s) sys.exit(1) - error, stream = ovs.stream.Stream.open_block(ovs.stream.Stream.open(name)) + error, stream = ovs_stream.Stream.open_block(ovs_stream.Stream.open(name)) if error: sys.stderr.write("could not open \"%s\": %s\n" % (name, os.strerror(error))) @@ -142,7 +142,7 @@ def do_notify(name, method, params_string): sys.stderr.write("not a valid JSON-RPC notification: %s\n" % s) sys.exit(1) - error, stream = ovs.stream.Stream.open_block(ovs.stream.Stream.open(name)) + error, stream = ovs_stream.Stream.open_block(ovs_stream.Stream.open(name)) if error: sys.stderr.write("could not open \"%s\": %s\n" % (name, os.strerror(error))) @@ -174,7 +174,7 @@ def main(argv): listen LOCAL listen for connections on LOCAL request REMOTE METHOD PARAMS send request, print reply notify REMOTE METHOD PARAMS send notification and exit -""" + ovs.stream.usage("JSON-RPC") +""" + ovs_stream.usage("JSON-RPC") group = parser.add_argument_group(title="Commands", description=group_description)