2 # SPDX-license-identifier: Apache-2.0
3 ##############################################################################
4 # Copyright (c) 2016 Ericsson AB and others.
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
9 ##############################################################################
13 export PYTHONUNBUFFERED=1
14 SCRIPT_HOME="$(cd "$(dirname "$0")" && pwd)"
15 BIFROST_HOME=$SCRIPT_HOME/..
16 ANSIBLE_INSTALL_ROOT=${ANSIBLE_INSTALL_ROOT:-/opt/stack}
21 PROVISION_WAIT_TIMEOUT=${PROVISION_WAIT_TIMEOUT:-2400}
23 # Set defaults for ansible command-line options to drive the different
26 # NOTE(TheJulia/cinerama): The variables defined on the command line
27 # for the default and DHCP tests are to drive the use of Cirros as the
28 # deployed operating system, and as such sets the test user to cirros,
29 # and writes a debian style interfaces file out to the configuration
30 # drive as cirros does not support the network_info.json format file
31 # placed in the configuration drive. The "build image" test does not
35 export TEST_VM_NODE_NAMES="jumphost.opnfvlocal controller00.opnfvlocal compute00.opnfvlocal"
36 export VM_DOMAIN_TYPE="kvm"
39 TEST_PLAYBOOK="test-bifrost-infracloud.yaml"
45 CREATE_IPA_IMAGE=false
48 INVENTORY_DHCP_STATIC_IP=false
49 WRITE_INTERFACES_FILE=true
51 # Set BIFROST_INVENTORY_SOURCE
52 export BIFROST_INVENTORY_SOURCE=/tmp/baremetal.csv
54 # DIB custom elements path
55 export ELEMENTS_PATH=/usr/share/diskimage-builder/elements:/opt/puppet-infracloud/files/elements
57 # settings for console access
58 export DIB_DEV_USER_PWDLESS_SUDO=yes
59 export DIB_DEV_USER_PASSWORD=devuser
61 # settings for distro: trusty/ubuntu-minimal, 7/centos-minimal
62 export DIB_OS_RELEASE=${DIB_OS_RELEASE:-trusty}
63 export DIB_OS_ELEMENT=${DIB_OS_ELEMENT:-ubuntu-minimal}
65 # for centos 7: "openssh-server,vim,less,bridge-utils,iputils,rsyslog,curl"
66 export DIB_OS_PACKAGES=${DIB_OS_PACKAGES:-"openssh-server,vlan,vim,less,bridge-utils,language-pack-en,iputils-ping,rsyslog,curl"}
69 # NOTE(TheJulia): Ansible stable-1.9 source method tosses an error deep
70 # under the hood which -x will detect, so for this step, we need to suspend
71 # and then re-enable the feature.
73 $SCRIPT_HOME/env-setup.sh
74 source ${ANSIBLE_INSTALL_ROOT}/ansible/hacking/env-setup
75 ANSIBLE=$(which ansible-playbook)
78 # Change working directory
79 cd $BIFROST_HOME/playbooks
81 # Syntax check of dynamic inventory test path
82 for task in syntax-check list-tasks; do
84 -i inventory/localhost \
85 test-bifrost-create-vm.yaml \
88 -i inventory/localhost \
91 -e testing_user=${TESTING_USER}
96 -i inventory/localhost \
97 test-bifrost-create-vm.yaml \
98 -e test_vm_num_nodes=${TEST_VM_NUM_NODES} \
99 -e test_vm_memory_size=${VM_MEMORY_SIZE} \
100 -e enable_venv=${ENABLE_VENV} \
101 -e test_vm_domain_type=${VM_DOMAIN_TYPE}
103 # Execute the installation and VM startup test.
105 -i inventory/bifrost_inventory.py \
107 -e use_cirros=${USE_CIRROS} \
108 -e testing_user=${TESTING_USER} \
109 -e test_vm_num_nodes=${TEST_VM_NUM_NODES} \
110 -e inventory_dhcp=${INVENTORY_DHCP} \
111 -e inventory_dhcp_static_ip=${INVENTORY_DHCP_STATIC_IP} \
112 -e enable_venv=${ENABLE_VENV} \
113 -e enable_inspector=${USE_INSPECTOR} \
114 -e inspect_nodes=${INSPECT_NODES} \
115 -e download_ipa=${DOWNLOAD_IPA} \
116 -e create_ipa_image=${CREATE_IPA_IMAGE} \
117 -e write_interfaces_file=${WRITE_INTERFACES_FILE} \
118 -e ipv4_gateway=192.168.122.1 \
119 -e wait_timeout=${PROVISION_WAIT_TIMEOUT}
122 if [ $EXITCODE != 0 ]; then
123 echo "****************************"
124 echo "Test failed. See logs folder"
125 echo "****************************"
128 $SCRIPT_HOME/collect-test-info.sh