aboutsummaryrefslogtreecommitdiffstats
path: root/functest/opnfv_tests
diff options
context:
space:
mode:
authorCedric Ollivier <cedric.ollivier@orange.com>2017-09-22 05:21:00 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-09-22 05:21:00 +0000
commitcf30a201a275247c078fabbeb25dada670e620d9 (patch)
treea526f77a42563f928cbf73cecdd3df6d4b4dcf3b /functest/opnfv_tests
parent1a6f7b2483590e73ab2bc6092d10fed1933e2961 (diff)
parentdd99f5356ef08f3a2a1ed18d63492391390df752 (diff)
Merge "Support https when testing ODL"
Diffstat (limited to 'functest/opnfv_tests')
-rw-r--r--functest/opnfv_tests/sdn/odl/odl.py34
1 files changed, 18 insertions, 16 deletions
diff --git a/functest/opnfv_tests/sdn/odl/odl.py b/functest/opnfv_tests/sdn/odl/odl.py
index d09532cb..dd313ffe 100644
--- a/functest/opnfv_tests/sdn/odl/odl.py
+++ b/functest/opnfv_tests/sdn/odl/odl.py
@@ -78,20 +78,20 @@ class ODLTests(testcase.TestCase):
@classmethod
def set_robotframework_vars(cls, odlusername="admin", odlpassword="admin"):
- """Set credentials in csit/variables/Variables.py.
+ """Set credentials in csit/variables/Variables.robot.
Returns:
True if credentials are set.
False otherwise.
"""
odl_variables_files = os.path.join(cls.odl_test_repo,
- 'csit/variables/Variables.py')
+ 'csit/variables/Variables.robot')
try:
for line in fileinput.input(odl_variables_files,
inplace=True):
- print(re.sub("AUTH = .*",
- ("AUTH = [u'" + odlusername + "', u'" +
- odlpassword + "']"),
+ print(re.sub("@{AUTH}.*",
+ "@{{AUTH}} {} {}".format(
+ odlusername, odlpassword),
line.rstrip()))
return True
except Exception as ex: # pylint: disable=broad-except
@@ -125,7 +125,7 @@ class ODLTests(testcase.TestCase):
* odlusername,
* odlpassword,
* osauthurl,
- * neutronip,
+ * neutronurl,
* osusername,
* ostenantname,
* ospassword,
@@ -152,9 +152,11 @@ class ODLTests(testcase.TestCase):
odlusername = kwargs['odlusername']
odlpassword = kwargs['odlpassword']
osauthurl = kwargs['osauthurl']
- keystoneip = urllib.parse.urlparse(osauthurl).hostname
- variables = ['KEYSTONE:' + keystoneip,
- 'NEUTRON:' + kwargs['neutronip'],
+ keystoneurl = "{}://{}".format(
+ urllib.parse.urlparse(osauthurl).scheme,
+ urllib.parse.urlparse(osauthurl).netloc)
+ variables = ['KEYSTONEURL:' + keystoneurl,
+ 'NEUTRONURL:' + kwargs['neutronurl'],
'OS_AUTH_URL:"' + osauthurl + '"',
'OSUSERNAME:"' + kwargs['osusername'] + '"',
('OSUSERDOMAINNAME:"' +
@@ -167,8 +169,7 @@ class ODLTests(testcase.TestCase):
'PORT:' + kwargs['odlwebport'],
'RESTCONFPORT:' + kwargs['odlrestconfport']]
except KeyError as ex:
- self.__logger.error("Cannot run ODL testcases. Please check "
- "%s", str(ex))
+ self.__logger.exception("Cannot run ODL testcases. Please check")
return self.EX_RUN_ERROR
if self.set_robotframework_vars(odlusername, odlpassword):
try:
@@ -214,9 +215,10 @@ class ODLTests(testcase.TestCase):
suites = kwargs["suites"]
except KeyError:
pass
- neutron_url = op_utils.get_endpoint(service_type='network')
- kwargs = {'neutronip': urllib.parse.urlparse(neutron_url).hostname}
- kwargs['odlip'] = kwargs['neutronip']
+ kwargs = {'neutronurl': op_utils.get_endpoint(
+ service_type='network')}
+ kwargs['odlip'] = urllib.parse.urlparse(
+ kwargs['neutronurl']).hostname
kwargs['odlwebport'] = '8080'
kwargs['odlrestconfport'] = '8181'
kwargs['odlusername'] = 'admin'
@@ -267,8 +269,8 @@ class ODLParser(object): # pylint: disable=too-few-public-methods
def __init__(self):
self.parser = argparse.ArgumentParser()
self.parser.add_argument(
- '-n', '--neutronip', help='Neutron IP',
- default='127.0.0.1')
+ '-n', '--neutronurl', help='Neutron Endpoint',
+ default='http://127.0.0.1:9696')
self.parser.add_argument(
'-k', '--osauthurl', help='OS_AUTH_URL as defined by OpenStack',
default='http://127.0.0.1:5000/v3')