Merge "bifrost: test-bifrost-deployment.sh: Use the new 'openssh-server' dib element"
[releng.git] / prototypes / bifrost / scripts / test-bifrost-deployment.sh
index 5df58f8..90f014c 100755 (executable)
@@ -1,3 +1,4 @@
+#!/bin/bash
 # SPDX-license-identifier: Apache-2.0
 ##############################################################################
 # Copyright (c) 2016 Ericsson AB and others.
@@ -6,7 +7,6 @@
 # which accompanies this distribution, and is available at
 # http://www.apache.org/licenses/LICENSE-2.0
 ##############################################################################
-#!/bin/bash
 
 set -eux
 set -o pipefail
@@ -18,6 +18,7 @@ ENABLE_VENV="false"
 USE_DHCP="false"
 USE_VENV="false"
 BUILD_IMAGE=true
+PROVISION_WAIT_TIMEOUT=${PROVISION_WAIT_TIMEOUT:-3600}
 
 # Set defaults for ansible command-line options to drive the different
 # tests.
@@ -33,13 +34,13 @@ BUILD_IMAGE=true
 TEST_VM_NUM_NODES=3
 export TEST_VM_NODE_NAMES="jumphost.opnfvlocal controller00.opnfvlocal compute00.opnfvlocal"
 export VM_DOMAIN_TYPE="kvm"
-export VM_CPU=4
-export VM_DISK=100
+export VM_CPU=${VM_CPU:-4}
+export VM_DISK=${VM_DISK:-100}
 TEST_PLAYBOOK="test-bifrost-infracloud.yaml"
 USE_INSPECTOR=true
 USE_CIRROS=false
 TESTING_USER=root
-VM_MEMORY_SIZE="8192"
+VM_MEMORY_SIZE=${VM_MEMORY_SIZE:-8192}
 DOWNLOAD_IPA=true
 CREATE_IPA_IMAGE=false
 INSPECT_NODES=true
@@ -57,6 +58,16 @@ export ELEMENTS_PATH=/usr/share/diskimage-builder/elements:/opt/puppet-infraclou
 export DIB_DEV_USER_PWDLESS_SUDO=yes
 export DIB_DEV_USER_PASSWORD=devuser
 
+# settings for distro: trusty/ubuntu-minimal, 7/centos7
+export DIB_OS_RELEASE=${DIB_OS_RELEASE:-trusty}
+export DIB_OS_ELEMENT=${DIB_OS_ELEMENT:-ubuntu-minimal}
+
+# for centos 7: "vim,less,bridge-utils,iputils,rsyslog,curl"
+export DIB_OS_PACKAGES=${DIB_OS_PACKAGES:-"vlan,vim,less,bridge-utils,language-pack-en,iputils-ping,rsyslog,curl"}
+
+# Additional dib elements
+export EXTRA_DIB_ELEMENTS=${EXTRA_DIB_ELEMENTS:-"openssh-server"}
+
 # Source Ansible
 # NOTE(TheJulia): Ansible stable-1.9 source method tosses an error deep
 # under the hood which -x will detect, so for this step, we need to suspend
@@ -71,17 +82,17 @@ set -x -o nounset
 cd $BIFROST_HOME/playbooks
 
 # Syntax check of dynamic inventory test path
-${ANSIBLE} -vvvv \
-       -i inventory/localhost \
-       test-bifrost-create-vm.yaml \
-       --syntax-check \
-       --list-tasks
-${ANSIBLE} -vvvv \
-       -i inventory/localhost \
-       ${TEST_PLAYBOOK} \
-       --syntax-check \
-       --list-tasks \
-       -e testing_user=${TESTING_USER}
+for task in syntax-check list-tasks; do
+    ${ANSIBLE} -vvvv \
+           -i inventory/localhost \
+           test-bifrost-create-vm.yaml \
+           --${task}
+    ${ANSIBLE} -vvvv \
+           -i inventory/localhost \
+           ${TEST_PLAYBOOK} \
+           --${task} \
+           -e testing_user=${TESTING_USER}
+done
 
 # Create the test VMS
 ${ANSIBLE} -vvvv \
@@ -107,7 +118,8 @@ ${ANSIBLE} -vvvv \
     -e download_ipa=${DOWNLOAD_IPA} \
     -e create_ipa_image=${CREATE_IPA_IMAGE} \
     -e write_interfaces_file=${WRITE_INTERFACES_FILE} \
-    -e ipv4_gateway=192.168.122.1
+    -e ipv4_gateway=192.168.122.1 \
+    -e wait_timeout=${PROVISION_WAIT_TIMEOUT}
 EXITCODE=$?
 
 if [ $EXITCODE != 0 ]; then