blob: 7e332617e62a744203ad12b36d071d90c0362e02 [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)
Kiall Mac Innes25fb29e2016-04-07 08:07:04 +010061
62 def get_opt_lists(self):
63 """
64 Get a list of options for sample config generation
65
66 Return option_list: A list of tuples with the group name
67 and options in that group.
68 Return type: list
69 """
Kiall Mac Innes8ae796c2016-04-21 13:47:25 +010070 return [
71 (project_config.service_available_group.name,
72 project_config.ServiceAvailableGroup),
73 (project_config.dns_group.name,
74 project_config.DnsGroup),
75 (project_config.dns_feature_group.name,
76 project_config.DnsFeatureGroup),
77 ]
Andrea Frittoli0eeb2902017-10-26 15:39:27 +020078
79 def get_service_clients(self):
80 dns_config = config.service_client_config('dns')
81 admin_params = {
82 'name': 'dns_admin',
83 'service_version': 'dns.admin',
84 'module_path': 'designate_tempest_plugin.services.dns.admin',
85 'client_names': ['QuotasClient']
86 }
87 v2_params = {
88 'name': 'dns_v2',
89 'service_version': 'dns.v2',
90 'module_path': 'designate_tempest_plugin.services.dns.v2',
Michael Johnsondf9fda12021-07-09 16:39:08 +000091 'client_names': dns_v2_services.__all__
Andrea Frittoli0eeb2902017-10-26 15:39:27 +020092 }
93 admin_params.update(dns_config)
94 v2_params.update(dns_config)
95 return [admin_params, v2_params]