From 559f60d48f59ba60bc1e0fd70be223f04abd9752 Mon Sep 17 00:00:00 2001 From: Bryan Sullivan Date: Wed, 25 Jan 2017 10:21:35 -0800 Subject: Include tacker.conf.sample due to issues with tox, etc JIRA: MODELS-23 Change from OSC to specific clients (e.g. neutron) due to issues with newton version of the OSC. Add apt-utils install due to not in default Xenial container. Fix branch selection for OSC and other clients. Comment out tox section (throwing exceptions for some reason). Use tacker.conf.sample included in the repo. Fix test for VNF active (tacker vnf-show). Add loop for server up test. Add OpenStack branch as option. Change-Id: Id85b433e94df57c7b68f7feec2ce9cf6b2b238e0 Signed-off-by: Bryan Sullivan --- tests/vHello_Tacker.sh | 48 ++++++++++++++++++++++++++++-------------------- 1 file changed, 28 insertions(+), 20 deletions(-) (limited to 'tests/vHello_Tacker.sh') diff --git a/tests/vHello_Tacker.sh b/tests/vHello_Tacker.sh index b89eb9c..934f63c 100644 --- a/tests/vHello_Tacker.sh +++ b/tests/vHello_Tacker.sh @@ -39,7 +39,7 @@ # 1) models-joid-001 | models-apex-001 (installation of OPNFV system) # # Test Steps and Assertions: -# 1) bash vHello_Tacker.sh setup +# 1) bash vHello_Tacker.sh setup [branch] # models-tacker-001 (Tacker installation in a docker container on the jumphost) # models-nova-001 (Keypair creation) # 2) bash vHello_Tacker.sh start @@ -68,14 +68,16 @@ # How to use: # $ git clone https://gerrit.opnfv.org/gerrit/models # $ cd models/tests -# $ bash vHello_Tacker.sh [setup|start|run|stop|clean] [] [] -# setup: setup test environment -# run: setup test environment and run test -# start: install blueprint and run test -# stop: stop test and uninstall blueprint -# clean: cleanup after test -# : include for setup|run as location of OpenStack openrc file -# : include for setup|run as IP address of the Heat service +# $ bash vHello_Tacker.sh [setup|run] [] [] [branch] +# setup: setup test environment +# : location of OpenStack openrc file +# : IP address of the Heat service +# branch: OpenStack branch to install (default: master) +# $ bash vHello_Tacker.sh [start|stop|clean] +# run: setup test environment and run test +# start: install blueprint and run test +# stop: stop test and uninstall blueprint +# clean: cleanup after test trap 'fail' ERR @@ -110,7 +112,7 @@ get_floating_net () { [[ $(neutron net-show ${id}|grep 'router:external'|grep -i "true") != "" ]] && FLOATING_NETWORK_ID=${id} done if [[ $FLOATING_NETWORK_ID ]]; then - FLOATING_NETWORK_NAME=$(openstack network show $FLOATING_NETWORK_ID | awk "/ name / { print \$4 }") + FLOATING_NETWORK_NAME=$(neutron net-show $FLOATING_NETWORK_ID | awk "/ name / { print \$4 }") else echo "$0: $(date) Floating network not found" exit 1 @@ -161,11 +163,11 @@ setup () { fi echo "$0: $(date) Execute tacker-setup.sh in the container" - sudo docker exec -it tacker /bin/bash /tmp/tacker/tacker-setup.sh setup + sudo docker exec -it tacker /bin/bash /tmp/tacker/tacker-setup.sh setup $3 if [ $? -eq 1 ]; then fail; fi else echo "$0: $(date) Execute tacker-setup.sh in the container" - sudo docker exec -i -t tacker /bin/bash /tmp/tacker/tacker-setup.sh setup + sudo docker exec -i -t tacker /bin/bash /tmp/tacker/tacker-setup.sh setup $3 if [ $? -eq 1 ]; then fail; fi fi @@ -214,7 +216,7 @@ start() { while [[ -z $active ]] do active=$(tacker vnf-show hello-world-tacker | grep ACTIVE) - if [ "$(tacker vnf-show hello-world-tacker | grep -c ERROR)" > "0" ]; then + if [[ $(tacker vnf-show hello-world-tacker | grep -c ERROR) > 0 ]]; then echo "$0: $(date) hello-world-tacker VNF creation failed with state ERROR" fail fi @@ -235,16 +237,16 @@ start() { done echo "$0: $(date) directly assign security group (unsupported in Mitaka Tacker)" - if [[ $(openstack security group list | awk "/ vHello / { print \$2 }") ]]; then openstack security group vHello; fi - openstack security group create vHello - openstack security group rule create --ingress --protocol TCP --dst-port 22:22 vHello - openstack security group rule create --ingress --protocol TCP --dst-port 80:80 vHello + if [[ $(neutron security-group-list | awk "/ vHello / { print \$2 }") ]]; then neutron security-group-delete vHello; fi + neutron security-group-create vHello + neutron security-group-rule-create --direction ingress --protocol TCP --port-range-min 22 --port-range-max 22 vHello + neutron security-group-rule-create --direction ingress --protocol TCP --port-range-min 80 --port-range-max 80 vHello openstack server add security group $SERVER_ID vHello openstack server add security group $SERVER_ID default echo "$0: $(date) associate floating IP" get_floating_net - FIP=$(openstack floating ip create $FLOATING_NETWORK_NAME | awk "/floating_ip_address/ { print \$4 }") + FIP=$(nova floating-ip-create $FLOATING_NETWORK_NAME | awk "/public/ { print \$4 }") nova floating-ip-associate $SERVER_ID $FIP # End setup for workarounds @@ -257,6 +259,12 @@ start() { echo "$0: $(date) verify vHello server is running" apt-get install -y curl + count=12 + while [[ $(curl $SERVER_URL | grep -c "Hello World") == 0 ]] + do + sleep 10 + let count=$count-1 + done if [[ $(curl $SERVER_URL | grep -c "Hello World") == 0 ]]; then fail; fi assert "models-vhello-001 (vHello VNF creation)" true assert "models-tacker-003 (VNF creation)" true @@ -304,12 +312,12 @@ dist=`grep DISTRIB_ID /etc/*-release | awk -F '=' '{print $2}'` case "$1" in setup) - setup $2 $3 + setup $2 $3 $4 if [ $? -eq 1 ]; then fail; fi pass ;; run) - setup $2 $3 + setup $2 $3 $4 forward_to_container start if [ $? -eq 1 ]; then fail; fi pass -- cgit 1.2.3-korg