summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryan Sullivan <bryan.sullivan@att.com>2017-02-27 13:08:33 -0800
committerBryan Sullivan <bryan.sullivan@att.com>2017-02-28 10:59:34 -0800
commit180afdd04499f0a5c6b4c93cd269be526373880d (patch)
treef872852a7da1c7eee5607e8333346c3dc8f5c8fc
parented5d8f79a473ba75e63eccc6a7ecdba434835a66 (diff)
Update vHello_Tacker for Danube
JIRA: MODELS-23 Verified on devstack. Use current xenial cloud image link. Tests as part of asserts are not working - refactor. Correct URL for OPNFV logo. Fix if statements as needed. Loop on VNF deletion (response is 0 so can't use that as success indication). Increase VNF creation loop timeout. Use presence of dockerenv as "running in container" indication. Change-Id: I7cdc0719b1d5bac7cfb90efed9a8ce092a63ec86 Signed-off-by: Bryan Sullivan <bryan.sullivan@att.com>
-rw-r--r--[-rwxr-xr-x]tests/blueprints/tosca-vnfd-hello-world-tacker/blueprint.yaml7
-rw-r--r--tests/vHello_Tacker.sh87
2 files changed, 71 insertions, 23 deletions
diff --git a/tests/blueprints/tosca-vnfd-hello-world-tacker/blueprint.yaml b/tests/blueprints/tosca-vnfd-hello-world-tacker/blueprint.yaml
index bf570cc..edd2042 100755..100644
--- a/tests/blueprints/tosca-vnfd-hello-world-tacker/blueprint.yaml
+++ b/tests/blueprints/tosca-vnfd-hello-world-tacker/blueprint.yaml
@@ -12,7 +12,7 @@ topology_template:
artifacts:
VNFImage:
type: tosca.artifacts.Deployment.Image.VM
- file: http://cloud-images.ubuntu.com/releases/xenial/release/ubuntu-16.04-server-cloudimg-amd64-disk1.img
+ file: https://cloud-images.ubuntu.com/xenial/current/xenial-server-cloudimg-amd64-disk1.img
capabilities:
nfv_compute:
properties:
@@ -50,12 +50,13 @@ topology_template:
</head>
<body>
Hello World!<br>
- <a href="http://wiki.opnfv.org"><img src="https://www.opnfv.org/sites/all/themes/opnfv/logo.png"></a>
+ <a href="http://wiki.opnfv.org"><img src="https://www.opnfv.org/wp-content/uploads/2016/11/opnfv_logo_wp.png"></a>
<div>
- <p>Instance ID fom config drive file /mnt/openstack/latest/meta_data.json></p>
+ <p>Instance ID from config drive file /mnt/openstack/latest/meta_data.json></p>
<pre>
$id
</pre>
+ <p>Server setup completed at $(date)</p>
</div>
</body></html>
EOM
diff --git a/tests/vHello_Tacker.sh b/tests/vHello_Tacker.sh
index cf7dbae..7000ff2 100644
--- a/tests/vHello_Tacker.sh
+++ b/tests/vHello_Tacker.sh
@@ -99,7 +99,7 @@ fail() {
}
assert() {
- if [[ "$2" ]]; then echo "$0 test assertion passed: $1"
+ if [[ $2 == true ]]; then echo "$0 test assertion passed: $1"
else
echo "$0 test assertion failed: $1"
fail
@@ -122,8 +122,7 @@ get_floating_net () {
try () {
count=$1
$3
- while [[ $? -eq 1 && $count -gt 0 ]]
- do
+ while [[ $? == 1 && $count > 0 ]]; do
sleep $2
let count=$count-1
$3
@@ -172,9 +171,13 @@ setup () {
fi
assert "models-tacker-001 (Tacker installation in a docker container on the jumphost)" true
+}
+copy_blueprint() {
echo "$0: $(date) reset blueprints folder"
- if [[ -d /opt/tacker/blueprints/tosca-vnfd-hello-world-tacker ]]; then rm -rf /opt/tacker/blueprints/tosca-vnfd-hello-world-tacker; fi
+ if [[ -d /opt/tacker/blueprints/tosca-vnfd-hello-world-tacker ]]; then
+ rm -rf /opt/tacker/blueprints/tosca-vnfd-hello-world-tacker
+ fi
mkdir -p /opt/tacker/blueprints/tosca-vnfd-hello-world-tacker
echo "$0: $(date) copy tosca-vnfd-hello-world-tacker to blueprints folder"
@@ -203,7 +206,12 @@ start() {
cd /opt/tacker/blueprints/tosca-vnfd-hello-world-tacker
# newton: NAME (was "--name") is now a positional parameter
tacker vnfd-create --vnfd-file blueprint.yaml hello-world-tacker
- assert "models-tacker-002 (VNFD creation)" [[ $? -eq 0 ]]
+ if [[ $? -eq 0 ]]; then
+ assert "models-tacker-002 (VNFD creation)" true
+ else
+ assert "models-tacker-002 (VNFD creation)" false
+ fi
+
echo "$0: $(date) create VNF"
# newton: NAME (was "--name") is now a positional parameter
@@ -212,16 +220,22 @@ start() {
echo "$0: $(date) wait for hello-world-tacker to go ACTIVE"
active=""
- while [[ -z $active ]]
+ count=24
+ while [[ -z $active && $count -gt 0 ]]
do
active=$(tacker vnf-show hello-world-tacker | grep ACTIVE)
if [[ $(tacker vnf-show hello-world-tacker | grep -c ERROR) > 0 ]]; then
echo "$0: $(date) hello-world-tacker VNF creation failed with state ERROR"
assert "models-tacker-002 (VNF creation)" false
fi
- sleep 10
+ let count=$count-1
+ sleep 30
echo "$0: $(date) wait for hello-world-tacker to go ACTIVE"
done
+ if [[ $count == 0 ]]; then
+ echo "$0: $(date) hello-world-tacker VNF creation failed - timed out"
+ assert "models-tacker-002 (VNF creation)" false
+ fi
assert "models-tacker-002 (VNF creation)" true
# Setup for workarounds
@@ -265,30 +279,52 @@ start() {
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-vhello-001 (vHello VNF creation)" [[ $(curl $SERVER_URL | grep -c "Hello World") > 0 ]]
+ assert "models-vhello-001 (vHello VNF creation)" true
assert "models-tacker-003 (VNF creation)" true
assert "models-tacker-vnfd-002 (artifacts creation)" true
assert "models-tacker-vnfd-003 (user_data creation)" true
echo "$0: $(date) verify contents of config drive are included in web page"
id=$(curl $SERVER_URL | awk "/uuid/ { print \$2 }")
- assert "models-tacker-vnfd-001 (config_drive creation)" [[ -z "$id" ]]
+ assert "models-tacker-vnfd-001 (config_drive creation)" [[ ! -z "$id" ]]
}
stop() {
echo "$0: $(date) setup OpenStack CLI environment"
source /opt/tacker/admin-openrc.sh
+set -x
+ if [[ "$(tacker vnf-list|grep hello-world-tacker|awk '{print $2}')" != '' ]]; then
+ echo "$0: $(date) uninstall vHello blueprint via CLI"
+ try 12 10 "tacker vnf-delete hello-world-tacker"
+ # It can take some time to delete a VNF - thus wait 2 minutes
+ count=12
+ while [[ $count > 0 && "$(tacker vnf-list|grep hello-world-tacker|awk '{print $2}')" != '' ]]; do
+ sleep 10
+ let count=$count-1
+ done
+ if [[ "$(tacker vnf-list|grep hello-world-tacker|awk '{print $2}')" == '' ]]; then
+ assert "models-tacker-004 (VNF deletion)" true
+ else
+ assert "models-tacker-004 (VNF deletion)" false
+ fi
+ fi
- echo "$0: $(date) uninstall vHello blueprint via CLI"
- vid=($(tacker vnf-list|grep hello-world-tacker|awk '{print $2}')); for id in ${vid[@]}; do tacker vnf-delete ${id}; done
- assert "models-tacker-004 (VNF deletion)" [[ -z "$(tacker vnf-list|grep hello-world-tacker|awk '{print $2}')" ]]
-
- vid=($(tacker vnfd-list|grep hello-world-tacker|awk '{print $2}')); for id in ${vid[@]}; do try 10 10 "tacker vnfd-delete ${id}"; done
- assert "models-tacker-005 (VNFD deletion)" [[ -z "$(tacker vnfd-list|grep hello-world-tacker|awk '{print $2}')" ]]
+ # It can take some time to delete a VNFD - thus wait 2 minutes
+ if [[ "$(tacker vnfd-list|grep hello-world-tacker|awk '{print $2}')" != '' ]]; then
+ try 12 10 "tacker vnfd-delete hello-world-tacker"
+ if [[ "$(tacker vnfd-list|grep hello-world-tacker|awk '{print $2}')" == '' ]]; then
+ assert "models-tacker-005 (VNFD deletion)" true
+ else
+ assert "models-tacker-005 (VNFD deletion)" false
+ fi
+ fi
iid=($(openstack image list|grep VNFImage|awk '{print $2}')); for id in ${iid[@]}; do openstack image delete ${id}; done
- assert "models-tacker-vnfd-004 (artifacts deletion)" [[ -z "$(openstack image list|grep VNFImage|awk '{print $2}')" ]]
+ if [[ "$(openstack image list|grep VNFImage|awk '{print $2}')" == '' ]]; then
+ assert "models-tacker-vnfd-004 (artifacts deletion)" true
+ else
+ assert "models-tacker-vnfd-004 (artifacts deletion)" false
+ fi
# Cleanup for workarounds
fip=($(neutron floatingip-list|grep -v "+"|grep -v id|awk '{print $2}')); for id in ${fip[@]}; do neutron floatingip-delete ${id}; done
@@ -315,15 +351,26 @@ case "$1" in
;;
run)
setup $2 $3
+ copy_blueprint
forward_to_container start
if [ $? -eq 1 ]; then fail; fi
pass
;;
- start|stop)
+ start)
+ if [[ -f /.dockerenv ]]; then
+ start
+ else
+ copy_blueprint
+ forward_to_container start
+ fi
+ if [ $? -eq 1 ]; then fail; fi
+ pass
+ ;;
+ stop)
if [[ -f /.dockerenv ]]; then
- $1
+ stop
else
- forward_to_container $1
+ forward_to_container stop
fi
if [ $? -eq 1 ]; then fail; fi
pass