diff options
-rw-r--r-- | ci/config_functest.yaml | 1 | ||||
-rw-r--r-- | ci/config_patch.yaml | 1 | ||||
-rwxr-xr-x | ci/exec_test.sh | 7 | ||||
-rw-r--r-- | ci/testcases.yaml | 21 | ||||
-rw-r--r-- | cli/commands/cli_os.py | 6 | ||||
-rw-r--r-- | docker/Dockerfile | 2 | ||||
-rw-r--r-- | testcases/Controllers/ONOS/Sfc/Sfc_fun.py | 16 | ||||
-rwxr-xr-x | testcases/OpenStack/healthcheck/healthcheck.sh | 5 | ||||
-rw-r--r-- | testcases/OpenStack/tempest/custom_tests/blacklist.txt | 17 | ||||
-rwxr-xr-x | testcases/OpenStack/tempest/gen_tempest_conf.py | 4 | ||||
-rwxr-xr-x | testcases/OpenStack/tempest/run_tempest.py | 5 | ||||
-rwxr-xr-x | testcases/features/copper.py | 40 | ||||
-rwxr-xr-x | testcases/features/sfc/set-up-tacker.sh | 6 | ||||
-rwxr-xr-x | testcases/features/sfc/sfc.py | 3 | ||||
-rw-r--r-- | testcases/security_scan/scripts/internet_check.py | 25 | ||||
-rwxr-xr-x | testcases/security_scan/security_scan.py | 52 |
16 files changed, 156 insertions, 55 deletions
diff --git a/ci/config_functest.yaml b/ci/config_functest.yaml index 8e45b1d2..afa6ff1f 100644 --- a/ci/config_functest.yaml +++ b/ci/config_functest.yaml @@ -50,6 +50,7 @@ general: healthcheck: disk_image: /home/opnfv/functest/data/cirros-0.3.4-x86_64-disk.img + disk_format: qcow2 vping: ping_timeout: 200 diff --git a/ci/config_patch.yaml b/ci/config_patch.yaml index 467a83ca..4994d49d 100644 --- a/ci/config_patch.yaml +++ b/ci/config_patch.yaml @@ -7,3 +7,4 @@ lxd: healthcheck: disk_image: /home/opnfv/functest/data/cirros-0.3.4-x86_64-lxc.tar.gz + disk_format: raw
\ No newline at end of file diff --git a/ci/exec_test.sh b/ci/exec_test.sh index 9951c097..db9c7a07 100755 --- a/ci/exec_test.sh +++ b/ci/exec_test.sh @@ -140,19 +140,18 @@ function run_test(){ "security_scan") echo "Sourcing Credentials ${FUNCTEST_CONF_DIR}/stackrc for undercloud .." source ${FUNCTEST_CONF_DIR}/stackrc - python ${FUNCTEST_REPO_DIR}/testcases/security_scan/security_scan.py --config ${FUNCTEST_REPO_DIR}/testcases/security_scan/config.ini + python ${repos_dir}/securityscanning/security_scan.py --config ${repos_dir}/securityscanning/config.ini ;; "copper") python ${FUNCTEST_REPO_DIR}/testcases/features/copper.py ;; "moon") - # TODO put the link to Moon script to be run (if test runnable) here - ${repos_dir}/moon/tests/run_tests.sh + python ${repos_dir}/moon/tests/run_tests.py ;; "multisite") python ${FUNCTEST_REPO_DIR}/testcases/OpenStack/tempest/gen_tempest_conf.py python ${FUNCTEST_REPO_DIR}/testcases/OpenStack/tempest/run_tempest.py \ - $clean_flag -s -m feature_multisite $report + $clean_flag -s -m feature_multisite $report \ -c ${FUNCTEST_REPO_DIR}/testcases/OpenStack/tempest/tempest_multisite.conf ;; "domino") diff --git a/ci/testcases.yaml b/ci/testcases.yaml index 47d544b9..ca0273c2 100644 --- a/ci/testcases.yaml +++ b/ci/testcases.yaml @@ -47,7 +47,7 @@ tiers: 2) Connectivity between 2 instances over a private network. dependencies: installer: '' - scenario: '' + scenario: '^((?!lxd).)*$' - name: tempest_smoke_serial @@ -207,7 +207,15 @@ tiers: dependencies: installer: '' scenario: 'onos-sfc' - + - + name: parser + criteria: 'ret == 0' + blocking: false + description: >- + Test suite from Parser project. + dependencies: + installer: 'fuel' + scenario: '' - name: openstack order: 4 @@ -255,12 +263,3 @@ tiers: dependencies: installer: '' scenario: '(ocl)|(nosdn)|^(os-odl)((?!bgpvpn).)*$' - - - name: parser - criteria: 'ret == 0' - blocking: false - description: >- - Test suite from Parser project. - dependencies: - installer: 'fuel' - scenario: '' diff --git a/cli/commands/cli_os.py b/cli/commands/cli_os.py index b007842b..722c700c 100644 --- a/cli/commands/cli_os.py +++ b/cli/commands/cli_os.py @@ -106,7 +106,8 @@ class CliOpenStack: def snapshot_show(self): if not os.path.isfile(OS_SNAPSHOT_FILE): click.echo("There is no OpenStack snapshot created. To create " - "one run the command 'functest env os-create-snapshot'") + "one run the command " + "'functest openstack snapshot-create'") return with open(OS_SNAPSHOT_FILE, 'r') as yaml_file: click.echo("\n%s" @@ -117,6 +118,7 @@ class CliOpenStack: if not os.path.isfile(OS_SNAPSHOT_FILE): click.echo("Not possible to clean OpenStack without a snapshot. " "This could cause problems. " - "Run first the command 'os-create-shapshot'.") + "Run first the command " + "'functest openstack snapshot-create'") return os_clean.main() diff --git a/docker/Dockerfile b/docker/Dockerfile index 57c10f3b..23221f23 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -64,6 +64,7 @@ RUN pip install --upgrade pip RUN mkdir -p ${repos_dir} RUN mkdir -p /home/opnfv/functest/results +RUN mkdir -p /home/opnfv/functest/conf RUN mkdir -p /root/.ssh RUN chmod 700 /root/.ssh @@ -85,6 +86,7 @@ RUN git clone https://gerrit.opnfv.org/gerrit/sdnvpn ${repos_dir}/sdnvpn RUN git clone https://github.com/openstack/kingbird.git ${repos_dir}/kingbird RUN git clone https://gerrit.opnfv.org/gerrit/domino ${repos_dir}/domino RUN git clone https://gerrit.opnfv.org/gerrit/parser ${repos_dir}/parser +RUN git clone https://gerrit.opnfv.org/gerrit/securityscanning ${repos_dir}/securityscanning RUN pip install -r ${repos_dir}/functest/docker/requirements.pip RUN pip install -r ${repos_dir}/rally/requirements.txt diff --git a/testcases/Controllers/ONOS/Sfc/Sfc_fun.py b/testcases/Controllers/ONOS/Sfc/Sfc_fun.py index b94eedca..0d9eaf80 100644 --- a/testcases/Controllers/ONOS/Sfc/Sfc_fun.py +++ b/testcases/Controllers/ONOS/Sfc/Sfc_fun.py @@ -227,6 +227,22 @@ class Sfc_fun: else: return(response.status_code) + url = 'http://' + self.nova_hostname + \ + ':8774/v2.1/' + self.tenant_id + '/flavors?name=m1.tiny' + headers = {"Accept": "application/json", "Content-Type": + "application/json", "X-Auth-Token": self.token_id} + response = requests.get(url, headers=headers) + + if (response.status_code == 200): + self.logger.debug(response.status_code) + self.logger.debug(response.content) + self.logger.info("\tFlavor is available") + json1_data = json.loads(response.content) + self.logger.debug(json1_data) + self.flavorRef = json1_data['flavors'][0]['id'] + else: + return(response.status_code) + for y in range(0, 3): Dicdata = {} org_nw_port = [] diff --git a/testcases/OpenStack/healthcheck/healthcheck.sh b/testcases/OpenStack/healthcheck/healthcheck.sh index 2449ac93..996aadcf 100755 --- a/testcases/OpenStack/healthcheck/healthcheck.sh +++ b/testcases/OpenStack/healthcheck/healthcheck.sh @@ -120,6 +120,7 @@ info "...Keystone OK!" info "Testing Glance API..." ################################# disk_img=$(cat ${YAML_FILE} | shyaml get-value healthcheck.disk_image 2> /dev/null || true) +disk_format=$(cat ${YAML_FILE} | shyaml get-value healthcheck.disk_format 2> /dev/null || true) kernel_img=$(cat ${YAML_FILE} | shyaml get-value healthcheck.kernel_image 2> /dev/null || true) ramdisk_img=$(cat ${YAML_FILE} | shyaml get-value healthcheck.ramdisk_image 2> /dev/null || true) extra_properties=$(cat ${YAML_FILE} | shyaml get-value healthcheck.extra_properties 2> /dev/null || true) @@ -151,10 +152,10 @@ fi debug "image extra_properties=${extra_properties}" -eval glance image-create --name ${image_1} --disk-format qcow2 --container-format bare \ +eval glance image-create --name ${image_1} --disk-format ${disk_format} --container-format bare \ ${extra_opts} < ${disk_img} debug "image '${image_1}' created." -eval glance image-create --name ${image_2} --disk-format qcow2 --container-format bare \ +eval glance image-create --name ${image_2} --disk-format ${disk_format} --container-format bare \ ${extra_opts} < ${disk_img} debug "image '${image_2}' created." info "... Glance OK!" diff --git a/testcases/OpenStack/tempest/custom_tests/blacklist.txt b/testcases/OpenStack/tempest/custom_tests/blacklist.txt index 5dd8fe2e..ddd41e68 100644 --- a/testcases/OpenStack/tempest/custom_tests/blacklist.txt +++ b/testcases/OpenStack/tempest/custom_tests/blacklist.txt @@ -31,3 +31,20 @@ - joid tests: - tempest.api.object_storage + + scenarios: + - os-onos-nofeature-ha + - os-onos-nofeature-noha + - os-onos-sfc-ha + - os-onos-sfc-noha + installers: + - fuel + - apex + - joid + - compass + tests: + - tempest.api.compute.servers.test_server_actions.ServerActionsTestJSON.test_reboot_server_hard + - tempest.scenario.test_network_basic_ops.TestNetworkBasicOps.test_network_basic_ops + - tempest.scenario.test_server_basic_ops.TestServerBasicOps.test_server_basic_ops + - tempest.scenario.test_volume_boot_pattern.TestVolumeBootPattern.test_volume_boot_pattern + - tempest.scenario.test_volume_boot_pattern.TestVolumeBootPatternV2.test_volume_boot_pattern diff --git a/testcases/OpenStack/tempest/gen_tempest_conf.py b/testcases/OpenStack/tempest/gen_tempest_conf.py index 79236b95..4aa814a5 100755 --- a/testcases/OpenStack/tempest/gen_tempest_conf.py +++ b/testcases/OpenStack/tempest/gen_tempest_conf.py @@ -17,6 +17,7 @@ import shutil import functest.utils.functest_utils as ft_utils import functest.utils.functest_logger as ft_logger from run_tempest import configure_tempest +from run_tempest import TEMPEST_RESULTS_DIR logger = ft_logger.Logger("multisite").getLogger() @@ -112,6 +113,9 @@ def configure_tempest_multisite(deployment_dir): def main(): + if not os.path.exists(TEMPEST_RESULTS_DIR): + os.makedirs(TEMPEST_RESULTS_DIR) + deployment_dir = ft_utils.get_deployment_dir(logger) configure_tempest_multisite(deployment_dir) diff --git a/testcases/OpenStack/tempest/run_tempest.py b/testcases/OpenStack/tempest/run_tempest.py index 3a8d8d72..c143fffa 100755 --- a/testcases/OpenStack/tempest/run_tempest.py +++ b/testcases/OpenStack/tempest/run_tempest.py @@ -365,6 +365,8 @@ def run_tempest(OPTION): if 'smoke' in args.mode: case_name = 'tempest_smoke_serial' + elif 'feature' in args.mode: + case_name = args.mode.replace("feature_", "") else: case_name = 'tempest_full_parallel' @@ -422,7 +424,8 @@ def main(): deployment_dir = ft_utils.get_deployment_dir(logger) - if "" != args.conf: + if "" == args.conf: + MODE = "" configure_tempest(deployment_dir) else: MODE = " --tempest-config " + args.conf diff --git a/testcases/features/copper.py b/testcases/features/copper.py index 9efcbd7f..78c0fb4d 100755 --- a/testcases/features/copper.py +++ b/testcases/features/copper.py @@ -60,23 +60,29 @@ def main(): version = functest_utils.get_version(logger)
build_tag = functest_utils.get_build_tag(logger)
- logger.info("Pushing COPPER results: TEST_DB_URL=%(db)s pod_name=%(pod)s "
- "version=%(v)s scenario=%(s)s criteria=%(c)s details=%(d)s" % {
- 'db': TEST_DB_URL,
- 'pod': pod_name,
- 'v': version,
- 's': scenario,
- 'c': details['status'],
- 'b': build_tag,
- 'd': details,
- })
- functest_utils.push_results_to_db("COPPER",
- "COPPER-notification",
- logger,
- start_time,
- stop_time,
- details['status'],
- details)
+ try:
+ logger.info("Pushing COPPER results: TEST_DB_URL=%(db)s "
+ "pod_name=%(pod)s version=%(v)s scenario=%(s)s "
+ "criteria=%(c)s details=%(d)s" % {
+ 'db': TEST_DB_URL,
+ 'pod': pod_name,
+ 'v': version,
+ 's': scenario,
+ 'c': details['status'],
+ 'b': build_tag,
+ 'd': details,
+ })
+ functest_utils.push_results_to_db("copper",
+ "copper-notification",
+ logger,
+ start_time,
+ stop_time,
+ details['status'],
+ details)
+ except:
+ logger.error("Error pushing results into Database '%s'"
+ % sys.exc_info()[0])
+
if ret_val != 0:
sys.exit(-1)
diff --git a/testcases/features/sfc/set-up-tacker.sh b/testcases/features/sfc/set-up-tacker.sh index 577b7d94..da2cb922 100755 --- a/testcases/features/sfc/set-up-tacker.sh +++ b/testcases/features/sfc/set-up-tacker.sh @@ -1,8 +1,8 @@ -curl "https://gerrit.opnfv.org/gerrit/gitweb?p=fuel.git;a=blob_plain;f=prototypes/sfc_tacker/poc.tacker-up.sh;hb=ddd4e11bb8bc62b7e8b06d4b44a308293c2c3362" > poc.tacker-up.sh +git_commit=ee3046f24df0bfca7ee15501f6c06ad86dd462c2 +curl "https://gerrit.opnfv.org/gerrit/gitweb?p=fuel.git;a=blob_plain;\ +f=prototypes/sfc_tacker/poc.tacker-up.sh;hb=${git_commit}" > poc.tacker-up.sh bash poc.tacker-up.sh -touch delete.sh - cat <<EOF > delete.sh tacker sfc-classifier-delete red_http tacker sfc-classifier-delete blue_ssh diff --git a/testcases/features/sfc/sfc.py b/testcases/features/sfc/sfc.py index 17ab386f..bdd27905 100755 --- a/testcases/features/sfc/sfc.py +++ b/testcases/features/sfc/sfc.py @@ -349,6 +349,9 @@ def main(): TACKER_CHANGECLASSI subprocess.call(tacker_classi, shell=True) + logger.info("Wait for ODL to update the classification rules in OVS") + time.sleep(10) + # SSH to modify the classification flows in compute contr_cmd4 = ("sshpass -p r00tme ssh " + ssh_options + " root@10.20.0.2" diff --git a/testcases/security_scan/scripts/internet_check.py b/testcases/security_scan/scripts/internet_check.py new file mode 100644 index 00000000..1bed50a7 --- /dev/null +++ b/testcases/security_scan/scripts/internet_check.py @@ -0,0 +1,25 @@ +#!/usr/bin/python +# +# Copyright (c) 2016 Red Hat +# Luke Hinds (lhinds@redhat.com) +# 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 +# +# Performs simple connection check, falls to default timeout of 10 seconds + +import socket + +TEST_HOST = "google.com" + + +def is_connected(): + try: + host = socket.gethostbyname(TEST_HOST) + socket.create_connection((host, 80), 2) + return True + except: + return False +print is_connected() diff --git a/testcases/security_scan/security_scan.py b/testcases/security_scan/security_scan.py index d39c2905..36b79543 100755 --- a/testcases/security_scan/security_scan.py +++ b/testcases/security_scan/security_scan.py @@ -73,21 +73,27 @@ def run_tests(host, nodetype): port = cfgparse.get(nodetype, 'port') connect.logger.info("Host: {0} Selected Profile: {1}".format(host, nodetype)) - connect.logger.info("Creating temp file structure..") - createfiles(host, port, user, localkey) - connect.logger.info("Installing OpenSCAP...") - install_pkg(host, port, user, localkey) - connect.logger.info("Running scan...") - run_scanner(host, port, user, localkey, nodetype) - clean = cfgparse.get(nodetype, 'clean') - connect.logger.info("Post installation tasks....") - post_tasks(host, port, user, localkey, nodetype) - if clean: - connect.logger.info("Cleaning down environment....") - connect.logger.info("Removing OpenSCAP....") - removepkg(host, port, user, localkey, nodetype) - connect.logger.info("Deleting tmp file and reports (remote)...") - cleandir(host, port, user, localkey, nodetype) + connect.logger.info("Checking internet for package installation...") + if internet_check(host, nodetype): + connect.logger.info("Internet Connection OK.") + connect.logger.info("Creating temp file structure..") + createfiles(host, port, user, localkey) + connect.logger.info("Installing OpenSCAP...") + install_pkg(host, port, user, localkey) + connect.logger.info("Running scan...") + run_scanner(host, port, user, localkey, nodetype) + clean = cfgparse.get(nodetype, 'clean') + connect.logger.info("Post installation tasks....") + post_tasks(host, port, user, localkey, nodetype) + if clean: + connect.logger.info("Cleaning down environment....") + connect.logger.info("Removing OpenSCAP....") + removepkg(host, port, user, localkey, nodetype) + connect.logger.info("Deleting tmp file and reports (remote)...") + cleandir(host, port, user, localkey, nodetype) + else: + connect.logger.error("Internet timeout. Moving on to next node..") + pass def nova_iterate(): @@ -106,6 +112,22 @@ def nova_iterate(): run_tests(host, nodetype) +def internet_check(host, nodetype): + import connect + user = cfgparse.get(nodetype, 'user') + port = cfgparse.get(nodetype, 'port') + localpath = functest_dir + 'scripts/internet_check.py' + remotepath = '/tmp/internet_check.py' + com = 'python /tmp/internet_check.py' + testconnect = connect.ConnectionManager(host, port, user, localkey, + localpath, remotepath, com) + connectionresult = testconnect.remotescript() + if connectionresult.rstrip() == 'True': + return True + else: + return False + + def createfiles(host, port, user, localkey): import connect global tmpdir |