diff options
author | Yiting.Li <liyiting@huawei.com> | 2016-01-11 16:52:58 +0800 |
---|---|---|
committer | Yiting.Li <liyiting@huawei.com> | 2016-01-11 16:52:58 +0800 |
commit | e899fe06280752d5b51fac6dbb3be8f3d1461a76 (patch) | |
tree | 09c908ce3a2f3989962276ad108730f3b64dd499 | |
parent | f476468dc4fac62f43987edf3c2501a209b8bcda (diff) |
Add ci scripts for vstf tu cases.
JIRA: BOTTLENECK-29
Change-Id: I578273a6130b2eaf67a8bbbea2d3c70bbe66bf90
Signed-off-by: Yiting.Li <liyiting@huawei.com>
4 files changed, 100 insertions, 35 deletions
diff --git a/utils/infra_setup/heat_template/vstf_heat_template/bottleneck_vstf.yaml b/utils/infra_setup/heat_template/vstf_heat_template/bottleneck_vstf.yaml index 70bc6b31..d9419929 100644 --- a/utils/infra_setup/heat_template/vstf_heat_template/bottleneck_vstf.yaml +++ b/utils/infra_setup/heat_template/vstf_heat_template/bottleneck_vstf.yaml @@ -20,10 +20,14 @@ parameters: type: string description: Name of image to use for servers default: vstf-manager - image_vstf_agent: + image_vstf_tester: type: string description: Name of image to use for servers - default: vstf-agent + default: vstf-tester + image_vstf_target: + type: string + description: Name of image to use for servers + default: vstf-target #nova flavor-list to query available flavors flavor: type: string @@ -170,7 +174,7 @@ resources: type: OS::Nova::Server properties: name: vstf-target - image: { get_param: image_vstf_agent } + image: { get_param: image_vstf_target } flavor: { get_param: flavor } key_name: { get_param: key_name } networks: @@ -201,7 +205,7 @@ resources: type: OS::Nova::Server properties: name: vstf-tester - image: { get_param: image_vstf_agent } + image: { get_param: image_vstf_tester } flavor: { get_param: flavor } key_name: { get_param: key_name } networks: diff --git a/utils/infra_setup/heat_template/vstf_heat_template/launch_vstf.sh b/utils/infra_setup/heat_template/vstf_heat_template/launch_vstf.sh index 4165e3b3..37754f98 100644 --- a/utils/infra_setup/heat_template/vstf_heat_template/launch_vstf.sh +++ b/utils/infra_setup/heat_template/vstf_heat_template/launch_vstf.sh @@ -20,22 +20,40 @@ function fn_parser_ipaddress(){ manager_control_private_ip=`heat output-show ${STACK_NAME} manager_control_private_ip | sed 's/\"//g'` manager_control_public_ip=`heat output-show ${STACK_NAME} manager_control_public_ip | sed 's/\"//g'` echo "manager_control_private_ip = ${manager_control_private_ip}" - ping -c 5 ${manager_control_private_ip} + #ping -c 5 ${manager_control_private_ip} echo "manager_control_public_ip = ${manager_control_public_ip}" ping -c 5 ${manager_control_public_ip} target_control_private_ip=`heat output-show ${STACK_NAME} target_control_private_ip | sed 's/\"//g'` target_control_public_ip=`heat output-show ${STACK_NAME} target_control_public_ip | sed 's/\"//g'` echo "target_control_private_ip = ${target_control_private_ip}" - ping -c 5 ${target_control_private_ip} + #ping -c 5 ${target_control_private_ip} echo "target_control_public_ip = ${target_control_public_ip}" ping -c 5 ${target_control_public_ip} tester_control_private_ip=`heat output-show ${STACK_NAME} tester_control_private_ip | sed 's/\"//g'` tester_control_public_ip=`heat output-show ${STACK_NAME} tester_control_public_ip | sed 's/\"//g'` echo "tester_control_private_ip = ${tester_control_private_ip}" - ping -c 5 ${tester_control_private_ip} + #ping -c 5 ${tester_control_private_ip} echo "tester_control_public_ip = ${tester_control_public_ip}" ping -c 5 ${tester_control_public_ip} + #get testing ipaddress + tester_testing_ip=`nova list | grep "vstf-tester" | grep "bottlenecks-testing" | awk -F'bottlenecks-testing=' '{print $2}' | awk '{print $1}'` + target_testing_ip=`nova list | grep "vstf-target" | grep "bottlenecks-testing" | awk -F'bottlenecks-testing=' '{print $2}' | awk '{print $1}'` + echo "tester_testing_ip = ${tester_testing_ip}" + echo "target_testing_ip = ${target_testing_ip}" + + #config ip for the testing plane + ssh-keygen -f "/home/jenkins-ci/.ssh/known_hosts" -R ${target_control_public_ip} + sshpass -p root ssh -o StrictHostKeyChecking=no root@${target_control_public_ip} "ifconfig eth1 ${target_testing_ip}/24;sleep 4" + ssh-keygen -f "/home/jenkins-ci/.ssh/known_hosts" -R ${tester_control_public_ip} + sshpass -p root ssh -o StrictHostKeyChecking=no root@${tester_control_public_ip} "ifconfig eth1 ${tester_testing_ip}/24;sleep 4" + #ping with each other + ssh-keygen -f "/home/jenkins-ci/.ssh/known_hosts" -R ${target_control_public_ip} + sshpass -p root ssh -o StrictHostKeyChecking=no root@${target_control_public_ip} "ping -c 10 ${tester_testing_ip}" + + ssh-keygen -f "/home/jenkins-ci/.ssh/known_hosts" -R ${tester_control_public_ip} + sshpass -p root ssh -o StrictHostKeyChecking=no root@${tester_control_public_ip} "ping -c 10 ${target_testing_ip}" + local ipaddr="" for ipaddr in ${manager_control_private_ip} ${manager_control_public_ip} ${target_control_private_ip} \ ${target_control_public_ip} ${tester_control_private_ip} ${tester_control_public_ip} @@ -72,17 +90,20 @@ function fn_generate_amqp(){ function fn_provision_agent_file(){ - apt-get -y install expect + #apt-get -y install expect #manager fn_generate_amqp "manager" - + #target fn_generate_amqp "target" #scp_cmd ${target_control_public_ip} ${VM_TARGET_USER} ${VM_TARGET_PASSWD} "./vstf-target.ini" "/etc/vstf/amqp/amqp.ini" "file" - + ssh-keygen -f "/home/jenkins-ci/.ssh/known_hosts" -R ${target_control_public_ip} + sshpass -p root scp -o StrictHostKeyChecking=no "./vstf-target.ini" root@${target_control_public_ip}:/etc/vstf/amqp/amqp.ini #tester fn_generate_amqp "tester" #scp_cmd ${tester_control_public_ip} ${VM_TESTER_USER} ${VM_TESTER_PASSWD} "./vstf-tester.ini" "/etc/vstf/amqp/amqp.ini" "file" + ssh-keygen -f "/home/jenkins-ci/.ssh/known_hosts" -R ${tester_control_public_ip} + sshpass -p root scp -o StrictHostKeyChecking=no "./vstf-tester.ini" root@${tester_control_public_ip}:/etc/vstf/amqp/amqp.ini return 0 } @@ -91,14 +112,23 @@ function fn_launch_vstf_process(){ #launch manager local manager_cmd="vstf-manager stop;pkill vstf-manager;rm -rf /opt/vstf/vstf-server.pid;vstf-manager start --monitor ${manager_control_private_ip} --port ${RABBITMQ_PORT}" - run_cmd ${manager_control_public_ip} ${VM_MANAGER_USER} ${VM_MANAGER_PASSWD} "${manager_cmd}" - + #run_cmd ${manager_control_public_ip} ${VM_MANAGER_USER} ${VM_MANAGER_PASSWD} "${manager_cmd}" + ssh-keygen -f "/home/jenkins-ci/.ssh/known_hosts" -R ${manager_control_public_ip} + sshpass -p root ssh -o StrictHostKeyChecking=no root@${manager_control_public_ip} "ifconfig -a" + sshpass -p root ssh -o StrictHostKeyChecking=no root@${manager_control_public_ip} "${manager_cmd}" + #launch target agent local target_cmd="vstf-agent stop;pkill vstf-agent;rm -rf /tmp/esp_rpc_client.pid;vstf-agent start --config_file=/etc/vstf/amqp/amqp.ini" - run_cmd ${target_control_public_ip} ${VM_TARGET_USER} ${VM_TARGET_PASSWD} "${target_cmd}" - + #run_cmd ${target_control_public_ip} ${VM_TARGET_USER} ${VM_TARGET_PASSWD} "${target_cmd}" + ssh-keygen -f "/home/jenkins-ci/.ssh/known_hosts" -R ${target_control_public_ip} + sshpass -p root ssh -o StrictHostKeyChecking=no root@${target_control_public_ip} "ifconfig -a" + sshpass -p root ssh -o StrictHostKeyChecking=no root@${target_control_public_ip} "${target_cmd}" + #launch tester agent - run_cmd ${tester_control_public_ip} ${VM_TESTER_USER} ${VM_TESTER_PASSWD} "${target_cmd}" + #run_cmd ${tester_control_public_ip} ${VM_TESTER_USER} ${VM_TESTER_PASSWD} "${target_cmd}" + ssh-keygen -f "/home/jenkins-ci/.ssh/known_hosts" -R ${tester_control_public_ip} + sshpass -p root ssh -o StrictHostKeyChecking=no root@${tester_control_public_ip} "ifconfig -a" + sshpass -p root ssh -o StrictHostKeyChecking=no root@${tester_control_public_ip} "${target_cmd}" return 0 } @@ -106,7 +136,12 @@ function fn_launch_vstf_process(){ function main(){ fn_parser_ipaddress fn_provision_agent_file - #fn_launch_vstf_process + fn_launch_vstf_process + cmd="rabbitmqctl list_queues" + sleep 20 + #${manager_control_public_ip} ${VM_MANAGER_USER} ${VM_MANAGER_PASSWD} "${cmd}" + ssh-keygen -f "/home/jenkins-ci/.ssh/known_hosts" -R ${manager_control_public_ip} + sshpass -p root ssh -o StrictHostKeyChecking=no root@${manager_control_public_ip} "${cmd}" return 0 } diff --git a/utils/infra_setup/heat_template/vstf_heat_template/vstf_HOT_create_instance.sh b/utils/infra_setup/heat_template/vstf_heat_template/vstf_HOT_create_instance.sh index f608e120..45000256 100755 --- a/utils/infra_setup/heat_template/vstf_heat_template/vstf_HOT_create_instance.sh +++ b/utils/infra_setup/heat_template/vstf_heat_template/vstf_HOT_create_instance.sh @@ -39,13 +39,18 @@ vstf_cleanup() done fi - glance image-delete ${MANAGER_IMAGE_NAME};glance image-delete "${AGENT_IMAGE_NAME}" + echo "begin to clean the image" + glance image-delete ${MANAGER_IMAGE_NAME};glance image-delete "${TARGET_IMAGE_NAME}";glance image-delete "${TESTER_IMAGE_NAME}" if glance image-list; then for image in $(glance image-list | grep -e "${MANAGER_IMAGE_NAME}" | awk '{print $2}'); do echo "[INFO]clean up image $image" glance image-delete $image || true done - for image in $(glance image-list | grep -e "${AGENT_IMAGE_NAME}" | awk '{print $2}'); do + for image in $(glance image-list | grep -e "${TARGET_IMAGE_NAME}" | awk '{print $2}'); do + echo "[INFO]clean up image $image" + glance image-delete $image || true + done + for image in $(glance image-list | grep -e "${TESTER_IMAGE_NAME}" | awk '{print $2}'); do echo "[INFO]clean up image $image" glance image-delete $image || true done @@ -63,7 +68,11 @@ vstf_cleanup() flag=`nova flavor-list | grep "m1.large "` echo "[INFO]the flavor m1.large num is $flag" fi + + #delete image file + rm -rf /tmp/vstf-manager.img;rm -rf /tmp/vstf-agent.img ;rm -rf /tmp/vstf-agent_1.img return 0 + } vstf_register() @@ -73,7 +82,8 @@ vstf_register() #curl --connect-timeout 10 -o /tmp/vstf-manager.img $MANAGER_IMAGE_URL -v #curl --connect-timeout 10 -o /tmp/vstf-agent.img $AGENT_IMAGE_URL -v curl --connect-timeout 10 -o /tmp/vstf-manager.img $MANAGER_IMAGE_URL -v - curl --connect-timeout 10 -o /tmp/vstf-agent.img $AGENT_IMAGE_URL -v + curl --connect-timeout 10 -o /tmp/vstf-agent.img $MANAGER_IMAGE_URL -v + curl --connect-timeout 10 -o /tmp/vstf-agent_1.img $MANAGER_IMAGE_URL -v #echo "begin to test downloading from vstf directory!!!!!!" #curl --connect-timeout 10 -o /tmp/vstf-test.txt #echo "begin to cat /tmp/vstf-test.txt vstf directory!!!!!!" @@ -88,15 +98,22 @@ vstf_register() echo "Manager image register result $result." result=$(glance image-create \ - --name $AGENT_IMAGE_NAME \ + --name $TESTER_IMAGE_NAME \ --disk-format qcow2 \ --container-format bare \ --file /tmp/vstf-agent.img) echo "Agent image register result $result." + result=$(glance image-create \ + --name $TARGET_IMAGE_NAME \ + --disk-format qcow2 \ + --container-format bare \ + --file /tmp/vstf-agent_1.img) + echo "Agent image register result $result." + glance image-list - rm -rf /tmp/vstf-manager.img;rm -rf /tmp/vstf-agent.img + rm -rf /tmp/vstf-manager.img;rm -rf /tmp/vstf-agent.img ;rm -rf /tmp/vstf-agent_1.img } #vstf logic function here @@ -174,12 +191,14 @@ main() BOTTLENECKS_REPO=https://gerrit.opnfv.org/gerrit/bottlenecks BOTTLENECKS_REPO_DIR=/tmp/opnfvrepo_vstf/bottlenecks #vstf parameter here - MANAGER_IMAGE_URL=http://artifacts.opnfv.org/bottlenecks/vstf/vstf-manager.img - AGENT_IMAGE_URL=http://artifacts.opnfv.org/bottlenecks/vstf/vstf-agent.img - MANAGER_IMAGE_URL=http://artifacts.opnfv.org/bottlenecks/rubbos/bottlenecks-trusty-server.img - AGENT_IMAGE_URL=http://artifacts.opnfv.org/bottlenecks/rubbos/bottlenecks-trusty-server.img + MANAGER_IMAGE_URL=http://artifacts.opnfv.org/bottlenecks/vstf-manager-new.img + AGENT_IMAGE_URL=http://artifacts.opnfv.org/bottlenecks/vstf-agent-new.img + #MANAGER_IMAGE_URL=http://artifacts.opnfv.org/bottlenecks/rubbos/bottlenecks-trusty-server.img + #AGENT_IMAGE_URL=http://artifacts.opnfv.org/bottlenecks/rubbos/bottlenecks-trusty-server.img MANAGER_IMAGE_NAME="vstf-manager" - AGENT_IMAGE_NAME="vstf-agent" + TESTER_IMAGE_NAME="vstf-tester" + TARGET_IMAGE_NAME="vstf-target" + KEY_PATH=$BOTTLENECKS_REPO_DIR/utils/infra_setup/bottlenecks_key HOT_PATH=$BOTTLENECKS_REPO_DIR/utils/infra_setup/heat_template/vstf_heat_template KEY_NAME=vstf-key @@ -190,7 +209,6 @@ main() #load adminrc bottlenecks_env_prepare - #vstf function here vstf_cleanup vstf_register @@ -200,10 +218,10 @@ main() nova list sleep 100 vstf_launch - #sleep 30 + sleep 30 vstf_test - #sleep 10 - #echo "[INFO]bottleneck vstf testsuite done ,results in the directory ${HOT_PATH}/result" + sleep 10 + echo "[INFO]bottleneck vstf testsuite done ,results in the directory ${HOT_PATH}/result" echo "[INFO]Begin to clean up the vstf heat-stack and image" vstf_cleanup sleep 30 diff --git a/utils/infra_setup/heat_template/vstf_heat_template/vstf_test.sh b/utils/infra_setup/heat_template/vstf_heat_template/vstf_test.sh index 5f5aa36f..051f2858 100644 --- a/utils/infra_setup/heat_template/vstf_heat_template/vstf_test.sh +++ b/utils/infra_setup/heat_template/vstf_heat_template/vstf_test.sh @@ -33,9 +33,11 @@ function fn_vstf_test_config(){ echo "tester_testing_ip = ${tester_testing_ip}" echo "target_testing_ip = ${target_testing_ip}" #setting testting ipaddress - local cmd='vstfadm settings ${tester_testing_ip} ${target_testing_ip}' + local cmd="vstfadm settings ${tester_testing_ip} ${target_testing_ip}" echo "$cmd" #run_cmd ${manager_control_public_ip} ${VM_MANAGER_USER} ${VM_MANAGER_PASSWD} "${cmd}" + ssh-keygen -f "/home/jenkins-ci/.ssh/known_hosts" -R ${manager_control_public_ip} + sshpass -p root ssh -o StrictHostKeyChecking=no root@${manager_control_public_ip} "${cmd}" return 0 } @@ -51,7 +53,11 @@ function fn_testing_scenario(){ do local cmd="${head_cmd} ${scene} ${test_tool} ${protocol} ${test_type} \"${test_length_list}\" > /root/${scene}-result.txt" echo ${cmd} - run_cmd ${manager_control_public_ip} ${VM_MANAGER_USER} ${VM_MANAGER_PASSWD} "${head_cmd} ${scene} ${test_tool} ${protocol} ${test_type} \"${test_length_list}\" > /root/${scene}" + + ssh-keygen -f "/home/jenkins-ci/.ssh/known_hosts" -R ${manager_control_public_ip} + #run_cmd ${manager_control_public_ip} ${VM_MANAGER_USER} ${VM_MANAGER_PASSWD} "${head_cmd} ${scene} ${test_tool} ${protocol} ${test_type} \"${test_length_list}\" > /root/${scene}" + sshpass -p root ssh -o StrictHostKeyChecking=no root@${manager_control_public_ip} "${cmd}" + sleep 10 done return 0 } @@ -62,7 +68,9 @@ function fn_result(){ rm -rf ./result/* for scene in ${test_scenario_list} do - remote_scp_cmd ${manager_control_public_ip} ${VM_MANAGER_USER} ${VM_MANAGER_PASSWD} "/root/${scene}-result.txt" "./result/${scene}" "file" + #remote_scp_cmd ${manager_control_public_ip} ${VM_MANAGER_USER} ${VM_MANAGER_PASSWD} "/root/${scene}-result.txt" "./result/${scene}" "file" + sshpass -p root ssh -o StrictHostKeyChecking=no root@${manager_control_public_ip} "cat /root/${scene}-result.txt" + sshpass -p root scp -o StrictHostKeyChecking=no root@${manager_control_public_ip}:/root/${scene}-result.txt "./result/${scene}" done return 0 } @@ -70,8 +78,8 @@ function fn_result(){ function main(){ fn_parser_ipaddress fn_vstf_test_config - #fn_testing_scenario - #fn_result + fn_testing_scenario + fn_result return 0 } |