diff --git a/devstack/plugin.sh b/devstack/plugin.sh index 2d8fb091c..4827e224e 100644 --- a/devstack/plugin.sh +++ b/devstack/plugin.sh @@ -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 diff --git a/devstack/post_test_hook.sh b/devstack/post_test_hook.sh index 65af7559d..6ca41e12c 100644 --- a/devstack/post_test_hook.sh +++ b/devstack/post_test_hook.sh @@ -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" diff --git a/devstack/settings b/devstack/settings index 455bcfcdc..fe3e13597 100644 --- a/devstack/settings +++ b/devstack/settings @@ -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 diff --git a/networking_odl/tests/contrib/gate_hook.sh b/networking_odl/tests/contrib/gate_hook.sh index fd6c6fb45..bc8411537 100644 --- a/networking_odl/tests/contrib/gate_hook.sh +++ b/networking_odl/tests/contrib/gate_hook.sh @@ -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") diff --git a/networking_odl/tests/contrib/post_test_hook.sh b/networking_odl/tests/contrib/post_test_hook.sh index cf7e4032b..d17ed0aca 100644 --- a/networking_odl/tests/contrib/post_test_hook.sh +++ b/networking_odl/tests/contrib/post_test_hook.sh @@ -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 diff --git a/tools/configure_for_func_testing.sh b/tools/configure_for_func_testing.sh index fad91770f..27aa5988d 100755 --- a/tools/configure_for_func_testing.sh +++ b/tools/configure_for_func_testing.sh @@ -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 diff --git a/vagrant/functional/Vagrantfile b/vagrant/functional/Vagrantfile new file mode 100644 index 000000000..e785843ae --- /dev/null +++ b/vagrant/functional/Vagrantfile @@ -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 diff --git a/vagrant/functional/config-override.sh b/vagrant/functional/config-override.sh new file mode 100755 index 000000000..6bbc61c0f --- /dev/null +++ b/vagrant/functional/config-override.sh @@ -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 diff --git a/vagrant/functional/reproduce.sh b/vagrant/functional/reproduce.sh new file mode 100755 index 000000000..4885e88cc --- /dev/null +++ b/vagrant/functional/reproduce.sh @@ -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 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 diff --git a/vagrant/functional/setup-minimum.sh b/vagrant/functional/setup-minimum.sh new file mode 100755 index 000000000..a7bb2a75f --- /dev/null +++ b/vagrant/functional/setup-minimum.sh @@ -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