functional: vagrantfile for functional test

add vagantfile for functional test so that the environment
can be setup easily.

Change-Id: Ibcb98275a845b0c5d1644581f44c533f15037e5c
This commit is contained in:
Isaku Yamahata
2016-12-08 14:32:26 -08:00
parent 566a18242e
commit 98f82d6f19
10 changed files with 200 additions and 7 deletions

View File

@@ -8,7 +8,7 @@ _XTRACE_NETWORKING_ODL=$(set +o | grep xtrace)
set +o xtrace
# OpenDaylight directories
NETWORKING_ODL_DIR=$DEST/networking-odl
NETWORKING_ODL_DIR=${NETWORKING_ODL_DIR:-$DEST/networking-odl}
ODL_DIR=$DEST/opendaylight
# Make sure $ODL_DIR exists

View File

@@ -10,7 +10,7 @@ source $DEVSTACK_PATH/openrc admin admin
TEMPEST_CODE_DIR="$BASE/new/tempest"
TEMPEST_DATA_DIR="$DATA_DIR/tempest"
NETWORKING_ODL_DIR="$BASE/new/networking-odl"
NETWORKING_ODL_DIR="${NETWORKING_ODL_DIR:-$BASE/new/networking-odl}"
owner=stack
sudo_env="TEMPEST_CONFIG_DIR=$TEMPEST_CODE_DIR/etc"

View File

@@ -67,5 +67,5 @@ esac
IS_GATE=$(trueorfalse False IS_GATE)
if [[ "$IS_GATE" == "True" ]]
then
NETWORKING_ODL_DIR=$DEST/networking-odl
NETWORKING_ODL_DIR=${NETWORKING_ODL_DIR:-$DEST/networking-odl}
fi

View File

@@ -6,7 +6,7 @@ VENV=${1:-"dsvm-functional"}
GATE_DEST=$BASE/new
DEVSTACK_PATH=$GATE_DEST/devstack
NETWORKING_ODL_PATH="$BASE/new/networking-odl"
NETWORKING_ODL_DIR="${NETWORKING_ODL_DIR:-$BASE/new/networking-odl}"
case $VENV in
"dsvm-functional")
@@ -15,7 +15,7 @@ case $VENV in
PROJECT_NAME=networking-odl
IS_GATE=True
source $NETWORKING_ODL_PATH/tools/configure_for_func_testing.sh
source $NETWORKING_ODL_DIR/tools/configure_for_func_testing.sh
configure_host_for_func_testing
;;
"dsvm-fullstack")

View File

@@ -2,7 +2,7 @@
set -xe
NETWORKING_ODL_DIR="$BASE/new/networking-odl"
NETWORKING_ODL_DIR="${NETWORKING_ODL_DIR:-$BASE/new/networking-odl}"
SCRIPTS_DIR="/usr/os-testr-env/bin/"
GATE_STACK_USER=stack

View File

@@ -179,7 +179,7 @@ function _install_opendaylight {
Q_PLUGIN_CONF_FILE=$Q_PLUGIN_CONF_PATH/$Q_PLUGIN_CONF_FILENAME
touch /$Q_PLUGIN_CONF_FILE
NETWORKING_ODL_DIR=$REPO_BASE/networking-odl
NETWORKING_ODL_DIR=${NETWORKING_ODL_DIR:-$REPO_BASE/networking-odl}
# openstack service provider isn't needed, only ODL neutron northbound
# is necessary for functional test
ODL_NETVIRT_KARAF_FEATURE=odl-neutron-service,odl-restconf-all,odl-aaa-authn,odl-dlux-core,odl-mdsal-apidocs,odl-neutron-logger

23
vagrant/functional/Vagrantfile vendored Normal file
View File

@@ -0,0 +1,23 @@
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
if Vagrant.has_plugin?("vagrant-cachier")
config.cache.scope = :box
end
# share networking-odl
config.vm.synced_folder File.expand_path("../.."), "/home/vagrant/networking-odl"
config.vm.box = "ubuntu/xenial64"
# config.vm.box = "bento/ubuntu-16.04"
config.vm.network 'private_network', ip: '192.168.0.10'
config.vm.provision "shell", path: "setup-minimum.sh", privileged: true
config.vm.provision "shell", path: "reproduce.sh", privileged: true
# Increase the memory for the VM. If you need to run devstack, this needs
# to be at least 8192
config.vm.provider "virtualbox" do |v|
v.memory = 8192
v.cpus = 4
end
end

View File

@@ -0,0 +1,38 @@
#! /bin/bash
#
# override configurations of reproduce.sh
#
export NETWORKING_ODL_DIR=/home/vagrant/networking-odl
# Adjust path to scripts in networking-odl
pre_test_hook ()
{
. $NETWORKING_ODL_DIR/devstack/pre_test_hook.sh
}
declare -fx pre_test_hook
gate_hook ()
{
bash -xe $NETWORKING_ODL_DIR/networking_odl/tests/contrib/gate_hook.sh dsvm-functional
}
declare -fx gate_hook
post_test_hook ()
{
# Don't run tests.
sudo chown -R stack:stack $BASE/new
# sudo -H -u stack tox -e dsvm-function
# bash -xe $NETWORKING_ODL_DIR/networking_odl/tests/contrib/post_test_hook.sh dsvm-functional dsvm-functional
}
declare -fx post_test_hook
# we don't need most of projects. networking-odl isn't needed.
export DEVSTACK_LOCAL_CONFIG=""
export DEVSTACK_GATE_SETTINGS="$NETWORKING_ODL_DIR/devstack/devstackgaterc"
export PROJECTS=""
export OVERRIDE_ENABLED_SERVICES="odl-server"
export DEVSTACK_GATE_PROJECTS_OVERRIDE
DEVSTACK_GATE_PROJECTS_OVERRIDE="openstack-infra/devstack-gate"
DEVSTACK_GATE_PROJECTS_OVERRIDE="openstack-dev/devstack $DEVSTACK_GATE_PROJECTS_OVERRIDE"
DEVSTACK_GATE_PROJECTS_OVERRIDE="openstack/requirements $DEVSTACK_GATE_PROJECTS_OVERRIDE"
export ODL_RELEASE_BASE=carbon-snapshot

121
vagrant/functional/reproduce.sh Executable file
View File

@@ -0,0 +1,121 @@
#!/bin/bash -xe
#
# Script to reproduce devstack-gate run.
#
# Prerequisites:
# - Fresh install of current Ubuntu LTS, with basic internet access.
# Note we can and do run devstack-gate on other distros double check
# where your job ran (will be recorded in console.html) to reproduce
# as accurately as possible.
# - Must have python-all-dev, build-essential, git, libssl-dev installed
# from apt, or their equivalents on other distros.
# - Must have virtualenv installed from pip
# - Must be run as root
#
exec 0</dev/null
declare -x DEVSTACK_GATE_TEMPEST_ALL="0"
declare -x DEVSTACK_GATE_TEMPEST_FULL="0"
declare -x DEVSTACK_GATE_TEMPEST_ALL_PLUGINS="0"
declare -x ZUUL_PROJECT="openstack/networking-odl"
declare -x DEVSTACK_GATE_IRONIC_BUILD_RAMDISK="1"
declare -x DEVSTACK_GATE_SAHARA="0"
declare -x DEVSTACK_LOCAL_CONFIG="enable_plugin networking-odl git://git.openstack.org/openstack/networking-odl
HOST_IP=127.0.0.1
UNSTACK_KEEP_ODL=True"
declare -x DEVSTACK_GATE_TEMPEST_NOTESTS="0"
declare -x DEVSTACK_CINDER_SECURE_DELETE="0"
declare -x DEVSTACK_GATE_SMOKE_SERIAL="0"
declare -x DEVSTACK_PROJECT_FROM_GIT=""
declare -x DEVSTACK_GATE_IRONIC_DRIVER="pxe_ssh"
declare -x OVERRIDE_ZUUL_BRANCH="master"
declare -x ZUUL_BRANCH="master"
declare -x DEVSTACK_GATE_SETTINGS="/opt/stack/new/networking-odl/devstack/devstackgaterc"
declare -x ZUUL_VOTING="0"
declare -x ZUUL_URL="http://zm06.openstack.org/p"
declare -x DEVSTACK_GATE_PROJECTS_OVERRIDE=""
declare -x DEVSTACK_CINDER_VOLUME_CLEAR="none"
declare -x DEVSTACK_GATE_FEATURE_MATRIX="features.yaml"
declare -x DEVSTACK_GATE_TEMPEST="0"
declare -x DEVSTACK_GATE_UNSTACK="1"
declare -x ZUUL_CHANGE="408294"
declare -x TOX_TESTENV_PASSENV="ZUUL_PIPELINE ZUUL_UUID ZUUL_VOTING ZUUL_CHANGE_IDS ZUUL_PATCHSET ZUUL_BRANCH ZUUL_REF ZUUL_COMMIT ZUUL_URL ZUUL_CHANGE ZUUL_CHANGES ZUUL_PROJECT"
declare -x DEVSTACK_GATE_INSTALL_TESTONLY="1"
declare -x DEVSTACK_GATE_TOPOLOGY="aio"
declare -x DEVSTACK_GATE_NETCONSOLE=""
declare -x DEVSTACK_GATE_NOVA_API_METADATA_SPLIT="0"
declare -x DEVSTACK_GATE_NEUTRON_DVR="0"
declare -x DEVSTACK_GATE_TIMEOUT="120"
declare -x DEVSTACK_GATE_CELLS="0"
declare -x DEVSTACK_GATE_MQ_DRIVER="rabbitmq"
declare -x DEVSTACK_GATE_REMOVE_STACK_SUDO="0"
declare -x DEVSTACK_GATE_TEMPEST_HEAT_SLOW="0"
declare -x DEVSTACK_GATE_IRONIC="0"
declare -x DEVSTACK_GATE_CLEAN_LOGS="1"
declare -x DEVSTACK_GATE_TEMPEST_DISABLE_TENANT_ISOLATION="0"
declare -x DEVSTACK_GATE_CEILOMETER_BACKEND="mysql"
declare -x ZUUL_CHANGES="openstack/networking-odl:master:refs/changes/94/408294/1"
declare -x DEVSTACK_GATE_EXERCISES="0"
declare -x DEVSTACK_GATE_VIRT_DRIVER="libvirt"
declare -x DEVSTACK_GATE_TROVE="0"
declare -x DEVSTACK_GATE_TEMPEST_LARGE_OPS="0"
declare -x DEVSTACK_GATE_ZEROMQ="0"
declare -x DEVSTACK_GATE_POSTGRES="0"
declare -x DEVSTACK_GATE_TIMEOUT_BUFFER="10"
declare -x ZUUL_REF="refs/zuul/master/Z8054bc24de3e47bd85ab550e02465160"
declare -x ZUUL_CHANGE_IDS="408294,1"
declare -x DEVSTACK_GATE_LIBVIRT_TYPE="qemu"
declare -x DEVSTACK_GATE_TEMPEST_STRESS_ARGS=""
declare -x DEVSTACK_GATE_TEMPEST_STRESS="0"
declare -x DEVSTACK_GATE_TEMPEST_REGEX=""
declare -x DEVSTACK_GATE_GRENADE=""
declare -x DEVSTACK_GATE_NEUTRON="1"
declare -x DEVSTACK_GATE_CONFIGDRIVE="0"
declare -x ZUUL_PIPELINE="check"
declare -x ZUUL_COMMIT="fd975d87091843d6b3bddec69654ba5c5a707ba7"
declare -x ZUUL_PATCHSET="1"
declare -x DEVSTACK_GATE_REQS_INTEGRATION="0"
declare -x ZUUL_UUID="86deca87c8af4cd3830520d95f20cd26"
declare -x PROJECTS="openstack/networking-odl "
pre_test_hook ()
{
. $BASE/new/networking-odl/devstack/pre_test_hook.sh
}
declare -fx pre_test_hook
gate_hook ()
{
bash -xe $BASE/new/networking-odl/networking_odl/tests/contrib/gate_hook.sh dsvm-functional
}
declare -fx gate_hook
post_test_hook ()
{
bash -xe $BASE/new/networking-odl/networking_odl/tests/contrib/post_test_hook.sh dsvm-functional
}
declare -fx post_test_hook
# twist variables to install only necessary packages/projects
# it overrides pre_test_hook, gate_hook, post_test_hook and
# several variables.
source /home/vagrant/networking-odl/vagrant/functional/config-override.sh
mkdir -p workspace/
cd workspace/
export WORKSPACE=`pwd`
if [[ ! -e /usr/zuul-env ]]; then
virtualenv /usr/zuul-env
/usr/zuul-env/bin/pip install zuul
fi
cat > clonemap.yaml << IEOF
clonemap:
- name: openstack-infra/devstack-gate
dest: devstack-gate
IEOF
/usr/zuul-env/bin/zuul-cloner -m clonemap.yaml --cache-dir /opt/git git://git.openstack.org openstack-infra/devstack-gate
cp devstack-gate/devstack-vm-gate-wrap.sh ./safe-devstack-vm-gate-wrap.sh
./safe-devstack-vm-gate-wrap.sh

View File

@@ -0,0 +1,11 @@
#!/bin/bash -xe
#
# Script to install minimum environment to run reproduce.sh
#
# install pre required packages
apt-get install --yes python-pip
pip install --upgrade pip
pip install --upgrade setuptools
pip install --upgrade virtualenv
pip install --upgrade tox