From 457321c2c8ed7e8dcb1daccb6d2fd9814e6a98ca Mon Sep 17 00:00:00 2001 From: Cédric Ollivier Date: Tue, 28 Mar 2017 20:38:15 +0200 Subject: Add case_name as constructor arg MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It allows managing multiple TestCase names with only one TestCase module. It is mainly required by odl which implements: - odl, - odl_netvirt, - fds. It also renames case to case_name in Features to conform with TestCases. JIRA: FUNCTEST-762 Change-Id: Ie254f754a0ea3077a8afda1c470528d38c79478f Signed-off-by: Cédric Ollivier --- functest/opnfv_tests/features/barometer.py | 2 +- functest/opnfv_tests/features/copper.py | 2 +- functest/opnfv_tests/features/doctor.py | 2 +- functest/opnfv_tests/features/domino.py | 2 +- functest/opnfv_tests/features/netready.py | 2 +- functest/opnfv_tests/features/odl_sfc.py | 2 +- functest/opnfv_tests/features/promise.py | 2 +- functest/opnfv_tests/features/sdnvpn.py | 2 +- functest/opnfv_tests/features/security_scan.py | 2 +- functest/opnfv_tests/openstack/rally/rally.py | 4 +-- .../openstack/refstack_client/refstack_client.py | 9 +++--- functest/opnfv_tests/openstack/tempest/tempest.py | 34 +++++++++------------- functest/opnfv_tests/openstack/vping/vping_base.py | 4 +-- functest/opnfv_tests/openstack/vping/vping_ssh.py | 5 ++-- .../opnfv_tests/openstack/vping/vping_userdata.py | 5 ++-- functest/opnfv_tests/sdn/odl/odl.py | 4 --- functest/opnfv_tests/sdn/onos/onos.py | 8 ++--- functest/opnfv_tests/vnf/aaa/aaa.py | 3 +- functest/opnfv_tests/vnf/ims/cloudify_ims.py | 4 +-- functest/opnfv_tests/vnf/ims/opera_ims.py | 4 +-- functest/opnfv_tests/vnf/ims/orchestra_ims.py | 4 +-- 21 files changed, 45 insertions(+), 61 deletions(-) (limited to 'functest/opnfv_tests') diff --git a/functest/opnfv_tests/features/barometer.py b/functest/opnfv_tests/features/barometer.py index 6011340f..8432bda4 100644 --- a/functest/opnfv_tests/features/barometer.py +++ b/functest/opnfv_tests/features/barometer.py @@ -18,7 +18,7 @@ class BarometerCollectd(base.Feature): def __init__(self): super(BarometerCollectd, self).__init__(project='barometer', - case='barometercollectd', + case_name='barometercollectd', repo='dir_repo_barometer') def execute(self): diff --git a/functest/opnfv_tests/features/copper.py b/functest/opnfv_tests/features/copper.py index 689341ea..6ed5e0ce 100644 --- a/functest/opnfv_tests/features/copper.py +++ b/functest/opnfv_tests/features/copper.py @@ -20,6 +20,6 @@ import functest.core.feature as base class Copper(base.Feature): def __init__(self): super(Copper, self).__init__(project='copper', - case='copper-notification', + case_name='copper-notification', 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 d32bbfc9..e35eadee 100644 --- a/functest/opnfv_tests/features/doctor.py +++ b/functest/opnfv_tests/features/doctor.py @@ -19,6 +19,6 @@ import functest.core.feature as base class Doctor(base.Feature): def __init__(self): super(Doctor, self).__init__(project='doctor', - case='doctor-notification', + case_name='doctor-notification', 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 e34429bc..cf5f23d1 100644 --- a/functest/opnfv_tests/features/domino.py +++ b/functest/opnfv_tests/features/domino.py @@ -20,6 +20,6 @@ import functest.core.feature as base class Domino(base.Feature): def __init__(self): super(Domino, self).__init__(project='domino', - case='domino-multinode', + case_name='domino-multinode', 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 88f377c2..7648a9b3 100644 --- a/functest/opnfv_tests/features/netready.py +++ b/functest/opnfv_tests/features/netready.py @@ -15,7 +15,7 @@ class GluonVping(base.Feature): def __init__(self): super(GluonVping, self).__init__(project='netready', - case='gluon_vping', + case_name='gluon_vping', 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 fff7f2b0..d3947e37 100644 --- a/functest/opnfv_tests/features/odl_sfc.py +++ b/functest/opnfv_tests/features/odl_sfc.py @@ -14,7 +14,7 @@ class OpenDaylightSFC(base.Feature): def __init__(self): super(OpenDaylightSFC, self).__init__(project='sfc', - case='functest-odl-sfc', + case_name='functest-odl-sfc', 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 a7f4e628..b76a1910 100644 --- a/functest/opnfv_tests/features/promise.py +++ b/functest/opnfv_tests/features/promise.py @@ -18,7 +18,7 @@ import functest.core.feature as base class Promise(base.Feature): def __init__(self): super(Promise, self).__init__(project='promise', - case='promise', + case_name='promise', 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 10e3146c..ea31f20a 100644 --- a/functest/opnfv_tests/features/sdnvpn.py +++ b/functest/opnfv_tests/features/sdnvpn.py @@ -14,7 +14,7 @@ class SdnVpnTests(base.Feature): def __init__(self): super(SdnVpnTests, self).__init__(project='sdnvpn', - case='bgpvpn', + case_name='bgpvpn', 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 2374b39f..3cde9d31 100644 --- a/functest/opnfv_tests/features/security_scan.py +++ b/functest/opnfv_tests/features/security_scan.py @@ -15,7 +15,7 @@ from functest.utils.constants import CONST class SecurityScan(base.Feature): def __init__(self): super(SecurityScan, self).__init__(project='securityscanning', - case='security_scan', + case_name='security_scan', 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 8c6abc15..1fe6143e 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 = '' diff --git a/functest/opnfv_tests/openstack/refstack_client/refstack_client.py b/functest/opnfv_tests/openstack/refstack_client/refstack_client.py index 37aa9e39..2d04869a 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 @@ -194,8 +193,8 @@ class RefstackClient(testcase.TestCase): class RefstackClientParser(testcase.TestCase): - def __init__(self): - super(RefstackClientParser, self).__init__() + def __init__(self, case_name=''): + super(RefstackClientParser, 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 diff --git a/functest/opnfv_tests/openstack/tempest/tempest.py b/functest/opnfv_tests/openstack/tempest/tempest.py index 0addbd17..c3184e35 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 584ded38..64cb0004 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 fc2f01c6..a68b0ff7 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 fa91c12a..e9b86998 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 ccc1101a..c0e2a9ae 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 d482ae32..fe37669a 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 bdedcf7c..f80e7bcc 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/cloudify_ims.py b/functest/opnfv_tests/vnf/ims/cloudify_ims.py index 404f208e..d739335d 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 d022b3c7..7ca96ae1 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 5c19be09..213d690d 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 -- cgit 1.2.3-korg