Yuiko Takada | b652700 | 2015-12-07 11:49:12 +0900 | [diff] [blame] | 1 | # 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 | |
| 15 | from tempest import clients |
| 16 | from tempest.common import credentials_factory as common_creds |
| 17 | from tempest import config |
| 18 | |
| 19 | from ironic_tempest_plugin.services.baremetal.v1.json.baremetal_client import \ |
| 20 | BaremetalClient |
| 21 | |
| 22 | |
| 23 | CONF = config.CONF |
| 24 | |
Vladyslav Drok | ac752ac | 2017-03-10 16:16:14 +0200 | [diff] [blame] | 25 | ADMIN_CREDS = None |
Yuiko Takada | b652700 | 2015-12-07 11:49:12 +0900 | [diff] [blame] | 26 | |
| 27 | |
| 28 | class Manager(clients.Manager): |
| 29 | def __init__(self, |
Vladyslav Drok | ac752ac | 2017-03-10 16:16:14 +0200 | [diff] [blame] | 30 | credentials=None): |
Yuiko Takada | ff78500 | 2015-12-17 15:56:42 +0900 | [diff] [blame] | 31 | """Initialization of Manager class. |
| 32 | |
| 33 | Setup service client and make it available for test cases. |
| 34 | :param credentials: type Credentials or TestResources |
Yuiko Takada | ff78500 | 2015-12-17 15:56:42 +0900 | [diff] [blame] | 35 | """ |
Vladyslav Drok | ac752ac | 2017-03-10 16:16:14 +0200 | [diff] [blame] | 36 | 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 Drok | 96bd3e3 | 2017-01-05 12:19:11 +0200 | [diff] [blame] | 41 | super(Manager, self).__init__(credentials) |
Thiago Paiva | a776093 | 2016-08-15 15:23:30 -0300 | [diff] [blame] | 42 | 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 Takada | b652700 | 2015-12-07 11:49:12 +0900 | [diff] [blame] | 48 | 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 Paiva | a776093 | 2016-08-15 15:23:30 -0300 | [diff] [blame] | 53 | **default_params_with_timeout_values) |