
move code around so useful methods are in a common place. create a clients singleton holding all required clients for testing. Change-Id: I65d0a8b494ef760b9d14f132f5611cfefde03dc7
81 lines
2.3 KiB
Python
81 lines
2.3 KiB
Python
# Copyright 2016 Nokia
|
|
#
|
|
# 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 vitrage import keystone_client
|
|
from vitrage import os_clients
|
|
from vitrageclient import client as vc
|
|
|
|
|
|
class TempestClients(object):
|
|
@classmethod
|
|
def class_init(cls, conf):
|
|
cls._conf = conf
|
|
cls._vitrage = None
|
|
cls._ceilometer = None
|
|
cls._nova = None
|
|
cls._cinder = None
|
|
cls._glance = None
|
|
cls._neutron = None
|
|
cls._heat = None
|
|
cls._mistral = None
|
|
|
|
@classmethod
|
|
def vitrage(cls):
|
|
if not cls._vitrage:
|
|
cls._vitrage = vc.Client(
|
|
'1', session=keystone_client.get_session(cls._conf))
|
|
return cls._vitrage
|
|
|
|
@classmethod
|
|
def ceilometer(cls):
|
|
if not cls._ceilometer:
|
|
cls._ceilometer = os_clients.ceilometer_client(cls._conf)
|
|
return cls._ceilometer
|
|
|
|
@classmethod
|
|
def nova(cls):
|
|
if not cls._nova:
|
|
cls._nova = os_clients.nova_client(cls._conf)
|
|
return cls._nova
|
|
|
|
@classmethod
|
|
def cinder(cls):
|
|
if not cls._cinder:
|
|
cls._cinder = os_clients.cinder_client(cls._conf)
|
|
return cls._cinder
|
|
|
|
@classmethod
|
|
def glance(cls):
|
|
if not cls._glance:
|
|
cls._glance = os_clients.glance_client(cls._conf)
|
|
return cls._glance
|
|
|
|
@classmethod
|
|
def neutron(cls):
|
|
if not cls._neutron:
|
|
cls._neutron = os_clients.neutron_client(cls._conf)
|
|
return cls._neutron
|
|
|
|
@classmethod
|
|
def heat(cls):
|
|
if not cls._heat:
|
|
cls._heat = os_clients.heat_client(cls._conf)
|
|
return cls._heat
|
|
|
|
@classmethod
|
|
def mistral(cls):
|
|
if not cls._mistral:
|
|
cls._mistral = os_clients.mistral_client(cls._conf)
|
|
return cls._mistral
|