[ovs-dev] [PATCH V2 03/10] python tests: Rename stream.py to stream_unix.py
Paul Boca
pboca at cloudbasesolutions.com
Tue Aug 30 12:00:59 UTC 2016
Prepare for porting unix sockets to Windows named-pipes.
Signed-off-by: Paul-Daniel Boca <pboca at cloudbasesolutions.com>
---
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)
--
2.7.2.windows.1
More information about the dev
mailing list