Add basic support for Senlin service
This patch adds basic support for Senlin service including consts of Senlin service name, type and Senlin client implementation in osclients module. Change-Id: I94fa1143553b5ac815087820b6bb5ec54db2f3b0 Partial-bp: add-support-for-clustering-service-senlin
This commit is contained in:
parent
7de6956ee7
commit
7f3d4310fb
@ -3,3 +3,4 @@ python-fuelclient==6.1.0
|
||||
python-muranoclient>=0.5.5
|
||||
python-monascaclient>=1.0.22
|
||||
python-cueclient>=1.0.0
|
||||
python-senlinclient>=0.3.0 # Apache-2.0
|
||||
|
@ -26,6 +26,7 @@ from rally.common import utils
|
||||
|
||||
class _TempestTestsAPI(utils.ImmutableMixin, utils.EnumMixin):
|
||||
BAREMETAL = "baremetal"
|
||||
CLUSTERING = "clustering"
|
||||
COMPUTE = "compute"
|
||||
DATA_PROCESSING = "data_processing"
|
||||
DATABASE = "database"
|
||||
@ -103,6 +104,7 @@ class _Service(utils.ImmutableMixin, utils.EnumMixin):
|
||||
CEILOMETER = "ceilometer"
|
||||
MONASCA = "monasca"
|
||||
S3 = "s3"
|
||||
SENLIN = "senlin"
|
||||
TROVE = "trove"
|
||||
SAHARA = "sahara"
|
||||
SWIFT = "swift"
|
||||
@ -121,6 +123,7 @@ class _ServiceType(utils.ImmutableMixin, utils.EnumMixin):
|
||||
CLOUD = "cloudformation"
|
||||
ORCHESTRATION = "orchestration"
|
||||
IDENTITY = "identity"
|
||||
CLUSTERING = "clustering"
|
||||
COMPUTE = "compute"
|
||||
NETWORK = "network"
|
||||
DNS = "dns"
|
||||
@ -137,6 +140,7 @@ class _ServiceType(utils.ImmutableMixin, utils.EnumMixin):
|
||||
|
||||
def __init__(self):
|
||||
self.__names = {
|
||||
self.CLUSTERING: _Service.SENLIN,
|
||||
self.COMPUTE: _Service.NOVA,
|
||||
self.VOLUME: _Service.CINDER,
|
||||
self.SHARE: _Service.MANILA,
|
||||
|
@ -691,6 +691,17 @@ class Cue(OSClient):
|
||||
return cue.Client(session=session, interface=endpoint_type[0])
|
||||
|
||||
|
||||
@configure("senlin", default_version="1", default_service_type="clustering",
|
||||
supported_versions=["1"])
|
||||
class Senlin(OSClient):
|
||||
def create_client(self, version=None, service_type=None):
|
||||
"""Return senlin client."""
|
||||
from senlinclient import client as senlin
|
||||
return senlin.Client(
|
||||
self.choose_version(version),
|
||||
**self._get_auth_info(project_name_key="project_name"))
|
||||
|
||||
|
||||
class Clients(object):
|
||||
"""This class simplify and unify work with OpenStack python clients."""
|
||||
|
||||
|
@ -1457,6 +1457,13 @@ class FakeCueClient(object):
|
||||
pass
|
||||
|
||||
|
||||
class FakeSenlinClient(object):
|
||||
|
||||
def __init__(self):
|
||||
# TODO(Yanyan Hu):Fake interfaces of senlinclient.
|
||||
pass
|
||||
|
||||
|
||||
class FakeClients(object):
|
||||
|
||||
def __init__(self, credential_=None):
|
||||
@ -1476,6 +1483,7 @@ class FakeClients(object):
|
||||
self._murano = None
|
||||
self._monasca = None
|
||||
self._ec2 = None
|
||||
self._senlin = None
|
||||
self._credential = credential_ or objects.Credential(
|
||||
"http://fake.example.org:5000/v2.0/",
|
||||
"fake_username",
|
||||
@ -1565,6 +1573,11 @@ class FakeClients(object):
|
||||
self._ec2 = FakeEC2Client()
|
||||
return self._ec2
|
||||
|
||||
def senlin(self):
|
||||
if not self._senlin:
|
||||
self._senlin = FakeSenlinClient()
|
||||
return self._senlin
|
||||
|
||||
|
||||
class FakeRunner(object):
|
||||
|
||||
|
@ -782,3 +782,19 @@ class OSClientsTestCase(test.TestCase):
|
||||
interface=consts.EndpointType.PUBLIC,
|
||||
session=self.fake_keystone.session)
|
||||
self.assertEqual(fake_cue, self.clients.cache["cue"])
|
||||
|
||||
def test_senlin(self):
|
||||
mock_senlin = mock.MagicMock()
|
||||
self.assertNotIn("senlin", self.clients.cache)
|
||||
with mock.patch.dict("sys.modules", {"senlinclient": mock_senlin}):
|
||||
client = self.clients.senlin()
|
||||
self.assertEqual(mock_senlin.client.Client.return_value, client)
|
||||
mock_senlin.client.Client.assert_called_once_with(
|
||||
"1",
|
||||
username=self.credential.username,
|
||||
password=self.credential.password,
|
||||
project_name=self.credential.tenant_name,
|
||||
auth_url=self.credential.auth_url)
|
||||
self.assertEqual(
|
||||
mock_senlin.client.Client.return_value,
|
||||
self.clients.cache["senlin"])
|
||||
|
Loading…
Reference in New Issue
Block a user