Merge "Initial commit for the Messaging service (Zaqar)"
This commit is contained in:
@@ -19,6 +19,7 @@ KEYSTONE_BRANCH=stable/OPENSTACK_VERSION
|
|||||||
NEUTRON_BRANCH=stable/OPENSTACK_VERSION
|
NEUTRON_BRANCH=stable/OPENSTACK_VERSION
|
||||||
NOVA_BRANCH=stable/OPENSTACK_VERSION
|
NOVA_BRANCH=stable/OPENSTACK_VERSION
|
||||||
SWIFT_BRANCH=stable/OPENSTACK_VERSION
|
SWIFT_BRANCH=stable/OPENSTACK_VERSION
|
||||||
|
ZAQAR_BRANCH=stable/OPENSTACK_VERSION
|
||||||
|
|
||||||
# Enable Swift
|
# Enable Swift
|
||||||
enable_service s-proxy
|
enable_service s-proxy
|
||||||
@@ -44,6 +45,10 @@ enable_service ceilometer-alarm-evaluator
|
|||||||
enable_service ceilometer-alarm-notifier
|
enable_service ceilometer-alarm-notifier
|
||||||
enable_service ceilometer-api
|
enable_service ceilometer-api
|
||||||
|
|
||||||
|
# Enable Zaqar
|
||||||
|
enable_plugin zaqar https://github.com/openstack/zaqar
|
||||||
|
enable_service zaqar-server
|
||||||
|
|
||||||
# Automatically download and register a VM image that Heat can launch
|
# Automatically download and register a VM image that Heat can launch
|
||||||
# For more information on Heat and DevStack see
|
# For more information on Heat and DevStack see
|
||||||
# http://docs.openstack.org/developer/heat/getting_started/on_devstack.html
|
# http://docs.openstack.org/developer/heat/getting_started/on_devstack.html
|
||||||
|
|||||||
0
openstack/messaging/__init__.py
Normal file
0
openstack/messaging/__init__.py
Normal file
26
openstack/messaging/messaging_service.py
Normal file
26
openstack/messaging/messaging_service.py
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
# not use this file except in compliance with the License. You may obtain
|
||||||
|
# a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
# License for the specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
|
||||||
|
from openstack.auth import service_filter
|
||||||
|
|
||||||
|
|
||||||
|
class MessagingService(service_filter.ServiceFilter):
|
||||||
|
"""The messaging service."""
|
||||||
|
|
||||||
|
valid_versions = [service_filter.ValidVersion('v1')]
|
||||||
|
|
||||||
|
def __init__(self, version=None):
|
||||||
|
"""Create an messaging service."""
|
||||||
|
super(MessagingService, self).__init__(
|
||||||
|
service_type='messaging',
|
||||||
|
version=version
|
||||||
|
)
|
||||||
0
openstack/messaging/v1/__init__.py
Normal file
0
openstack/messaging/v1/__init__.py
Normal file
29
openstack/messaging/v1/_proxy.py
Normal file
29
openstack/messaging/v1/_proxy.py
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
# not use this file except in compliance with the License. You may obtain
|
||||||
|
# a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
# License for the specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
|
||||||
|
from openstack.messaging.v1 import queue
|
||||||
|
from openstack import proxy
|
||||||
|
|
||||||
|
|
||||||
|
class Proxy(proxy.BaseProxy):
|
||||||
|
|
||||||
|
def create_queue(self, **attrs):
|
||||||
|
"""Create a new queue from attributes
|
||||||
|
|
||||||
|
:param dict attrs: Keyword arguments which will be used to create
|
||||||
|
a :class:`~openstack.messaging.v1.queue.Queue`,
|
||||||
|
comprised of the properties on the Queue class.
|
||||||
|
|
||||||
|
:returns: The results of queue creation
|
||||||
|
:rtype: :class:`~openstack.messaging.v1.queue.Queue`
|
||||||
|
"""
|
||||||
|
return self._create(queue.Queue, **attrs)
|
||||||
33
openstack/messaging/v1/queue.py
Normal file
33
openstack/messaging/v1/queue.py
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
# not use this file except in compliance with the License. You may obtain
|
||||||
|
# a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
# License for the specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
|
||||||
|
from openstack.messaging import messaging_service
|
||||||
|
from openstack import resource
|
||||||
|
|
||||||
|
|
||||||
|
class Queue(resource.Resource):
|
||||||
|
id_attribute = 'name'
|
||||||
|
resources_key = 'queues'
|
||||||
|
base_path = '/queues'
|
||||||
|
service = messaging_service.MessagingService()
|
||||||
|
|
||||||
|
# capabilities
|
||||||
|
allow_create = True
|
||||||
|
allow_list = False
|
||||||
|
allow_retrieve = False
|
||||||
|
allow_delete = False
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def create_by_id(cls, session, attrs, resource_id=None, path_args=None):
|
||||||
|
url = cls._get_url(path_args, resource_id)
|
||||||
|
session.put(url, service=cls.service, accept=None)
|
||||||
|
return {cls.id_attribute: resource_id}
|
||||||
30
openstack/messaging/version.py
Normal file
30
openstack/messaging/version.py
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
# not use this file except in compliance with the License. You may obtain
|
||||||
|
# a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
# License for the specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
|
||||||
|
from openstack.messaging import messaging_service
|
||||||
|
from openstack import resource
|
||||||
|
|
||||||
|
|
||||||
|
class Version(resource.Resource):
|
||||||
|
resource_key = 'version'
|
||||||
|
resources_key = 'versions'
|
||||||
|
base_path = '/'
|
||||||
|
service = messaging_service.MessagingService(
|
||||||
|
version=messaging_service.MessagingService.UNVERSIONED
|
||||||
|
)
|
||||||
|
|
||||||
|
# capabilities
|
||||||
|
allow_list = True
|
||||||
|
|
||||||
|
# Properties
|
||||||
|
links = resource.prop('links')
|
||||||
|
status = resource.prop('status')
|
||||||
@@ -59,6 +59,7 @@ from openstack import exceptions
|
|||||||
from openstack.identity import identity_service
|
from openstack.identity import identity_service
|
||||||
from openstack.image import image_service
|
from openstack.image import image_service
|
||||||
from openstack.keystore import keystore_service
|
from openstack.keystore import keystore_service
|
||||||
|
from openstack.messaging import messaging_service
|
||||||
from openstack.metric import metric_service
|
from openstack.metric import metric_service
|
||||||
from openstack.network import network_service
|
from openstack.network import network_service
|
||||||
from openstack.object_store import object_store_service
|
from openstack.object_store import object_store_service
|
||||||
@@ -120,6 +121,9 @@ class Profile(object):
|
|||||||
serv = volume_service.VolumeService()
|
serv = volume_service.VolumeService()
|
||||||
serv.set_visibility(None)
|
serv.set_visibility(None)
|
||||||
self._services[serv.service_type] = serv
|
self._services[serv.service_type] = serv
|
||||||
|
serv = messaging_service.MessagingService()
|
||||||
|
serv.set_visibility(None)
|
||||||
|
self._services[serv.service_type] = serv
|
||||||
|
|
||||||
self.service_names = sorted(self._services.keys())
|
self.service_names = sorted(self._services.keys())
|
||||||
|
|
||||||
|
|||||||
0
openstack/tests/unit/messaging/__init__.py
Normal file
0
openstack/tests/unit/messaging/__init__.py
Normal file
28
openstack/tests/unit/messaging/test_messaging_service.py
Normal file
28
openstack/tests/unit/messaging/test_messaging_service.py
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
# not use this file except in compliance with the License. You may obtain
|
||||||
|
# a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
# License for the specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
|
||||||
|
import testtools
|
||||||
|
|
||||||
|
from openstack.messaging import messaging_service
|
||||||
|
|
||||||
|
|
||||||
|
class TestOrchestrationService(testtools.TestCase):
|
||||||
|
|
||||||
|
def test_service(self):
|
||||||
|
sot = messaging_service.MessagingService()
|
||||||
|
self.assertEqual('messaging', sot.service_type)
|
||||||
|
self.assertEqual('public', sot.visibility)
|
||||||
|
self.assertIsNone(sot.region)
|
||||||
|
self.assertIsNone(sot.service_name)
|
||||||
|
self.assertEqual(1, len(sot.valid_versions))
|
||||||
|
self.assertEqual('v1', sot.valid_versions[0].module)
|
||||||
|
self.assertEqual('v1', sot.valid_versions[0].path)
|
||||||
43
openstack/tests/unit/messaging/test_version.py
Normal file
43
openstack/tests/unit/messaging/test_version.py
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
# not use this file except in compliance with the License. You may obtain
|
||||||
|
# a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
# License for the specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
|
||||||
|
import testtools
|
||||||
|
|
||||||
|
from openstack.messaging import version
|
||||||
|
|
||||||
|
IDENTIFIER = 'IDENTIFIER'
|
||||||
|
EXAMPLE = {
|
||||||
|
'id': IDENTIFIER,
|
||||||
|
'links': '2',
|
||||||
|
'status': '3',
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class TestVersion(testtools.TestCase):
|
||||||
|
|
||||||
|
def test_basic(self):
|
||||||
|
sot = version.Version()
|
||||||
|
self.assertEqual('version', sot.resource_key)
|
||||||
|
self.assertEqual('versions', sot.resources_key)
|
||||||
|
self.assertEqual('/', sot.base_path)
|
||||||
|
self.assertEqual('messaging', sot.service.service_type)
|
||||||
|
self.assertFalse(sot.allow_create)
|
||||||
|
self.assertFalse(sot.allow_retrieve)
|
||||||
|
self.assertFalse(sot.allow_update)
|
||||||
|
self.assertFalse(sot.allow_delete)
|
||||||
|
self.assertTrue(sot.allow_list)
|
||||||
|
|
||||||
|
def test_make_it(self):
|
||||||
|
sot = version.Version(EXAMPLE)
|
||||||
|
self.assertEqual(EXAMPLE['id'], sot.id)
|
||||||
|
self.assertEqual(EXAMPLE['links'], sot.links)
|
||||||
|
self.assertEqual(EXAMPLE['status'], sot.status)
|
||||||
0
openstack/tests/unit/messaging/v1/__init__.py
Normal file
0
openstack/tests/unit/messaging/v1/__init__.py
Normal file
29
openstack/tests/unit/messaging/v1/test_proxy.py
Normal file
29
openstack/tests/unit/messaging/v1/test_proxy.py
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
# not use this file except in compliance with the License. You may obtain
|
||||||
|
# a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
# License for the specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
|
||||||
|
from openstack.messaging.v1 import _proxy
|
||||||
|
from openstack.messaging.v1 import queue
|
||||||
|
from openstack.tests.unit import test_proxy_base
|
||||||
|
|
||||||
|
|
||||||
|
class TestMessagingProxy(test_proxy_base.TestProxyBase):
|
||||||
|
def setUp(self):
|
||||||
|
super(TestMessagingProxy, self).setUp()
|
||||||
|
self.proxy = _proxy.Proxy(self.session)
|
||||||
|
|
||||||
|
def test_queue_create_attrs(self):
|
||||||
|
kwargs = {"x": 1, "y": 2, "z": 3}
|
||||||
|
self.verify_create2('openstack.proxy.BaseProxy._create',
|
||||||
|
self.proxy.create_queue,
|
||||||
|
method_kwargs=kwargs,
|
||||||
|
expected_args=[queue.Queue],
|
||||||
|
expected_kwargs=kwargs)
|
||||||
53
openstack/tests/unit/messaging/v1/test_queue.py
Normal file
53
openstack/tests/unit/messaging/v1/test_queue.py
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
# not use this file except in compliance with the License. You may obtain
|
||||||
|
# a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
# License for the specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
|
||||||
|
import mock
|
||||||
|
import testtools
|
||||||
|
|
||||||
|
from openstack.messaging.v1 import queue
|
||||||
|
|
||||||
|
|
||||||
|
FAKE_NAME = 'test_queue'
|
||||||
|
FAKE = {
|
||||||
|
'name': FAKE_NAME,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class TestStack(testtools.TestCase):
|
||||||
|
|
||||||
|
def test_basic(self):
|
||||||
|
sot = queue.Queue()
|
||||||
|
self.assertEqual('queues', sot.resources_key)
|
||||||
|
self.assertEqual('/queues', sot.base_path)
|
||||||
|
self.assertEqual('messaging', sot.service.service_type)
|
||||||
|
self.assertTrue(sot.allow_create)
|
||||||
|
self.assertFalse(sot.allow_retrieve)
|
||||||
|
self.assertFalse(sot.allow_update)
|
||||||
|
self.assertFalse(sot.allow_delete)
|
||||||
|
self.assertFalse(sot.allow_list)
|
||||||
|
|
||||||
|
def test_make_it(self):
|
||||||
|
sot = queue.Queue(FAKE)
|
||||||
|
self.assertEqual(FAKE['name'], sot.name)
|
||||||
|
|
||||||
|
def test_create(self):
|
||||||
|
sess = mock.Mock()
|
||||||
|
sess.put = mock.Mock()
|
||||||
|
sess.put.return_value = mock.Mock()
|
||||||
|
sot = queue.Queue(FAKE)
|
||||||
|
|
||||||
|
sot.create(sess)
|
||||||
|
|
||||||
|
url = 'queues/%s' % FAKE_NAME
|
||||||
|
sess.put.assert_called_with(url, service=sot.service, accept=None)
|
||||||
|
self.assertEqual(FAKE_NAME, sot.id)
|
||||||
|
self.assertEqual(FAKE_NAME, sot.name)
|
||||||
@@ -24,6 +24,7 @@ class TestProfile(base.TestCase):
|
|||||||
'identity',
|
'identity',
|
||||||
'image',
|
'image',
|
||||||
'keystore',
|
'keystore',
|
||||||
|
'messaging',
|
||||||
'metering',
|
'metering',
|
||||||
'metric',
|
'metric',
|
||||||
'network',
|
'network',
|
||||||
|
|||||||
Reference in New Issue
Block a user