Jude Cross | 986e3f5 | 2017-07-24 14:57:20 -0700 | [diff] [blame] | 1 | # Copyright 2017 GoDaddy |
| 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 | |
| 16 | import os |
| 17 | |
| 18 | from tempest import config |
| 19 | from tempest.test_discover import plugins |
| 20 | |
| 21 | from octavia_tempest_plugin import config as project_config |
Michael Johnson | 29d8e61 | 2021-06-23 16:16:12 +0000 | [diff] [blame] | 22 | from octavia_tempest_plugin.services.load_balancer import v2 as lb_v2_services |
Jude Cross | 986e3f5 | 2017-07-24 14:57:20 -0700 | [diff] [blame] | 23 | |
| 24 | |
| 25 | class OctaviaTempestPlugin(plugins.TempestPlugin): |
| 26 | |
| 27 | def load_tests(self): |
| 28 | base_path = os.path.split(os.path.dirname( |
| 29 | os.path.abspath(__file__)))[0] |
| 30 | test_dir = "octavia_tempest_plugin/tests" |
| 31 | full_test_dir = os.path.join(base_path, test_dir) |
| 32 | return full_test_dir, base_path |
| 33 | |
| 34 | def register_opts(self, conf): |
| 35 | config.register_opt_group(conf, project_config.service_available_group, |
| 36 | project_config.ServiceAvailableGroup) |
| 37 | config.register_opt_group(conf, project_config.octavia_group, |
| 38 | project_config.OctaviaGroup) |
Reedip | f88cffc | 2018-09-03 13:20:08 +0000 | [diff] [blame] | 39 | config.register_opt_group(conf, |
| 40 | project_config.lb_feature_enabled_group, |
| 41 | project_config.LBFeatureEnabledGroup) |
Michael Johnson | 6006de7 | 2021-02-21 01:42:39 +0000 | [diff] [blame] | 42 | config.register_opt_group(conf, project_config.enforce_scope_group, |
| 43 | project_config.EnforceScopeGroup) |
Jude Cross | 986e3f5 | 2017-07-24 14:57:20 -0700 | [diff] [blame] | 44 | |
| 45 | def get_opt_lists(self): |
| 46 | return [ |
| 47 | (project_config.service_available_group.name, |
| 48 | project_config.ServiceAvailableGroup), |
| 49 | (project_config.octavia_group.name, |
| 50 | project_config.OctaviaGroup), |
Reedip | f88cffc | 2018-09-03 13:20:08 +0000 | [diff] [blame] | 51 | (project_config.lb_feature_enabled_group.name, |
| 52 | project_config.LBFeatureEnabledGroup) |
Jude Cross | 986e3f5 | 2017-07-24 14:57:20 -0700 | [diff] [blame] | 53 | ] |
| 54 | |
| 55 | def get_service_clients(self): |
| 56 | octavia_config = config.service_client_config( |
| 57 | project_config.octavia_group.name |
| 58 | ) |
| 59 | |
| 60 | params = { |
Michael Johnson | 29d8e61 | 2021-06-23 16:16:12 +0000 | [diff] [blame] | 61 | 'name': 'load_balancer_v2', |
Jude Cross | 986e3f5 | 2017-07-24 14:57:20 -0700 | [diff] [blame] | 62 | 'service_version': 'load-balancer.v2', |
| 63 | 'module_path': 'octavia_tempest_plugin.services.load_balancer.v2', |
Michael Johnson | 29d8e61 | 2021-06-23 16:16:12 +0000 | [diff] [blame] | 64 | 'client_names': lb_v2_services.__all__, |
Jude Cross | 986e3f5 | 2017-07-24 14:57:20 -0700 | [diff] [blame] | 65 | } |
| 66 | params.update(octavia_config) |
| 67 | |
| 68 | return [params] |