blob: 15e7cc5f64e77a6fca8861d4e3cbbc758827db19 [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
Michael Johnsondf9fda12021-07-09 16:39:08 +000021from designate_tempest_plugin.services.dns import v2 as dns_v2_services
Kiall Mac Innes25fb29e2016-04-07 08:07:04 +010022
23
24class DesignateTempestPlugin(plugins.TempestPlugin):
25 """
26 A DesignateTempestPlugin class provides the basic hooks for an external
27 plugin to provide tempest the necessary information to run the plugin.
28 """
29 def load_tests(self):
30 """
31 Method to return the information necessary to load the tests in the
32 plugin.
33
34 :return: a tuple with the first value being the test_dir and the second
35 being the top_level
36 :return type: tuple
37 """
38 base_path = os.path.split(os.path.dirname(
39 os.path.abspath(__file__)))[0]
40 test_dir = "designate_tempest_plugin/tests"
41 full_test_dir = os.path.join(base_path, test_dir)
42 return full_test_dir, base_path
43
44 def register_opts(self, conf):
45 """
46 Add additional configuration options to tempest.
47
48 This method will be run for the plugin during the register_opts()
49 function in tempest.config
50
51 Parameters:
52 conf (ConfigOpts): The conf object that can be used to register
53 additional options on.
54 """
Kiall Mac Innes8ae796c2016-04-21 13:47:25 +010055 config.register_opt_group(conf, project_config.service_available_group,
56 project_config.ServiceAvailableGroup)
Kiall Mac Innes25fb29e2016-04-07 08:07:04 +010057 config.register_opt_group(conf, project_config.dns_group,
58 project_config.DnsGroup)
Kiall Mac Innes8ae796c2016-04-21 13:47:25 +010059 config.register_opt_group(conf, project_config.dns_feature_group,
60 project_config.DnsFeatureGroup)
Michael Johnsona3a23632021-07-21 21:55:32 +000061 config.register_opt_group(conf, project_config.enforce_scope_group,
62 project_config.EnforceScopeGroup)
Kiall Mac Innes25fb29e2016-04-07 08:07:04 +010063
64 def get_opt_lists(self):
65 """
66 Get a list of options for sample config generation
67
68 Return option_list: A list of tuples with the group name
69 and options in that group.
70 Return type: list
71 """
Kiall Mac Innes8ae796c2016-04-21 13:47:25 +010072 return [
73 (project_config.service_available_group.name,
74 project_config.ServiceAvailableGroup),
75 (project_config.dns_group.name,
76 project_config.DnsGroup),
77 (project_config.dns_feature_group.name,
78 project_config.DnsFeatureGroup),
79 ]
Andrea Frittoli0eeb2902017-10-26 15:39:27 +020080
81 def get_service_clients(self):
82 dns_config = config.service_client_config('dns')
83 admin_params = {
84 'name': 'dns_admin',
85 'service_version': 'dns.admin',
86 'module_path': 'designate_tempest_plugin.services.dns.admin',
87 'client_names': ['QuotasClient']
88 }
89 v2_params = {
90 'name': 'dns_v2',
91 'service_version': 'dns.v2',
92 'module_path': 'designate_tempest_plugin.services.dns.v2',
Michael Johnsondf9fda12021-07-09 16:39:08 +000093 'client_names': dns_v2_services.__all__
Andrea Frittoli0eeb2902017-10-26 15:39:27 +020094 }
95 admin_params.update(dns_config)
96 v2_params.update(dns_config)
97 return [admin_params, v2_params]