aboutsummaryrefslogtreecommitdiffstats
path: root/functest
diff options
context:
space:
mode:
Diffstat (limited to 'functest')
-rw-r--r--functest/ci/rally_aarch64_patch.conf4
-rwxr-xr-xfunctest/ci/run_tests.py2
-rw-r--r--functest/core/feature.py5
-rw-r--r--functest/core/pytest_suite_runner.py4
-rw-r--r--functest/core/testcase.py5
-rw-r--r--functest/core/vnf_base.py5
-rw-r--r--functest/opnfv_tests/features/barometer.py4
-rw-r--r--functest/opnfv_tests/features/copper.py4
-rw-r--r--functest/opnfv_tests/features/doctor.py4
-rw-r--r--functest/opnfv_tests/features/domino.py4
-rw-r--r--functest/opnfv_tests/features/netready.py4
-rw-r--r--functest/opnfv_tests/features/odl_sfc.py4
-rw-r--r--functest/opnfv_tests/features/promise.py4
-rw-r--r--functest/opnfv_tests/features/sdnvpn.py4
-rw-r--r--functest/opnfv_tests/features/security_scan.py4
-rw-r--r--functest/opnfv_tests/openstack/rally/rally.py14
-rwxr-xr-xfunctest/opnfv_tests/openstack/refstack_client/refstack_client.py8
-rwxr-xr-xfunctest/opnfv_tests/openstack/refstack_client/tempest_conf.py19
-rw-r--r--functest/opnfv_tests/openstack/snaps/api_check.py5
-rw-r--r--functest/opnfv_tests/openstack/snaps/connection_check.py5
-rw-r--r--functest/opnfv_tests/openstack/snaps/health_check.py5
-rw-r--r--functest/opnfv_tests/openstack/snaps/smoke.py5
-rw-r--r--functest/opnfv_tests/openstack/snaps/snaps_test_runner.py4
-rw-r--r--functest/opnfv_tests/openstack/tempest/tempest.py34
-rw-r--r--functest/opnfv_tests/openstack/vping/vping_base.py4
-rwxr-xr-xfunctest/opnfv_tests/openstack/vping/vping_ssh.py5
-rwxr-xr-xfunctest/opnfv_tests/openstack/vping/vping_userdata.py5
-rwxr-xr-xfunctest/opnfv_tests/sdn/odl/odl.py4
-rw-r--r--functest/opnfv_tests/sdn/onos/onos.py8
-rwxr-xr-xfunctest/opnfv_tests/vnf/aaa/aaa.py3
-rw-r--r--functest/opnfv_tests/vnf/ims/clearwater_ims_base.py3
-rw-r--r--functest/opnfv_tests/vnf/ims/cloudify_ims.py4
-rw-r--r--functest/opnfv_tests/vnf/ims/opera_ims.py4
-rwxr-xr-xfunctest/opnfv_tests/vnf/ims/orchestra_ims.py66
-rw-r--r--functest/opnfv_tests/vnf/ims/orchestra_ims.yaml2
-rw-r--r--functest/tests/unit/core/test_feature.py108
-rw-r--r--functest/tests/unit/core/test_testcase.py15
-rw-r--r--functest/tests/unit/core/test_vnf_base.py3
-rw-r--r--functest/tests/unit/features/__init__.py0
-rw-r--r--functest/tests/unit/features/test_barometer.py55
-rw-r--r--functest/tests/unit/features/test_copper.py38
-rw-r--r--functest/tests/unit/features/test_doctor.py38
-rw-r--r--functest/tests/unit/features/test_domino.py38
-rw-r--r--functest/tests/unit/features/test_netready.py39
-rw-r--r--functest/tests/unit/features/test_odl_sfc.py39
-rw-r--r--functest/tests/unit/features/test_promise.py39
-rw-r--r--functest/tests/unit/features/test_sdnvpn.py39
-rw-r--r--functest/tests/unit/features/test_security_scan.py42
48 files changed, 627 insertions, 134 deletions
diff --git a/functest/ci/rally_aarch64_patch.conf b/functest/ci/rally_aarch64_patch.conf
index a49588bf8..e5cae8137 100644
--- a/functest/ci/rally_aarch64_patch.conf
+++ b/functest/ci/rally_aarch64_patch.conf
@@ -1,5 +1,5 @@
img_name_regex = ^TestVM$
img_url = http://download.cirros-cloud.net/daily/20161201/cirros-d161201-aarch64-disk.img
-flavor_ref_ram = 128
+flavor_ref_ram = 256
flavor_ref_alt_ram = 256
-heat_instance_type_ram = 128
+heat_instance_type_ram = 256
diff --git a/functest/ci/run_tests.py b/functest/ci/run_tests.py
index 37b90f922..5793c04a7 100755
--- a/functest/ci/run_tests.py
+++ b/functest/ci/run_tests.py
@@ -144,7 +144,7 @@ def run_test(test, tier_name, testcases=None):
try:
module = importlib.import_module(run_dict['module'])
cls = getattr(module, run_dict['class'])
- test_case = cls()
+ test_case = cls(case_name=test_name)
try:
kwargs = run_dict['args']
diff --git a/functest/core/feature.py b/functest/core/feature.py
index 325c10d49..5149f80fd 100644
--- a/functest/core/feature.py
+++ b/functest/core/feature.py
@@ -8,10 +8,9 @@ from functest.utils.constants import CONST
class Feature(base.TestCase):
- def __init__(self, project='functest', case='', repo='', cmd=''):
- super(Feature, self).__init__()
+ def __init__(self, project='functest', case_name='', repo='', cmd=''):
+ super(Feature, self).__init__(case_name=case_name)
self.project_name = project
- self.case_name = case
self.cmd = cmd
self.repo = CONST.__getattribute__(repo)
self.result_file = self.get_result_file()
diff --git a/functest/core/pytest_suite_runner.py b/functest/core/pytest_suite_runner.py
index 4f777628a..9cfaea7ae 100644
--- a/functest/core/pytest_suite_runner.py
+++ b/functest/core/pytest_suite_runner.py
@@ -15,8 +15,8 @@ class PyTestSuiteRunner(base.TestCase):
This superclass is designed to execute pre-configured unittest.TestSuite()
objects
"""
- def __init__(self):
- super(PyTestSuiteRunner, self).__init__()
+ def __init__(self, case_name=''):
+ super(PyTestSuiteRunner, self).__init__(case_name)
self.suite = None
def run(self, **kwargs):
diff --git a/functest/core/testcase.py b/functest/core/testcase.py
index b540cfb5a..8c5fd6476 100644
--- a/functest/core/testcase.py
+++ b/functest/core/testcase.py
@@ -27,10 +27,10 @@ class TestCase(object):
logger = ft_logger.Logger(__name__).getLogger()
- def __init__(self):
+ def __init__(self, case_name=""):
self.details = {}
self.project_name = "functest"
- self.case_name = ""
+ self.case_name = case_name
self.criteria = ""
self.start_time = ""
self.stop_time = ""
@@ -87,6 +87,7 @@ class TestCase(object):
It could be overriden if the common implementation is not
suitable. The following attributes must be set before pushing
the results to DB:
+ * project_name,
* case_name,
* criteria,
* start_time,
diff --git a/functest/core/vnf_base.py b/functest/core/vnf_base.py
index 3f0adcc66..3d3a441f4 100644
--- a/functest/core/vnf_base.py
+++ b/functest/core/vnf_base.py
@@ -21,11 +21,10 @@ class VnfOnBoardingBase(base.TestCase):
logger = ft_logger.Logger(__name__).getLogger()
- def __init__(self, project='functest', case='', repo='', cmd=''):
- super(VnfOnBoardingBase, self).__init__()
+ def __init__(self, project='functest', case_name='', repo='', cmd=''):
+ super(VnfOnBoardingBase, self).__init__(case_name=case_name)
self.repo = repo
self.project_name = project
- self.case_name = case
self.cmd = cmd
self.details = {}
self.result_dir = CONST.dir_results
diff --git a/functest/opnfv_tests/features/barometer.py b/functest/opnfv_tests/features/barometer.py
index 6011340f8..6207f5814 100644
--- a/functest/opnfv_tests/features/barometer.py
+++ b/functest/opnfv_tests/features/barometer.py
@@ -16,9 +16,9 @@ class BarometerCollectd(base.Feature):
Class for executing barometercollectd testcase.
'''
- def __init__(self):
+ def __init__(self, case_name='barometercollectd'):
super(BarometerCollectd, self).__init__(project='barometer',
- case='barometercollectd',
+ case_name=case_name,
repo='dir_repo_barometer')
def execute(self):
diff --git a/functest/opnfv_tests/features/copper.py b/functest/opnfv_tests/features/copper.py
index 689341eab..5b88a4995 100644
--- a/functest/opnfv_tests/features/copper.py
+++ b/functest/opnfv_tests/features/copper.py
@@ -18,8 +18,8 @@ import functest.core.feature as base
class Copper(base.Feature):
- def __init__(self):
+ def __init__(self, case_name='copper-notification'):
super(Copper, self).__init__(project='copper',
- case='copper-notification',
+ case_name=case_name,
repo='dir_repo_copper')
self.cmd = 'cd %s/tests && bash run.sh && cd -' % self.repo
diff --git a/functest/opnfv_tests/features/doctor.py b/functest/opnfv_tests/features/doctor.py
index d32bbfc99..fd181a040 100644
--- a/functest/opnfv_tests/features/doctor.py
+++ b/functest/opnfv_tests/features/doctor.py
@@ -17,8 +17,8 @@ import functest.core.feature as base
class Doctor(base.Feature):
- def __init__(self):
+ def __init__(self, case_name='doctor-notification'):
super(Doctor, self).__init__(project='doctor',
- case='doctor-notification',
+ case_name=case_name,
repo='dir_repo_doctor')
self.cmd = 'cd %s/tests && ./run.sh' % self.repo
diff --git a/functest/opnfv_tests/features/domino.py b/functest/opnfv_tests/features/domino.py
index e34429bc2..1c620235c 100644
--- a/functest/opnfv_tests/features/domino.py
+++ b/functest/opnfv_tests/features/domino.py
@@ -18,8 +18,8 @@ import functest.core.feature as base
class Domino(base.Feature):
- def __init__(self):
+ def __init__(self, case_name='domino-multinode'):
super(Domino, self).__init__(project='domino',
- case='domino-multinode',
+ case_name=case_name,
repo='dir_repo_domino')
self.cmd = 'cd %s && ./tests/run_multinode.sh' % self.repo
diff --git a/functest/opnfv_tests/features/netready.py b/functest/opnfv_tests/features/netready.py
index 88f377c26..ada322c18 100644
--- a/functest/opnfv_tests/features/netready.py
+++ b/functest/opnfv_tests/features/netready.py
@@ -13,9 +13,9 @@ import functest.core.feature as base
class GluonVping(base.Feature):
- def __init__(self):
+ def __init__(self, case_name='gluon_vping'):
super(GluonVping, self).__init__(project='netready',
- case='gluon_vping',
+ case_name=case_name,
repo='dir_repo_netready')
dir_netready_functest = '{}/test/functest'.format(self.repo)
self.cmd = ('cd %s && python ./gluon-test-suite.py' %
diff --git a/functest/opnfv_tests/features/odl_sfc.py b/functest/opnfv_tests/features/odl_sfc.py
index fff7f2b0d..f96683e36 100644
--- a/functest/opnfv_tests/features/odl_sfc.py
+++ b/functest/opnfv_tests/features/odl_sfc.py
@@ -12,9 +12,9 @@ import functest.core.feature as base
class OpenDaylightSFC(base.Feature):
- def __init__(self):
+ def __init__(self, case_name='functest-odl-sfc'):
super(OpenDaylightSFC, self).__init__(project='sfc',
- case='functest-odl-sfc',
+ case_name=case_name,
repo='dir_repo_sfc')
dir_sfc_functest = '{}/sfc/tests/functest'.format(self.repo)
self.cmd = 'cd %s && python ./run_tests.py' % dir_sfc_functest
diff --git a/functest/opnfv_tests/features/promise.py b/functest/opnfv_tests/features/promise.py
index a7f4e6283..e3dc7fdf5 100644
--- a/functest/opnfv_tests/features/promise.py
+++ b/functest/opnfv_tests/features/promise.py
@@ -16,9 +16,9 @@ import functest.core.feature as base
class Promise(base.Feature):
- def __init__(self):
+ def __init__(self, case_name='promise'):
super(Promise, self).__init__(project='promise',
- case='promise',
+ case_name=case_name,
repo='dir_repo_promise')
dir_promise_functest = '{}/promise/test/functest'.format(self.repo)
self.cmd = 'cd %s && python ./run_tests.py' % dir_promise_functest
diff --git a/functest/opnfv_tests/features/sdnvpn.py b/functest/opnfv_tests/features/sdnvpn.py
index 10e3146c8..5e9254a0b 100644
--- a/functest/opnfv_tests/features/sdnvpn.py
+++ b/functest/opnfv_tests/features/sdnvpn.py
@@ -12,9 +12,9 @@ import functest.core.feature as base
class SdnVpnTests(base.Feature):
- def __init__(self):
+ def __init__(self, case_name='bgpvpn'):
super(SdnVpnTests, self).__init__(project='sdnvpn',
- case='bgpvpn',
+ case_name=case_name,
repo='dir_repo_sdnvpn')
dir_sfc_functest = '{}/sdnvpn/test/functest'.format(self.repo)
self.cmd = 'cd %s && python ./run_tests.py' % dir_sfc_functest
diff --git a/functest/opnfv_tests/features/security_scan.py b/functest/opnfv_tests/features/security_scan.py
index 2374b39fe..e72563808 100644
--- a/functest/opnfv_tests/features/security_scan.py
+++ b/functest/opnfv_tests/features/security_scan.py
@@ -13,9 +13,9 @@ from functest.utils.constants import CONST
class SecurityScan(base.Feature):
- def __init__(self):
+ def __init__(self, case_name='security_scan'):
super(SecurityScan, self).__init__(project='securityscanning',
- case='security_scan',
+ case_name=case_name,
repo='dir_repo_securityscan')
self.cmd = ('. {0}/stackrc && '
'cd {1} && '
diff --git a/functest/opnfv_tests/openstack/rally/rally.py b/functest/opnfv_tests/openstack/rally/rally.py
index 8c6abc157..e7411c51d 100644
--- a/functest/opnfv_tests/openstack/rally/rally.py
+++ b/functest/opnfv_tests/openstack/rally/rally.py
@@ -56,8 +56,8 @@ class RallyBase(testcase.TestCase):
RALLY_PRIVATE_SUBNET_CIDR = CONST.rally_subnet_cidr
RALLY_ROUTER_NAME = CONST.rally_router_name
- def __init__(self):
- super(RallyBase, self).__init__()
+ def __init__(self, case_name=''):
+ super(RallyBase, self).__init__(case_name)
self.mode = ''
self.summary = []
self.scenario_dir = ''
@@ -536,9 +536,8 @@ class RallyBase(testcase.TestCase):
class RallySanity(RallyBase):
- def __init__(self):
- super(RallySanity, self).__init__()
- self.case_name = 'rally_sanity'
+ def __init__(self, case_name="rally_sanity"):
+ super(RallySanity, self).__init__(case_name)
self.mode = 'sanity'
self.test_name = 'all'
self.smoke = True
@@ -546,9 +545,8 @@ class RallySanity(RallyBase):
class RallyFull(RallyBase):
- def __init__(self):
- super(RallyFull, self).__init__()
- self.case_name = 'rally_full'
+ def __init__(self, case_name="rally_full"):
+ super(RallyFull, self).__init__(case_name)
self.mode = 'full'
self.test_name = 'all'
self.smoke = False
diff --git a/functest/opnfv_tests/openstack/refstack_client/refstack_client.py b/functest/opnfv_tests/openstack/refstack_client/refstack_client.py
index 37aa9e399..441abfee3 100755
--- a/functest/opnfv_tests/openstack/refstack_client/refstack_client.py
+++ b/functest/opnfv_tests/openstack/refstack_client/refstack_client.py
@@ -25,9 +25,8 @@ logger = ft_logger.Logger("refstack_defcore").getLogger()
class RefstackClient(testcase.TestCase):
- def __init__(self):
- super(RefstackClient, self).__init__()
- self.case_name = "refstack_defcore"
+ def __init__(self, case_name="refstack_defcore"):
+ super(RefstackClient, self).__init__(case_name)
self.FUNCTEST_TEST = CONST.dir_functest_test
self.CONF_PATH = CONST.refstack_tempest_conf_path
self.DEFCORE_LIST = CONST.refstack_defcore_list
@@ -192,10 +191,9 @@ class RefstackClient(testcase.TestCase):
return res
-class RefstackClientParser(testcase.TestCase):
+class RefstackClientParser(object):
def __init__(self):
- super(RefstackClientParser, self).__init__()
self.FUNCTEST_TEST = CONST.dir_functest_test
self.CONF_PATH = CONST.refstack_tempest_conf_path
self.DEFCORE_LIST = CONST.refstack_defcore_list
diff --git a/functest/opnfv_tests/openstack/refstack_client/tempest_conf.py b/functest/opnfv_tests/openstack/refstack_client/tempest_conf.py
index 5624ed79b..d01f08727 100755
--- a/functest/opnfv_tests/openstack/refstack_client/tempest_conf.py
+++ b/functest/opnfv_tests/openstack/refstack_client/tempest_conf.py
@@ -5,9 +5,8 @@
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
-import sys
+import os
-from functest.core import testcase
from functest.opnfv_tests.openstack.tempest import conf_utils
from functest.utils import openstack_utils
from functest.utils.constants import CONST
@@ -25,6 +24,8 @@ class TempestConf(object):
self.DEPLOYMENT_ID = conf_utils.get_verifier_deployment_id()
self.DEPLOYMENT_DIR = conf_utils.get_verifier_deployment_dir(
self.VERIFIER_ID, self.DEPLOYMENT_ID)
+ self.confpath = os.path.join(CONST.dir_functest_test,
+ CONST.refstack_tempest_conf_path)
def generate_tempestconf(self):
try:
@@ -33,21 +34,19 @@ class TempestConf(object):
use_custom_images=True, use_custom_flavors=True)
conf_utils.configure_tempest_defcore(
self.DEPLOYMENT_DIR, img_flavor_dict)
- except KeyError as e:
- logger.error("defcore prepare env error with: %s", e)
+ except Exception as e:
+ logger.error("error with generating refstack client "
+ "reference tempest conf file: %s", e)
def main(self):
try:
self.generate_tempestconf()
- res = testcase.TestCase.EX_OK
+ logger.info("a reference tempest conf file generated "
+ "at %s", self.confpath)
except Exception as e:
logger.error('Error with run: %s', e)
- res = testcase.TestCase.EX_RUN_ERROR
- return res
if __name__ == '__main__':
tempestconf = TempestConf()
- result = tempestconf.main()
- if result != testcase.TestCase.EX_OK:
- sys.exit(result)
+ tempestconf.main()
diff --git a/functest/opnfv_tests/openstack/snaps/api_check.py b/functest/opnfv_tests/openstack/snaps/api_check.py
index ad77d9be3..dea1ca759 100644
--- a/functest/opnfv_tests/openstack/snaps/api_check.py
+++ b/functest/opnfv_tests/openstack/snaps/api_check.py
@@ -20,11 +20,10 @@ class ApiCheck(SnapsTestRunner):
that exercise many of the OpenStack APIs within Keystone, Glance, Neutron,
and Nova
"""
- def __init__(self):
- super(ApiCheck, self).__init__()
+ def __init__(self, case_name="api_check"):
+ super(ApiCheck, self).__init__(case_name)
self.suite = unittest.TestSuite()
- self.case_name = "api_check"
test_suite_builder.add_openstack_api_tests(
self.suite,
diff --git a/functest/opnfv_tests/openstack/snaps/connection_check.py b/functest/opnfv_tests/openstack/snaps/connection_check.py
index 0637bcfb3..57b74d4c2 100644
--- a/functest/opnfv_tests/openstack/snaps/connection_check.py
+++ b/functest/opnfv_tests/openstack/snaps/connection_check.py
@@ -20,11 +20,10 @@ class ConnectionCheck(SnapsTestRunner):
that simply obtain the different OpenStack clients and may perform
simple queries
"""
- def __init__(self):
- super(ConnectionCheck, self).__init__()
+ def __init__(self, case_name="connection_check"):
+ super(ConnectionCheck, self).__init__(case_name)
self.suite = unittest.TestSuite()
- self.case_name = "connection_check"
test_suite_builder.add_openstack_client_tests(
self.suite,
diff --git a/functest/opnfv_tests/openstack/snaps/health_check.py b/functest/opnfv_tests/openstack/snaps/health_check.py
index 8fece7465..6b3cfdd0d 100644
--- a/functest/opnfv_tests/openstack/snaps/health_check.py
+++ b/functest/opnfv_tests/openstack/snaps/health_check.py
@@ -21,11 +21,10 @@ class HealthCheck(SnapsTestRunner):
creates a VM with a single port with an IPv4 address that is assigned by
DHCP. This test then validates the expected IP with the actual
"""
- def __init__(self):
- super(HealthCheck, self).__init__()
+ def __init__(self, case_name="snaps_health_check"):
+ super(HealthCheck, self).__init__(case_name)
self.suite = unittest.TestSuite()
- self.case_name = "snaps_health_check"
image_custom_config = None
if hasattr(CONST, 'snaps_health_check'):
diff --git a/functest/opnfv_tests/openstack/snaps/smoke.py b/functest/opnfv_tests/openstack/snaps/smoke.py
index 45fa6de86..63d5c1223 100644
--- a/functest/opnfv_tests/openstack/snaps/smoke.py
+++ b/functest/opnfv_tests/openstack/snaps/smoke.py
@@ -21,11 +21,10 @@ class SnapsSmoke(SnapsTestRunner):
that exercise many of the OpenStack APIs within Keystone, Glance, Neutron,
and Nova
"""
- def __init__(self):
- super(SnapsSmoke, self).__init__()
+ def __init__(self, case_name="snaps_smoke"):
+ super(SnapsSmoke, self).__init__(case_name)
self.suite = unittest.TestSuite()
- self.case_name = "snaps_smoke"
use_fip = CONST.snaps_use_floating_ips
# The snaps smoke test uses the same config as the
diff --git a/functest/opnfv_tests/openstack/snaps/snaps_test_runner.py b/functest/opnfv_tests/openstack/snaps/snaps_test_runner.py
index 9d723905f..044a0bb04 100644
--- a/functest/opnfv_tests/openstack/snaps/snaps_test_runner.py
+++ b/functest/opnfv_tests/openstack/snaps/snaps_test_runner.py
@@ -19,8 +19,8 @@ class SnapsTestRunner(PyTestSuiteRunner):
creates a VM with a single port with an IPv4 address that is assigned by
DHCP. This test then validates the expected IP with the actual
"""
- def __init__(self):
- super(SnapsTestRunner, self).__init__()
+ def __init__(self, case_name=''):
+ super(SnapsTestRunner, self).__init__(case_name)
self.ext_net_name = snaps_utils.get_ext_net_name()
self.logger = ft_logger.Logger(self.project_name).getLogger()
diff --git a/functest/opnfv_tests/openstack/tempest/tempest.py b/functest/opnfv_tests/openstack/tempest/tempest.py
index 0addbd172..c3184e352 100644
--- a/functest/opnfv_tests/openstack/tempest/tempest.py
+++ b/functest/opnfv_tests/openstack/tempest/tempest.py
@@ -28,8 +28,8 @@ logger = ft_logger.Logger("Tempest").getLogger()
class TempestCommon(testcase.TestCase):
- def __init__(self):
- super(TempestCommon, self).__init__()
+ def __init__(self, case_name=''):
+ super(TempestCommon, self).__init__(case_name)
self.MODE = ""
self.OPTION = ""
self.VERIFIER_ID = conf_utils.get_verifier_id()
@@ -234,35 +234,31 @@ class TempestCommon(testcase.TestCase):
class TempestSmokeSerial(TempestCommon):
- def __init__(self):
- TempestCommon.__init__(self)
- self.case_name = "tempest_smoke_serial"
+ def __init__(self, case_name='tempest_smoke_serial'):
+ TempestCommon.__init__(self, case_name)
self.MODE = "smoke"
self.OPTION = "--concurrency 1"
class TempestSmokeParallel(TempestCommon):
- def __init__(self):
- TempestCommon.__init__(self)
- self.case_name = "tempest_smoke_parallel"
+ def __init__(self, case_name='tempest_smoke_parallel'):
+ TempestCommon.__init__(self, case_name)
self.MODE = "smoke"
self.OPTION = ""
class TempestFullParallel(TempestCommon):
- def __init__(self):
- TempestCommon.__init__(self)
- self.case_name = "tempest_full_parallel"
+ def __init__(self, case_name="tempest_full_parallel"):
+ TempestCommon.__init__(self, case_name)
self.MODE = "full"
class TempestMultisite(TempestCommon):
- def __init__(self):
- TempestCommon.__init__(self)
- self.case_name = "multisite"
+ def __init__(self, case_name="multisite"):
+ TempestCommon.__init__(self, case_name)
self.MODE = "feature_multisite"
self.OPTION = "--concurrency 1"
conf_utils.install_verifier_ext(CONST.dir_repo_kingbird)
@@ -270,17 +266,15 @@ class TempestMultisite(TempestCommon):
class TempestCustom(TempestCommon):
- def __init__(self):
- TempestCommon.__init__(self)
- self.case_name = "tempest_custom"
+ def __init__(self, case_name="tempest_custom"):
+ TempestCommon.__init__(self, case_name)
self.MODE = "custom"
self.OPTION = "--concurrency 1"
class TempestDefcore(TempestCommon):
- def __init__(self):
- TempestCommon.__init__(self)
- self.case_name = "tempest_defcore"
+ def __init__(self, case_name="tempest_defcore"):
+ TempestCommon.__init__(self, case_name)
self.MODE = "defcore"
self.OPTION = "--concurrency 1"
diff --git a/functest/opnfv_tests/openstack/vping/vping_base.py b/functest/opnfv_tests/openstack/vping/vping_base.py
index 584ded386..64cb0004d 100644
--- a/functest/opnfv_tests/openstack/vping/vping_base.py
+++ b/functest/opnfv_tests/openstack/vping/vping_base.py
@@ -18,8 +18,8 @@ from functest.utils.constants import CONST
class VPingBase(testcase.TestCase):
- def __init__(self):
- super(VPingBase, self).__init__()
+ def __init__(self, case_name=''):
+ super(VPingBase, self).__init__(case_name)
self.logger = None
self.functest_repo = CONST.dir_repo_functest
self.repo = CONST.dir_vping
diff --git a/functest/opnfv_tests/openstack/vping/vping_ssh.py b/functest/opnfv_tests/openstack/vping/vping_ssh.py
index fc2f01c64..a68b0ff75 100755
--- a/functest/opnfv_tests/openstack/vping/vping_ssh.py
+++ b/functest/opnfv_tests/openstack/vping/vping_ssh.py
@@ -24,9 +24,8 @@ import functest.core.testcase as testcase
class VPingSSH(vping_base.VPingBase):
- def __init__(self):
- super(VPingSSH, self).__init__()
- self.case_name = 'vping_ssh'
+ def __init__(self, case_name='vping_ssh'):
+ super(VPingSSH, self).__init__(case_name)
self.logger = ft_logger.Logger(self.case_name).getLogger()
def do_vping(self, vm, test_ip):
diff --git a/functest/opnfv_tests/openstack/vping/vping_userdata.py b/functest/opnfv_tests/openstack/vping/vping_userdata.py
index fa91c12a6..e9b869983 100755
--- a/functest/opnfv_tests/openstack/vping/vping_userdata.py
+++ b/functest/opnfv_tests/openstack/vping/vping_userdata.py
@@ -18,9 +18,8 @@ import vping_base
class VPingUserdata(vping_base.VPingBase):
- def __init__(self):
- super(VPingUserdata, self).__init__()
- self.case_name = 'vping_userdata'
+ def __init__(self, case_name='vping_userdata'):
+ super(VPingUserdata, self).__init__(case_name)
self.logger = ft_logger.Logger(self.case_name).getLogger()
def boot_vm_preparation(self, config, vmname, test_ip):
diff --git a/functest/opnfv_tests/sdn/odl/odl.py b/functest/opnfv_tests/sdn/odl/odl.py
index ccc1101a5..c0e2a9aeb 100755
--- a/functest/opnfv_tests/sdn/odl/odl.py
+++ b/functest/opnfv_tests/sdn/odl/odl.py
@@ -72,10 +72,6 @@ class ODLTests(testcase.TestCase):
res_dir = '/home/opnfv/functest/results/odl/'
logger = ft_logger.Logger("opendaylight").getLogger()
- def __init__(self):
- testcase.TestCase.__init__(self)
- self.case_name = "odl"
-
@classmethod
def set_robotframework_vars(cls, odlusername="admin", odlpassword="admin"):
"""Set credentials in csit/variables/Variables.py.
diff --git a/functest/opnfv_tests/sdn/onos/onos.py b/functest/opnfv_tests/sdn/onos/onos.py
index d482ae320..fe37669a4 100644
--- a/functest/opnfv_tests/sdn/onos/onos.py
+++ b/functest/opnfv_tests/sdn/onos/onos.py
@@ -32,9 +32,6 @@ class OnosBase(testcase.TestCase):
onos_sfc_path = os.path.join(CONST.dir_repo_functest,
CONST.dir_onos_sfc)
- def __init__(self):
- super(OnosBase, self).__init__()
-
def run(self):
self.start_time = time.time()
try:
@@ -52,9 +49,8 @@ class OnosBase(testcase.TestCase):
class Onos(OnosBase):
- def __init__(self):
- super(Onos, self).__init__()
- self.case_name = 'onos'
+ def __init__(self, case_name='onos'):
+ super(Onos, self).__init__(case_name)
self.log_path = os.path.join(self.onos_repo_path, 'TestON/logs')
def set_onos_ip(self):
diff --git a/functest/opnfv_tests/vnf/aaa/aaa.py b/functest/opnfv_tests/vnf/aaa/aaa.py
index bdedcf7c5..f80e7bcc0 100755
--- a/functest/opnfv_tests/vnf/aaa/aaa.py
+++ b/functest/opnfv_tests/vnf/aaa/aaa.py
@@ -21,7 +21,7 @@ class AaaVnf(vnf_base.VnfOnBoardingBase):
logger = ft_logger.Logger("VNF AAA").getLogger()
def __init__(self):
- super(AaaVnf, self).__init__(case="aaa")
+ super(AaaVnf, self).__init__(case_name="aaa")
def deploy_orchestrator(self):
self.logger.info("No VNFM needed to deploy a free radius here")
@@ -56,6 +56,7 @@ class AaaVnf(vnf_base.VnfOnBoardingBase):
kwargs = {}
return self.main(**kwargs)
+
if __name__ == '__main__':
parser = argparse.ArgumentParser()
args = vars(parser.parse_args())
diff --git a/functest/opnfv_tests/vnf/ims/clearwater_ims_base.py b/functest/opnfv_tests/vnf/ims/clearwater_ims_base.py
index f21ce3f9a..2fc5449cf 100644
--- a/functest/opnfv_tests/vnf/ims/clearwater_ims_base.py
+++ b/functest/opnfv_tests/vnf/ims/clearwater_ims_base.py
@@ -46,8 +46,7 @@ class ClearwaterOnBoardingBase(vnf_base.VnfOnBoardingBase):
rq = requests.post(account_url, data=params)
output_dict['login'] = params
if rq.status_code != 201 and rq.status_code != 409:
- raise Exception("Unable to create an account for number"
- " provision: %s" % rq.json()['reason'])
+ raise Exception("Unable to create an account for number provision")
self.logger.info('Account is created on Ellis: %s', params)
session_url = 'http://{0}/session'.format(ellis_ip)
diff --git a/functest/opnfv_tests/vnf/ims/cloudify_ims.py b/functest/opnfv_tests/vnf/ims/cloudify_ims.py
index 404f208eb..d739335dc 100644
--- a/functest/opnfv_tests/vnf/ims/cloudify_ims.py
+++ b/functest/opnfv_tests/vnf/ims/cloudify_ims.py
@@ -25,9 +25,9 @@ import functest.utils.openstack_utils as os_utils
class CloudifyIms(clearwater_ims_base.ClearwaterOnBoardingBase):
- def __init__(self, project='functest', case='cloudify_ims',
+ def __init__(self, project='functest', case_name='cloudify_ims',
repo='', cmd=''):
- super(CloudifyIms, self).__init__(project, case, repo, cmd)
+ super(CloudifyIms, self).__init__(project, case_name, repo, cmd)
self.logger = ft_logger.Logger(__name__).getLogger()
# Retrieve the configuration
diff --git a/functest/opnfv_tests/vnf/ims/opera_ims.py b/functest/opnfv_tests/vnf/ims/opera_ims.py
index d022b3c7f..7ca96ae12 100644
--- a/functest/opnfv_tests/vnf/ims/opera_ims.py
+++ b/functest/opnfv_tests/vnf/ims/opera_ims.py
@@ -21,9 +21,9 @@ import functest.utils.functest_logger as ft_logger
class OperaIms(clearwater_ims_base.ClearwaterOnBoardingBase):
- def __init__(self, project='functest', case='opera_ims',
+ def __init__(self, project='functest', case_name='opera_ims',
repo=CONST.dir_repo_opera, cmd=''):
- super(OperaIms, self).__init__(project, case, repo, cmd)
+ super(OperaIms, self).__init__(project, case_name, repo, cmd)
self.logger = ft_logger.Logger(__name__).getLogger()
self.ellis_file = os.path.join(self.result_dir, 'ellis.info')
self.live_test_file = os.path.join(self.result_dir,
diff --git a/functest/opnfv_tests/vnf/ims/orchestra_ims.py b/functest/opnfv_tests/vnf/ims/orchestra_ims.py
index 5c19be096..c95a17e28 100755
--- a/functest/opnfv_tests/vnf/ims/orchestra_ims.py
+++ b/functest/opnfv_tests/vnf/ims/orchestra_ims.py
@@ -78,9 +78,9 @@ def servertest(host, port):
class ImsVnf(vnf_base.VnfOnBoardingBase):
- def __init__(self, project='functest', case='orchestra_ims',
+ def __init__(self, project='functest', case_name='orchestra_ims',
repo='', cmd=''):
- super(ImsVnf, self).__init__(project, case, repo, cmd)
+ super(ImsVnf, self).__init__(project, case_name, repo, cmd)
self.ob_password = "openbaton"
self.ob_username = "admin"
self.ob_https = False
@@ -103,7 +103,7 @@ class ImsVnf(vnf_base.VnfOnBoardingBase):
try:
self.config = CONST.__getattribute__(
'vnf_{}_config'.format(self.case_name))
- except:
+ except BaseException:
raise Exception("Orchestra VNF config file not found")
config_file = self.case_dir + self.config
self.imagename = get_config("openbaton.imagename", config_file)
@@ -115,6 +115,8 @@ class ImsVnf(vnf_base.VnfOnBoardingBase):
config_file)
self.images = get_config("tenant_images", config_file)
self.ims_conf = get_config("vIMS", config_file)
+ self.userdata_file = get_config("openbaton.userdata.file",
+ config_file)
def deploy_orchestrator(self, **kwargs):
self.logger.info("Additional pre-configuration steps")
@@ -132,7 +134,7 @@ class ImsVnf(vnf_base.VnfOnBoardingBase):
image_id = os_utils.get_image_id(glance_client,
image_name)
self.logger.info("image_id: %s" % image_id)
- except:
+ except BaseException:
self.logger.error("Unexpected error: %s" % sys.exc_info()[0])
if image_id == '':
@@ -153,7 +155,8 @@ class ImsVnf(vnf_base.VnfOnBoardingBase):
"192.168.100.0/24")
# orchestrator VM flavor
- self.logger.info("Check if Flavor is available, if not create one")
+ self.logger.info(
+ "Check if orchestra Flavor is available, if not create one")
flavor_exist, flavor_id = os_utils.get_or_create_flavor(
"orchestra",
"4096",
@@ -210,8 +213,13 @@ class ImsVnf(vnf_base.VnfOnBoardingBase):
bootstrap = "sh ./bootstrap release -configFile=./config_file"
userdata += bootstrap + "\n"
userdata += "echo \"Setting 'nfvo.plugin.timeout' to '300000'\"\n"
- userdata += ("echo \"nfvo.plugin.timeout=300000\" >> "
+ userdata += ("echo \"nfvo.plugin.timeout=600000\" >> "
"/etc/openbaton/openbaton-nfvo.properties\n")
+ userdata += (
+ "wget %s -O /etc/openbaton/openbaton-vnfm-generic-user-data.sh\n" %
+ self.userdata_file)
+ userdata += "sed -i '113i\ \ \ \ sleep 60' " \
+ "/etc/openbaton/openbaton-vnfm-generic-user-data.sh\n"
userdata += "echo \"Starting NFVO\"\n"
userdata += "service openbaton-nfvo restart\n"
userdata += "echo \"Starting Generic VNFM\"\n"
@@ -283,7 +291,10 @@ class ImsVnf(vnf_base.VnfOnBoardingBase):
self.ob_username = "admin"
self.ob_https = False
self.ob_port = "8080"
-
+ self.logger.info("Waiting for all components up and running...")
+ time.sleep(60)
+ self.details["orchestrator"] = {
+ 'status': "PASS", 'result': "Deploy Open Baton NFVO: OK"}
self.logger.info("Deploy Open Baton NFVO: OK")
def deploy_vnf(self):
@@ -296,6 +307,16 @@ class ImsVnf(vnf_base.VnfOnBoardingBase):
username=self.ob_username,
password=self.ob_password)
+ self.logger.info(
+ "Check if openims Flavor is available, if not create one")
+ flavor_exist, flavor_id = os_utils.get_or_create_flavor(
+ "m1.small",
+ "2048",
+ '20',
+ '1',
+ public=True)
+ self.logger.debug("Flavor id: %s" % flavor_id)
+
self.logger.info("Getting project 'default'...")
project_agent = self.main_agent.get_agent("project", self.ob_projectid)
for p in json.loads(project_agent.find()):
@@ -311,9 +332,16 @@ class ImsVnf(vnf_base.VnfOnBoardingBase):
creds = os_utils.get_credentials()
self.logger.info("PoP creds: %s" % creds)
- project_id = os_utils.get_tenant_id(
- os_utils.get_keystone_client(),
- creds.get("project_name"))
+ if os_utils.is_keystone_v3():
+ self.logger.info(
+ "Using v3 API of OpenStack... -> Using OS_PROJECT_ID")
+ project_id = os_utils.get_tenant_id(
+ os_utils.get_keystone_client(),
+ creds.get("project_name"))
+ else:
+ self.logger.info(
+ "Using v2 API of OpenStack... -> Using OS_TENANT_NAME")
+ project_id = creds.get("tenant_name")
self.logger.debug("project id: %s" % project_id)
@@ -381,16 +409,17 @@ class ImsVnf(vnf_base.VnfOnBoardingBase):
self.nsr = json.loads(nsr_agent.find(self.nsr.get('id')))
if self.nsr.get("status") == 'ACTIVE':
- deploy_vnf = {'status': "PASS", 'result': self.nsr}
+ self.details["vnf"] = {'status': "PASS", 'result': self.nsr}
self.logger.info("Deploy VNF: OK")
else:
- deploy_vnf = {'status': "FAIL", 'result': self.nsr}
+ self.details["vnf"] = {'status': "FAIL", 'result': self.nsr}
+ self.logger.error(self.nsr)
self.step_failure("Deploy VNF: ERROR")
self.ob_nsr_id = self.nsr.get("id")
self.logger.info(
"Sleep for 60s to ensure that all services are up and running...")
time.sleep(60)
- return deploy_vnf
+ return self.details.get("vnf")
def test_vnf(self):
# Adaptations probably needed
@@ -427,9 +456,18 @@ class ImsVnf(vnf_base.VnfOnBoardingBase):
"VNFC instance %s is not reachable "
"at %s:%s" % (vnfci.get('hostname'),
floatingIp.get('ip'), port))
+ self.details["test_vnf"] = {
+ 'status': "FAIL", 'result': (
+ "Port %s of server %s -> %s is "
+ "not reachable" %
+ (port, vnfci.get('hostname'),
+ floatingIp.get('ip')))}
self.step_failure("Test VNF: ERROR")
+ self.details["test_vnf"] = {
+ 'status': "PASS",
+ 'result': "All tests have been executed successfully"}
self.logger.info("Test VNF: OK")
- return
+ return self.details.get('test_vnf')
def clean(self):
self.main_agent.get_agent(
diff --git a/functest/opnfv_tests/vnf/ims/orchestra_ims.yaml b/functest/opnfv_tests/vnf/ims/orchestra_ims.yaml
index 5923a775a..5b25d3c96 100644
--- a/functest/opnfv_tests/vnf/ims/orchestra_ims.yaml
+++ b/functest/opnfv_tests/vnf/ims/orchestra_ims.yaml
@@ -4,6 +4,8 @@ tenant_images:
openbaton:
bootstrap_link: http://get.openbaton.org/bootstraps/bootstrap_3.2.0_opnfv/bootstrap
bootstrap_config_link: http://get.openbaton.org/bootstraps/bootstrap_3.2.0_opnfv/bootstrap-config-file
+ userdata:
+ file: https://raw.githubusercontent.com/openbaton/generic-vnfm/3.2.0/src/main/resources/user-data.sh
marketplace_link: http://marketplace.openbaton.org:8082/api/v1/nsds/fokus/OpenImsCore/3.2.0/json
imagename: ubuntu_14.04
vIMS:
diff --git a/functest/tests/unit/core/test_feature.py b/functest/tests/unit/core/test_feature.py
new file mode 100644
index 000000000..0ed178a1d
--- /dev/null
+++ b/functest/tests/unit/core/test_feature.py
@@ -0,0 +1,108 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2017 Orange and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+
+# pylint: disable=missing-docstring
+
+import logging
+import unittest
+
+import mock
+
+from functest.core import feature
+from functest.core import testcase
+from functest.utils import constants
+
+
+class FeatureInitTesting(unittest.TestCase):
+
+ logging.disable(logging.CRITICAL)
+
+ @unittest.skip("JIRA: FUNCTEST-780")
+ def test_init_with_wrong_repo(self):
+ with self.assertRaises(ValueError):
+ feature.Feature(repo='foo')
+
+ def test_init(self):
+ barometer = feature.Feature(repo='dir_repo_barometer')
+ self.assertEqual(barometer.project_name, "functest")
+ self.assertEqual(barometer.case_name, "")
+ self.assertEqual(
+ barometer.repo,
+ constants.CONST.__getattribute__('dir_repo_barometer'))
+
+
+class FeatureTesting(unittest.TestCase):
+
+ logging.disable(logging.CRITICAL)
+
+ def setUp(self):
+ self.feature = feature.Feature(repo='dir_repo_barometer')
+
+ @unittest.skip("JIRA: FUNCTEST-781")
+ def test_prepare_ko(self):
+ # pylint: disable=bad-continuation
+ with mock.patch.object(
+ self.feature, 'prepare',
+ return_value=testcase.TestCase.EX_RUN_ERROR) as mock_object:
+ self.assertEqual(self.feature.run(),
+ testcase.TestCase.EX_RUN_ERROR)
+ mock_object.assert_called_once_with()
+
+ @unittest.skip("JIRA: FUNCTEST-781")
+ def test_prepare_exc(self):
+ with mock.patch.object(self.feature, 'prepare',
+ side_effect=Exception) as mock_object:
+ self.assertEqual(self.feature.run(),
+ testcase.TestCase.EX_RUN_ERROR)
+ mock_object.assert_called_once_with()
+
+ @unittest.skip("JIRA: FUNCTEST-781")
+ def test_post_ko(self):
+ # pylint: disable=bad-continuation
+ with mock.patch.object(
+ self.feature, 'post',
+ return_value=testcase.TestCase.EX_RUN_ERROR) as mock_object:
+ self.assertEqual(self.feature.run(),
+ testcase.TestCase.EX_RUN_ERROR)
+ mock_object.assert_called_once_with()
+
+ @unittest.skip("JIRA: FUNCTEST-781")
+ def test_post_exc(self):
+ with mock.patch.object(self.feature, 'post',
+ side_effect=Exception) as mock_object:
+ self.assertEqual(self.feature.run(),
+ testcase.TestCase.EX_RUN_ERROR)
+ mock_object.assert_called_once_with()
+
+ @unittest.skip("JIRA: FUNCTEST-778")
+ def test_execute_ko(self):
+ with mock.patch.object(self.feature, 'execute',
+ return_value=1) as mock_object:
+ self.assertEqual(self.feature.run(),
+ testcase.TestCase.EX_RUN_ERROR)
+ mock_object.assert_called_once_with()
+
+ @unittest.skip("JIRA: FUNCTEST-778")
+ def test_execute_exc(self):
+ with mock.patch.object(self.feature, 'execute',
+ side_effect=Exception) as mock_object:
+ self.assertEqual(self.feature.run(),
+ testcase.TestCase.EX_RUN_ERROR)
+ mock_object.assert_called_once_with()
+
+ def test_run(self):
+ with mock.patch.object(self.feature, 'execute',
+ return_value=0) as mock_object:
+ self.assertEqual(self.feature.run(),
+ testcase.TestCase.EX_OK)
+ mock_object.assert_called_once_with()
+
+
+if __name__ == "__main__":
+ unittest.main(verbosity=2)
diff --git a/functest/tests/unit/core/test_testcase.py b/functest/tests/unit/core/test_testcase.py
index 32104194b..5ff41cd65 100644
--- a/functest/tests/unit/core/test_testcase.py
+++ b/functest/tests/unit/core/test_testcase.py
@@ -26,10 +26,11 @@ class TestCaseTesting(unittest.TestCase):
logging.disable(logging.CRITICAL)
+ _case_name = "base"
+
def setUp(self):
- self.test = testcase.TestCase()
+ self.test = testcase.TestCase(case_name=self._case_name)
self.test.project = "functest"
- self.test.case_name = "base"
self.test.start_time = "1"
self.test.stop_time = "2"
self.test.criteria = "PASS"
@@ -46,6 +47,10 @@ class TestCaseTesting(unittest.TestCase):
testcase.TestCase.EX_PUSH_TO_DB_ERROR)
mock_function.assert_not_called()
+ def test_missing_project_name(self):
+ self.test.project_name = None
+ self._test_missing_attribute()
+
def test_missing_case_name(self):
self.test.case_name = None
self._test_missing_attribute()
@@ -69,7 +74,7 @@ class TestCaseTesting(unittest.TestCase):
self.assertEqual(self.test.push_to_db(),
testcase.TestCase.EX_OK)
mock_function.assert_called_once_with(
- self.test.project, self.test.case_name, self.test.start_time,
+ self.test.project, self._case_name, self.test.start_time,
self.test.stop_time, self.test.criteria, self.test.details)
@mock.patch('functest.utils.functest_utils.push_results_to_db',
@@ -78,7 +83,7 @@ class TestCaseTesting(unittest.TestCase):
self.assertEqual(self.test.push_to_db(),
testcase.TestCase.EX_PUSH_TO_DB_ERROR)
mock_function.assert_called_once_with(
- self.test.project, self.test.case_name, self.test.start_time,
+ self.test.project, self._case_name, self.test.start_time,
self.test.stop_time, self.test.criteria, self.test.details)
@mock.patch('functest.utils.functest_utils.push_results_to_db',
@@ -87,7 +92,7 @@ class TestCaseTesting(unittest.TestCase):
self.assertEqual(self.test.push_to_db(),
testcase.TestCase.EX_OK)
mock_function.assert_called_once_with(
- self.test.project, self.test.case_name, self.test.start_time,
+ self.test.project, self._case_name, self.test.start_time,
self.test.stop_time, self.test.criteria, self.test.details)
def test_check_criteria_missing(self):
diff --git a/functest/tests/unit/core/test_vnf_base.py b/functest/tests/unit/core/test_vnf_base.py
index 1680f03f5..96706040d 100644
--- a/functest/tests/unit/core/test_vnf_base.py
+++ b/functest/tests/unit/core/test_vnf_base.py
@@ -19,9 +19,8 @@ class VnfBaseTesting(unittest.TestCase):
def setUp(self):
self.test = vnf_base.VnfOnBoardingBase(project='functest',
- case='aaa')
+ case_name='aaa')
self.test.project = "functest"
- self.test.case_name = "aaa"
self.test.start_time = "1"
self.test.stop_time = "5"
self.test.criteria = ""
diff --git a/functest/tests/unit/features/__init__.py b/functest/tests/unit/features/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/functest/tests/unit/features/__init__.py
diff --git a/functest/tests/unit/features/test_barometer.py b/functest/tests/unit/features/test_barometer.py
new file mode 100644
index 000000000..62f2e0d6e
--- /dev/null
+++ b/functest/tests/unit/features/test_barometer.py
@@ -0,0 +1,55 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2017 Orange and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+
+# pylint: disable=missing-docstring
+
+import logging
+import sys
+import unittest
+
+import mock
+
+from functest.core import testcase
+sys.modules['baro_tests'] = mock.Mock() # noqa
+# pylint: disable=wrong-import-position
+from functest.opnfv_tests.features import barometer
+from functest.utils import constants
+
+
+class BarometerTesting(unittest.TestCase):
+
+ logging.disable(logging.CRITICAL)
+
+ def setUp(self):
+ self.barometer = barometer.BarometerCollectd(
+ case_name="barometercollectd")
+
+ def test_init(self):
+ self.assertEqual(self.barometer.project_name, "barometer")
+ self.assertEqual(self.barometer.case_name, "barometercollectd")
+ self.assertEqual(
+ self.barometer.repo,
+ constants.CONST.__getattribute__('dir_repo_barometer'))
+
+ @unittest.skip("JIRA: FUNCTEST-777")
+ def test_execute_ko(self):
+ # It must be skipped to allow merging
+ sys.modules['baro_tests'].collectd.main = mock.Mock(return_value=1)
+ self.assertEqual(self.barometer.execute(),
+ testcase.TestCase.EX_RUN_ERROR)
+
+ @unittest.skip("JIRA: FUNCTEST-777")
+ def test_execute(self):
+ # It must be skipped to allow merging
+ sys.modules['baro_tests'].collectd.main = mock.Mock(return_value=0)
+ self.assertEqual(self.barometer.execute(), testcase.TestCase.EX_OK)
+
+
+if __name__ == "__main__":
+ unittest.main(verbosity=2)
diff --git a/functest/tests/unit/features/test_copper.py b/functest/tests/unit/features/test_copper.py
new file mode 100644
index 000000000..b6d187f7a
--- /dev/null
+++ b/functest/tests/unit/features/test_copper.py
@@ -0,0 +1,38 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2017 Orange and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+
+# pylint: disable=missing-docstring
+
+import logging
+import unittest
+
+from functest.opnfv_tests.features import copper
+from functest.utils import constants
+
+
+class CopperTesting(unittest.TestCase):
+
+ logging.disable(logging.CRITICAL)
+
+ def setUp(self):
+ self.copper = copper.Copper(case_name="copper-notification")
+
+ def test_init(self):
+ self.assertEqual(self.copper.project_name, "copper")
+ self.assertEqual(self.copper.case_name, "copper-notification")
+ self.assertEqual(
+ self.copper.repo,
+ constants.CONST.__getattribute__("dir_repo_copper"))
+ self.assertEqual(
+ self.copper.cmd,
+ "cd {}/tests && bash run.sh && cd -".format(self.copper.repo))
+
+
+if __name__ == "__main__":
+ unittest.main(verbosity=2)
diff --git a/functest/tests/unit/features/test_doctor.py b/functest/tests/unit/features/test_doctor.py
new file mode 100644
index 000000000..36bac44f0
--- /dev/null
+++ b/functest/tests/unit/features/test_doctor.py
@@ -0,0 +1,38 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2017 Orange and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+
+# pylint: disable=missing-docstring
+
+import logging
+import unittest
+
+from functest.opnfv_tests.features import doctor
+from functest.utils import constants
+
+
+class DoctorTesting(unittest.TestCase):
+
+ logging.disable(logging.CRITICAL)
+
+ def setUp(self):
+ self.doctor = doctor.Doctor(case_name="doctor-notification")
+
+ def test_init(self):
+ self.assertEqual(self.doctor.project_name, "doctor")
+ self.assertEqual(self.doctor.case_name, "doctor-notification")
+ self.assertEqual(
+ self.doctor.repo,
+ constants.CONST.__getattribute__("dir_repo_doctor"))
+ self.assertEqual(
+ self.doctor.cmd,
+ 'cd {}/tests && ./run.sh'.format(self.doctor.repo))
+
+
+if __name__ == "__main__":
+ unittest.main(verbosity=2)
diff --git a/functest/tests/unit/features/test_domino.py b/functest/tests/unit/features/test_domino.py
new file mode 100644
index 000000000..c0bfd14b4
--- /dev/null
+++ b/functest/tests/unit/features/test_domino.py
@@ -0,0 +1,38 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2017 Orange and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+
+# pylint: disable=missing-docstring
+
+import logging
+import unittest
+
+from functest.opnfv_tests.features import domino
+from functest.utils import constants
+
+
+class DominoTesting(unittest.TestCase):
+
+ logging.disable(logging.CRITICAL)
+
+ def setUp(self):
+ self.domino = domino.Domino(case_name="domino-multinode")
+
+ def test_init(self):
+ self.assertEqual(self.domino.project_name, "domino")
+ self.assertEqual(self.domino.case_name, "domino-multinode")
+ self.assertEqual(
+ self.domino.repo,
+ constants.CONST.__getattribute__("dir_repo_domino"))
+ self.assertEqual(
+ self.domino.cmd,
+ 'cd {} && ./tests/run_multinode.sh'.format(self.domino.repo))
+
+
+if __name__ == "__main__":
+ unittest.main(verbosity=2)
diff --git a/functest/tests/unit/features/test_netready.py b/functest/tests/unit/features/test_netready.py
new file mode 100644
index 000000000..47be42034
--- /dev/null
+++ b/functest/tests/unit/features/test_netready.py
@@ -0,0 +1,39 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2017 Orange and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+
+# pylint: disable=missing-docstring
+
+import logging
+import unittest
+
+from functest.opnfv_tests.features import netready
+from functest.utils import constants
+
+
+class NetreadyTesting(unittest.TestCase):
+
+ logging.disable(logging.CRITICAL)
+
+ def setUp(self):
+ self.netready = netready.GluonVping(case_name="gluon_vping")
+
+ def test_init(self):
+ self.assertEqual(self.netready.project_name, "netready")
+ self.assertEqual(self.netready.case_name, "gluon_vping")
+ self.assertEqual(
+ self.netready.repo,
+ constants.CONST.__getattribute__("dir_repo_netready"))
+ self.assertEqual(
+ self.netready.cmd,
+ 'cd {}/test/functest && python ./gluon-test-suite.py'.format(
+ self.netready.repo))
+
+
+if __name__ == "__main__":
+ unittest.main(verbosity=2)
diff --git a/functest/tests/unit/features/test_odl_sfc.py b/functest/tests/unit/features/test_odl_sfc.py
new file mode 100644
index 000000000..dcdcdff63
--- /dev/null
+++ b/functest/tests/unit/features/test_odl_sfc.py
@@ -0,0 +1,39 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2017 Orange and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+
+# pylint: disable=missing-docstring
+
+import logging
+import unittest
+
+from functest.opnfv_tests.features import odl_sfc
+from functest.utils import constants
+
+
+class OpenDaylightSFCTesting(unittest.TestCase):
+
+ logging.disable(logging.CRITICAL)
+
+ def setUp(self):
+ self.odl_sfc = odl_sfc.OpenDaylightSFC(case_name="functest-odl-sfc")
+
+ def test_init(self):
+ self.assertEqual(self.odl_sfc.project_name, "sfc")
+ self.assertEqual(self.odl_sfc.case_name, "functest-odl-sfc")
+ self.assertEqual(
+ self.odl_sfc.repo,
+ constants.CONST.__getattribute__("dir_repo_sfc"))
+ dir_sfc_functest = '{}/sfc/tests/functest'.format(self.odl_sfc.repo)
+ self.assertEqual(
+ self.odl_sfc.cmd,
+ 'cd {} && python ./run_tests.py'.format(dir_sfc_functest))
+
+
+if __name__ == "__main__":
+ unittest.main(verbosity=2)
diff --git a/functest/tests/unit/features/test_promise.py b/functest/tests/unit/features/test_promise.py
new file mode 100644
index 000000000..29b4d4ec8
--- /dev/null
+++ b/functest/tests/unit/features/test_promise.py
@@ -0,0 +1,39 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2017 Orange and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+
+# pylint: disable=missing-docstring
+
+import logging
+import unittest
+
+from functest.opnfv_tests.features import promise
+from functest.utils import constants
+
+
+class PromiseTesting(unittest.TestCase):
+
+ logging.disable(logging.CRITICAL)
+
+ def setUp(self):
+ self.promise = promise.Promise(case_name="promise")
+
+ def test_init(self):
+ self.assertEqual(self.promise.project_name, "promise")
+ self.assertEqual(self.promise.case_name, "promise")
+ self.assertEqual(
+ self.promise.repo,
+ constants.CONST.__getattribute__("dir_repo_promise"))
+ self.assertEqual(
+ self.promise.cmd,
+ 'cd {}/promise/test/functest && python ./run_tests.py'.format(
+ self.promise.repo))
+
+
+if __name__ == "__main__":
+ unittest.main(verbosity=2)
diff --git a/functest/tests/unit/features/test_sdnvpn.py b/functest/tests/unit/features/test_sdnvpn.py
new file mode 100644
index 000000000..8fa43fc44
--- /dev/null
+++ b/functest/tests/unit/features/test_sdnvpn.py
@@ -0,0 +1,39 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2017 Orange and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+
+# pylint: disable=missing-docstring
+
+import logging
+import unittest
+
+from functest.opnfv_tests.features import sdnvpn
+from functest.utils import constants
+
+
+class SdnVpnTesting(unittest.TestCase):
+
+ logging.disable(logging.CRITICAL)
+
+ def setUp(self):
+ self.sdnvpn = sdnvpn.SdnVpnTests(case_name="bgpvpn")
+
+ def test_init(self):
+ self.assertEqual(self.sdnvpn.project_name, "sdnvpn")
+ self.assertEqual(self.sdnvpn.case_name, "bgpvpn")
+ self.assertEqual(
+ self.sdnvpn.repo,
+ constants.CONST.__getattribute__("dir_repo_sdnvpn"))
+ self.assertEqual(
+ self.sdnvpn.cmd,
+ 'cd {}/sdnvpn/test/functest && python ./run_tests.py'.format(
+ self.sdnvpn.repo))
+
+
+if __name__ == "__main__":
+ unittest.main(verbosity=2)
diff --git a/functest/tests/unit/features/test_security_scan.py b/functest/tests/unit/features/test_security_scan.py
new file mode 100644
index 000000000..f0e40159d
--- /dev/null
+++ b/functest/tests/unit/features/test_security_scan.py
@@ -0,0 +1,42 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2017 Orange and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+
+# pylint: disable=missing-docstring
+
+import logging
+import unittest
+
+from functest.opnfv_tests.features import security_scan
+from functest.utils import constants
+
+
+class SecurityScanTesting(unittest.TestCase):
+
+ logging.disable(logging.CRITICAL)
+
+ def setUp(self):
+ self.sscan = security_scan.SecurityScan(case_name="security_scan")
+
+ def test_init(self):
+ self.assertEqual(self.sscan.project_name, "securityscanning")
+ self.assertEqual(self.sscan.case_name, "security_scan")
+ self.assertEqual(
+ self.sscan.repo,
+ constants.CONST.__getattribute__("dir_repo_securityscan"))
+ self.assertEqual(
+ self.sscan.cmd, (
+ '. {0}/stackrc && cd {1} && '
+ 'python security_scan.py --config config.ini && '
+ 'cd -'.format(
+ constants.CONST.__getattribute__("dir_functest_conf"),
+ self.sscan.repo)))
+
+
+if __name__ == "__main__":
+ unittest.main(verbosity=2)