Modify TestCase constructor attributes 55/33155/3
authorCédric Ollivier <cedric.ollivier@orange.com>
Sat, 8 Apr 2017 11:38:45 +0000 (13:38 +0200)
committerCédric Ollivier <cedric.ollivier@orange.com>
Tue, 11 Apr 2017 12:23:21 +0000 (14:23 +0200)
Every feature/testcase now allows receiving the data defined in
testcases.yaml as args (name is renamed to case_name).

From the time being, only project and case names are handled. Next
pending patches will add criteria, cmd and repo to this list.

It keeps the default values for case names except for features which
will be aggregated into Feature.

Change-Id: Id742d100b8183d7f10894c24ae6879d1b2b60ac9
Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
49 files changed:
functest/ci/run_tests.py
functest/ci/testcases.yaml
functest/ci/tier_builder.py
functest/core/feature.py
functest/core/pytest_suite_runner.py
functest/core/testcase.py
functest/core/vnf_base.py
functest/opnfv_tests/features/barometer.py
functest/opnfv_tests/features/copper.py
functest/opnfv_tests/features/doctor.py
functest/opnfv_tests/features/domino.py
functest/opnfv_tests/features/netready.py
functest/opnfv_tests/features/odl_sfc.py
functest/opnfv_tests/features/promise.py
functest/opnfv_tests/features/sdnvpn.py
functest/opnfv_tests/features/security_scan.py
functest/opnfv_tests/mano/orchestra.py
functest/opnfv_tests/openstack/rally/rally.py
functest/opnfv_tests/openstack/refstack_client/refstack_client.py
functest/opnfv_tests/openstack/snaps/api_check.py
functest/opnfv_tests/openstack/snaps/connection_check.py
functest/opnfv_tests/openstack/snaps/health_check.py
functest/opnfv_tests/openstack/snaps/smoke.py
functest/opnfv_tests/openstack/snaps/snaps_test_runner.py
functest/opnfv_tests/openstack/tempest/tempest.py
functest/opnfv_tests/openstack/vping/vping_base.py
functest/opnfv_tests/openstack/vping/vping_ssh.py
functest/opnfv_tests/openstack/vping/vping_userdata.py
functest/opnfv_tests/sdn/onos/onos.py
functest/opnfv_tests/vnf/aaa/aaa.py
functest/opnfv_tests/vnf/ims/clearwater_ims_base.py
functest/opnfv_tests/vnf/ims/cloudify_ims.py
functest/opnfv_tests/vnf/rnc/parser.py
functest/opnfv_tests/vnf/router/vyos_vrouter.py
functest/tests/unit/ci/test_tier_builder.py
functest/tests/unit/core/test_testcase.py
functest/tests/unit/features/test_barometer.py
functest/tests/unit/features/test_copper.py
functest/tests/unit/features/test_doctor.py
functest/tests/unit/features/test_domino.py
functest/tests/unit/features/test_netready.py
functest/tests/unit/features/test_odl_sfc.py
functest/tests/unit/features/test_promise.py
functest/tests/unit/features/test_sdnvpn.py
functest/tests/unit/features/test_security_scan.py
functest/tests/unit/odl/test_odl.py
functest/tests/unit/utils/test_functest_utils.py
functest/tests/unit/vnf/rnc/test_parser.py
functest/utils/functest_utils.py

index 5793c04..0ca73f3 100755 (executable)
@@ -144,7 +144,8 @@ 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(case_name=test_name)
+            test_dict = ft_utils.get_dict_by_test(test_name)
+            test_case = cls(**test_dict)
 
             try:
                 kwargs = run_dict['args']
index 9309604..f717cdd 100755 (executable)
@@ -8,7 +8,8 @@ tiers:
             operations in the VIM.
         testcases:
             -
-                name: connection_check
+                case_name: connection_check
+                project_name: functest
                 criteria: 'status == "PASS"'
                 blocking: true
                 clean_flag: false
@@ -27,7 +28,8 @@ tiers:
                     class: 'ConnectionCheck'
 
             -
-                name: api_check
+                case_name: api_check
+                project_name: functest
                 criteria: 'status == "PASS"'
                 blocking: true
                 clean_flag: false
@@ -45,7 +47,8 @@ tiers:
                     module: 'functest.opnfv_tests.openstack.snaps.api_check'
                     class: 'ApiCheck'
             -
-                name: snaps_health_check
+                case_name: snaps_health_check
+                project_name: functest
                 criteria: 'status == "PASS"'
                 blocking: true
                 clean_flag: false
@@ -68,7 +71,8 @@ tiers:
             Set of basic Functional tests to validate the OPNFV scenarios.
         testcases:
             -
-                name: vping_ssh
+                case_name: vping_ssh
+                project_name: functest
                 criteria: 'status == "PASS"'
                 blocking: true
                 clean_flag: true
@@ -84,7 +88,8 @@ tiers:
                     class: 'VPingSSH'
 
             -
-                name: vping_userdata
+                case_name: vping_userdata
+                project_name: functest
                 criteria: 'status == "PASS"'
                 blocking: true
                 clean_flag: true
@@ -99,7 +104,8 @@ tiers:
                     class: 'VPingUserdata'
 
             -
-                name: tempest_smoke_serial
+                case_name: tempest_smoke_serial
+                project_name: functest
                 criteria: 'success_rate == 100%'
                 blocking: false
                 clean_flag: true
@@ -116,7 +122,8 @@ tiers:
                     class: 'TempestSmokeSerial'
 
             -
-                name: rally_sanity
+                case_name: rally_sanity
+                project_name: functest
                 criteria: 'success_rate == 100%'
                 blocking: false
                 clean_flag: false
@@ -131,7 +138,8 @@ tiers:
                     class: 'RallySanity'
 
             -
-                name: refstack_defcore
+                case_name: refstack_defcore
+                project_name: functest
                 criteria: 'success_rate == 100%'
                 blocking: false
                 clean_flag: true
@@ -146,7 +154,8 @@ tiers:
                     class: 'RefstackClient'
 
             -
-                name: odl
+                case_name: odl
+                project_name: functest
                 criteria: 'success_rate == 100%'
                 blocking: true
                 clean_flag: false
@@ -166,7 +175,8 @@ tiers:
                             -  /home/opnfv/repos/odl_test/csit/suites/openstack/neutron
 
             -
-                name: odl_netvirt
+                case_name: odl_netvirt
+                project_name: functest
                 criteria: 'success_rate == 100%'
                 blocking: false
                 clean_flag: false
@@ -188,7 +198,8 @@ tiers:
                             -  /home/opnfv/repos/odl_test/csit/suites/openstack/connectivity
 
             -
-                name: fds
+                case_name: fds
+                project_name: functest
                 criteria: 'success_rate == 100%'
                 blocking: false
                 clean_flag: false
@@ -207,7 +218,8 @@ tiers:
                             -  /home/opnfv/repos/fds/testing/robot
 
             -
-                name: onos
+                case_name: onos
+                project_name: functest
                 criteria: 'status == "PASS"'
                 blocking: true
                 clean_flag: true
@@ -223,7 +235,8 @@ tiers:
                     class: 'Onos'
 
             -
-                name: snaps_smoke
+                case_name: snaps_smoke
+                project_name: functest
                 criteria: 'status == "PASS"'
                 blocking: false
                 clean_flag: false
@@ -252,7 +265,8 @@ tiers:
             integrated in functest
         testcases:
             -
-                name: promise
+                case_name: promise
+                project_name: promise
                 criteria: 'success_rate == 100%'
                 blocking: false
                 clean_flag: true
@@ -266,7 +280,8 @@ tiers:
                      class: 'Promise'
 
             -
-                name: doctor-notification
+                case_name: doctor-notification
+                project_name: doctor
                 criteria: 'status == "PASS"'
                 blocking: false
                 clean_flag: true
@@ -280,7 +295,8 @@ tiers:
                     class: 'Doctor'
 
             -
-                name: bgpvpn
+                case_name: bgpvpn
+                project_name: sdnvpn
                 criteria: 'status == "PASS"'
                 blocking: false
                 clean_flag: true
@@ -294,7 +310,8 @@ tiers:
                     class: 'SdnVpnTests'
 
             -
-                name: security_scan
+                case_name: security_scan
+                project_name: securityscanning
                 criteria: 'status == "PASS"'
                 blocking: false
                 clean_flag: true
@@ -308,7 +325,8 @@ tiers:
                     class: 'SecurityScan'
 
             -
-                name: multisite
+                case_name: multisite
+                project_name: multisite
                 criteria: 'success_rate == 100%'
                 blocking: false
                 clean_flag: false
@@ -321,7 +339,8 @@ tiers:
                     module: 'functest.opnfv_tests.openstack.tempest.tempest'
                     class: 'TempestMultisite'
             -
-                name: functest-odl-sfc
+                case_name: functest-odl-sfc
+                project_name: sfc
                 criteria: 'status == "PASS"'
                 blocking: false
                 clean_flag: true
@@ -334,7 +353,8 @@ tiers:
                     module: 'functest.opnfv_tests.features.odl_sfc'
                     class: 'OpenDaylightSFC'
             -
-                name: onos_sfc
+                case_name: onos_sfc
+                project_name: functest
                 criteria: 'status == "PASS"'
                 blocking: true
                 clean_flag: true
@@ -347,7 +367,8 @@ tiers:
                     module: 'functest.opnfv_tests.sdn.onos.onos'
                     class: 'OnosSfc'
             -
-                name: parser-basics
+                case_name: parser-basics
+                project_name: parser
                 criteria: 'ret == 0'
                 blocking: false
                 clean_flag: true
@@ -360,7 +381,8 @@ tiers:
                     module: 'functest.opnfv_tests.vnf.rnc.parser'
                     class: 'Parser'
             -
-                name: domino-multinode
+                case_name: domino-multinode
+                project_name: domino
                 criteria: 'status == "PASS"'
                 blocking: false
                 clean_flag: true
@@ -373,7 +395,8 @@ tiers:
                     module: 'functest.opnfv_tests.features.domino'
                     class: 'Domino'
             -
-                name: gluon_vping
+                case_name: gluon_vping
+                project_name: netready
                 criteria: 'status == "PASS"'
                 blocking: false
                 clean_flag: true
@@ -386,7 +409,8 @@ tiers:
                      module: 'functest.opnfv_tests.features.netready'
                      class: 'GluonVping'
             -
-                name: barometercollectd
+                case_name: barometercollectd
+                project_name: barometer
                 criteria: 'status == "PASS"'
                 blocking: false
                 clean_flag: true
@@ -409,7 +433,8 @@ tiers:
             Extensive testing of OpenStack API.
         testcases:
             -
-                name: tempest_full_parallel
+                case_name: tempest_full_parallel
+                project_name: functest
                 criteria: 'success_rate >= 80%'
                 blocking: false
                 clean_flag: true
@@ -424,7 +449,8 @@ tiers:
                     module: 'functest.opnfv_tests.openstack.tempest.tempest'
                     class: 'TempestFullParallel'
             -
-                name: tempest_custom
+                case_name: tempest_custom
+                project_name: functest
                 criteria: 'success_rate == 100%'
                 blocking: false
                 clean_flag: true
@@ -441,7 +467,8 @@ tiers:
                     module: 'functest.opnfv_tests.openstack.tempest.tempest'
                     class: 'TempestCustom'
             -
-                name: rally_full
+                case_name: rally_full
+                project_name: functest
                 criteria: 'success_rate >= 90%'
                 blocking: false
                 clean_flag: false
@@ -463,7 +490,8 @@ tiers:
             Collection of VNF test cases.
         testcases:
             -
-                name: cloudify_ims
+                case_name: cloudify_ims
+                project_name: functest
                 criteria: 'status == "PASS"'
                 blocking: false
                 clean_flag: true
@@ -477,7 +505,8 @@ tiers:
                     module: 'functest.opnfv_tests.vnf.ims.cloudify_ims'
                     class: 'CloudifyIms'
 #          -
-#               name: aaa
+#               case_name: aaa
+#               project_name: functest
 #               criteria: 'ret == 0'
 #               blocking: false
 #               clean_flag: true
@@ -490,7 +519,8 @@ tiers:
 #                   module: 'functest.opnfv_tests.vnf.aaa.aaa'
 #                   class: 'AaaVnf'
             -
-                name: orchestra_ims
+                case_name: orchestra_ims
+                project_name: functest
                 criteria: 'ret == 0'
                 blocking: false
                 clean_flag: true
@@ -504,7 +534,8 @@ tiers:
                     class: 'ImsVnf'
 
             -
-                name: opera_ims
+                case_name: opera-vims
+                project_name: opera
                 criteria: 'status == "PASS"'
                 blocking: false
                 clean_flag: true
@@ -518,7 +549,8 @@ tiers:
                     class: 'OperaIms'
 
             -
-                name: vyos_vrouter
+                case_name: vyos_vrouter
+                project_name: functest
                 criteria: 'status == "PASS"'
                 blocking: false
                 clean_flag: true
index f4c6f70..44b2725 100644 (file)
@@ -46,7 +46,7 @@ class TierBuilder(object):
                 scenario = dic_testcase['dependencies']['scenario']
                 dep = th.Dependency(installer, scenario)
 
-                testcase = th.TestCase(name=dic_testcase['name'],
+                testcase = th.TestCase(name=dic_testcase['case_name'],
                                        dependency=dep,
                                        criteria=dic_testcase['criteria'],
                                        blocking=dic_testcase['blocking'],
index 5149f80..9f20a42 100644 (file)
@@ -8,13 +8,13 @@ from functest.utils.constants import CONST
 
 class Feature(base.TestCase):
 
-    def __init__(self, project='functest', case_name='', repo='', cmd=''):
-        super(Feature, self).__init__(case_name=case_name)
-        self.project_name = project
-        self.cmd = cmd
+    def __init__(self, **kwargs):
+        super(Feature, self).__init__(**kwargs)
+        self.cmd = kwargs.get('cmd', '')
+        repo = kwargs.get('repo', '')
         self.repo = CONST.__getattribute__(repo)
         self.result_file = self.get_result_file()
-        self.logger = ft_logger.Logger(project).getLogger()
+        self.logger = ft_logger.Logger(self.project_name).getLogger()
 
     def run(self, **kwargs):
         self.prepare()
index 9cfaea7..775f0a6 100644 (file)
@@ -15,8 +15,8 @@ class PyTestSuiteRunner(base.TestCase):
     This superclass is designed to execute pre-configured unittest.TestSuite()
     objects
     """
-    def __init__(self, case_name=''):
-        super(PyTestSuiteRunner, self).__init__(case_name)
+    def __init__(self, **kwargs):
+        super(PyTestSuiteRunner, self).__init__(**kwargs)
         self.suite = None
 
     def run(self, **kwargs):
index 8c5fd64..3b43aef 100644 (file)
@@ -27,10 +27,10 @@ class TestCase(object):
 
     logger = ft_logger.Logger(__name__).getLogger()
 
-    def __init__(self, case_name=""):
+    def __init__(self, **kwargs):
         self.details = {}
-        self.project_name = "functest"
-        self.case_name = case_name
+        self.project_name = kwargs.get('project_name', 'functest')
+        self.case_name = kwargs.get('case_name', '')
         self.criteria = ""
         self.start_time = ""
         self.stop_time = ""
index 3d3a441..3c71ec7 100644 (file)
@@ -21,11 +21,10 @@ class VnfOnBoardingBase(base.TestCase):
 
     logger = ft_logger.Logger(__name__).getLogger()
 
-    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.cmd = cmd
+    def __init__(self, **kwargs):
+        super(VnfOnBoardingBase, self).__init__(**kwargs)
+        self.repo = kwargs.get('repo', '')
+        self.cmd = kwargs.get('cmd', '')
         self.details = {}
         self.result_dir = CONST.dir_results
         self.details['orchestrator'] = {}
index 6207f58..cd3062c 100644 (file)
@@ -16,10 +16,9 @@ class BarometerCollectd(base.Feature):
     Class for executing barometercollectd testcase.
     '''
 
-    def __init__(self, case_name='barometercollectd'):
-        super(BarometerCollectd, self).__init__(project='barometer',
-                                                case_name=case_name,
-                                                repo='dir_repo_barometer')
+    def __init__(self, **kwargs):
+        kwargs["repo"] = 'dir_repo_barometer'
+        super(BarometerCollectd, self).__init__(**kwargs)
 
     def execute(self):
         return collectd.main(self.logger)
index 5b88a49..e5c3f8b 100644 (file)
@@ -18,8 +18,7 @@ import functest.core.feature as base
 
 
 class Copper(base.Feature):
-    def __init__(self, case_name='copper-notification'):
-        super(Copper, self).__init__(project='copper',
-                                     case_name=case_name,
-                                     repo='dir_repo_copper')
+    def __init__(self, **kwargs):
+        kwargs["repo"] = 'dir_repo_copper'
+        super(Copper, self).__init__(**kwargs)
         self.cmd = 'cd %s/tests && bash run.sh && cd -' % self.repo
index fd181a0..3a2cc7d 100644 (file)
@@ -17,8 +17,7 @@ import functest.core.feature as base
 
 
 class Doctor(base.Feature):
-    def __init__(self, case_name='doctor-notification'):
-        super(Doctor, self).__init__(project='doctor',
-                                     case_name=case_name,
-                                     repo='dir_repo_doctor')
+    def __init__(self, **kwargs):
+        kwargs["repo"] = 'dir_repo_doctor'
+        super(Doctor, self).__init__(**kwargs)
         self.cmd = 'cd %s/tests && ./run.sh' % self.repo
index 1c62023..629c8d5 100644 (file)
@@ -18,8 +18,7 @@ import functest.core.feature as base
 
 
 class Domino(base.Feature):
-    def __init__(self, case_name='domino-multinode'):
-        super(Domino, self).__init__(project='domino',
-                                     case_name=case_name,
-                                     repo='dir_repo_domino')
+    def __init__(self, **kwargs):
+        kwargs["repo"] = 'dir_repo_domino'
+        super(Domino, self).__init__(**kwargs)
         self.cmd = 'cd %s && ./tests/run_multinode.sh' % self.repo
index ada322c..f7bab08 100644 (file)
@@ -13,10 +13,9 @@ import functest.core.feature as base
 
 class GluonVping(base.Feature):
 
-    def __init__(self, case_name='gluon_vping'):
-        super(GluonVping, self).__init__(project='netready',
-                                         case_name=case_name,
-                                         repo='dir_repo_netready')
+    def __init__(self, **kwargs):
+        kwargs["repo"] = 'dir_repo_netready'
+        super(GluonVping, self).__init__(**kwargs)
         dir_netready_functest = '{}/test/functest'.format(self.repo)
         self.cmd = ('cd %s && python ./gluon-test-suite.py' %
                     dir_netready_functest)
index f96683e..d4f4eb6 100644 (file)
@@ -12,9 +12,8 @@ import functest.core.feature as base
 
 class OpenDaylightSFC(base.Feature):
 
-    def __init__(self, case_name='functest-odl-sfc'):
-        super(OpenDaylightSFC, self).__init__(project='sfc',
-                                              case_name=case_name,
-                                              repo='dir_repo_sfc')
+    def __init__(self, **kwargs):
+        kwargs["repo"] = 'dir_repo_sfc'
+        super(OpenDaylightSFC, self).__init__(**kwargs)
         dir_sfc_functest = '{}/sfc/tests/functest'.format(self.repo)
         self.cmd = 'cd %s && python ./run_tests.py' % dir_sfc_functest
index e3dc7fd..49eb8a0 100644 (file)
@@ -16,9 +16,8 @@ import functest.core.feature as base
 
 
 class Promise(base.Feature):
-    def __init__(self, case_name='promise'):
-        super(Promise, self).__init__(project='promise',
-                                      case_name=case_name,
-                                      repo='dir_repo_promise')
+    def __init__(self, **kwargs):
+        kwargs["repo"] = 'dir_repo_promise'
+        super(Promise, self).__init__(**kwargs)
         dir_promise_functest = '{}/promise/test/functest'.format(self.repo)
         self.cmd = 'cd %s && python ./run_tests.py' % dir_promise_functest
index 5e9254a..6a1071f 100644 (file)
@@ -12,9 +12,8 @@ import functest.core.feature as base
 
 class SdnVpnTests(base.Feature):
 
-    def __init__(self, case_name='bgpvpn'):
-        super(SdnVpnTests, self).__init__(project='sdnvpn',
-                                          case_name=case_name,
-                                          repo='dir_repo_sdnvpn')
+    def __init__(self, **kwargs):
+        kwargs["repo"] = 'dir_repo_sdnvpn'
+        super(SdnVpnTests, self).__init__(**kwargs)
         dir_sfc_functest = '{}/sdnvpn/test/functest'.format(self.repo)
         self.cmd = 'cd %s && python ./run_tests.py' % dir_sfc_functest
index e725638..2ed9a82 100644 (file)
@@ -13,10 +13,9 @@ from functest.utils.constants import CONST
 
 
 class SecurityScan(base.Feature):
-    def __init__(self, case_name='security_scan'):
-        super(SecurityScan, self).__init__(project='securityscanning',
-                                           case_name=case_name,
-                                           repo='dir_repo_securityscan')
+    def __init__(self, **kwargs):
+        kwargs["repo"] = 'dir_repo_securityscan'
+        super(SecurityScan, self).__init__(**kwargs)
         self.cmd = ('. {0}/stackrc && '
                     'cd {1} && '
                     'python security_scan.py --config config.ini && '
index a9cf0ae..dea26ef 100644 (file)
@@ -16,9 +16,12 @@ import functest.core.feature as base
 
 
 class Orchestra(base.Feature):
-    def __init__(self):
-        super(Orchestra, self).__init__(project='orchestra',
-                                        case='orchestra',
-                                        repo='dir_repo_orchestra')
+    def __init__(self, **kwargs):
+        if "project_name" not in kwargs:
+            kwargs["project_name"] = "orchestra"
+        if "case_name" not in kwargs:
+            kwargs["case_name"] = "orchestra"
+        kwargs['repo'] = 'dir_repo_orchestra'
+        super(Orchestra, self).__init__(**kwargs)
         # TODO
         # self.cmd = "%s/tests/run.sh %s/tests" % (self.repo, self.repo)
index e7411c5..ad8745c 100644 (file)
@@ -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, case_name=''):
-        super(RallyBase, self).__init__(case_name)
+    def __init__(self, **kwargs):
+        super(RallyBase, self).__init__(**kwargs)
         self.mode = ''
         self.summary = []
         self.scenario_dir = ''
@@ -536,8 +536,10 @@ class RallyBase(testcase.TestCase):
 
 
 class RallySanity(RallyBase):
-    def __init__(self, case_name="rally_sanity"):
-        super(RallySanity, self).__init__(case_name)
+    def __init__(self, **kwargs):
+        if "case_name" not in kwargs:
+            kwargs["case_name"] = "rally_sanity"
+        super(RallySanity, self).__init__(**kwargs)
         self.mode = 'sanity'
         self.test_name = 'all'
         self.smoke = True
@@ -545,8 +547,10 @@ class RallySanity(RallyBase):
 
 
 class RallyFull(RallyBase):
-    def __init__(self, case_name="rally_full"):
-        super(RallyFull, self).__init__(case_name)
+    def __init__(self, **kwargs):
+        if "case_name" not in kwargs:
+            kwargs["case_name"] = "rally_full"
+        super(RallyFull, self).__init__(**kwargs)
         self.mode = 'full'
         self.test_name = 'all'
         self.smoke = False
index 441abfe..c708a22 100755 (executable)
@@ -25,8 +25,10 @@ logger = ft_logger.Logger("refstack_defcore").getLogger()
 
 class RefstackClient(testcase.TestCase):
 
-    def __init__(self, case_name="refstack_defcore"):
-        super(RefstackClient, self).__init__(case_name)
+    def __init__(self, **kwargs):
+        if "case_name" not in kwargs:
+            kwargs["case_name"] = "refstack_defcore"
+        super(RefstackClient, self).__init__(**kwargs)
         self.FUNCTEST_TEST = CONST.dir_functest_test
         self.CONF_PATH = CONST.refstack_tempest_conf_path
         self.DEFCORE_LIST = CONST.refstack_defcore_list
index dea1ca7..bceb7c1 100644 (file)
@@ -20,8 +20,10 @@ class ApiCheck(SnapsTestRunner):
     that exercise many of the OpenStack APIs within Keystone, Glance, Neutron,
     and Nova
     """
-    def __init__(self, case_name="api_check"):
-        super(ApiCheck, self).__init__(case_name)
+    def __init__(self, **kwargs):
+        if "case_name" not in kwargs:
+            kwargs["case_name"] = "api_check"
+        super(ApiCheck, self).__init__(**kwargs)
 
         self.suite = unittest.TestSuite()
 
index 57b74d4..0607beb 100644 (file)
@@ -20,8 +20,10 @@ class ConnectionCheck(SnapsTestRunner):
     that simply obtain the different OpenStack clients and may perform
     simple queries
     """
-    def __init__(self, case_name="connection_check"):
-        super(ConnectionCheck, self).__init__(case_name)
+    def __init__(self, **kwargs):
+        if "case_name" not in kwargs:
+            kwargs["case_name"] = "connection_check"
+        super(ConnectionCheck, self).__init__(**kwargs)
 
         self.suite = unittest.TestSuite()
 
index 6b3cfdd..245f505 100644 (file)
@@ -21,8 +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, case_name="snaps_health_check"):
-        super(HealthCheck, self).__init__(case_name)
+    def __init__(self, **kwargs):
+        if "case_name" not in kwargs:
+            kwargs["case_name"] = "snaps_health_check"
+        super(HealthCheck, self).__init__(**kwargs)
 
         self.suite = unittest.TestSuite()
 
index 63d5c12..ceead6b 100644 (file)
@@ -21,8 +21,10 @@ class SnapsSmoke(SnapsTestRunner):
     that exercise many of the OpenStack APIs within Keystone, Glance, Neutron,
     and Nova
     """
-    def __init__(self, case_name="snaps_smoke"):
-        super(SnapsSmoke, self).__init__(case_name)
+    def __init__(self, **kwargs):
+        if "case_name" not in kwargs:
+            kwargs["case_name"] = "snaps_smoke"
+        super(SnapsSmoke, self).__init__(**kwargs)
 
         self.suite = unittest.TestSuite()
         use_fip = CONST.snaps_use_floating_ips
index 044a0bb..2068852 100644 (file)
@@ -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, case_name=''):
-        super(SnapsTestRunner, self).__init__(case_name)
+    def __init__(self, **kwargs):
+        super(SnapsTestRunner, self).__init__(**kwargs)
 
         self.ext_net_name = snaps_utils.get_ext_net_name()
         self.logger = ft_logger.Logger(self.project_name).getLogger()
index c3184e3..8b175c2 100644 (file)
@@ -28,8 +28,8 @@ logger = ft_logger.Logger("Tempest").getLogger()
 
 class TempestCommon(testcase.TestCase):
 
-    def __init__(self, case_name=''):
-        super(TempestCommon, self).__init__(case_name)
+    def __init__(self, **kwargs):
+        super(TempestCommon, self).__init__(**kwargs)
         self.MODE = ""
         self.OPTION = ""
         self.VERIFIER_ID = conf_utils.get_verifier_id()
@@ -234,31 +234,39 @@ class TempestCommon(testcase.TestCase):
 
 class TempestSmokeSerial(TempestCommon):
 
-    def __init__(self, case_name='tempest_smoke_serial'):
-        TempestCommon.__init__(self, case_name)
+    def __init__(self, **kwargs):
+        if "case_name" not in kwargs:
+            kwargs["case_name"] = 'tempest_smoke_serial'
+        TempestCommon.__init__(self, **kwargs)
         self.MODE = "smoke"
         self.OPTION = "--concurrency 1"
 
 
 class TempestSmokeParallel(TempestCommon):
 
-    def __init__(self, case_name='tempest_smoke_parallel'):
-        TempestCommon.__init__(self, case_name)
+    def __init__(self, **kwargs):
+        if "case_name" not in kwargs:
+            kwargs["case_name"] = 'tempest_smoke_parallel'
+        TempestCommon.__init__(self, **kwargs)
         self.MODE = "smoke"
         self.OPTION = ""
 
 
 class TempestFullParallel(TempestCommon):
 
-    def __init__(self, case_name="tempest_full_parallel"):
-        TempestCommon.__init__(self, case_name)
+    def __init__(self, **kwargs):
+        if "case_name" not in kwargs:
+            kwargs["case_name"] = 'tempest_full_parallel'
+        TempestCommon.__init__(self, **kwargs)
         self.MODE = "full"
 
 
 class TempestMultisite(TempestCommon):
 
-    def __init__(self, case_name="multisite"):
-        TempestCommon.__init__(self, case_name)
+    def __init__(self, **kwargs):
+        if "case_name" not in kwargs:
+            kwargs["case_name"] = 'multisite'
+        TempestCommon.__init__(self, **kwargs)
         self.MODE = "feature_multisite"
         self.OPTION = "--concurrency 1"
         conf_utils.install_verifier_ext(CONST.dir_repo_kingbird)
@@ -266,15 +274,19 @@ class TempestMultisite(TempestCommon):
 
 class TempestCustom(TempestCommon):
 
-    def __init__(self, case_name="tempest_custom"):
-        TempestCommon.__init__(self, case_name)
+    def __init__(self, **kwargs):
+        if "case_name" not in kwargs:
+            kwargs["case_name"] = 'tempest_custom'
+        TempestCommon.__init__(self, **kwargs)
         self.MODE = "custom"
         self.OPTION = "--concurrency 1"
 
 
 class TempestDefcore(TempestCommon):
 
-    def __init__(self, case_name="tempest_defcore"):
-        TempestCommon.__init__(self, case_name)
+    def __init__(self, **kwargs):
+        if "case_name" not in kwargs:
+            kwargs["case_name"] = 'tempest_defcore'
+        TempestCommon.__init__(self, **kwargs)
         self.MODE = "defcore"
         self.OPTION = "--concurrency 1"
index 64cb000..8f7cc1d 100644 (file)
@@ -18,8 +18,8 @@ from functest.utils.constants import CONST
 
 
 class VPingBase(testcase.TestCase):
-    def __init__(self, case_name=''):
-        super(VPingBase, self).__init__(case_name)
+    def __init__(self, **kwargs):
+        super(VPingBase, self).__init__(**kwargs)
         self.logger = None
         self.functest_repo = CONST.dir_repo_functest
         self.repo = CONST.dir_vping
index a68b0ff..c26c4e0 100755 (executable)
@@ -24,8 +24,10 @@ import functest.core.testcase as testcase
 
 class VPingSSH(vping_base.VPingBase):
 
-    def __init__(self, case_name='vping_ssh'):
-        super(VPingSSH, self).__init__(case_name)
+    def __init__(self, **kwargs):
+        if "case_name" not in kwargs:
+            kwargs["case_name"] = "vping_ssh"
+        super(VPingSSH, self).__init__(**kwargs)
         self.logger = ft_logger.Logger(self.case_name).getLogger()
 
     def do_vping(self, vm, test_ip):
index e9b8699..1b00ca2 100755 (executable)
@@ -18,8 +18,10 @@ import vping_base
 
 class VPingUserdata(vping_base.VPingBase):
 
-    def __init__(self, case_name='vping_userdata'):
-        super(VPingUserdata, self).__init__(case_name)
+    def __init__(self, **kwargs):
+        if "case_name" not in kwargs:
+            kwargs["case_name"] = "vping_userdata"
+        super(VPingUserdata, self).__init__(**kwargs)
         self.logger = ft_logger.Logger(self.case_name).getLogger()
 
     def boot_vm_preparation(self, config, vmname, test_ip):
index fe37669..fe496c1 100644 (file)
@@ -49,8 +49,10 @@ class OnosBase(testcase.TestCase):
 
 
 class Onos(OnosBase):
-    def __init__(self, case_name='onos'):
-        super(Onos, self).__init__(case_name)
+    def __init__(self, **kwargs):
+        if "case_name" not in kwargs:
+            kwargs["case_name"] = "onos"
+        super(Onos, self).__init__(**kwargs)
         self.log_path = os.path.join(self.onos_repo_path, 'TestON/logs')
 
     def set_onos_ip(self):
index f80e7bc..6de65bc 100755 (executable)
@@ -20,8 +20,10 @@ class AaaVnf(vnf_base.VnfOnBoardingBase):
 
     logger = ft_logger.Logger("VNF AAA").getLogger()
 
-    def __init__(self):
-        super(AaaVnf, self).__init__(case_name="aaa")
+    def __init__(self, **kwargs):
+        if "case_name" not in kwargs:
+            kwargs["case_name"] = "aaa"
+        super(AaaVnf, self).__init__(**kwargs)
 
     def deploy_orchestrator(self):
         self.logger.info("No VNFM needed to deploy a free radius here")
index 2fc5449..494633f 100644 (file)
@@ -20,13 +20,12 @@ import functest.utils.functest_utils as ft_utils
 
 class ClearwaterOnBoardingBase(vnf_base.VnfOnBoardingBase):
 
-    def __init__(self, project='functest', case='', repo='', cmd=''):
+    def __init__(self, **kwargs):
         self.logger = ft_logger.Logger(__name__).getLogger()
-        super(ClearwaterOnBoardingBase, self).__init__(
-            project, case, repo, cmd)
+        super(ClearwaterOnBoardingBase, self).__init__(**kwargs)
         self.case_dir = os.path.join(CONST.dir_functest_test, 'vnf', 'ims')
         self.data_dir = CONST.dir_ims_data
-        self.result_dir = os.path.join(CONST.dir_results, case)
+        self.result_dir = os.path.join(CONST.dir_results, self.case_name)
         self.test_dir = CONST.dir_repo_vims_test
 
         if not os.path.exists(self.data_dir):
index d739335..e351e0d 100644 (file)
@@ -25,9 +25,10 @@ import functest.utils.openstack_utils as os_utils
 
 class CloudifyIms(clearwater_ims_base.ClearwaterOnBoardingBase):
 
-    def __init__(self, project='functest', case_name='cloudify_ims',
-                 repo='', cmd=''):
-        super(CloudifyIms, self).__init__(project, case_name, repo, cmd)
+    def __init__(self, **kwargs):
+        if "case_name" not in kwargs:
+            kwargs["case_name"] = "cloudify_ims"
+        super(CloudifyIms, self).__init__(**kwargs)
         self.logger = ft_logger.Logger(__name__).getLogger()
 
         # Retrieve the configuration
index fe4def1..ff726b9 100644 (file)
@@ -19,8 +19,7 @@ import functest.core.feature as base
 
 
 class Parser(base.Feature):
-    def __init__(self, case_name='parser-basics'):
-        super(Parser, self).__init__(project='parser',
-                                     case_name=case_name,
-                                     repo='dir_repo_parser')
+    def __init__(self, **kwargs):
+        kwargs["repo"] = 'dir_repo_parser'
+        super(Parser, self).__init__(**kwargs)
         self.cmd = 'cd %s/tests && ./functest_run.sh' % self.repo
index e188c3f..e6d2284 100644 (file)
@@ -14,10 +14,11 @@ RESULT_DETAILS_FILE = "test_result.json"
 
 
 class VrouterVnf(base.Feature):
-    def __init__(self):
-        super(VrouterVnf, self).__init__(project='functest',
-                                         case='vyos_vrouter',
-                                         repo='dir_repo_vrouter')
+    def __init__(self, **kwargs):
+        kwargs["repo"] = 'dir_repo_vrouter'
+        if "case_name" not in kwargs:
+            kwargs["case_name"] = "vyos_vrouter"
+        super(VrouterVnf, self).__init__(**kwargs)
         self.cmd = 'cd %s && ./run.sh' % self.repo
 
     def set_result_details(self):
index 48c94a5..438fa7c 100644 (file)
@@ -22,7 +22,7 @@ class TierBuilderTesting(unittest.TestCase):
                            'scenario': 'test_scenario'}
 
         self.testcase = {'dependencies': self.dependency,
-                         'name': 'test_name',
+                         'case_name': 'test_name',
                          'criteria': 'test_criteria',
                          'blocking': 'test_blocking',
                          'clean_flag': 'test_clean_flag',
index 5ff41cd..4f3b25c 100644 (file)
@@ -27,10 +27,11 @@ class TestCaseTesting(unittest.TestCase):
     logging.disable(logging.CRITICAL)
 
     _case_name = "base"
+    _project_name = "functest"
 
     def setUp(self):
-        self.test = testcase.TestCase(case_name=self._case_name)
-        self.test.project = "functest"
+        self.test = testcase.TestCase(case_name=self._case_name,
+                                      project_name=self._project_name)
         self.test.start_time = "1"
         self.test.stop_time = "2"
         self.test.criteria = "PASS"
@@ -74,7 +75,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._case_name, self.test.start_time,
+            self._project_name, 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',
@@ -83,7 +84,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._case_name, self.test.start_time,
+            self._project_name, 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',
@@ -92,7 +93,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._case_name, self.test.start_time,
+            self._project_name, self._case_name, self.test.start_time,
             self.test.stop_time, self.test.criteria, self.test.details)
 
     def test_check_criteria_missing(self):
index 62f2e0d..8afb56d 100644 (file)
@@ -26,13 +26,16 @@ class BarometerTesting(unittest.TestCase):
 
     logging.disable(logging.CRITICAL)
 
+    _case_name = "barometercollectd"
+    _project_name = "barometer"
+
     def setUp(self):
         self.barometer = barometer.BarometerCollectd(
-            case_name="barometercollectd")
+            case_name=self._case_name, project_name=self._project_name)
 
     def test_init(self):
-        self.assertEqual(self.barometer.project_name, "barometer")
-        self.assertEqual(self.barometer.case_name, "barometercollectd")
+        self.assertEqual(self.barometer.project_name, self._project_name)
+        self.assertEqual(self.barometer.case_name, self._case_name)
         self.assertEqual(
             self.barometer.repo,
             constants.CONST.__getattribute__('dir_repo_barometer'))
index b6d187f..e4ddc14 100644 (file)
@@ -20,12 +20,16 @@ class CopperTesting(unittest.TestCase):
 
     logging.disable(logging.CRITICAL)
 
+    _case_name = "copper-notification"
+    _project_name = "copper"
+
     def setUp(self):
-        self.copper = copper.Copper(case_name="copper-notification")
+        self.copper = copper.Copper(case_name=self._case_name,
+                                    project_name=self._project_name)
 
     def test_init(self):
-        self.assertEqual(self.copper.project_name, "copper")
-        self.assertEqual(self.copper.case_name, "copper-notification")
+        self.assertEqual(self.copper.project_name, self._project_name)
+        self.assertEqual(self.copper.case_name, self._case_name)
         self.assertEqual(
             self.copper.repo,
             constants.CONST.__getattribute__("dir_repo_copper"))
index 36bac44..a851288 100644 (file)
@@ -20,12 +20,16 @@ class DoctorTesting(unittest.TestCase):
 
     logging.disable(logging.CRITICAL)
 
+    _case_name = "doctor-notification"
+    _project_name = "doctor"
+
     def setUp(self):
-        self.doctor = doctor.Doctor(case_name="doctor-notification")
+        self.doctor = doctor.Doctor(case_name=self._case_name,
+                                    project_name=self._project_name)
 
     def test_init(self):
-        self.assertEqual(self.doctor.project_name, "doctor")
-        self.assertEqual(self.doctor.case_name, "doctor-notification")
+        self.assertEqual(self.doctor.project_name, self._project_name)
+        self.assertEqual(self.doctor.case_name, self._case_name)
         self.assertEqual(
             self.doctor.repo,
             constants.CONST.__getattribute__("dir_repo_doctor"))
index c0bfd14..27353a4 100644 (file)
@@ -20,12 +20,16 @@ class DominoTesting(unittest.TestCase):
 
     logging.disable(logging.CRITICAL)
 
+    _case_name = "domino-multinode"
+    _project_name = "domino"
+
     def setUp(self):
-        self.domino = domino.Domino(case_name="domino-multinode")
+        self.domino = domino.Domino(case_name=self._case_name,
+                                    project_name=self._project_name)
 
     def test_init(self):
-        self.assertEqual(self.domino.project_name, "domino")
-        self.assertEqual(self.domino.case_name, "domino-multinode")
+        self.assertEqual(self.domino.project_name, self._project_name)
+        self.assertEqual(self.domino.case_name, self._case_name)
         self.assertEqual(
             self.domino.repo,
             constants.CONST.__getattribute__("dir_repo_domino"))
index 47be420..1a88e78 100644 (file)
@@ -20,12 +20,16 @@ class NetreadyTesting(unittest.TestCase):
 
     logging.disable(logging.CRITICAL)
 
+    _case_name = "gluon_vping"
+    _project_name = "netready"
+
     def setUp(self):
-        self.netready = netready.GluonVping(case_name="gluon_vping")
+        self.netready = netready.GluonVping(case_name=self._case_name,
+                                            project_name=self._project_name)
 
     def test_init(self):
-        self.assertEqual(self.netready.project_name, "netready")
-        self.assertEqual(self.netready.case_name, "gluon_vping")
+        self.assertEqual(self.netready.project_name, self._project_name)
+        self.assertEqual(self.netready.case_name, self._case_name)
         self.assertEqual(
             self.netready.repo,
             constants.CONST.__getattribute__("dir_repo_netready"))
index dcdcdff..439d596 100644 (file)
@@ -20,8 +20,13 @@ class OpenDaylightSFCTesting(unittest.TestCase):
 
     logging.disable(logging.CRITICAL)
 
+    _case_name = "functest-odl-sfc"
+    _project_name = "sfc"
+
     def setUp(self):
-        self.odl_sfc = odl_sfc.OpenDaylightSFC(case_name="functest-odl-sfc")
+        self.odl_sfc = odl_sfc.OpenDaylightSFC(
+            case_name="functest-odl-sfc",
+            project_name=self._project_name)
 
     def test_init(self):
         self.assertEqual(self.odl_sfc.project_name, "sfc")
index 29b4d4e..2af9c67 100644 (file)
@@ -20,12 +20,16 @@ class PromiseTesting(unittest.TestCase):
 
     logging.disable(logging.CRITICAL)
 
+    _case_name = "promise"
+    _project_name = "promise"
+
     def setUp(self):
-        self.promise = promise.Promise(case_name="promise")
+        self.promise = promise.Promise(case_name=self._case_name,
+                                       project_name=self._project_name)
 
     def test_init(self):
-        self.assertEqual(self.promise.project_name, "promise")
-        self.assertEqual(self.promise.case_name, "promise")
+        self.assertEqual(self.promise.project_name, self._project_name)
+        self.assertEqual(self.promise.case_name, self._case_name)
         self.assertEqual(
             self.promise.repo,
             constants.CONST.__getattribute__("dir_repo_promise"))
index 8fa43fc..dd67d8b 100644 (file)
@@ -20,12 +20,16 @@ class SdnVpnTesting(unittest.TestCase):
 
     logging.disable(logging.CRITICAL)
 
+    _case_name = "bgpvpn"
+    _project_name = "sdnvpn"
+
     def setUp(self):
-        self.sdnvpn = sdnvpn.SdnVpnTests(case_name="bgpvpn")
+        self.sdnvpn = sdnvpn.SdnVpnTests(case_name=self._case_name,
+                                         project_name=self._project_name)
 
     def test_init(self):
-        self.assertEqual(self.sdnvpn.project_name, "sdnvpn")
-        self.assertEqual(self.sdnvpn.case_name, "bgpvpn")
+        self.assertEqual(self.sdnvpn.project_name, self._project_name)
+        self.assertEqual(self.sdnvpn.case_name, self._case_name)
         self.assertEqual(
             self.sdnvpn.repo,
             constants.CONST.__getattribute__("dir_repo_sdnvpn"))
index f0e4015..081bf1f 100644 (file)
@@ -20,12 +20,16 @@ class SecurityScanTesting(unittest.TestCase):
 
     logging.disable(logging.CRITICAL)
 
+    _case_name = "security_scan"
+    _project_name = "security_scan"
+
     def setUp(self):
-        self.sscan = security_scan.SecurityScan(case_name="security_scan")
+        self.sscan = security_scan.SecurityScan(
+            case_name=self._case_name, project_name=self._project_name)
 
     def test_init(self):
-        self.assertEqual(self.sscan.project_name, "securityscanning")
-        self.assertEqual(self.sscan.case_name, "security_scan")
+        self.assertEqual(self.sscan.project_name, self._project_name)
+        self.assertEqual(self.sscan.case_name, self._case_name)
         self.assertEqual(
             self.sscan.repo,
             constants.CONST.__getattribute__("dir_repo_securityscan"))
index e08deb2..55e100d 100644 (file)
@@ -90,7 +90,7 @@ class ODLTesting(unittest.TestCase):
         os.environ["OS_USERNAME"] = self._os_username
         os.environ["OS_PASSWORD"] = self._os_password
         os.environ["OS_TENANT_NAME"] = self._os_tenantname
-        self.test = odl.ODLTests()
+        self.test = odl.ODLTests(case_name='odl', project_name='functest')
         self.defaultargs = {'odlusername': self._odl_username,
                             'odlpassword': self._odl_password,
                             'neutronip': self._keystone_ip,
index eb241e5..22cadf0 100644 (file)
@@ -54,7 +54,8 @@ class FunctestUtilsTesting(unittest.TestCase):
         self.cmd = 'test_cmd'
         self.output_file = 'test_output_file'
         self.testname = 'testname'
-        self.testcase_dict = {'name': 'testname', 'criteria': self.criteria}
+        self.testcase_dict = {'case_name': 'testname',
+                              'criteria': self.criteria}
         self.parameter = 'general.openstack.image_name'
         self.config_yaml = 'test_config_yaml-'
         self.db_url_env = 'http://foo/testdb'
index 59f618a..3a181fe 100644 (file)
@@ -20,12 +20,16 @@ class ParserTesting(unittest.TestCase):
 
     logging.disable(logging.CRITICAL)
 
+    _case_name = "parser-basics"
+    _project_name = "parser"
+
     def setUp(self):
-        self.parser = parser.Parser(case_name="parser-basics")
+        self.parser = parser.Parser(
+            case_name=self._case_name, project_name=self._project_name)
 
     def test_init(self):
-        self.assertEqual(self.parser.project_name, "parser")
-        self.assertEqual(self.parser.case_name, "parser-basics")
+        self.assertEqual(self.parser.project_name, self._project_name)
+        self.assertEqual(self.parser.case_name, self._case_name)
         self.assertEqual(
             self.parser.repo,
             constants.CONST.__getattribute__("dir_repo_parser"))
index 7cc5029..ef9d3da 100644 (file)
@@ -337,7 +337,7 @@ def get_dict_by_test(testname):
 
     for dic_tier in testcases_yaml.get("tiers"):
         for dic_testcase in dic_tier['testcases']:
-            if dic_testcase['name'] == testname:
+            if dic_testcase['case_name'] == testname:
                 return dic_testcase
 
     logger.error('Project %s is not defined in testcases.yaml' % testname)