X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=tests%2Ffunctest_run.sh;h=a582d7607532fba5006a85be43c28a2fb6b1f29e;hb=refs%2Fchanges%2F45%2F42845%2F1;hp=8bccef4463305d55969185a989e0c5b4012f01e0;hpb=945d0599fb5d120ca45e6489b95113f34d1b3517;p=parser.git diff --git a/tests/functest_run.sh b/tests/functest_run.sh index 8bccef4..a582d76 100755 --- a/tests/functest_run.sh +++ b/tests/functest_run.sh @@ -9,6 +9,8 @@ ############################################################################## PARSER_CI_DEBUG=${CI_DEBUG:-false} +PRASER_WORK_DIR=$(cd $(dirname $0) && pwd) + [[ "${PARSER_CI_DEBUG}" == "true" ]] && { set -x debug="--debug" @@ -16,12 +18,23 @@ PARSER_CI_DEBUG=${CI_DEBUG:-false} set +x debug="" } +LOCAL_IMAGE_FILE=${1:-""} + +if [ -e "${LOCAL_IMAGE_FILE}" ]; then + echo "Input local image file: ${LOCAL_IMAGE_FILE}" + PARSER_IMAGE_URL_FILE=${LOCAL_IMAGE_FILE} +else + echo "No local image file or the file(${LOCAL_IMAGE_FILE}) doesn't exsit!" + + PARSER_IMAGE_URL_FILE=cirros-0.3.5-x86_64-disk.img + PARSER_IMAGE_VERSION=$(echo ${PARSER_IMAGE_URL_FILE} | awk -F- '{print $2}') + # PARSER_IMAGE_URL=https://launchpad.net/cirros/trunk/0.3.0/+download/${PARSER_IMAGE_URL_FILE} + PARSER_IMAGE_URL=http://download.cirros-cloud.net/${PARSER_IMAGE_VERSION}/${PARSER_IMAGE_URL_FILE} + echo "so will download image(${PARSER_IMAGE_URL_FILE}) from ${PARSER_IMAGE_URL}." +fi -# PARSER_IMAGE_URL_FILE=cirros-0.3.0-x86_64-disk.img -PARSER_IMAGE_URL_FILE=cirros-0.3.2-x86_64-disk.img -# PARSER_IMAGE_URL=https://launchpad.net/cirros/trunk/0.3.0/+download/${PARSER_IMAGE_URL_FILE} -PARSER_IMAGE_URL=http://download.cirros-cloud.net/0.3.2/${PARSER_IMAGE_URL_FILE} # PARSER_IMAGE_NAME=rhel-6.5-test-image +# fiexd image name according to the translator default vlaue of images PARSER_IMAGE_NAME=cirros-0.3.2-x86_64-uec PARSER_IMAGE_FILE="${PARSER_IMAGE_NAME}.img" PARSER_IMAGE_FORMAT=qcow2 @@ -91,13 +104,18 @@ create_parser_user_and_project() { } # 3. grant role for parser user - openstack ${debug} user role list ${PARSER_USER} --project ${PARSER_PROJECT} \ + openstack ${debug} role list ${PARSER_USER} --project ${PARSER_PROJECT} \ | grep -qow ${PARSER_ROLE} && { echo " User ${PARSER_USER} has role ${PARSER_ROLE} in project ${PARSER_PROJECT}, doesn't create." } || { openstack ${debug} role add ${PARSER_ROLE} --user ${PARSER_USER} \ --project ${PARSER_PROJECT} echo " Grant user ${PARSER_USER} the role ${PARSER_ROLE} in project ${PARSER_PROJECT} successful." + openstack ${debug} role list | grep -qow heat_stack_owner && { + openstack ${debug} role add heat_stack_owner --user ${PARSER_USER} \ + --project ${PARSER_PROJECT} + echo " Grant user ${PARSER_USER} the role heat_stack_owner in project ${PARSER_PROJECT} successful." + } } } @@ -109,6 +127,9 @@ change_env_to_parser_user_project() { export OS_PROJECT_NAME=${PARSER_PROJECT} export OS_TENANT_NAME=${PARSER_TENANT} + export OS_PROJECT_DOMAIN_NAME=${OS_PROJECT_DOMAIN_NAME:-'Default'} + export OS_USER_DOMAIN_NAME=${OS_USER_DOMAIN_NAME:-'Default'} + } @@ -116,21 +137,21 @@ make_patch_for_provider_network() { # copy temp file echo " Patch provider network for input file:" - echo " Raw yaml file: ${VRNC_INPUT_TEMPLATE_RAW_FILE}" - echo " Patched yaml file: ${VRNC_INPUT_TEMPLATE_FILE}" + echo " Raw yaml file: ${VRNC_INPUT_TEMPLATE_RAW_FILE}" + echo " Patched yaml file: ${VRNC_INPUT_TEMPLATE_FILE}" cp ${VRNC_INPUT_TEMPLATE_RAW_FILE} ${VRNC_INPUT_TEMPLATE_FILE} echo "" # Delete the provider:network_type - echo " Patch provider:network_type..." + echo " Patching provider:network_type..." sed -i '/network_type:/d' ${VRNC_INPUT_TEMPLATE_FILE} # Delete the provider:segmentation_id - echo " Patch provider:segmentation_id..." + echo " Patching provider:segmentation_id..." sed -i '/segmentation_id:/d' ${VRNC_INPUT_TEMPLATE_FILE} # Delete the provider:physical_network - echo " Patch provider:physical_network..." + echo " Patching provider:physical_network..." sed -i '/physical_network:/d' ${VRNC_INPUT_TEMPLATE_FILE} echo "" @@ -140,7 +161,9 @@ make_patch_for_provider_network() { make_patch_for_translated_file() { # Replace the signal_transport - echo " Patch compute:signal_transport..." + echo " Patch yaml file: ${VRNC_OUTPUT_TEMPLATE_FILE}" + echo "" + echo " Patching compute:signal_transport" sed -i '1,$s/HEAT_SIGNAL/NO_SIGNAL/g' ${VRNC_OUTPUT_TEMPLATE_FILE} } @@ -172,17 +195,29 @@ translator_and_deploy_vRNC() { echo "" # 5. Patch translated file - echo " Make patch for translated file..." + echo " Make patch for translated file:" make_patch_for_translated_file echo "" # 6. deploy vRNC echo " Deploy stack..." [[ "${PARSER_CI_DEBUG}" == "true" ]] && debug="--debug" || debug="" - openstack ${debug} stack create --timeout 30 --wait --enable-rollback \ + openstack ${debug} stack create --timeout 15 --wait --enable-rollback \ -t ${VRNC_OUTPUT_TEMPLATE_FILE} ${PARSER_STACK_NAME} - # 7. Validate the deploy result. + # 7. basic information. + echo " The basic information of deployment..." + openstack ${debug} stack show ${PARSER_STACK_NAME} + + # 8. deployed resources. + echo " The resources of deployment..." + openstack ${debug} stack resource list ${PARSER_STACK_NAME} + + # 9. deployed outputs. + echo " The outputs of deployment..." + openstack ${debug} stack output list ${PARSER_STACK_NAME} + + # 10. Validate the deploy result. echo " Checking the result of deployment..." openstack ${debug} stack show ${PARSER_STACK_NAME} | grep -qow "CREATE_COMPLETE" && { echo " Check the result of deployment successfully." @@ -262,7 +297,7 @@ reset_parser_test() { } echo "" - echo "======================= Parser functest end ==========================" + echo "======================={ Parser functest end }==========================" echo "" echo "" @@ -270,13 +305,13 @@ reset_parser_test() { echo "" echo "" -echo "======================= Parser functest begin ==========================" +echo "======================={ Parser functest begin }==========================" echo "" trap reset_parser_test EXIT # start syslog for loghander -service rsyslog restart +which service > /dev/null && service rsyslog restart || true echo "|========= 1/4. Preparing VM image for parser... =========|" download_parser_image