aboutsummaryrefslogtreecommitdiffstats
path: root/functest/opnfv_tests
diff options
context:
space:
mode:
authorCédric Ollivier <cedric.ollivier@orange.com>2017-09-20 10:52:33 +0200
committerCédric Ollivier <cedric.ollivier@orange.com>2017-09-22 00:26:43 +0200
commitdd99f5356ef08f3a2a1ed18d63492391390df752 (patch)
treec84e017a3daf35dff10dd2fc8c1dcdc629da6944 /functest/opnfv_tests
parent47c049623b07dd563218959ad59c0e027a354836 (diff)
Support https when testing ODL
It conforms with the last change on ODL tests [1]. Neutron endpoint is passed via robot args instead of Neutron ip. Keystone url (based on OS_AUTH_URL) is passed too to replace Keystone ip. [1] https://git.opendaylight.org/gerrit/#/c/63293/ Change-Id: Ie44f55304a438b1b0289ec69ac2241664be70e80 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
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')