summaryrefslogtreecommitdiffstats
path: root/test/ete/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'test/ete/scripts')
-rwxr-xr-xtest/ete/scripts/deploy-onap.sh53
-rw-r--r--test/ete/scripts/get-floating-ip.sh6
2 files changed, 59 insertions, 0 deletions
diff --git a/test/ete/scripts/deploy-onap.sh b/test/ete/scripts/deploy-onap.sh
new file mode 100755
index 000000000..3c69e15e8
--- /dev/null
+++ b/test/ete/scripts/deploy-onap.sh
@@ -0,0 +1,53 @@
+#!/bin/bash
+
+if [ -z "$OS_AUTH_URL" ] || [ -z "$OS_USERNAME" ]
+then
+ echo "ERROR: OpenStack environment variables not set. Please source your OpenStack RC script first."
+ exit 1
+fi
+
+
+if [ -z "$WORKSPACE" ]; then
+ export WORKSPACE=`git rev-parse --show-toplevel`
+fi
+
+
+
+# Assume that if ROBOT_VENV is set, we don't need to reinstall robot
+if [ -f ${WORKSPACE}/env.properties ]; then
+ source ${WORKSPACE}/env.properties
+fi
+
+if [ ! -z "$ONAP_VENV" ] && [ -f "$ONAP_VENV/bin/activate" ]; then
+ source ${ONAP_VENV}/bin/activate
+else
+ ONAP_VENV=$(mktemp -d --suffix=_onap_venv)
+ virtualenv ${ONAP_VENV}
+ source ${ONAP_VENV}/bin/activate
+
+ pip install --upgrade pip
+ pip install --upgrade python-openstackclient python-heatclient
+
+ echo "ONAP_VENV=${ONAP_VENV}" >> $WORKSPACE/env.properties
+fi
+echo "ONAP_VENV=${ONAP_VENV}"
+
+if [ -z "$ONAP_WORKDIR" ]; then
+ ONAP_WORKDIR=$(mktemp -d --suffix=_onap_workdir)
+ echo "ONAP_WORKDIR=${ONAP_WORKDIR}" >> $WORKSPACE/env.properties
+fi
+echo "ONAP_WORKDIR=${ONAP_WORKDIR}"
+if [ ! -d ${ONAP_WORKDIR}/demo ]; then
+ git clone http://gerrit.onap.org/r/demo ${ONAP_WORKDIR}/demo
+else
+ pushd ${ONAP_WORKDIR}/demo
+ git pull
+ popd
+fi
+
+
+
+STACK="ete-$(uuidgen | cut -c-8)"
+echo "Stack Name: ${STACK}"
+openstack stack create -t ${ONAP_WORKDIR}/demo/heat/ONAP/onap_openstack.yaml -e ${WORKSPACE}/test/ete/labs/windriver/onap.env $STACK
+
diff --git a/test/ete/scripts/get-floating-ip.sh b/test/ete/scripts/get-floating-ip.sh
new file mode 100644
index 000000000..55854e73f
--- /dev/null
+++ b/test/ete/scripts/get-floating-ip.sh
@@ -0,0 +1,6 @@
+#!/bin/sh
+# Get floating IP assigned to a server name
+
+PORT_ID=$(openstack server show -f json $1 | python -c 'import sys, json; print json.load(sys.stdin)["wrs-if:nics"][0]["nic1"]["port_id"]')
+FLOATING_IP=$(openstack floating ip list -f json --port $PORT_ID | python -c 'import sys, json; print json.load(sys.stdin)[0]["Floating IP Address"]')
+echo $FLOATING_IP