| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
import testtools |
| 15 |
|
| 16 |
from tempest import config |
| 17 |
from tempest.lib.common.utils import data_utils |
| 18 |
from tempest.lib import decorators |
| 19 |
from tempest.lib import exceptions as tempest_exceptions |
| 20 |
|
| 21 |
from octavia_tempest_plugin.common import constants as const |
| 22 |
from octavia_tempest_plugin.tests import test_base |
| 23 |
from octavia_tempest_plugin.tests import waiters |
| 24 |
|
| 25 |
CONF = config.CONF |
| 26 |
|
| 27 |
|
| 28 |
class IPv6TrafficOperationsScenarioTest( |
| 29 |
test_base.LoadBalancerBaseTestWithCompute): |
| 30 |
"""Test traffic operations with an IPv6 VIP.""" |
| 31 |
|
| 32 |
@classmethod |
| 33 |
def skip_checks(cls): |
| 34 |
super(IPv6TrafficOperationsScenarioTest, cls).skip_checks() |
| 35 |
|
| 36 |
if not CONF.validation.run_validation: |
| 37 |
raise cls.skipException('Traffic tests will not work without ' |
| 38 |
'run_validation enabled.') |
| 39 |
|
| 40 |
if CONF.load_balancer.test_with_noop: |
| 41 |
raise cls.skipException('Traffic tests will not work in noop ' |
| 42 |
'mode.') |
| 43 |
|
| 44 |
if not CONF.load_balancer.test_with_ipv6: |
| 45 |
raise cls.skipException('IPv6 traffic ops tests require Octavia ' |
| 46 |
'IPv6 testing enabled') |
| 47 |
|
| 48 |
@classmethod |
| 49 |
def resource_setup(cls): |
| 50 |
"""Setup resources needed by the tests.""" |
| 51 |
super(IPv6TrafficOperationsScenarioTest, cls).resource_setup() |
| 52 |
|
| 53 |
lb_name = data_utils.rand_name("lb_member_lb1_ipv6_ops") |
| 54 |
lb_kwargs = {const.PROVIDER: CONF.load_balancer.provider, |
| 55 |
const.NAME: lb_name} |
| 56 |
|
| 57 |
ip_version = 6 |
| 58 |
cls._setup_lb_network_kwargs(lb_kwargs, ip_version) |
| 59 |
|
| 60 |
lb = cls.mem_lb_client.create_loadbalancer(**lb_kwargs) |
| 61 |
cls.lb_id = lb[const.ID] |
| 62 |
cls.addClassResourceCleanup( |
| 63 |
cls.mem_lb_client.cleanup_loadbalancer, |
| 64 |
cls.lb_id, cascade=True) |
| 65 |
|
| 66 |
cls.lb_vip_address = lb[const.VIP_ADDRESS] |
| 67 |
|
| 68 |
|
| 69 |
cls.listener_ids = {} |
| 70 |
cls.pool_ids = {} |
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
cls._listener_pool_create(const.HTTP, 80) |
| 75 |
|
| 76 |
cls._listener_pool_create(const.TCP, 81) |
| 77 |
|
| 78 |
cls._listener_pool_create(const.UDP, 8080) |
| 79 |
|
| 80 |
@classmethod |
| 81 |
def _listener_pool_create(cls, protocol, protocol_port, |
| 82 |
algorithm=const.LB_ALGORITHM_ROUND_ROBIN): |
| 83 |
if (protocol == const.UDP and |
| 84 |
not cls.mem_listener_client.is_version_supported( |
| 85 |
cls.api_version, '2.1')): |
| 86 |
return |
| 87 |
|
| 88 |
waiters.wait_for_status(cls.mem_lb_client.show_loadbalancer, |
| 89 |
cls.lb_id, const.PROVISIONING_STATUS, |
| 90 |
const.ACTIVE, |
| 91 |
CONF.load_balancer.lb_build_interval, |
| 92 |
CONF.load_balancer.lb_build_timeout) |
| 93 |
|
| 94 |
listener_name = data_utils.rand_name("lb_member_listener1_ipv6_ops") |
| 95 |
listener_kwargs = { |
| 96 |
const.NAME: listener_name, |
| 97 |
const.PROTOCOL: protocol, |
| 98 |
const.PROTOCOL_PORT: protocol_port, |
| 99 |
const.LOADBALANCER_ID: cls.lb_id, |
| 100 |
|
| 101 |
|
| 102 |
const.CONNECTION_LIMIT: 200, |
| 103 |
} |
| 104 |
listener = cls.mem_listener_client.create_listener(**listener_kwargs) |
| 105 |
cls.listener_ids[protocol] = listener[const.ID] |
| 106 |
|
| 107 |
cls.addClassResourceCleanup( |
| 108 |
cls.mem_listener_client.cleanup_listener, |
| 109 |
listener[const.ID], |
| 110 |
lb_client=cls.mem_lb_client, lb_id=cls.lb_id) |
| 111 |
|
| 112 |
waiters.wait_for_status(cls.mem_lb_client.show_loadbalancer, |
| 113 |
cls.lb_id, const.PROVISIONING_STATUS, |
| 114 |
const.ACTIVE, |
| 115 |
CONF.load_balancer.build_interval, |
| 116 |
CONF.load_balancer.build_timeout) |
| 117 |
|
| 118 |
pool_name = data_utils.rand_name("lb_member_pool1_ipv6_ops") |
| 119 |
pool_kwargs = { |
| 120 |
const.NAME: pool_name, |
| 121 |
const.PROTOCOL: protocol, |
| 122 |
const.LB_ALGORITHM: algorithm, |
| 123 |
const.LISTENER_ID: cls.listener_ids[protocol], |
| 124 |
} |
| 125 |
pool = cls.mem_pool_client.create_pool(**pool_kwargs) |
| 126 |
cls.pool_ids[protocol] = pool[const.ID] |
| 127 |
|
| 128 |
cls.addClassResourceCleanup( |
| 129 |
cls.mem_pool_client.cleanup_pool, |
| 130 |
pool[const.ID], |
| 131 |
lb_client=cls.mem_lb_client, lb_id=cls.lb_id) |
| 132 |
|
| 133 |
waiters.wait_for_status(cls.mem_lb_client.show_loadbalancer, |
| 134 |
cls.lb_id, const.PROVISIONING_STATUS, |
| 135 |
const.ACTIVE, |
| 136 |
CONF.load_balancer.build_interval, |
| 137 |
CONF.load_balancer.build_timeout) |
| 138 |
|
| 139 |
def _test_ipv6_vip_mixed_ipv4_ipv6_members_traffic( |
| 140 |
self, protocol, protocol_port, persistent=True): |
| 141 |
"""Tests traffic through a loadbalancer with IPv4 and IPv6 members. |
| 142 |
|
| 143 |
* Set up members on a loadbalancer. |
| 144 |
* Test traffic to ensure it is balanced properly. |
| 145 |
""" |
| 146 |
|
| 147 |
member1_name = data_utils.rand_name("lb_member_member1-traffic") |
| 148 |
member1_kwargs = { |
| 149 |
const.POOL_ID: self.pool_ids[protocol], |
| 150 |
const.NAME: member1_name, |
| 151 |
const.ADMIN_STATE_UP: True, |
| 152 |
const.ADDRESS: self.webserver1_ip, |
| 153 |
const.PROTOCOL_PORT: 80, |
| 154 |
} |
| 155 |
if self.lb_member_1_subnet: |
| 156 |
member1_kwargs[const.SUBNET_ID] = self.lb_member_1_subnet[const.ID] |
| 157 |
|
| 158 |
member1 = self.mem_member_client.create_member(**member1_kwargs) |
| 159 |
self.addCleanup( |
| 160 |
self.mem_member_client.cleanup_member, |
| 161 |
member1[const.ID], pool_id=self.pool_ids[protocol], |
| 162 |
lb_client=self.mem_lb_client, lb_id=self.lb_id) |
| 163 |
waiters.wait_for_status( |
| 164 |
self.mem_lb_client.show_loadbalancer, self.lb_id, |
| 165 |
const.PROVISIONING_STATUS, const.ACTIVE, |
| 166 |
CONF.load_balancer.check_interval, |
| 167 |
CONF.load_balancer.check_timeout) |
| 168 |
|
| 169 |
|
| 170 |
member2_name = data_utils.rand_name("lb_member_member2-traffic") |
| 171 |
member2_kwargs = { |
| 172 |
const.POOL_ID: self.pool_ids[protocol], |
| 173 |
const.NAME: member2_name, |
| 174 |
const.ADMIN_STATE_UP: True, |
| 175 |
const.ADDRESS: self.webserver2_ipv6, |
| 176 |
const.PROTOCOL_PORT: 80, |
| 177 |
} |
| 178 |
if self.lb_member_2_ipv6_subnet: |
| 179 |
member2_kwargs[const.SUBNET_ID] = ( |
| 180 |
self.lb_member_2_ipv6_subnet[const.ID]) |
| 181 |
|
| 182 |
member2 = self.mem_member_client.create_member(**member2_kwargs) |
| 183 |
self.addCleanup( |
| 184 |
self.mem_member_client.cleanup_member, |
| 185 |
member2[const.ID], pool_id=self.pool_ids[protocol], |
| 186 |
lb_client=self.mem_lb_client, lb_id=self.lb_id) |
| 187 |
waiters.wait_for_status( |
| 188 |
self.mem_lb_client.show_loadbalancer, self.lb_id, |
| 189 |
const.PROVISIONING_STATUS, const.ACTIVE, |
| 190 |
CONF.load_balancer.check_interval, |
| 191 |
CONF.load_balancer.check_timeout) |
| 192 |
|
| 193 |
|
| 194 |
self.check_members_balanced(self.lb_vip_address, |
| 195 |
protocol_port=protocol_port, |
| 196 |
protocol=protocol, persistent=persistent) |
| 197 |
|
| 198 |
@decorators.idempotent_id('219ac17d-c5c1-4e7e-a9d5-0764d7ce7746') |
| 199 |
def test_http_ipv6_vip_mixed_ipv4_ipv6_members_traffic(self): |
| 200 |
self._test_ipv6_vip_mixed_ipv4_ipv6_members_traffic(const.HTTP, 80) |
| 201 |
|
| 202 |
@decorators.idempotent_id('a4e8d5d1-03d5-4252-9300-e89b9b2bdafc') |
| 203 |
def test_tcp_ipv6_vip_mixed_ipv4_ipv6_members_traffic(self): |
| 204 |
self._test_ipv6_vip_mixed_ipv4_ipv6_members_traffic(const.TCP, 81, |
| 205 |
persistent=False) |
| 206 |
|
| 207 |
@decorators.idempotent_id('c468434d-bc84-4bfa-825f-d4761daa0d76') |
| 208 |
|
| 209 |
|
| 210 |
|
| 211 |
@decorators.skip_because( |
| 212 |
bug='2003329', |
| 213 |
bug_type='storyboard', |
| 214 |
condition=CONF.load_balancer.provider in const.AMPHORA_PROVIDERS) |
| 215 |
def test_ipv6_vip_mixed_ipv4_ipv6_members_udp_traffic(self): |
| 216 |
if not self.mem_listener_client.is_version_supported( |
| 217 |
self.api_version, '2.1'): |
| 218 |
raise self.skipException('UDP listener support is only available ' |
| 219 |
'in Octavia API version 2.1 or newer') |
| 220 |
|
| 221 |
self._test_ipv6_vip_mixed_ipv4_ipv6_members_traffic(const.UDP, 8080) |
| 222 |
|
| 223 |
def _test_ipv6_vip_ipv6_members_traffic(self, protocol, protocol_port, |
| 224 |
persistent=True): |
| 225 |
"""Tests traffic through a loadbalancer with IPv6 members. |
| 226 |
|
| 227 |
* Set up members on a loadbalancer. |
| 228 |
* Test traffic to ensure it is balanced properly. |
| 229 |
""" |
| 230 |
|
| 231 |
|
| 232 |
member1_name = data_utils.rand_name("lb_member_member1-traffic") |
| 233 |
member1_kwargs = { |
| 234 |
const.POOL_ID: self.pool_ids[protocol], |
| 235 |
const.NAME: member1_name, |
| 236 |
const.ADMIN_STATE_UP: True, |
| 237 |
const.ADDRESS: self.webserver1_ipv6, |
| 238 |
const.PROTOCOL_PORT: 80, |
| 239 |
} |
| 240 |
if self.lb_member_1_ipv6_subnet: |
| 241 |
member1_kwargs[const.SUBNET_ID] = ( |
| 242 |
self.lb_member_1_ipv6_subnet[const.ID]) |
| 243 |
|
| 244 |
member1 = self.mem_member_client.create_member(**member1_kwargs) |
| 245 |
self.addCleanup( |
| 246 |
self.mem_member_client.cleanup_member, |
| 247 |
member1[const.ID], pool_id=self.pool_ids[protocol], |
| 248 |
lb_client=self.mem_lb_client, lb_id=self.lb_id) |
| 249 |
waiters.wait_for_status( |
| 250 |
self.mem_lb_client.show_loadbalancer, self.lb_id, |
| 251 |
const.PROVISIONING_STATUS, const.ACTIVE, |
| 252 |
CONF.load_balancer.check_interval, |
| 253 |
CONF.load_balancer.check_timeout) |
| 254 |
|
| 255 |
|
| 256 |
member2_name = data_utils.rand_name("lb_member_member2-traffic") |
| 257 |
member2_kwargs = { |
| 258 |
const.POOL_ID: self.pool_ids[protocol], |
| 259 |
const.NAME: member2_name, |
| 260 |
const.ADMIN_STATE_UP: True, |
| 261 |
const.ADDRESS: self.webserver2_ipv6, |
| 262 |
const.PROTOCOL_PORT: 80, |
| 263 |
} |
| 264 |
if self.lb_member_2_ipv6_subnet: |
| 265 |
member2_kwargs[const.SUBNET_ID] = ( |
| 266 |
self.lb_member_2_ipv6_subnet[const.ID]) |
| 267 |
|
| 268 |
member2 = self.mem_member_client.create_member(**member2_kwargs) |
| 269 |
self.addCleanup( |
| 270 |
self.mem_member_client.cleanup_member, |
| 271 |
member2[const.ID], pool_id=self.pool_ids[protocol], |
| 272 |
lb_client=self.mem_lb_client, lb_id=self.lb_id) |
| 273 |
waiters.wait_for_status( |
| 274 |
self.mem_lb_client.show_loadbalancer, self.lb_id, |
| 275 |
const.PROVISIONING_STATUS, const.ACTIVE, |
| 276 |
CONF.load_balancer.check_interval, |
| 277 |
CONF.load_balancer.check_timeout) |
| 278 |
|
| 279 |
|
| 280 |
self.check_members_balanced(self.lb_vip_address, |
| 281 |
protocol_port=protocol_port, |
| 282 |
protocol=protocol, persistent=persistent) |
| 283 |
|
| 284 |
@decorators.idempotent_id('dd75f41a-5b29-47ad-963d-3434f1056ca3') |
| 285 |
def test_http_ipv6_vip_ipv6_members_traffic(self): |
| 286 |
self._test_ipv6_vip_ipv6_members_traffic(const.HTTP, 80) |
| 287 |
|
| 288 |
@decorators.idempotent_id('9bb93619-14cb-45d9-ad60-2f80c201486a') |
| 289 |
def test_tcp_ipv6_vip_ipv6_members_traffic(self): |
| 290 |
self._test_ipv6_vip_ipv6_members_traffic(const.TCP, 81, |
| 291 |
persistent=False) |
| 292 |
|
| 293 |
@decorators.idempotent_id('26317013-a9b5-4a00-a993-d4c55b764e40') |
| 294 |
def test_ipv6_vip_ipv6_members_udp_traffic(self): |
| 295 |
if not self.mem_listener_client.is_version_supported( |
| 296 |
self.api_version, '2.1'): |
| 297 |
raise self.skipException('UDP listener support is only available ' |
| 298 |
'in Octavia API version 2.1 or newer') |
| 299 |
|
| 300 |
self._test_ipv6_vip_ipv6_members_traffic(const.UDP, 8080) |
| 301 |
|
| 302 |
@decorators.idempotent_id('9bead31b-0760-4c8f-b70a-f758fc5edd6a') |
| 303 |
def test_ipv6_http_LC_listener_with_allowed_cidrs(self): |
| 304 |
self._test_listener_with_allowed_cidrs( |
| 305 |
const.HTTP, 90, const.LB_ALGORITHM_LEAST_CONNECTIONS) |
| 306 |
|
| 307 |
@decorators.idempotent_id('843a13f7-e00f-4151-8817-b5395eb69b52') |
| 308 |
def test_ipv6_tcp_LC_listener_with_allowed_cidrs(self): |
| 309 |
self._test_listener_with_allowed_cidrs( |
| 310 |
const.TCP, 91, const.LB_ALGORITHM_LEAST_CONNECTIONS, delay=0.2) |
| 311 |
|
| 312 |
@decorators.idempotent_id('cc0d55b1-87e8-4a87-bf50-66299947a469') |
| 313 |
def test_ipv6_udp_LC_listener_with_allowed_cidrs(self): |
| 314 |
self._test_listener_with_allowed_cidrs( |
| 315 |
const.UDP, 92, const.LB_ALGORITHM_LEAST_CONNECTIONS) |
| 316 |
|
| 317 |
@decorators.idempotent_id('84b23f68-4bc3-49e5-8372-60c25fe69613') |
| 318 |
def test_ipv6_http_RR_listener_with_allowed_cidrs(self): |
| 319 |
self._test_listener_with_allowed_cidrs( |
| 320 |
const.HTTP, 93, const.LB_ALGORITHM_ROUND_ROBIN) |
| 321 |
|
| 322 |
@decorators.idempotent_id('52c07510-5755-44a3-9231-64c9cbb4bbd4') |
| 323 |
def test_ipv6_tcp_RR_listener_with_allowed_cidrs(self): |
| 324 |
self._test_listener_with_allowed_cidrs( |
| 325 |
const.TCP, 94, const.LB_ALGORITHM_ROUND_ROBIN) |
| 326 |
|
| 327 |
@decorators.idempotent_id('df0417d9-dc72-4bb5-b3ce-1e2558a3c4a9') |
| 328 |
def test_ipv6_udp_RR_listener_with_allowed_cidrs(self): |
| 329 |
self._test_listener_with_allowed_cidrs( |
| 330 |
const.UDP, 95, const.LB_ALGORITHM_ROUND_ROBIN) |
| 331 |
|
| 332 |
@decorators.idempotent_id('d1256195-3d85-4ffd-bda3-1c0ab78b8ce1') |
| 333 |
def test_ipv6_http_SI_listener_with_allowed_cidrs(self): |
| 334 |
self._test_listener_with_allowed_cidrs( |
| 335 |
const.HTTP, 96, const.LB_ALGORITHM_SOURCE_IP) |
| 336 |
|
| 337 |
@decorators.idempotent_id('bf8504b6-b95a-4f8a-9032-ab432db46eec') |
| 338 |
def test_ipv6_tcp_SI_listener_with_allowed_cidrs(self): |
| 339 |
self._test_listener_with_allowed_cidrs( |
| 340 |
const.TCP, 97, const.LB_ALGORITHM_SOURCE_IP) |
| 341 |
|
| 342 |
@decorators.idempotent_id('ce75bf28-5288-4821-a603-460e602de8b9') |
| 343 |
def test_ipv6_udp_SI_listener_with_allowed_cidrs(self): |
| 344 |
self._test_listener_with_allowed_cidrs( |
| 345 |
const.UDP, 98, const.LB_ALGORITHM_SOURCE_IP) |
| 346 |
|
| 347 |
@decorators.idempotent_id('c11768f1-19b4-48cc-99a5-0737379b1957') |
| 348 |
def test_ipv6_http_SIP_listener_with_allowed_cidrs(self): |
| 349 |
self._test_listener_with_allowed_cidrs( |
| 350 |
const.HTTP, 99, const.LB_ALGORITHM_SOURCE_IP_PORT) |
| 351 |
|
| 352 |
@decorators.idempotent_id('fcfe2ab1-2c36-4793-a926-1fec589a9a2a') |
| 353 |
def test_ipv6_tcp_SIP_listener_with_allowed_cidrs(self): |
| 354 |
self._test_listener_with_allowed_cidrs( |
| 355 |
const.TCP, 100, const.LB_ALGORITHM_SOURCE_IP_PORT) |
| 356 |
|
| 357 |
@decorators.idempotent_id('80f31bc1-819e-4d9e-8820-bf3e28600540') |
| 358 |
def test_ipv6_udp_SIP_listener_with_allowed_cidrs(self): |
| 359 |
self._test_listener_with_allowed_cidrs( |
| 360 |
const.UDP, 101, const.LB_ALGORITHM_SOURCE_IP_PORT) |
| 361 |
|
| 362 |
def _test_listener_with_allowed_cidrs(self, protocol, protocol_port, |
| 363 |
algorithm, delay=None): |
| 364 |
"""Tests traffic through a loadbalancer with allowed CIDRs set. |
| 365 |
|
| 366 |
* Set up listener with allowed CIDRS (allow all) on a loadbalancer. |
| 367 |
* Set up pool on a loadbalancer |
| 368 |
* Set up members on a loadbalancer. |
| 369 |
* Test traffic to ensure it is balanced properly. |
| 370 |
* Update allowed CIDRs to restrict traffic to a small subnet. |
| 371 |
* Assert loadbalancer does not respond to client requests. |
| 372 |
""" |
| 373 |
|
| 374 |
if not self.mem_listener_client.is_version_supported( |
| 375 |
self.api_version, '2.12'): |
| 376 |
raise self.skipException('Allowed CIDRS in listeners is only ' |
| 377 |
'available on Octavia API version 2.12 ' |
| 378 |
'or newer.') |
| 379 |
|
| 380 |
listener_name = data_utils.rand_name("lb_member_listener2_cidrs") |
| 381 |
listener_kwargs = { |
| 382 |
const.NAME: listener_name, |
| 383 |
const.PROTOCOL: protocol, |
| 384 |
const.PROTOCOL_PORT: protocol_port, |
| 385 |
const.LOADBALANCER_ID: self.lb_id, |
| 386 |
const.ALLOWED_CIDRS: ['::/0'] |
| 387 |
} |
| 388 |
listener = self.mem_listener_client.create_listener(**listener_kwargs) |
| 389 |
listener_id = listener[const.ID] |
| 390 |
self.addCleanup( |
| 391 |
self.mem_listener_client.cleanup_listener, |
| 392 |
listener_id, |
| 393 |
lb_client=self.mem_lb_client, lb_id=self.lb_id) |
| 394 |
|
| 395 |
waiters.wait_for_status(self.mem_lb_client.show_loadbalancer, |
| 396 |
self.lb_id, const.PROVISIONING_STATUS, |
| 397 |
const.ACTIVE, |
| 398 |
CONF.load_balancer.build_interval, |
| 399 |
CONF.load_balancer.build_timeout) |
| 400 |
|
| 401 |
pool_name = data_utils.rand_name("lb_member_pool3_cidrs") |
| 402 |
pool_kwargs = { |
| 403 |
const.NAME: pool_name, |
| 404 |
const.PROTOCOL: protocol, |
| 405 |
const.LB_ALGORITHM: algorithm, |
| 406 |
const.LISTENER_ID: listener_id, |
| 407 |
} |
| 408 |
|
| 409 |
|
| 410 |
|
| 411 |
try: |
| 412 |
pool = self.mem_pool_client.create_pool(**pool_kwargs) |
| 413 |
except tempest_exceptions.NotImplemented as e: |
| 414 |
if algorithm != const.LB_ALGORITHM_SOURCE_IP_PORT: |
| 415 |
raise |
| 416 |
message = ("The configured provider driver '{driver}' " |
| 417 |
"does not support a feature required for this " |
| 418 |
"test.".format(driver=CONF.load_balancer.provider)) |
| 419 |
if hasattr(e, 'resp_body'): |
| 420 |
message = e.resp_body.get('faultstring', message) |
| 421 |
raise testtools.TestCase.skipException(message) |
| 422 |
|
| 423 |
pool_id = pool[const.ID] |
| 424 |
self.addCleanup( |
| 425 |
self.mem_pool_client.cleanup_pool, |
| 426 |
pool_id, |
| 427 |
lb_client=self.mem_lb_client, lb_id=self.lb_id) |
| 428 |
|
| 429 |
waiters.wait_for_status(self.mem_lb_client.show_loadbalancer, |
| 430 |
self.lb_id, const.PROVISIONING_STATUS, |
| 431 |
const.ACTIVE, |
| 432 |
CONF.load_balancer.build_interval, |
| 433 |
CONF.load_balancer.build_timeout) |
| 434 |
|
| 435 |
|
| 436 |
member1_name = data_utils.rand_name("lb_member_member1-cidrs-traffic") |
| 437 |
member1_kwargs = { |
| 438 |
const.POOL_ID: pool_id, |
| 439 |
const.NAME: member1_name, |
| 440 |
const.ADMIN_STATE_UP: True, |
| 441 |
const.ADDRESS: self.webserver1_ipv6, |
| 442 |
const.PROTOCOL_PORT: 80, |
| 443 |
} |
| 444 |
if self.lb_member_1_ipv6_subnet: |
| 445 |
member1_kwargs[const.SUBNET_ID] = ( |
| 446 |
self.lb_member_1_ipv6_subnet[const.ID]) |
| 447 |
|
| 448 |
member1 = self.mem_member_client.create_member( |
| 449 |
**member1_kwargs) |
| 450 |
self.addCleanup( |
| 451 |
self.mem_member_client.cleanup_member, |
| 452 |
member1[const.ID], pool_id=pool_id, |
| 453 |
lb_client=self.mem_lb_client, lb_id=self.lb_id) |
| 454 |
waiters.wait_for_status( |
| 455 |
self.mem_lb_client.show_loadbalancer, self.lb_id, |
| 456 |
const.PROVISIONING_STATUS, const.ACTIVE, |
| 457 |
CONF.load_balancer.check_interval, |
| 458 |
CONF.load_balancer.check_timeout) |
| 459 |
|
| 460 |
|
| 461 |
member2_name = data_utils.rand_name("lb_member_member2-cidrs-traffic") |
| 462 |
member2_kwargs = { |
| 463 |
const.POOL_ID: pool_id, |
| 464 |
const.NAME: member2_name, |
| 465 |
const.ADMIN_STATE_UP: True, |
| 466 |
const.ADDRESS: self.webserver2_ipv6, |
| 467 |
const.PROTOCOL_PORT: 80, |
| 468 |
} |
| 469 |
if self.lb_member_2_ipv6_subnet: |
| 470 |
member2_kwargs[const.SUBNET_ID] = ( |
| 471 |
self.lb_member_2_ipv6_subnet[const.ID]) |
| 472 |
|
| 473 |
member2 = self.mem_member_client.create_member(**member2_kwargs) |
| 474 |
self.addCleanup( |
| 475 |
self.mem_member_client.cleanup_member, |
| 476 |
member2[const.ID], pool_id=pool_id, |
| 477 |
lb_client=self.mem_lb_client, lb_id=self.lb_id) |
| 478 |
waiters.wait_for_status( |
| 479 |
self.mem_lb_client.show_loadbalancer, self.lb_id, |
| 480 |
const.PROVISIONING_STATUS, const.ACTIVE, |
| 481 |
CONF.load_balancer.check_interval, |
| 482 |
CONF.load_balancer.check_timeout) |
| 483 |
|
| 484 |
|
| 485 |
members = 2 |
| 486 |
if algorithm == const.LB_ALGORITHM_SOURCE_IP: |
| 487 |
members = 1 |
| 488 |
self.check_members_balanced( |
| 489 |
self.lb_vip_address, protocol=protocol, |
| 490 |
protocol_port=protocol_port, persistent=False, |
| 491 |
traffic_member_count=members, delay=delay) |
| 492 |
|
| 493 |
listener_kwargs = { |
| 494 |
const.LISTENER_ID: listener_id, |
| 495 |
const.ALLOWED_CIDRS: ['2001:db8:a0b:12f0::/128'] |
| 496 |
} |
| 497 |
self.mem_listener_client.update_listener(**listener_kwargs) |
| 498 |
waiters.wait_for_status(self.mem_lb_client.show_loadbalancer, |
| 499 |
self.lb_id, const.PROVISIONING_STATUS, |
| 500 |
const.ACTIVE, |
| 501 |
CONF.load_balancer.build_interval, |
| 502 |
CONF.load_balancer.build_timeout) |
| 503 |
|
| 504 |
|
| 505 |
|
| 506 |
|
| 507 |
def expect_timeout_error(address, protocol, protocol_port): |
| 508 |
if protocol != const.UDP: |
| 509 |
address = "[{}]".format(address) |
| 510 |
try: |
| 511 |
self.make_request(address, protocol=protocol, |
| 512 |
protocol_port=protocol_port) |
| 513 |
except tempest_exceptions.TimeoutException: |
| 514 |
return True |
| 515 |
return False |
| 516 |
|
| 517 |
waiters.wait_until_true( |
| 518 |
expect_timeout_error, address=self.lb_vip_address, |
| 519 |
protocol=protocol, protocol_port=protocol_port) |
| 520 |
|
| 521 |
|
| 522 |
if protocol == const.UDP: |
| 523 |
url_for_vip = 'udp://[{}]:{}/'.format(self.lb_vip_address, |
| 524 |
protocol_port) |
| 525 |
else: |
| 526 |
url_for_vip = 'http://[{}]:{}/'.format(self.lb_vip_address, |
| 527 |
protocol_port) |
| 528 |
self.assertConsistentResponse( |
| 529 |
(None, None), url_for_vip, repeat=3, expect_connection_error=True) |