From 165ff17205d99b18df36e5ac6f34ede858e3da17 Mon Sep 17 00:00:00 2001 From: Morgan Richomme Date: Thu, 24 Nov 2016 18:25:52 +0100 Subject: file/dir renaming for consistency JIRA: FUNCTEST-579 Change-Id: Iaa545db70bfb76770df0a3d17871e29ce518ff2d Signed-off-by: Morgan Richomme --- functest/opnfv_tests/openstack/__init__.py | 0 .../openstack/examples/create_instance_and_ip.py | 126 +++++ .../openstack/healthcheck/healthcheck.sh | 262 +++++++++ functest/opnfv_tests/openstack/rally/blacklist.txt | 18 + .../opnfv_tests/openstack/rally/macro/macro.yaml | 97 ++++ .../opnfv_tests/openstack/rally/run_rally-cert.py | 619 +++++++++++++++++++++ .../rally/scenario/full/opnfv-cinder.yaml | 266 +++++++++ .../openstack/rally/scenario/full/opnfv-heat.yaml | 140 +++++ .../rally/scenario/full/opnfv-neutron.yaml | 239 ++++++++ .../openstack/rally/scenario/full/opnfv-nova.yaml | 369 ++++++++++++ .../rally/scenario/opnfv-authenticate.yaml | 63 +++ .../openstack/rally/scenario/opnfv-glance.yaml | 49 ++ .../openstack/rally/scenario/opnfv-keystone.yaml | 92 +++ .../openstack/rally/scenario/opnfv-quotas.yaml | 54 ++ .../openstack/rally/scenario/opnfv-requests.yaml | 11 + .../openstack/rally/scenario/opnfv-vm.yaml | 42 ++ .../rally/scenario/sanity/opnfv-cinder.yaml | 84 +++ .../rally/scenario/sanity/opnfv-heat.yaml | 42 ++ .../rally/scenario/sanity/opnfv-neutron.yaml | 152 +++++ .../rally/scenario/sanity/opnfv-nova.yaml | 140 +++++ .../rally/scenario/support/instance_dd_test.sh | 13 + .../templates/autoscaling_policy.yaml.template | 17 + .../rally/scenario/templates/default.yaml.template | 1 + .../templates/random_strings.yaml.template | 13 + .../templates/resource_group.yaml.template | 13 + .../templates/server_with_ports.yaml.template | 64 +++ .../templates/server_with_volume.yaml.template | 43 ++ ...pdated_autoscaling_policy_inplace.yaml.template | 23 + .../updated_random_strings_add.yaml.template | 19 + .../updated_random_strings_delete.yaml.template | 11 + .../updated_random_strings_replace.yaml.template | 19 + .../updated_resource_group_increase.yaml.template | 16 + .../updated_resource_group_reduce.yaml.template | 16 + functest/opnfv_tests/openstack/rally/task.yaml | 48 ++ .../openstack/tempest/custom_tests/blacklist.txt | 96 ++++ .../openstack/tempest/custom_tests/defcore_req.txt | 122 ++++ .../openstack/tempest/gen_tempest_conf.py | 128 +++++ .../opnfv_tests/openstack/tempest/run_tempest.py | 450 +++++++++++++++ functest/opnfv_tests/openstack/vping/__init__.py | 0 functest/opnfv_tests/openstack/vping/ping.sh | 13 + functest/opnfv_tests/openstack/vping/vping_base.py | 297 ++++++++++ functest/opnfv_tests/openstack/vping/vping_ssh.py | 175 ++++++ .../opnfv_tests/openstack/vping/vping_userdata.py | 82 +++ 43 files changed, 4544 insertions(+) create mode 100644 functest/opnfv_tests/openstack/__init__.py create mode 100755 functest/opnfv_tests/openstack/examples/create_instance_and_ip.py create mode 100755 functest/opnfv_tests/openstack/healthcheck/healthcheck.sh create mode 100644 functest/opnfv_tests/openstack/rally/blacklist.txt create mode 100644 functest/opnfv_tests/openstack/rally/macro/macro.yaml create mode 100755 functest/opnfv_tests/openstack/rally/run_rally-cert.py create mode 100644 functest/opnfv_tests/openstack/rally/scenario/full/opnfv-cinder.yaml create mode 100644 functest/opnfv_tests/openstack/rally/scenario/full/opnfv-heat.yaml create mode 100644 functest/opnfv_tests/openstack/rally/scenario/full/opnfv-neutron.yaml create mode 100644 functest/opnfv_tests/openstack/rally/scenario/full/opnfv-nova.yaml create mode 100644 functest/opnfv_tests/openstack/rally/scenario/opnfv-authenticate.yaml create mode 100644 functest/opnfv_tests/openstack/rally/scenario/opnfv-glance.yaml create mode 100644 functest/opnfv_tests/openstack/rally/scenario/opnfv-keystone.yaml create mode 100644 functest/opnfv_tests/openstack/rally/scenario/opnfv-quotas.yaml create mode 100644 functest/opnfv_tests/openstack/rally/scenario/opnfv-requests.yaml create mode 100644 functest/opnfv_tests/openstack/rally/scenario/opnfv-vm.yaml create mode 100644 functest/opnfv_tests/openstack/rally/scenario/sanity/opnfv-cinder.yaml create mode 100644 functest/opnfv_tests/openstack/rally/scenario/sanity/opnfv-heat.yaml create mode 100644 functest/opnfv_tests/openstack/rally/scenario/sanity/opnfv-neutron.yaml create mode 100644 functest/opnfv_tests/openstack/rally/scenario/sanity/opnfv-nova.yaml create mode 100755 functest/opnfv_tests/openstack/rally/scenario/support/instance_dd_test.sh create mode 100644 functest/opnfv_tests/openstack/rally/scenario/templates/autoscaling_policy.yaml.template create mode 100644 functest/opnfv_tests/openstack/rally/scenario/templates/default.yaml.template create mode 100644 functest/opnfv_tests/openstack/rally/scenario/templates/random_strings.yaml.template create mode 100644 functest/opnfv_tests/openstack/rally/scenario/templates/resource_group.yaml.template create mode 100644 functest/opnfv_tests/openstack/rally/scenario/templates/server_with_ports.yaml.template create mode 100644 functest/opnfv_tests/openstack/rally/scenario/templates/server_with_volume.yaml.template create mode 100644 functest/opnfv_tests/openstack/rally/scenario/templates/updated_autoscaling_policy_inplace.yaml.template create mode 100644 functest/opnfv_tests/openstack/rally/scenario/templates/updated_random_strings_add.yaml.template create mode 100644 functest/opnfv_tests/openstack/rally/scenario/templates/updated_random_strings_delete.yaml.template create mode 100644 functest/opnfv_tests/openstack/rally/scenario/templates/updated_random_strings_replace.yaml.template create mode 100644 functest/opnfv_tests/openstack/rally/scenario/templates/updated_resource_group_increase.yaml.template create mode 100644 functest/opnfv_tests/openstack/rally/scenario/templates/updated_resource_group_reduce.yaml.template create mode 100644 functest/opnfv_tests/openstack/rally/task.yaml create mode 100644 functest/opnfv_tests/openstack/tempest/custom_tests/blacklist.txt create mode 100644 functest/opnfv_tests/openstack/tempest/custom_tests/defcore_req.txt create mode 100755 functest/opnfv_tests/openstack/tempest/gen_tempest_conf.py create mode 100755 functest/opnfv_tests/openstack/tempest/run_tempest.py create mode 100644 functest/opnfv_tests/openstack/vping/__init__.py create mode 100755 functest/opnfv_tests/openstack/vping/ping.sh create mode 100644 functest/opnfv_tests/openstack/vping/vping_base.py create mode 100644 functest/opnfv_tests/openstack/vping/vping_ssh.py create mode 100644 functest/opnfv_tests/openstack/vping/vping_userdata.py (limited to 'functest/opnfv_tests/openstack') diff --git a/functest/opnfv_tests/openstack/__init__.py b/functest/opnfv_tests/openstack/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/functest/opnfv_tests/openstack/examples/create_instance_and_ip.py b/functest/opnfv_tests/openstack/examples/create_instance_and_ip.py new file mode 100755 index 00000000..6a2abe60 --- /dev/null +++ b/functest/opnfv_tests/openstack/examples/create_instance_and_ip.py @@ -0,0 +1,126 @@ +#!/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 +# +# This script boots an instance and assigns a floating ip +# + +import argparse +import sys +import functest.utils.functest_logger as ft_logger +import functest.utils.openstack_utils as os_utils +import functest.utils.functest_constants as ft_constants + +parser = argparse.ArgumentParser() + +parser.add_argument("-r", "--report", + help="Create json result file", + action="store_true") + +args = parser.parse_args() + +""" logging configuration """ +logger = ft_logger.Logger("create_instance_and_ip").getLogger() + +HOME = ft_constants.HOME + "/" + +VM_BOOT_TIMEOUT = 180 + +EXAMPLE_INSTANCE_NAME = ft_constants.EXAMPLE_INSTANCE_NAME +EXAMPLE_FLAVOR = ft_constants.EXAMPLE_FLAVOR +EXAMPLE_IMAGE_NAME = ft_constants.EXAMPLE_IMAGE_NAME +IMAGE_FILENAME = ft_constants.GLANCE_IMAGE_FILENAME +IMAGE_FORMAT = ft_constants.GLANCE_IMAGE_FORMAT +IMAGE_PATH = ft_constants.FUNCTEST_DATA_DIR + \ + "/" + IMAGE_FILENAME + +# NEUTRON Private Network parameters + +EXAMPLE_PRIVATE_NET_NAME = ft_constants.EXAMPLE_PRIVATE_NET_NAME +EXAMPLE_PRIVATE_SUBNET_NAME = ft_constants.EXAMPLE_PRIVATE_SUBNET_NAME +EXAMPLE_PRIVATE_SUBNET_CIDR = ft_constants.EXAMPLE_PRIVATE_SUBNET_CIDR +EXAMPLE_ROUTER_NAME = ft_constants.EXAMPLE_ROUTER_NAME + +EXAMPLE_SECGROUP_NAME = ft_constants.EXAMPLE_SECGROUP_NAME +EXAMPLE_SECGROUP_DESCR = ft_constants.EXAMPLE_SECGROUP_DESCR + + +def main(): + + nova_client = os_utils.get_nova_client() + neutron_client = os_utils.get_neutron_client() + glance_client = os_utils.get_glance_client() + + image_id = os_utils.create_glance_image(glance_client, + EXAMPLE_IMAGE_NAME, + IMAGE_PATH, + disk=IMAGE_FORMAT, + container="bare", + public=True) + + network_dic = os_utils.create_network_full(neutron_client, + EXAMPLE_PRIVATE_NET_NAME, + EXAMPLE_PRIVATE_SUBNET_NAME, + EXAMPLE_ROUTER_NAME, + EXAMPLE_PRIVATE_SUBNET_CIDR) + if not network_dic: + logger.error( + "There has been a problem when creating the neutron network") + sys.exit(-1) + + network_id = network_dic["net_id"] + + sg_id = os_utils.create_security_group_full(neutron_client, + EXAMPLE_SECGROUP_NAME, + EXAMPLE_SECGROUP_DESCR) + + # boot INTANCE + logger.info("Creating instance '%s'..." % EXAMPLE_INSTANCE_NAME) + logger.debug( + "Configuration:\n name=%s \n flavor=%s \n image=%s \n " + "network=%s \n" + % (EXAMPLE_INSTANCE_NAME, EXAMPLE_FLAVOR, image_id, network_id)) + instance = \ + os_utils.create_instance_and_wait_for_active(EXAMPLE_FLAVOR, + image_id, + network_id, + EXAMPLE_INSTANCE_NAME) + + if instance is None: + logger.error("Error while booting instance.") + sys.exit(-1) + # Retrieve IP of INSTANCE + instance_ip = instance.networks.get(EXAMPLE_PRIVATE_NET_NAME)[0] + logger.debug("Instance '%s' got private ip '%s'." % + (EXAMPLE_INSTANCE_NAME, instance_ip)) + + logger.info("Adding '%s' to security group '%s'..." + % (EXAMPLE_INSTANCE_NAME, EXAMPLE_SECGROUP_NAME)) + os_utils.add_secgroup_to_instance(nova_client, instance.id, sg_id) + + logger.info("Creating floating IP for VM '%s'..." % EXAMPLE_INSTANCE_NAME) + floatip_dic = os_utils.create_floating_ip(neutron_client) + floatip = floatip_dic['fip_addr'] + # floatip_id = floatip_dic['fip_id'] + + if floatip is None: + logger.error("Cannot create floating IP.") + sys.exit(-1) + logger.info("Floating IP created: '%s'" % floatip) + + logger.info("Associating floating ip: '%s' to VM '%s' " + % (floatip, EXAMPLE_INSTANCE_NAME)) + if not os_utils.add_floating_ip(nova_client, instance.id, floatip): + logger.error("Cannot associate floating IP to VM.") + sys.exit(-1) + + sys.exit(0) + + +if __name__ == '__main__': + main() diff --git a/functest/opnfv_tests/openstack/healthcheck/healthcheck.sh b/functest/opnfv_tests/openstack/healthcheck/healthcheck.sh new file mode 100755 index 00000000..e27cf4b4 --- /dev/null +++ b/functest/opnfv_tests/openstack/healthcheck/healthcheck.sh @@ -0,0 +1,262 @@ +# +# OpenStack Health Check +# This script is meant for really basic API operations on OpenStack +# Services tested: Keystone, Glance, Cinder, Neutron, Nova +# +# +# Author: +# jose.lausuch@ericsson.com +# +# +# 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 +# + +set -e + +#Redirect all the output (stdout) to a log file and show only possible errors. +LOG_FILE=/home/opnfv/functest/results/healthcheck.log +YAML_FILE=${CONFIG_FUNCTEST_YAML} +echo "">$LOG_FILE +exec 1<>$LOG_FILE + +info () { + echo -e "$(date '+%Y-%m-%d %H:%M:%S,%3N') - healtcheck - INFO - " "$*" | tee -a $LOG_FILE 1>&2 +} + +debug () { + if [[ "${CI_DEBUG,,}" == "true" ]]; then + echo -e "$(date '+%Y-%m-%d %H:%M:%S,%3N') - healtcheck - DEBUG - " "$*" | tee -a $LOG_FILE 1>&2 + fi +} + +error () { + echo -e "$(date '+%Y-%m-%d %H:%M:%S,%3N') - healtcheck - ERROR - " "$*" | tee -a $LOG_FILE 1>&2 + exit 1 +} + +if [ -z $OS_AUTH_URL ]; then + echo "Source credentials first." + exit 1 +fi + + +echo "Using following credentials:" +env | grep OS + +## Variables: +project_1="opnfv-tenant1" +project_2="opnfv-tenant2" +user_1="opnfv_user1" +user_2="opnfv_user2" +user_3="opnfv_user3" +user_4="opnfv_user4" +user_5="opnfv_user5" +user_6="opnfv_user6" +kernel_image="opnfv-kernel-img" +ramdisk_image="opnfv-ramdisk-img" +image_1="opnfv-image1" +image_2="opnfv-image2" +volume_1="opnfv-volume1" +volume_2="opnfv-volume2" +net_1="opnfv-network1" +net_2="opnfv-network2" +subnet_1="opnfv-subnet1" +subnet_2="opnfv-subnet2" +port_1="opnfv-port1" +port_2="opnfv-port2" +router_1="opnfv-router1" +router_2="opnfv-router2" +flavor="m1.tiny" +instance_1="opnfv-instance1" +instance_2="opnfv-instance2" +instance_3="opnfv-instance3" +instance_4="opnfv-instance4" + + + +function wait_for_ip() { + # $1 is the instance name + # $2 is the first octet of the subnet ip + timeout=60 + while [[ ${timeout} > 0 ]]; do + if [[ $(nova console-log $1|grep "No lease, failing") ]]; then + error "The instance $1 couldn't get an IP from the DHCP agent." | tee -a $LOG_FILE 1>&2 + exit 1 + elif [[ $(nova console-log $1|grep "^Lease"|grep "obtained") ]]; then + debug "The instance $1 got an IP successfully from the DHCP agent." | tee -a $LOG_FILE 1>&2 + break + fi + let timeout=timeout-1 + sleep 1 + done +} + + +################################# +info "Testing Keystone API..." | tee -a $LOG_FILE 1>&2 +################################# +openstack project create ${project_1} +debug "project '${project_1}' created." +openstack project create ${project_2} +debug "project '${project_2}' created." +openstack user create ${user_1} --project ${project_1} +debug "user '${user_1}' created in project ${project_1}." +openstack user create ${user_2} --project ${project_1} +debug "user '${user_2}' created in project ${project_1}." +openstack user create ${user_3} --project ${project_1} +debug "user '${user_3}' created in project ${project_1}." +openstack user create ${user_4} --project ${project_2} +debug "user '${user_4}' created in project ${project_2}." +openstack user create ${user_5} --project ${project_2} +debug "user '${user_5}' created in project ${project_2}." +openstack user create ${user_6} --project ${project_2} +debug "user '${user_6}' created in project ${project_2}." +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) + +# Test if we need to create a 3part image +if [ "X$kernel_img" != "X" ] +then + img_id=$(glance image-create --name ${kernel_image} --disk-format aki \ + --container-format bare < ${kernel_img} | awk '$2 == "id" { print $4 }') + extra_opts="--property kernel_id=${img_id}" + + if [ "X$ramdisk_img" != "X" ] + then + img_id=$(glance image-create --name ${ramdisk_image} --disk-format ari \ + --container-format bare < ${ramdisk_img} | awk '$2 == "id" { print $4 }') + extra_opts="$extra_opts --property ramdisk_id=${img_id}" + fi +fi + +if [ "X$extra_properties" != "X" ] +then + keys=$(cat ${YAML_FILE} | shyaml keys healthcheck.extra_properties) + for key in ${keys} + do + value=$(cat ${YAML_FILE} | shyaml get-value healthcheck.extra_properties.${key}) + extra_opts="$extra_opts --property ${key}=\"${value}\"" + done +fi + +debug "image extra_properties=${extra_properties}" + +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 ${disk_format} --container-format bare \ + ${extra_opts} < ${disk_img} +debug "image '${image_2}' created." +info "... Glance OK!" + +################################# +info "Testing Cinder API..." +################################# +cinder create --display_name ${volume_1} 1 +debug "volume '${volume_1}' created." +cinder create --display_name ${volume_2} 10 +debug "volume '${volume_2}' created." +info "...Cinder OK!" + +################################# +info "Testing Neutron API..." +################################# + +network_ids=($(neutron net-list|grep -v "+"|grep -v name|awk '{print $2}')) +for id in ${network_ids[@]}; do + [[ $(neutron net-show ${id}|grep 'router:external'|grep -i "true") != "" ]] && ext_net_id=${id} +done +if [[ "${ext_net_id}" == "" ]]; then + error "No external network found. Exiting Health Check..." + exit 1 +else + info "External network found. ${ext_net_id}" +fi + +info "1. Create Networks..." +neutron net-create ${net_1} +debug "net '${net_1}' created." +neutron net-create ${net_2} +debug "net '${net_2}' created." +net1_id=$(neutron net-list | grep ${net_1} | awk '{print $2}') +net2_id=$(neutron net-list | grep ${net_2} | awk '{print $2}') + +info "2. Create subnets..." +neutron subnet-create --name ${subnet_1} --allocation-pool start=10.6.0.2,end=10.6.0.253 --gateway 10.6.0.254 ${net_1} 10.6.0.0/24 +debug "subnet '${subnet_1}' created." +neutron subnet-create --name ${subnet_2} --allocation-pool start=10.7.0.2,end=10.7.0.253 --gateway 10.7.0.254 ${net_2} 10.7.0.0/24 +debug "subnet '${subnet_2}' created." + +info "3. Create Routers..." +neutron router-create ${router_1} +debug "router '${router_1}' created." +neutron router-create ${router_2} +debug "router '${router_2}' created." + +neutron router-gateway-set ${router_1} ${ext_net_id} +debug "router '${router_1}' gateway set to ${ext_net_id}." +neutron router-gateway-set ${router_2} ${ext_net_id} +debug "router '${router_2}' gateway set to ${ext_net_id}." + +neutron router-interface-add ${router_1} ${subnet_1} +debug "router '${router_1}' interface added ${subnet_1}." +neutron router-interface-add ${router_2} ${subnet_2} +debug "router '${router_2}' interface added ${subnet_2}." + +info "...Neutron OK!" + +################################# +info "Testing Nova API..." +################################# + +# This delay should be removed after resolving Jira case APEX-149. +# The purpose is to give some time to populate openflow rules +# by SDN controller in case of odl_l2 scenario. +wait_time=$(cat ${YAML_FILE} | shyaml get-value healthcheck.wait_time 2> /dev/null || true) +sleep ${wait_time} + + +# Check if flavor exists +if [[ -z $(nova flavor-list|grep $flavor) ]]; then + # if given flavor doesn't exist, we create one + debug "Flavor $flavor doesn't exist. Creating a new flavor." + nova flavor-create --is-public false ${flavor} auto 512 1 1 --is-public True +fi +debug "Using flavor $flavor to boot the instances." + + +nova boot --flavor ${flavor} --image ${image_1} --nic net-id=${net1_id} ${instance_1} +debug "nova instance '${instance_1}' booted on ${net_1}." +nova boot --flavor ${flavor} --image ${image_1} --nic net-id=${net1_id} ${instance_2} +debug "nova instance '${instance_2}' booted on ${net_1}." +nova boot --flavor ${flavor} --image ${image_2} --nic net-id=${net2_id} ${instance_3} +debug "nova instance '${instance_3}' booted on ${net_2}." +nova boot --flavor ${flavor} --image ${image_2} --nic net-id=${net2_id} ${instance_4} +debug "nova instance '${instance_4}' booted on ${net_2}." + +vm1_id=$(nova list | grep ${instance_1} | awk '{print $2}') +vm2_id=$(nova list | grep ${instance_2} | awk '{print $2}') +vm3_id=$(nova list | grep ${instance_3} | awk '{print $2}') +vm4_id=$(nova list | grep ${instance_4} | awk '{print $2}') +info "...Nova OK!" + +info "Checking if instances get an IP from DHCP..." +wait_for_ip ${instance_1} "10.6" +wait_for_ip ${instance_2} "10.6" +wait_for_ip ${instance_3} "10.7" +wait_for_ip ${instance_4} "10.7" +info "...DHCP OK!" + +info "Health check passed!" +exit 0 diff --git a/functest/opnfv_tests/openstack/rally/blacklist.txt b/functest/opnfv_tests/openstack/rally/blacklist.txt new file mode 100644 index 00000000..3a17fa61 --- /dev/null +++ b/functest/opnfv_tests/openstack/rally/blacklist.txt @@ -0,0 +1,18 @@ +scenario: + - + scenarios: + - os-nosdn-lxd-ha + - os-nosdn-lxd-noha + installers: + - joid + tests: + - NovaServers.boot_server_from_volume_and_delete + +functionality: + - + functions: + - no_live_migration + tests: + - NovaServers.boot_and_live_migrate_server + - NovaServers.boot_server_attach_created_volume_and_live_migrate + - NovaServers.boot_server_from_volume_and_live_migrate diff --git a/functest/opnfv_tests/openstack/rally/macro/macro.yaml b/functest/opnfv_tests/openstack/rally/macro/macro.yaml new file mode 100644 index 00000000..48c0333e --- /dev/null +++ b/functest/opnfv_tests/openstack/rally/macro/macro.yaml @@ -0,0 +1,97 @@ +{%- macro user_context(tenants,users_per_tenant, use_existing_users) -%} +{%- if use_existing_users and caller is not defined -%} {} +{%- else %} + {%- if not use_existing_users %} + users: + tenants: {{ tenants }} + users_per_tenant: {{ users_per_tenant }} + {%- endif %} + {%- if caller is defined %} + {{ caller() }} + {%- endif %} +{%- endif %} +{%- endmacro %} + +{%- macro vm_params(image=none, flavor=none, size=none) %} +{%- if flavor is not none %} + flavor: + name: {{ flavor }} +{%- endif %} +{%- if image is not none %} + image: + name: {{ image }} +{%- endif %} +{%- if size is not none %} + size: {{ size }} +{%- endif %} +{%- endmacro %} + +{%- macro unlimited_volumes() %} + cinder: + gigabytes: -1 + snapshots: -1 + volumes: -1 +{%- endmacro %} + +{%- macro constant_runner(concurrency=1, times=1, is_smoke=True) %} + type: "constant" + {%- if is_smoke %} + concurrency: 1 + times: 1 + {%- else %} + concurrency: {{ concurrency }} + times: {{ times }} + {%- endif %} +{%- endmacro %} + +{%- macro rps_runner(rps=1, times=1, is_smoke=True) %} + type: rps + {%- if is_smoke %} + rps: 1 + times: 1 + {%- else %} + rps: {{ rps }} + times: {{ times }} + {%- endif %} +{%- endmacro %} + +{%- macro no_failures_sla() %} + failure_rate: + max: 0 +{%- endmacro %} + +{%- macro volumes(size=1, volumes_per_tenant=1) %} + volumes: + size: {{ size }} + volumes_per_tenant: {{ volumes_per_tenant }} +{%- endmacro %} + +{%- macro unlimited_nova(keypairs=false) %} + nova: + cores: -1 + floating_ips: -1 + instances: -1 + {%- if keypairs %} + key_pairs: -1 + {%- endif %} + ram: -1 + security_group_rules: -1 + security_groups: -1 +{%- endmacro %} + +{%- macro unlimited_neutron(secgroups=false) %} + neutron: + network: -1 + port: -1 + subnet: -1 + {%- if secgroups %} + security_group: -1 + security_group_rule: -1 + {%- endif %} +{%- endmacro %} + +{%- macro glance_args(location, container="bare", type="qcow2") %} + container_format: {{ container }} + disk_format: {{ type }} + image_location: {{ location }} +{%- endmacro %} diff --git a/functest/opnfv_tests/openstack/rally/run_rally-cert.py b/functest/opnfv_tests/openstack/rally/run_rally-cert.py new file mode 100755 index 00000000..6d8f0160 --- /dev/null +++ b/functest/opnfv_tests/openstack/rally/run_rally-cert.py @@ -0,0 +1,619 @@ +#!/usr/bin/env python +# +# Copyright (c) 2015 Orange +# guyrodrigue.koffi@orange.com +# morgan.richomme@orange.com +# 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 +# +# 0.1 (05/2015) initial commit +# 0.2 (28/09/2015) extract Tempest, format json result, add ceilometer suite +# 0.3 (19/10/2015) remove Tempest from run_rally +# and push result into test DB +# +""" tests configuration """ + +import json +import os +import re +import subprocess +import time + +import argparse +import iniparse +import yaml + +import functest.utils.functest_logger as ft_logger +import functest.utils.functest_utils as ft_utils +import functest.utils.openstack_utils as os_utils +import functest.utils.functest_constants as ft_constants + +tests = ['authenticate', 'glance', 'cinder', 'heat', 'keystone', + 'neutron', 'nova', 'quotas', 'requests', 'vm', 'all'] +parser = argparse.ArgumentParser() +parser.add_argument("test_name", + help="Module name to be tested. " + "Possible values are : " + "[ {d[0]} | {d[1]} | {d[2]} | {d[3]} | {d[4]} | " + "{d[5]} | {d[6]} | {d[7]} | {d[8]} | {d[9]} | " + "{d[10]} ] " + "The 'all' value " + "performs all possible test scenarios" + .format(d=tests)) + +parser.add_argument("-d", "--debug", help="Debug mode", action="store_true") +parser.add_argument("-r", "--report", + help="Create json result file", + action="store_true") +parser.add_argument("-s", "--smoke", + help="Smoke test mode", + action="store_true") +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") +parser.add_argument("-z", "--sanity", + help="Sanity test mode, execute only a subset of tests", + action="store_true") + +args = parser.parse_args() + + +if args.verbose: + RALLY_STDERR = subprocess.STDOUT +else: + RALLY_STDERR = open(os.devnull, 'w') + +""" logging configuration """ +logger = ft_logger.Logger("run_rally-cert").getLogger() + +RALLY_DIR = os.path.join(ft_constants.FUNCTEST_REPO_DIR, + ft_constants.RALLY_RELATIVE_PATH) +RALLY_SCENARIO_DIR = os.path.join(RALLY_DIR, "scenario") +SANITY_MODE_DIR = os.path.join(RALLY_SCENARIO_DIR, "sanity") +FULL_MODE_DIR = os.path.join(RALLY_SCENARIO_DIR, "full") +TEMPLATE_DIR = os.path.join(RALLY_SCENARIO_DIR, "templates") +SUPPORT_DIR = os.path.join(RALLY_SCENARIO_DIR, "support") +TEMP_DIR = os.path.join(RALLY_DIR, "var") +BLACKLIST_FILE = os.path.join(RALLY_DIR, "blacklist.txt") + +FLAVOR_NAME = "m1.tiny" +USERS_AMOUNT = 2 +TENANTS_AMOUNT = 3 +ITERATIONS_AMOUNT = 10 +CONCURRENCY = 4 + +RESULTS_DIR = os.path.join(ft_constants.FUNCTEST_RESULTS_DIR, 'rally') +TEMPEST_CONF_FILE = os.path.join(ft_constants.FUNCTEST_RESULTS_DIR, + 'tempest/tempest.conf') + +RALLY_PRIVATE_NET_NAME = ft_constants.RALLY_PRIVATE_NET_NAME +RALLY_PRIVATE_SUBNET_NAME = ft_constants.RALLY_PRIVATE_SUBNET_NAME +RALLY_PRIVATE_SUBNET_CIDR = ft_constants.RALLY_PRIVATE_SUBNET_CIDR +RALLY_ROUTER_NAME = ft_constants.RALLY_ROUTER_NAME + +GLANCE_IMAGE_NAME = ft_constants.GLANCE_IMAGE_NAME +GLANCE_IMAGE_FILENAME = ft_constants.GLANCE_IMAGE_FILENAME +GLANCE_IMAGE_FORMAT = ft_constants.GLANCE_IMAGE_FORMAT +GLANCE_IMAGE_PATH = os.path.join(ft_constants.FUNCTEST_DATA_DIR, + GLANCE_IMAGE_FILENAME) +CINDER_VOLUME_TYPE_NAME = "volume_test" + + +class GlobalVariables: + SUMMARY = [] + neutron_client = None + network_dict = {} + + +def get_task_id(cmd_raw): + """ + get task id from command rally result + :param cmd_raw: + :return: task_id as string + """ + taskid_re = re.compile('^Task +(.*): started$') + for line in cmd_raw.splitlines(True): + line = line.strip() + match = taskid_re.match(line) + if match: + return match.group(1) + return None + + +def task_succeed(json_raw): + """ + Parse JSON from rally JSON results + :param json_raw: + :return: Bool + """ + rally_report = json.loads(json_raw) + for report in rally_report: + if report is None or report.get('result') is None: + return False + + for result in report.get('result'): + if result is None or len(result.get('error')) > 0: + return False + + return True + + +def live_migration_supported(): + config = iniparse.ConfigParser() + if (config.read(TEMPEST_CONF_FILE) and + config.has_section('compute-feature-enabled') and + config.has_option('compute-feature-enabled', 'live_migration')): + return config.getboolean('compute-feature-enabled', 'live_migration') + + return False + + +def build_task_args(test_file_name): + task_args = {'service_list': [test_file_name]} + task_args['image_name'] = GLANCE_IMAGE_NAME + task_args['flavor_name'] = FLAVOR_NAME + task_args['glance_image_location'] = GLANCE_IMAGE_PATH + task_args['glance_image_format'] = GLANCE_IMAGE_FORMAT + task_args['tmpl_dir'] = TEMPLATE_DIR + task_args['sup_dir'] = SUPPORT_DIR + task_args['users_amount'] = USERS_AMOUNT + task_args['tenants_amount'] = TENANTS_AMOUNT + task_args['use_existing_users'] = False + task_args['iterations'] = ITERATIONS_AMOUNT + task_args['concurrency'] = CONCURRENCY + + if args.sanity: + task_args['smoke'] = True + else: + task_args['smoke'] = args.smoke + + ext_net = os_utils.get_external_net(GlobalVariables.neutron_client) + if ext_net: + task_args['floating_network'] = str(ext_net) + else: + task_args['floating_network'] = '' + + net_id = GlobalVariables.network_dict['net_id'] + task_args['netid'] = str(net_id) + + auth_url = ft_constants.OS_AUTH_URL + if auth_url is not None: + task_args['request_url'] = auth_url.rsplit(":", 1)[0] + else: + task_args['request_url'] = '' + + return task_args + + +def get_output(proc, test_name): + result = "" + nb_tests = 0 + overall_duration = 0.0 + success = 0.0 + nb_totals = 0 + + while proc.poll() is None: + line = proc.stdout.readline() + if args.verbose: + result += line + else: + if ("Load duration" in line or + "started" in line or + "finished" in line or + " Preparing" in line or + "+-" in line or + "|" in line): + result += line + elif "test scenario" in line: + result += "\n" + line + elif "Full duration" in line: + result += line + "\n\n" + + # 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('%') + try: + success += float(percentage) + except ValueError: + logger.info('Percentage error: %s, %s' % (percentage, line)) + nb_totals += 1 + elif "Full duration" in line: + duration = line.split(': ')[1] + try: + overall_duration += float(duration) + except ValueError: + logger.info('Duration error: %s, %s' % (duration, line)) + + 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} + GlobalVariables.SUMMARY.append(scenario_summary) + + logger.debug("\n" + result) + + return result + + +def get_cmd_output(proc): + result = "" + + while proc.poll() is None: + line = proc.stdout.readline() + result += line + + return result + + +def excl_scenario(): + black_tests = [] + + try: + with open(BLACKLIST_FILE, 'r') as black_list_file: + black_list_yaml = yaml.safe_load(black_list_file) + + installer_type = ft_constants.CI_INSTALLER_TYPE + deploy_scenario = ft_constants.CI_SCENARIO + if (bool(installer_type) * bool(deploy_scenario)): + if 'scenario' in black_list_yaml.keys(): + for item in black_list_yaml['scenario']: + scenarios = item['scenarios'] + installers = item['installers'] + if (deploy_scenario in scenarios and + installer_type in installers): + tests = item['tests'] + black_tests.extend(tests) + except: + logger.debug("Scenario exclusion not applied.") + + return black_tests + + +def excl_func(): + black_tests = [] + func_list = [] + + try: + with open(BLACKLIST_FILE, 'r') as black_list_file: + black_list_yaml = yaml.safe_load(black_list_file) + + if not live_migration_supported(): + func_list.append("no_live_migration") + + if 'functionality' in black_list_yaml.keys(): + for item in black_list_yaml['functionality']: + functions = item['functions'] + for func in func_list: + if func in functions: + tests = item['tests'] + black_tests.extend(tests) + except: + logger.debug("Functionality exclusion not applied.") + + return black_tests + + +def apply_blacklist(case_file_name, result_file_name): + logger.debug("Applying blacklist...") + cases_file = open(case_file_name, 'r') + result_file = open(result_file_name, 'w') + + black_tests = list(set(excl_func() + excl_scenario())) + + include = True + for cases_line in cases_file: + if include: + for black_tests_line in black_tests: + if re.search(black_tests_line, cases_line.strip().rstrip(':')): + include = False + break + else: + result_file.write(str(cases_line)) + else: + if cases_line.isspace(): + include = True + + cases_file.close() + result_file.close() + + +def prepare_test_list(test_name): + test_yaml_file_name = 'opnfv-{}.yaml'.format(test_name) + scenario_file_name = os.path.join(RALLY_SCENARIO_DIR, test_yaml_file_name) + + if not os.path.exists(scenario_file_name): + if args.sanity: + scenario_file_name = os.path.join(SANITY_MODE_DIR, + test_yaml_file_name) + else: + scenario_file_name = os.path.join(FULL_MODE_DIR, + test_yaml_file_name) + + if not os.path.exists(scenario_file_name): + logger.info("The scenario '%s' does not exist." + % scenario_file_name) + exit(-1) + + logger.debug('Scenario fetched from : {}'.format(scenario_file_name)) + test_file_name = os.path.join(TEMP_DIR, test_yaml_file_name) + + if not os.path.exists(TEMP_DIR): + os.makedirs(TEMP_DIR) + + apply_blacklist(scenario_file_name, test_file_name) + return test_file_name + + +def file_is_empty(file_name): + try: + if os.stat(file_name).st_size > 0: + return False + except: + pass + + return True + + +def run_task(test_name): + # + # the "main" function of the script who launch rally for a task + # :param test_name: name for the rally test + # :return: void + # + logger.info('Starting test scenario "{}" ...'.format(test_name)) + start_time = time.time() + + task_file = os.path.join(RALLY_DIR, 'task.yaml') + if not os.path.exists(task_file): + logger.error("Task file '%s' does not exist." % task_file) + exit(-1) + + file_name = prepare_test_list(test_name) + if file_is_empty(file_name): + logger.info('No tests for scenario "{}"'.format(test_name)) + return + + cmd_line = ("rally task start --abort-on-sla-failure " + + "--task {} ".format(task_file) + + "--task-args \"{}\" ".format(build_task_args(test_name))) + logger.debug('running command line : {}'.format(cmd_line)) + + p = subprocess.Popen(cmd_line, stdout=subprocess.PIPE, + stderr=RALLY_STDERR, shell=True) + output = get_output(p, test_name) + task_id = get_task_id(output) + logger.debug('task_id : {}'.format(task_id)) + + if task_id is None: + logger.error('Failed to retrieve task_id, validating task...') + cmd_line = ("rally task validate " + + "--task {} ".format(task_file) + + "--task-args \"{}\" ".format(build_task_args(test_name))) + logger.debug('running command line : {}'.format(cmd_line)) + p = subprocess.Popen(cmd_line, stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, shell=True) + output = get_cmd_output(p) + logger.error("Task validation result:" + "\n" + output) + return + + # check for result directory and create it otherwise + if not os.path.exists(RESULTS_DIR): + logger.debug('{} does not exist, we create it.'.format(RESULTS_DIR)) + os.makedirs(RESULTS_DIR) + + # write html report file + report_html_name = 'opnfv-{}.html'.format(test_name) + report_html_dir = os.path.join(RESULTS_DIR, report_html_name) + cmd_line = "rally task report {} --out {}".format(task_id, + report_html_dir) + + logger.debug('running command line : {}'.format(cmd_line)) + os.popen(cmd_line) + + # get and save rally operation JSON result + cmd_line = "rally task results %s" % task_id + logger.debug('running command line : {}'.format(cmd_line)) + cmd = os.popen(cmd_line) + json_results = cmd.read() + report_json_name = 'opnfv-{}.json'.format(test_name) + report_json_dir = os.path.join(RESULTS_DIR, report_json_name) + with open(report_json_dir, 'w') as f: + logger.debug('saving json file') + f.write(json_results) + + with open(report_json_dir) as json_file: + json_data = json.load(json_file) + + """ parse JSON operation result """ + status = "FAIL" + if task_succeed(json_results): + logger.info('Test scenario: "{}" OK.'.format(test_name) + "\n") + status = "PASS" + else: + logger.info('Test scenario: "{}" Failed.'.format(test_name) + "\n") + + # Push results in payload of testcase + if args.report: + stop_time = time.time() + logger.debug("Push Rally detailed results into DB") + ft_utils.push_results_to_db("functest", + "Rally_details", + start_time, + stop_time, + status, + json_data) + + +def main(): + + GlobalVariables.nova_client = os_utils.get_nova_client() + GlobalVariables.neutron_client = os_utils.get_neutron_client() + cinder_client = os_utils.get_cinder_client() + + start_time = time.time() + + # configure script + if not (args.test_name in tests): + logger.error('argument not valid') + exit(-1) + + GlobalVariables.SUMMARY = [] + + volume_types = os_utils.list_volume_types(cinder_client, + private=False) + if not volume_types: + volume_type = os_utils.create_volume_type( + cinder_client, CINDER_VOLUME_TYPE_NAME) + if not volume_type: + logger.error("Failed to create volume type...") + exit(-1) + else: + logger.debug("Volume type '%s' created succesfully..." + % CINDER_VOLUME_TYPE_NAME) + else: + logger.debug("Using existing volume type(s)...") + + image_exists, image_id = os_utils.get_or_create_image(GLANCE_IMAGE_NAME, + GLANCE_IMAGE_PATH, + GLANCE_IMAGE_FORMAT) + if not image_id: + exit(-1) + + logger.debug("Creating network '%s'..." % RALLY_PRIVATE_NET_NAME) + GlobalVariables.network_dict = \ + os_utils.create_shared_network_full(RALLY_PRIVATE_NET_NAME, + RALLY_PRIVATE_SUBNET_NAME, + RALLY_ROUTER_NAME, + RALLY_PRIVATE_SUBNET_CIDR) + if not GlobalVariables.network_dict: + exit(1) + + if args.test_name == "all": + for test_name in tests: + if not (test_name == 'all' or + test_name == 'vm'): + run_task(test_name) + else: + logger.debug("Test name: " + args.test_name) + run_task(args.test_name) + + report = ("\n" + " " + "\n" + " Rally Summary Report\n" + "\n" + "+===================+============+===============+===========+" + "\n" + "| Module | Duration | nb. Test Run | Success |" + "\n" + "+===================+============+===============+===========+" + "\n") + payload = [] + stop_time = time.time() + + # for each scenario we draw a row for the table + total_duration = 0.0 + total_nb_tests = 0 + total_success = 0.0 + for s in GlobalVariables.SUMMARY: + name = "{0:<17}".format(s['test_name']) + duration = float(s['overall_duration']) + total_duration += duration + duration = time.strftime("%M:%S", time.gmtime(duration)) + duration = "{0:<10}".format(duration) + nb_tests = "{0:<13}".format(s['nb_tests']) + total_nb_tests += int(s['nb_tests']) + success = "{0:<10}".format(str(s['success']) + '%') + total_success += float(s['success']) + report += ("" + + "| " + name + " | " + duration + " | " + + nb_tests + " | " + success + "|\n" + + "+-------------------+------------" + "+---------------+-----------+\n") + payload.append({'module': name, + 'details': {'duration': s['overall_duration'], + 'nb tests': s['nb_tests'], + 'success': s['success']}}) + + 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) + + if len(GlobalVariables.SUMMARY): + success_rate = total_success / len(GlobalVariables.SUMMARY) + else: + success_rate = 100 + success_rate = "{:0.2f}".format(success_rate) + success_rate_str = "{0:<10}".format(str(success_rate) + '%') + report += "+===================+============+===============+===========+" + report += "\n" + report += ("| TOTAL: | " + total_duration_str2 + " | " + + total_nb_tests_str + " | " + success_rate_str + "|\n") + report += "+===================+============+===============+===========+" + report += "\n" + + logger.info("\n" + report) + payload.append({'summary': {'duration': total_duration, + 'nb tests': total_nb_tests, + 'nb success': success_rate}}) + + if args.sanity: + case_name = "rally_sanity" + else: + case_name = "rally_full" + + # Evaluation of the success criteria + status = ft_utils.check_success_rate(case_name, success_rate) + + exit_code = -1 + if status == "PASS": + exit_code = 0 + + if args.report: + logger.debug("Pushing Rally summary into DB...") + ft_utils.push_results_to_db("functest", + case_name, + start_time, + stop_time, + status, + payload) + if args.noclean: + exit(exit_code) + + if not image_exists: + logger.debug("Deleting image '%s' with ID '%s'..." + % (GLANCE_IMAGE_NAME, image_id)) + if not os_utils.delete_glance_image(GlobalVariables.nova_client, + image_id): + logger.error("Error deleting the glance image") + + if not volume_types: + logger.debug("Deleting volume type '%s'..." + % CINDER_VOLUME_TYPE_NAME) + if not os_utils.delete_volume_type(cinder_client, volume_type): + logger.error("Error in deleting volume type...") + + exit(exit_code) + + +if __name__ == '__main__': + main() diff --git a/functest/opnfv_tests/openstack/rally/scenario/full/opnfv-cinder.yaml b/functest/opnfv_tests/openstack/rally/scenario/full/opnfv-cinder.yaml new file mode 100644 index 00000000..e844e33f --- /dev/null +++ b/functest/opnfv_tests/openstack/rally/scenario/full/opnfv-cinder.yaml @@ -0,0 +1,266 @@ + CinderVolumes.create_and_attach_volume: + - + args: + {{ vm_params(image_name,flavor_name,1) }} + nics: + - net-id: {{ netid }} + context: + {% call user_context(tenants_amount, users_amount, use_existing_users) %} + quotas: + {{ unlimited_volumes() }} + {% endcall %} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + CinderVolumes.create_and_list_snapshots: + - + args: + detailed: true + force: false + context: + {% call user_context(tenants_amount, users_amount, use_existing_users) %} + quotas: + {{ unlimited_volumes() }} + {{ volumes() }} + {% endcall %} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + CinderVolumes.create_and_list_volume: + - + args: + detailed: true + {{ vm_params(image_name,none,1) }} + context: + {% call user_context(tenants_amount, users_amount, use_existing_users) %} + quotas: + {{ unlimited_volumes() }} + {% endcall %} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + - + args: + detailed: true + size: 1 + context: + {% call user_context(tenants_amount, users_amount, use_existing_users) %} + quotas: + {{ unlimited_volumes() }} + {% endcall %} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + CinderVolumes.create_and_upload_volume_to_image: + - + args: + container_format: "bare" + disk_format: "raw" + do_delete: true + force: false + size: 1 + context: + {% call user_context(tenants_amount, users_amount, use_existing_users) %} + quotas: + {{ unlimited_volumes() }} + {% endcall %} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + CinderVolumes.create_nested_snapshots_and_attach_volume: + - + args: + nested_level: 1 + size: + max: 1 + min: 1 + context: + {% call user_context(tenants_amount, users_amount, use_existing_users) %} + quotas: + {{ unlimited_volumes() }} + servers: + {{ vm_params(image_name,flavor_name,none)|indent(2,true) }} + servers_per_tenant: 1 + auto_assign_nic: true + network: {} + {% endcall %} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + CinderVolumes.create_snapshot_and_attach_volume: + - + args: + volume_type: false + size: + min: 1 + max: 5 + context: + {% call user_context(tenants_amount, users_amount, use_existing_users) %} + quotas: + {{ unlimited_volumes() }} + servers: + {{ vm_params(image_name,flavor_name,none)|indent(2,true) }} + servers_per_tenant: 2 + auto_assign_nic: true + network: {} + {% endcall %} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + - + args: + volume_type: true + size: + min: 1 + max: 5 + context: + {% call user_context(tenants_amount, users_amount, use_existing_users) %} + quotas: + {{ unlimited_volumes() }} + servers: + {{ vm_params(image_name,flavor_name,none)|indent(2,true) }} + servers_per_tenant: 2 + auto_assign_nic: true + network: {} + {% endcall %} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + CinderVolumes.create_volume: + - + args: + size: 1 + context: + {{ user_context(tenants_amount, users_amount, use_existing_users) }} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + - + args: + size: + min: 1 + max: 5 + context: + {% call user_context(tenants_amount, users_amount, use_existing_users) %} + quotas: + {{ unlimited_volumes() }} + {% endcall %} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + CinderVolumes.list_volumes: + - + args: + detailed: True + context: + {% call user_context(tenants_amount, users_amount, use_existing_users) %} + quotas: + {{ unlimited_volumes() }} + volumes: + size: 1 + volumes_per_tenant: 4 + {% endcall %} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + CinderVolumes.create_and_delete_snapshot: + - + args: + force: false + context: + {% call user_context(tenants_amount, users_amount, use_existing_users) %} + quotas: + {{ unlimited_volumes() }} + {{ volumes() }} + {% endcall %} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + CinderVolumes.create_and_delete_volume: + - + args: + size: + max: 1 + min: 1 + context: + {% call user_context(tenants_amount, users_amount, use_existing_users) %} + quotas: + {{ unlimited_volumes() }} + {% endcall %} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + - + args: + {{ vm_params(image_name,none,1) }} + context: + {% call user_context(tenants_amount, users_amount, use_existing_users) %} + quotas: + {{ unlimited_volumes() }} + {% endcall %} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + - + args: + size: 1 + context: + {% call user_context(tenants_amount, users_amount, use_existing_users) %} + quotas: + {{ unlimited_volumes() }} + {% endcall %} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + CinderVolumes.create_and_extend_volume: + - + args: + new_size: 2 + size: 1 + context: + {% call user_context(tenants_amount, users_amount, use_existing_users) %} + quotas: + {{ unlimited_volumes() }} + {% endcall %} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + CinderVolumes.create_from_volume_and_delete_volume: + - + args: + size: 1 + context: + {% call user_context(tenants_amount, users_amount, use_existing_users) %} + quotas: + {{ unlimited_volumes() }} + {{ volumes() }} + {% endcall %} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} diff --git a/functest/opnfv_tests/openstack/rally/scenario/full/opnfv-heat.yaml b/functest/opnfv_tests/openstack/rally/scenario/full/opnfv-heat.yaml new file mode 100644 index 00000000..6f3a5c16 --- /dev/null +++ b/functest/opnfv_tests/openstack/rally/scenario/full/opnfv-heat.yaml @@ -0,0 +1,140 @@ + HeatStacks.create_and_delete_stack: + - + args: + template_path: "{{ tmpl_dir }}/default.yaml.template" + context: + {{ user_context(tenants_amount, users_amount, use_existing_users) }} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + - + args: + template_path: "{{ tmpl_dir }}/server_with_ports.yaml.template" + parameters: + public_net: {{ floating_network }} + image: {{ image_name }} + flavor: {{ flavor_name }} + context: + {{ user_context(tenants_amount, users_amount, use_existing_users) }} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + - + args: + template_path: "{{ tmpl_dir }}/server_with_volume.yaml.template" + parameters: + image: {{ image_name }} + flavor: {{ flavor_name }} + network_id: {{ netid }} + context: + {{ user_context(tenants_amount, users_amount, use_existing_users) }} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + HeatStacks.create_and_list_stack: + - + args: + template_path: "{{ tmpl_dir }}/default.yaml.template" + context: + {{ user_context(tenants_amount, users_amount, use_existing_users) }} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + HeatStacks.create_update_delete_stack: + - + args: + template_path: "{{ tmpl_dir }}/random_strings.yaml.template" + updated_template_path: "{{ tmpl_dir }}/updated_random_strings_add.yaml.template" + context: + {{ user_context(tenants_amount, users_amount, use_existing_users) }} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + - + args: + template_path: "{{ tmpl_dir }}/random_strings.yaml.template" + updated_template_path: "{{ tmpl_dir }}/updated_random_strings_delete.yaml.template" + context: + {{ user_context(tenants_amount, users_amount, use_existing_users) }} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + - + args: + template_path: "{{ tmpl_dir }}/resource_group.yaml.template" + updated_template_path: "{{ tmpl_dir }}/updated_resource_group_increase.yaml.template" + context: + {{ user_context(tenants_amount, users_amount, use_existing_users) }} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + - + args: + template_path: "{{ tmpl_dir }}/autoscaling_policy.yaml.template" + updated_template_path: "{{ tmpl_dir }}/updated_autoscaling_policy_inplace.yaml.template" + context: + {{ user_context(tenants_amount, users_amount, use_existing_users) }} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + - + args: + template_path: "{{ tmpl_dir }}/resource_group.yaml.template" + updated_template_path: "{{ tmpl_dir }}/updated_resource_group_reduce.yaml.template" + context: + {{ user_context(tenants_amount, users_amount, use_existing_users) }} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + - + args: + template_path: "{{ tmpl_dir }}/random_strings.yaml.template" + updated_template_path: "{{ tmpl_dir }}/updated_random_strings_replace.yaml.template" + context: + {{ user_context(tenants_amount, users_amount, use_existing_users) }} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + HeatStacks.create_check_delete_stack: + - + args: + template_path: "{{ tmpl_dir }}/random_strings.yaml.template" + context: + {{ user_context(tenants_amount, users_amount, use_existing_users) }} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + HeatStacks.create_suspend_resume_delete_stack: + - + args: + template_path: "{{ tmpl_dir }}/random_strings.yaml.template" + context: + {{ user_context(tenants_amount, users_amount, use_existing_users) }} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + HeatStacks.list_stacks_and_resources: + - + context: + {{ user_context(tenants_amount, users_amount, use_existing_users) }} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} diff --git a/functest/opnfv_tests/openstack/rally/scenario/full/opnfv-neutron.yaml b/functest/opnfv_tests/openstack/rally/scenario/full/opnfv-neutron.yaml new file mode 100644 index 00000000..0a773533 --- /dev/null +++ b/functest/opnfv_tests/openstack/rally/scenario/full/opnfv-neutron.yaml @@ -0,0 +1,239 @@ + NeutronNetworks.create_and_update_networks: + - + args: + network_create_args: {} + network_update_args: + admin_state_up: false + context: + {% call user_context(tenants_amount, users_amount, use_existing_users) %} + quotas: + neutron: + network: -1 + {% endcall %} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + NeutronNetworks.create_and_update_ports: + - + args: + network_create_args: {} + port_create_args: {} + port_update_args: + admin_state_up: false + device_id: "dummy_id" + device_owner: "dummy_owner" + ports_per_network: 1 + context: + {% call user_context(tenants_amount, users_amount, use_existing_users) %} + network: {} + quotas: + neutron: + network: -1 + port: -1 + {% endcall %} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + NeutronNetworks.create_and_update_routers: + - + args: + network_create_args: {} + router_create_args: {} + router_update_args: + admin_state_up: false + subnet_cidr_start: "1.1.0.0/30" + subnet_create_args: {} + subnets_per_network: 1 + context: + {% call user_context(tenants_amount, users_amount, use_existing_users) %} + network: {} + quotas: + neutron: + network: -1 + subnet: -1 + port: -1 + router: -1 + {% endcall %} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + NeutronNetworks.create_and_update_subnets: + - + args: + network_create_args: {} + subnet_cidr_start: "1.4.0.0/16" + subnet_create_args: {} + subnet_update_args: + enable_dhcp: false + subnets_per_network: 1 + context: + {% call user_context(tenants_amount, users_amount, use_existing_users) %} + network: {} + quotas: + neutron: + network: -1 + subnet: -1 + {% endcall %} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + NeutronNetworks.create_and_delete_networks: + - + args: + network_create_args: {} + context: + {% call user_context(tenants_amount, users_amount, use_existing_users) %} + quotas: + neutron: + network: -1 + {% endcall %} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + NeutronNetworks.create_and_delete_ports: + - + args: + network_create_args: {} + port_create_args: {} + ports_per_network: 1 + context: + {% call user_context(tenants_amount, users_amount, use_existing_users) %} + network: {} + quotas: + neutron: + network: -1 + port: -1 + {% endcall %} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + NeutronNetworks.create_and_delete_routers: + - + args: + network_create_args: {} + router_create_args: {} + subnet_cidr_start: "1.1.0.0/30" + subnet_create_args: {} + subnets_per_network: 1 + context: + {% call user_context(tenants_amount, users_amount, use_existing_users) %} + network: {} + quotas: + neutron: + network: -1 + subnet: -1 + port: -1 + router: -1 + {% endcall %} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + NeutronNetworks.create_and_delete_subnets: + - + args: + network_create_args: {} + subnet_cidr_start: "1.1.0.0/30" + subnet_create_args: {} + subnets_per_network: 1 + context: + {% call user_context(tenants_amount, users_amount, use_existing_users) %} + network: {} + quotas: + neutron: + network: -1 + subnet: -1 + {% endcall %} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + NeutronNetworks.create_and_list_networks: + - + args: + network_create_args: {} + context: + {% call user_context(tenants_amount, users_amount, use_existing_users) %} + quotas: + neutron: + network: -1 + {% endcall %} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + NeutronNetworks.create_and_list_ports: + - + args: + network_create_args: {} + port_create_args: {} + ports_per_network: 1 + context: + {% call user_context(tenants_amount, users_amount, use_existing_users) %} + network: {} + quotas: + neutron: + network: -1 + port: -1 + {% endcall %} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + NeutronNetworks.create_and_list_routers: + - + args: + network_create_args: {} + router_create_args: {} + subnet_cidr_start: "1.1.0.0/30" + subnet_create_args: {} + subnets_per_network: 1 + context: + {% call user_context(tenants_amount, users_amount, use_existing_users) %} + network: {} + quotas: + neutron: + network: -1 + subnet: -1 + router: -1 + {% endcall %} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + NeutronNetworks.create_and_list_subnets: + - + args: + network_create_args: {} + subnet_cidr_start: "1.1.0.0/30" + subnet_create_args: {} + subnets_per_network: 1 + context: + {% call user_context(tenants_amount, users_amount, use_existing_users) %} + network: {} + quotas: + neutron: + network: -1 + subnet: -1 + {% endcall %} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} diff --git a/functest/opnfv_tests/openstack/rally/scenario/full/opnfv-nova.yaml b/functest/opnfv_tests/openstack/rally/scenario/full/opnfv-nova.yaml new file mode 100644 index 00000000..d7622093 --- /dev/null +++ b/functest/opnfv_tests/openstack/rally/scenario/full/opnfv-nova.yaml @@ -0,0 +1,369 @@ + NovaKeypair.create_and_delete_keypair: + - + context: + {% call user_context(tenants_amount, users_amount, use_existing_users) %} + quotas: + {{ unlimited_nova(keypairs=true) }} + {% endcall %} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + NovaKeypair.create_and_list_keypairs: + - + context: + {% call user_context(tenants_amount, users_amount, use_existing_users) %} + quotas: + {{ unlimited_nova(keypairs=true) }} + {% endcall %} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + NovaServers.boot_and_bounce_server: + - + args: + actions: + - + hard_reboot: 1 + - + soft_reboot: 1 + - + stop_start: 1 + - + rescue_unrescue: 1 + {{ vm_params(image_name, flavor_name) }} + nics: + - net-id: {{ netid }} + context: + {% call user_context(tenants_amount, users_amount, use_existing_users) %} + network: + networks_per_tenant: 1 + start_cidr: "100.1.0.0/25" + quotas: + {{ unlimited_neutron() }} + {{ unlimited_nova() }} + {% endcall %} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + NovaServers.boot_and_delete_server: + - + args: + {{ vm_params(image_name, flavor_name) }} + nics: + - net-id: {{ netid }} + context: + {% call user_context(tenants_amount, users_amount, use_existing_users) %} + network: + networks_per_tenant: 1 + start_cidr: "100.1.0.0/25" + quotas: + {{ unlimited_neutron() }} + {{ unlimited_nova() }} + {% endcall %} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + NovaServers.boot_and_list_server: + - + args: + detailed: true + {{ vm_params(image_name, flavor_name) }} + nics: + - net-id: {{ netid }} + context: + {% call user_context(tenants_amount, users_amount, use_existing_users) %} + network: + networks_per_tenant: 1 + start_cidr: "100.1.0.0/25" + quotas: + {{ unlimited_neutron() }} + {{ unlimited_nova() }} + {% endcall %} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + NovaServers.boot_and_rebuild_server: + - + args: + {{ vm_params(flavor=flavor_name) }} + from_image: + name: {{ image_name }} + to_image: + name: {{ image_name }} + nics: + - net-id: {{ netid }} + context: + {% call user_context(tenants_amount, users_amount, use_existing_users) %} + network: + networks_per_tenant: 1 + start_cidr: "100.1.0.0/25" + quotas: + {{ unlimited_neutron() }} + {{ unlimited_nova() }} + {% endcall %} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + NovaServers.snapshot_server: + - + args: + {{ vm_params(image_name, flavor_name) }} + nics: + - net-id: {{ netid }} + context: + {% call user_context(tenants_amount, users_amount, use_existing_users) %} + network: + networks_per_tenant: 1 + start_cidr: "100.1.0.0/25" + quotas: + {{ unlimited_neutron() }} + {{ unlimited_nova() }} + {% endcall %} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + NovaServers.boot_server_from_volume: + - + args: + {{ vm_params(image_name, flavor_name) }} + volume_size: 10 + nics: + - net-id: {{ netid }} + context: + {{ user_context(tenants_amount, users_amount, use_existing_users) }} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + NovaServers.boot_server: + - + args: + {{ vm_params(image_name, flavor_name) }} + nics: + - net-id: {{ netid }} + context: + {{ user_context(tenants_amount, users_amount, use_existing_users) }} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + NovaSecGroup.create_and_delete_secgroups: + - + args: + security_group_count: 10 + rules_per_security_group: 10 + context: + {% call user_context(tenants_amount, users_amount, use_existing_users) %} + quotas: + {{ unlimited_neutron(secgroups=true) }} + {% endcall %} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + NovaSecGroup.create_and_list_secgroups: + - + args: + security_group_count: 10 + rules_per_security_group: 10 + context: + {% call user_context(tenants_amount, users_amount, use_existing_users) %} + quotas: + {{ unlimited_neutron(secgroups=true) }} + {% endcall %} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + NovaServers.list_servers: + - + args: + detailed: True + context: + {% call user_context(tenants_amount, users_amount, use_existing_users) %} + servers: + {{ vm_params(image_name,flavor_name,none)|indent(2,true) }} + servers_per_tenant: 2 + auto_assign_nic: true + network: {} + {% endcall %} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + NovaServers.resize_server: + - + args: + {{ vm_params(image_name, flavor_name) }} + to_flavor: + name: "m1.small" + confirm: true + force_delete: false + nics: + - net-id: {{ netid }} + context: + {{ user_context(tenants_amount, users_amount, use_existing_users) }} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + NovaServers.boot_and_live_migrate_server: + - args: + {{ vm_params(image_name, flavor_name) }} + block_migration: false + nics: + - net-id: {{ netid }} + context: + {{ user_context(tenants_amount, users_amount, use_existing_users) }} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + NovaServers.boot_server_attach_created_volume_and_live_migrate: + - + args: + {{ vm_params(image_name, flavor_name) }} + size: 10 + block_migration: false + boot_server_kwargs: + nics: + - net-id: {{ netid }} + context: + {{ user_context(tenants_amount, users_amount, use_existing_users) }} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + NovaServers.boot_server_from_volume_and_live_migrate: + - args: + {{ vm_params(image_name, flavor_name) }} + block_migration: false + volume_size: 10 + force_delete: false + nics: + - net-id: {{ netid }} + context: + {{ user_context(tenants_amount, users_amount, use_existing_users) }} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + NovaKeypair.boot_and_delete_server_with_keypair: + - + args: + {{ vm_params(image_name, flavor_name) }} + server_kwargs: + nics: + - net-id: {{ netid }} + context: + {% call user_context(tenants_amount, users_amount, use_existing_users) %} + network: + networks_per_tenant: 1 + start_cidr: "100.1.0.0/25" + quotas: + {{ unlimited_neutron() }} + {{ unlimited_nova(keypairs=true) }} + {% endcall %} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + NovaServers.boot_server_from_volume_and_delete: + - + args: + {{ vm_params(image_name, flavor_name) }} + volume_size: 5 + nics: + - net-id: {{ netid }} + context: + {% call user_context(tenants_amount, users_amount, use_existing_users) %} + network: + networks_per_tenant: 1 + start_cidr: "100.1.0.0/25" + quotas: + {{ unlimited_volumes() }} + {{ unlimited_neutron() }} + {{ unlimited_nova() }} + {% endcall %} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + NovaServers.pause_and_unpause_server: + - + args: + {{ vm_params(image_name, flavor_name) }} + force_delete: false + nics: + - net-id: {{ netid }} + context: + {% call user_context(tenants_amount, users_amount, use_existing_users) %} + network: + networks_per_tenant: 1 + start_cidr: "100.1.0.0/25" + quotas: + {{ unlimited_neutron() }} + {{ unlimited_nova() }} + {% endcall %} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + NovaSecGroup.boot_and_delete_server_with_secgroups: + - + args: + {{ vm_params(image_name, flavor_name) }} + security_group_count: 10 + rules_per_security_group: 10 + nics: + - net-id: {{ netid }} + context: + {% call user_context(tenants_amount, users_amount, use_existing_users) %} + network: + start_cidr: "100.1.0.0/25" + quotas: + {{ unlimited_nova() }} + {{ unlimited_neutron(secgroups=true) }} + {% endcall %} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + NovaServers.boot_and_migrate_server: + - args: + {{ vm_params(image_name, flavor_name) }} + nics: + - net-id: {{ netid }} + context: + {{ user_context(tenants_amount, users_amount, use_existing_users) }} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} diff --git a/functest/opnfv_tests/openstack/rally/scenario/opnfv-authenticate.yaml b/functest/opnfv_tests/openstack/rally/scenario/opnfv-authenticate.yaml new file mode 100644 index 00000000..a04e4c1c --- /dev/null +++ b/functest/opnfv_tests/openstack/rally/scenario/opnfv-authenticate.yaml @@ -0,0 +1,63 @@ + Authenticate.keystone: + - + context: + {{ user_context(tenants_amount, users_amount, use_existing_users) }} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + Authenticate.validate_cinder: + - + args: + repetitions: 2 + context: + {{ user_context(tenants_amount, users_amount, use_existing_users) }} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + Authenticate.validate_glance: + - + args: + repetitions: 2 + context: + {{ user_context(tenants_amount, users_amount, use_existing_users) }} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + Authenticate.validate_heat: + - + args: + repetitions: 2 + context: + {{ user_context(tenants_amount, users_amount, use_existing_users) }} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + Authenticate.validate_neutron: + - + args: + repetitions: 2 + context: + {{ user_context(tenants_amount, users_amount, use_existing_users) }} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + Authenticate.validate_nova: + - + args: + repetitions: 2 + context: + {{ user_context(tenants_amount, users_amount, use_existing_users) }} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} diff --git a/functest/opnfv_tests/openstack/rally/scenario/opnfv-glance.yaml b/functest/opnfv_tests/openstack/rally/scenario/opnfv-glance.yaml new file mode 100644 index 00000000..3a67e745 --- /dev/null +++ b/functest/opnfv_tests/openstack/rally/scenario/opnfv-glance.yaml @@ -0,0 +1,49 @@ + GlanceImages.create_and_delete_image: + - + args: + {{ glance_args(location=glance_image_location, type=glance_image_format) }} + context: + {{ user_context(tenants_amount, users_amount, use_existing_users) }} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + GlanceImages.create_and_list_image: + - + args: + {{ glance_args(location=glance_image_location, type=glance_image_format) }} + context: + {{ user_context(tenants_amount, users_amount, use_existing_users) }} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + GlanceImages.list_images: + - + context: + {{ user_context(tenants_amount, users_amount, use_existing_users) }} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + GlanceImages.create_image_and_boot_instances: + - + args: + {{ glance_args(location=glance_image_location, type=glance_image_format) }} + flavor: + name: {{ flavor_name }} + number_instances: 2 + nics: + - net-id: {{ netid }} + context: + {{ user_context(tenants_amount, users_amount, use_existing_users) }} + quotas: + {{ unlimited_nova() }} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + diff --git a/functest/opnfv_tests/openstack/rally/scenario/opnfv-keystone.yaml b/functest/opnfv_tests/openstack/rally/scenario/opnfv-keystone.yaml new file mode 100644 index 00000000..bfc9948b --- /dev/null +++ b/functest/opnfv_tests/openstack/rally/scenario/opnfv-keystone.yaml @@ -0,0 +1,92 @@ + KeystoneBasic.add_and_remove_user_role: + - + context: + {{ user_context(tenants_amount, users_amount, use_existing_users) }} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + KeystoneBasic.create_add_and_list_user_roles: + - + context: + {{ user_context(tenants_amount, users_amount, use_existing_users) }} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + KeystoneBasic.create_and_list_tenants: + - + context: + {{ user_context(tenants_amount, users_amount, use_existing_users) }} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + KeystoneBasic.create_and_delete_role: + - + context: + {{ user_context(tenants_amount, users_amount, use_existing_users) }} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + KeystoneBasic.create_and_delete_service: + - + context: + {{ user_context(tenants_amount, users_amount, use_existing_users) }} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + KeystoneBasic.get_entities: + - + context: + {{ user_context(tenants_amount, users_amount, use_existing_users) }} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + KeystoneBasic.create_update_and_delete_tenant: + - + context: + {{ user_context(tenants_amount, users_amount, use_existing_users) }} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + KeystoneBasic.create_user: + - + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + KeystoneBasic.create_tenant: + - + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + KeystoneBasic.create_and_list_users: + - + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + KeystoneBasic.create_tenant_with_users: + - + args: + users_per_tenant: 10 + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} diff --git a/functest/opnfv_tests/openstack/rally/scenario/opnfv-quotas.yaml b/functest/opnfv_tests/openstack/rally/scenario/opnfv-quotas.yaml new file mode 100644 index 00000000..a0682acc --- /dev/null +++ b/functest/opnfv_tests/openstack/rally/scenario/opnfv-quotas.yaml @@ -0,0 +1,54 @@ + Quotas.cinder_update_and_delete: + - + args: + max_quota: 1024 + context: + {{ user_context(tenants_amount, users_amount, use_existing_users) }} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + Quotas.cinder_update: + - + args: + max_quota: 1024 + context: + {{ user_context(tenants_amount, users_amount, use_existing_users) }} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + Quotas.neutron_update: + - + args: + max_quota: 1024 + context: + {{ user_context(tenants_amount, users_amount, use_existing_users) }} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + Quotas.nova_update_and_delete: + - + args: + max_quota: 1024 + context: + {{ user_context(tenants_amount, users_amount, use_existing_users) }} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + Quotas.nova_update: + - + args: + max_quota: 1024 + context: + {{ user_context(tenants_amount, users_amount, use_existing_users) }} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} diff --git a/functest/opnfv_tests/openstack/rally/scenario/opnfv-requests.yaml b/functest/opnfv_tests/openstack/rally/scenario/opnfv-requests.yaml new file mode 100644 index 00000000..16136978 --- /dev/null +++ b/functest/opnfv_tests/openstack/rally/scenario/opnfv-requests.yaml @@ -0,0 +1,11 @@ + HttpRequests.check_request: + - + args: + url: "{{ request_url }}" + method: "GET" + status_code: 200 + allow_redirects: True + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} diff --git a/functest/opnfv_tests/openstack/rally/scenario/opnfv-vm.yaml b/functest/opnfv_tests/openstack/rally/scenario/opnfv-vm.yaml new file mode 100644 index 00000000..74f50992 --- /dev/null +++ b/functest/opnfv_tests/openstack/rally/scenario/opnfv-vm.yaml @@ -0,0 +1,42 @@ + VMTasks.boot_runcommand_delete: + - + args: + {{ vm_params(image_name, flavor_name) }} + floating_network: {{ floating_network }} + force_delete: false + command: + interpreter: /bin/sh + script_file: {{ sup_dir }}/instance_dd_test.sh + username: cirros + nics: + - net-id: {{ netid }} + context: + {% call user_context(tenants_amount, users_amount, use_existing_users) %} + network: {} + {% endcall %} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + - + args: + {{ vm_params(image_name, flavor_name) }} + fixed_network: private + floating_network: {{ floating_network }} + force_delete: false + command: + interpreter: /bin/sh + script_file: {{ sup_dir }}/instance_dd_test.sh + use_floatingip: true + username: cirros + nics: + - net-id: {{ netid }} + volume_args: + size: 2 + context: + {{ user_context(tenants_amount, users_amount, use_existing_users) }} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} diff --git a/functest/opnfv_tests/openstack/rally/scenario/sanity/opnfv-cinder.yaml b/functest/opnfv_tests/openstack/rally/scenario/sanity/opnfv-cinder.yaml new file mode 100644 index 00000000..5962b1db --- /dev/null +++ b/functest/opnfv_tests/openstack/rally/scenario/sanity/opnfv-cinder.yaml @@ -0,0 +1,84 @@ + CinderVolumes.create_and_delete_snapshot: + - + args: + force: false + context: + {% call user_context(tenants_amount, users_amount, use_existing_users) %} + quotas: + {{ unlimited_volumes() }} + {{ volumes() }} + {% endcall %} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + CinderVolumes.create_and_delete_volume: + - + args: + size: + max: 1 + min: 1 + context: + {% call user_context(tenants_amount, users_amount, use_existing_users) %} + quotas: + {{ unlimited_volumes() }} + {% endcall %} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + - + args: + {{ vm_params(image_name,none,1) }} + context: + {% call user_context(tenants_amount, users_amount, use_existing_users) %} + quotas: + {{ unlimited_volumes() }} + {% endcall %} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + - + args: + size: 1 + context: + {% call user_context(tenants_amount, users_amount, use_existing_users) %} + quotas: + {{ unlimited_volumes() }} + {% endcall %} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + CinderVolumes.create_and_extend_volume: + - + args: + new_size: 2 + size: 1 + context: + {% call user_context(tenants_amount, users_amount, use_existing_users) %} + quotas: + {{ unlimited_volumes() }} + {% endcall %} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + CinderVolumes.create_from_volume_and_delete_volume: + - + args: + size: 1 + context: + {% call user_context(tenants_amount, users_amount, use_existing_users) %} + quotas: + {{ unlimited_volumes() }} + {{ volumes() }} + {% endcall %} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} diff --git a/functest/opnfv_tests/openstack/rally/scenario/sanity/opnfv-heat.yaml b/functest/opnfv_tests/openstack/rally/scenario/sanity/opnfv-heat.yaml new file mode 100644 index 00000000..dc34cc3f --- /dev/null +++ b/functest/opnfv_tests/openstack/rally/scenario/sanity/opnfv-heat.yaml @@ -0,0 +1,42 @@ + HeatStacks.create_update_delete_stack: + - + args: + template_path: "{{ tmpl_dir }}/autoscaling_policy.yaml.template" + updated_template_path: "{{ tmpl_dir }}/updated_autoscaling_policy_inplace.yaml.template" + context: + {{ user_context(tenants_amount, users_amount, use_existing_users) }} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + HeatStacks.create_check_delete_stack: + - + args: + template_path: "{{ tmpl_dir }}/random_strings.yaml.template" + context: + {{ user_context(tenants_amount, users_amount, use_existing_users) }} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + HeatStacks.create_suspend_resume_delete_stack: + - + args: + template_path: "{{ tmpl_dir }}/random_strings.yaml.template" + context: + {{ user_context(tenants_amount, users_amount, use_existing_users) }} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + HeatStacks.list_stacks_and_resources: + - + context: + {{ user_context(tenants_amount, users_amount, use_existing_users) }} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} diff --git a/functest/opnfv_tests/openstack/rally/scenario/sanity/opnfv-neutron.yaml b/functest/opnfv_tests/openstack/rally/scenario/sanity/opnfv-neutron.yaml new file mode 100644 index 00000000..159f2b63 --- /dev/null +++ b/functest/opnfv_tests/openstack/rally/scenario/sanity/opnfv-neutron.yaml @@ -0,0 +1,152 @@ + NeutronNetworks.create_and_delete_networks: + - + args: + network_create_args: {} + context: + {% call user_context(tenants_amount, users_amount, use_existing_users) %} + quotas: + neutron: + network: -1 + {% endcall %} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + NeutronNetworks.create_and_delete_ports: + - + args: + network_create_args: {} + port_create_args: {} + ports_per_network: 1 + context: + {% call user_context(tenants_amount, users_amount, use_existing_users) %} + network: {} + quotas: + neutron: + network: -1 + port: -1 + {% endcall %} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + NeutronNetworks.create_and_delete_routers: + - + args: + network_create_args: {} + router_create_args: {} + subnet_cidr_start: "1.1.0.0/30" + subnet_create_args: {} + subnets_per_network: 1 + context: + {% call user_context(tenants_amount, users_amount, use_existing_users) %} + network: {} + quotas: + neutron: + network: -1 + subnet: -1 + port: -1 + router: -1 + {% endcall %} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + NeutronNetworks.create_and_delete_subnets: + - + args: + network_create_args: {} + subnet_cidr_start: "1.1.0.0/30" + subnet_create_args: {} + subnets_per_network: 1 + context: + {% call user_context(tenants_amount, users_amount, use_existing_users) %} + network: {} + quotas: + neutron: + network: -1 + subnet: -1 + {% endcall %} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + NeutronNetworks.create_and_list_networks: + - + args: + network_create_args: {} + context: + {% call user_context(tenants_amount, users_amount, use_existing_users) %} + quotas: + neutron: + network: -1 + {% endcall %} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + NeutronNetworks.create_and_list_ports: + - + args: + network_create_args: {} + port_create_args: {} + ports_per_network: 1 + context: + {% call user_context(tenants_amount, users_amount, use_existing_users) %} + network: {} + quotas: + neutron: + network: -1 + port: -1 + {% endcall %} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + NeutronNetworks.create_and_list_routers: + - + args: + network_create_args: {} + router_create_args: {} + subnet_cidr_start: "1.1.0.0/30" + subnet_create_args: {} + subnets_per_network: 1 + context: + {% call user_context(tenants_amount, users_amount, use_existing_users) %} + network: {} + quotas: + neutron: + network: -1 + subnet: -1 + router: -1 + {% endcall %} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + NeutronNetworks.create_and_list_subnets: + - + args: + network_create_args: {} + subnet_cidr_start: "1.1.0.0/30" + subnet_create_args: {} + subnets_per_network: 1 + context: + {% call user_context(tenants_amount, users_amount, use_existing_users) %} + network: {} + quotas: + neutron: + network: -1 + subnet: -1 + {% endcall %} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} diff --git a/functest/opnfv_tests/openstack/rally/scenario/sanity/opnfv-nova.yaml b/functest/opnfv_tests/openstack/rally/scenario/sanity/opnfv-nova.yaml new file mode 100644 index 00000000..e2795cf7 --- /dev/null +++ b/functest/opnfv_tests/openstack/rally/scenario/sanity/opnfv-nova.yaml @@ -0,0 +1,140 @@ + NovaServers.boot_and_live_migrate_server: + - args: + {{ vm_params(image_name, flavor_name) }} + block_migration: false + nics: + - net-id: {{ netid }} + context: + {{ user_context(tenants_amount, users_amount, use_existing_users) }} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + NovaServers.boot_server_attach_created_volume_and_live_migrate: + - + args: + {{ vm_params(image_name, flavor_name) }} + size: 10 + block_migration: false + boot_server_kwargs: + nics: + - net-id: {{ netid }} + context: + {{ user_context(tenants_amount, users_amount, use_existing_users) }} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + NovaServers.boot_server_from_volume_and_live_migrate: + - args: + {{ vm_params(image_name, flavor_name) }} + block_migration: false + volume_size: 10 + force_delete: false + nics: + - net-id: {{ netid }} + context: + {{ user_context(tenants_amount, users_amount, use_existing_users) }} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + NovaKeypair.boot_and_delete_server_with_keypair: + - + args: + {{ vm_params(image_name, flavor_name) }} + server_kwargs: + nics: + - net-id: {{ netid }} + context: + {% call user_context(tenants_amount, users_amount, use_existing_users) %} + network: + networks_per_tenant: 1 + start_cidr: "100.1.0.0/25" + quotas: + {{ unlimited_neutron() }} + {{ unlimited_nova(keypairs=true) }} + {% endcall %} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + NovaServers.boot_server_from_volume_and_delete: + - + args: + {{ vm_params(image_name, flavor_name) }} + volume_size: 5 + nics: + - net-id: {{ netid }} + context: + {% call user_context(tenants_amount, users_amount, use_existing_users) %} + network: + networks_per_tenant: 1 + start_cidr: "100.1.0.0/25" + quotas: + {{ unlimited_volumes() }} + {{ unlimited_neutron() }} + {{ unlimited_nova() }} + {% endcall %} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + NovaServers.pause_and_unpause_server: + - + args: + {{ vm_params(image_name, flavor_name) }} + force_delete: false + nics: + - net-id: {{ netid }} + context: + {% call user_context(tenants_amount, users_amount, use_existing_users) %} + network: + networks_per_tenant: 1 + start_cidr: "100.1.0.0/25" + quotas: + {{ unlimited_neutron() }} + {{ unlimited_nova() }} + {% endcall %} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + NovaSecGroup.boot_and_delete_server_with_secgroups: + - + args: + {{ vm_params(image_name, flavor_name) }} + security_group_count: 10 + rules_per_security_group: 10 + nics: + - net-id: {{ netid }} + context: + {% call user_context(tenants_amount, users_amount, use_existing_users) %} + network: + start_cidr: "100.1.0.0/25" + quotas: + {{ unlimited_nova() }} + {{ unlimited_neutron(secgroups=true) }} + {% endcall %} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + NovaServers.boot_and_migrate_server: + - args: + {{ vm_params(image_name, flavor_name) }} + nics: + - net-id: {{ netid }} + context: + {{ user_context(tenants_amount, users_amount, use_existing_users) }} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} diff --git a/functest/opnfv_tests/openstack/rally/scenario/support/instance_dd_test.sh b/functest/opnfv_tests/openstack/rally/scenario/support/instance_dd_test.sh new file mode 100755 index 00000000..e3bf2340 --- /dev/null +++ b/functest/opnfv_tests/openstack/rally/scenario/support/instance_dd_test.sh @@ -0,0 +1,13 @@ +#!/bin/sh +time_seconds(){ (time -p $1 ) 2>&1 |awk '/real/{print $2}'; } +file=/tmp/test.img +c=${1:-$SIZE} +c=${c:-1000} #default is 1GB +write_seq=$(time_seconds "dd if=/dev/zero of=$file bs=1M count=$c") +read_seq=$(time_seconds "dd if=$file of=/dev/null bs=1M count=$c") +[ -f $file ] && rm $file + +echo "{ + \"write_seq_${c}m\": $write_seq, + \"read_seq_${c}m\": $read_seq + }" diff --git a/functest/opnfv_tests/openstack/rally/scenario/templates/autoscaling_policy.yaml.template b/functest/opnfv_tests/openstack/rally/scenario/templates/autoscaling_policy.yaml.template new file mode 100644 index 00000000..a22487e3 --- /dev/null +++ b/functest/opnfv_tests/openstack/rally/scenario/templates/autoscaling_policy.yaml.template @@ -0,0 +1,17 @@ +heat_template_version: 2013-05-23 + +resources: + test_group: + type: OS::Heat::AutoScalingGroup + properties: + desired_capacity: 0 + max_size: 0 + min_size: 0 + resource: + type: OS::Heat::RandomString + test_policy: + type: OS::Heat::ScalingPolicy + properties: + adjustment_type: change_in_capacity + auto_scaling_group_id: { get_resource: test_group } + scaling_adjustment: 1 \ No newline at end of file diff --git a/functest/opnfv_tests/openstack/rally/scenario/templates/default.yaml.template b/functest/opnfv_tests/openstack/rally/scenario/templates/default.yaml.template new file mode 100644 index 00000000..eb4f2f2d --- /dev/null +++ b/functest/opnfv_tests/openstack/rally/scenario/templates/default.yaml.template @@ -0,0 +1 @@ +heat_template_version: 2014-10-16 \ No newline at end of file diff --git a/functest/opnfv_tests/openstack/rally/scenario/templates/random_strings.yaml.template b/functest/opnfv_tests/openstack/rally/scenario/templates/random_strings.yaml.template new file mode 100644 index 00000000..2dd676c1 --- /dev/null +++ b/functest/opnfv_tests/openstack/rally/scenario/templates/random_strings.yaml.template @@ -0,0 +1,13 @@ +heat_template_version: 2014-10-16 + +description: Test template for rally create-update-delete scenario + +resources: + test_string_one: + type: OS::Heat::RandomString + properties: + length: 20 + test_string_two: + type: OS::Heat::RandomString + properties: + length: 20 \ No newline at end of file diff --git a/functest/opnfv_tests/openstack/rally/scenario/templates/resource_group.yaml.template b/functest/opnfv_tests/openstack/rally/scenario/templates/resource_group.yaml.template new file mode 100644 index 00000000..b3f505fa --- /dev/null +++ b/functest/opnfv_tests/openstack/rally/scenario/templates/resource_group.yaml.template @@ -0,0 +1,13 @@ +heat_template_version: 2014-10-16 + +description: Test template for rally create-update-delete scenario + +resources: + test_group: + type: OS::Heat::ResourceGroup + properties: + count: 2 + resource_def: + type: OS::Heat::RandomString + properties: + length: 20 \ No newline at end of file diff --git a/functest/opnfv_tests/openstack/rally/scenario/templates/server_with_ports.yaml.template b/functest/opnfv_tests/openstack/rally/scenario/templates/server_with_ports.yaml.template new file mode 100644 index 00000000..909f45d2 --- /dev/null +++ b/functest/opnfv_tests/openstack/rally/scenario/templates/server_with_ports.yaml.template @@ -0,0 +1,64 @@ +heat_template_version: 2013-05-23 + +parameters: + # set all correct defaults for parameters before launch test + public_net: + type: string + default: public + image: + type: string + default: cirros-0.3.4-x86_64-uec + flavor: + type: string + default: m1.tiny + cidr: + type: string + default: 11.11.11.0/24 + +resources: + server: + type: OS::Nova::Server + properties: + image: {get_param: image} + flavor: {get_param: flavor} + networks: + - port: { get_resource: server_port } + + router: + type: OS::Neutron::Router + properties: + external_gateway_info: + network: {get_param: public_net} + + router_interface: + type: OS::Neutron::RouterInterface + properties: + router_id: { get_resource: router } + subnet_id: { get_resource: private_subnet } + + private_net: + type: OS::Neutron::Net + + private_subnet: + type: OS::Neutron::Subnet + properties: + network: { get_resource: private_net } + cidr: {get_param: cidr} + + port_security_group: + type: OS::Neutron::SecurityGroup + properties: + name: default_port_security_group + description: > + Default security group assigned to port. The neutron default group is not + used because neutron creates several groups with the same name=default and + nova cannot chooses which one should it use. + + server_port: + type: OS::Neutron::Port + properties: + network: {get_resource: private_net} + fixed_ips: + - subnet: { get_resource: private_subnet } + security_groups: + - { get_resource: port_security_group } diff --git a/functest/opnfv_tests/openstack/rally/scenario/templates/server_with_volume.yaml.template b/functest/opnfv_tests/openstack/rally/scenario/templates/server_with_volume.yaml.template new file mode 100644 index 00000000..826ca9da --- /dev/null +++ b/functest/opnfv_tests/openstack/rally/scenario/templates/server_with_volume.yaml.template @@ -0,0 +1,43 @@ +heat_template_version: 2013-05-23 + +parameters: + # set all correct defaults for parameters before launch test + image: + type: string + default: cirros-0.3.4-x86_64-uec + flavor: + type: string + default: m1.tiny + availability_zone: + type: string + description: The Availability Zone to launch the instance. + default: nova + volume_size: + type: number + description: Size of the volume to be created. + default: 1 + constraints: + - range: { min: 1, max: 1024 } + description: must be between 1 and 1024 Gb. + network_id: + type: string + +resources: + server: + type: OS::Nova::Server + properties: + image: {get_param: image} + flavor: {get_param: flavor} + networks: + - network: { get_param: network_id } + cinder_volume: + type: OS::Cinder::Volume + properties: + size: { get_param: volume_size } + availability_zone: { get_param: availability_zone } + volume_attachment: + type: OS::Cinder::VolumeAttachment + properties: + volume_id: { get_resource: cinder_volume } + instance_uuid: { get_resource: server} + mountpoint: /dev/vdc diff --git a/functest/opnfv_tests/openstack/rally/scenario/templates/updated_autoscaling_policy_inplace.yaml.template b/functest/opnfv_tests/openstack/rally/scenario/templates/updated_autoscaling_policy_inplace.yaml.template new file mode 100644 index 00000000..cf34879c --- /dev/null +++ b/functest/opnfv_tests/openstack/rally/scenario/templates/updated_autoscaling_policy_inplace.yaml.template @@ -0,0 +1,23 @@ +heat_template_version: 2013-05-23 + +description: > + Test template for create-update-delete-stack scenario in rally. + The template updates resource parameters without resource re-creation(replacement) + in the stack defined by autoscaling_policy.yaml.template. It allows to measure + performance of "pure" resource update operation only. + +resources: + test_group: + type: OS::Heat::AutoScalingGroup + properties: + desired_capacity: 0 + max_size: 0 + min_size: 0 + resource: + type: OS::Heat::RandomString + test_policy: + type: OS::Heat::ScalingPolicy + properties: + adjustment_type: change_in_capacity + auto_scaling_group_id: { get_resource: test_group } + scaling_adjustment: -1 \ No newline at end of file diff --git a/functest/opnfv_tests/openstack/rally/scenario/templates/updated_random_strings_add.yaml.template b/functest/opnfv_tests/openstack/rally/scenario/templates/updated_random_strings_add.yaml.template new file mode 100644 index 00000000..e06d42e0 --- /dev/null +++ b/functest/opnfv_tests/openstack/rally/scenario/templates/updated_random_strings_add.yaml.template @@ -0,0 +1,19 @@ +heat_template_version: 2014-10-16 + +description: > + Test template for create-update-delete-stack scenario in rally. + The template updates the stack defined by random_strings.yaml.template with additional resource. + +resources: + test_string_one: + type: OS::Heat::RandomString + properties: + length: 20 + test_string_two: + type: OS::Heat::RandomString + properties: + length: 20 + test_string_three: + type: OS::Heat::RandomString + properties: + length: 20 \ No newline at end of file diff --git a/functest/opnfv_tests/openstack/rally/scenario/templates/updated_random_strings_delete.yaml.template b/functest/opnfv_tests/openstack/rally/scenario/templates/updated_random_strings_delete.yaml.template new file mode 100644 index 00000000..d02593e3 --- /dev/null +++ b/functest/opnfv_tests/openstack/rally/scenario/templates/updated_random_strings_delete.yaml.template @@ -0,0 +1,11 @@ +heat_template_version: 2014-10-16 + +description: > + Test template for create-update-delete-stack scenario in rally. + The template deletes one resource from the stack defined by random_strings.yaml.template. + +resources: + test_string_one: + type: OS::Heat::RandomString + properties: + length: 20 \ No newline at end of file diff --git a/functest/opnfv_tests/openstack/rally/scenario/templates/updated_random_strings_replace.yaml.template b/functest/opnfv_tests/openstack/rally/scenario/templates/updated_random_strings_replace.yaml.template new file mode 100644 index 00000000..46d8bff4 --- /dev/null +++ b/functest/opnfv_tests/openstack/rally/scenario/templates/updated_random_strings_replace.yaml.template @@ -0,0 +1,19 @@ +heat_template_version: 2014-10-16 + +description: > + Test template for create-update-delete-stack scenario in rally. + The template deletes one resource from the stack defined by + random_strings.yaml.template and re-creates it with the updated parameters + (so-called update-replace). That happens because some parameters cannot be + changed without resource re-creation. The template allows to measure performance + of update-replace operation. + +resources: + test_string_one: + type: OS::Heat::RandomString + properties: + length: 20 + test_string_two: + type: OS::Heat::RandomString + properties: + length: 40 \ No newline at end of file diff --git a/functest/opnfv_tests/openstack/rally/scenario/templates/updated_resource_group_increase.yaml.template b/functest/opnfv_tests/openstack/rally/scenario/templates/updated_resource_group_increase.yaml.template new file mode 100644 index 00000000..891074eb --- /dev/null +++ b/functest/opnfv_tests/openstack/rally/scenario/templates/updated_resource_group_increase.yaml.template @@ -0,0 +1,16 @@ +heat_template_version: 2014-10-16 + +description: > + Test template for create-update-delete-stack scenario in rally. + The template updates one resource from the stack defined by resource_group.yaml.template + and adds children resources to that resource. + +resources: + test_group: + type: OS::Heat::ResourceGroup + properties: + count: 3 + resource_def: + type: OS::Heat::RandomString + properties: + length: 20 \ No newline at end of file diff --git a/functest/opnfv_tests/openstack/rally/scenario/templates/updated_resource_group_reduce.yaml.template b/functest/opnfv_tests/openstack/rally/scenario/templates/updated_resource_group_reduce.yaml.template new file mode 100644 index 00000000..b4d1d173 --- /dev/null +++ b/functest/opnfv_tests/openstack/rally/scenario/templates/updated_resource_group_reduce.yaml.template @@ -0,0 +1,16 @@ +heat_template_version: 2014-10-16 + +description: > + Test template for create-update-delete-stack scenario in rally. + The template updates one resource from the stack defined by resource_group.yaml.template + and deletes children resources from that resource. + +resources: + test_group: + type: OS::Heat::ResourceGroup + properties: + count: 1 + resource_def: + type: OS::Heat::RandomString + properties: + length: 20 \ No newline at end of file diff --git a/functest/opnfv_tests/openstack/rally/task.yaml b/functest/opnfv_tests/openstack/rally/task.yaml new file mode 100644 index 00000000..c482f120 --- /dev/null +++ b/functest/opnfv_tests/openstack/rally/task.yaml @@ -0,0 +1,48 @@ +{%- if smoke %} +{%- set users_amount = 1 %} +{%- set tenants_amount = 1 %} +{%- endif %} + +{%- from "macro/macro.yaml" import user_context, vm_params, unlimited_volumes, constant_runner, rps_runner, no_failures_sla -%} +{%- from "macro/macro.yaml" import volumes, unlimited_nova, unlimited_neutron, glance_args -%} + +--- +{% if "authenticate" in service_list %} +{%- include "var/opnfv-authenticate.yaml"-%} +{% endif %} + +{% if "cinder" in service_list %} +{%- include "var/opnfv-cinder.yaml"-%} +{% endif %} + +{% if "keystone" in service_list %} +{%- include "var/opnfv-keystone.yaml"-%} +{% endif %} + +{% if "nova" in service_list %} +{%- include "var/opnfv-nova.yaml"-%} +{% endif %} + +{% if "glance" in service_list %} +{%- include "var/opnfv-glance.yaml"-%} +{% endif %} + +{% if "neutron" in service_list %} +{%- include "var/opnfv-neutron.yaml"-%} +{% endif %} + +{% if "quotas" in service_list %} +{%- include "var/opnfv-quotas.yaml"-%} +{% endif %} + +{% if "requests" in service_list %} +{%- include "var/opnfv-requests.yaml"-%} +{% endif %} + +{% if "heat" in service_list %} +{%- include "var/opnfv-heat.yaml"-%} +{% endif %} + +{% if "vm" in service_list %} +{%- include "var/opnfv-vm.yaml"-%} +{% endif %} diff --git a/functest/opnfv_tests/openstack/tempest/custom_tests/blacklist.txt b/functest/opnfv_tests/openstack/tempest/custom_tests/blacklist.txt new file mode 100644 index 00000000..5c8581f6 --- /dev/null +++ b/functest/opnfv_tests/openstack/tempest/custom_tests/blacklist.txt @@ -0,0 +1,96 @@ +- + scenarios: + - os-odl_l2-bgpvpn-ha + - os-odl_l2-bgpvpn-noha + installers: + - fuel + - apex + tests: + - tempest.api.compute.servers.test_create_server.ServersTestJSON.test_list_servers + - tempest.api.compute.servers.test_create_server.ServersTestJSON.test_verify_server_details + - tempest.api.compute.servers.test_create_server.ServersTestManualDisk.test_list_servers + - tempest.api.compute.servers.test_create_server.ServersTestManualDisk.test_verify_server_details + - tempest.api.compute.servers.test_server_actions.ServerActionsTestJSON.test_reboot_server_hard + - tempest.api.network.test_floating_ips.FloatingIPTestJSON.test_create_list_show_update_delete_floating_ip + - tempest.api.network.test_floating_ips.FloatingIPTestJSON.test_create_floating_ip_specifying_a_fixed_ip_address + - 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 + +- + scenarios: + - os-odl_l2-nofeature-ha + - os-odl_l2-nofeature-noha + - os-nosdn-nofeature-ha + - os-nosdn-nofeature-noha + installers: + - joid + tests: + - tempest.api.object_storage + +- + scenarios: + - os-nosdn-lxd-ha + - os-nosdn-lxd-noha + installers: + - joid + tests: + - tempest.api.object_storage + - 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 + +- + scenarios: + - os-onos-nofeature-ha + - os-onos-nofeature-noha + - os-onos-sfc-ha + - os-onos-sfc-noha + installers: + - fuel + - apex + - 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 + +- + scenarios: + - os-onos-nofeature-ha + - os-onos-nofeature-noha + - os-onos-sfc-ha + - os-onos-sfc-noha + installers: + - joid + tests: + - tempest.api.object_storage + - 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 + +- + # https://bugs.launchpad.net/tempest/+bug/1586931 + scenarios: + - os-odl_l2-nofeature-ha + - os-odl_l2-nofeature-noha + - os-odl_l2-sfc-ha + - os-odl_l2-sfc-noha + - os-odl_l3-nofeature-ha + - os-odl_l3-nofeature-noha + - os-nosdn-kvm-ha + - os-nosdn-kvm-noha + - os-nosdn-nofeature-ha + - os-nosdn-nofeature-noha + - os-nosdn-ovs-ha + - os-nosdn-ovs-noha + installers: + - fuel + tests: + - tempest.scenario.test_server_basic_ops.TestServerBasicOps.test_server_basic_ops diff --git a/functest/opnfv_tests/openstack/tempest/custom_tests/defcore_req.txt b/functest/opnfv_tests/openstack/tempest/custom_tests/defcore_req.txt new file mode 100644 index 00000000..bb1d172d --- /dev/null +++ b/functest/opnfv_tests/openstack/tempest/custom_tests/defcore_req.txt @@ -0,0 +1,122 @@ +# Set of DefCore tempest test cases (see http://www.openstack.org/brand/interop) +# This approved version (2016.01) is valid for Juno, Kilo, and Liberty releases of OpenStack +# The list is stored at http://git.openstack.org/cgit/openstack/defcore/plain/2016.01/2016.01.required.txt +tempest.api.compute.images.test_images.ImagesTestJSON.test_delete_saving_image[id-aa06b52b-2db5-4807-b218-9441f75d74e3] +tempest.api.compute.images.test_images_oneserver.ImagesOneServerTestJSON.test_create_delete_image[id-3731d080-d4c5-4872-b41a-64d0d0021314] +tempest.api.compute.images.test_images_oneserver.ImagesOneServerTestJSON.test_create_image_specify_multibyte_character_image_name[id-3b7c6fe4-dfe7-477c-9243-b06359db51e6] +tempest.api.compute.images.test_list_image_filters.ListImageFiltersTestJSON.test_list_images_filter_by_changes_since[id-18bac3ae-da27-436c-92a9-b22474d13aab] +tempest.api.compute.images.test_list_image_filters.ListImageFiltersTestJSON.test_list_images_filter_by_name[id-33163b73-79f5-4d07-a7ea-9213bcc468ff] +tempest.api.compute.images.test_list_image_filters.ListImageFiltersTestJSON.test_list_images_filter_by_server_id[id-9f238683-c763-45aa-b848-232ec3ce3105] +tempest.api.compute.images.test_list_image_filters.ListImageFiltersTestJSON.test_list_images_filter_by_server_ref[id-05a377b8-28cf-4734-a1e6-2ab5c38bf606] +tempest.api.compute.images.test_list_image_filters.ListImageFiltersTestJSON.test_list_images_filter_by_status[id-a3f5b513-aeb3-42a9-b18e-f091ef73254d] +tempest.api.compute.images.test_list_image_filters.ListImageFiltersTestJSON.test_list_images_filter_by_type[id-e3356918-4d3e-4756-81d5-abc4524ba29f] +tempest.api.compute.images.test_list_image_filters.ListImageFiltersTestJSON.test_list_images_limit_results[id-3a484ca9-67ba-451e-b494-7fcf28d32d62] +tempest.api.compute.images.test_list_image_filters.ListImageFiltersTestJSON.test_list_images_with_detail_filter_by_changes_since[id-7d439e18-ac2e-4827-b049-7e18004712c4] +tempest.api.compute.images.test_list_image_filters.ListImageFiltersTestJSON.test_list_images_with_detail_filter_by_name[id-644ea267-9bd9-4f3b-af9f-dffa02396a17] +tempest.api.compute.images.test_list_image_filters.ListImageFiltersTestJSON.test_list_images_with_detail_filter_by_server_ref[id-8c78f822-203b-4bf6-8bba-56ebd551cf84] +tempest.api.compute.images.test_list_image_filters.ListImageFiltersTestJSON.test_list_images_with_detail_filter_by_status[id-9b0ea018-6185-4f71-948a-a123a107988e] +tempest.api.compute.images.test_list_image_filters.ListImageFiltersTestJSON.test_list_images_with_detail_filter_by_type[id-888c0cc0-7223-43c5-9db0-b125fd0a393b] +tempest.api.compute.images.test_list_image_filters.ListImageFiltersTestJSON.test_list_images_with_detail_limit_results[id-ba2fa9a9-b672-47cc-b354-3b4c0600e2cb] +tempest.api.compute.images.test_list_images.ListImagesTestJSON.test_get_image[id-490d0898-e12a-463f-aef0-c50156b9f789] +tempest.api.compute.images.test_list_images.ListImagesTestJSON.test_list_images[id-fd51b7f4-d4a3-4331-9885-866658112a6f] +tempest.api.compute.images.test_list_images.ListImagesTestJSON.test_list_images_with_detail[id-9f94cb6b-7f10-48c5-b911-a0b84d7d4cd6] +tempest.api.compute.servers.test_create_server.ServersTestJSON.test_host_name_is_same_as_server_name[id-ac1ad47f-984b-4441-9274-c9079b7a0666] +tempest.api.compute.servers.test_create_server.ServersTestJSON.test_list_servers[id-9a438d88-10c6-4bcd-8b5b-5b6e25e1346f,smoke] +tempest.api.compute.servers.test_create_server.ServersTestJSON.test_list_servers_with_detail[id-585e934c-448e-43c4-acbf-d06a9b899997] +tempest.api.compute.servers.test_create_server.ServersTestJSON.test_verify_created_server_vcpus[id-cbc0f52f-05aa-492b-bdc1-84b575ca294b] +tempest.api.compute.servers.test_create_server.ServersTestJSON.test_verify_server_details[id-5de47127-9977-400a-936f-abcfbec1218f,smoke] +tempest.api.compute.servers.test_create_server.ServersTestManualDisk.test_host_name_is_same_as_server_name[id-ac1ad47f-984b-4441-9274-c9079b7a0666] +tempest.api.compute.servers.test_create_server.ServersTestManualDisk.test_list_servers[id-9a438d88-10c6-4bcd-8b5b-5b6e25e1346f,smoke] +tempest.api.compute.servers.test_create_server.ServersTestManualDisk.test_list_servers_with_detail[id-585e934c-448e-43c4-acbf-d06a9b899997] +tempest.api.compute.servers.test_create_server.ServersTestManualDisk.test_verify_created_server_vcpus[id-cbc0f52f-05aa-492b-bdc1-84b575ca294b] +tempest.api.compute.servers.test_create_server.ServersTestManualDisk.test_verify_server_details[id-5de47127-9977-400a-936f-abcfbec1218f,smoke] +tempest.api.compute.servers.test_instance_actions.InstanceActionsTestJSON.test_get_instance_action[id-aacc71ca-1d70-4aa5-bbf6-0ff71470e43c] +tempest.api.compute.servers.test_instance_actions.InstanceActionsTestJSON.test_list_instance_actions[id-77ca5cc5-9990-45e0-ab98-1de8fead201a] +tempest.api.compute.servers.test_list_server_filters.ListServerFiltersTestJSON.test_list_servers_detailed_filter_by_flavor[id-80c574cc-0925-44ba-8602-299028357dd9] +tempest.api.compute.servers.test_list_server_filters.ListServerFiltersTestJSON.test_list_servers_detailed_filter_by_image[id-b3304c3b-97df-46d2-8cd3-e2b6659724e7] +tempest.api.compute.servers.test_list_server_filters.ListServerFiltersTestJSON.test_list_servers_detailed_filter_by_server_name[id-f9eb2b70-735f-416c-b260-9914ac6181e4] +tempest.api.compute.servers.test_list_server_filters.ListServerFiltersTestJSON.test_list_servers_detailed_filter_by_server_status[id-de2612ab-b7dd-4044-b0b1-d2539601911f] +tempest.api.compute.servers.test_list_server_filters.ListServerFiltersTestJSON.test_list_servers_detailed_limit_results[id-67aec2d0-35fe-4503-9f92-f13272b867ed] +tempest.api.compute.servers.test_list_server_filters.ListServerFiltersTestJSON.test_list_servers_filter_by_flavor[id-573637f5-7325-47bb-9144-3476d0416908] +tempest.api.compute.servers.test_list_server_filters.ListServerFiltersTestJSON.test_list_servers_filter_by_image[id-05e8a8e7-9659-459a-989d-92c2f501f4ba] +tempest.api.compute.servers.test_list_server_filters.ListServerFiltersTestJSON.test_list_servers_filter_by_limit[id-614cdfc1-d557-4bac-915b-3e67b48eee76] +tempest.api.compute.servers.test_list_server_filters.ListServerFiltersTestJSON.test_list_servers_filter_by_server_name[id-9b067a7b-7fee-4f6a-b29c-be43fe18fc5a] +tempest.api.compute.servers.test_list_server_filters.ListServerFiltersTestJSON.test_list_servers_filter_by_server_status[id-ca78e20e-fddb-4ce6-b7f7-bcbf8605e66e] +tempest.api.compute.servers.test_list_server_filters.ListServerFiltersTestJSON.test_list_servers_filtered_by_ip[id-43a1242e-7b31-48d1-88f2-3f72aa9f2077] +tempest.api.compute.servers.test_list_server_filters.ListServerFiltersTestJSON.test_list_servers_filtered_by_ip_regex[id-a905e287-c35e-42f2-b132-d02b09f3654a] +tempest.api.compute.servers.test_list_server_filters.ListServerFiltersTestJSON.test_list_servers_filtered_by_name_wildcard[id-e9f624ee-92af-4562-8bec-437945a18dcb] +tempest.api.compute.servers.test_list_servers_negative.ListServersNegativeTestJSON.test_list_servers_by_changes_since_future_date[id-74745ad8-b346-45b5-b9b8-509d7447fc1f,negative] +tempest.api.compute.servers.test_list_servers_negative.ListServersNegativeTestJSON.test_list_servers_by_changes_since_invalid_date[id-87d12517-e20a-4c9c-97b6-dd1628d6d6c9,negative] +tempest.api.compute.servers.test_list_servers_negative.ListServersNegativeTestJSON.test_list_servers_by_limits[id-12c80a9f-2dec-480e-882b-98ba15757659] +tempest.api.compute.servers.test_list_servers_negative.ListServersNegativeTestJSON.test_list_servers_by_limits_greater_than_actual_count[id-d47c17fb-eebd-4287-8e95-f20a7e627b18,negative] +tempest.api.compute.servers.test_list_servers_negative.ListServersNegativeTestJSON.test_list_servers_by_limits_pass_negative_value[id-62610dd9-4713-4ee0-8beb-fd2c1aa7f950,negative] +tempest.api.compute.servers.test_list_servers_negative.ListServersNegativeTestJSON.test_list_servers_by_limits_pass_string[id-679bc053-5e70-4514-9800-3dfab1a380a6,negative] +tempest.api.compute.servers.test_list_servers_negative.ListServersNegativeTestJSON.test_list_servers_by_non_existing_flavor[id-5913660b-223b-44d4-a651-a0fbfd44ca75,negative] +tempest.api.compute.servers.test_list_servers_negative.ListServersNegativeTestJSON.test_list_servers_by_non_existing_image[id-ff01387d-c7ad-47b4-ae9e-64fa214638fe,negative] +tempest.api.compute.servers.test_list_servers_negative.ListServersNegativeTestJSON.test_list_servers_by_non_existing_server_name[id-e2c77c4a-000a-4af3-a0bd-629a328bde7c,negative] +tempest.api.compute.servers.test_list_servers_negative.ListServersNegativeTestJSON.test_list_servers_detail_server_is_deleted[id-93055106-2d34-46fe-af68-d9ddbf7ee570,negative] +tempest.api.compute.servers.test_list_servers_negative.ListServersNegativeTestJSON.test_list_servers_status_non_existing[id-fcdf192d-0f74-4d89-911f-1ec002b822c4,negative] +tempest.api.compute.servers.test_list_servers_negative.ListServersNegativeTestJSON.test_list_servers_with_a_deleted_server[id-24a26f1a-1ddc-4eea-b0d7-a90cc874ad8f,negative] +tempest.api.compute.servers.test_server_actions.ServerActionsTestJSON.test_lock_unlock_server[id-80a8094c-211e-440a-ab88-9e59d556c7ee] +tempest.api.compute.servers.test_server_actions.ServerActionsTestJSON.test_reboot_server_hard[id-2cb1baf6-ac8d-4429-bf0d-ba8a0ba53e32,smoke] +tempest.api.compute.servers.test_server_actions.ServerActionsTestJSON.test_rebuild_server[id-aaa6cdf3-55a7-461a-add9-1c8596b9a07c] +tempest.api.compute.servers.test_server_actions.ServerActionsTestJSON.test_resize_server_confirm[id-1499262a-9328-4eda-9068-db1ac57498d2] +tempest.api.compute.servers.test_server_actions.ServerActionsTestJSON.test_resize_server_revert[id-c03aab19-adb1-44f5-917d-c419577e9e68] +tempest.api.compute.servers.test_server_actions.ServerActionsTestJSON.test_stop_start_server[id-af8eafd4-38a7-4a4b-bdbc-75145a580560] +tempest.api.compute.servers.test_server_metadata.ServerMetadataTestJSON.test_delete_server_metadata_item[id-127642d6-4c7b-4486-b7cd-07265a378658] +tempest.api.compute.servers.test_server_metadata.ServerMetadataTestJSON.test_get_server_metadata_item[id-3043c57d-7e0e-49a6-9a96-ad569c265e6a] +tempest.api.compute.servers.test_server_metadata.ServerMetadataTestJSON.test_list_server_metadata[id-479da087-92b3-4dcf-aeb3-fd293b2d14ce] +tempest.api.compute.servers.test_server_metadata.ServerMetadataTestJSON.test_set_server_metadata[id-211021f6-21de-4657-a68f-908878cfe251] +tempest.api.compute.servers.test_server_metadata.ServerMetadataTestJSON.test_set_server_metadata_item[id-58c02d4f-5c67-40be-8744-d3fa5982eb1c] +tempest.api.compute.servers.test_server_metadata.ServerMetadataTestJSON.test_update_server_metadata[id-344d981e-0c33-4997-8a5d-6c1d803e4134] +tempest.api.compute.servers.test_servers.ServersTestJSON.test_create_server_with_admin_password[id-b92d5ec7-b1dd-44a2-87e4-45e888c46ef0] +tempest.api.compute.servers.test_servers.ServersTestJSON.test_create_specify_keypair[id-f9e15296-d7f9-4e62-b53f-a04e89160833] +tempest.api.compute.servers.test_servers.ServersTestJSON.test_create_with_existing_server_name[id-8fea6be7-065e-47cf-89b8-496e6f96c699] +tempest.api.compute.servers.test_servers.ServersTestJSON.test_update_access_server_address[id-89b90870-bc13-4b73-96af-f9d4f2b70077] +tempest.api.compute.servers.test_servers.ServersTestJSON.test_update_server_name[id-5e6ccff8-349d-4852-a8b3-055df7988dd2] +tempest.api.compute.servers.test_servers_negative.ServersNegativeTestJSON.test_create_numeric_server_name[id-fd57f159-68d6-4c2a-902b-03070828a87e,negative] +tempest.api.compute.servers.test_servers_negative.ServersNegativeTestJSON.test_create_server_metadata_exceeds_length_limit[id-7fc74810-0bd2-4cd7-8244-4f33a9db865a,negative] +tempest.api.compute.servers.test_servers_negative.ServersNegativeTestJSON.test_create_server_name_length_exceeds_256[id-c3e0fb12-07fc-4d76-a22e-37409887afe8,negative] +tempest.api.compute.servers.test_servers_negative.ServersNegativeTestJSON.test_create_with_invalid_flavor[id-18f5227f-d155-4429-807c-ccb103887537,negative] +tempest.api.compute.servers.test_servers_negative.ServersNegativeTestJSON.test_create_with_invalid_image[id-fcba1052-0a50-4cf3-b1ac-fae241edf02f,negative] +tempest.api.compute.servers.test_servers_negative.ServersNegativeTestJSON.test_create_with_invalid_network_uuid[id-4e72dc2d-44c5-4336-9667-f7972e95c402,negative] +tempest.api.compute.servers.test_servers_negative.ServersNegativeTestJSON.test_delete_server_pass_id_exceeding_length_limit[id-f4d7279b-5fd2-4bf2-9ba4-ae35df0d18c5,negative] +tempest.api.compute.servers.test_servers_negative.ServersNegativeTestJSON.test_delete_server_pass_negative_id[id-75f79124-277c-45e6-a373-a1d6803f4cc4,negative] +tempest.api.compute.servers.test_servers_negative.ServersNegativeTestJSON.test_get_non_existent_server[id-3436b02f-1b1e-4f03-881e-c6a602327439,negative] +tempest.api.compute.servers.test_servers_negative.ServersNegativeTestJSON.test_invalid_ip_v6_address[id-5226dd80-1e9c-4d8a-b5f9-b26ca4763fd0,negative] +tempest.api.compute.servers.test_servers_negative.ServersNegativeTestJSON.test_reboot_non_existent_server[id-d4c023a0-9c55-4747-9dd5-413b820143c7,negative] +tempest.api.compute.servers.test_servers_negative.ServersNegativeTestJSON.test_rebuild_deleted_server[id-98fa0458-1485-440f-873b-fe7f0d714930,negative] +tempest.api.compute.servers.test_servers_negative.ServersNegativeTestJSON.test_rebuild_non_existent_server[id-d86141a7-906e-4731-b187-d64a2ea61422,negative] +tempest.api.compute.servers.test_servers_negative.ServersNegativeTestJSON.test_resize_server_with_non_existent_flavor[id-ced1a1d7-2ab6-45c9-b90f-b27d87b30efd,negative] +tempest.api.compute.servers.test_servers_negative.ServersNegativeTestJSON.test_resize_server_with_null_flavor[id-45436a7d-a388-4a35-a9d8-3adc5d0d940b,negative] +tempest.api.compute.servers.test_servers_negative.ServersNegativeTestJSON.test_server_name_blank[id-dbbfd247-c40c-449e-8f6c-d2aa7c7da7cf,negative] +tempest.api.compute.servers.test_servers_negative.ServersNegativeTestJSON.test_stop_non_existent_server[id-a31460a9-49e1-42aa-82ee-06e0bb7c2d03,negative] +tempest.api.compute.servers.test_servers_negative.ServersNegativeTestJSON.test_update_name_of_non_existent_server[id-aa8eed43-e2cb-4ebf-930b-da14f6a21d81,negative] +tempest.api.compute.servers.test_servers_negative.ServersNegativeTestJSON.test_update_server_name_length_exceeds_256[id-5c8e244c-dada-4590-9944-749c455b431f,negative] +tempest.api.compute.servers.test_servers_negative.ServersNegativeTestJSON.test_update_server_set_empty_name[id-38204696-17c6-44da-9590-40f87fb5a899,negative] +tempest.api.compute.servers.test_servers_negative.ServersNegativeTestMultiTenantJSON.test_delete_a_server_of_another_tenant[id-5c75009d-3eea-423e-bea3-61b09fd25f9c,negative] +tempest.api.compute.servers.test_servers_negative.ServersNegativeTestMultiTenantJSON.test_update_server_of_another_tenant[id-543d84c1-dd2e-4c6d-8cb2-b9da0efaa384,negative] +tempest.api.compute.test_quotas.QuotasTestJSON.test_get_default_quotas[id-9bfecac7-b966-4f47-913f-1a9e2c12134a] +tempest.api.compute.test_quotas.QuotasTestJSON.test_get_quotas[id-f1ef0a97-dbbb-4cca-adc5-c9fbc4f76107] +tempest.api.compute.volumes.test_attach_volume.AttachVolumeTestJSON.test_attach_detach_volume[id-52e9045a-e90d-4c0d-9087-79d657faffff] +tempest.api.compute.volumes.test_attach_volume.AttachVolumeTestJSON.test_list_get_volume_attachments[id-7fa563fe-f0f7-43eb-9e22-a1ece036b513] +tempest.api.compute.volumes.test_volumes_list.VolumesTestJSON.test_volume_list[id-bc2dd1a0-15af-48e5-9990-f2e75a48325d] +tempest.api.compute.volumes.test_volumes_list.VolumesTestJSON.test_volume_list_with_details[id-bad0567a-5a4f-420b-851e-780b55bb867c] +tempest.api.compute.volumes.test_volumes_negative.VolumesNegativeTest.test_get_invalid_volume_id[id-f01904f2-e975-4915-98ce-cb5fa27bde4f,negative] +tempest.api.compute.volumes.test_volumes_negative.VolumesNegativeTest.test_get_volume_without_passing_volume_id[id-62bab09a-4c03-4617-8cca-8572bc94af9b,negative] +tempest.api.identity.v3.test_tokens.TokensV3Test.test_create_token[id-6f8e4436-fc96-4282-8122-e41df57197a9] +tempest.api.image.v2.test_images.ListImagesTest.test_list_no_params[id-1e341d7a-90a9-494c-b143-2cdf2aeb6aee] +tempest.api.image.v1.test_images.ListImagesTest.test_index_no_params[id-246178ab-3b33-4212-9a4b-a7fe8261794d] +tempest.api.object_storage.test_object_expiry.ObjectExpiryTest.test_get_object_after_expiry_time[id-fb024a42-37f3-4ba5-9684-4f40a7910b41] +tempest.api.object_storage.test_object_services.ObjectTest.test_copy_object_2d_way[id-06f90388-2d0e-40aa-934c-e9a8833e958a] +tempest.api.object_storage.test_object_services.ObjectTest.test_copy_object_across_containers[id-aa467252-44f3-472a-b5ae-5b57c3c9c147] +tempest.api.object_storage.test_object_services.ObjectTest.test_copy_object_in_same_container[id-1a9ab572-1b66-4981-8c21-416e2a5e6011] +tempest.api.object_storage.test_object_services.ObjectTest.test_copy_object_to_itself[id-2248abba-415d-410b-9c30-22dff9cd6e67] +tempest.api.object_storage.test_object_services.ObjectTest.test_create_object[id-5b4ce26f-3545-46c9-a2ba-5754358a4c62,smoke] +tempest.api.object_storage.test_object_services.ObjectTest.test_delete_object[id-17738d45-03bd-4d45-9e0b-7b2f58f98687] +tempest.api.object_storage.test_object_services.ObjectTest.test_get_object[id-02610ba7-86b7-4272-9ed8-aa8d417cb3cd,smoke] +tempest.api.object_storage.test_object_services.ObjectTest.test_get_object_if_different[id-50d01f12-526f-4360-9ac2-75dd508d7b68] +tempest.api.object_storage.test_object_services.ObjectTest.test_object_upload_in_segments[id-e3e6a64a-9f50-4955-b987-6ce6767c97fb] +tempest.api.object_storage.test_object_temp_url.ObjectTempUrlTest.test_get_object_using_temp_url[id-f91c96d4-1230-4bba-8eb9-84476d18d991] +tempest.api.object_storage.test_object_temp_url.ObjectTempUrlTest.test_put_object_using_temp_url[id-9b08dade-3571-4152-8a4f-a4f2a873a735] +tempest.api.object_storage.test_object_version.ContainerTest.test_versioned_container[id-a151e158-dcbf-4a1f-a1e7-46cd65895a6f] diff --git a/functest/opnfv_tests/openstack/tempest/gen_tempest_conf.py b/functest/opnfv_tests/openstack/tempest/gen_tempest_conf.py new file mode 100755 index 00000000..8e298d36 --- /dev/null +++ b/functest/opnfv_tests/openstack/tempest/gen_tempest_conf.py @@ -0,0 +1,128 @@ +#!/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 +# +# Execute Multisite Tempest test cases +## + +import ConfigParser +import os +import re +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 +import functest.utils.functest_constants as ft_constants + +logger = ft_logger.Logger("gen_tempest_conf").getLogger() + +CI_INSTALLER_TYPE = ft_constants.CI_INSTALLER_TYPE +CI_INSTALLER_IP = ft_constants.CI_INSTALLER_IP + + +def configure_tempest_multisite(deployment_dir): + """ + Add/update needed parameters into tempest.conf file generated by Rally + """ + logger.debug("configure the tempest") + configure_tempest(deployment_dir) + + logger.debug("Finding tempest.conf file...") + tempest_conf_old = os.path.join(deployment_dir, '/tempest.conf') + if not os.path.isfile(tempest_conf_old): + logger.error("Tempest configuration file %s NOT found." + % tempest_conf_old) + exit(-1) + + # Copy tempest.conf to /home/opnfv/functest/results/tempest/ + cur_path = os.path.split(os.path.realpath(__file__))[0] + tempest_conf_file = os.path.join(cur_path, '/tempest_multisite.conf') + shutil.copyfile(tempest_conf_old, tempest_conf_file) + + logger.debug("Updating selected tempest.conf parameters...") + config = ConfigParser.RawConfigParser() + config.read(tempest_conf_file) + + config.set('service_available', 'kingbird', 'true') + cmd = "openstack endpoint show kingbird | grep publicurl |\ + awk '{print $4}' | awk -F '/' '{print $4}'" + kingbird_api_version = os.popen(cmd).read() + if CI_INSTALLER_TYPE == 'fuel': + # For MOS based setup, the service is accessible + # via bind host + kingbird_conf_path = "/etc/kingbird/kingbird.conf" + installer_type = CI_INSTALLER_TYPE + installer_ip = CI_INSTALLER_IP + installer_username = ft_utils.get_functest_config( + "multisite." + installer_type + + "_environment.installer_username") + installer_password = ft_utils.get_functest_config( + "multisite." + installer_type + + "_environment.installer_password") + + ssh_options = "-o UserKnownHostsFile=/dev/null -o \ + StrictHostKeyChecking=no" + + # Get the controller IP from the fuel node + cmd = 'sshpass -p %s ssh 2>/dev/null %s %s@%s \ + \'fuel node --env 1| grep controller | grep "True\| 1" \ + | awk -F\| "{print \$5}"\'' % (installer_password, + ssh_options, + installer_username, + installer_ip) + multisite_controller_ip = \ + "".join(os.popen(cmd).read().split()) + + # Login to controller and get bind host details + cmd = 'sshpass -p %s ssh 2>/dev/null %s %s@%s "ssh %s \\" \ + grep -e "^bind_" %s \\""' % (installer_password, + ssh_options, + installer_username, + installer_ip, + multisite_controller_ip, + kingbird_conf_path) + bind_details = os.popen(cmd).read() + bind_details = "".join(bind_details.split()) + # Extract port number from the bind details + bind_port = re.findall(r"\D(\d{4})", bind_details)[0] + # Extract ip address from the bind details + bind_host = re.findall(r"\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}", + bind_details)[0] + kingbird_endpoint_url = "http://" + bind_host + ":" + bind_port + \ + "/" + else: + cmd = "openstack endpoint show kingbird | grep publicurl |\ + awk '{print $4}' | awk -F '/' '{print $3}'" + kingbird_endpoint_url = os.popen(cmd).read() + + try: + config.add_section("kingbird") + except Exception: + logger.info('kingbird section exist') + config.set('kingbird', 'endpoint_type', 'publicURL') + config.set('kingbird', 'TIME_TO_SYNC', '20') + config.set('kingbird', 'endpoint_url', kingbird_endpoint_url) + config.set('kingbird', 'api_version', kingbird_api_version) + with open(tempest_conf_file, 'wb') as config_file: + config.write(config_file) + + return True + + +def main(): + + if not os.path.exists(TEMPEST_RESULTS_DIR): + os.makedirs(TEMPEST_RESULTS_DIR) + + deployment_dir = ft_utils.get_deployment_dir() + configure_tempest_multisite(deployment_dir) + + +if __name__ == '__main__': + main() diff --git a/functest/opnfv_tests/openstack/tempest/run_tempest.py b/functest/opnfv_tests/openstack/tempest/run_tempest.py new file mode 100755 index 00000000..cbf92c1f --- /dev/null +++ b/functest/opnfv_tests/openstack/tempest/run_tempest.py @@ -0,0 +1,450 @@ +#!/usr/bin/env python +# +# Description: +# Runs tempest and pushes the results to the DB +# +# Authors: +# morgan.richomme@orange.com +# jose.lausuch@ericsson.com +# viktor.tikkanen@nokia.com +# +# 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 subprocess +import sys +import time + +import argparse +import yaml + +import functest.utils.functest_logger as ft_logger +import functest.utils.functest_utils as ft_utils +import functest.utils.openstack_utils as os_utils +import functest.utils.functest_constants as ft_constants + +modes = ['full', 'smoke', 'baremetal', 'compute', 'data_processing', + 'identity', 'image', 'network', 'object_storage', 'orchestration', + 'telemetry', 'volume', 'custom', 'defcore', 'feature_multisite'] + +""" tests configuration """ +parser = argparse.ArgumentParser() +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") +parser.add_argument("-c", "--conf", + help="User-specified Tempest config file location", + default="") + +args = parser.parse_args() + +""" logging configuration """ +logger = ft_logger.Logger("run_tempest").getLogger() + +GLANCE_IMAGE_NAME = ft_constants.GLANCE_IMAGE_NAME +GLANCE_IMAGE_FILENAME = ft_constants.GLANCE_IMAGE_FILENAME +GLANCE_IMAGE_FORMAT = ft_constants.GLANCE_IMAGE_FORMAT +GLANCE_IMAGE_PATH = ft_constants.FUNCTEST_DATA_DIR + \ + "/" + GLANCE_IMAGE_FILENAME +IMAGE_ID_ALT = None + +FLAVOR_NAME = ft_constants.FLAVOR_NAME +FLAVOR_RAM = ft_constants.FLAVOR_RAM +FLAVOR_DISK = ft_constants.FLAVOR_DISK +FLAVOR_VCPUS = ft_constants.FLAVOR_VCPUS +FLAVOR_ID_ALT = None + +TEMPEST_PRIVATE_NET_NAME = ft_constants.TEMPEST_PRIVATE_NET_NAME +TEMPEST_PRIVATE_SUBNET_NAME = ft_constants.TEMPEST_PRIVATE_SUBNET_NAME +TEMPEST_PRIVATE_SUBNET_CIDR = ft_constants.TEMPEST_PRIVATE_SUBNET_CIDR +TEMPEST_ROUTER_NAME = ft_constants.TEMPEST_ROUTER_NAME +TEMPEST_TENANT_NAME = ft_constants.TEMPEST_TENANT_NAME +TEMPEST_TENANT_DESCRIPTION = ft_constants.TEMPEST_TENANT_DESCRIPTION +TEMPEST_USER_NAME = ft_constants.TEMPEST_USER_NAME +TEMPEST_USER_PASSWORD = ft_constants.TEMPEST_USER_PASSWORD +TEMPEST_SSH_TIMEOUT = ft_constants.TEMPEST_SSH_TIMEOUT +TEMPEST_USE_CUSTOM_IMAGES = ft_constants.TEMPEST_USE_CUSTOM_IMAGES +TEMPEST_USE_CUSTOM_FLAVORS = ft_constants.TEMPEST_USE_CUSTOM_FLAVORS + +RESULTS_DIR = ft_constants.FUNCTEST_RESULTS_DIR +TEMPEST_RESULTS_DIR = os.path.join(RESULTS_DIR, 'tempest') + +REPO_PATH = ft_constants.FUNCTEST_REPO_DIR +TEMPEST_TEST_LIST_DIR = ft_constants.TEMPEST_TEST_LIST_DIR +TEMPEST_CUSTOM = os.path.join(REPO_PATH, TEMPEST_TEST_LIST_DIR, + 'test_list.txt') +TEMPEST_BLACKLIST = os.path.join(REPO_PATH, TEMPEST_TEST_LIST_DIR, + 'blacklist.txt') +TEMPEST_DEFCORE = os.path.join(REPO_PATH, TEMPEST_TEST_LIST_DIR, + 'defcore_req.txt') +TEMPEST_RAW_LIST = os.path.join(TEMPEST_RESULTS_DIR, 'test_raw_list.txt') +TEMPEST_LIST = os.path.join(TEMPEST_RESULTS_DIR, 'test_list.txt') + + +class GlobalVariables: + IMAGE_ID = None + FLAVOR_ID = None + MODE = "smoke" + + +def get_info(file_result): + test_run = "" + duration = "" + test_failed = "" + + p = subprocess.Popen('cat tempest.log', + shell=True, stdout=subprocess.PIPE, + stderr=subprocess.STDOUT) + for line in p.stdout.readlines(): + # print line, + if (len(test_run) < 1): + test_run = re.findall("[0-9]*\.[0-9]*s", line) + if (len(duration) < 1): + duration = re.findall("[0-9]*\ tests", line) + regexp = r"(failures=[0-9]+)" + if (len(test_failed) < 1): + test_failed = re.findall(regexp, line) + + logger.debug("test_run:" + test_run) + logger.debug("duration:" + duration) + + +def create_tempest_resources(): + keystone_client = os_utils.get_keystone_client() + + logger.debug("Creating tenant and user for Tempest suite") + tenant_id = os_utils.create_tenant(keystone_client, + TEMPEST_TENANT_NAME, + TEMPEST_TENANT_DESCRIPTION) + if not tenant_id: + logger.error("Error : Failed to create %s tenant" + % TEMPEST_TENANT_NAME) + + user_id = os_utils.create_user(keystone_client, TEMPEST_USER_NAME, + TEMPEST_USER_PASSWORD, + None, tenant_id) + if not user_id: + logger.error("Error : Failed to create %s user" % TEMPEST_USER_NAME) + + logger.debug("Creating private network for Tempest suite") + network_dic = \ + os_utils.create_shared_network_full(TEMPEST_PRIVATE_NET_NAME, + TEMPEST_PRIVATE_SUBNET_NAME, + TEMPEST_ROUTER_NAME, + TEMPEST_PRIVATE_SUBNET_CIDR) + if not network_dic: + exit(1) + + if TEMPEST_USE_CUSTOM_IMAGES: + # adding alternative image should be trivial should we need it + logger.debug("Creating image for Tempest suite") + _, GlobalVariables.IMAGE_ID = os_utils.get_or_create_image( + GLANCE_IMAGE_NAME, GLANCE_IMAGE_PATH, GLANCE_IMAGE_FORMAT) + if not GlobalVariables.IMAGE_ID: + exit(-1) + + if TEMPEST_USE_CUSTOM_FLAVORS: + # adding alternative flavor should be trivial should we need it + logger.debug("Creating flavor for Tempest suite") + _, GlobalVariables.FLAVOR_ID = os_utils.get_or_create_flavor( + FLAVOR_NAME, FLAVOR_RAM, FLAVOR_DISK, FLAVOR_VCPUS) + if not GlobalVariables.FLAVOR_ID: + exit(-1) + + +def configure_tempest(deployment_dir): + """ + Add/update needed parameters into tempest.conf file generated by Rally + """ + + tempest_conf_file = deployment_dir + "/tempest.conf" + if os.path.isfile(tempest_conf_file): + logger.debug("Deleting old tempest.conf file...") + os.remove(tempest_conf_file) + + logger.debug("Generating new tempest.conf file...") + cmd = "rally verify genconfig" + ft_utils.execute_command(cmd) + + logger.debug("Finding tempest.conf file...") + if not os.path.isfile(tempest_conf_file): + logger.error("Tempest configuration file %s NOT found." + % tempest_conf_file) + exit(-1) + + logger.debug("Updating selected tempest.conf parameters...") + config = ConfigParser.RawConfigParser() + config.read(tempest_conf_file) + config.set('compute', 'fixed_network_name', TEMPEST_PRIVATE_NET_NAME) + if TEMPEST_USE_CUSTOM_IMAGES: + if GlobalVariables.IMAGE_ID is not None: + config.set('compute', 'image_ref', GlobalVariables.IMAGE_ID) + if IMAGE_ID_ALT is not None: + config.set('compute', 'image_ref_alt', IMAGE_ID_ALT) + if TEMPEST_USE_CUSTOM_FLAVORS: + if GlobalVariables.FLAVOR_ID is not None: + config.set('compute', 'flavor_ref', GlobalVariables.FLAVOR_ID) + if FLAVOR_ID_ALT is not None: + config.set('compute', 'flavor_ref_alt', FLAVOR_ID_ALT) + config.set('identity', 'tenant_name', TEMPEST_TENANT_NAME) + config.set('identity', 'username', TEMPEST_USER_NAME) + config.set('identity', 'password', TEMPEST_USER_PASSWORD) + config.set('validation', 'ssh_timeout', TEMPEST_SSH_TIMEOUT) + + if ft_constants.OS_ENDPOINT_TYPE is not None: + services_list = ['compute', 'volume', 'image', 'network', + 'data-processing', 'object-storage', 'orchestration'] + sections = config.sections() + for service in services_list: + if service not in sections: + config.add_section(service) + config.set(service, 'endpoint_type', + ft_constants.OS_ENDPOINT_TYPE) + + with open(tempest_conf_file, 'wb') as config_file: + config.write(config_file) + + # Copy tempest.conf to /home/opnfv/functest/results/tempest/ + shutil.copyfile(tempest_conf_file, TEMPEST_RESULTS_DIR + '/tempest.conf') + return True + + +def read_file(filename): + with open(filename) as src: + return [line.strip() for line in src.readlines()] + + +def generate_test_list(deployment_dir, mode): + logger.debug("Generating test case list...") + if mode == 'defcore': + shutil.copyfile(TEMPEST_DEFCORE, TEMPEST_RAW_LIST) + elif mode == 'custom': + if os.path.isfile(TEMPEST_CUSTOM): + shutil.copyfile(TEMPEST_CUSTOM, TEMPEST_RAW_LIST) + else: + logger.error("Tempest test list file %s NOT found." + % TEMPEST_CUSTOM) + exit(-1) + else: + if mode == 'smoke': + testr_mode = "smoke" + elif mode == 'feature_multisite': + testr_mode = " | grep -i kingbird " + elif mode == 'full': + testr_mode = "" + else: + testr_mode = 'tempest.api.' + mode + cmd = ("cd " + deployment_dir + ";" + "testr list-tests " + + testr_mode + ">" + TEMPEST_RAW_LIST + ";cd") + ft_utils.execute_command(cmd) + + +def apply_tempest_blacklist(): + logger.debug("Applying tempest blacklist...") + cases_file = read_file(TEMPEST_RAW_LIST) + result_file = open(TEMPEST_LIST, 'w') + black_tests = [] + try: + installer_type = ft_constants.CI_INSTALLER_TYPE + deploy_scenario = ft_constants.CI_SCENARIO + if (bool(installer_type) * bool(deploy_scenario)): + # if INSTALLER_TYPE and DEPLOY_SCENARIO are set we read the file + black_list_file = open(TEMPEST_BLACKLIST) + black_list_yaml = yaml.safe_load(black_list_file) + black_list_file.close() + for item in black_list_yaml: + scenarios = item['scenarios'] + installers = item['installers'] + if (deploy_scenario in scenarios and + installer_type in installers): + tests = item['tests'] + for test in tests: + black_tests.append(test) + break + except: + black_tests = [] + logger.debug("Tempest blacklist file does not exist.") + + for cases_line in cases_file: + for black_tests_line in black_tests: + if black_tests_line in cases_line: + break + else: + result_file.write(str(cases_line) + '\n') + result_file.close() + + +def run_tempest(OPTION): + # + # the "main" function of the script which launches Rally to run Tempest + # :param option: tempest option (smoke, ..) + # :return: void + # + logger.info("Starting Tempest test suite: '%s'." % OPTION) + start_time = time.time() + stop_time = start_time + cmd_line = "rally verify start " + OPTION + " --system-wide" + + header = ("Tempest environment:\n" + " Installer: %s\n Scenario: %s\n Node: %s\n Date: %s\n" % + (ft_constants.CI_INSTALLER_TYPE, + ft_constants.CI_SCENARIO, + ft_constants.CI_NODE, + time.strftime("%a %b %d %H:%M:%S %Z %Y"))) + + f_stdout = open(TEMPEST_RESULTS_DIR + "/tempest.log", 'w+') + f_stderr = open(TEMPEST_RESULTS_DIR + "/tempest-error.log", 'w+') + f_env = open(TEMPEST_RESULTS_DIR + "/environment.log", 'w+') + f_env.write(header) + + # subprocess.call(cmd_line, shell=True, stdout=f_stdout, stderr=f_stderr) + p = subprocess.Popen( + cmd_line, shell=True, + stdout=subprocess.PIPE, + stderr=f_stderr, + bufsize=1) + + with p.stdout: + for line in iter(p.stdout.readline, b''): + if re.search("\} tempest\.", line): + logger.info(line.replace('\n', '')) + f_stdout.write(line) + p.wait() + + f_stdout.close() + f_stderr.close() + f_env.close() + + cmd_line = "rally verify show" + output = "" + p = subprocess.Popen( + cmd_line, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + for line in p.stdout: + if re.search("Tests\:", line): + break + output += line + logger.info(output) + + cmd_line = "rally verify list" + cmd = os.popen(cmd_line) + output = (((cmd.read()).splitlines()[-2]).replace(" ", "")).split("|") + # Format: + # | UUID | Deployment UUID | smoke | tests | failures | Created at | + # Duration | Status | + num_tests = output[4] + num_failures = output[5] + time_start = output[6] + duration = output[7] + # Compute duration (lets assume it does not take more than 60 min) + dur_min = int(duration.split(':')[1]) + dur_sec_float = float(duration.split(':')[2]) + dur_sec_int = int(round(dur_sec_float, 0)) + dur_sec_int = dur_sec_int + 60 * dur_min + stop_time = time.time() + + try: + diff = (int(num_tests) - int(num_failures)) + success_rate = 100 * diff / int(num_tests) + except: + success_rate = 0 + + 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' + + status = ft_utils.check_success_rate(case_name, success_rate) + logger.info("Tempest %s success_rate is %s%%, is marked as %s" + % (case_name, success_rate, status)) + + # Push results in payload of testcase + if args.report: + # add the test in error in the details sections + # should be possible to do it during the test + logger.debug("Pushing tempest results into DB...") + with open(TEMPEST_RESULTS_DIR + "/tempest.log", 'r') as myfile: + output = myfile.read() + error_logs = "" + + for match in re.findall('(.*?)[. ]*FAILED', output): + error_logs += match + + # Generate json results for DB + json_results = {"timestart": time_start, "duration": dur_sec_int, + "tests": int(num_tests), "failures": int(num_failures), + "errors": error_logs} + logger.info("Results: " + str(json_results)) + # split Tempest smoke and full + + try: + ft_utils.push_results_to_db("functest", + case_name, + start_time, + stop_time, + status, + json_results) + except: + logger.error("Error pushing results into Database '%s'" + % sys.exc_info()[0]) + + if status == "PASS": + return 0 + else: + return -1 + + +def main(): + + if not (args.mode in modes): + logger.error("Tempest mode not valid. " + "Possible values are:\n" + str(modes)) + exit(-1) + + if not os.path.exists(TEMPEST_RESULTS_DIR): + os.makedirs(TEMPEST_RESULTS_DIR) + + deployment_dir = ft_utils.get_deployment_dir() + create_tempest_resources() + + if "" == args.conf: + GlobalVariables.MODE = "" + configure_tempest(deployment_dir) + else: + GlobalVariables.MODE = " --tempest-config " + args.conf + + generate_test_list(deployment_dir, args.mode) + apply_tempest_blacklist() + + GlobalVariables.MODE += " --tests-file " + TEMPEST_LIST + if args.serial: + GlobalVariables.MODE += " --concur 1" + + ret_val = run_tempest(GlobalVariables.MODE) + if ret_val != 0: + sys.exit(-1) + + sys.exit(0) + + +if __name__ == '__main__': + main() diff --git a/functest/opnfv_tests/openstack/vping/__init__.py b/functest/opnfv_tests/openstack/vping/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/functest/opnfv_tests/openstack/vping/ping.sh b/functest/opnfv_tests/openstack/vping/ping.sh new file mode 100755 index 00000000..693b8682 --- /dev/null +++ b/functest/opnfv_tests/openstack/vping/ping.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +while true; do + ping -c 1 $1 2>&1 >/dev/null + RES=$? + if [ "Z$RES" = "Z0" ] ; then + echo 'vPing OK' + break + else + echo 'vPing KO' + fi + sleep 1 +done \ No newline at end of file diff --git a/functest/opnfv_tests/openstack/vping/vping_base.py b/functest/opnfv_tests/openstack/vping/vping_base.py new file mode 100644 index 00000000..7d56e9da --- /dev/null +++ b/functest/opnfv_tests/openstack/vping/vping_base.py @@ -0,0 +1,297 @@ +#!/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 os +import pprint +import time +from datetime import datetime + +import functest.utils.functest_utils as ft_utils +import functest.utils.openstack_utils as os_utils +from functest.core import TestCasesBase + + +class VPingBase(TestCasesBase.TestCasesBase): + def __init__(self): + def get_conf(parameter): + return ft_utils.get_functest_config(parameter) + + super(VPingBase, self).__init__() + self.logger = None + self.repo = get_conf('general.directories.dir_vping') + self.vm1_name = get_conf('vping.vm_name_1') + self.vm2_name = get_conf('vping.vm_name_2') + self.vm_boot_timeout = 180 + self.vm_delete_timeout = 100 + self.ping_timeout = get_conf('vping.ping_timeout') + + self.image_name = get_conf('vping.image_name') + self.image_filename = get_conf('general.openstack.image_file_name') + self.image_format = get_conf('general.openstack.image_disk_format') + self.image_path = \ + "%s/%s" % (get_conf('general.directories.dir_functest_data'), + self.image_filename) + + self.flavor_name = get_conf('vping.vm_flavor') + + # NEUTRON Private Network parameters + self.private_net_name = get_conf('vping.vping_private_net_name') + self.private_subnet_name = get_conf('vping.vping_private_subnet_name') + self.private_subnet_cidr = get_conf('vping.vping_private_subnet_cidr') + self.router_name = get_conf('vping.vping_router_name') + self.sg_name = get_conf('vping.vping_sg_name') + self.sg_desc = get_conf('vping.vping_sg_descr') + self.neutron_client = os_utils.get_neutron_client() + self.glance_client = os_utils.get_glance_client() + self.nova_client = os_utils.get_nova_client() + + def run(self, **kwargs): + if not self.check_repo_exist(): + return TestCasesBase.TestCasesBase.EX_RUN_ERROR + + image_id = self.create_image() + if not image_id: + return TestCasesBase.TestCasesBase.EX_RUN_ERROR + + flavor = self.get_flavor() + if not flavor: + return TestCasesBase.TestCasesBase.EX_RUN_ERROR + + network_id = self.create_network_full() + if not network_id: + return TestCasesBase.TestCasesBase.EX_RUN_ERROR + + sg_id = self.create_security_group() + if not sg_id: + return TestCasesBase.TestCasesBase.EX_RUN_ERROR + + self.delete_exist_vms() + + self.start_time = time.time() + self.logger.info("vPing Start Time:'%s'" % ( + datetime.fromtimestamp(self.start_time).strftime( + '%Y-%m-%d %H:%M:%S'))) + + vm1 = self.boot_vm(self.vm1_name, + image_id, + flavor, + network_id, + None, + sg_id) + if not vm1: + return TestCasesBase.TestCasesBase.EX_RUN_ERROR + + test_ip = self.get_test_ip(vm1) + vm2 = self.boot_vm(self.vm2_name, + image_id, + flavor, + network_id, + test_ip, + sg_id) + if not vm2: + return TestCasesBase.TestCasesBase.EX_RUN_ERROR + + EXIT_CODE = self.do_vping(vm2, test_ip) + if EXIT_CODE == TestCasesBase.TestCasesBase.EX_RUN_ERROR: + return EXIT_CODE + + self.stop_time = time.time() + self.parse_result(EXIT_CODE, + self.start_time, + self.stop_time) + return TestCasesBase.TestCasesBase.EX_OK + + def boot_vm_preparation(self, config, vmname, test_ip): + pass + + def do_vping(self, vm, test_ip): + raise NotImplementedError('vping execution is not implemented') + + def check_repo_exist(self): + if not os.path.exists(self.functest_repo): + self.logger.error("Functest repository not found '%s'" + % self.functest_repo) + return False + return True + + def create_image(self): + _, image_id = os_utils.get_or_create_image(self.image_name, + self.image_path, + self.image_format) + if not image_id: + return None + + return image_id + + def get_flavor(self): + try: + flavor = self.nova_client.flavors.find(name=self.flavor_name) + self.logger.info("Using existing Flavor '%s'..." + % self.flavor_name) + return flavor + except: + self.logger.error("Flavor '%s' not found." % self.flavor_name) + self.logger.info("Available flavors are: ") + self.pMsg(self.nova_client.flavor.list()) + return None + + def create_network_full(self): + network_dic = os_utils.create_network_full(self.neutron_client, + self.private_net_name, + self.private_subnet_name, + self.router_name, + self.private_subnet_cidr) + + if not network_dic: + self.logger.error( + "There has been a problem when creating the neutron network") + return None + network_id = network_dic["net_id"] + return network_id + + def create_security_group(self): + sg_id = os_utils.get_security_group_id(self.neutron_client, + self.sg_name) + if sg_id != '': + self.logger.info("Using existing security group '%s'..." + % self.sg_name) + else: + self.logger.info("Creating security group '%s'..." + % self.sg_name) + SECGROUP = os_utils.create_security_group(self.neutron_client, + self.sg_name, + self.sg_desc) + if not SECGROUP: + self.logger.error("Failed to create the security group...") + return None + + sg_id = SECGROUP['id'] + + self.logger.debug("Security group '%s' with ID=%s created " + "successfully." % (SECGROUP['name'], sg_id)) + + self.logger.debug("Adding ICMP rules in security group '%s'..." + % self.sg_name) + if not os_utils.create_secgroup_rule(self.neutron_client, sg_id, + 'ingress', 'icmp'): + self.logger.error("Failed to create security group rule...") + return None + + self.logger.debug("Adding SSH rules in security group '%s'..." + % self.sg_name) + if not os_utils.create_secgroup_rule(self.neutron_client, sg_id, + 'ingress', 'tcp', + '22', '22'): + self.logger.error("Failed to create security group rule...") + return None + + if not os_utils.create_secgroup_rule( + self.neutron_client, sg_id, 'egress', 'tcp', '22', '22'): + self.logger.error("Failed to create security group rule...") + return None + return sg_id + + def delete_exist_vms(self): + servers = self.nova_client.servers.list() + for server in servers: + if server.name == self.vm1_name or server.name == self.vm2_name: + self.logger.info("Deleting instance %s..." % server.name) + server.delete() + + def boot_vm(self, vmname, image_id, flavor, network_id, test_ip, sg_id): + config = dict() + config['name'] = vmname + config['flavor'] = flavor + config['image'] = image_id + config['nics'] = [{"net-id": network_id}] + self.boot_vm_preparation(config, vmname, test_ip) + self.logger.info("Creating instance '%s'..." % vmname) + self.logger.debug("Configuration: %s" % config) + vm = self.nova_client.servers.create(**config) + + # wait until VM status is active + if not self.waitVmActive(self.nova_client, vm): + vm_status = os_utils.get_instance_status(self.nova_client, vm) + self.logger.error("Instance '%s' cannot be booted. Status is '%s'" + % (vmname, vm_status)) + return None + else: + self.logger.info("Instance '%s' is ACTIVE." % vmname) + + self.add_secgroup(vmname, vm.id, sg_id) + + return vm + + def waitVmActive(self, nova, vm): + # sleep and wait for VM status change + sleep_time = 3 + count = self.vm_boot_timeout / sleep_time + while True: + status = os_utils.get_instance_status(nova, vm) + self.logger.debug("Status: %s" % status) + if status == "ACTIVE": + return True + if status == "ERROR" or status == "error": + return False + if count == 0: + self.logger.debug("Booting a VM timed out...") + return False + count -= 1 + time.sleep(sleep_time) + return False + + def add_secgroup(self, vmname, vm_id, sg_id): + self.logger.info("Adding '%s' to security group '%s'..." % + (vmname, self.sg_name)) + os_utils.add_secgroup_to_instance(self.nova_client, vm_id, sg_id) + + def get_test_ip(self, vm): + test_ip = vm.networks.get(self.private_net_name)[0] + self.logger.debug("Instance '%s' got %s" % (vm.name, test_ip)) + return test_ip + + def parse_result(self, code, start_time, stop_time): + test_status = "FAIL" + if code == 0: + self.logger.info("vPing OK") + duration = round(stop_time - start_time, 1) + self.logger.info("vPing duration:'%s'" % duration) + test_status = "PASS" + elif code == -2: + duration = 0 + self.logger.info("Userdata is not supported in nova boot. " + "Aborting test...") + else: + duration = 0 + self.logger.error("vPing FAILED") + + self.details = {'timestart': start_time, + 'duration': duration, + 'status': test_status} + self.criteria = test_status + + @staticmethod + def pMsg(msg): + """pretty printing""" + pprint.PrettyPrinter(indent=4).pprint(msg) + + +class VPingMain(object): + def __init__(self, vping_cls): + self.vping = vping_cls() + + def main(self, **kwargs): + try: + result = self.vping.run(**kwargs) + if result != VPingBase.EX_OK: + return result + if kwargs['report']: + return self.vping.push_to_db() + except Exception: + return VPingBase.EX_RUN_ERROR diff --git a/functest/opnfv_tests/openstack/vping/vping_ssh.py b/functest/opnfv_tests/openstack/vping/vping_ssh.py new file mode 100644 index 00000000..6fb35a7a --- /dev/null +++ b/functest/opnfv_tests/openstack/vping/vping_ssh.py @@ -0,0 +1,175 @@ +#!/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 os +import re +import sys +import time + +import argparse +import paramiko +from scp import SCPClient + +import functest.utils.functest_logger as ft_logger +import functest.utils.openstack_utils as os_utils +import vping_base +from functest.core.TestCasesBase import TestCasesBase + + +class VPingSSH(vping_base.VPingBase): + + def __init__(self): + super(VPingSSH, self).__init__() + self.case_name = 'vping_ssh' + self.logger = ft_logger.Logger(self.case_name).getLogger() + + def do_vping(self, vm, test_ip): + floatip = self.add_float_ip(vm) + if not floatip: + return TestCasesBase.EX_RUN_ERROR + ssh = self.establish_ssh(vm, floatip) + if not ssh: + return TestCasesBase.EX_RUN_ERROR + if not self.transfer_ping_script(ssh, floatip): + return TestCasesBase.EX_RUN_ERROR + return self.do_vping_ssh(ssh, test_ip) + + def add_float_ip(self, vm): + self.logger.info("Creating floating IP for VM '%s'..." % self.vm2_name) + floatip_dic = os_utils.create_floating_ip(self.neutron_client) + floatip = floatip_dic['fip_addr'] + + if floatip is None: + self.logger.error("Cannot create floating IP.") + return None + self.logger.info("Floating IP created: '%s'" % floatip) + + self.logger.info("Associating floating ip: '%s' to VM '%s' " + % (floatip, self.vm2_name)) + if not os_utils.add_floating_ip(self.nova_client, vm.id, floatip): + self.logger.error("Cannot associate floating IP to VM.") + return None + + return floatip + + def establish_ssh(self, vm, floatip): + self.logger.info("Trying to establish SSH connection to %s..." + % floatip) + username = 'cirros' + password = 'cubswin:)' + ssh = paramiko.SSHClient() + ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) + + timeout = 50 + nolease = False + got_ip = False + discover_count = 0 + cidr_first_octet = self.private_subnet_cidr.split('.')[0] + while timeout > 0: + try: + ssh.connect(floatip, username=username, + password=password, timeout=2) + self.logger.debug("SSH connection established to %s." + % floatip) + break + except: + self.logger.debug("Waiting for %s..." % floatip) + time.sleep(6) + timeout -= 1 + + console_log = vm.get_console_output() + + # print each "Sending discover" captured on the console log + if (len(re.findall("Sending discover", console_log)) > + discover_count and not got_ip): + discover_count += 1 + self.logger.debug("Console-log '%s': Sending discover..." + % self.vm2_name) + + # check if eth0 got an ip,the line looks like this: + # "inet addr:192.168.".... + # if the dhcp agent fails to assing ip, this line will not appear + if "inet addr:" + cidr_first_octet in console_log and not got_ip: + got_ip = True + self.logger.debug("The instance '%s' succeeded to get the IP " + "from the dhcp agent." % self.vm2_name) + + # if dhcp not work,it shows "No lease, failing".The test will fail + if "No lease, failing" in console_log \ + and not nolease \ + and not got_ip: + nolease = True + self.logger.debug("Console-log '%s': No lease, failing..." + % self.vm2_name) + self.logger.info("The instance failed to get an IP from DHCP " + "agent. The test will probably timeout...") + + if timeout == 0: # 300 sec timeout (5 min) + self.logger.error("Cannot establish connection to IP '%s'. " + "Aborting" % floatip) + return None + return ssh + + def transfer_ping_script(self, ssh, floatip): + self.logger.info("Trying to transfer ping.sh to %s..." % floatip) + scp = SCPClient(ssh.get_transport()) + + ping_script = os.path.join(self.repo + "ping.sh") + try: + scp.put(ping_script, "~/") + except: + self.logger.error("Cannot SCP the file '%s' to VM '%s'" + % (ping_script, floatip)) + return False + + cmd = 'chmod 755 ~/ping.sh' + (stdin, stdout, stderr) = ssh.exec_command(cmd) + for line in stdout.readlines(): + print line + + return True + + def do_vping_ssh(self, ssh, test_ip): + EXIT_CODE = -1 + self.logger.info("Waiting for ping...") + + sec = 0 + cmd = '~/ping.sh ' + test_ip + flag = False + + while True: + time.sleep(1) + (stdin, stdout, stderr) = ssh.exec_command(cmd) + output = stdout.readlines() + + for line in output: + if "vPing OK" in line: + self.logger.info("vPing detected!") + EXIT_CODE = 0 + flag = True + break + + elif sec == self.ping_timeout: + self.logger.info("Timeout reached.") + flag = True + break + if flag: + break + self.logger.debug("Pinging %s. Waiting for response..." % test_ip) + sec += 1 + return EXIT_CODE + + +if __name__ == '__main__': + args_parser = argparse.ArgumentParser() + args_parser.add_argument("-r", "--report", + help="Create json result file", + action="store_true") + args = vars(args_parser.parse_args()) + sys.exit(vping_base.VPingMain(VPingSSH).main(**args)) diff --git a/functest/opnfv_tests/openstack/vping/vping_userdata.py b/functest/opnfv_tests/openstack/vping/vping_userdata.py new file mode 100644 index 00000000..fa91c12a --- /dev/null +++ b/functest/opnfv_tests/openstack/vping/vping_userdata.py @@ -0,0 +1,82 @@ +#!/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 sys +import time + +import argparse + +import functest.utils.functest_logger as ft_logger +import vping_base + + +class VPingUserdata(vping_base.VPingBase): + + def __init__(self): + super(VPingUserdata, self).__init__() + self.case_name = 'vping_userdata' + self.logger = ft_logger.Logger(self.case_name).getLogger() + + def boot_vm_preparation(self, config, vmname, test_ip): + config['config_drive'] = True + if vmname == self.vm2_name: + u = ("#!/bin/sh\n\n" + "while true; do\n" + " ping -c 1 %s 2>&1 >/dev/null\n" + " RES=$?\n" + " if [ \"Z$RES\" = \"Z0\" ] ; then\n" + " echo 'vPing OK'\n" + " break\n" + " else\n" + " echo 'vPing KO'\n" + " fi\n" + " sleep 1\n" + "done\n" % test_ip) + config['userdata'] = u + + def do_vping(self, vm, test_ip): + self.logger.info("Waiting for ping...") + EXIT_CODE = -1 + sec = 0 + tries = 0 + + while True: + time.sleep(1) + p_console = vm.get_console_output() + if "vPing OK" in p_console: + self.logger.info("vPing detected!") + EXIT_CODE = 0 + break + elif "failed to read iid from metadata" in p_console or tries > 5: + EXIT_CODE = -2 + break + elif sec == self.ping_timeout: + self.logger.info("Timeout reached.") + break + elif sec % 10 == 0: + if "request failed" in p_console: + self.logger.debug("It seems userdata is not supported " + "in nova boot. Waiting a bit...") + tries += 1 + else: + self.logger.debug("Pinging %s. Waiting for response..." + % test_ip) + sec += 1 + + return EXIT_CODE + + +if __name__ == '__main__': + args_parser = argparse.ArgumentParser() + args_parser.add_argument("-r", "--report", + help="Create json result file", + action="store_true") + args = vars(args_parser.parse_args()) + + sys.exit(vping_base.VPingMain(VPingUserdata).main(**args)) -- cgit 1.2.3-korg