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:-3600}
22 BAREMETAL_DATA_FILE=${BAREMETAL_DATA_FILE:-'/tmp/baremetal.json'}
23 INVENTORY_FILE_FORMAT="baremetal_json_file"
24 export BIFROST_INVENTORY_SOURCE=$BAREMETAL_DATA_FILE
26 # Set defaults for ansible command-line options to drive the different
29 # NOTE(TheJulia/cinerama): The variables defined on the command line
30 # for the default and DHCP tests are to drive the use of Cirros as the
31 # deployed operating system, and as such sets the test user to cirros,
32 # and writes a debian style interfaces file out to the configuration
33 # drive as cirros does not support the network_info.json format file
34 # placed in the configuration drive. The "build image" test does not
38 export TEST_VM_NODE_NAMES="xcimaster controller00 compute00"
39 export VM_DOMAIN_TYPE="kvm"
40 export VM_CPU=${VM_CPU:-4}
41 export VM_DISK=${VM_DISK:-100}
42 export VM_DISK_CACHE=${VM_DISK_CACHE:-unsafe}
43 TEST_PLAYBOOK="opnfv-virtual.yaml"
47 VM_MEMORY_SIZE=${VM_MEMORY_SIZE:-8192}
49 CREATE_IPA_IMAGE=false
52 INVENTORY_DHCP_STATIC_IP=false
53 WRITE_INTERFACES_FILE=true
55 # settings for console access
56 export DIB_DEV_USER_PWDLESS_SUDO=yes
57 export DIB_DEV_USER_PASSWORD=devuser
59 # settings for distro: trusty/ubuntu-minimal, 7/centos7
60 export DIB_OS_RELEASE=${DIB_OS_RELEASE:-trusty}
61 export DIB_OS_ELEMENT=${DIB_OS_ELEMENT:-ubuntu-minimal}
63 # for centos 7: "vim,less,bridge-utils,iputils,rsyslog,curl"
64 export DIB_OS_PACKAGES=${DIB_OS_PACKAGES:-"vlan,vim,less,bridge-utils,language-pack-en,iputils-ping,rsyslog,curl"}
66 # Additional dib elements
67 export EXTRA_DIB_ELEMENTS=${EXTRA_DIB_ELEMENTS:-"openssh-server"}
70 # NOTE(TheJulia): Ansible stable-1.9 source method tosses an error deep
71 # under the hood which -x will detect, so for this step, we need to suspend
72 # and then re-enable the feature.
74 $SCRIPT_HOME/env-setup.sh
75 source ${ANSIBLE_INSTALL_ROOT}/ansible/hacking/env-setup
76 ANSIBLE=$(which ansible-playbook)
80 $SCRIPT_HOME/collect-test-info.sh
82 trap logs_on_exit EXIT
84 # Change working directory
85 cd $BIFROST_HOME/playbooks
87 # Syntax check of dynamic inventory test path
88 for task in syntax-check list-tasks; do
90 -i inventory/localhost \
91 test-bifrost-create-vm.yaml \
94 -i inventory/localhost \
97 -e testing_user=${TESTING_USER}
100 # Create the test VMS
102 -i inventory/localhost \
103 test-bifrost-create-vm.yaml \
104 -e test_vm_num_nodes=${TEST_VM_NUM_NODES} \
105 -e test_vm_memory_size=${VM_MEMORY_SIZE} \
106 -e enable_venv=${ENABLE_VENV} \
107 -e test_vm_domain_type=${VM_DOMAIN_TYPE} \
108 -e ${INVENTORY_FILE_FORMAT}=${BAREMETAL_DATA_FILE}
110 # Execute the installation and VM startup test.
112 -i inventory/bifrost_inventory.py \
114 -e use_cirros=${USE_CIRROS} \
115 -e testing_user=${TESTING_USER} \
116 -e test_vm_num_nodes=${TEST_VM_NUM_NODES} \
117 -e inventory_dhcp=${INVENTORY_DHCP} \
118 -e inventory_dhcp_static_ip=${INVENTORY_DHCP_STATIC_IP} \
119 -e enable_venv=${ENABLE_VENV} \
120 -e enable_inspector=${USE_INSPECTOR} \
121 -e inspect_nodes=${INSPECT_NODES} \
122 -e download_ipa=${DOWNLOAD_IPA} \
123 -e create_ipa_image=${CREATE_IPA_IMAGE} \
124 -e write_interfaces_file=${WRITE_INTERFACES_FILE} \
125 -e ipv4_gateway=192.168.122.1 \
126 -e wait_timeout=${PROVISION_WAIT_TIMEOUT}
129 if [ $EXITCODE != 0 ]; then
130 echo "****************************"
131 echo "Test failed. See logs folder"
132 echo "****************************"