Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
snf-occi
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
itminedu
snf-occi
Commits
05e18da9
Commit
05e18da9
authored
Jul 21, 2016
by
Stavros Sachtouris
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add docker image built support for testing
parent
dc1ce94a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
132 additions
and
2 deletions
+132
-2
snfOCCI/compute.py
snfOCCI/compute.py
+2
-2
test/Dockerfile
test/Dockerfile
+9
-0
test/README.md
test/README.md
+41
-0
test/run_functional_tests.sh
test/run_functional_tests.sh
+80
-0
No files found.
snfOCCI/compute.py
View file @
05e18da9
...
...
@@ -144,7 +144,7 @@ class ComputeBackend(MyBackend):
else
:
if
entity
.
attributes
[
'occi.compute.state'
]
==
'inactive'
:
entity
.
actions
=
[
infrastructure
.
START
]
if
entity
.
attributes
[
'occi.compute.state'
]
==
'active'
:
if
entity
.
attributes
[
'occi.compute.state'
]
==
'active'
:
entity
.
actions
=
[
infrastructure
.
STOP
,
infrastructure
.
SUSPEND
,
...
...
@@ -157,7 +157,7 @@ class ComputeBackend(MyBackend):
snf
.
delete_server
(
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
=
[]
status_dict
=
dict
(
ACTIVE
=
'active'
,
STOPPED
=
'inactive'
,
REBOOT
=
'inactive'
,
...
...
test/Dockerfile
0 → 100644
View file @
05e18da9
# Dockerfile for snf-occi-manual-ci
# contains functional testing scripts
FROM
egifedcloud/fedcloud-userinterface:latest
MAINTAINER
Stavros Sachtouris <saxtouri@grnet.gr>
RUN
fetch-crl
-p
20 |
echo
"Failed to fetch-crl -p 20"
COPY
run_functional_tests.sh /data/
CMD
/bin/bash
test/README.md
0 → 100644
View file @
05e18da9
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 fedcloud.egi.eu -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.
OCCI_ENDPOINT
USER_PROXY
OS_TPL
RESOURCE_TPL
For instance, if you have a proxy, you may want to run something like:
$ docker run -v my_proxy:/data/my_proxy
\
-e OCCI_ENDPOINT="https://okeanos-occi2.hellasgrid.gr:9000"
\
-e USER_PROXY="/data/my_proxy"
\
-e OS_TPL="debian_base" -e RESOURCE_TPL="c2r2048d20drbd"
\
-ti snf-occi-manual-ci:latest
test/run_functional_tests.sh
0 → 100755
View file @
05e18da9
#!/bin/bash
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
}
"
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
"RESOURCE_TPL =
${
RESOURCE_TPL
}
"
;
echo
"Vars OK, run tests"
echo
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
echo
"List resource templates"
echo
"Meaning: kamaki flavor list"
CMD
=
"
${
BASE_CMD
}
--action list --resource resource_tpl"
echo
"
$CMD
"
eval
$CMD
echo
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
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
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
echo
"List server instances"
echo
"Meaning: kamaki server list"
CMD
=
"
${
BASE_CMD
}
--action list --resource compute"
echo
"
$CMD
"
eval
$CMD
echo
if
[
-z
"
$VM_URL
"
]
;
then
echo
"Frankly, I don't know what servers to delete"
;
else
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
;
fi
;
echo
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment