aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbootstrap.sh125
-rw-r--r--resources/libraries/python/SetupFramework.py14
2 files changed, 133 insertions, 6 deletions
diff --git a/bootstrap.sh b/bootstrap.sh
index 455168c17a..fa3f00635c 100755
--- a/bootstrap.sh
+++ b/bootstrap.sh
@@ -1,15 +1,18 @@
#!/bin/bash
+set -x
+
#sudo apt-get -y install libpython2.7-dev
#VIRL_VMS="10.30.51.53,10.30.51.51,10.30.51.52"
#IFS=',' read -ra ADDR <<< "${VIRL_VMS}"
#
-#function ssh_do() {
-# echo
-# echo "### " ssh $@
-# ssh -i priv_key -o StrictHostKeyChecking=no $@
-#}
+
+function ssh_do() {
+ echo
+ echo "### " ssh $@
+ ssh -i priv_key -o StrictHostKeyChecking=no $@
+}
#for addr in "${ADDR[@]}"; do
# echo
@@ -26,6 +29,116 @@
# ssh_do cisco@${addr} "sudo -S sh -c 'echo exec show hardware | vpp_api_test '"
#done
+VIRL_SERVER=10.30.51.28
+VIRL_USERNAME=jenkins-in
+VIRL_PKEY=priv_key
+
+rm -f ${VIRL_PKEY}
+cat > ${VIRL_PKEY} <<EOF
+-----BEGIN RSA PRIVATE KEY-----
+MIIEpQIBAAKCAQEA+IHXq87GcqMR1C47rzx6Cbip5Ghq8pKrbqKrP5Nf41HcYrT6
+GOXl9nFWKsMOzIlIn+8y7Il27eZh7csQGApbg8QLiHMtcYEmWNzKZpkqg4nuAPxX
+VXwlKgnKX902SrET9Gp9TDayiHtCRWVfrlPPPSA0UEXW6BjLN/uHJ+W/Xzrrab+9
+asBVa05vT2W6n0KJ66zfCaeDM912mQ6SttscAwFoWDmdHlegiVqrlIG2ABxOvxxz
+L3dM3iSmlmQlzv9bThjo+nI4KFYh6m5wrZmAo5r/4q9CIJc21HVnTqkGOWJIZz6J
+73lePJVSq5gYqaoGw3swFEA/MDkOx7baWKSoLQIDAQABAoIBAQCNBeolNp+JWJ76
+gQ4fwLsknyXSV6sxYyhkDW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dJhyEUFgZ
+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
+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
+
+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[@]}
+
+cat ${VIRL_PKEY}
+# 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 simple-ring ${VPP_DEBS_FULL[@]}")
+retval=$?
+if [ "$?" -ne "0" ]; then
+ echo "VIRL simulation start failed"
+ exit ${retval}
+fi
+
+if [ "x${VIRL_SID}" == "x" ]; 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
@@ -33,7 +146,7 @@ echo pip install
pip install -r requirements.txt
PYTHONPATH=`pwd` pybot -L TRACE \
- -v TOPOLOGY_PATH:topologies/available/virl.yaml \
+ -v TOPOLOGY_PATH:topologies/enabled/topology.yaml \
--include vm_env \
--include 3_NODE_SINGLE_LINK_TOPO \
--exclude 3_node_double_link_topoNOT3_node_single_link_topo \
diff --git a/resources/libraries/python/SetupFramework.py b/resources/libraries/python/SetupFramework.py
index 47c609fada..cb0d536987 100644
--- a/resources/libraries/python/SetupFramework.py
+++ b/resources/libraries/python/SetupFramework.py
@@ -84,11 +84,25 @@ def create_env_directory_at_node(node):
logger.error('Virtualenv creation error: {0}'.format(stdout + stderr))
raise Exception('Virtualenv setup failed')
+def install_dependencies(node):
+ """TEMPORARY FUNCTION TO INSTALL DEPENDENCIES ON NODES BEFORE THE VIRL
+ HOSTS HAVE ALL PREREQUISITES INSTALLED"""
+ logger.console('Installing prerequisites on {0}'.format(node['host']))
+ ssh = SSH()
+ ssh.connect(node)
+ (ret_code, stdout, stderr) = ssh.exec_command(
+ 'sudo apt-get -y update; ' \
+ 'sudo apt-get -y install python-virtualenv python-dev', timeout=120)
+ if 0 != ret_code:
+ logger.error('Failed to install prerequisites: {0}'.
+ format(stdout + stderr))
+ raise Exception('Virtualenv setup failed')
def setup_node(args):
tarball, remote_tarball, node = args
copy_tarball_to_node(tarball, node)
extract_tarball_at_node(remote_tarball, node)
+ install_dependencies(node)
if node['type'] == NodeType.TG:
create_env_directory_at_node(node)