From c883810963b208e60b714e2c222b32f20bd6138a Mon Sep 17 00:00:00 2001 From: Cédric Ollivier Date: Wed, 17 May 2017 06:06:51 +0200 Subject: Add Python3 support to the ODL testcase MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It also adds this support to its dependencies. Change-Id: I0534f0c7b0e15a9ee89f522f314cf5200874454c Signed-off-by: Cédric Ollivier --- functest/opnfv_tests/sdn/odl/odl.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'functest/opnfv_tests') diff --git a/functest/opnfv_tests/sdn/odl/odl.py b/functest/opnfv_tests/sdn/odl/odl.py index e50d9c13..6f586b7a 100755 --- a/functest/opnfv_tests/sdn/odl/odl.py +++ b/functest/opnfv_tests/sdn/odl/odl.py @@ -25,12 +25,12 @@ import logging import os import re import sys -import urlparse import robot.api from robot.errors import RobotError import robot.run from robot.utils.robottime import timestamp_to_secs +from six.moves import urllib from functest.core import testcase import functest.utils.openstack_utils as op_utils @@ -87,10 +87,10 @@ class ODLTests(testcase.TestCase): try: for line in fileinput.input(odl_variables_files, inplace=True): - print re.sub("AUTH = .*", + print(re.sub("AUTH = .*", ("AUTH = [u'" + odlusername + "', u'" + odlpassword + "']"), - line.rstrip()) + line.rstrip())) return True except Exception as ex: # pylint: disable=broad-except cls.__logger.error("Cannot set ODL creds: %s", str(ex)) @@ -150,7 +150,7 @@ class ODLTests(testcase.TestCase): odlusername = kwargs['odlusername'] odlpassword = kwargs['odlpassword'] osauthurl = kwargs['osauthurl'] - keystoneip = urlparse.urlparse(osauthurl).hostname + keystoneip = urllib.parse.urlparse(osauthurl).hostname variables = ['KEYSTONE:' + keystoneip, 'NEUTRON:' + kwargs['neutronip'], 'OS_AUTH_URL:"' + osauthurl + '"', @@ -218,7 +218,7 @@ class ODLTests(testcase.TestCase): except KeyError: pass neutron_url = op_utils.get_endpoint(service_type='network') - kwargs = {'neutronip': urlparse.urlparse(neutron_url).hostname} + kwargs = {'neutronip': urllib.parse.urlparse(neutron_url).hostname} kwargs['odlip'] = kwargs['neutronip'] kwargs['odlwebport'] = '8080' kwargs['odlrestconfport'] = '8181' -- cgit 1.2.3-korg