Steve Baker | 450aa7f | 2014-08-25 10:37:27 +1200 | [diff] [blame] | 1 | # Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 2 | # not use this file except in compliance with the License. You may obtain |
| 3 | # a copy of the License at |
| 4 | # |
| 5 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 6 | # |
| 7 | # Unless required by applicable law or agreed to in writing, software |
| 8 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 9 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 10 | # License for the specific language governing permissions and limitations |
| 11 | # under the License. |
| 12 | |
| 13 | import os |
Steve Baker | 450aa7f | 2014-08-25 10:37:27 +1200 | [diff] [blame] | 14 | |
Jens Rosenboom | 4f069fb | 2015-02-18 14:19:07 +0100 | [diff] [blame] | 15 | from oslo_config import cfg |
Steve Baker | 450aa7f | 2014-08-25 10:37:27 +1200 | [diff] [blame] | 16 | |
| 17 | import heat_integrationtests |
| 18 | |
Steve Baker | 21904b5 | 2016-08-01 00:36:02 +0000 | [diff] [blame^] | 19 | _CONF = None |
| 20 | |
Steve Baker | 39ed19e | 2016-08-01 00:55:34 +0000 | [diff] [blame] | 21 | service_available_group = cfg.OptGroup(name="service_available", |
| 22 | title="Available OpenStack Services") |
| 23 | |
| 24 | ServiceAvailableGroup = [ |
| 25 | cfg.BoolOpt("heat_plugin", |
| 26 | default=True, |
| 27 | help="Whether or not heat is expected to be available"), |
| 28 | ] |
Steve Baker | 450aa7f | 2014-08-25 10:37:27 +1200 | [diff] [blame] | 29 | |
Steve Baker | dc769c3 | 2016-07-27 23:31:50 +0000 | [diff] [blame] | 30 | heat_group = cfg.OptGroup(name="heat_plugin", |
| 31 | title="Heat Service Options") |
Steve Baker | 450aa7f | 2014-08-25 10:37:27 +1200 | [diff] [blame] | 32 | |
Steve Baker | dc769c3 | 2016-07-27 23:31:50 +0000 | [diff] [blame] | 33 | HeatGroup = [ |
| 34 | cfg.StrOpt("catalog_type", |
| 35 | default="orchestration", |
| 36 | help="Catalog type of the orchestration service."), |
Steve Baker | 450aa7f | 2014-08-25 10:37:27 +1200 | [diff] [blame] | 37 | cfg.StrOpt('username', |
| 38 | default=os.environ.get('OS_USERNAME'), |
Rakesh H S | a286a13 | 2016-02-18 18:54:00 +0530 | [diff] [blame] | 39 | help="Username to use for non admin API requests."), |
Steve Baker | 450aa7f | 2014-08-25 10:37:27 +1200 | [diff] [blame] | 40 | cfg.StrOpt('password', |
| 41 | default=os.environ.get('OS_PASSWORD'), |
Rakesh H S | a286a13 | 2016-02-18 18:54:00 +0530 | [diff] [blame] | 42 | help="Non admin API key to use when authenticating.", |
| 43 | secret=True), |
| 44 | cfg.StrOpt('admin_username', |
| 45 | help="Username to use for admin API requests."), |
| 46 | cfg.StrOpt('admin_password', |
| 47 | help="Admin API key to use when authentication.", |
Steve Baker | 450aa7f | 2014-08-25 10:37:27 +1200 | [diff] [blame] | 48 | secret=True), |
| 49 | cfg.StrOpt('tenant_name', |
Steve Baker | 7c9115d | 2015-08-03 11:12:46 +1200 | [diff] [blame] | 50 | default=(os.environ.get('OS_PROJECT_NAME') or |
| 51 | os.environ.get('OS_TENANT_NAME')), |
Steve Baker | 450aa7f | 2014-08-25 10:37:27 +1200 | [diff] [blame] | 52 | help="Tenant name to use for API requests."), |
rabi | fd98a47 | 2016-05-24 10:18:33 +0530 | [diff] [blame] | 53 | cfg.StrOpt('admin_tenant_name', |
| 54 | default='admin', |
| 55 | help="Admin tenant name to use for admin API requests."), |
Steve Baker | 450aa7f | 2014-08-25 10:37:27 +1200 | [diff] [blame] | 56 | cfg.StrOpt('auth_url', |
| 57 | default=os.environ.get('OS_AUTH_URL'), |
Rabi Mishra | 65493fb | 2016-01-29 22:23:21 +0530 | [diff] [blame] | 58 | help="Full URI of the OpenStack Identity API (Keystone)"), |
Rabi Mishra | 1d53874 | 2016-03-21 21:09:20 +0530 | [diff] [blame] | 59 | cfg.StrOpt('user_domain_name', |
| 60 | default=os.environ.get('OS_USER_DOMAIN_NAME'), |
| 61 | help="User domain name, if keystone v3 auth_url" |
| 62 | "is used"), |
| 63 | cfg.StrOpt('project_domain_name', |
| 64 | default=os.environ.get('OS_PROJECT_DOMAIN_NAME'), |
| 65 | help="Project domain name, if keystone v3 auth_url" |
Rabi Mishra | 65493fb | 2016-01-29 22:23:21 +0530 | [diff] [blame] | 66 | "is used"), |
Steve Baker | 450aa7f | 2014-08-25 10:37:27 +1200 | [diff] [blame] | 67 | cfg.StrOpt('region', |
| 68 | default=os.environ.get('OS_REGION_NAME'), |
Rabi Mishra | 65493fb | 2016-01-29 22:23:21 +0530 | [diff] [blame] | 69 | help="The region name to use"), |
Steve Baker | 450aa7f | 2014-08-25 10:37:27 +1200 | [diff] [blame] | 70 | cfg.StrOpt('instance_type', |
Steve Baker | 450aa7f | 2014-08-25 10:37:27 +1200 | [diff] [blame] | 71 | help="Instance type for tests. Needs to be big enough for a " |
| 72 | "full OS plus the test workload"), |
Pavlo Shchelokovskyy | 46e5cb2 | 2015-03-23 12:01:25 +0000 | [diff] [blame] | 73 | cfg.StrOpt('minimal_instance_type', |
| 74 | help="Instance type enough for simplest cases."), |
Steve Baker | 450aa7f | 2014-08-25 10:37:27 +1200 | [diff] [blame] | 75 | cfg.StrOpt('image_ref', |
Steve Baker | 450aa7f | 2014-08-25 10:37:27 +1200 | [diff] [blame] | 76 | help="Name of image to use for tests which boot servers."), |
| 77 | cfg.StrOpt('keypair_name', |
Steve Baker | 450aa7f | 2014-08-25 10:37:27 +1200 | [diff] [blame] | 78 | help="Name of existing keypair to launch servers with."), |
| 79 | cfg.StrOpt('minimal_image_ref', |
Steve Baker | 450aa7f | 2014-08-25 10:37:27 +1200 | [diff] [blame] | 80 | help="Name of minimal (e.g cirros) image to use when " |
| 81 | "launching test instances."), |
Steve Baker | 450aa7f | 2014-08-25 10:37:27 +1200 | [diff] [blame] | 82 | cfg.BoolOpt('disable_ssl_certificate_validation', |
| 83 | default=False, |
| 84 | help="Set to True if using self-signed SSL certificates."), |
tyagi | 39aa11a | 2016-03-07 04:47:00 -0800 | [diff] [blame] | 85 | cfg.StrOpt('ca_file', |
tyagi | 39aa11a | 2016-03-07 04:47:00 -0800 | [diff] [blame] | 86 | help="CA certificate to pass for servers that have " |
| 87 | "https endpoint."), |
Steve Baker | 450aa7f | 2014-08-25 10:37:27 +1200 | [diff] [blame] | 88 | cfg.IntOpt('build_interval', |
| 89 | default=4, |
| 90 | help="Time in seconds between build status checks."), |
| 91 | cfg.IntOpt('build_timeout', |
| 92 | default=1200, |
| 93 | help="Timeout in seconds to wait for a stack to build."), |
| 94 | cfg.StrOpt('network_for_ssh', |
Rabi Mishra | ec4b03b | 2015-05-23 02:20:47 +0530 | [diff] [blame] | 95 | default='heat-net', |
Steve Baker | 450aa7f | 2014-08-25 10:37:27 +1200 | [diff] [blame] | 96 | help="Network used for SSH connections."), |
| 97 | cfg.StrOpt('fixed_network_name', |
Rabi Mishra | ec4b03b | 2015-05-23 02:20:47 +0530 | [diff] [blame] | 98 | default='heat-net', |
Steve Baker | 450aa7f | 2014-08-25 10:37:27 +1200 | [diff] [blame] | 99 | help="Visible fixed network name "), |
Pavlo Shchelokovskyy | 6fa2380 | 2015-03-23 11:22:35 +0000 | [diff] [blame] | 100 | cfg.StrOpt('floating_network_name', |
| 101 | default='public', |
| 102 | help="Visible floating network name "), |
Steve Baker | 0b679bb | 2015-03-11 13:46:42 +1300 | [diff] [blame] | 103 | cfg.StrOpt('boot_config_env', |
Steve Baker | 803f150 | 2015-03-11 13:47:08 +1300 | [diff] [blame] | 104 | default=('heat_integrationtests/scenario/templates' |
| 105 | '/boot_config_none_env.yaml'), |
Steve Baker | 0b679bb | 2015-03-11 13:46:42 +1300 | [diff] [blame] | 106 | help="Path to environment file which defines the " |
| 107 | "resource type Heat::InstallConfigAgent. Needs to " |
| 108 | "be appropriate for the image_ref."), |
kairat_kushaev | 0ab3d7c | 2015-01-27 21:48:46 +0300 | [diff] [blame] | 109 | cfg.StrOpt('fixed_subnet_name', |
Rabi Mishra | ec4b03b | 2015-05-23 02:20:47 +0530 | [diff] [blame] | 110 | default='heat-subnet', |
kairat_kushaev | 0ab3d7c | 2015-01-27 21:48:46 +0300 | [diff] [blame] | 111 | help="Visible fixed sub-network name "), |
Steve Baker | 450aa7f | 2014-08-25 10:37:27 +1200 | [diff] [blame] | 112 | cfg.IntOpt('ssh_timeout', |
| 113 | default=300, |
| 114 | help="Timeout in seconds to wait for authentication to " |
| 115 | "succeed."), |
| 116 | cfg.IntOpt('ip_version_for_ssh', |
| 117 | default=4, |
| 118 | help="IP version used for SSH connections."), |
| 119 | cfg.IntOpt('ssh_channel_timeout', |
| 120 | default=60, |
| 121 | help="Timeout in seconds to wait for output from ssh " |
| 122 | "channel."), |
| 123 | cfg.IntOpt('tenant_network_mask_bits', |
| 124 | default=28, |
| 125 | help="The mask bits for tenant ipv4 subnets"), |
Rabi Mishra | 477efc9 | 2015-07-31 13:01:45 +0530 | [diff] [blame] | 126 | cfg.BoolOpt('skip_scenario_tests', |
| 127 | default=False, |
| 128 | help="Skip all scenario tests"), |
| 129 | cfg.BoolOpt('skip_functional_tests', |
| 130 | default=False, |
| 131 | help="Skip all functional tests"), |
| 132 | cfg.ListOpt('skip_functional_test_list', |
Rabi Mishra | 94c4372 | 2015-08-12 18:39:38 +0530 | [diff] [blame] | 133 | help="List of functional test class or class.method " |
| 134 | "names to skip ex. AutoscalingGroupTest," |
| 135 | "InstanceGroupBasicTest.test_size_updates_work"), |
Rabi Mishra | 477efc9 | 2015-07-31 13:01:45 +0530 | [diff] [blame] | 136 | cfg.ListOpt('skip_scenario_test_list', |
Rabi Mishra | 94c4372 | 2015-08-12 18:39:38 +0530 | [diff] [blame] | 137 | help="List of scenario test class or class.method " |
| 138 | "names to skip ex. NeutronLoadBalancerTest, " |
huangtianhua | 422c1ba | 2016-06-08 15:50:39 +0800 | [diff] [blame] | 139 | "AodhAlarmTest.test_alarm"), |
Rabi Mishra | 477efc9 | 2015-07-31 13:01:45 +0530 | [diff] [blame] | 140 | cfg.ListOpt('skip_test_stack_action_list', |
| 141 | help="List of stack actions in tests to skip " |
| 142 | "ex. ABANDON, ADOPT, SUSPEND, RESUME"), |
Steve Baker | 450aa7f | 2014-08-25 10:37:27 +1200 | [diff] [blame] | 143 | cfg.IntOpt('volume_size', |
| 144 | default=1, |
| 145 | help='Default size in GB for volumes created by volumes tests'), |
Anastasia Kuznetsova | 3e0ab4d | 2015-03-06 18:10:13 +0400 | [diff] [blame] | 146 | cfg.IntOpt('connectivity_timeout', |
| 147 | default=120, |
| 148 | help="Timeout in seconds to wait for connectivity to " |
| 149 | "server."), |
Oleksii Chuprykov | 4be023a | 2015-07-08 07:17:08 -0400 | [diff] [blame] | 150 | cfg.IntOpt('sighup_timeout', |
rabi | cfffc83 | 2016-07-28 12:15:32 +0530 | [diff] [blame] | 151 | default=120, |
Oleksii Chuprykov | 4be023a | 2015-07-08 07:17:08 -0400 | [diff] [blame] | 152 | help="Timeout in seconds to wait for adding or removing child" |
Thomas Herve | 2ce4bda | 2016-01-22 17:55:55 +0100 | [diff] [blame] | 153 | "process after receiving of sighup signal"), |
Peter Razumovsky | 483e64b | 2016-03-04 17:04:28 +0300 | [diff] [blame] | 154 | cfg.IntOpt('sighup_config_edit_retries', |
| 155 | default=10, |
| 156 | help='Count of retries to edit config file during sighup. If ' |
| 157 | 'another worker already edit config file, file can be ' |
| 158 | 'busy, so need to wait and try edit file again.'), |
Thomas Herve | 2ce4bda | 2016-01-22 17:55:55 +0100 | [diff] [blame] | 159 | cfg.StrOpt('heat-config-notify-script', |
| 160 | default=('heat-config-notify'), |
| 161 | help="Path to the script heat-config-notify"), |
Rabi Mishra | 65493fb | 2016-01-29 22:23:21 +0530 | [diff] [blame] | 162 | |
Steve Baker | 450aa7f | 2014-08-25 10:37:27 +1200 | [diff] [blame] | 163 | ] |
| 164 | |
| 165 | |
| 166 | def init_conf(read_conf=True): |
Steve Baker | 21904b5 | 2016-08-01 00:36:02 +0000 | [diff] [blame^] | 167 | global _CONF |
| 168 | if _CONF: |
| 169 | return _CONF |
Steve Baker | 450aa7f | 2014-08-25 10:37:27 +1200 | [diff] [blame] | 170 | |
| 171 | default_config_files = None |
| 172 | if read_conf: |
| 173 | confpath = os.path.join( |
| 174 | os.path.dirname(os.path.realpath(heat_integrationtests.__file__)), |
| 175 | 'heat_integrationtests.conf') |
| 176 | if os.path.isfile(confpath): |
| 177 | default_config_files = [confpath] |
| 178 | |
Steve Baker | 21904b5 | 2016-08-01 00:36:02 +0000 | [diff] [blame^] | 179 | _CONF = cfg.ConfigOpts() |
| 180 | _CONF(args=[], project='heat_integrationtests', |
| 181 | default_config_files=default_config_files) |
Steve Baker | 450aa7f | 2014-08-25 10:37:27 +1200 | [diff] [blame] | 182 | |
Steve Baker | dc769c3 | 2016-07-27 23:31:50 +0000 | [diff] [blame] | 183 | for group, opts in list_opts(): |
Steve Baker | 21904b5 | 2016-08-01 00:36:02 +0000 | [diff] [blame^] | 184 | _CONF.register_opts(opts, group=group) |
| 185 | return _CONF |
Steve Baker | 450aa7f | 2014-08-25 10:37:27 +1200 | [diff] [blame] | 186 | |
| 187 | |
Thomas Herve | cd3622e | 2014-12-17 10:36:51 +0100 | [diff] [blame] | 188 | def list_opts(): |
Steve Baker | dc769c3 | 2016-07-27 23:31:50 +0000 | [diff] [blame] | 189 | yield heat_group.name, HeatGroup |
Steve Baker | 39ed19e | 2016-08-01 00:55:34 +0000 | [diff] [blame] | 190 | yield service_available_group.name, ServiceAvailableGroup |