Commit 05e18da9 authored by Stavros Sachtouris's avatar Stavros Sachtouris

Add docker image built support for testing

parent dc1ce94a
...@@ -157,7 +157,7 @@ class ComputeBackend(MyBackend): ...@@ -157,7 +157,7 @@ class ComputeBackend(MyBackend):
snf.delete_server(vm_id) snf.delete_server(vm_id)
print "Deleting VM" + str(vm_id) print "Deleting VM" + str(vm_id)
def get_vm_actions(self, entity , vm_state): def get_vm_actions(self, entity, vm_state):
actions = [] actions = []
status_dict = dict( status_dict = dict(
ACTIVE='active', STOPPED='inactive', REBOOT='inactive', ACTIVE='active', STOPPED='inactive', REBOOT='inactive',
# Dockerfile for snf-occi-manual-ci
# contains functional testing scripts
FROM egifedcloud/fedcloud-userinterface:latest
MAINTAINER Stavros Sachtouris <>
RUN fetch-crl -p 20 | echo "Failed to fetch-crl -p 20"
COPY /data/
CMD /bin/bash
Build the image
$ docker build -t snf-occi-manual-ci:<version>
This will build a new image, which can be pushed or kept local.
Run a new container
You need either a client proxy or a pair of keys.
If you have a pair of keys, load the directory containing them as /root/.globus
Then run the appropriate commands to generate a proxy
$ docker run -v ${HOME}/.globus:/root/.globus -ti snf-occi-manual-ci:latest
# fetch -p 20
# voms-proxy-init -voms -rfc
If you have a valid proxy, load it somewhere on the machine
$ docker run -v my_proxy:/data/my_proxy -ti snf-occi-manual-ci:latest
What is in the container
You will find all the tools from egifedcloud/fedcloud-userinterface:latest plus
a shell script to test the snf-occi application.
To run the script, you must set some variables, either when you RUN the
container or while you are inside the container.
For instance, if you have a proxy, you may want to run something like:
$ docker run -v my_proxy:/data/my_proxy \
-e USER_PROXY="/data/my_proxy" \
-e OS_TPL="debian_base" -e RESOURCE_TPL="c2r2048d20drbd" \
-ti snf-occi-manual-ci:latest
echo "Check vars ..."
if [ -z "$OCCI_ENDPOINT" ]; then echo "E: OCCI_ENDPOINT not set"; exit 1; fi;
if [ -z "$USER_PROXY" ]; then echo "E: USER_PROXY not set"; exit 1; fi;
if [ -z "$OS_TPL" ]; then echo "E: OS_TPL not set"; exit 1; fi;
echo "OS_TPL = ${OS_TPL}"
if [ -z "$RESOURCE_TPL" ]; then echo "E: RESOURCE_TPL not set"; exit 1; fi;
echo "Vars OK, run tests"
BASE_CMD="occi --endpoint ${OCCI_ENDPOINT} -n x509 -X --user-cred ${USER_PROXY}"
echo "List OS templates"
echo "Meaning: kamaki image list"
CMD="${BASE_CMD} --action list --resource os_tpl"
echo "$CMD"
eval $CMD
echo "List resource templates"
echo "Meaning: kamaki flavor list"
CMD="${BASE_CMD} --action list --resource resource_tpl"
echo "$CMD"
eval $CMD
echo "Details on OS template"
echo "Meaning: kamaki image info <ID of ${OS_TPL} image>"
CMD="${BASE_CMD} --action describe --resource os_tpl#${OS_TPL}"
echo "$CMD"
eval $CMD
echo "Details on resource template"
echo "Meaning: kamaki flavor info <FLAVOR ID of ${RESOURCE_TPL}>"
CMD="${BASE_CMD} --action describe --resource resource_tpl#${RESOURCE_TPL}"
echo "$CMD"
eval $CMD
echo "Create a server instance"
echo "Meaning: kamaki server create --name \"My Test VM\" \\"
echo " --flavor-id <ID of c2r2048d40drb> --image-id <ID of ${OS_TPL}>"
CMD="${BASE_CMD} --action create --resource compute "
CMD="${CMD} --attribute occi.core.title=\"My Test VM\""
CMD="${CMD} --mixin os_tpl#${OS_TPL} --mixin resource_tpl#${RESOURCE_TPL}"
echo "$CMD"
VM_URL=$(eval $CMD)
echo "VM URL: ${VM_URL}"
echo "List server instances"
echo "Meaning: kamaki server list"
CMD="${BASE_CMD} --action list --resource compute"
echo "$CMD"
eval $CMD
if [ -z "$VM_URL" ]; then
echo "Frankly, I don't know what servers to delete";
SUFFIX=(`echo ${VM_URL}|awk '{n=split($0,a,"/"); print "/"a[n-1]"/"a[n]}'`)
echo "Destroy server instance ${SUFFIX}";
echo "Meaning: kamaki server delete ${SERVER_URL}";
CMD="${BASE_CMD} --action delete --resource ${SUFFIX}";
echo "$CMD";
eval $CMD;
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