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}
22 # Set defaults for ansible command-line options to drive the different
25 # NOTE(TheJulia/cinerama): The variables defined on the command line
26 # for the default and DHCP tests are to drive the use of Cirros as the
27 # deployed operating system, and as such sets the test user to cirros,
28 # and writes a debian style interfaces file out to the configuration
29 # drive as cirros does not support the network_info.json format file
30 # placed in the configuration drive. The "build image" test does not
34 export TEST_VM_NODE_NAMES="jumphost.opnfvlocal controller00.opnfvlocal compute00.opnfvlocal"
35 export VM_DOMAIN_TYPE="kvm"
38 TEST_PLAYBOOK="test-bifrost-infracloud.yaml"
44 CREATE_IPA_IMAGE=false
47 INVENTORY_DHCP_STATIC_IP=false
48 WRITE_INTERFACES_FILE=true
50 # Set BIFROST_INVENTORY_SOURCE
51 export BIFROST_INVENTORY_SOURCE=/tmp/baremetal.csv
53 # DIB custom elements path
54 export ELEMENTS_PATH=/usr/share/diskimage-builder/elements:/opt/puppet-infracloud/files/elements
56 # settings for console access
57 export DIB_DEV_USER_PWDLESS_SUDO=yes
58 export DIB_DEV_USER_PASSWORD=devuser
61 # NOTE(TheJulia): Ansible stable-1.9 source method tosses an error deep
62 # under the hood which -x will detect, so for this step, we need to suspend
63 # and then re-enable the feature.
65 $SCRIPT_HOME/env-setup.sh
66 source ${ANSIBLE_INSTALL_ROOT}/ansible/hacking/env-setup
67 ANSIBLE=$(which ansible-playbook)
70 # Change working directory
71 cd $BIFROST_HOME/playbooks
73 # Syntax check of dynamic inventory test path
75 -i inventory/localhost \
76 test-bifrost-create-vm.yaml \
80 -i inventory/localhost \
84 -e testing_user=${TESTING_USER}
88 -i inventory/localhost \
89 test-bifrost-create-vm.yaml \
90 -e test_vm_num_nodes=${TEST_VM_NUM_NODES} \
91 -e test_vm_memory_size=${VM_MEMORY_SIZE} \
92 -e enable_venv=${ENABLE_VENV} \
93 -e test_vm_domain_type=${VM_DOMAIN_TYPE}
95 # Execute the installation and VM startup test.
97 -i inventory/bifrost_inventory.py \
99 -e use_cirros=${USE_CIRROS} \
100 -e testing_user=${TESTING_USER} \
101 -e test_vm_num_nodes=${TEST_VM_NUM_NODES} \
102 -e inventory_dhcp=${INVENTORY_DHCP} \
103 -e inventory_dhcp_static_ip=${INVENTORY_DHCP_STATIC_IP} \
104 -e enable_venv=${ENABLE_VENV} \
105 -e enable_inspector=${USE_INSPECTOR} \
106 -e inspect_nodes=${INSPECT_NODES} \
107 -e download_ipa=${DOWNLOAD_IPA} \
108 -e create_ipa_image=${CREATE_IPA_IMAGE} \
109 -e write_interfaces_file=${WRITE_INTERFACES_FILE} \
110 -e ipv4_gateway=192.168.122.1
113 if [ $EXITCODE != 0 ]; then
114 echo "****************************"
115 echo "Test failed. See logs folder"
116 echo "****************************"
119 $SCRIPT_HOME/collect-test-info.sh