diff options
-rw-r--r-- | test/functest/config.yaml | 15 | ||||
-rw-r--r-- | test/functest/tempest.py | 81 | ||||
-rw-r--r-- | test/functest/tempest_1.sh | 11 | ||||
-rw-r--r-- | test/functest/tempest_2.sh | 11 |
4 files changed, 84 insertions, 34 deletions
diff --git a/test/functest/config.yaml b/test/functest/config.yaml index 91f960e..83564c4 100644 --- a/test/functest/config.yaml +++ b/test/functest/config.yaml @@ -1,18 +1,11 @@ testcases: - tempest_1: + tempest: enabled: true - description: ODL VPN Service tests - type: bash - - tempest_2: - enabled: true - description: OpenStack Neutron BGPVPN API tests - type: bash + description: Neutron BGPVPN tests in tempest testcase_1: enabled: true description: VPN provides connectivity between subnets - type: python ping_timeout: 200 flavor: m1.tiny # adapt to your environment instance_1_name: sdnvpn-1-1 @@ -35,7 +28,6 @@ testcases: testcase_2: enabled: true description: Tenant separation - type: python ping_timeout: 200 flavor: m1.tiny # adapt to your environment instance_1_name: sdnvpn-2-1 @@ -60,7 +52,6 @@ testcases: sdnvpn_sg_descr: Security group for SDNVPN test cases testcase_3: - enabled: true + enabled: false description: Data center gateway integration - type: python diff --git a/test/functest/tempest.py b/test/functest/tempest.py new file mode 100644 index 0000000..8d4b664 --- /dev/null +++ b/test/functest/tempest.py @@ -0,0 +1,81 @@ +#!/usr/bin/python +# +# Copyright (c) 2015 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 +# +# +import ConfigParser +import os +import re +import shutil +import functest.utils.functest_logger as ft_logger +import functest.utils.functest_utils as ft_utils + +logger = ft_logger.Logger("bgpvpn").getLogger() + + +def main(): + src_tempest_dir = ft_utils.get_deployment_dir(logger) + if not src_tempest_dir: + logger.error("Rally deployment not found.") + exit(-1) + + src_tempest_conf = src_tempest_dir + '/tempest.conf' + bgpvpn_tempest_conf = src_tempest_dir + '/bgpvpn_tempest.conf' + + if not os.path.isfile(src_tempest_conf): + logger.error("tempest.conf not found in %s." % src_tempest_conf) + exit(-1) + shutil.copy(src_tempest_conf, bgpvpn_tempest_conf) + + logger.info("Copying tempest.conf to %s." % bgpvpn_tempest_conf) + config = ConfigParser.RawConfigParser() + config.read(bgpvpn_tempest_conf) + config.set('service_available', 'bgpvpn', 'True') + logger.debug("Updating %s with bgpvpn=True" % bgpvpn_tempest_conf) + with open(bgpvpn_tempest_conf, 'wb') as config_file: + config.write(config_file) + + cmd_line = (src_tempest_dir + + "/run_tempest.sh -C %s -t -N -- " + "networking_bgpvpn_tempest" % bgpvpn_tempest_conf) + logger.info("Executing: %s" % cmd_line) + cmd = os.popen(cmd_line) + output = cmd.read() + logger.debug(output) + # Results parsing + error_logs = "" + duration = 0 + failed = 0 + try: + # Look For errors + error_logs = "" + for match in re.findall('(.*?)[. ]*FAILED', output): + error_logs += match + # look for duration + m = re.search('tests in(.*)sec', output) + duration = m.group(1) + # Look for num tests run + m = re.search('Ran:(.*)tests', output) + num_tests = m.group(1) + # Look for tests failed + m = re.search('Failed:(.*)', output) + failed = m.group(1) + # Look for name of the tests + testcases = re.findall("\{0\} (.*)", output) + + results = {"test_name": "tempest", "duration": duration, + "num_tests": num_tests, "failed": failed, + "tests": testcases} + logger.info("Results: %s" % results) + return results + except: + logger.error("Problem when parsing the results.") + + +if __name__ == '__main__': + main() diff --git a/test/functest/tempest_1.sh b/test/functest/tempest_1.sh deleted file mode 100644 index 5bc2032..0000000 --- a/test/functest/tempest_1.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash -# -# Copyright (c) 2015 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 -# - -echo "Tempest_1"
\ No newline at end of file diff --git a/test/functest/tempest_2.sh b/test/functest/tempest_2.sh deleted file mode 100644 index e014d95..0000000 --- a/test/functest/tempest_2.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash -# -# Copyright (c) 2015 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 -# - -echo "Tempest_2"
\ No newline at end of file |