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 BAREMETAL_DATA_FILE=${BAREMETAL_DATA_FILE:-'/tmp/baremetal.json'}
22 PROVISION_WAIT_TIMEOUT=${PROVISION_WAIT_TIMEOUT:-3600}
24 # Set defaults for ansible command-line options to drive the different
27 # NOTE(TheJulia/cinerama): The variables defined on the command line
28 # for the default and DHCP tests are to drive the use of Cirros as the
29 # deployed operating system, and as such sets the test user to cirros,
30 # and writes a debian style interfaces file out to the configuration
31 # drive as cirros does not support the network_info.json format file
32 # placed in the configuration drive. The "build image" test does not
36 export TEST_VM_NODE_NAMES="jumphost controller00 controller01 controller02 compute00 compute01"
37 export VM_DOMAIN_TYPE="kvm"
38 # 8 vCPU, 60 GB HDD are minimum equipment
39 export VM_CPU=${VM_CPU:-8}
40 export VM_DISK=${VM_DISK:-100}
41 export VM_DISK_CACHE=${VM_DISK_CACHE:-unsafe}
42 TEST_PLAYBOOK="test-bifrost-infracloud.yaml"
46 # seting the memory to 16 GB to make more easily success
47 # 8 GB RAM is minimum equipment, but it work with at least 12 GB.
48 VM_MEMORY_SIZE=${VM_MEMORY_SIZE:-16384}
50 CREATE_IPA_IMAGE=false
53 INVENTORY_DHCP_STATIC_IP=false
54 WRITE_INTERFACES_FILE=true
56 # Set BIFROST_INVENTORY_SOURCE
57 export BIFROST_INVENTORY_SOURCE=/tmp/baremetal.json
59 # DIB custom elements path
60 export ELEMENTS_PATH=/opt/puppet-infracloud/files/elements
62 # settings for console access
63 export DIB_DEV_USER_PWDLESS_SUDO=yes
64 export DIB_DEV_USER_PASSWORD=devuser
66 # settings for distro: trusty/ubuntu-minimal, 7/centos7
67 export DIB_OS_RELEASE=${DIB_OS_RELEASE:-xenial}
68 export DIB_OS_ELEMENT=${DIB_OS_ELEMENT:-ubuntu-minimal}
70 # for centos 7: "vim,less,bridge-utils,iputils,rsyslog,curl"
71 export DIB_OS_PACKAGES=${DIB_OS_PACKAGES:-"vlan,vim,less,bridge-utils,sudo,language-pack-en,iputils-ping,rsyslog,curl,python,debootstrap,ifenslave,ifenslave-2.6,lsof,lvm2,tcpdump,nfs-kernel-server,chrony"}
73 # Additional dib elements
74 export EXTRA_DIB_ELEMENTS=${EXTRA_DIB_ELEMENTS:-"openssh-server"}
77 # NOTE(TheJulia): Ansible stable-1.9 source method tosses an error deep
78 # under the hood which -x will detect, so for this step, we need to suspend
79 # and then re-enable the feature.
81 $SCRIPT_HOME/env-setup.sh
82 source ${ANSIBLE_INSTALL_ROOT}/ansible/hacking/env-setup
83 ANSIBLE=$(which ansible-playbook)
87 $SCRIPT_HOME/collect-test-info.sh
89 trap logs_on_exit EXIT
91 # Change working directory
92 cd $BIFROST_HOME/playbooks
94 # Syntax check of dynamic inventory test path
95 for task in syntax-check list-tasks; do
97 -i inventory/localhost \
98 test-bifrost-create-vm.yaml \
101 -i inventory/localhost \
104 -e testing_user=${TESTING_USER}
107 # Create the test VMS
109 -i inventory/localhost \
110 test-bifrost-create-vm.yaml \
111 -e test_vm_num_nodes=${TEST_VM_NUM_NODES} \
112 -e test_vm_memory_size=${VM_MEMORY_SIZE} \
113 -e enable_venv=${ENABLE_VENV} \
114 -e test_vm_domain_type=${VM_DOMAIN_TYPE} \
115 -e baremetal_json_file=${BAREMETAL_DATA_FILE}
117 # Execute the installation and VM startup test.
119 -i inventory/bifrost_inventory.py \
121 -e use_cirros=${USE_CIRROS} \
122 -e testing_user=${TESTING_USER} \
123 -e test_vm_num_nodes=${TEST_VM_NUM_NODES} \
124 -e inventory_dhcp=${INVENTORY_DHCP} \
125 -e inventory_dhcp_static_ip=${INVENTORY_DHCP_STATIC_IP} \
126 -e enable_venv=${ENABLE_VENV} \
127 -e enable_inspector=${USE_INSPECTOR} \
128 -e inspect_nodes=${INSPECT_NODES} \
129 -e download_ipa=${DOWNLOAD_IPA} \
130 -e create_ipa_image=${CREATE_IPA_IMAGE} \
131 -e write_interfaces_file=${WRITE_INTERFACES_FILE} \
132 -e ipv4_gateway=192.168.122.1 \
133 -e wait_timeout=${PROVISION_WAIT_TIMEOUT}
136 if [ $EXITCODE != 0 ]; then
137 echo "****************************"
138 echo "Test failed. See logs folder"
139 echo "****************************"