From cdd7359cc8a28e767de6aed1f6205f41fc055f34 Mon Sep 17 00:00:00 2001 From: Cédric Ollivier Date: Thu, 2 Feb 2017 18:25:43 +0100 Subject: Allow multiple sets of suites in ODL MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ODLTests can manage multiple sets of suites passing as run args. It avoids duplicating odl.py according to ODL features installed (e.g. netvirt). Change-Id: Ibb0697ef9441506c3f33627e13a0845cc482e23f Signed-off-by: Cédric Ollivier --- functest/opnfv_tests/sdn/odl/odl.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'functest/opnfv_tests/sdn/odl/odl.py') diff --git a/functest/opnfv_tests/sdn/odl/odl.py b/functest/opnfv_tests/sdn/odl/odl.py index 339c305e..9502be93 100755 --- a/functest/opnfv_tests/sdn/odl/odl.py +++ b/functest/opnfv_tests/sdn/odl/odl.py @@ -54,6 +54,7 @@ class ODLTests(testcase_base.TestcaseBase): "csit/suites/openstack/neutron") basic_suite_dir = os.path.join(odl_test_repo, "csit/suites/integration/basic") + default_suites = [basic_suite_dir, neutron_suite_dir] res_dir = '/home/opnfv/functest/results/odl/' logger = ft_logger.Logger("opendaylight").getLogger() @@ -89,8 +90,7 @@ class ODLTests(testcase_base.TestcaseBase): self.details['description'] = result.suite.name self.details['tests'] = visitor.get_data() - def main(self, **kwargs): - dirs = [self.basic_suite_dir, self.neutron_suite_dir] + def main(self, suites=default_suites, **kwargs): try: odlusername = kwargs['odlusername'] odlpassword = kwargs['odlpassword'] @@ -117,7 +117,7 @@ class ODLTests(testcase_base.TestcaseBase): stdout_file = os.path.join(self.res_dir, 'stdout.txt') output_dir = os.path.join(self.res_dir, 'output.xml') with open(stdout_file, 'w+') as stdout: - robot.run(*dirs, variable=variables, + robot.run(*suites, variable=variables, output=output_dir, log='NONE', report='NONE', @@ -140,8 +140,13 @@ class ODLTests(testcase_base.TestcaseBase): else: return self.EX_RUN_ERROR - def run(self): + def run(self, **kwargs): try: + suites = self.default_suites + try: + suites = kwargs["suites"] + except KeyError: + pass keystone_url = op_utils.get_endpoint(service_type='identity') neutron_url = op_utils.get_endpoint(service_type='network') kwargs = {'keystoneip': urlparse.urlparse(keystone_url).hostname} @@ -178,7 +183,7 @@ class ODLTests(testcase_base.TestcaseBase): self.logger.exception("Cannot run ODL testcases.") return self.EX_RUN_ERROR - return self.main(**kwargs) + return self.main(suites, **kwargs) class ODLParser(): @@ -228,7 +233,7 @@ if __name__ == '__main__': parser = ODLParser() args = parser.parse_args(sys.argv[1:]) try: - result = odl.main(**args) + result = odl.main(ODLTests.default_suites, **args) if result != testcase_base.TestcaseBase.EX_OK: sys.exit(result) if args['pushtodb']: -- cgit 1.2.3-korg