summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--docker/Dockerfile1
-rw-r--r--testcases/Controllers/ODL/CI/odlreport2db.py7
-rw-r--r--testcases/Controllers/ONOS/Teston/CI/onosfunctest.py13
-rw-r--r--testcases/VIM/OpenStack/CI/libraries/clean_openstack.py5
-rw-r--r--testcases/VIM/OpenStack/CI/libraries/generate_defaults.py6
-rwxr-xr-xtestcases/VIM/OpenStack/CI/libraries/run_rally-cert.py8
-rw-r--r--testcases/VIM/OpenStack/CI/libraries/run_tempest.py9
-rw-r--r--testcases/features/doctor.py5
-rw-r--r--testcases/features/promise.py8
-rw-r--r--testcases/tests/TestFunctestUtils.py7
-rw-r--r--testcases/vIMS/CI/vIMS.py23
-rw-r--r--testcases/vPing/CI/libraries/vPing_ssh.py8
-rw-r--r--testcases/vPing/CI/libraries/vPing_userdata.py16
13 files changed, 54 insertions, 62 deletions
diff --git a/docker/Dockerfile b/docker/Dockerfile
index 9aefc018f..b1e412473 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -33,6 +33,7 @@ ENV repos_dir /home/opnfv/repos
ENV creds /home/opnfv/functest/conf/openstack.creds
ENV TERM xterm
ENV COLORTERM gnome-terminal
+ENV PYTHONPATH $PYTHONPATH:/home/opnfv/repos/functest/testcases/
WORKDIR /home/opnfv
# Packaged dependencies
diff --git a/testcases/Controllers/ODL/CI/odlreport2db.py b/testcases/Controllers/ODL/CI/odlreport2db.py
index 3a696eb2d..f236ddcba 100644
--- a/testcases/Controllers/ODL/CI/odlreport2db.py
+++ b/testcases/Controllers/ODL/CI/odlreport2db.py
@@ -20,14 +20,13 @@
# 0.2: measure test duration and publish results under json format
#
#
-import xmltodict
+
+import getopt
import json
import sys
-import getopt
+import xmltodict
import yaml
-
-sys.path.append("/home/opnfv/repos/functest/testcases")
import functest_utils
diff --git a/testcases/Controllers/ONOS/Teston/CI/onosfunctest.py b/testcases/Controllers/ONOS/Teston/CI/onosfunctest.py
index 73b4b63ba..d36cf5edd 100644
--- a/testcases/Controllers/ONOS/Teston/CI/onosfunctest.py
+++ b/testcases/Controllers/ONOS/Teston/CI/onosfunctest.py
@@ -14,14 +14,15 @@ lanqinglong@huawei.com
#
"""
+import argparse
+import datetime
+import logging
import os
+import re
import time
-import sys
-import logging
import yaml
-import datetime
-import re
-import argparse
+
+import functest_utils
parser = argparse.ArgumentParser()
parser.add_argument("-i", "--installer", help="Installer type")
@@ -54,8 +55,6 @@ REPO_PATH = ONOS_REPO_PATH + '/functest/'
if not os.path.exists(REPO_PATH):
logger.error("Functest repository directory not found '%s'" % REPO_PATH)
exit(-1)
-sys.path.append(REPO_PATH + "testcases/")
-import functest_utils
ONOSCI_PATH = REPO_PATH + 'testcases/Controllers/ONOS/Teston/CI/'
starttime = datetime.datetime.now()
diff --git a/testcases/VIM/OpenStack/CI/libraries/clean_openstack.py b/testcases/VIM/OpenStack/CI/libraries/clean_openstack.py
index bff71f4e0..c5cfb07a8 100644
--- a/testcases/VIM/OpenStack/CI/libraries/clean_openstack.py
+++ b/testcases/VIM/OpenStack/CI/libraries/clean_openstack.py
@@ -23,7 +23,6 @@
import argparse
import logging
import os
-import sys
import time
import yaml
@@ -32,6 +31,8 @@ from neutronclient.v2_0 import client as neutronclient
from keystoneclient.v2_0 import client as keystoneclient
from cinderclient import client as cinderclient
+import openstack_utils
+
parser = argparse.ArgumentParser()
parser.add_argument("-d", "--debug", help="Debug mode", action="store_true")
args = parser.parse_args()
@@ -53,8 +54,6 @@ ch.setFormatter(formatter)
logger.addHandler(ch)
REPO_PATH = os.environ['repos_dir'] + '/functest/'
-sys.path.append(REPO_PATH + "testcases/")
-import openstack_utils
DEFAULTS_FILE = '/home/opnfv/functest/conf/os_defaults.yaml'
diff --git a/testcases/VIM/OpenStack/CI/libraries/generate_defaults.py b/testcases/VIM/OpenStack/CI/libraries/generate_defaults.py
index e67e4deec..5e799e4c9 100644
--- a/testcases/VIM/OpenStack/CI/libraries/generate_defaults.py
+++ b/testcases/VIM/OpenStack/CI/libraries/generate_defaults.py
@@ -23,7 +23,6 @@
import argparse
import logging
import os
-import sys
import yaml
from novaclient import client as novaclient
@@ -31,6 +30,8 @@ from neutronclient.v2_0 import client as neutronclient
from keystoneclient.v2_0 import client as keystoneclient
from cinderclient import client as cinderclient
+import openstack_utils
+
parser = argparse.ArgumentParser()
parser.add_argument("-d", "--debug", help="Debug mode", action="store_true")
args = parser.parse_args()
@@ -55,8 +56,7 @@ REPO_PATH = os.environ['repos_dir'] + '/functest/'
if not os.path.exists(REPO_PATH):
logger.error("Functest repository directory not found '%s'" % REPO_PATH)
exit(-1)
-sys.path.append(REPO_PATH + "testcases/")
-import openstack_utils
+
DEFAULTS_FILE = '/home/opnfv/functest/conf/os_defaults.yaml'
diff --git a/testcases/VIM/OpenStack/CI/libraries/run_rally-cert.py b/testcases/VIM/OpenStack/CI/libraries/run_rally-cert.py
index 3ac3d4490..6e625ce51 100755
--- a/testcases/VIM/OpenStack/CI/libraries/run_rally-cert.py
+++ b/testcases/VIM/OpenStack/CI/libraries/run_rally-cert.py
@@ -21,7 +21,6 @@ import os
import re
import requests
import subprocess
-import sys
import time
import yaml
@@ -31,6 +30,9 @@ from keystoneclient.v2_0 import client as keystoneclient
from neutronclient.v2_0 import client as neutronclient
from cinderclient import client as cinderclient
+import functest_utils
+import openstack_utils
+
""" tests configuration """
tests = ['authenticate', 'glance', 'cinder', 'heat', 'keystone',
'neutron', 'nova', 'quotas', 'requests', 'vm', 'all']
@@ -87,9 +89,7 @@ REPO_PATH = os.environ['repos_dir'] + '/functest/'
if not os.path.exists(REPO_PATH):
logger.error("Functest repository directory not found '%s'" % REPO_PATH)
exit(-1)
-sys.path.append(REPO_PATH + "testcases/")
-import functest_utils
-import openstack_utils
+
with open("/home/opnfv/functest/conf/config_functest.yaml") as f:
functest_yaml = yaml.safe_load(f)
diff --git a/testcases/VIM/OpenStack/CI/libraries/run_tempest.py b/testcases/VIM/OpenStack/CI/libraries/run_tempest.py
index 951210ce9..9d8b7be8b 100644
--- a/testcases/VIM/OpenStack/CI/libraries/run_tempest.py
+++ b/testcases/VIM/OpenStack/CI/libraries/run_tempest.py
@@ -21,12 +21,15 @@ import re
import requests
import shutil
import subprocess
-import sys
import time
import yaml
+
import keystoneclient.v2_0.client as ksclient
from neutronclient.v2_0 import client as neutronclient
+import functest_utils
+import openstack_utils
+
modes = ['full', 'smoke', 'baremetal', 'compute', 'data_processing',
'identity', 'image', 'network', 'object_storage', 'orchestration',
'telemetry', 'volume', 'custom', 'defcore']
@@ -67,9 +70,7 @@ ch.setFormatter(formatter)
logger.addHandler(ch)
REPO_PATH = os.environ['repos_dir'] + '/functest/'
-sys.path.append(REPO_PATH + "testcases/")
-import functest_utils
-import openstack_utils
+
with open("/home/opnfv/functest/conf/config_functest.yaml") as f:
functest_yaml = yaml.safe_load(f)
diff --git a/testcases/features/doctor.py b/testcases/features/doctor.py
index 0c1f713e7..9ca6bf618 100644
--- a/testcases/features/doctor.py
+++ b/testcases/features/doctor.py
@@ -15,10 +15,10 @@
#
import logging
-import sys
import time
import yaml
+import functest_utils
with open('/home/opnfv/functest/conf/config_functest.yaml') as f:
functest_yaml = yaml.safe_load(f)
@@ -28,9 +28,6 @@ FUNCTEST_REPO = dirs.get('dir_repo_functest')
DOCTOR_REPO = dirs.get('dir_repo_doctor')
TEST_DB_URL = functest_yaml.get('results').get('test_db_url')
-sys.path.append('%s/testcases' % FUNCTEST_REPO)
-import functest_utils
-
logger = logging.getLogger('doctor')
logger.setLevel(logging.DEBUG)
ch = logging.StreamHandler()
diff --git a/testcases/features/promise.py b/testcases/features/promise.py
index d501d6764..04ca87a70 100644
--- a/testcases/features/promise.py
+++ b/testcases/features/promise.py
@@ -15,7 +15,6 @@ import logging
import os
import requests
import subprocess
-import sys
import yaml
import keystoneclient.v2_0.client as ksclient
@@ -23,6 +22,9 @@ import glanceclient.client as glclient
import novaclient.client as nvclient
from neutronclient.v2_0 import client as ntclient
+import functest_utils
+import openstack_utils
+
parser = argparse.ArgumentParser()
parser.add_argument("-d", "--debug", help="Debug mode", action="store_true")
@@ -58,10 +60,6 @@ GLANCE_IMAGE_FORMAT = functest_yaml.get('general'). \
GLANCE_IMAGE_PATH = functest_yaml.get('general'). \
get('directories').get('dir_functest_data') + "/" + GLANCE_IMAGE_FILENAME
-sys.path.append('%s/testcases' % FUNCTEST_REPO)
-import functest_utils
-import openstack_utils
-
""" logging configuration """
logger = logging.getLogger('Promise')
logger.setLevel(logging.DEBUG)
diff --git a/testcases/tests/TestFunctestUtils.py b/testcases/tests/TestFunctestUtils.py
index 024088b13..e1f81ecdf 100644
--- a/testcases/tests/TestFunctestUtils.py
+++ b/testcases/tests/TestFunctestUtils.py
@@ -1,9 +1,8 @@
-import unittest
+#!/usr/bin/python
+
import os
-import sys
+import unittest
import yaml
-
-sys.path.append("../")
from functest_utils import getTestEnv, isTestRunnable, generateTestcaseList
diff --git a/testcases/vIMS/CI/vIMS.py b/testcases/vIMS/CI/vIMS.py
index 2518855cd..fcc056357 100644
--- a/testcases/vIMS/CI/vIMS.py
+++ b/testcases/vIMS/CI/vIMS.py
@@ -11,24 +11,26 @@
# http://www.apache.org/licenses/LICENSE-2.0
########################################################################
-import os
-import time
-import subprocess
-import logging
import argparse
-import yaml
-import pprint
-import sys
-import json
import datetime
+import json
+import logging
+import os
+import pprint
import requests
+import subprocess
+import time
+import yaml
+
import keystoneclient.v2_0.client as ksclient
import glanceclient.client as glclient
import novaclient.client as nvclient
from neutronclient.v2_0 import client as ntclient
-import orchestrator
import clearwater
+import functest_utils
+import openstack_utils
+import orchestrator
pp = pprint.PrettyPrinter(indent=4)
@@ -61,9 +63,6 @@ REPO_PATH = os.environ['repos_dir'] + '/functest/'
if not os.path.exists(REPO_PATH):
logger.error("Functest repository directory not found '%s'" % REPO_PATH)
exit(-1)
-sys.path.append(REPO_PATH + "testcases/")
-import functest_utils
-import openstack_utils
with open("/home/opnfv/functest/conf/config_functest.yaml") as f:
functest_yaml = yaml.safe_load(f)
diff --git a/testcases/vPing/CI/libraries/vPing_ssh.py b/testcases/vPing/CI/libraries/vPing_ssh.py
index dc46c89d4..3d2ff7084 100644
--- a/testcases/vPing/CI/libraries/vPing_ssh.py
+++ b/testcases/vPing/CI/libraries/vPing_ssh.py
@@ -20,15 +20,18 @@ import os
import paramiko
import pprint
import re
-import sys
import time
import yaml
from scp import SCPClient
+
from novaclient import client as novaclient
from neutronclient.v2_0 import client as neutronclient
from keystoneclient.v2_0 import client as keystoneclient
from glanceclient import client as glanceclient
+import functest_utils
+import openstack_utils
+
pp = pprint.PrettyPrinter(indent=4)
parser = argparse.ArgumentParser()
@@ -64,9 +67,6 @@ REPO_PATH = os.environ['repos_dir'] + '/functest/'
if not os.path.exists(REPO_PATH):
logger.error("Functest repository directory not found '%s'" % REPO_PATH)
exit(-1)
-sys.path.append(REPO_PATH + "testcases/")
-import functest_utils
-import openstack_utils
with open("/home/opnfv/functest/conf/config_functest.yaml") as f:
functest_yaml = yaml.safe_load(f)
diff --git a/testcases/vPing/CI/libraries/vPing_userdata.py b/testcases/vPing/CI/libraries/vPing_userdata.py
index 20a47aeaf..0adfc6dbd 100644
--- a/testcases/vPing/CI/libraries/vPing_userdata.py
+++ b/testcases/vPing/CI/libraries/vPing_userdata.py
@@ -14,19 +14,22 @@
#
#
-import os
-import time
import argparse
-import pprint
-import sys
+import datetime
import logging
+import os
+import pprint
+import time
import yaml
-import datetime
+
from novaclient import client as novaclient
from neutronclient.v2_0 import client as neutronclient
from keystoneclient.v2_0 import client as keystoneclient
from glanceclient import client as glanceclient
+import functest_utils
+import openstack_utils
+
pp = pprint.PrettyPrinter(indent=4)
parser = argparse.ArgumentParser()
@@ -61,9 +64,6 @@ REPO_PATH = os.environ['repos_dir'] + '/functest/'
if not os.path.exists(REPO_PATH):
logger.error("Functest repository directory not found '%s'" % REPO_PATH)
exit(-1)
-sys.path.append(REPO_PATH + "testcases/")
-import functest_utils
-import openstack_utils
with open("/home/opnfv/functest/conf/config_functest.yaml") as f:
functest_yaml = yaml.safe_load(f)