Jude Cross | 986e3f5 | 2017-07-24 14:57:20 -0700 | [diff] [blame] | 1 | # Copyright 2016 Rackspace Inc. |
| 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 | from oslo_config import cfg |
Michael Johnson | 0a0f9b3 | 2019-01-02 16:58:21 -0800 | [diff] [blame] | 17 | from oslo_log import log as logging |
Ilya Bumarskov | eded9c7 | 2023-03-16 14:12:09 +0400 | [diff] [blame] | 18 | from tempest import config |
Jude Cross | 986e3f5 | 2017-07-24 14:57:20 -0700 | [diff] [blame] | 19 | |
| 20 | from octavia_tempest_plugin.common import constants as const |
| 21 | |
Michael Johnson | 0a0f9b3 | 2019-01-02 16:58:21 -0800 | [diff] [blame] | 22 | |
| 23 | LOG = logging.getLogger(__name__) |
| 24 | |
Jude Cross | 986e3f5 | 2017-07-24 14:57:20 -0700 | [diff] [blame] | 25 | service_available_group = cfg.OptGroup(name='service_available', |
| 26 | title='Available OpenStack Services') |
| 27 | |
| 28 | ServiceAvailableGroup = [ |
| 29 | cfg.BoolOpt('load_balancer', |
| 30 | default=True, |
| 31 | help="Whether or not the load-balancer service is expected " |
| 32 | "to be available."), |
| 33 | ] |
| 34 | |
| 35 | octavia_group = cfg.OptGroup(name='load_balancer', |
| 36 | title='load-balancer service options') |
| 37 | |
| 38 | OctaviaGroup = [ |
| 39 | # Tempest plugin common options |
| 40 | cfg.StrOpt("region", |
| 41 | default="", |
| 42 | help="The region name to use. If empty, the value " |
| 43 | "of identity.region is used instead. If no such region " |
| 44 | "is found in the service catalog, the first found one is " |
| 45 | "used."), |
| 46 | cfg.StrOpt('catalog_type', |
| 47 | default='load-balancer', |
| 48 | help='Catalog type of the Octavia service.'), |
| 49 | cfg.StrOpt('endpoint_type', |
| 50 | default='publicURL', |
| 51 | choices=['public', 'admin', 'internal', |
| 52 | 'publicURL', 'adminURL', 'internalURL'], |
| 53 | help="The endpoint type to use for the load-balancer service"), |
Michael Johnson | 6a9236a | 2020-08-04 23:54:54 +0000 | [diff] [blame] | 54 | cfg.FloatOpt('build_interval', |
| 55 | default=5, |
| 56 | help='Time in seconds between build status checks for ' |
| 57 | 'non-load-balancer resources to build'), |
Jude Cross | 986e3f5 | 2017-07-24 14:57:20 -0700 | [diff] [blame] | 58 | cfg.IntOpt('build_timeout', |
Jacky Hu | 2b95f2f | 2018-09-30 09:12:25 +0800 | [diff] [blame] | 59 | default=300, |
Jude Cross | 986e3f5 | 2017-07-24 14:57:20 -0700 | [diff] [blame] | 60 | help='Timeout in seconds to wait for non-load-balancer ' |
| 61 | 'resources to build'), |
Michael Johnson | 0a0f9b3 | 2019-01-02 16:58:21 -0800 | [diff] [blame] | 62 | cfg.StrOpt('octavia_svc_username', default='admin', |
| 63 | help='The service_auth username the Octavia services are using' |
| 64 | 'to access other OpenStack services.'), |
Jude Cross | 986e3f5 | 2017-07-24 14:57:20 -0700 | [diff] [blame] | 65 | # load-balancer specific options |
Michael Johnson | 6a9236a | 2020-08-04 23:54:54 +0000 | [diff] [blame] | 66 | cfg.FloatOpt('check_interval', |
| 67 | default=5, |
| 68 | help='Interval to check for status changes.'), |
Jude Cross | 986e3f5 | 2017-07-24 14:57:20 -0700 | [diff] [blame] | 69 | cfg.IntOpt('check_timeout', |
Michael Johnson | 6d99fc6 | 2018-07-22 16:04:48 -0700 | [diff] [blame] | 70 | default=120, |
Jude Cross | 986e3f5 | 2017-07-24 14:57:20 -0700 | [diff] [blame] | 71 | help='Timeout, in seconds, to wait for a status change.'), |
| 72 | cfg.BoolOpt('test_with_noop', |
| 73 | default=False, |
| 74 | help='Runs the tests assuming no-op drivers are being used. ' |
| 75 | 'Tests will assume no actual amphora are created.'), |
Michael Johnson | 6a9236a | 2020-08-04 23:54:54 +0000 | [diff] [blame] | 76 | cfg.FloatOpt('lb_build_interval', |
| 77 | default=10, |
| 78 | help='Time in seconds between build status checks for a ' |
| 79 | 'load balancer.'), |
Jude Cross | 986e3f5 | 2017-07-24 14:57:20 -0700 | [diff] [blame] | 80 | cfg.IntOpt('lb_build_timeout', |
| 81 | default=900, |
| 82 | help='Timeout in seconds to wait for a ' |
| 83 | 'load balancer to build.'), |
| 84 | cfg.StrOpt('member_role', |
| 85 | default='load-balancer_member', |
| 86 | help='The load balancing member RBAC role.'), |
| 87 | cfg.StrOpt('admin_role', |
| 88 | default='load-balancer_admin', |
| 89 | help='The load balancing admin RBAC role.'), |
Michael Johnson | 6006de7 | 2021-02-21 01:42:39 +0000 | [diff] [blame] | 90 | cfg.StrOpt('observer_role', |
| 91 | default='load-balancer_observer', |
| 92 | help='The load balancing observer RBAC role.'), |
| 93 | cfg.StrOpt('global_observer_role', |
| 94 | default='load-balancer_global_observer', |
| 95 | help='The load balancing global observer RBAC role.'), |
Jude Cross | 986e3f5 | 2017-07-24 14:57:20 -0700 | [diff] [blame] | 96 | cfg.IntOpt('scp_connection_timeout', |
| 97 | default=5, |
| 98 | help='Timeout in seconds to wait for a ' |
| 99 | 'scp connection to complete.'), |
| 100 | cfg.IntOpt('scp_connection_attempts', |
| 101 | default=20, |
| 102 | help='Retries for scp to attempt to connect.'), |
| 103 | cfg.StrOpt('provider', |
| 104 | default='octavia', |
| 105 | help='The provider driver to use for the tests.'), |
| 106 | cfg.StrOpt('RBAC_test_type', default=const.ADVANCED, |
Michael Johnson | 6006de7 | 2021-02-21 01:42:39 +0000 | [diff] [blame] | 107 | choices=[const.ADVANCED, const.KEYSTONE_DEFAULT_ROLES, |
| 108 | const.OWNERADMIN, const.NONE], |
Jude Cross | 986e3f5 | 2017-07-24 14:57:20 -0700 | [diff] [blame] | 109 | help='Type of RBAC tests to run. "advanced" runs the octavia ' |
| 110 | 'default RBAC tests. "owner_or_admin" runs the legacy ' |
Michael Johnson | 6006de7 | 2021-02-21 01:42:39 +0000 | [diff] [blame] | 111 | 'owner or admin tests. "keystone_default_roles" runs the ' |
| 112 | 'tests using only the keystone default roles. "none" ' |
| 113 | 'disables the RBAC tests.'), |
Michael Johnson | fc223fe | 2019-01-15 16:40:05 -0800 | [diff] [blame] | 114 | cfg.DictOpt('enabled_provider_drivers', |
Carlos Goncalves | decfc35 | 2019-07-25 19:31:52 +0200 | [diff] [blame] | 115 | help=('A comma separated list of dictionaries of the ' |
| 116 | 'enabled provider driver names and descriptions. ' |
| 117 | 'Must match the driver name in the ' |
Michael Johnson | fc223fe | 2019-01-15 16:40:05 -0800 | [diff] [blame] | 118 | 'octavia.api.drivers entrypoint. Example: ' |
Carlos Goncalves | decfc35 | 2019-07-25 19:31:52 +0200 | [diff] [blame] | 119 | 'amphora:The Octavia Amphora driver.,' |
| 120 | 'octavia:Deprecated alias of the Octavia ' |
Ann Taraday | 7d0b582 | 2019-10-17 15:28:30 +0400 | [diff] [blame] | 121 | 'Amphora driver.,' |
| 122 | 'amphorav2:The Octavia Amphora driver that uses ' |
| 123 | 'taskflow jobboard persistence.'), |
Michael Johnson | fc223fe | 2019-01-15 16:40:05 -0800 | [diff] [blame] | 124 | default={'amphora': 'The Octavia Amphora driver.', |
Ann Taraday | 7d0b582 | 2019-10-17 15:28:30 +0400 | [diff] [blame] | 125 | 'amphorav2': 'The Octavia Amphora driver that uses ' |
| 126 | 'taskflow jobboard persistence.', |
Michael Johnson | fc223fe | 2019-01-15 16:40:05 -0800 | [diff] [blame] | 127 | 'octavia': 'Deprecated alias of the Octavia Amphora ' |
| 128 | 'driver.'}), |
Carlos Goncalves | ee09a1b | 2019-07-22 11:45:04 +0200 | [diff] [blame] | 129 | cfg.StrOpt('loadbalancer_topology', |
| 130 | default=const.SINGLE, |
| 131 | choices=const.SUPPORTED_LB_TOPOLOGIES, |
| 132 | help='Load balancer topology configuration.'), |
Michael Johnson | 77df032 | 2019-01-15 18:27:58 -0800 | [diff] [blame] | 133 | cfg.DictOpt('expected_flavor_capability', |
| 134 | help=('Defines a provider flavor capability that is expected ' |
| 135 | 'to be present in the selected provider under test. ' |
| 136 | 'It is specified in a "name": "description" dict. ' |
| 137 | 'Example: {"loadbalancer_topology": "The load balancer ' |
| 138 | 'topology. One of: SINGLE - One amphora per load ' |
| 139 | 'balancer. ACTIVE_STANDBY - Two amphora per load ' |
| 140 | 'balancer."}'), |
| 141 | default={'loadbalancer_topology': 'The load balancer ' |
| 142 | 'topology. One of: SINGLE - One amphora per load ' |
| 143 | 'balancer. ACTIVE_STANDBY - Two amphora per load ' |
| 144 | 'balancer.'}), |
Adam Harwell | c2aa20c | 2019-11-20 11:15:07 -0800 | [diff] [blame] | 145 | cfg.DictOpt('expected_availability_zone_capability', |
| 146 | help=('Defines a provider availability zone capability that ' |
| 147 | 'is expected to be present in the selected provider ' |
| 148 | 'under test. It is specified in a "name": "description" ' |
| 149 | 'dict. Example: {"compute_zone": "The compute ' |
| 150 | 'availability zone."}'), |
| 151 | default={'compute_zone': 'The compute availability zone.'}), |
Oleh Hryhorov | fc72032 | 2022-01-11 21:24:19 +0200 | [diff] [blame] | 152 | cfg.IntOpt('listener_conn_limit', |
| 153 | default=200, |
| 154 | help='Defines listener connection limit.'), |
Jude Cross | 986e3f5 | 2017-07-24 14:57:20 -0700 | [diff] [blame] | 155 | # Networking |
| 156 | cfg.BoolOpt('test_with_ipv6', |
| 157 | default=True, |
| 158 | help='When true the IPv6 tests will be run.'), |
| 159 | cfg.BoolOpt('disable_boot_network', default=False, |
| 160 | help='True if your cloud does not allow creating networks or ' |
| 161 | 'specifying the boot network for instances.'), |
| 162 | cfg.BoolOpt('enable_security_groups', default=False, |
| 163 | help='When true, security groups will be created for the test ' |
| 164 | 'servers. When false, port security will be disabled on ' |
| 165 | 'the created networks.'), |
| 166 | cfg.StrOpt('test_network_override', |
| 167 | help='Overrides network creation and uses this network ID for ' |
| 168 | 'all tests (VIP, members, etc.). Required if ' |
| 169 | 'test_subnet_override is set.'), |
| 170 | cfg.StrOpt('test_subnet_override', |
| 171 | help='Overrides subnet creation and uses this subnet ID for ' |
| 172 | 'all IPv4 tests (VIP, members, etc.). Optional'), |
| 173 | cfg.StrOpt('test_ipv6_subnet_override', |
| 174 | help='Overrides subnet creation and uses this subnet ID for ' |
| 175 | 'all IPv6 tests (VIP, members, etc.). Optional and only ' |
| 176 | 'valid if test_network_override is set.'), |
| 177 | cfg.StrOpt('vip_subnet_cidr', |
| 178 | default='10.1.1.0/24', |
| 179 | help='CIDR format subnet to use for the vip subnet.'), |
| 180 | cfg.StrOpt('vip_ipv6_subnet_cidr', |
| 181 | default='fdde:1a92:7523:70a0::/64', |
| 182 | help='CIDR format subnet to use for the IPv6 vip subnet.'), |
| 183 | cfg.StrOpt('member_1_ipv4_subnet_cidr', |
| 184 | default='10.2.1.0/24', |
| 185 | help='CIDR format subnet to use for the member 1 subnet.'), |
| 186 | cfg.StrOpt('member_1_ipv6_subnet_cidr', |
| 187 | default='fd7b:f9f7:0fff:4eca::/64', |
| 188 | help='CIDR format subnet to use for the member 1 ipv6 subnet.'), |
| 189 | cfg.StrOpt('member_2_ipv4_subnet_cidr', |
| 190 | default='10.2.2.0/24', |
| 191 | help='CIDR format subnet to use for the member 2 subnet.'), |
| 192 | cfg.StrOpt('member_2_ipv6_subnet_cidr', |
| 193 | default='fd77:1457:4cf0:26a8::/64', |
| 194 | help='CIDR format subnet to use for the member 1 ipv6 subnet.'), |
Gregory Thiemonge | 54225ad | 2021-02-04 15:25:17 +0100 | [diff] [blame] | 195 | cfg.StrOpt('default_router', |
| 196 | default='router1', |
| 197 | help='The default router connected to the public network.'), |
| 198 | cfg.StrOpt('default_ipv6_subnetpool', |
| 199 | default='shared-default-subnetpool-v6', |
| 200 | help='The default IPv6 subnetpool to use when creating the ' |
| 201 | 'IPv6 VIP subnet.'), |
Carlos Goncalves | c2e1216 | 2019-02-14 23:57:44 +0100 | [diff] [blame] | 202 | # Amphora specific options |
| 203 | cfg.StrOpt('amphora_ssh_user', |
| 204 | default='ubuntu', |
| 205 | help='The amphora SSH user.'), |
| 206 | cfg.StrOpt('amphora_ssh_key', |
Carlos Goncalves | 9891de0 | 2019-07-28 13:37:33 +0200 | [diff] [blame] | 207 | default='/etc/octavia/.ssh/octavia_ssh_key', |
Carlos Goncalves | c2e1216 | 2019-02-14 23:57:44 +0100 | [diff] [blame] | 208 | help='The amphora SSH key file.'), |
Jude Cross | 986e3f5 | 2017-07-24 14:57:20 -0700 | [diff] [blame] | 209 | # Environment specific options |
Carlos Goncalves | c2e1216 | 2019-02-14 23:57:44 +0100 | [diff] [blame] | 210 | # These are used to accomodate clouds with specific limitations |
Jude Cross | 986e3f5 | 2017-07-24 14:57:20 -0700 | [diff] [blame] | 211 | cfg.IntOpt('random_server_name_length', |
| 212 | default=0, |
| 213 | help='If non-zero, generate a random name of the length ' |
| 214 | 'provided for each server, in the format "m[A-Z0-9]*". '), |
| 215 | cfg.StrOpt('availability_zone', |
| 216 | default=None, |
| 217 | help='Availability zone to use for creating servers.'), |
Michael Johnson | a1862ff | 2020-06-21 12:15:27 -0700 | [diff] [blame] | 218 | cfg.StrOpt('availability_zone2', |
| 219 | default=None, |
| 220 | help='A second availability zone to use for creating servers.'), |
| 221 | cfg.StrOpt('availability_zone3', |
| 222 | default=None, |
| 223 | help='A third availability zone to use for creating servers.'), |
Maciej Józefczyk | 6a508ce | 2019-07-26 13:10:50 +0000 | [diff] [blame] | 224 | cfg.BoolOpt('test_reuse_connection', default=True, |
| 225 | help='Reuse TCP connections while testing LB with ' |
| 226 | 'HTTP members (keep-alive).'), |
Michael Johnson | b1ba3b3 | 2019-07-30 20:23:51 -0700 | [diff] [blame] | 227 | # Log offloading specific options |
| 228 | cfg.StrOpt('tenant_flow_log_file', |
| 229 | default='/var/log/octavia-tenant-traffic.log', |
| 230 | help='File path, on the tempest system, to the tenant flow ' |
| 231 | 'log file.'), |
Michael Johnson | 7bd2f97 | 2019-07-30 21:32:04 -0700 | [diff] [blame] | 232 | cfg.StrOpt('amphora_admin_log_file', |
| 233 | default='/var/log/octavia-amphora.log', |
| 234 | help='File path, on the tempest system, to the amphora admin ' |
| 235 | 'log file.'), |
Michael Johnson | 2735735 | 2020-11-13 13:55:09 -0800 | [diff] [blame] | 236 | cfg.StrOpt('test_server_path', |
| 237 | default='/opt/octavia-tempest-plugin/test_server.bin', |
| 238 | help='Filesystem path to the test web server that will be ' |
| 239 | 'installed in the web server VMs.'), |
Michael Johnson | 6006de7 | 2021-02-21 01:42:39 +0000 | [diff] [blame] | 240 | # RBAC related options |
| 241 | # Note: Also see the enforce_scope section (from tempest) for Octavia API |
| 242 | # scope checking setting. |
| 243 | cfg.BoolOpt('enforce_new_defaults', |
| 244 | default=False, |
| 245 | help='Does the load-balancer service API policies enforce ' |
| 246 | 'the new keystone default roles? This configuration ' |
| 247 | 'value should be same as octavia.conf: ' |
| 248 | '[oslo_policy].enforce_new_defaults option.'), |
Jude Cross | 986e3f5 | 2017-07-24 14:57:20 -0700 | [diff] [blame] | 249 | ] |
Reedip | f88cffc | 2018-09-03 13:20:08 +0000 | [diff] [blame] | 250 | |
| 251 | lb_feature_enabled_group = cfg.OptGroup(name='loadbalancer-feature-enabled', |
| 252 | title='Enabled/Disabled LB features') |
| 253 | LBFeatureEnabledGroup = [ |
Michael Johnson | 6fbfed0 | 2020-03-19 15:37:31 -0700 | [diff] [blame] | 254 | cfg.BoolOpt('not_implemented_is_error', |
| 255 | default=True, |
| 256 | help="When True, not-implemented responses from the API are " |
| 257 | "considered an error and test failure. This should be " |
| 258 | "used when a driver should support all of the Octavia " |
| 259 | "API features, such as the reference driver."), |
Reedip | f88cffc | 2018-09-03 13:20:08 +0000 | [diff] [blame] | 260 | cfg.BoolOpt('health_monitor_enabled', |
| 261 | default=True, |
Carlos Goncalves | cc7dbcd | 2019-03-14 18:48:12 +0100 | [diff] [blame] | 262 | help="Whether Health Monitor is available with provider " |
| 263 | "driver or not."), |
Michael Johnson | 0a0f9b3 | 2019-01-02 16:58:21 -0800 | [diff] [blame] | 264 | cfg.BoolOpt('terminated_tls_enabled', |
| 265 | default=True, |
| 266 | help="Whether TLS termination is available with provider " |
| 267 | "driver or not."), |
Reedip | 6626f25 | 2018-12-03 07:31:34 +0000 | [diff] [blame] | 268 | cfg.BoolOpt('l7_protocol_enabled', |
| 269 | default=True, |
Carlos Goncalves | cc7dbcd | 2019-03-14 18:48:12 +0100 | [diff] [blame] | 270 | help="Whether L7 Protocols are available with the provider " |
| 271 | "driver or not."), |
| 272 | cfg.BoolOpt('pool_algorithms_enabled', |
| 273 | default=True, |
| 274 | help="Whether pool algorithms are available with provider" |
| 275 | "driver or not."), |
Reedip | 6626f25 | 2018-12-03 07:31:34 +0000 | [diff] [blame] | 276 | cfg.StrOpt('l4_protocol', |
| 277 | default="TCP", |
Carlos Goncalves | cc7dbcd | 2019-03-14 18:48:12 +0100 | [diff] [blame] | 278 | help="The type of L4 Protocol which is supported with the " |
| 279 | "provider driver."), |
Gregory Thiemonge | e037eb8 | 2019-09-19 16:22:19 +0200 | [diff] [blame] | 280 | cfg.BoolOpt('spare_pool_enabled', |
| 281 | default=False, |
| 282 | help="Wether spare pool is available with amphora provider " |
| 283 | "driver or not."), |
Reedip Banerjee | 2bb585d | 2019-03-22 08:06:12 +0000 | [diff] [blame] | 284 | cfg.BoolOpt('session_persistence_enabled', |
| 285 | default=True, |
| 286 | help="Whether session persistence is supported with the " |
| 287 | "provider driver."), |
Michael Johnson | b1ba3b3 | 2019-07-30 20:23:51 -0700 | [diff] [blame] | 288 | cfg.BoolOpt('log_offload_enabled', default=False, |
| 289 | help="Whether the log offload tests will run. These require " |
| 290 | "the tempest instance have access to the log files " |
| 291 | "specified in the tempest configuration."), |
Michael Polenchuk | be2bca6 | 2022-04-04 13:34:43 +0400 | [diff] [blame] | 292 | cfg.BoolOpt('force_cleanup_enabled', |
| 293 | default=False, |
| 294 | help="Whether to delete loadbalancers with force on cleanup."), |
Reedip | f88cffc | 2018-09-03 13:20:08 +0000 | [diff] [blame] | 295 | ] |
Michael Johnson | 6006de7 | 2021-02-21 01:42:39 +0000 | [diff] [blame] | 296 | |
| 297 | # Extending this enforce_scope group defined in tempest |
| 298 | enforce_scope_group = cfg.OptGroup(name="enforce_scope", |
| 299 | title="OpenStack Services with " |
| 300 | "enforce scope") |
| 301 | EnforceScopeGroup = [ |
| 302 | cfg.BoolOpt('octavia', |
| 303 | default=False, |
| 304 | help='Does the load-balancer service API policies enforce ' |
| 305 | 'scope? This configuration value should be same as ' |
| 306 | 'octavia.conf: [oslo_policy].enforce_scope option.'), |
| 307 | ] |
Ilya Bumarskov | eded9c7 | 2023-03-16 14:12:09 +0400 | [diff] [blame] | 308 | |
| 309 | |
| 310 | def is_tungstenfabric_backend_enabled(): |
| 311 | """Return True if TungstenFabric is used as a backend.""" |
| 312 | try: |
| 313 | sdn = getattr(config.CONF, 'sdn') |
| 314 | return getattr(sdn, 'service_name', None) == 'tungstenfabric' |
| 315 | except cfg.NoSuchOptError: |
| 316 | return False |