diff options
-rwxr-xr-x | tests/blueprints/tosca-vnfd-hello-world-tacker/start.sh | 13 | ||||
-rw-r--r-- | tests/blueprints/tosca-vnfd-hello-world-tacker/vHello.pem | 29 | ||||
-rw-r--r-- | tests/blueprints/tosca-vnfd-hello-world-tacker/vHello.pub | 1 | ||||
-rw-r--r-- | tests/utils/tacker-setup.sh | 3 | ||||
-rw-r--r-- | tests/vHello_Tacker.sh | 32 |
5 files changed, 54 insertions, 24 deletions
diff --git a/tests/blueprints/tosca-vnfd-hello-world-tacker/start.sh b/tests/blueprints/tosca-vnfd-hello-world-tacker/start.sh index d2bf204..5285e69 100755 --- a/tests/blueprints/tosca-vnfd-hello-world-tacker/start.sh +++ b/tests/blueprints/tosca-vnfd-hello-world-tacker/start.sh @@ -21,12 +21,7 @@ # How to use: # $ bash start.sh -set -e - -sudo apt-get update -sudo apt-get install -y python3 - -cat <<EOF >index.html +cat << EOM | sudo tee /home/ubuntu/index.html <!DOCTYPE html> <html> <head> @@ -38,10 +33,8 @@ body { width: 100%; background-color: white; color: black; padding: 0px; margin: </head> <body> Hello World!<br> -<a href="http://wiki.opnfv.org"><img src="logo.png"></a> +<a href="http://wiki.opnfv.org"><img src="https://www.opnfv.org/sites/all/themes/opnfv/logo.png"></a> </body></html> -EOF - -wget https://www.opnfv.org/sites/all/themes/opnfv/logo.png +EOM nohup sudo python3 -m http.server 80 > /dev/null 2>&1 & diff --git a/tests/blueprints/tosca-vnfd-hello-world-tacker/vHello.pem b/tests/blueprints/tosca-vnfd-hello-world-tacker/vHello.pem new file mode 100644 index 0000000..15c166e --- /dev/null +++ b/tests/blueprints/tosca-vnfd-hello-world-tacker/vHello.pem @@ -0,0 +1,29 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIEqAIBAAKCAQEA0W9XrzB1+H5fm+850+cdeaqvOkNDsz0Zl2IpSogFIo+Xua0o +HxOj3UhVoyYLlJxrKIEUhT8LLVwv1ycLyxLgYWrs1IC5NJS6VZs5uOVfZwsxbsDB +h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bENYitzx4aeqnpnAfk +xdbbfDIJrYonerE1G4tCTFAGkQKCAIEAgGlODH2HARA2UO15oVw6jpb7xqSaKIZo +1BzlZlfnYeFsg5EOROYzkwJhLkk7YH0gD1epweWQT7eXPVESYClDcNdB4Z/lO9hC +i5zF5vQ2u+TGFwgzlW5RbE2sx2O1t+yj2qI2UVyFEWl4IimQQ4mdL65u0tRsHckj +ZHSVfTcNnXkCggCANM6LGdj1qIwp+mwBCdwyF7e7P6csjdX3afWv8sM4Uka4qSKG +tQrlnXMt/fgoIwatBPaRM6zWLU0dLie/F93kaqKEDly7dmcusEyp7szLGbDQjxpJ +h8+6MiPlW9O6s50stOjkAETohV3+jkdU2sCsWIIc4yPXvc8rF2znnlvSkbo= +-----END RSA PRIVATE KEY----- + + diff --git a/tests/blueprints/tosca-vnfd-hello-world-tacker/vHello.pub b/tests/blueprints/tosca-vnfd-hello-world-tacker/vHello.pub new file mode 100644 index 0000000..dcb5d1e --- /dev/null +++ b/tests/blueprints/tosca-vnfd-hello-world-tacker/vHello.pub @@ -0,0 +1 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDRb1evMHX4fl+b7znT5x15qq86Q0OzPRmXYilKiAUij5e5rSgfE6PdSFWjJguUnGsogRSFPwstXC/XJwvLEuBhauzUgLk0lLpVmzm45V9nCzFuwMGE6YIHXJW3qqH3WV6ijb5hCavWFIgfFRcMpQ5FDimkxM8yhRDg03uAXh77ORlFQiYpVbebAHcGy7mNBE043Lr75wYu5+KLWI9zEKQufMnjghkLs3yrNMi91LA6ruwNHrdIZy6FGkWXNsPl+QZglUyIhi4JMDqSz6hNkhJK3zrp/QURiSb6bmCnG2GWuReAj0YOPzZLaWPksTjPg9VMlR/cBCusCjuTiN67kJWL Generated-by-Nova diff --git a/tests/utils/tacker-setup.sh b/tests/utils/tacker-setup.sh index 078a388..b508059 100644 --- a/tests/utils/tacker-setup.sh +++ b/tests/utils/tacker-setup.sh @@ -335,6 +335,9 @@ case "$2" in openstack endpoint delete $(openstack endpoint list | awk "/tacker/ { print \$2 }") openstack user delete $(openstack user list | awk "/tacker/ { print \$2 }") openstack service delete $(openstack service list | awk "/tacker/ { print \$2 }") + pid=($(neutron port-list|grep -v "+"|grep -v id|awk '{print $2}')); for id in ${pid[@]}; do neutron port-delete ${id}; done + sid=($(openstack stack list|grep -v "+"|grep -v id|awk '{print $2}')); for id in ${sid[@]}; do openstack stack delete ${id}; done + sid=($(openstack security group list|grep security_group_local_security_group|awk '{print $2}')); for id in ${sid[@]}; do openstack security group delete ${id}; done neutron router-gateway-clear vnf_mgmt_router pid=($(neutron router-port-list vnf_mgmt_router|grep -v name|awk '{print $2}')); for id in ${pid[@]}; do neutron router-interface-delete vnf_mgmt_router vnf_mgmt; done neutron router-delete vnf_mgmt_router diff --git a/tests/vHello_Tacker.sh b/tests/vHello_Tacker.sh index c03881b..22a8878 100644 --- a/tests/vHello_Tacker.sh +++ b/tests/vHello_Tacker.sh @@ -29,6 +29,8 @@ set -x +trap 'fail' ERR + pass() { echo "Hooray!" set +x #echo off @@ -108,7 +110,7 @@ start() { SERVER_URL="http://$SERVER_IP" echo "$0: start vHello web server" - chown root ~/.ssh/vHello.pem + chown root /tmp/tacker/vHello.pem ssh -i /tmp/tacker/vHello.pem -x -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no ubuntu@$SERVER_IP <<EOF cat << EOM | sudo tee /home/ubuntu/index.html <!DOCTYPE html> @@ -172,18 +174,17 @@ if [[ "$2" == "setup" ]]; then echo "$0: copy tosca-vnfd-hello-world-tacker to blueprints folder" cp -r blueprints/tosca-vnfd-hello-world-tacker /tmp/tacker/blueprints - echo "$0: Create Nova key pair" - cd ~ - mkdir -p ~/.ssh - nova keypair-delete vHello - nova keypair-add vHello > ~/.ssh/vHello.pem - chmod 600 ~/.ssh/vHello.pem - cp ~/.ssh/vHello.pem /tmp/tacker - pubkey=$(nova keypair-show vHello | grep "Public key:" | sed -- 's/Public key: //g') - nova keypair-show vHello | grep "Public key:" | sed -- 's/Public key: //g' >~/.ssh/vHello.pub - cp ~/.ssh/vHello.pub /tmp/tacker - -# echo "$0: Inject key into xenial server image" +# Following two steps are in testing still. The guestfish step needs work. + +# echo "$0: Create Nova key pair" +# mkdir -p ~/.ssh +# nova keypair-delete vHello +# nova keypair-add vHello > /tmp/tacker/vHello.pem +# chmod 600 /tmp/tacker/vHello.pem +# pubkey=$(nova keypair-show vHello | grep "Public key:" | sed -- 's/Public key: //g') +# nova keypair-show vHello | grep "Public key:" | sed -- 's/Public key: //g' >/tmp/tacker/vHello.pub + + echo "$0: Inject key into xenial server image" # wget http://cloud-images.ubuntu.com/xenial/current/xenial-server-cloudimg-amd64-disk1.img # sudo yum install -y libguestfs-tools # guestfish <<EOF @@ -199,8 +200,11 @@ if [[ "$2" == "setup" ]]; then #chown -R ubuntu /home/ubuntu #EOF - echo "$0: Setup image_id" + # Using pre-key-injected image for now, vHello.pem as provided in the blueprint wget http://bkaj.net/opnfv/xenial-server-cloudimg-amd64-disk1.img + cp blueprints/tosca-vnfd-hello-world-tacker/vHello.pem /tmp/tacker + + echo "$0: Setup image_id" image_id=$(openstack image list | awk "/ models-xenial-server / { print \$2 }") if [ -z $image_id ]; then glance image-delete $image_id; fi glance --os-image-api-version 1 image-create --name models-xenial-server --disk-format qcow2 --file xenial-server-cloudimg-amd64-disk1.img --container-format bare |