From a7c3ac83eac821842499776eb8ac8fa67dc8897f Mon Sep 17 00:00:00 2001 From: blsaws Date: Sun, 23 Oct 2016 01:41:03 +0000 Subject: Apex support mods JIRA: VES-1 Change-Id: I9265191fb9c5a985fe84355159114941cccc16f4 Signed-off-by: blsaws --- tests/blueprints/tosca-vnfd-hello-ves/start.sh | 50 ++++++++++++++++++-------- tests/vHello_VES.sh | 17 ++++++--- 2 files changed, 47 insertions(+), 20 deletions(-) (limited to 'tests') diff --git a/tests/blueprints/tosca-vnfd-hello-ves/start.sh b/tests/blueprints/tosca-vnfd-hello-ves/start.sh index 4c6184c..858ddb9 100755 --- a/tests/blueprints/tosca-vnfd-hello-ves/start.sh +++ b/tests/blueprints/tosca-vnfd-hello-ves/start.sh @@ -35,20 +35,35 @@ setup_collectd () { guest=$1 echo "$0: Install prerequisites" - sudo apt-get update - echo "$0: Install collectd plugin" - cd ~ - git clone https://github.com/maryamtahhan/OpenStackBarcelonaDemo.git + dist=`grep DISTRIB_ID /etc/*-release | awk -F '=' '{print $2}'` + if [ "$dist" == "Ubuntu" ]; then + conf="/etc/collectd/collectd.conf" + else + conf="/etc/collectd.conf" + fi + + if [[ ! -d ~/OpenStackBarcelonaDemo ]]; then + if [ "$dist" == "Ubuntu" ]; then + sudo apt-get update + sudo apt-get install -y collectd + else + sudo yum update -y + sudo yum install -y epel-release + sudo yum install -y collectd + fi + cd ~ + + echo "$0: Install VES collectd plugin" + git clone https://github.com/maryamtahhan/OpenStackBarcelonaDemo.git - sudo apt-get install -y collectd - sudo sed -i -- "s/FQDNLookup true/FQDNLookup false/" /etc/collectd/collectd.conf - sudo sed -i -- "s/#LoadPlugin cpu/LoadPlugin cpu/" /etc/collectd/collectd.conf - sudo sed -i -- "s/#LoadPlugin disk/LoadPlugin disk/" /etc/collectd/collectd.conf - sudo sed -i -- "s/#LoadPlugin interface/LoadPlugin interface/" /etc/collectd/collectd.conf - sudo sed -i -- "s/#LoadPlugin memory/LoadPlugin memory/" /etc/collectd/collectd.conf + sudo sed -i -- "s/FQDNLookup true/FQDNLookup false/" /etc/collectd/collectd.conf + sudo sed -i -- "s/#LoadPlugin cpu/LoadPlugin cpu/" /etc/collectd/collectd.conf + sudo sed -i -- "s/#LoadPlugin disk/LoadPlugin disk/" /etc/collectd/collectd.conf + sudo sed -i -- "s/#LoadPlugin interface/LoadPlugin interface/" /etc/collectd/collectd.conf + sudo sed -i -- "s/#LoadPlugin memory/LoadPlugin memory/" /etc/collectd/collectd.conf - if [[ "$guest" == true ]]; then - cat < Globals true @@ -86,8 +101,8 @@ LoadPlugin aggregation LoadPlugin uuid EOF - else - cat < Globals true @@ -128,7 +143,12 @@ LoadPlugin aggregation SetPlugin "cpu-aggregation" CalculateAverage true -EOF + +EOF + fi + else + echo "$0: Update collectd conf with current Collector IP" + sudo sed -i -- "s/ Domain \".*\"/ Domain \"$collector_ip\"/" $conf fi sudo service collectd restart } diff --git a/tests/vHello_VES.sh b/tests/vHello_VES.sh index 1b291d7..585738f 100644 --- a/tests/vHello_VES.sh +++ b/tests/vHello_VES.sh @@ -227,8 +227,15 @@ EOF hosts=($(openstack hypervisor list | grep -v Hostname | grep -v "+" | awk '{print $4}')) for host in ${hosts[@]}; do ip=$(openstack hypervisor show $host | grep host_ip | awk '{print $4}') - scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no /tmp/tacker/blueprints/tosca-vnfd-hello-ves/start.sh ubuntu@$ip:/home/ubuntu/start.sh - ssh -x -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no ubuntu:ubuntu@$ip "nohup bash /home/ubuntu/start.sh collectd $ip ${vdu_ip[4]} hello world &" + if ("$OS_CLOUDNAME" == "overcloud"); then + u="heat-admin" + p="" + else + u="ubuntu" + p=":ubuntu" + fi + scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no /tmp/tacker/blueprints/tosca-vnfd-hello-ves/start.sh $u@$ip:/home/$u/start.sh + ssh -x -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no $u$p@$ip "nohup bash /home/$u/start.sh collectd $ip ${vdu_ip[4]} hello world &" done echo "$0: $(date) wait 30 seconds for server SSH to be available" @@ -241,13 +248,13 @@ EOF done echo "$0: $(date) start vHello webserver in VDU1 at ${vdu_ip[1]}" - ssh -i /tmp/tacker/vHello.pem -x -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no ubuntu@${vdu_ip[1]} "nohup bash /home/ubuntu/start.sh webserver ${vdu_id[1]} ${vdu_ip[4]} hello world &" + ssh -i /tmp/tacker/vHello.pem -x -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no ubuntu@${vdu_ip[1]} "nohup bash /home/ubuntu/start.sh webserver ${vdu_id[1]} ${vdu_ip[4]} hello world > /dev/null 2>&1 &; exit" echo "$0: $(date) start vHello webserver in VDU2 at ${vdu_ip[2]}" - ssh -i /tmp/tacker/vHello.pem -x -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no ubuntu@${vdu_ip[2]} "nohup bash /home/ubuntu/start.sh webserver ${vdu_id[2]} ${vdu_ip[4]} hello world &" + ssh -i /tmp/tacker/vHello.pem -x -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no ubuntu@${vdu_ip[2]} "nohup bash /home/ubuntu/start.sh webserver ${vdu_id[2]} ${vdu_ip[4]} hello world > /dev/null 2>&1 &; exit" echo "$0: $(date) start LB in VDU3 at ${vdu_ip[3]}" - ssh -i /tmp/tacker/vHello.pem -x -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no ubuntu@${vdu_ip[3]} "nohup bash /home/ubuntu/start.sh lb ${vdu_id[3]} ${vdu_ip[4]} hello world ${vdu_ip[1]} ${vdu_ip[2]} &" + ssh -i /tmp/tacker/vHello.pem -x -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no ubuntu@${vdu_ip[3]} "nohup bash /home/ubuntu/start.sh lb ${vdu_id[3]} ${vdu_ip[4]} hello world ${vdu_ip[1]} ${vdu_ip[2]} > /dev/null 2>&1 &; exit" echo "$0: $(date) start Monitor in VDU4 at ${vdu_ip[4]}" # Replacing the default collector with monitor.py which has processing logic as well -- cgit 1.2.3-korg