diff options
author | Jan Gelety <jgelety@cisco.com> | 2016-03-15 13:45:55 +0100 |
---|---|---|
committer | Gerrit Code Review <gerrit@fd.io> | 2016-03-29 12:42:12 +0000 |
commit | 77873c7c4c3793b3a9a5fa0e5daa6884dabb2e82 (patch) | |
tree | c5204aa5bfe7db157d93fbd8c70ced0d093b0e34 | |
parent | bf584751869e2763468fc1c8a1865b5a5ae7c10f (diff) |
Bootstrap to test csit-master against VPP release.
- get the version of the latest VPP build
- download and install the latest VPP build on nodes
- run three times all test suites to check if the VPP build
can be used for csit development and current csit master
can be pushed to master-verified branch
(see patch https://gerrit.fd.io/r/590)
Change-Id: I0ad2e9fe1620cc18ccc11dce2d107177cf97ff27
Signed-off-by: Jan Gelety <jgelety@cisco.com>
-rwxr-xr-x | bootstrap-verify-master.sh | 165 | ||||
-rwxr-xr-x | resources/tools/download_install_vpp_pkgs.sh | 15 |
2 files changed, 176 insertions, 4 deletions
diff --git a/bootstrap-verify-master.sh b/bootstrap-verify-master.sh new file mode 100755 index 0000000000..5f560ce794 --- /dev/null +++ b/bootstrap-verify-master.sh @@ -0,0 +1,165 @@ +#!/bin/bash +# Copyright (c) 2016 Cisco and/or its affiliates. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at: +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -x + +cat /etc/hostname +cat /etc/hosts + +export DEBIAN_FRONTEND=noninteractive +sudo apt-get -y update +sudo apt-get -y install libpython2.7-dev python-virtualenv + +function ssh_do() { + echo + echo "### " ssh $@ + ssh -i priv_key -o StrictHostKeyChecking=no $@ +} + +VIRL_SERVER=10.30.51.28 +VIRL_USERNAME=jenkins-in +VIRL_PKEY=priv_key + +rm -f ${VIRL_PKEY} +cat >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1n7sab +UIrjsdzSJK/9Zb9yTTHPyibYzNEgaJV1HsbxfEFXAoGAYO2RmvRm0phll18OQVJV +IpKk9kLKAKZ/R/K32hAsikBC8SVPQTPniyaifFWx81diblalff2hX4ipTf7Yx24I +wMIMZuW7Im/R7QMef4+94G3Bad7p7JuE/qnAEHJ2OBnu+eYfxaK35XDsrq6XMazS +NqHE7hOq3giVfgg+C12hCKMCgYEAtu9dbYcG5owbehxzfRI2/OCRsjz/t1bv1seM +xVMND4XI6xb/apBWAZgZpIFrqrWoIBM3ptfsKipZe91ngBPUnL9s0Dolx452RVAj +yctHB8uRxWYgqDkjsxtzXf1HnZBBkBS8CUzYj+hdfuddoeKLaY3invXLCiV+PpXS +U4KAK9kCgYEAtSv0m5+Fg74BbAiFB6kCh11FYkW94YI6B/E2D/uVTD5dJhyEUFgZ +cWsudXjMki8734WSpMBqBp/J8wG3C9ZS6IpQD+U7UXA+roB7Qr+j4TqtWfM+87Rh +maOpG56uAyR0w5Z9BhwzA3VakibVk9KwDgZ29WtKFzuATLFnOtCS46E= +-----END RSA PRIVATE KEY----- +EOF +chmod 600 priv_key + +# Temporarily download VPP packages from nexus.fd.io + +rm -f *.deb +if [ "${#}" -ne "0" ]; then + arr=(${@}) + echo ${arr[0]} +else + # Download the latest VPP build .deb install packages + bash ./resources/tools/download_install_vpp_pkgs.sh --skip-install +fi + +VPP_DEBS=(*.deb) +echo ${VPP_DEBS[@]} +VIRL_DIR_LOC="/tmp" +VPP_DEBS_FULL=(${VPP_DEBS[@]}) + +# Prepend directory location at remote host to deb file list +for index in "${!VPP_DEBS_FULL[@]}"; do + VPP_DEBS_FULL[${index}]=${VIRL_DIR_LOC}/${VPP_DEBS_FULL[${index}]} +done + +echo "Updated file names: " ${VPP_DEBS_FULL[@]} + +# Copy the files to VIRL host +scp -i ${VIRL_PKEY} -o StrictHostKeyChecking=no *.deb \ + ${VIRL_USERNAME}@${VIRL_SERVER}:${VIRL_DIR_LOC}/ + +result=$? +if [ "${result}" -ne "0" ]; then + echo "Failed to copy vpp deb files to virl host" + echo ${result} + exit ${result} +fi + +# Start a simulation on VIRL server +echo "Starting simulation on VIRL server" + +function stop_virl_simulation { + ssh -i priv_key -o StrictHostKeyChecking=no ${VIRL_USERNAME}@${VIRL_SERVER}\ + "/home/jenkins-in/testcase-infra/bin/stop-testcase ${VIRL_SID}" +} + +VIRL_SID=$(ssh -i priv_key -o StrictHostKeyChecking=no \ + ${VIRL_USERNAME}@${VIRL_SERVER} \ + "/home/jenkins-in/testcase-infra/bin/start-testcase -c simple-ring ${VPP_DEBS_FULL[@]}") +retval=$? +if [ "$?" -ne "0" ]; then + echo "VIRL simulation start failed" + exit ${retval} +fi + +if [[ ! "${VIRL_SID}" =~ session-[a-zA-Z0-9_]{6} ]]; then + echo "No VIRL session ID reported." + exit 127 +fi + +# Upon script exit, cleanup the simulation execution +trap stop_virl_simulation EXIT +echo ${VIRL_SID} + +ssh_do ${VIRL_USERNAME}@${VIRL_SERVER} cat /scratch/${VIRL_SID}/topology.yaml + +# Download the topology file from virl session +scp -i ${VIRL_PKEY} -o StrictHostKeyChecking=no \ + ${VIRL_USERNAME}@${VIRL_SERVER}:/scratch/${VIRL_SID}/topology.yaml \ + topologies/enabled/topology.yaml + +retval=$? +if [ "$?" -ne "0" ]; then + echo "Failed to copy topology file from VIRL simulation" + exit ${retval} +fi + + +virtualenv env +. env/bin/activate + +echo pip install +pip install -r requirements.txt + + +# There are used three iterations of tests there to check +# the stability and reliability of the results +for test_set in 1 2 3 +do + echo + echo ${test_set}. test loop + PYTHONPATH=`pwd` pybot -L TRACE \ + -v TOPOLOGY_PATH:topologies/enabled/topology.yaml \ + --exclude 3_node_double_link_topoNOT3_node_single_link_topo \ + --include VM_ENV \ + --exclude PERFTEST \ + --noncritical EXPECTED_FAILING \ + --output log_test_set${test_set} \ + tests/ +done + +rebot --output output.xml ./log_test_set1.xml ./log_test_set2.xml ./log_test_set3.xml + +rm -f ./log_test_set1.xml ./log_test_set2.xml ./log_test_set3.xml diff --git a/resources/tools/download_install_vpp_pkgs.sh b/resources/tools/download_install_vpp_pkgs.sh index 0d95e75922..025be87720 100755 --- a/resources/tools/download_install_vpp_pkgs.sh +++ b/resources/tools/download_install_vpp_pkgs.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # Copyright (c) 2016 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); @@ -13,7 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -set -x +set -ex + +trap 'rm -f *.deb.md5; exit' EXIT +trap 'rm -f *.deb.md5;rm -f *.deb; exit' ERR URL="https://nexus.fd.io/service/local/artifact/maven/content" VER="RELEASE" @@ -36,5 +39,9 @@ for MD5FILE in *.md5; do md5sum -c ${MD5FILE} || exit done -echo sudo dpkg -i *.deb - +if [ "$1" != "--skip-install" ]; then + echo Installing VPP + sudo dpkg -i *.deb +else + echo VPP Installation skipped +fi |