diff options
author | Yang (Gabriel) Yu <Gabriel.yuyang@huawei.com> | 2018-11-29 08:32:06 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2018-11-29 08:32:06 +0000 |
commit | a0622be5cc8486bbe8c85b382644277bc408ffda (patch) | |
tree | 318ef60159a821400add163a04224ab7ac30b437 /utils/infra_setup | |
parent | 6576b8fe77019840b3ce3dfd31cc365923065099 (diff) | |
parent | 2bdb7f219b403f446591a4a6d3bfac8f3a2aa8d0 (diff) |
Merge "Remove useless files in Bottlenecks repo"
Diffstat (limited to 'utils/infra_setup')
9 files changed, 0 insertions, 1126 deletions
diff --git a/utils/infra_setup/heat/consts/__init__.py b/utils/infra_setup/heat/consts/__init__.py deleted file mode 100755 index e69de29b..00000000 --- a/utils/infra_setup/heat/consts/__init__.py +++ /dev/null diff --git a/utils/infra_setup/heat/consts/files.py b/utils/infra_setup/heat/consts/files.py deleted file mode 100755 index f148f103..00000000 --- a/utils/infra_setup/heat/consts/files.py +++ /dev/null @@ -1,36 +0,0 @@ -############################################################################## -# Copyright (c) 2016 Huawei Technologies Co.,Ltd and others. -# -# 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 -############################################################################## - -# ------------------------------------------------------ -# Configuration File -# ------------------------------------------------------ -GENERAL = 'General' - - -def get_sections(): - return [ - GENERAL, - # Add here new configurations... - ] - - -def get_sections_api(): - return [ - GENERAL, - # Add here new configurations... - ] - -# ------------------------------------------------------ -# General section parameters -# ------------------------------------------------------ -ITERATIONS = 'iterations' -TEMPLATE_DIR = 'template_dir' -TEMPLATE_NAME = 'template_base_name' -BENCHMARKS = 'benchmarks' -DEBUG = 'debug' diff --git a/utils/infra_setup/heat/consts/parameters.py b/utils/infra_setup/heat/consts/parameters.py deleted file mode 100755 index 15aa5b5d..00000000 --- a/utils/infra_setup/heat/consts/parameters.py +++ /dev/null @@ -1,16 +0,0 @@ -############################################################################## -# Copyright (c) 2016 Huawei Technologies Co.,Ltd and others. -# -# 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 -############################################################################## - - -# ------------------------------------------------------ -# Directories and file locations -# ------------------------------------------------------ -HEAT_DIR = 'heat/' -TEST_TEMPLATE_NAME = 'test_template' -TEMPLATE_EXTENSION = '.yaml' diff --git a/utils/infra_setup/heat_template/rubbos_heat_template/HOT_create_instance.sh b/utils/infra_setup/heat_template/rubbos_heat_template/HOT_create_instance.sh deleted file mode 100755 index 1a80d950..00000000 --- a/utils/infra_setup/heat_template/rubbos_heat_template/HOT_create_instance.sh +++ /dev/null @@ -1,325 +0,0 @@ -#!/bin/bash -############################################################################## -# Copyright (c) 2015 Huawei Technologies Co.,Ltd and others. -# -# 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 -x - -git_checkout() -{ - if git cat-file -e $1^{commit} 2>/dev/null; then - # branch, tag or sha1 object - git checkout $1 - else - # refspec / changeset - git fetch --tags --progress $2 $1 - git checkout FETCH_HEAD - fi -} - -bottlenecks_env_prepare() { - set -e - echo "Bottlenecks env prepare start $(date)" - git config --global http.sslVerify false - - if [ ! -d $BOTTLENECKS_REPO_DIR ]; then - git clone $BOTTLENECKS_REPO $BOTTLENECKS_REPO_DIR - fi - cd $BOTTLENECKS_REPO_DIR - git checkout master && git pull - git_checkout $BOTTLENECKS_BRANCH $BOTTLENECKS_REPO - cd - - - echo "Creating openstack credentials .." - if [ ! -d $RELENG_REPO_DIR ]; then - git clone $RELENG_REPO $RELENG_REPO_DIR - fi - cd $RELENG_REPO_DIR - git checkout master && git pull - git_checkout $RELENG_BRANCH $RELENG_REPO - cd - - - # Create openstack credentials - $RELENG_REPO_DIR/utils/fetch_os_creds.sh \ - -d /tmp/openrc \ - -i ${INSTALLER_TYPE} -a ${INSTALLER_IP} - - source /tmp/openrc - - chmod 600 $KEY_PATH/bottlenecks_key - - echo "Bottlenecks env prepare end $(date)" - set +e -} - -wait_heat_stack_complete() { - retry=0 - while true - do - status=$(heat stack-list | grep bottlenecks | awk '{print $6}') - if [ x$status = x"CREATE_COMPLETE" ]; then - echo "bottlenecks stacke create complete" - heat stack-show bottlenecks - nova list | grep rubbos_ - break; - elif [ x$status = x"CREATE_FAILED" ]; then - echo "bottlenecks stacke create failed !!!" - heat stack-show bottlenecks - exit 1 - fi - - #if [ $BOTTLENECKS_DEBUG = True ]; then - if false; then - heat stack-show bottlenecks - nova list | grep rubbos_ - for i in $(nova list | grep rubbos_ | grep ERROR | awk '{print $2}') - do - nova show $i - done - fi - sleep 1 - let retry+=1 - if [[ $retry -ge $1 ]];then - echo "Heat stack create timeout, status $status !!!" - exit 1 - fi - done -} - -wait_rubbos_control_ok() { - control_ip=$(nova list | grep rubbos_control | awk '{print $13}') - - retry=0 - until timeout 3s ssh $ssh_args ubuntu@$control_ip "exit" >/dev/null 2>&1 - do - echo "retry connect rubbos control $retry" - sleep 1 - let retry+=1 - if [[ $retry -ge $1 ]];then - echo "rubbos control start timeout !!!" - exit 1 - fi - done - ssh $ssh_args ubuntu@$control_ip "uname -a" -} - -bottlenecks_check_instance_ok() -{ - echo "Bottlenecks check instance ok start $(date)" - - wait_heat_stack_complete 120 - wait_rubbos_control_ok 300 - nova list | grep rubbos_ - if [ $BOTTLENECKS_DEBUG = True ]; then - date - while true - do - for i in rubbos_benchmark rubbos_client1 rubbos_client2 rubbos_client3 \ - rubbos_client4 rubbos_control rubbos_httpd rubbos_mysql1 rubbos_tomcat1 - do - echo "logging $i" - nova console-log $i | tail -n 2 | grep Cloud-init | grep finished - if [ $? != 0 ]; then - break - fi - if [ $i = rubbos_tomcat1 ]; then - echo "all vm Cloud-init finished!" - date - return - fi - done - sleep 10 - done - fi - - echo "Bottlenecks check instance ok end $(date)" -} - -bottlenecks_create_instance() -{ - echo "Bottlenecks create instance using heat template start $(date)" - - echo "upload keypair" - nova keypair-add --pub_key $KEY_PATH/bottlenecks_key.pub $KEY_NAME - - echo "create flavor" - nova flavor-create $FLAVOR_NAME 200 4096 20 2 - - echo "use heat template to create stack" - cd $HOT_PATH - heat stack-create bottlenecks -f ${TEMPLATE_NAME} \ - -P "image=$IMAGE_NAME;key_name=$KEY_NAME;public_net=$EXTERNAL_NET;flavor=$FLAVOR_NAME" - - echo "Bottlenecks create instance using heat template end $(date)" -} - -bottlenecks_rubbos_wait_finish() -{ - echo "Start checking rubbos running status..." - retry=0 - while true - do - ssh $ssh_args ubuntu@$control_ip "FILE=/tmp/rubbos_finished; if [ -f \$FILE ]; then exit 0; else exit 1; fi" - if [ $? = 0 ]; then - echo "Rubbos test case successfully finished :)" - return 0 - fi - echo "Rubbos running $retry ..." - sleep 30 - let retry+=1 - if [[ $retry -ge $1 ]]; then - echo "Rubbos test case timeout :(" - return 1 - fi - done -} - -bottlenecks_rubbos_run() -{ - echo "Run Rubbos" - control_ip=$(nova list | grep rubbos_control | awk '{print $13}') - for i in rubbos_benchmark rubbos_client1 rubbos_client2 rubbos_client3 \ - rubbos_client4 rubbos_control rubbos_httpd rubbos_mysql1 \ - rubbos_tomcat1 - do - ip=$(nova list | grep $i | awk '{print $12}' | awk -F [=,] '{print $2}') - echo "$i=$ip" >> $BOTTLENECKS_REPO_DIR/utils/infra_setup/vm_dev_setup/hosts.conf - done - - nameserver_ip=$(grep -m 1 '^nameserver' \ - /etc/resolv.conf | awk '{ print $2 '}) - echo "nameserver_ip=$nameserver_ip" >> $BOTTLENECKS_REPO_DIR/utils/infra_setup/vm_dev_setup/hosts.conf - - echo "GERRIT_REFSPEC_DEBUG=$GERRIT_REFSPEC_DEBUG" >> $BOTTLENECKS_REPO_DIR/utils/infra_setup/vm_dev_setup/hosts.conf - echo "BOTTLENECKS_BRANCH=$BOTTLENECKS_BRANCH" >> $BOTTLENECKS_REPO_DIR/utils/infra_setup/vm_dev_setup/hosts.conf - - echo "NODE_NAME=$NODE_NAME" >> $BOTTLENECKS_REPO_DIR/utils/infra_setup/vm_dev_setup/hosts.conf - echo "INSTALLER_TYPE=$INSTALLER_TYPE" >> $BOTTLENECKS_REPO_DIR/utils/infra_setup/vm_dev_setup/hosts.conf - echo "BOTTLENECKS_VERSION=$BOTTLENECKS_VERSION" >> $BOTTLENECKS_REPO_DIR/utils/infra_setup/vm_dev_setup/hosts.conf - echo "BOTTLENECKS_DB_TARGET=$BOTTLENECKS_DB_TARGET" >> $BOTTLENECKS_REPO_DIR/utils/infra_setup/vm_dev_setup/hosts.conf - echo "PACKAGE_URL=$PACKAGE_URL" >> $BOTTLENECKS_REPO_DIR/utils/infra_setup/vm_dev_setup/hosts.conf - - scp $ssh_args -r \ - $BOTTLENECKS_REPO_DIR/utils/infra_setup/vm_dev_setup \ - ubuntu@$control_ip:/tmp - ssh $ssh_args \ - ubuntu@$control_ip "bash /tmp/vm_dev_setup/setup_env.sh" & - - bottlenecks_rubbos_wait_finish 200 - - if [ x"$GERRIT_REFSPEC_DEBUG" != x ]; then - # TODO fix hard coded path - scp $ssh_args \ - ubuntu@$control_ip:"/bottlenecks/rubbos/rubbos_results/2015-01-20T081237-0700.tgz" /tmp - fi - - rm -rf $BOTTLENECKS_REPO_DIR/utils/infra_setup/vm_dev_setup/hosts.conf -} - -bottlenecks_cleanup() -{ - echo "Bottlenecks cleanup start $(date)" - - if heat stack-list; then - for stack in $(heat stack-list | grep -e bottlenecks | awk '{print $2}'); do - echo "clean up stack $stack" - heat stack-delete $stack || true - sleep 30 - done - fi - - if glance image-list; then - for image in $(glance image-list | grep -e $IMAGE_NAME | awk '{print $2}'); do - echo "clean up image $image" - glance image-delete $image || true - done - fi - - if nova keypair-list; then - for key in $(nova keypair-list | grep -e $KEY_NAME | awk '{print $2}'); do - echo "clean up key $key" - nova keypair-delete $key || true - done - fi - - if nova flavor-list; then - for flavor in $(nova flavor-list | grep -e $FLAVOR_NAME | awk '{print $2}'); do - echo "clean up flavor $flavor" - nova flavor-delete $flavor || true - done - fi - - echo "Bottlenecks cleanup end $(date)" -} - -bottlenecks_load_bottlenecks_image() -{ - echo "Bottlenecks load image start $(date)" - - curl --connect-timeout 10 -o /tmp/bottlenecks-trusty-server.img $IMAGE_URL -v - - result=$(glance image-create \ - --name $IMAGE_NAME \ - --disk-format qcow2 \ - --container-format bare \ - --file /tmp/bottlenecks-trusty-server.img) - echo "$result" - - rm -rf /tmp/bottlenecks-trusty-server.img - - IMAGE_ID_BOTTLENECKS=$(echo "$result" | grep " id " | awk '{print $(NF-1)}') - if [ -z "$IMAGE_ID_BOTTLENECKS" ]; then - echo 'failed to upload bottlenecks image to openstack' - exit 1 - fi - - echo "bottlenecks image end id: $IMAGE_ID_BOTTLENECKS $(date)" -} - -main() -{ - echo "main start $(date)" - - : ${BOTTLENECKS_DEBUG:='True'} - : ${BOTTLENECKS_REPO:='https://gerrit.opnfv.org/gerrit/bottlenecks'} - : ${BOTTLENECKS_REPO_DIR:='/tmp/opnfvrepo/bottlenecks'} - : ${BOTTLENECKS_BRANCH:='master'} # branch, tag, sha1 or refspec - : ${RELENG_REPO:='https://gerrit.opnfv.org/gerrit/releng'} - : ${RELENG_REPO_DIR:='/tmp/opnfvrepo/releng'} - : ${RELENG_BRANCH:='master'} # branch, tag, sha1 or refspec - : ${IMAGE_NAME:='bottlenecks-trusty-server'} - KEY_PATH=$BOTTLENECKS_REPO_DIR/utils/infra_setup/bottlenecks_key - HOT_PATH=$BOTTLENECKS_REPO_DIR/utils/infra_setup/heat_template - : ${KEY_NAME:='bottlenecks-key'} - : ${FLAVOR_NAME:='bottlenecks-flavor'} - : ${TEMPLATE_NAME:='bottlenecks_rubbos_hot.yaml'} - ssh_args="-o StrictHostKeyChecking=no -o BatchMode=yes -i $KEY_PATH/bottlenecks_key" - : ${EXTERNAL_NET:='net04_ext'} - : ${PACKAGE_URL:='http://artifacts.opnfv.org/bottlenecks'} - : ${NODE_NAME:='opnfv-jump-2'} - : ${INSTALLER_TYPE:='fuel'} - : ${INSTALLER_IP:='10.20.0.2'} - # TODO fix for dashboard - : ${BOTTLENECKS_VERSION:='master'} - : ${BOTTLENECKS_DB_TARGET:='213.77.62.197'} - IMAGE_URL=${PACKAGE_URL}/rubbos/bottlenecks-trusty-server.img - - bottlenecks_env_prepare - set -x - bottlenecks_cleanup - bottlenecks_load_bottlenecks_image - bottlenecks_create_instance - bottlenecks_check_instance_ok - bottlenecks_rubbos_run - bottlenecks_cleanup - echo "main end $(date)" -} - -main -set +x - 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 deleted file mode 100644 index d9419929..00000000 --- a/utils/infra_setup/heat_template/vstf_heat_template/bottleneck_vstf.yaml +++ /dev/null @@ -1,252 +0,0 @@ -heat_template_version: 2013-05-23 -description: > - This template is used for creating a new environment on the Openstack Release L , - and the deployment will create three virtual machine on the compute node, one manager - and two agent vm included. Each vm will has a nic on the controlplane switch and two - agent vms will has a additional nic on the dataplane. -parameters: - #nova keypair-list to query available key pair - key_name: - type: string - description: Name of keypair to assign to servers - default: vstf-key - #nova image-list to query available images - image: - type: string - description: Name of image to use for servers - default: bottlenecks-trusty-server - #new addition image for the actual deployment - image_vstf_manager: - type: string - description: Name of image to use for servers - default: vstf-manager - image_vstf_tester: - type: string - description: Name of image to use for servers - 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 - description: Flavor to use for servers - default: m1.large - #nova net-list to query available - public_net: - type: string - description: > - ID or name of public network for which floating IP addresses will be allocated - default: net04_ext - - #private controlplane - private_net_name: - type: string - description: Name of private network to be created - default: vstf-private - private_net_cidr: - type: string - description: Private network address (CIDR notation) - default: "10.0.11.0/24" - private_net_gateway: - type: string - description: Private network gateway address - default: "10.0.11.1" - private_net_pool_start: - type: string - description: Start of private network IP address allocation pool - default: "10.0.11.2" - private_net_pool_end: - type: string - description: End of private network IP address allocation pool - default: "10.0.11.199" - - #testing dataplane - testing_net_name: - type: string - description: Name of private network to be created - default: bottlenecks-testing - testing_net_cidr: - type: string - description: Private network address (CIDR notation) - default: "10.0.20.0/24" - testing_net_gateway: - type: string - description: Private network gateway address - default: "10.0.20.1" - testing_net_pool_start: - type: string - description: Start of private network IP address allocation pool - default: "10.0.20.2" - testing_net_pool_end: - type: string - description: End of private network IP address allocation pool - default: "10.0.20.199" - - -resources: - #control plane - private_net: - type: OS::Neutron::Net - properties: - name: { get_param: private_net_name } - private_subnet: - type: OS::Neutron::Subnet - properties: - network_id: { get_resource: private_net } - cidr: { get_param: private_net_cidr } - gateway_ip: { get_param: private_net_gateway } - allocation_pools: - - start: { get_param: private_net_pool_start } - end: { get_param: private_net_pool_end } - - #dataplane - testing_net: - type: OS::Neutron::Net - properties: - name: { get_param: testing_net_name } - testing_subnet: - type: OS::Neutron::Subnet - properties: - network_id: { get_resource: testing_net } - cidr: { get_param: testing_net_cidr } - gateway_ip: { get_param: testing_net_gateway } - allocation_pools: - - start: { get_param: testing_net_pool_start } - end: { get_param: testing_net_pool_end } - - #router info - 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 } - - #security_group - server_security_group: - type: OS::Neutron::SecurityGroup - properties: - description: vstf group for servers access. - name: vstf-security-group - rules: [ - {remote_ip_prefix: 0.0.0.0/0, - protocol: tcp, - port_range_min: 1, - port_range_max: 65535}, - {remote_ip_prefix: 0.0.0.0/0, - protocol: udp, - port_range_min: 1, - port_range_max: 65535}, - {remote_ip_prefix: 0.0.0.0/0, - protocol: icmp}] - - #nova server vstf manager definition info - vstf-manager: - type: OS::Nova::Server - properties: - name: vstf-manager - image: { get_param: image_vstf_manager } - flavor: { get_param: flavor } - key_name: { get_param: key_name } - networks: - - port: { get_resource: manager_control_port } - manager_control_port: - type: OS::Neutron::Port - properties: - network_id: { get_resource: private_net } - fixed_ips: - - subnet_id: { get_resource: private_subnet } - security_groups: [{ get_resource: server_security_group }] - manager_control_floating_ip: - type: OS::Neutron::FloatingIP - properties: - floating_network: { get_param: public_net } - port_id: { get_resource: manager_control_port } - - #nova server vstf target definition info - vstf-target: - type: OS::Nova::Server - properties: - name: vstf-target - image: { get_param: image_vstf_target } - flavor: { get_param: flavor } - key_name: { get_param: key_name } - networks: - - port: { get_resource: target_control_port } - - port: { get_resource: target_testing_port } - target_control_port: - type: OS::Neutron::Port - properties: - network_id: { get_resource: private_net } - fixed_ips: - - subnet_id: { get_resource: private_subnet } - security_groups: [{ get_resource: server_security_group }] - target_testing_port: - type: OS::Neutron::Port - properties: - network_id: { get_resource: testing_net } - fixed_ips: - - subnet_id: { get_resource: testing_subnet } - security_groups: [{ get_resource: server_security_group }] - target_control_floating_ip: - type: OS::Neutron::FloatingIP - properties: - floating_network: { get_param: public_net } - port_id: { get_resource: target_control_port } - - #nova server vstf tester definition info - vstf-tester: - type: OS::Nova::Server - properties: - name: vstf-tester - image: { get_param: image_vstf_tester } - flavor: { get_param: flavor } - key_name: { get_param: key_name } - networks: - - port: { get_resource: tester_control_port } - - port: { get_resource: tester_testing_port } - tester_control_port: - type: OS::Neutron::Port - properties: - network_id: { get_resource: private_net } - fixed_ips: - - subnet_id: { get_resource: private_subnet } - security_groups: [{ get_resource: server_security_group }] - tester_testing_port: - type: OS::Neutron::Port - properties: - network_id: { get_resource: testing_net } - fixed_ips: - - subnet_id: { get_resource: testing_subnet } - security_groups: [{ get_resource: server_security_group }] - tester_control_floating_ip: - type: OS::Neutron::FloatingIP - properties: - floating_network: { get_param: public_net } - port_id: { get_resource: tester_control_port } - -outputs: - manager_control_private_ip: - description: IP address of manager_control in private network - value: { get_attr: [ vstf-manager, first_address ] } - manager_control_public_ip: - description: Floating IP address of manager_control in public network - value: { get_attr: [ manager_control_floating_ip, floating_ip_address ] } - target_control_private_ip: - description: IP address of manager_control in private network - value: { get_attr: [ vstf-target, first_address ] } - target_control_public_ip: - description: Floating IP address of manager_control in public network - value: { get_attr: [ target_control_floating_ip, floating_ip_address ] } - tester_control_private_ip: - description: IP address of manager_control in private network - value: { get_attr: [ vstf-tester, first_address ] } - tester_control_public_ip: - description: Floating IP address of manager_control in public network - value: { get_attr: [ tester_control_floating_ip, floating_ip_address ] } diff --git a/utils/infra_setup/heat_template/vstf_heat_template/dashboard.json b/utils/infra_setup/heat_template/vstf_heat_template/dashboard.json deleted file mode 100755 index df6f64c3..00000000 --- a/utils/infra_setup/heat_template/vstf_heat_template/dashboard.json +++ /dev/null @@ -1,6 +0,0 @@ -{
- "pod_name": "unknown-pod",
- "installer": "fuel",
- "version": "unknown",
- "target": "http://213.77.62.197/results"
-}
\ No newline at end of file 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 deleted file mode 100644 index ec615ec2..00000000 --- a/utils/infra_setup/heat_template/vstf_heat_template/launch_vstf.sh +++ /dev/null @@ -1,156 +0,0 @@ -#!/bin/bash -############################################################################## -# Copyright (c) 2015 Huawei Technologies Co.,Ltd and others. -# -# 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 -x - -STACK_NAME="bottlenecks_vstf_stack" -VM_MANAGER_USER="root" -VM_MANAGER_PASSWD="root" -VM_TARGET_USER="root" -VM_TARGET_PASSWD="root" -VM_TESTER_USER="root" -VM_TESTER_PASSWD="root" -RABBITMQ_PORT="5672" - -#load func -#source ./ssh.sh -#source ./scp.sh - -function fn_parser_ipaddress(){ - #parser and get output 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} - 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} - 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} - 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} - do - if [ "${ipaddr}x" == "x" ] - then - echo "[ERROR]The ipaddress is null ,get ip from heat output failed" - exit 1 - fi - done - - return 0 -} - -function fn_generate_amqp(){ - local node_type=$1 - if [ "${node_type}" == "manager" ] - then - return 0 - elif [ "${node_type}" == "target" -o "${node_type}" == "tester" ] - then - echo "[rabbit]" > ./vstf-${node_type}.ini - echo "user=guest" >> ./vstf-${node_type}.ini - echo "passwd=guest" >> ./vstf-${node_type}.ini - echo "host=${manager_control_private_ip}" >> ./vstf-${node_type}.ini - echo "port=${RABBITMQ_PORT}" >> ./vstf-${node_type}.ini - echo "id=\"${node_type}\"" >> ./vstf-${node_type}.ini - else - echo "[ERROR]node type ${node_type} does not exist" - exit 1 - fi - return 0 -} - -function fn_provision_agent_file(){ - - #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 -} - -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}" - 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}" - 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}" - 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 -} - -function main(){ - fn_parser_ipaddress - fn_provision_agent_file - 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 -} - -main -set +x 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 deleted file mode 100755 index ce8ed439..00000000 --- a/utils/infra_setup/heat_template/vstf_heat_template/vstf_HOT_create_instance.sh +++ /dev/null @@ -1,241 +0,0 @@ -#!/bin/bash -############################################################################## -# Copyright (c) 2015 Huawei Technologies Co.,Ltd and others. -# -# 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 -ex - -GERRIT_REFSPEC_DEBUG=$1 - -echo "vstf DEBUG test" -echo "vstf workflow goes here" - -bottlenecks_env_prepare() -{ - if [ -d $BOTTLENECKS_REPO_DIR ]; then - rm -rf ${BOTTLENECKS_REPO_DIR} - fi - - mkdir -p ${BOTTLENECKS_REPO_DIR} - git config --global http.sslVerify false - git clone ${BOTTLENECKS_REPO} ${BOTTLENECKS_REPO_DIR} - if [ x"$GERRIT_REFSPEC_DEBUG" != x ]; then - cd ${BOTTLENECKS_REPO_DIR} - git fetch $BOTTLENECKS_REPO $GERRIT_REFSPEC_DEBUG && git checkout FETCH_HEAD - cd - - fi - - #obtain installer(openstack) IP, etc, use rubbos's temporarily, later we can amend this - source $BOTTLENECKS_REPO_DIR/rubbos/rubbos_scripts/1-1-1/scripts/env_preparation.sh -} - -vstf_cleanup() -{ - echo "[INFO]Begin to clean up vstf heat-stack ,glance images and keypairs" - #heat stack-delete bottlenecks - sleep 30 - if heat stack-list; then - for stack in $(heat stack-list | grep -e " vstf " | awk '{print $2}'); do - echo "[INFO]clean up stack $stack" - heat stack-delete $stack || true - sleep 30 - done - fi - - 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 "${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 - fi - - if nova keypair-list; then - for key in $(nova keypair-list | grep -e $KEY_NAME | awk '{print $2}'); do - echo "[INFO]clean up key $key" - nova keypair-delete $key || true - done - fi - - #check the default flavor m1.large existing - if nova flavor-list; then - 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() -{ - echo "[INFO]download vstf images" - #download vstf-manager and vstf-agent image - #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 $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!!!!!!" - #cat /tmp/vstf-test.txt - #register - echo "[INFO]register vstf manager and agent images" - result=$(glance image-create \ - --name $MANAGER_IMAGE_NAME \ - --disk-format qcow2 \ - --container-format bare \ - --file /tmp/vstf-manager.img) - echo "Manager image register result $result." - - result=$(glance image-create \ - --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-agent_1.img -} - -#vstf logic function here -vstf_create_heat_template() -{ - echo "create vstf instance using heat template" - echo "upload keypair" - nova keypair-add --pub_key $KEY_PATH/bottlenecks_key.pub $KEY_NAME - nova keypair-list - echo "use heat template to create stack" - cd ${HOT_PATH} - heat stack-create vstf -f ${TEMPLATE_NAME} - -} - -wait_heat_stack_complete() -{ - retry=0 - while true - do - status=$(heat stack-list | grep vstf | awk '{print $6}') - if [ x$status = x"CREATE_COMPLETE" ]; then - echo "vstf stacke create complete" - heat stack-show vstf - nova list | grep vstf- - break; - elif [ x$status = x"CREATE_FAILED" ]; then - echo "bottlenecks stacke create failed !!!" - heat stack-show vstf - exit 1 - fi - - if [ "$BOTTLENECKS_DEBUG" == "True" ]; then - heat stack-show vstf - nova list | grep vstf- - for i in $(nova list | grep "vstf-" | grep ERROR | awk '{print $2}') - do - nova show $i - done - fi - sleep 1 - let retry+=1 - if [[ $retry -ge $1 ]];then - echo "Heat vstf stack create timeout, status $status !!!" - exit 1 - fi - done -} - - -vstf_check_instance_ok() -{ - wait_heat_stack_complete 120 - - return 0 -} - -vstf_launch() -{ - cd ${HOT_PATH} - bash -x ./launch_vstf.sh - -} - -vstf_test() -{ - cd ${HOT_PATH} - bash -x ./vstf_test.sh -} - -main() -{ - echo "bottlenecks vstf: create instances with heat template" - - 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-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" - 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 - #use the default openstack flavor m1.large - FLAVOR_NAME="m1.large" - TEMPLATE_NAME=bottleneck_vstf.yaml - PUBLIC_NET_NAME=net04_ext - - #load adminrc - bottlenecks_env_prepare - #vstf function here - vstf_cleanup - vstf_register - vstf_create_heat_template - vstf_check_instance_ok - heat stack-list - nova list - sleep 100 - vstf_launch - sleep 30 - vstf_test - 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 - heat stack-list - nova list - -} - -main -set +ex 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 deleted file mode 100644 index 94e42e23..00000000 --- a/utils/infra_setup/heat_template/vstf_heat_template/vstf_test.sh +++ /dev/null @@ -1,94 +0,0 @@ -#!/bin/bash -############################################################################## -# Copyright (c) 2015 Huawei Technologies Co.,Ltd and others. -# -# 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 -x - -VM_MANAGER_USER="root" -VM_MANAGER_PASSWD="root" -STACK_NAME="bottlenecks_vstf_stack" - -function fn_parser_ipaddress(){ - #parser and get output 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'` - - local ipaddr="" - for ipaddr in ${manager_control_private_ip} ${manager_control_public_ip} - do - if [ "${ipaddr}x" == "x" ] - then - echo "[ERROR]The ipaddress is null ,get ip from heat output failed" - exit 1 - fi - done - - return 0 -} - -function fn_vstf_test_config(){ - #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}" - #setting testting ipaddress - local cmd="vstfadm settings ${tester_testing_ip} ${target_testing_ip}" - echo "$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 -} - -function fn_testing_scenario(){ - local head_cmd="vstfadm perf-test " - local test_length_list="64 128 256 512 1024" - local test_scenario_list="Tu-1 Tu-3" - local test_tool="netperf" - local protocol="udp" - local test_type="frameloss" - for scene in ${test_scenario_list} - do - local cmd="${head_cmd} ${scene} ${test_tool} ${protocol} ${test_type} \"${test_length_list}\" > /root/${scene}-result.txt" - echo ${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}" - sleep 10 - done - return 0 -} - -function fn_result(){ - local test_scenario_list="Tu-1 Tu-3" - mkdir ./result - rm -rf ./result/* - for scene in ${test_scenario_list} - do - 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 -} - -function fn_upload(){ - python vstf_collector.py --config dashboard.json --dir result -} - -function main(){ - fn_parser_ipaddress - fn_vstf_test_config - fn_testing_scenario - fn_result - fn_upload - return 0 -} - -main -set +x |