aboutsummaryrefslogtreecommitdiffstats
path: root/testcases/VIM/OpenStack
diff options
context:
space:
mode:
Diffstat (limited to 'testcases/VIM/OpenStack')
-rwxr-xr-xtestcases/VIM/OpenStack/CI/libraries/run_rally-cert.py66
-rwxr-xr-xtestcases/VIM/OpenStack/CI/libraries/run_rally.py6
-rw-r--r--testcases/VIM/OpenStack/CI/libraries/run_tempest.py20
3 files changed, 66 insertions, 26 deletions
diff --git a/testcases/VIM/OpenStack/CI/libraries/run_rally-cert.py b/testcases/VIM/OpenStack/CI/libraries/run_rally-cert.py
index ade4385b..0d199260 100755
--- a/testcases/VIM/OpenStack/CI/libraries/run_rally-cert.py
+++ b/testcases/VIM/OpenStack/CI/libraries/run_rally-cert.py
@@ -54,6 +54,9 @@ parser.add_argument("-s", "--smoke",
parser.add_argument("-v", "--verbose",
help="Print verbose info about the progress",
action="store_true")
+parser.add_argument("-n", "--noclean",
+ help="Don't clean the created resources for this test.",
+ action="store_true")
args = parser.parse_args()
@@ -208,15 +211,13 @@ def get_output(proc, test_name):
nb_tests = 0
overall_duration = 0.0
success = 0.0
+ nb_totals = 0
- if args.verbose:
- while proc.poll() is None:
- line = proc.stdout.readline()
- print line.replace('\n', '')
+ while proc.poll() is None:
+ line = proc.stdout.readline()
+ if args.verbose:
result += line
- else:
- while proc.poll() is None:
- line = proc.stdout.readline()
+ else:
if "Load duration" in line or \
"started" in line or \
"finished" in line or \
@@ -224,28 +225,41 @@ def get_output(proc, test_name):
"+-" in line or \
"|" in line:
result += line
- if "| " in line and \
- "| action" not in line and \
- "| " not in line and \
- "| total" not in line:
- nb_tests += 1
- percentage = ((line.split('|')[8]).strip(' ')).strip('%')
- success += float(percentage)
-
elif "test scenario" in line:
result += "\n" + line
elif "Full duration" in line:
result += line + "\n\n"
- overall_duration += float(line.split(': ')[1])
- logger.info("\n" + result)
- overall_duration = "{:10.2f}".format(overall_duration)
- success_avg = success / nb_tests
+
+ # parse output for summary report
+ if "| " in line and \
+ "| action" not in line and \
+ "| Starting" not in line and \
+ "| Completed" not in line and \
+ "| ITER" not in line and \
+ "| " not in line and \
+ "| total" not in line:
+ nb_tests += 1
+ elif "| total" in line:
+ percentage = ((line.split('|')[8]).strip(' ')).strip('%')
+ success += float(percentage)
+ nb_totals += 1
+ elif "Full duration" in line:
+ overall_duration += float(line.split(': ')[1])
+
+ overall_duration="{:10.2f}".format(overall_duration)
+ if nb_totals == 0:
+ success_avg = 0
+ else:
+ success_avg = "{:0.2f}".format(success / nb_totals)
+
scenario_summary = {'test_name': test_name,
'overall_duration': overall_duration,
'nb_tests': nb_tests,
'success': success_avg}
-
SUMMARY.append(scenario_summary)
+
+ logger.info("\n" + result)
+
return result
@@ -255,6 +269,7 @@ def run_task(test_name):
# :param test_name: name for the rally test
# :return: void
#
+ global SUMMARY
logger.info('Starting test scenario "{}" ...'.format(test_name))
task_file = '{}task.yaml'.format(SCENARIOS_DIR)
@@ -282,12 +297,12 @@ def run_task(test_name):
logger.debug('task_id : {}'.format(task_id))
if task_id is None:
- logger.error("failed to retrieve task_id")
+ logger.error("Failed to retrieve task_id.")
exit(-1)
# check for result directory and create it otherwise
if not os.path.exists(RESULTS_DIR):
- logger.debug('does not exists, we create it'.format(RESULTS_DIR))
+ logger.debug('%s does not exist, we create it.'.format(RESULTS_DIR))
os.makedirs(RESULTS_DIR)
# write html report file
@@ -388,7 +403,7 @@ def main():
test_name == 'vm'):
run_task(test_name)
else:
- print(args.test_name)
+ logger.debug("Test name: " + args.test_name)
run_task(args.test_name)
report = "\n"\
@@ -424,7 +439,7 @@ def main():
total_duration_str = time.strftime("%H:%M:%S", time.gmtime(total_duration))
total_duration_str2 = "{0:<10}".format(total_duration_str)
total_nb_tests_str = "{0:<13}".format(total_nb_tests)
- total_success = total_success / len(SUMMARY)
+ total_success = "{:0.2f}".format(total_success / len(SUMMARY))
total_success_str = "{0:<10}".format(str(total_success)+'%')
report += "+===================+============+===============+===========+\n"
report += "| TOTAL: | " + total_duration_str2 + " | " + \
@@ -445,6 +460,9 @@ def main():
logger.debug("Pushing Rally summary into DB...")
push_results_to_db("Rally", payload)
+ if args.noclean:
+ exit(0)
+
logger.debug("Deleting image '%s' with ID '%s'..." \
% (GLANCE_IMAGE_NAME, image_id))
if not functest_utils.delete_glance_image(nova_client, image_id):
diff --git a/testcases/VIM/OpenStack/CI/libraries/run_rally.py b/testcases/VIM/OpenStack/CI/libraries/run_rally.py
index 18f60acc..6b1aae2e 100755
--- a/testcases/VIM/OpenStack/CI/libraries/run_rally.py
+++ b/testcases/VIM/OpenStack/CI/libraries/run_rally.py
@@ -47,6 +47,9 @@ parser.add_argument("-r", "--report",
parser.add_argument("-v", "--verbose",
help="Print verbose info about the progress",
action="store_true")
+parser.add_argument("-n", "--noclean",
+ help="Don't clean the created resources for this test.",
+ action="store_true")
args = parser.parse_args()
@@ -271,6 +274,9 @@ def main():
print(args.test_name)
run_task(args.test_name)
+ if args.noclean:
+ exit(0)
+
logger.debug("Deleting image '%s' with ID '%s'..." \
% (GLANCE_IMAGE_NAME, image_id))
if not functest_utils.delete_glance_image(nova_client, image_id):
diff --git a/testcases/VIM/OpenStack/CI/libraries/run_tempest.py b/testcases/VIM/OpenStack/CI/libraries/run_tempest.py
index b8ed2716..29466918 100644
--- a/testcases/VIM/OpenStack/CI/libraries/run_tempest.py
+++ b/testcases/VIM/OpenStack/CI/libraries/run_tempest.py
@@ -33,12 +33,21 @@ modes = ['full', 'smoke', 'baremetal', 'compute', 'data_processing',
""" tests configuration """
parser = argparse.ArgumentParser()
-parser.add_argument("-d", "--debug", help="Debug mode", action="store_true")
-parser.add_argument("-m", "--mode", help="Tempest test mode [smoke, all]",
+parser.add_argument("-d", "--debug",
+ help="Debug mode",
+ action="store_true")
+parser.add_argument("-s", "--serial",
+ help="Run tests in one thread",
+ action="store_true")
+parser.add_argument("-m", "--mode",
+ help="Tempest test mode [smoke, all]",
default="smoke")
parser.add_argument("-r", "--report",
help="Create json result file",
action="store_true")
+parser.add_argument("-n", "--noclean",
+ help="Don't clean the created resources for this test.",
+ action="store_true")
args = parser.parse_args()
@@ -289,12 +298,19 @@ def main():
else:
MODE = "--set "+args.mode
+ if args.serial:
+ MODE = "--concur 1 "+MODE
+
if not os.path.exists(TEMPEST_RESULTS_DIR):
os.makedirs(TEMPEST_RESULTS_DIR)
create_tempest_resources()
configure_tempest()
run_tempest(MODE)
+
+ if args.noclean:
+ exit(0)
+
free_tempest_resources()
="m">2>/dev/null $ssh_options root@${installer_ip} \ "scp $ssh_options ${controller_ip}:/root/openrc ." &> /dev/null sshpass -p r00tme scp 2>/dev/null $ssh_options root@${installer_ip}:~/openrc $dest_path &> /dev/null #This file contains the mgmt keystone API, we need the public one for our rc file admin_ip=$(cat $dest_path | grep "OS_AUTH_URL" | sed 's/^.*\=//' | sed "s/^\([\"']\)\(.*\)\1\$/\2/g" | sed s'/\/$//') public_ip=$(sshpass -p r00tme ssh $ssh_options root@${installer_ip} \ "ssh ${controller_ip} 'source openrc; openstack endpoint list --long'" \ | grep $admin_ip | sed 's/ /\n/g' | grep ^http | head -1) &> /dev/null #| grep http | head -1 | cut -d '|' -f 4 | sed 's/v1\/.*/v1\//' | sed 's/ //g') &> /dev/null #NOTE: this is super ugly sed 's/v1\/.*/v1\//'OS_AUTH_URL # but sometimes the output of endpoint-list is like this: http://172.30.9.70:8004/v1/%(tenant_id)s # Fuel virtual need a fix if [ "$DEPLOY_TYPE" == "virt" ]; then echo "INFO: Changing: internalURL -> publicURL in openrc" sed -i 's/internalURL/publicURL/' $dest_path fi elif [ "$installer_type" == "apex" ]; then verify_connectivity $installer_ip # The credentials file is located in the Instack VM (192.0.2.1) # NOTE: This might change for bare metal deployments info "Fetching rc file from Instack VM $installer_ip..." if [ -f /root/.ssh/id_rsa ]; then chmod 600 /root/.ssh/id_rsa fi sudo scp $ssh_options root@$installer_ip:/home/stack/overcloudrc $dest_path elif [ "$installer_type" == "compass" ]; then verify_connectivity $installer_ip controller_ip=$(sshpass -p'root' ssh 2>/dev/null $ssh_options root@${installer_ip} \ 'mysql -ucompass -pcompass -Dcompass -e"select * from cluster;"' \ | awk -F"," '{for(i=1;i<NF;i++)if($i~/\"host[1-5]\"/) {print $(i+1);break;}}' \ | grep -oP "\d+.\d+.\d+.\d+") if [ -z $controller_ip ]; then error "The controller $controller_ip is not up. Please check that the POD is correctly deployed." fi info "Fetching rc file from controller $controller_ip..." sshpass -p root ssh 2>/dev/null $ssh_options root@${installer_ip} \ "scp $ssh_options ${controller_ip}:/opt/admin-openrc.sh ." &> /dev/null sshpass -p root scp 2>/dev/null $ssh_options root@${installer_ip}:~/admin-openrc.sh $dest_path &> /dev/null echo 'export OS_REGION_NAME=regionOne' >> $dest_path info "This file contains the mgmt keystone API, we need the public one for our rc file" admin_ip=$(cat $dest_path | grep "OS_AUTH_URL" | sed 's/^.*\=//' | sed "s/^\([\"']\)\(.*\)\1\$/\2/g" | sed s'/\/$//') info "admin_ip: $admin_ip" public_ip=$(sshpass -p root ssh $ssh_options root@${installer_ip} \ "ssh ${controller_ip} 'source /opt/admin-openrc.sh; keystone endpoint-list'" \ | grep $admin_ip | sed 's/ /\n/g' | grep ^http | head -1) info "public_ip: $public_ip" elif [ "$installer_type" == "joid" ]; then # do nothing...for the moment # we can either do a scp from the jumphost or use the -v option to transmit the param to the docker file echo "Do nothing, creds will be provided through volume option at docker creation for joid" elif [ "$installer_type" == "foreman" ]; then #ip_foreman="172.30.10.73" controller="oscontroller1.opnfv.com" verify_connectivity $installer_ip # Check if controller is alive (here is more difficult to get the ip from a command like "fuel node") sshpass -p vagrant ssh $ssh_options root@${installer_ip} \ "sshpass -p Op3nStack ssh $ssh_options root@${controller} 'ls'" &> /dev/null if [ $? -ne 0 ]; then error "The controller ${controller} is not up. Please check that the POD is correctly deployed." fi info "Fetching openrc from a Foreman Controller '${controller}'..." sshpass -p vagrant ssh $ssh_options root@${installer_ip} \ "sshpass -p Op3nStack scp $ssh_options root@${controller}:~/keystonerc_admin ." &> /dev/null sshpass -p vagrant scp $ssh_options root@${installer_ip}:~/keystonerc_admin $dest_path &> /dev/null #This file contains the mgmt keystone API, we need the public one for our rc file admin_ip=$(cat $dest_path | grep "OS_AUTH_URL" | sed 's/^.*\=//' | sed "s/^\([\"']\)\(.*\)\1\$/\2/g" | sed s'/\/$//') public_ip=$(sshpass -p vagrant ssh $ssh_options root@${installer_ip} \ "sshpass -p Op3nStack ssh $ssh_options root@${controller} \ 'source keystonerc_admin;keystone endpoint-list'" \ | grep $admin_ip | sed 's/ /\n/g' | grep ^http | head -1) &> /dev/null else error "Installer $installer is not supported by this script" fi if [ ! -f $dest_path ]; then error "There has been an error retrieving the credentials" fi if [ "$public_ip" != "" ]; then info "Exchanging keystone public IP in rc file to $public_ip" sed -i "/OS_AUTH_URL/c\export OS_AUTH_URL=\'$public_ip'" $dest_path fi echo "-------- Credentials: --------" cat $dest_path exit 0