summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorRussell Bryant <russell@ovn.org>2015-12-14 14:03:14 -0500
committerRussell Bryant <russell@ovn.org>2016-01-20 16:43:15 -0500
commit73eb682edb67f44aead7f2c70e9e8777e87df898 (patch)
treea00ec92b3064f258eee85340e8c9b4f26dc93c25 /python
parent0a96a21b6ee67d7cde2abd72a3a5bd290ac618d5 (diff)
downloadopenvswitch-73eb682edb67f44aead7f2c70e9e8777e87df898.tar.gz
python: Fix xmlrpclib imports.
Fix imports of xmlrpclib to be compatible with Python 3. Python 2 had xmlrpclib (client) and SimpleXMLRPCServer (server). In Python 3, these have been renamed to xmlrpc.client and xmlrpc.server. The solution implemented here is to use the six library. It may seem excessive for this particular issue, but the six library provides helpers for Python 2 and 3 compatibility for many different issues. This is just the first of many uses of the six library. Signed-off-by: Russell Bryant <russell@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
Diffstat (limited to 'python')
-rw-r--r--python/ovstest/rpcserver.py5
-rw-r--r--python/ovstest/util.py6
2 files changed, 7 insertions, 4 deletions
diff --git a/python/ovstest/rpcserver.py b/python/ovstest/rpcserver.py
index 80fc5dc7e..7abf13cb8 100644
--- a/python/ovstest/rpcserver.py
+++ b/python/ovstest/rpcserver.py
@@ -20,8 +20,8 @@ from __future__ import print_function
import exceptions
import sys
-import xmlrpclib
+import six.moves.xmlrpc_client
from twisted.internet import reactor
from twisted.internet.error import CannotListenError
from twisted.web import xmlrpc
@@ -108,7 +108,8 @@ class TestArena(xmlrpc.XMLRPC):
Returns the ovs-test server IP address that the other ovs-test server
with the given ip will see.
"""
- server1 = xmlrpclib.Server("http://%s:%u/" % (his_ip, his_port))
+ server1 = six.moves.xmlrpc_client.Server("http://%s:%u/" %
+ (his_ip, his_port))
return server1.get_my_address()
def xmlrpc_create_udp_listener(self, port):
diff --git a/python/ovstest/util.py b/python/ovstest/util.py
index 16c012e7a..a52219540 100644
--- a/python/ovstest/util.py
+++ b/python/ovstest/util.py
@@ -25,7 +25,8 @@ import struct
import signal
import subprocess
import re
-import xmlrpclib
+
+import six.moves.xmlrpc_client
def str_ip(ip_address):
@@ -167,7 +168,8 @@ def get_interface_from_routing_decision(ip):
def rpc_client(ip, port):
- return xmlrpclib.Server("http://%s:%u/" % (ip, port), allow_none=True)
+ return six.moves.xmlrpc_client.Server("http://%s:%u/" % (ip, port),
+ allow_none=True)
def sigint_intercept():