blob: 47479bae61b35f964d2070173ada71452c2c854e [file] [log] [blame]
Kiall Mac Innes25fb29e2016-04-07 08:07:04 +01001# Copyright 2016 NEC Corporation. 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
15import os
16
17from tempest import config
18from tempest.test_discover import plugins
19
20from designate_tempest_plugin import config as project_config
21
22
23class DesignateTempestPlugin(plugins.TempestPlugin):
24 """
25 A DesignateTempestPlugin class provides the basic hooks for an external
26 plugin to provide tempest the necessary information to run the plugin.
27 """
28 def load_tests(self):
29 """
30 Method to return the information necessary to load the tests in the
31 plugin.
32
33 :return: a tuple with the first value being the test_dir and the second
34 being the top_level
35 :return type: tuple
36 """
37 base_path = os.path.split(os.path.dirname(
38 os.path.abspath(__file__)))[0]
39 test_dir = "designate_tempest_plugin/tests"
40 full_test_dir = os.path.join(base_path, test_dir)
41 return full_test_dir, base_path
42
43 def register_opts(self, conf):
44 """
45 Add additional configuration options to tempest.
46
47 This method will be run for the plugin during the register_opts()
48 function in tempest.config
49
50 Parameters:
51 conf (ConfigOpts): The conf object that can be used to register
52 additional options on.
53 """
Kiall Mac Innes8ae796c2016-04-21 13:47:25 +010054 config.register_opt_group(conf, project_config.service_available_group,
55 project_config.ServiceAvailableGroup)
Kiall Mac Innes25fb29e2016-04-07 08:07:04 +010056 config.register_opt_group(conf, project_config.dns_group,
57 project_config.DnsGroup)
Kiall Mac Innes8ae796c2016-04-21 13:47:25 +010058 config.register_opt_group(conf, project_config.dns_feature_group,
59 project_config.DnsFeatureGroup)
Kiall Mac Innes25fb29e2016-04-07 08:07:04 +010060
61 def get_opt_lists(self):
62 """
63 Get a list of options for sample config generation
64
65 Return option_list: A list of tuples with the group name
66 and options in that group.
67 Return type: list
68 """
Kiall Mac Innes8ae796c2016-04-21 13:47:25 +010069 return [
70 (project_config.service_available_group.name,
71 project_config.ServiceAvailableGroup),
72 (project_config.dns_group.name,
73 project_config.DnsGroup),
74 (project_config.dns_feature_group.name,
75 project_config.DnsFeatureGroup),
76 ]
Andrea Frittoli0eeb2902017-10-26 15:39:27 +020077
78 def get_service_clients(self):
79 dns_config = config.service_client_config('dns')
80 admin_params = {
81 'name': 'dns_admin',
82 'service_version': 'dns.admin',
83 'module_path': 'designate_tempest_plugin.services.dns.admin',
84 'client_names': ['QuotasClient']
85 }
86 v2_params = {
87 'name': 'dns_v2',
88 'service_version': 'dns.v2',
89 'module_path': 'designate_tempest_plugin.services.dns.v2',
90 'client_names': ['BlacklistsClient', 'PoolClient', 'QuotasClient',
91 'RecordsetClient', 'TldClient',
92 'TransferAcceptClient', 'TransferRequestClient',
93 'TsigkeyClient', 'ZoneExportsClient',
94 'ZoneImportsClient', 'ZonesClient']
95 }
96 admin_params.update(dns_config)
97 v2_params.update(dns_config)
98 return [admin_params, v2_params]