Files
group-based-policy/gbpservice/tests/contrib/functions-gbp
Sumit Naiksatam c5dffd53a1 Adding devstack artifacts for integration gate job
This will allow using the upstream devstack branch.
The gbp-specific artifacts will be patched on top
of that branch.

Also checking to see if resources are not getting
cleaned up after the exercise script run.

Closes-bug: 1469545

Change-Id: I610774366cd72348dd756c91c9989add9288de15
2015-07-01 04:20:08 -07:00

77 lines
2.8 KiB
Bash

#!/usr/bin/env bash
TOP_DIR="$BASE/new/devstack"
NEW_BASE="$BASE/new"
GBP_DIR="$NEW_BASE/group-based-policy"
SCRIPTS_DIR="/usr/local/jenkins/slave_scripts"
LOGS_DIR="$NEW_BASE/logs"
ARCHIVE_LOGS_DIR="$BASE/logs"
function prepare_gbp_devstack {
cd $TOP_DIR
sudo git checkout stable/juno
sudo cp $CONTRIB_DIR/devstack/local.conf $TOP_DIR/local.conf
sudo cp $CONTRIB_DIR/devstack/exercises/*.sh $TOP_DIR/exercises/
sudo cp $CONTRIB_DIR/devstack/lib/* $TOP_DIR/lib/
sudo cp -r $CONTRIB_DIR/devstack/gbp-templates $TOP_DIR
sudo sed -i "s/.*REQUIREMENTS_REPO.*/&\n sed -i 's\/.*python-neutronclient.*\/python-neutronclient==2.3.9\/g' \$REQUIREMENTS_DIR\/global-requirements.txt/g" $TOP_DIR/lib/infra
sudo sed -i 's/DEST=\/opt\/stack/DEST=\/opt\/stack\/new/g' $TOP_DIR/stackrc
sudo sed -i 's/exit 1/echo/g' $TOP_DIR/exercise.sh
sudo sed -i 's/source $TOP_DIR\/lib\/neutron-legacy/&\nsource $TOP_DIR\/lib\/gbp/g' $TOP_DIR/stack.sh
sudo sed -i 's/# Extras Configuration/source $TOP_DIR\/lib\/gbp\ninit_gbpservice\ninstall_gbpclient\n&/g' $TOP_DIR/stack.sh
sudo sed -i 's/echo_summary "Creating initial neutron network elements"//g' $TOP_DIR/stack.sh
sudo sed -i 's/create_neutron_initial_network//g' $TOP_DIR/stack.sh
source $TOP_DIR/functions
source $TOP_DIR/functions-common
pip_install -e $GBP_DIR
}
# Prepare the log files for Jenkins to upload
function prepare_logs {
cd $LOGS_DIR
sudo mv screen/screen*.*.log .
sudo rm -rf screen
for f in $(find . -name "*.20*.log"); do
sudo mv $f ${f/.log/.txt}
done
sudo gzip -9fk `find . -maxdepth 1 \! -type l -name "*.txt" | xargs ls -d`
mv *.gz $ARCHIVE_LOGS_DIR/
}
function generate_testr_results {
# Give job user rights to access tox logs
sudo -H chmod o+rw .
sudo -H chmod o+rw -R .testrepository
if [ -f ".testrepository/0" ] ; then
.tox/dsvm-functional/bin/subunit-1to2 < .testrepository/0 > ./testrepository.subunit
.tox/dsvm-functional/bin/python $SCRIPTS_DIR/subunit2html.py ./testrepository.subunit testr_results.html
gzip -9 ./testrepository.subunit
gzip -9 ./testr_results.html
sudo mv ./*.gz $ARCHIVE_LOGS_DIR/
fi
}
function check_residual_resources {
source $NEW_BASE/devstack/openrc $1 $2
gbp l3policy-list
gbp l2policy-list
gbp group-list
gbp policy-target-list
gbp policy-rule-set-list
gbp policy-rule-list
gbp policy-classifier-list
gbp policy-action-list
gbp servicechain-instance-list
gbp servicechain-node-list
gbp servicechain-spec-list
gbp network-service-policy-list
gbp nat-pool-list
gbp external-policy-list
gbp external-segment-list
neutron router-list
neutron net-list
neutron subnet-list
neutron port-list
}