diff options
author | shangxdy <shang.xiaodong@zte.com.cn> | 2016-08-09 11:57:24 +0800 |
---|---|---|
committer | shangxdy <shang.xiaodong@zte.com.cn> | 2016-08-09 11:57:24 +0800 |
commit | 012fe93ba6433a19566cf0f11a748d1adc4e48bd (patch) | |
tree | c3d3e0847666acec5fc439a337ad9167f892f49d | |
parent | eb5eb37bbbe0e97ddc8a0f2943943e1cabaa0cd1 (diff) |
Replace -f to --template-file in heat-translator and fix errors
1. Replace -f to --template-file in heat-translator;
2. Replace heat-translator with openstack template translate later;
3. Modify echo infomations.
JIRA:PARSER-82
Change-Id: I545cb4a38bcdb107c1992b6e02810a46ac9ef201
Signed-off-by: shangxdy <shang.xiaodong@zte.com.cn>
-rwxr-xr-x | tests/functest_run.sh | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/tests/functest_run.sh b/tests/functest_run.sh index 09345f0..70509cf 100755 --- a/tests/functest_run.sh +++ b/tests/functest_run.sh @@ -12,7 +12,7 @@ PARSER_IMAGE_URL_FILE=cirros-0.3.0-x86_64-disk.img PARSER_IMAGE_URL=https://launchpad.net/cirros/trunk/0.3.0/+download/${PARSER_IMAGE_URL_FILE} -PARSER_IMAGE_NAME=cirros +PARSER_IMAGE_NAME=parser_image PARSER_IMAGE_FILE="${PARSER_IMAGE_NAME}.img" PARSER_IMAGE_FORMAT=qcow2 @@ -28,17 +28,28 @@ PARSER_ROLE=admin PARSER_STACK_NAME=vRNC_Stack # VRNC_INPUT_TEMPLATE_FILE=../tosca2heat/tosca-parser/toscaparser/extensions/nfv/tests/data/vRNC/Definitions/vRNC.yaml -VRNC_INPUT_TEMPLATE_FILE=../tosca2heat/tosca-parser/toscaparser/extensions/nfv/tests/data/tosca_helloworld_nfv.yaml +VRNC_INPUT_TEMPLATE_FILE=../tosca2heat/heat-translator/translator/tests/data/test_tosca_nfv_sample.yaml VRNC_OUTPUT_TEMPLATE_FILE=./vRNC_Hot_Template.yaml download_parser_image() { - [ -e "${PARSER_IMAGE_URL_FILE}" ] && cp ${PARSER_IMAGE_URL_FILE} ${PARSER_IMAGE_FILE} && return 0 + [ -e "${PARSER_IMAGE_URL_FILE}" ] && { + echo "Image ${PARSER_IMAGE_URL_FILE} has bee cached, needn't download again." + cp ${PARSER_IMAGE_URL_FILE} ${PARSER_IMAGE_FILE} + return 0 + } + + echo "Download image ${PARSER_IMAGE_URL_FILE}..." wget "${PARSER_IMAGE_URL}" -o "${PARSER_IMAGE_FILE}" } register_parser_image() { - openstack image list | grep -qwo "${PARSER_IMAGE_NAME}" && return 0 + openstack image list | grep -qwo "${PARSER_IMAGE_NAME}" && { + echo "Image ${PARSER_IMAGE_NAME} has bee registed, needn't registe again." + return 0 + } + + echo "Registe image ${PARSER_IMAGE_NAME}..." openstack image create "${PARSER_IMAGE_NAME}" \ --public \ --disk-format "${PARSER_IMAGE_FORMAT}" \ @@ -50,7 +61,7 @@ create_parser_user_and_project() { # 1. create parser user. openstack user list | grep -qwo "${PARSER_USER}" && { - echo "User ${PARSER_USER} exist, doesn't crate." + echo "User ${PARSER_USER} exist, doesn't create again." } || { openstack user create "${PARSER_USER}" --password "${PARSER_PASSWORD}" echo "Create user ${PARSER_USER} successful." @@ -58,7 +69,7 @@ create_parser_user_and_project() { # 2. create parser project openstack project list | grep -qwo "${PARSER_PROJECT}" && { - echo "Project ${PARSER_PROJECT} exist, doesn't crate." + echo "Project ${PARSER_PROJECT} exist, doesn't create agian." } || { openstack project create "${PARSER_PROJECT}" echo "Create project ${PARSER_PROJECT} successful." @@ -67,7 +78,7 @@ create_parser_user_and_project() { # 3. grant role for parser user openstack user 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 crate." + echo "User ${PARSER_USER} has role ${PARSER_ROLE} in project ${PARSER_PROJECT}, doesn't create." } || { openstack role add "${PARSER_ROLE}" --user "${PARSER_USER}" \ --project "${PARSER_PROJECT}" @@ -96,7 +107,7 @@ translator_and_deploy_vRNC() { change_env_to_parser_user_project # 3. Translator and deploy vRNC - heat-translator --template-type tosca -f ${VRNC_INPUT_TEMPLATE_FILE} -o ${VRNC_OUTPUT_TEMPLATE_FILE} --deploy True + heat-translator --template-type tosca --template-file ${VRNC_INPUT_TEMPLATE_FILE} -o ${VRNC_OUTPUT_TEMPLATE_FILE} --deploy True # 4. Wait for create vRNC sleep 60 @@ -131,13 +142,13 @@ reset_parser_test() { # 4. Delete tmp image ${PARSER_IMAGE_FILE} [[ -e ${PARSER_IMAGE_FILE} ]] && { - echo "delete local image file ${PARSER_IMAGE_FILE} after tes." + echo "delete local image file ${PARSER_IMAGE_FILE} after test." rm -fr ${PARSER_IMAGE_FILE} } # 5. Delete tmp image ${PARSER_IMAGE_URL_FILE} [[ -e ${PARSER_IMAGE_URL_FILE} ]] && { - echo "delete local image file ${PARSER_IMAGE_URL_FILE} after tes." + echo "delete local image file ${PARSER_IMAGE_URL_FILE} after test." rm -fr ${PARSER_IMAGE_URL_FILE} } |