blob: 2b818780029ebec3219a47c34c01ccdc3dccbaa3 [file] [log] [blame]
Yuiko Takadab6527002015-12-07 11:49:12 +09001# All Rights Reserved.
2#
3# Licensed under the Apache License, Version 2.0 (the "License"); you may
4# not use this file except in compliance with the License. You may obtain
5# a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations
13# under the License.
14
15from tempest import clients
16from tempest.common import credentials_factory as common_creds
17from tempest import config
18
19from ironic_tempest_plugin.services.baremetal.v1.json.baremetal_client import \
20 BaremetalClient
21
22
23CONF = config.CONF
24
Vladyslav Drokac752ac2017-03-10 16:16:14 +020025ADMIN_CREDS = None
Yuiko Takadab6527002015-12-07 11:49:12 +090026
27
28class Manager(clients.Manager):
29 def __init__(self,
Vladyslav Drokac752ac2017-03-10 16:16:14 +020030 credentials=None):
Yuiko Takadaff785002015-12-17 15:56:42 +090031 """Initialization of Manager class.
32
33 Setup service client and make it available for test cases.
34 :param credentials: type Credentials or TestResources
Yuiko Takadaff785002015-12-17 15:56:42 +090035 """
Vladyslav Drokac752ac2017-03-10 16:16:14 +020036 if credentials is None:
37 global ADMIN_CREDS
38 if ADMIN_CREDS is None:
39 ADMIN_CREDS = common_creds.get_configured_admin_credentials()
40 credentials = ADMIN_CREDS
Vladyslav Drok96bd3e32017-01-05 12:19:11 +020041 super(Manager, self).__init__(credentials)
Thiago Paivaa7760932016-08-15 15:23:30 -030042 default_params_with_timeout_values = {
43 'build_interval': CONF.compute.build_interval,
44 'build_timeout': CONF.compute.build_timeout
45 }
46 default_params_with_timeout_values.update(self.default_params)
47
Yuiko Takadab6527002015-12-07 11:49:12 +090048 self.baremetal_client = BaremetalClient(
49 self.auth_provider,
50 CONF.baremetal.catalog_type,
51 CONF.identity.region,
52 endpoint_type=CONF.baremetal.endpoint_type,
Thiago Paivaa7760932016-08-15 15:23:30 -030053 **default_params_with_timeout_values)