first shot on issue #28.

This commit is contained in:
tmetsch 2013-04-29 11:30:49 +02:00
parent a7fe46fd80
commit a7f75c0018
3 changed files with 13 additions and 2 deletions

View File

@ -26,6 +26,7 @@ Network resource backend.
from occi import backend
from extensions import os_addon
from occi_os_api.nova_glue import net
@ -79,7 +80,8 @@ class NetworkInterfaceBackend(backend.KindBackend):
"""
if link.target.identifier == '/network/public':
# public means floating IP in OS!
if 'org.openstack.network.floating.pool' in link.attributes:
# if the os_net_link mixin is avail. a pool must be provided:
if os_addon.OS_NET_LINK in link.mixins:
pool = link.attributes['org.openstack.network.floating.pool']
else:
pool = None

View File

@ -63,7 +63,7 @@ OS_CREATE_IMAGE = core_model.Action(
_OS_VM_ATTRIBUTES = {'org.openstack.compute.console.vnc': 'immutable',
'org.openstack.compute.state': 'immutable'}
OS_VM = core_model.Mixin(
'http://schemas.openstack.org/instance/instance#',
'http://schemas.openstack.org/compute/instance#',
'os_vms', actions=[OS_CHG_PWD, OS_CREATE_IMAGE],
attributes=_OS_VM_ATTRIBUTES)
@ -73,3 +73,10 @@ _OS_KEY_PAIR_ATTRIBUTES = {'org.openstack.credentials.publickey.name': '',
OS_KEY_PAIR_EXT = core_model.Mixin(
'http://schemas.openstack.org/instance/credentials#',
'public_key', attributes=_OS_KEY_PAIR_ATTRIBUTES)
# A Mixin for OpenStack Network links
_OS_NET_LINK_ATTRIBUTES = {'org.openstack.network.floating.pool': 'required'}
OS_NET_LINK = core_model.Mixin(
'http://schemas.openstack.org/network/instance#',
'os_net_link', actions=[],
attributes=_OS_NET_LINK_ATTRIBUTES)

View File

@ -131,6 +131,8 @@ class OCCIApplication(occi_wsgi.Application, wsgi.Application):
openstack.OsComputeBackend())
self.register_backend(os_addon.OS_CHG_PWD,
openstack.OsComputeBackend())
self.register_backend(os_addon.OS_NET_LINK,
networkinterface_backend)
def __call__(self, environ, response):
"""