From 43b14afb249d185dd0e27cfd9f4c5739cd24a8d7 Mon Sep 17 00:00:00 2001 From: John Giannelos Date: Wed, 2 May 2012 16:05:52 +0300 Subject: [PATCH] New documentation with examples/new setup script --- docs/index.rst | 59 ++++++++++++++++++++++++-- setup.py | 5 ++- snfOCCI/{snf-occi-server.py => APIserver.py} | 5 ++- 3 files changed, 63 insertions(+), 6 deletions(-) rename snfOCCI/{snf-occi-server.py => APIserver.py} (99%) diff --git a/docs/index.rst b/docs/index.rst index 09e8d42..7b621f7 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -90,16 +90,69 @@ Below you can see the required procedures/operations for OCCI compatibility. OCCI client/server library ========================== -occi-py is a generic library implementation of the Open Cloud Computing Interface (OCCI). It aims to provide a high-level interface for the integration of OCCI to other new or existing applications. +pyssf is a collection of OCCI python modules. It aims to provide a high-level interface for the integration of OCCI to other new or existing applications. Features: --------- * It includes a REST API service with the OCCI specifications already implemented * It only requires a custom backend and registry to interact with Cyclades -* Implements a simple web frontend server with support for Tornado WSGI -Package on pypi: `OCCI 0.6 `_ +Current progress +================= +By now we have considered implementing only the **Compute** backend of the OCCI to Cyclades/Openstack API bridge and we are planning to extend it for **networking** and **storage** capabilities. + +Installation +------------- + +First, you need to install the required dependencies which can be found here: + +* `pyssf `_ +* `kamaki `_ + +Then you can install **snf-occi** API translation server by cloning our latest source code: + +* `snf-occi `_ + +**NOTE** :Before running setup.py you have to edit the **config.py** setting up: + +* API Server port +* VM hostname naming pattern (FQDN providing the id of each compute resource) +* VM core architecture + +Finally you can start the API translation server by running **snf-occi** + +Examples: +--------- +For the examples below we assume server is running on localhost (port 8888) and authentication token is $AUTH. For the HTTP requests we are using **curl**. + +* Retrieve all registered Kinds, Actions and Mixins: + + :: + + curl -v -X GET localhost:8888/-/ -H 'Auth-Token: $AUTH' + +* Create a new VM described by the flavor 'C2R2048D20' and using the image 'Debian' + + :: + + curl -v -X POST localhost:8888/compute/ + -H 'Category: compute; scheme=http://schemas.ogf.org/occi/infrastructure#; class="kind";' + -H 'X-OCCI-Attribute: occi.core.title = newVM' -H 'Category: C2R2048D20; scheme=http://schemas.ogf.org/occi/infrastructure#; ' + -H 'Category: Debian; scheme=http://schemas.ogf.org/occi/infrastructure#;' -H 'Auth-Token: $AUTH' + -H 'Content-type: text/occi' + +* Retrieve all the details of th VM with identifier $ID + + :: + + curl -v -X GET localhost:8888/compute/$ID -H 'Auth-Token: $AUTH' + +* Delete the VM with identifier $ID + + :: + + curl -v -X DELETE localhost:8888/compute/$ID -H 'Auth-Token: $AUTH' Indices and tables diff --git a/setup.py b/setup.py index cf1fa46..149e8a0 100644 --- a/setup.py +++ b/setup.py @@ -7,5 +7,8 @@ setup( url='http://code.grnet.gr/projects/snf-occi', license='BSD', packages = ['snfOCCI'], - scripts=['snfOCCI/snf-occi-server.py'] + entry_points = { + 'console_scripts' : ['snf-occi = snfOCCI.APIserver:main'] + } + ) diff --git a/snfOCCI/snf-occi-server.py b/snfOCCI/APIserver.py similarity index 99% rename from snfOCCI/snf-occi-server.py rename to snfOCCI/APIserver.py index 0ae507c..0a8c857 100755 --- a/snfOCCI/snf-occi-server.py +++ b/snfOCCI/APIserver.py @@ -61,7 +61,8 @@ class MyAPP(Application): return self._call_occi(environ, response, security = None, token = environ['HTTP_AUTH_TOKEN'], snf = compClient, client = cyclClient) -if __name__ == '__main__': +def main(): + APP = MyAPP(registry = snfRegistry()) COMPUTE_BACKEND = ComputeBackend() @@ -77,4 +78,4 @@ if __name__ == '__main__': VALIDATOR_APP = validator(APP) HTTPD = make_server('', SERVER_CONFIG['port'], VALIDATOR_APP) HTTPD.serve_forever() - + -- 1.7.10.4