Remove metric service
There is discussion on the mailing list about ceilometerclient removal that started this. The metric service is not an OpenStack service. It does not have an entry in service-types-authority, nor does it have an API documented at developer.openstack.org/api-ref. That's not saying that someone couldn't install it in their OpenStack cloud and that doing so is a bad idea. It's probably a great idea and those people are likely quite happy. Since this is openstacksdk we need to draw the line somewhere. The add_service patch adds the ability for consumers to opt-in to non-official services. Making an openstacksdk-metric package people could use with a MetricService object and the proxy/resource objects here would be a great idea. As a follow-up we should potentially add the ability to add a list of extra services to a clouds.yaml file. Change-Id: Ib3810e3b11dbacc0215d486397e05370a2d7521e
This commit is contained in:
parent
1f05e3ac4c
commit
cb4c425411
@ -1,5 +1,3 @@
|
||||
# TODO(shade) Add job that enables ceilometer
|
||||
|
||||
- job:
|
||||
name: openstacksdk-tox-py27-tips
|
||||
parent: openstack-tox-py27
|
||||
@ -72,13 +70,6 @@
|
||||
DEFAULT:
|
||||
osapi_max_limit: 6
|
||||
devstack_services:
|
||||
ceilometer-acentral: false
|
||||
ceilometer-acompute: false
|
||||
ceilometer-alarm-evaluator: false
|
||||
ceilometer-alarm-notifier: false
|
||||
ceilometer-anotification: false
|
||||
ceilometer-api: false
|
||||
ceilometer-collector: false
|
||||
horizon: false
|
||||
s-account: true
|
||||
s-container: true
|
||||
|
@ -36,15 +36,6 @@ enable_service q-l3
|
||||
enable_service q-meta
|
||||
enable_service q-metering
|
||||
|
||||
# Enable Ceilometer
|
||||
enable_service ceilometer-acompute
|
||||
enable_service ceilometer-acentral
|
||||
enable_service ceilometer-anotification
|
||||
enable_service ceilometer-collector
|
||||
enable_service ceilometer-alarm-evaluator
|
||||
enable_service ceilometer-alarm-notifier
|
||||
enable_service ceilometer-api
|
||||
|
||||
# Enable Zaqar
|
||||
enable_plugin zaqar https://github.com/openstack/zaqar
|
||||
enable_service zaqar-server
|
||||
|
@ -39,7 +39,6 @@ def get_proxy_methods():
|
||||
"openstack.load_balancer.v2._proxy",
|
||||
"openstack.message.v1._proxy",
|
||||
"openstack.message.v2._proxy",
|
||||
"openstack.metric.v1._proxy",
|
||||
"openstack.network.v2._proxy",
|
||||
"openstack.object_store.v1._proxy",
|
||||
"openstack.orchestration.v1._proxy",
|
||||
|
@ -94,7 +94,6 @@ provided by the SDK.
|
||||
Message v1 <proxies/message_v1>
|
||||
Message v2 <proxies/message_v2>
|
||||
Network <proxies/network>
|
||||
Metric <proxies/metric>
|
||||
Object Store <proxies/object_store>
|
||||
Orchestration <proxies/orchestration>
|
||||
Workflow <proxies/workflow>
|
||||
@ -123,7 +122,6 @@ The following services have exposed *Resource* classes.
|
||||
Image <resources/image/index>
|
||||
Key Management <resources/key_manager/index>
|
||||
Load Balancer <resources/load_balancer/index>
|
||||
Metric <resources/metric/index>
|
||||
Network <resources/network/index>
|
||||
Orchestration <resources/orchestration/index>
|
||||
Object Store <resources/object_store/index>
|
||||
|
@ -1,18 +0,0 @@
|
||||
Metric API
|
||||
==========
|
||||
|
||||
.. automodule:: openstack.metric.v1._proxy
|
||||
|
||||
The Metric Class
|
||||
----------------
|
||||
|
||||
The metric high-level interface is available through the ``metric``
|
||||
member of a :class:`~openstack.connection.Connection` object. The
|
||||
``metric`` member will only be added if the service is detected.
|
||||
|
||||
Capability Operations
|
||||
^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. autoclass:: openstack.metric.v1._proxy.Proxy
|
||||
|
||||
.. automethod:: openstack.metric.v1._proxy.Proxy.capabilities
|
@ -1,10 +0,0 @@
|
||||
Metric Resources
|
||||
================
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
|
||||
v1/archive_policy
|
||||
v1/capabilities
|
||||
v1/metric
|
||||
v1/resource
|
@ -1,13 +0,0 @@
|
||||
openstack.metric.v1.archive_policy
|
||||
==================================
|
||||
|
||||
.. automodule:: openstack.metric.v1.archive_policy
|
||||
|
||||
The ArchivePolicy Class
|
||||
-----------------------
|
||||
|
||||
The ``ArchivePolicy`` class inherits from
|
||||
:class:`~openstack.resource.Resource`.
|
||||
|
||||
.. autoclass:: openstack.metric.v1.archive_policy.ArchivePolicy
|
||||
:members:
|
@ -1,12 +0,0 @@
|
||||
openstack.metric.v1.capabilities
|
||||
================================
|
||||
|
||||
.. automodule:: openstack.metric.v1.capabilities
|
||||
|
||||
The Capabilities Class
|
||||
----------------------
|
||||
|
||||
The ``Capabilities`` class inherits from :class:`~openstack.resource.Resource`.
|
||||
|
||||
.. autoclass:: openstack.metric.v1.capabilities.Capabilities
|
||||
:members:
|
@ -1,12 +0,0 @@
|
||||
openstack.metric.v1.metric
|
||||
==========================
|
||||
|
||||
.. automodule:: openstack.metric.v1.metric
|
||||
|
||||
The Metric Class
|
||||
----------------
|
||||
|
||||
The ``Metric`` class inherits from :class:`~openstack.resource.Resource`.
|
||||
|
||||
.. autoclass:: openstack.metric.v1.metric.Metric
|
||||
:members:
|
@ -1,12 +0,0 @@
|
||||
openstack.metric.v1.resource
|
||||
============================
|
||||
|
||||
.. automodule:: openstack.metric.v1.resource
|
||||
|
||||
The Generic Class
|
||||
-----------------
|
||||
|
||||
The ``Generic`` class inherits from :class:`~openstack.resource.Resource`.
|
||||
|
||||
.. autoclass:: openstack.metric.v1.resource.Generic
|
||||
:members:
|
@ -204,11 +204,6 @@ class Connection(object):
|
||||
self.add_service(
|
||||
service_description.OpenStackServiceDescription(
|
||||
service, self.config))
|
||||
# TODO(mordred) openstacksdk has support for the metric service
|
||||
# which is not in service-types-authority. What do we do about that?
|
||||
self.add_service(
|
||||
service_description.OpenStackServiceDescription(
|
||||
dict(service_type='metric'), self.config))
|
||||
|
||||
def _get_config_from_profile(self, profile, authenticator, **kwargs):
|
||||
"""Get openstack.config objects from legacy profile."""
|
||||
|
@ -1,24 +0,0 @@
|
||||
# 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 import service_filter
|
||||
|
||||
|
||||
class MetricService(service_filter.ServiceFilter):
|
||||
"""The metric service."""
|
||||
|
||||
valid_versions = [service_filter.ValidVersion('v1')]
|
||||
|
||||
def __init__(self, version=None):
|
||||
"""Create a metric service."""
|
||||
super(MetricService, self).__init__(service_type='metric',
|
||||
version=version)
|
@ -1,28 +0,0 @@
|
||||
# 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.metric.v1 import capabilities
|
||||
from openstack import proxy2 as proxy
|
||||
|
||||
|
||||
class Proxy(proxy.BaseProxy):
|
||||
|
||||
def capabilities(self, **query):
|
||||
"""Return a generator of capabilities
|
||||
|
||||
:param kwargs \*\*query: Optional query parameters to be sent to limit
|
||||
the resources being returned.
|
||||
|
||||
:returns: A generator of capability objects
|
||||
:rtype: :class:`~openstack.metric.v1.capabilities.Capabilities`
|
||||
"""
|
||||
return self._list(capabilities.Capabilities, paginated=False, **query)
|
@ -1,35 +0,0 @@
|
||||
# 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.metric import metric_service
|
||||
from openstack import resource2 as resource
|
||||
|
||||
|
||||
class ArchivePolicy(resource.Resource):
|
||||
base_path = '/archive_policy'
|
||||
service = metric_service.MetricService()
|
||||
|
||||
# Supported Operations
|
||||
allow_create = True
|
||||
allow_get = True
|
||||
allow_delete = True
|
||||
allow_list = True
|
||||
|
||||
# Properties
|
||||
#: The name of this policy
|
||||
name = resource.Body('name', alternate_id=True)
|
||||
#: The definition of this policy
|
||||
definition = resource.Body('definition', type=list)
|
||||
#: The window of time older than the period that archives can be requested
|
||||
back_window = resource.Body('back_window')
|
||||
#: A list of the aggregation methods supported
|
||||
aggregation_methods = resource.Body("aggregation_methods", type=list)
|
@ -1,25 +0,0 @@
|
||||
# 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.metric import metric_service
|
||||
from openstack import resource2 as resource
|
||||
|
||||
|
||||
class Capabilities(resource.Resource):
|
||||
base_path = '/capabilities'
|
||||
service = metric_service.MetricService()
|
||||
|
||||
# Supported Operations
|
||||
allow_get = True
|
||||
|
||||
#: The supported methods of aggregation.
|
||||
aggregation_methods = resource.Body('aggregation_methods', type=list)
|
@ -1,39 +0,0 @@
|
||||
# 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.metric import metric_service
|
||||
from openstack import resource2 as resource
|
||||
|
||||
|
||||
class Metric(resource.Resource):
|
||||
base_path = '/metric'
|
||||
service = metric_service.MetricService()
|
||||
|
||||
# Supported Operations
|
||||
allow_create = True
|
||||
allow_get = True
|
||||
allow_delete = True
|
||||
allow_list = True
|
||||
|
||||
# Properties
|
||||
#: The name of the archive policy
|
||||
archive_policy_name = resource.Body('archive_policy_name')
|
||||
#: The archive policy
|
||||
archive_policy = resource.Body('archive_policy')
|
||||
#: The ID of the user who created this metric
|
||||
created_by_user_id = resource.Body('created_by_user_id')
|
||||
#: The ID of the project this metric was created under
|
||||
created_by_project_id = resource.Body('created_by_project_id')
|
||||
#: The identifier of this metric
|
||||
resource_id = resource.Body('resource_id')
|
||||
#: The name of this metric
|
||||
name = resource.Body('name')
|
@ -1,46 +0,0 @@
|
||||
# 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.metric import metric_service
|
||||
from openstack import resource2 as resource
|
||||
|
||||
|
||||
class Generic(resource.Resource):
|
||||
base_path = '/resource/generic'
|
||||
service = metric_service.MetricService()
|
||||
|
||||
# Supported Operations
|
||||
allow_create = True
|
||||
allow_get = True
|
||||
allow_delete = True
|
||||
allow_list = True
|
||||
allow_update = True
|
||||
|
||||
# Properties
|
||||
#: The identifier of this resource
|
||||
id = resource.Body('id')
|
||||
#: The ID of the user who created this resource
|
||||
created_by_user_id = resource.Body('created_by_user_id')
|
||||
#: The ID of the project this resource was created under
|
||||
created_by_project_id = resource.Body('created_by_project_id')
|
||||
#: The ID of the user
|
||||
user_id = resource.Body('user_id')
|
||||
#: The ID of the project
|
||||
project_id = resource.Body('project_id')
|
||||
#: Timestamp when this resource was started
|
||||
started_at = resource.Body('started_at')
|
||||
#: Timestamp when this resource was ended
|
||||
ended_at = resource.Body('ended_at')
|
||||
#: A dictionary of metrics collected on this resource
|
||||
metrics = resource.Body('metrics', type=dict)
|
||||
#: The type of resource
|
||||
type = resource.Body('type')
|
@ -1,28 +0,0 @@
|
||||
# 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.metric import metric_service
|
||||
|
||||
|
||||
class TestMetricService(testtools.TestCase):
|
||||
|
||||
def test_service(self):
|
||||
sot = metric_service.MetricService()
|
||||
self.assertEqual('metric', sot.service_type)
|
||||
self.assertEqual('public', sot.interface)
|
||||
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)
|
@ -1,61 +0,0 @@
|
||||
# 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.metric.v1 import archive_policy
|
||||
|
||||
EXAMPLE = {
|
||||
'definition':
|
||||
[
|
||||
{u'points': 12, u'timespan': u'1:00:00',
|
||||
u'granularity': u'0:05:00'},
|
||||
{u'points': 24, u'timespan': u'1 day, 0:00:00',
|
||||
u'granularity': u'1:00:00'},
|
||||
{u'points': 30, u'timespan': u'30 days, 0:00:00',
|
||||
u'granularity': u'1 day, 0:00:00'},
|
||||
],
|
||||
u'back_window': 0,
|
||||
u'name': u'low',
|
||||
u'aggregation_methods': [u'sum', u'max']
|
||||
}
|
||||
|
||||
|
||||
class TestArchivePolicy(testtools.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestArchivePolicy, self).setUp()
|
||||
self.resp = mock.Mock()
|
||||
self.resp.body = ''
|
||||
self.sess = mock.Mock()
|
||||
self.sess.put = mock.Mock(return_value=self.resp)
|
||||
|
||||
def test_basic(self):
|
||||
m = archive_policy.ArchivePolicy()
|
||||
self.assertIsNone(m.resource_key)
|
||||
self.assertIsNone(m.resources_key)
|
||||
self.assertEqual('/archive_policy', m.base_path)
|
||||
self.assertEqual('metric', m.service.service_type)
|
||||
self.assertTrue(m.allow_create)
|
||||
self.assertTrue(m.allow_get)
|
||||
self.assertFalse(m.allow_update)
|
||||
self.assertTrue(m.allow_delete)
|
||||
self.assertTrue(m.allow_list)
|
||||
|
||||
def test_make_it(self):
|
||||
m = archive_policy.ArchivePolicy(**EXAMPLE)
|
||||
self.assertEqual(EXAMPLE['name'], m.name)
|
||||
self.assertEqual(EXAMPLE['name'], m.id)
|
||||
self.assertEqual(EXAMPLE['definition'], m.definition)
|
||||
self.assertEqual(EXAMPLE['back_window'], m.back_window)
|
||||
self.assertEqual(EXAMPLE['aggregation_methods'], m.aggregation_methods)
|
@ -1,36 +0,0 @@
|
||||
# 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.metric.v1 import capabilities
|
||||
|
||||
BODY = {
|
||||
'aggregation_methods': ['mean', 'max', 'avg'],
|
||||
}
|
||||
|
||||
|
||||
class TestCapabilites(testtools.TestCase):
|
||||
def test_basic(self):
|
||||
sot = capabilities.Capabilities()
|
||||
self.assertEqual('/capabilities', sot.base_path)
|
||||
self.assertEqual('metric', sot.service.service_type)
|
||||
self.assertFalse(sot.allow_create)
|
||||
self.assertTrue(sot.allow_get)
|
||||
self.assertFalse(sot.allow_update)
|
||||
self.assertFalse(sot.allow_delete)
|
||||
self.assertFalse(sot.allow_list)
|
||||
|
||||
def test_make_it(self):
|
||||
sot = capabilities.Capabilities(**BODY)
|
||||
self.assertEqual(BODY['aggregation_methods'],
|
||||
sot.aggregation_methods)
|
@ -1,78 +0,0 @@
|
||||
# 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.metric.v1 import metric
|
||||
|
||||
EXAMPLE = {
|
||||
'id': '31bbd62e-b144-11e4-983c-bf9dbe7e25e6',
|
||||
'archive_policy_name': 'low',
|
||||
'created_by_user_id': '41bbd62e-b144-11e4-983c-bf9dbe7e25e6',
|
||||
'created_by_project_id': '51bbd62e-b144-11e4-983c-bf9dbe7e25e6',
|
||||
'resource_id': None,
|
||||
'name': None,
|
||||
}
|
||||
|
||||
EXAMPLE_AP = {
|
||||
'id': '31bbd62e-b144-11e4-983c-bf9dbe7e25e6',
|
||||
'archive_policy': {
|
||||
'name': "foobar",
|
||||
},
|
||||
'created_by_user_id': '41bbd62e-b144-11e4-983c-bf9dbe7e25e6',
|
||||
'created_by_project_id': '51bbd62e-b144-11e4-983c-bf9dbe7e25e6',
|
||||
'resource_id': "61bbd62e-b144-11e4-983c-bf9dbe7e25e6",
|
||||
'name': "foobaz",
|
||||
}
|
||||
|
||||
|
||||
class TestMetric(testtools.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestMetric, self).setUp()
|
||||
self.resp = mock.Mock()
|
||||
self.resp.body = ''
|
||||
self.sess = mock.Mock()
|
||||
self.sess.put = mock.Mock(return_value=self.resp)
|
||||
|
||||
def test_basic(self):
|
||||
m = metric.Metric()
|
||||
self.assertIsNone(m.resource_key)
|
||||
self.assertIsNone(m.resources_key)
|
||||
self.assertEqual('/metric', m.base_path)
|
||||
self.assertEqual('metric', m.service.service_type)
|
||||
self.assertTrue(m.allow_create)
|
||||
self.assertTrue(m.allow_get)
|
||||
self.assertFalse(m.allow_update)
|
||||
self.assertTrue(m.allow_delete)
|
||||
self.assertTrue(m.allow_list)
|
||||
|
||||
def test_make_it(self):
|
||||
m = metric.Metric(**EXAMPLE)
|
||||
self.assertEqual(EXAMPLE['id'], m.id)
|
||||
self.assertEqual(EXAMPLE['archive_policy_name'], m.archive_policy_name)
|
||||
self.assertEqual(EXAMPLE['created_by_user_id'], m.created_by_user_id)
|
||||
self.assertEqual(EXAMPLE['created_by_project_id'],
|
||||
m.created_by_project_id)
|
||||
self.assertEqual(EXAMPLE['resource_id'], m.resource_id)
|
||||
self.assertEqual(EXAMPLE['name'], m.name)
|
||||
|
||||
m = metric.Metric(**EXAMPLE_AP)
|
||||
self.assertEqual(EXAMPLE_AP['id'], m.id)
|
||||
self.assertEqual(EXAMPLE_AP['archive_policy'], m.archive_policy)
|
||||
self.assertEqual(EXAMPLE_AP['created_by_user_id'],
|
||||
m.created_by_user_id)
|
||||
self.assertEqual(EXAMPLE_AP['created_by_project_id'],
|
||||
m.created_by_project_id)
|
||||
self.assertEqual(EXAMPLE_AP['resource_id'], m.resource_id)
|
||||
self.assertEqual(EXAMPLE_AP['name'], m.name)
|
@ -1,25 +0,0 @@
|
||||
# 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.metric.v1 import _proxy
|
||||
from openstack.metric.v1 import capabilities
|
||||
from openstack.tests.unit import test_proxy_base2 as test_proxy_base
|
||||
|
||||
|
||||
class TestMetricProxy(test_proxy_base.TestProxyBase):
|
||||
def setUp(self):
|
||||
super(TestMetricProxy, self).setUp()
|
||||
self.proxy = _proxy.Proxy(self.session)
|
||||
|
||||
def test_capabilities(self):
|
||||
self.verify_list(self.proxy.capabilities, capabilities.Capabilities,
|
||||
paginated=False)
|
@ -1,56 +0,0 @@
|
||||
# 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.metric.v1 import resource
|
||||
|
||||
|
||||
EXAMPLE_GENERIC = {
|
||||
"created_by_user_id": "5521eab6-a3bc-4841-b253-d62871b65e76",
|
||||
"started_at": "2015-03-09T12:14:57.233772",
|
||||
"user_id": None,
|
||||
"created_by_project_id": "41649c3e-5f7a-41d1-81fb-2efa76c09e6c",
|
||||
"metrics": {},
|
||||
"ended_at": None,
|
||||
"project_id": None,
|
||||
"type": "generic",
|
||||
"id": "a8d5e83b-0320-45ce-8282-7c8ad8fb8bf6",
|
||||
}
|
||||
|
||||
|
||||
class TestResource(testtools.TestCase):
|
||||
def test_generic(self):
|
||||
m = resource.Generic()
|
||||
self.assertIsNone(m.resource_key)
|
||||
self.assertIsNone(m.resources_key)
|
||||
self.assertEqual('/resource/generic', m.base_path)
|
||||
self.assertEqual('metric', m.service.service_type)
|
||||
self.assertTrue(m.allow_create)
|
||||
self.assertTrue(m.allow_get)
|
||||
self.assertTrue(m.allow_update)
|
||||
self.assertTrue(m.allow_delete)
|
||||
self.assertTrue(m.allow_list)
|
||||
|
||||
def test_make_generic(self):
|
||||
r = resource.Generic(**EXAMPLE_GENERIC)
|
||||
self.assertEqual(EXAMPLE_GENERIC['created_by_user_id'],
|
||||
r.created_by_user_id)
|
||||
self.assertEqual(EXAMPLE_GENERIC['created_by_project_id'],
|
||||
r.created_by_project_id)
|
||||
self.assertEqual(EXAMPLE_GENERIC['user_id'], r.user_id)
|
||||
self.assertEqual(EXAMPLE_GENERIC['project_id'], r.project_id)
|
||||
self.assertEqual(EXAMPLE_GENERIC['type'], r.type)
|
||||
self.assertEqual(EXAMPLE_GENERIC['id'], r.id)
|
||||
self.assertEqual(EXAMPLE_GENERIC['metrics'], r.metrics)
|
||||
self.assertEqual(EXAMPLE_GENERIC['started_at'], r.started_at)
|
||||
self.assertEqual(EXAMPLE_GENERIC['ended_at'], r.ended_at)
|
5
releasenotes/notes/remove-metric-fe5ddfd52b43c852.yaml
Normal file
5
releasenotes/notes/remove-metric-fe5ddfd52b43c852.yaml
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
upgrade:
|
||||
- |
|
||||
Removed the metric service. It is not an OpenStack service and does not
|
||||
have an entry in service-types-authority.
|
Loading…
Reference in New Issue
Block a user