aboutsummaryrefslogtreecommitdiffstats
path: root/testcases
diff options
context:
space:
mode:
authorCédric Ollivier <cedric.ollivier@orange.com>2016-08-24 17:55:10 +0200
committerCédric Ollivier <cedric.ollivier@orange.com>2016-08-24 18:03:22 +0200
commitd6484df9b602f0888450ef1e29ccc0a5f6c94675 (patch)
tree76dc037a221f58c9fa18bbcce917ce45c60e33c6 /testcases
parent2002f166154ca5a9380f9d2da2843477669af8f5 (diff)
Stop calling exec_test.sh in the middle of python scripts
Now run_tests.py calls directly OpenDaylightTesting.functest_run(). It mainly reads env vars as exec_test.sh does. Change-Id: Ibb44a7ca67e9218d34d13b8dd539e772902fe5b8 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
Diffstat (limited to 'testcases')
-rwxr-xr-xtestcases/Controllers/ODL/OpenDaylightTesting.py45
-rw-r--r--testcases/Controllers/ODL/__init__.py0
-rw-r--r--testcases/Controllers/__init__.py0
3 files changed, 42 insertions, 3 deletions
diff --git a/testcases/Controllers/ODL/OpenDaylightTesting.py b/testcases/Controllers/ODL/OpenDaylightTesting.py
index d3bc0978..22df9f66 100755
--- a/testcases/Controllers/ODL/OpenDaylightTesting.py
+++ b/testcases/Controllers/ODL/OpenDaylightTesting.py
@@ -6,6 +6,7 @@ import os
import re
import shutil
import sys
+import urlparse
from robot import run
from robot.api import ExecutionResult, ResultVisitor
@@ -14,6 +15,7 @@ from robot.utils.robottime import timestamp_to_secs
import functest.utils.functest_logger as ft_logger
import functest.utils.functest_utils as ft_utils
+import functest.utils.openstack_utils as op_utils
class ODLResultVisitor(ResultVisitor):
@@ -60,7 +62,7 @@ class ODLTestCases:
except IOError as e:
cls.logger.error(
"Cannot copy OPNFV's testcases to ODL directory: "
- "%s" % e.strerror)
+ "%s" % str(e))
return False
return True
@@ -76,7 +78,7 @@ class ODLTestCases:
line.rstrip())
return True
except Exception as e:
- cls.logger.error("Cannot set ODL creds: %s" % e.strerror)
+ cls.logger.error("Cannot set ODL creds: %s" % str(e))
return False
@classmethod
@@ -95,7 +97,7 @@ class ODLTestCases:
'RESTCONFPORT:' + kwargs['odlrestconfport']]
except KeyError as e:
cls.logger.error("Cannot run ODL testcases. Please check "
- "%s" % e.strerror)
+ "%s" % str(e))
return False
if (cls.copy_opnf_testcases() and
cls.set_robotframework_vars(odlusername, odlpassword)):
@@ -122,6 +124,43 @@ class ODLTestCases:
return False
@classmethod
+ def functest_run(cls):
+ kclient = op_utils.get_keystone_client()
+ keystone_url = kclient.service_catalog.url_for(
+ service_type='identity', endpoint_type='publicURL')
+ neutron_url = kclient.service_catalog.url_for(
+ service_type='network', endpoint_type='publicURL')
+ kwargs = {'keystoneip': urlparse.urlparse(keystone_url).hostname}
+ kwargs['neutronip'] = urlparse.urlparse(neutron_url).hostname
+ kwargs['odlip'] = kwargs['neutronip']
+ kwargs['odlwebport'] = '8080'
+ kwargs['odlrestconfport'] = '8181'
+ kwargs['odlusername'] = 'admin'
+ kwargs['odlpassword'] = 'admin'
+ try:
+ installer_type = os.environ['INSTALLER_TYPE']
+ kwargs['osusername'] = os.environ['OS_USERNAME']
+ kwargs['ostenantname'] = os.environ['OS_TENANT_NAME']
+ kwargs['ospassword'] = os.environ['OS_PASSWORD']
+ if installer_type == 'fuel':
+ kwargs['odlwebport'] = '8282'
+ elif installer_type == 'apex':
+ kwargs['odlip'] = os.environ['SDN_CONTROLLER_IP']
+ kwargs['odlwebport'] = '8181'
+ elif installer_type == 'joid':
+ kwargs['odlip'] = os.environ['SDN_CONTROLLER']
+ elif installer_type == 'compass':
+ kwargs['odlwebport'] = '8181'
+ else:
+ kwargs['odlip'] = os.environ['SDN_CONTROLLER_IP']
+ except KeyError as e:
+ cls.logger.error("Cannot run ODL testcases. Please check env var: "
+ "%s" % str(e))
+ return False
+
+ return cls.run(**kwargs)
+
+ @classmethod
def push_to_db(cls):
try:
result = ExecutionResult(cls.res_dir + 'output.xml')
diff --git a/testcases/Controllers/ODL/__init__.py b/testcases/Controllers/ODL/__init__.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/testcases/Controllers/ODL/__init__.py
diff --git a/testcases/Controllers/__init__.py b/testcases/Controllers/__init__.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/testcases/Controllers/__init__.py