Fix AodhAlarmTest to use gnocchi
This changes the test to use AodhGnocchiAggregationByMetricsAlarm
and add measures using gnocchi api.
Change-Id: I0b2fe154b93d9882b703e95a0b09f139697ceb9a
Closes-Bug: #1727637
diff --git a/heat_tempest_plugin/services/clients.py b/heat_tempest_plugin/services/clients.py
index ffd5b78..ca79374 100644
--- a/heat_tempest_plugin/services/clients.py
+++ b/heat_tempest_plugin/services/clients.py
@@ -12,8 +12,8 @@
import os
-from ceilometerclient import client as ceilometer_client
from cinderclient import client as cinder_client
+from gnocchiclient import client as gnocchi_client
from heatclient import client as heat_client
from keystoneauth1 import exceptions as kc_exceptions
from keystoneauth1.identity.generic import password
@@ -64,7 +64,7 @@
CINDERCLIENT_VERSION = '2'
HEATCLIENT_VERSION = '1'
NOVA_API_VERSION = '2.1'
- CEILOMETER_VERSION = '2'
+ GNOCCHI_VERSION = '1'
def __init__(self, conf, admin_credentials=False):
self.conf = conf
@@ -82,7 +82,7 @@
self.network_client = self._get_network_client()
self.volume_client = self._get_volume_client()
self.object_client = self._get_object_client()
- self.metering_client = self._get_metering_client()
+ self.metric_client = self._get_metric_client()
def _username(self):
if self.admin_credentials:
@@ -182,18 +182,13 @@
}
return swift_client.Connection(**args)
- def _get_metering_client(self):
- try:
- endpoint = self.identity_client.get_endpoint_url('metering',
- self.conf.region)
- except kc_exceptions.EndpointNotFound:
- return None
- else:
- args = {
- 'session': self.identity_client.session,
- 'region_name': self.conf.region,
- 'endpoint_type': 'publicURL',
- 'service_type': 'metering',
- }
- return ceilometer_client.Client(self.CEILOMETER_VERSION,
- endpoint, **args)
+ def _get_metric_client(self):
+
+ adapter_options = {'interface': 'public',
+ 'region_name': self.conf.region}
+ args = {
+ 'session': self.identity_client.session,
+ 'adapter_options': adapter_options
+ }
+ return gnocchi_client.Client(version=self.GNOCCHI_VERSION,
+ **args)