diff options
Diffstat (limited to 'test/ete/scripts')
-rwxr-xr-x | test/ete/scripts/deploy-onap.sh | 50 | ||||
-rwxr-xr-x[-rw-r--r--] | test/ete/scripts/get-floating-ip.sh | 0 | ||||
-rwxr-xr-x | test/ete/scripts/install_openstack_cli.sh | 47 | ||||
-rwxr-xr-x | test/ete/scripts/remote/run-robot.sh | 18 | ||||
-rwxr-xr-x | test/ete/scripts/run-healthcheck.sh | 18 |
5 files changed, 90 insertions, 43 deletions
diff --git a/test/ete/scripts/deploy-onap.sh b/test/ete/scripts/deploy-onap.sh index 3c69e15e8..02943935d 100755 --- a/test/ete/scripts/deploy-onap.sh +++ b/test/ete/scripts/deploy-onap.sh @@ -1,53 +1,17 @@ #!/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 +source $WORKSPACE/test/ete/scripts/install_openstack_cli.sh - -# 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 - - +# Delete all existing stacks +STACKS=$(openstack stack list -c "Stack Name" -f value) +echo "Deleting Stacks ${STACKS}" +openstack stack delete -y $STACKS 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 +echo "New Stack Name: ${STACK}" +openstack stack create -t ${ONAP_WORKDIR}/demo/heat/ONAP/onap_openstack.yaml -e ${WORKSPACE}/test/ete/labs/windriver/onap-openstack.env $STACK diff --git a/test/ete/scripts/get-floating-ip.sh b/test/ete/scripts/get-floating-ip.sh index 55854e73f..55854e73f 100644..100755 --- a/test/ete/scripts/get-floating-ip.sh +++ b/test/ete/scripts/get-floating-ip.sh diff --git a/test/ete/scripts/install_openstack_cli.sh b/test/ete/scripts/install_openstack_cli.sh new file mode 100755 index 000000000..ec5ad1f76 --- /dev/null +++ b/test/ete/scripts/install_openstack_cli.sh @@ -0,0 +1,47 @@ +#!/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 + diff --git a/test/ete/scripts/remote/run-robot.sh b/test/ete/scripts/remote/run-robot.sh new file mode 100755 index 000000000..ff7223a17 --- /dev/null +++ b/test/ete/scripts/remote/run-robot.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +cd /opt + +if [ ! -x /opt/demo.sh ]; then + echo "Robot VM not initialized" + exit 2 +fi + +if [ ! -d eteshare/logs/demo ]; then + echo "09d8566ea45e43aa974cf447ed591d77" > /opt/config/openstack_tenant_id.txt + echo "gary_wu" > /opt/config/openstack_username.txt + echo $OS_PASSWORD_INPUT > /opt/config/openstack_password.txt + /bin/bash /opt/eteshare/config/vm_config2robot.sh + echo "test" | /opt/demo.sh init_robot +fi + +/opt/ete.sh health diff --git a/test/ete/scripts/run-healthcheck.sh b/test/ete/scripts/run-healthcheck.sh new file mode 100755 index 000000000..45142b006 --- /dev/null +++ b/test/ete/scripts/run-healthcheck.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +SSH_KEY=~/.ssh/onap_key + +if [ -z "$WORKSPACE" ]; then + export WORKSPACE=`git rev-parse --show-toplevel` +fi + +source $WORKSPACE/test/ete/scripts/install_openstack_cli.sh + +cd $WORKSPACE/test/ete/scripts + +ROBOT_IP=$(./get-floating-ip.sh onap-robot) +echo "ROBOT_IP=${ROBOT_IP}" + +ssh -o StrictHostKeychecking=no -i ${SSH_KEY} root@${ROBOT_IP} "OS_PASSWORD_INPUT=$OS_PASSWORD_INPUT bash -s" < ./remote/run-robot.sh +LOG_DIR=$(ssh -o StrictHostKeychecking=no -i ${SSH_KEY} root@${ROBOT_IP} "ls -1t /opt/eteshare/logs | head -1") +rsync -e "ssh -i ${SSH_KEY}" -avPz root@${ROBOT_IP}:/opt/eteshare/logs/${LOG_DIR}/ $WORKSPACE/archives/ |