Jude Cross | 638c4ef | 2017-07-24 14:57:20 -0700 | [diff] [blame] | 1 | # Copyright 2017 GoDaddy |
| 2 | # Copyright 2017 Catalyst IT Ltd |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 5 | # not use this file except in compliance with the License. You may obtain |
| 6 | # a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 13 | # License for the specific language governing permissions and limitations |
| 14 | # under the License. |
| 15 | # |
| 16 | |
| 17 | import os |
| 18 | |
| 19 | from tempest import config |
| 20 | from tempest.test_discover import plugins |
| 21 | |
| 22 | from octavia_tempest_plugin import config as project_config |
| 23 | |
| 24 | |
| 25 | class OctaviaTempestPlugin(plugins.TempestPlugin): |
| 26 | def load_tests(self): |
| 27 | base_path = os.path.split(os.path.dirname( |
| 28 | os.path.abspath(__file__)))[0] |
| 29 | test_dir = "octavia_tempest_plugin/tests" |
| 30 | full_test_dir = os.path.join(base_path, test_dir) |
| 31 | |
| 32 | return full_test_dir, base_path |
| 33 | |
| 34 | def register_opts(self, conf): |
| 35 | conf.register_opt( |
| 36 | project_config.service_option, group='service_available' |
| 37 | ) |
| 38 | conf.register_group(project_config.octavia_group) |
| 39 | conf.register_opts(project_config.OctaviaGroup, |
| 40 | group=project_config.octavia_group.name) |
| 41 | |
| 42 | def get_opt_lists(self): |
| 43 | return [ |
| 44 | ('service_available', [project_config.service_option]), |
| 45 | (project_config.octavia_group.name, project_config.OctaviaGroup) |
| 46 | ] |
| 47 | |
| 48 | def get_service_clients(self): |
| 49 | octavia_config = config.service_client_config( |
| 50 | project_config.octavia_group.name |
| 51 | ) |
| 52 | module_path = 'octavia_tempest_plugin.services.v2.loadbalancer_client' |
| 53 | |
| 54 | params = { |
| 55 | 'name': 'octavia_v2', |
| 56 | 'service_version': 'octavia.v2', |
| 57 | 'module_path': module_path, |
| 58 | 'client_names': ['LoadbalancerClient'], |
| 59 | } |
| 60 | params.update(octavia_config) |
| 61 | |
| 62 | return [params] |