diff options
Diffstat (limited to 'testcases')
-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 |
10 files changed, 135 insertions, 38 deletions
diff --git a/testcases/Controllers/ONOS/Sfc/Sfc_fun.py b/testcases/Controllers/ONOS/Sfc/Sfc_fun.py index b94eedcaf..0d9eaf80d 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 2449ac93b..996aadcf7 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 5dd8fe2e1..ddd41e688 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 79236b958..4aa814a51 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 3a8d8d72a..c143fffae 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 9efcbd7f4..78c0fb4d2 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 577b7d94e..da2cb922e 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 17ab386f6..bdd279051 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 000000000..1bed50a70 --- /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 d39c29052..36b795431 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 |