Add verification of config drive setup. Get key key from ~/vHello/pem. 65/25065/1
authorBryan Sullivan <bryan.sullivan@att.com>
Tue, 29 Nov 2016 05:46:21 +0000 (21:46 -0800)
committerBryan Sullivan <bryan.sullivan@att.com>
Tue, 29 Nov 2016 05:48:08 +0000 (21:48 -0800)
JIRA: MODELS-23

Signed-off-by: Bryan Sullivan <bryan.sullivan@att.com>
The key is not saved in the repo due to security recommendations.
This is a kludge that will be removed for Newton (Tacker supports
key injection as of Newton).

Change-Id: I6a21b189fc7b2b5a960a7acdd4b640148797d738
Signed-off-by: Bryan Sullivan <bryan.sullivan@att.com>
tests/blueprints/tosca-vnfd-hello-world-tacker/blueprint.yaml
tests/vHello_Tacker.sh

index c70fd25..99b8d9d 100755 (executable)
@@ -27,8 +27,11 @@ topology_template:
         config_drive: true
         user_data_format: RAW
         user_data: |
-          #!/bin/sh
+          #!/bin/bash
+          set -x
+          sudo mount /dev/sr0 /mnt/
           cd /tmp
+          id=$(cut -d ',' -f 3 /mnt/openstack/latest/meta_data.json)
           cat << EOM | sudo tee index.html
           <!DOCTYPE html>
           <html>
@@ -42,6 +45,12 @@ topology_template:
           <body>
           Hello World!<br>
           <a href="http://wiki.opnfv.org"><img src="https://www.opnfv.org/sites/all/themes/opnfv/logo.png"></a>
+          <div>
+          <p>Instance ID fom config drive file /mnt/openstack/latest/meta_data.json></p>
+          <pre>
+          $id
+          </pre>
+          </div>
           </body></html>
           EOM
           sudo python3 -m http.server 80
index 41d868d..9643130 100644 (file)
@@ -132,7 +132,7 @@ setup () {
   if [ ! -f /tmp/xenial-server-cloudimg-amd64-disk1.img ]; then 
     wget -O /tmp/xenial-server-cloudimg-amd64-disk1.img  http://artifacts.opnfv.org/models/images/xenial-server-cloudimg-amd64-disk1.img
   fi
-  cp blueprints/tosca-vnfd-hello-world-tacker/vHello.pem /tmp/tacker
+  cp ~/vHello.pem /tmp/tacker
   chmod 600 /tmp/tacker/vHello.pem
 
   echo "$0: setup OpenStack CLI environment"
@@ -207,6 +207,11 @@ start() {
   echo "$0: verify vHello server is running"
   apt-get install -y curl
   if [[ $(curl $SERVER_URL | grep -c "Hello World") == 0 ]]; then fail; fi
+
+  echo "$0: verify contents of config drive are included in web page"
+  id=$(curl $SERVER_URL | awk "/uuid/ { print \$2 }")
+  if [[ -z "$id" ]]; then fail; fi
+
 }
 
 stop() {