Commit 024f4f6c authored by Stavros Sachtouris's avatar Stavros Sachtouris

Implement rOCCI storage tests, use token in rOCCI

If USER_PROXY is not set, the rocci/*.sh tests can run with token
parent 094ceddc
......@@ -16,13 +16,13 @@
# Dockerfile for snf-occi-manual-ci
# contains functional testing scripts
#
# VERSION 0.3.2
# VERSION 0.4
FROM egifedcloud/fedcloud-userinterface:latest
MAINTAINER Stavros Sachtouris <saxtouri@grnet.gr>
RUN apt update && apt install ca-policy-egi-core curl openssh-client -y
COPY curl /data/curl
COPY storage /data/storage
COPY rocci /data/rocci
COPY run.sh /data/
CMD ["/bin/bash", "/data/run.sh"]
......@@ -55,10 +55,12 @@ either when you RUN the container or while you are inside the container.
::
OCCI_ENDPOINT
USER_PROXY
USER_PROXY or TOKEN
OS_TPL
RESOURCE_TPL
The "rocci/storage.sh" script can run with only the first two variables set.
For the "curl/compute.sh" you need a similar set of enviroment variables.
::
......@@ -68,6 +70,8 @@ For the "curl/compute.sh" you need a similar set of enviroment variables.
OS_TPL
RESOURCE_TPL
The "curl/storage.sh" script can run with only the first two variables set.
For instance, if you have a proxy, you may want to run something like:
::
......@@ -80,5 +84,6 @@ For instance, if you have a proxy, you may want to run something like:
-e RESOURCE_TPL="13"\
-ti snf-occi-client:latest
TIP: To test on the same host, run the command with the "--net host" argument
TIP: To test on the same host (e.g. with a server running localy), run the
command with the "--net host" argument
......@@ -32,7 +32,6 @@ else
fi
BASE_CMD="curl ${XARGS} -H'X-Auth-Token: ${TOKEN}'"
VM_INFO="/tmp/vm.info"
echo "Create a volume"
......
......@@ -19,8 +19,20 @@ echo "Check vars ..."
if [ -z "$OCCI_ENDPOINT" ]; then echo "E: OCCI_ENDPOINT not set"; exit 1; fi;
echo "OCCI_ENDPOINT = ${OCCI_ENDPOINT}"
if [ -z "$USER_PROXY" ]; then echo "E: USER_PROXY not set"; exit 1; fi;
echo "USER_PROXY = ${USER_PROXY}"
AUTH=""
if [ -z "$USER_PROXY" ]; then
echo "W: USER_PROXY not set";
if [ -z "$TOKEN" ]; then
echo "E: TOKEN not set";
exit 1;
else
echo "TOKEN = ${TOKEN}";
AUTH="-n token --token ${TOKEN}"
fi;
else
echo "USER_PROXY = ${USER_PROXY}"
AUTH="-n x509 -X --user-cred ${USER_PROXY}"
fi;
if [ -z "$OS_TPL" ]; then echo "E: OS_TPL not set"; exit 1; fi;
echo "OS_TPL = ${OS_TPL}"
......@@ -37,9 +49,10 @@ fi
echo "Vars OK, run tests"
echo
echo
BASE_CMD="occi ${XARGS} --endpoint ${OCCI_ENDPOINT} -n x509 -X --user-cred ${USER_PROXY}"
BASE_CMD="occi ${XARGS} --endpoint ${OCCI_ENDPOINT} ${AUTH}"
VM_INFO="/tmp/vm.info"
echo "List OS templates"
......@@ -48,6 +61,7 @@ CMD="${BASE_CMD} --action list --resource os_tpl"
echo "$CMD"
eval $CMD
echo
echo
echo "List resource templates"
echo "Meaning: kamaki flavor list"
......@@ -55,6 +69,7 @@ CMD="${BASE_CMD} --action list --resource resource_tpl"
echo "$CMD"
eval $CMD
echo
echo
echo "Details on OS template"
echo "Meaning: kamaki image info ${OS_TPL}"
......@@ -62,6 +77,7 @@ CMD="${BASE_CMD} --action describe --resource os_tpl#${OS_TPL}"
echo "$CMD"
eval $CMD
echo
echo
echo "Details on resource template"
echo "Meaning: kamaki flavor info ${RESOURCE_TPL}"
......@@ -69,6 +85,7 @@ CMD="${BASE_CMD} --action describe --resource resource_tpl#${RESOURCE_TPL}"
echo "$CMD"
eval $CMD
echo
echo
echo "Create a server instance"
echo "Meaning: kamaki server create --name \"OCCI test VM\" \\"
......@@ -80,6 +97,7 @@ echo "$CMD"
VM_URL=$(eval $CMD)
echo "VM URL: ${VM_URL}"
echo
echo
echo "List server instances"
echo "Meaning: kamaki server list"
......@@ -87,6 +105,7 @@ CMD="${BASE_CMD} --action list --resource compute"
echo "$CMD"
eval $CMD
echo
echo
if [ -z "$VM_URL" ]; then
echo "Frankly, I don't know what servers to describe or delete";
......@@ -162,6 +181,7 @@ else
eval $CMD;
fi;
echo
echo
echo "Check contextualization"
echo
......@@ -192,6 +212,7 @@ VM_URL=$(eval $CMD)
echo "VM URL: ${VM_URL}"
SUFFIX=(`echo ${VM_URL}|awk '{n=split($0,a,"/"); print "/"a[n-1]"/"a[n]}'`)
echo
echo
echo "Wait for server to get up"
CMD="${BASE_CMD} --action describe --resource ${SUFFIX} > ${VM_INFO}";
......@@ -209,6 +230,7 @@ do
STATE=(`awk '/occi.compute.state/{n=split($0,a," = "); print a[2];}' ${VM_INFO}`);
done;
echo
echo
printf "Wait 16 seconds for the network |"
for i in `seq 1 4`; do
......
#!/bin/bash
# Copyright (C) 2016 GRNET S.A.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
echo "Check vars ..."
if [ -z "$OCCI_ENDPOINT" ]; then echo "E: OCCI_ENDPOINT not set"; exit 1; fi;
echo "OCCI_ENDPOINT = ${OCCI_ENDPOINT}"
AUTH=""
if [ -z "$USER_PROXY" ]; then
echo "W: USER_PROXY not set";
if [ -z "$TOKEN" ]; then
echo "E: TOKEN not set";
exit 1;
else
echo "TOKEN = ${TOKEN}";
AUTH="-n token --token ${TOKEN}"
fi;
else
echo "USER_PROXY = ${USER_PROXY}"
AUTH="-n x509 -X --user-cred ${USER_PROXY}"
fi;
if [ -z "$SNF_OCCI_DEBUG" ]; then
XARGS="";
else
XARGS="-d";
fi;
echo "Vars OK, run tests"
echo
BASE_CMD="occi ${XARGS} --endpoint ${OCCI_ENDPOINT} ${AUTH}"
echo "Create a Volume"
echo "Meaning: kamaki volume create --name \"My test volume\" \\"
echo " --size 10 --volume-type 2"
CMD="${BASE_CMD} --action create --resource storage "
CMD="${CMD} --attribute occi.core.title=\"My test volume\""
CMD="${CMD} --attribute occi.storage.size=\"10\""
echo "$CMD"
VOLUME_URL=$(eval $CMD)
echo "${VM_URL}"
VOLUME_ID=(`echo $VOLUME_URL|awk '{n=split($0,a,"/"); print a[n];}'`)
echo
echo
echo "List Volumes"
echo "Meaning: kamaki volume list"
CMD="${BASE_CMD} --action list --resource storage"
echo "$CMD"
eval $CMD
echo
echo
echo "Details on a Volume"
echo "Meaning: kamaki volume info ${VOLUME_ID}"
CMD="${BASE_CMD} --action describe --resource /storage/${VOLUME_ID}"
echo "$CMD"
eval $CMD
echo
echo
echo "Clean up"
CMD="${BASE_CMD} --action delete --resource /storage/${VOLUME_ID}"
echo $CMD
eval $CMD
echo
echo
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment