Commit da8f3076 authored by Stavros Sachtouris's avatar Stavros Sachtouris

Adopt the settings mechanism of previous version

Update code and docs as seen fit
parent 5bcc72b0
snf-occi
========
snf-occi 0.2 implements the OCCI 1.1 procotol for Synnefo clouds. Since version
snf-occi 0.3 implements the OCCI 1.1 protocol for Synnefo clouds. Since version
0.2, authentication is performed by an external keystone-compatible service,
like Astavoms.
like "Astavoms". The major change is the abandonment of "snfOCCI" in favor of "OOI".
"OOI" is the Openstack OCCI Interface. It is used in snf-occi, wrapped by the newly introduced "SOI" package (Synnefo OCCI Interface). "SOI" is responsible for patching "OOI" so that it is compatible with Synnefo API.
Installation
-------------
First, you need to install the required dependencies which can be found here:
Clone snf-occi:
$ git clone https://github.com/grnet/snf-occi
* `pyssf <https://code.grnet.gr/attachments/download/1182/pyssf-0.4.5.tar>`_
* `kamaki <https://code.grnet.gr/projects/kamaki>`_
Create file config.py and edit it with the correct settings:
Then you can install **snf-occi** API translation server by cloning our latest source code:
$ cd snf-occi
$ cp soi/config.py.template soi/config.py
$ <your favorite editor> soi/config.py
* `snf-occi <https://code.grnet.gr/projects/snf-occi>`_
**Note** make sure you have a config.py file before installing snf-occi. You don't need to put the correct settings yet, though. They can wait until deployment.
**NOTE**: Before running setup.py you have to edit the **config.py** setting up:
Install the application (dependences are installed automatically) :
* API Server port
* VM hostname naming pattern (FQDN providing the id of each compute resource)
* VM core architecture
$ python setup.py install
Finally you can start the API translation server by running **snf-occi**
Finally you can start the API translation server with paste. We have provided a demonstration server for testing and development at "paste_deploy/test_server.py" but you should not use it for production.
More
----
......
# Copyright (C) 2012-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/>.
from paste import deploy
import logging
from soi.config immport PASTE_INI
LOG = logging.getLogger(__name__)
# NOTE(ldbragst): 'application' is required in this context by WSGI spec.
# The following is a reference to Python Paste Deploy documentation
# http://pythonpaste.org/deploy/
application = deploy.loadapp('config:{0}'.format(PASTE_INI))
# 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/>.
# snf_voms authentication PasteDeploy configuration file
[composite:main]
use = egg:Paste#urlmap
/:snf_occiapp
[app:snf_occiapp]
use = egg:snf-occi#snf_occi_app
# 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/>.
from paste import deploy
import logging
from paste import httpserver
from soi.config import PASTE_INI, HOST, PORT
LOG = logging.getLogger(__name__)
# Setup a server for testing
application = deploy.loadapp('config:{0}'.format(PASTE_INI))
httpserver.serve(application, HOST, PORT)
......@@ -17,7 +17,7 @@ from setuptools import setup
setup(
name='snf-occi',
version='0.4',
version='0.3',
description='OCCI to Openstack/Cyclades API bridge',
url='http://code.grnet.gr/projects/snf-occi',
license='GPLv3',
......
......@@ -36,8 +36,7 @@ from soi import synnefo
# pylint: disable=W0613
# noinspection PyUnusedLocal
def main(global_config, **settings):
"""This is the entry point for paste into the OCCI OS world."""
factory = wsgi.SNFOCCIMiddleware.factory({'openstack_version': 'v2.1'})
"""This is the entry point for paste into the Synnefo OCCI Interface"""
factory = wsgi.SNFOCCIMiddleware.factory({})
return factory(synnefo.call_kamaki)
# 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/>
# Copy this file as config.py and fill in the appropriate values
AUTH_URL = 'https://accounts.example.com/identity/v2.0'
CA_CERTS = '/etc/ssl/certs/ca-certificates.crt'
KEYSTONE_URL = 'https://okeanos-astavoms.example.com'
HOST = 'this-host.example.com or IP'
PORT = '8080'
PASTE_INI = '/home/user/snf-occi/paste_deploy/soi.ini'
......@@ -25,20 +25,19 @@
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
# from ooi.wsgi import OCCIMiddleware
# from paste import httpserver
from soi.log import reveale_me
import json
from kamaki.clients.astakos import AstakosClient, CachedAstakosClient
from kamaki.clients.astakos import AstakosClient
from kamaki.clients.cyclades import CycladesComputeClient
from kamaki.clients.utils import https
from soi.config import AUTH_URL, CA_CERTS
# Constants and classes for kamaki/synnefo calls
AUTH_URL = 'https://accounts.okeanos.grnet.gr/identity/v2.0'
ADMIN_TOKEN = 'some-token'
CA_CERTS = '/etc/ssl/certs/ca-certificates.crt'
# endpoints are offered auth-free, so no need for an admin token
ADMIN_TOKEN = ''
https.patch_with_certs(CA_CERTS)
auth = CachedAstakosClient(AUTH_URL, ADMIN_TOKEN)
auth = AstakosClient(AUTH_URL, ADMIN_TOKEN)
endpoints, client_classes = {}, {}
for cls in (AstakosClient, CycladesComputeClient):
......@@ -91,3 +90,8 @@ def _stringify_json_values(data):
if isinstance(data, list):
return map(_stringify_json_values, data)
return '{0}'.format(data) if data else data
# Set up OOI and run it
# factory = OCCIMiddleware.factory({'openstack_version': 'v2.1', })
# httpserver.serve(factory(call_kamaki))
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