Add with-statment support to VatTerminal.
[csit.git] / bootstrap.sh
index fa3f006..893a8db 100755 (executable)
@@ -1,8 +1,28 @@
 #!/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
 
-#sudo apt-get -y install libpython2.7-dev
+echo | sudo tee -a /etc/hostname
+echo "127.0.0.1 `cat /etc/hostname` " | sudo tee -a /etc/hosts
+
+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
 
 #VIRL_VMS="10.30.51.53,10.30.51.51,10.30.51.52"
 #IFS=',' read -ra ADDR <<< "${VIRL_VMS}"
@@ -68,12 +88,18 @@ chmod 600 priv_key
 # Temporarily download VPP packages from nexus.fd.io
 
 rm -f *.deb
-wget -q "https://nexus.fd.io/service/local/repositories/fd.io.dev/content/io/fd/vpp/vpp/1.0.0-185~gca0f3b3_amd64/vpp-1.0.0-185~gca0f3b3_amd64.deb" || exit
-wget -q "https://nexus.fd.io/service/local/repositories/fd.io.dev/content/io/fd/vpp/vpp-dbg/1.0.0-185~gca0f3b3_amd64/vpp-dbg-1.0.0-185~gca0f3b3_amd64.deb" || exit
-wget -q "https://nexus.fd.io/service/local/repositories/fd.io.dev/content/io/fd/vpp/vpp-dev/1.0.0-185~gca0f3b3_amd64/vpp-dev-1.0.0-185~gca0f3b3_amd64.deb" || exit
-wget -q "https://nexus.fd.io/service/local/repositories/fd.io.dev/content/io/fd/vpp/vpp-dpdk-dev/1.0.0-185~gca0f3b3_amd64/vpp-dpdk-dev-1.0.0-185~gca0f3b3_amd64.deb" || exit
-wget -q "https://nexus.fd.io/service/local/repositories/fd.io.dev/content/io/fd/vpp/vpp-dpdk-dkms/1.0.0-185~gca0f3b3_amd64/vpp-dpdk-dkms-1.0.0-185~gca0f3b3_amd64.deb" || exit
-wget -q "https://nexus.fd.io/service/local/repositories/fd.io.dev/content/io/fd/vpp/vpp-lib/1.0.0-185~gca0f3b3_amd64/vpp-lib-1.0.0-185~gca0f3b3_amd64.deb" || exit
+if [ "${#}" -ne "0" ]; then
+    echo "let's use the parameters"
+    arr=(${@})
+    echo ${arr[0]}
+else
+    wget -q "https://nexus.fd.io/service/local/repositories/fd.io.dev/content/io/fd/vpp/vpp/1.0.0-185~gca0f3b3_amd64/vpp-1.0.0-185~gca0f3b3_amd64.deb" || exit
+    wget -q "https://nexus.fd.io/service/local/repositories/fd.io.dev/content/io/fd/vpp/vpp-dbg/1.0.0-185~gca0f3b3_amd64/vpp-dbg-1.0.0-185~gca0f3b3_amd64.deb" || exit
+    wget -q "https://nexus.fd.io/service/local/repositories/fd.io.dev/content/io/fd/vpp/vpp-dev/1.0.0-185~gca0f3b3_amd64/vpp-dev-1.0.0-185~gca0f3b3_amd64.deb" || exit
+    wget -q "https://nexus.fd.io/service/local/repositories/fd.io.dev/content/io/fd/vpp/vpp-dpdk-dev/1.0.0-185~gca0f3b3_amd64/vpp-dpdk-dev-1.0.0-185~gca0f3b3_amd64.deb" || exit
+    wget -q "https://nexus.fd.io/service/local/repositories/fd.io.dev/content/io/fd/vpp/vpp-dpdk-dkms/1.0.0-185~gca0f3b3_amd64/vpp-dpdk-dkms-1.0.0-185~gca0f3b3_amd64.deb" || exit
+    wget -q "https://nexus.fd.io/service/local/repositories/fd.io.dev/content/io/fd/vpp/vpp-lib/1.0.0-185~gca0f3b3_amd64/vpp-lib-1.0.0-185~gca0f3b3_amd64.deb" || exit
+fi
 
 VPP_DEBS=(*.deb)
 echo ${VPP_DEBS[@]}
@@ -109,14 +135,14 @@ function stop_virl_simulation {
 
 VIRL_SID=$(ssh -i priv_key -o StrictHostKeyChecking=no \
     ${VIRL_USERNAME}@${VIRL_SERVER} \
-    "/home/jenkins-in/testcase-infra/bin/start-testcase simple-ring ${VPP_DEBS_FULL[@]}")
+    "/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 [ "x${VIRL_SID}" == "x" ]; then
+if [[ ! "${VIRL_SID}" =~ session-[a-zA-Z0-9]{6} ]]; then
     echo "No VIRL session ID reported."
     exit 127
 fi
@@ -151,4 +177,5 @@ PYTHONPATH=`pwd` pybot -L TRACE \
     --include 3_NODE_SINGLE_LINK_TOPO \
     --exclude 3_node_double_link_topoNOT3_node_single_link_topo \
     --exclude PERFTEST \
+    --noncritical EXPECTED_FAILING \
     tests/