snf-occi snf-occi implements the OCCI specification on top of synnefo’s API in order to achieve greater interoperability in common tasks referring cyclades management. This module is a translation bridge between OCCI and the Openstack API and is designed to be as independent as possible from the rest IaaS, providing an OCCI compatibility layer to other services using Openstack API.
snf-occi is based in modules provided by kamaki cli-tool when dealing with REST API calls to Openstack.
The current OCCI specification consists of the following three documents:
The OCCI implementation in Cyclades is going to be based in the OCCI Infrastructure specification, in which common Cloud IaaS components are described. The correspondence between OCCI and Cyclades is as follows:
OCCI | Cyclades |
---|---|
Compute | Synnefo servers |
OS Template | Synnefo images |
Resource Template | Synnefo flavors |
Networking | NA |
Storage | NA |
Note: Metadata info in synnefo’s servers cannot be represented (clearly) using OCCI’s components.
Due to OCCI’s structure there cannot be straightforward mapping to Cyclades/OpenStack API. The missing elements are networking and storage capabilities using current Cyclades API.
Below you can see the required procedures/operations for OCCI compatibility.
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.
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.
First, you need to install the required dependencies which can be found here:
Then you can install snf-occi API translation server by cloning our latest source code:
NOTE: Before running setup.py you have to edit the config.py setting up:
Finally you can start the API translation server by running snf-occi
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'