Debian Codegraph @

octavia_tempest_plugin/tests/api/v2/test_member.py

raw symbols SCIP
1 # Copyright 2018 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 import testtools
16 import time
17 from uuid import UUID
18
19 from dateutil import parser
20 from tempest import config
21 from tempest.lib.common.utils import data_utils
22 from tempest.lib.common.utils import misc
23 from tempest.lib import decorators
24 from tempest.lib import exceptions
25
26 from octavia_tempest_plugin.common import constants as const
27 from octavia_tempest_plugin.tests import test_base
28 from octavia_tempest_plugin.tests import waiters
29
30 CONF = config.CONF
31
32
33 # Member port numbers need to be unique on the shared pools so generate them
34 @misc.singleton
35 class MemberPort(object):
36
37 current_port = 8000
38
39 def increment(self):
40 self.current_port += 1
41 return self.current_port
42
43
44 class MemberAPITest(test_base.LoadBalancerBaseTest):
45 """Test the member object API."""
46
47 @classmethod
48 def resource_setup(cls):
49 """Setup resources needed by the tests."""
50 super(MemberAPITest, cls).resource_setup()
51
52 lb_name = data_utils.rand_name("lb_member_lb1_member")
53 lb_kwargs = {const.PROVIDER: CONF.load_balancer.provider,
54 const.NAME: lb_name}
55 cls._setup_lb_network_kwargs(lb_kwargs)
56
57 cls.current_listener_port = 8000
58 cls.listener_pool_cache = {}
59 cls.member_port = MemberPort()
60
61 lb = cls.mem_lb_client.create_loadbalancer(**lb_kwargs)
62 cls.lb_id = lb[const.ID]
63 cls.addClassResourceCleanup(
64 cls.mem_lb_client.cleanup_loadbalancer,
65 cls.lb_id, cascade=True)
66
67 waiters.wait_for_status(cls.mem_lb_client.show_loadbalancer,
68 cls.lb_id, const.PROVISIONING_STATUS,
69 const.ACTIVE,
70 CONF.load_balancer.lb_build_interval,
71 CONF.load_balancer.lb_build_timeout)
72
73 @classmethod
74 def _listener_pool_create(cls, listener_protocol, pool_protocol,
75 algorithm):
76 """Setup resources needed by the tests."""
77 if (algorithm == const.LB_ALGORITHM_SOURCE_IP_PORT and not
78 cls.mem_listener_client.is_version_supported(
79 cls.api_version, '2.13')):
80 raise testtools.TestCase.skipException(
81 'Skipping this test as load balancing algorithm '
82 'SOURCE_IP_PORT requires API version 2.13 or newer.')
83
84 if (listener_protocol == const.UDP and
85 not cls.mem_listener_client.is_version_supported(
86 cls.api_version, '2.1')):
87 raise cls.skipException('UDP listener support is only available '
88 'in Octavia API version 2.1 or newer')
89
90 # Cache listener/pool combinations we have already created as
91 # they can be reused for member test permutations
92 listener_pool_key = listener_protocol + pool_protocol + algorithm
93 pool_id = cls.listener_pool_cache.get(listener_pool_key, None)
94 if pool_id is not None:
95 return pool_id
96
97 listener_name = data_utils.rand_name("lb_member_listener1_member")
98 listener_kwargs = {
99 const.NAME: listener_name,
100 const.PROTOCOL: listener_protocol,
101 const.PROTOCOL_PORT: cls.current_listener_port,
102 const.LOADBALANCER_ID: cls.lb_id,
103 const.CONNECTION_LIMIT: 200
104 }
105 cls.current_listener_port += 1
106 listener = cls.mem_listener_client.create_listener(**listener_kwargs)
107
108 cls.addClassResourceCleanup(
109 cls.mem_listener_client.cleanup_listener,
110 listener[const.ID],
111 lb_client=cls.mem_lb_client, lb_id=cls.lb_id)
112
113 waiters.wait_for_status(cls.mem_lb_client.show_loadbalancer,
114 cls.lb_id, const.PROVISIONING_STATUS,
115 const.ACTIVE,
116 CONF.load_balancer.build_interval,
117 CONF.load_balancer.build_timeout)
118
119 pool_name = data_utils.rand_name("lb_member_pool1_member")
120 pool_kwargs = {
121 const.NAME: pool_name,
122 const.PROTOCOL: pool_protocol,
123 const.LB_ALGORITHM: algorithm,
124 const.LISTENER_ID: listener[const.ID]
125 }
126
127 # This is a special case as the reference driver does not support
128 # SOURCE-IP-PORT. Since it runs with not_implemented_is_error, we must
129 # handle this test case special.
130 try:
131 pool = cls.mem_pool_client.create_pool(**pool_kwargs)
132 except exceptions.NotImplemented as e:
133 if algorithm != const.LB_ALGORITHM_SOURCE_IP_PORT:
134 raise
135 message = ("The configured provider driver '{driver}' "
136 "does not support a feature required for this "
137 "test.".format(driver=CONF.load_balancer.provider))
138 if hasattr(e, 'resp_body'):
139 message = e.resp_body.get('faultstring', message)
140 raise testtools.TestCase.skipException(message)
141
142 cls.addClassResourceCleanup(
143 cls.mem_pool_client.cleanup_pool,
144 pool[const.ID],
145 lb_client=cls.mem_lb_client, lb_id=cls.lb_id)
146
147 waiters.wait_for_status(cls.mem_lb_client.show_loadbalancer,
148 cls.lb_id, const.PROVISIONING_STATUS,
149 const.ACTIVE,
150 CONF.load_balancer.build_interval,
151 CONF.load_balancer.build_timeout)
152 cls.listener_pool_cache[listener_pool_key] = pool[const.ID]
153 return pool[const.ID]
154
155
156 class MemberAPITest1(MemberAPITest):
157 @decorators.idempotent_id('c1e029b0-b6d6-4fa6-8ccb-5c3f3aa293b0')
158 def test_ipv4_HTTP_LC_backup_member_create(self):
159 if not self.mem_member_client.is_version_supported(
160 self.api_version, '2.1'):
161 raise self.skipException('Backup member support is only available '
162 'in Octavia API version 2.1 or newer')
163 pool_id = self._listener_pool_create(
164 listener_protocol=const.HTTP, pool_protocol=const.HTTP,
165 algorithm=const.LB_ALGORITHM_LEAST_CONNECTIONS)
166 self._test_member_create(4, pool_id, backup_member=True)
167
168 @decorators.idempotent_id('0684575a-0970-4fa8-8006-10c2b39c5f2b')
169 def test_ipv4_HTTP_LC_alt_monitor_member_create(self):
170 pool_id = self._listener_pool_create(
171 listener_protocol=const.HTTP, pool_protocol=const.HTTP,
172 algorithm=const.LB_ALGORITHM_LEAST_CONNECTIONS)
173 self._test_member_create(4, pool_id, alternate_monitor=True)
174
175 @decorators.idempotent_id('10641ec2-981e-4092-a0d0-89a434506eef')
176 def test_ipv4_HTTP_LC_member_create(self):
177 pool_id = self._listener_pool_create(
178 listener_protocol=const.HTTP, pool_protocol=const.HTTP,
179 algorithm=const.LB_ALGORITHM_LEAST_CONNECTIONS)
180 self._test_member_create(4, pool_id)
181
182 @decorators.idempotent_id('dce70b40-502b-4b1c-8592-180817324ea0')
183 def test_ipv4_HTTPS_LC_alt_monitor_member_create(self):
184 pool_id = self._listener_pool_create(
185 listener_protocol=const.HTTPS, pool_protocol=const.HTTPS,
186 algorithm=const.LB_ALGORITHM_LEAST_CONNECTIONS)
187 self._test_member_create(4, pool_id, alternate_monitor=True)
188
189 @decorators.idempotent_id('46555ea6-12a8-4961-b105-bffdead7abcd')
190 def test_ipv4_HTTPS_LC_member_create(self):
191 pool_id = self._listener_pool_create(
192 listener_protocol=const.HTTPS, pool_protocol=const.HTTPS,
193 algorithm=const.LB_ALGORITHM_LEAST_CONNECTIONS)
194 self._test_member_create(4, pool_id)
195
196 @decorators.idempotent_id('c1a5e297-f38e-4fc8-92a4-4177a37c4794')
197 def test_ipv4_PROXY_LC_alt_monitor_member_create(self):
198 pool_id = self._listener_pool_create(
199 listener_protocol=const.TCP, pool_protocol=const.PROXY,
200 algorithm=const.LB_ALGORITHM_LEAST_CONNECTIONS)
201 self._test_member_create(4, pool_id, alternate_monitor=True)
202
203 @decorators.idempotent_id('dfe24159-96a4-4496-888e-e74acd9d390d')
204 def test_ipv4_PROXY_LC_member_create(self):
205 pool_id = self._listener_pool_create(
206 listener_protocol=const.TCP, pool_protocol=const.PROXY,
207 algorithm=const.LB_ALGORITHM_LEAST_CONNECTIONS)
208 self._test_member_create(4, pool_id)
209
210 @decorators.idempotent_id('2716d05d-6b04-405e-bda9-e79c778eb6dd')
211 def test_ipv4_TCP_LC_alt_monitor_member_create(self):
212 pool_id = self._listener_pool_create(
213 listener_protocol=const.TCP, pool_protocol=const.TCP,
214 algorithm=const.LB_ALGORITHM_LEAST_CONNECTIONS)
215 self._test_member_create(4, pool_id, alternate_monitor=True)
216
217 @decorators.idempotent_id('14ee6e7d-c434-4e2e-947b-1a37d5ffa3bd')
218 def test_ipv4_TCP_LC_member_create(self):
219 pool_id = self._listener_pool_create(
220 listener_protocol=const.TCP, pool_protocol=const.TCP,
221 algorithm=const.LB_ALGORITHM_LEAST_CONNECTIONS)
222 self._test_member_create(4, pool_id)
223
224 @decorators.idempotent_id('fb9d0708-e320-45d7-be30-f6e7ea45c644')
225 # Skipping test for amphora driver until "UDP load balancers cannot mix
226 # protocol versions" (https://storyboard.openstack.org/#!/story/2003329) is
227 # fixed
228 @decorators.skip_because(
229 bug='2003329',
230 bug_type='storyboard',
231 condition=(CONF.load_balancer.provider in const.AMPHORA_PROVIDERS and
232 CONF.load_balancer.test_with_ipv6))
233 def test_ipv4_UDP_LC_alt_monitor_member_create(self):
234 pool_id = self._listener_pool_create(
235 listener_protocol=const.UDP, pool_protocol=const.UDP,
236 algorithm=const.LB_ALGORITHM_LEAST_CONNECTIONS)
237 self._test_member_create(4, pool_id, alternate_monitor=True)
238
239 @decorators.idempotent_id('5d36d4a4-3b9c-4d54-af61-5f80080bb040')
240 # Skipping test for amphora driver until "UDP load balancers cannot mix
241 # protocol versions" (https://storyboard.openstack.org/#!/story/2003329) is
242 # fixed
243 @decorators.skip_because(
244 bug='2003329',
245 bug_type='storyboard',
246 condition=(CONF.load_balancer.provider in const.AMPHORA_PROVIDERS and
247 CONF.load_balancer.test_with_ipv6))
248 def test_ipv4_UDP_LC_member_create(self):
249 pool_id = self._listener_pool_create(
250 listener_protocol=const.UDP, pool_protocol=const.UDP,
251 algorithm=const.LB_ALGORITHM_LEAST_CONNECTIONS)
252 self._test_member_create(4, pool_id)
253
254 @decorators.idempotent_id('0623aa1f-753d-44e7-afa1-017d274eace7')
255 def test_ipv4_HTTP_RR_alt_monitor_member_create(self):
256 pool_id = self._listener_pool_create(
257 listener_protocol=const.HTTP, pool_protocol=const.HTTP,
258 algorithm=const.LB_ALGORITHM_ROUND_ROBIN)
259 self._test_member_create(4, pool_id, alternate_monitor=True)
260
261 @decorators.idempotent_id('96b709fa-dca3-4780-8de7-fb168d455d76')
262 def test_ipv4_HTTP_RR_member_create(self):
263 pool_id = self._listener_pool_create(
264 listener_protocol=const.HTTP, pool_protocol=const.HTTP,
265 algorithm=const.LB_ALGORITHM_ROUND_ROBIN)
266 self._test_member_create(4, pool_id)
267
268 @decorators.idempotent_id('5354ac6c-653d-43ce-8096-1f9de961de73')
269 def test_ipv4_HTTPS_RR_alt_monitor_member_create(self):
270 pool_id = self._listener_pool_create(
271 listener_protocol=const.HTTPS, pool_protocol=const.HTTPS,
272 algorithm=const.LB_ALGORITHM_ROUND_ROBIN)
273 self._test_member_create(4, pool_id, alternate_monitor=True)
274
275 @decorators.idempotent_id('e5c8503a-4bc5-43ad-b0da-3e5c1ef719f7')
276 def test_ipv4_HTTPS_RR_member_create(self):
277 pool_id = self._listener_pool_create(
278 listener_protocol=const.HTTPS, pool_protocol=const.HTTPS,
279 algorithm=const.LB_ALGORITHM_ROUND_ROBIN)
280 self._test_member_create(4, pool_id)
281
282 @decorators.idempotent_id('b2c8632b-f833-4844-9af3-ffee655be6bf')
283 def test_ipv4_PROXY_RR_alt_monitor_member_create(self):
284 pool_id = self._listener_pool_create(
285 listener_protocol=const.TCP, pool_protocol=const.PROXY,
286 algorithm=const.LB_ALGORITHM_ROUND_ROBIN)
287 self._test_member_create(4, pool_id, alternate_monitor=True)
288
289 @decorators.idempotent_id('e565de98-88e2-4529-9730-a66073e31480')
290 def test_ipv4_PROXY_RR_member_create(self):
291 pool_id = self._listener_pool_create(
292 listener_protocol=const.TCP, pool_protocol=const.PROXY,
293 algorithm=const.LB_ALGORITHM_ROUND_ROBIN)
294 self._test_member_create(4, pool_id)
295
296 @decorators.idempotent_id('9306b599-c8e2-4ce9-b789-9e32d42406c4')
297 def test_ipv4_TCP_RR_alt_monitor_member_create(self):
298 pool_id = self._listener_pool_create(
299 listener_protocol=const.TCP, pool_protocol=const.TCP,
300 algorithm=const.LB_ALGORITHM_ROUND_ROBIN)
301 self._test_member_create(4, pool_id, alternate_monitor=True)
302
303 @decorators.idempotent_id('9bbfec96-a7e5-414d-96d1-710e468b8700')
304 def test_ipv4_TCP_RR_member_create(self):
305 pool_id = self._listener_pool_create(
306 listener_protocol=const.TCP, pool_protocol=const.TCP,
307 algorithm=const.LB_ALGORITHM_ROUND_ROBIN)
308 self._test_member_create(4, pool_id)
309
310 @decorators.idempotent_id('ccced84a-994d-4d30-a07a-30fa83e4dde2')
311 # Skipping test for amphora driver until "UDP load balancers cannot mix
312 # protocol versions" (https://storyboard.openstack.org/#!/story/2003329) is
313 # fixed
314 @decorators.skip_because(
315 bug='2003329',
316 bug_type='storyboard',
317 condition=(CONF.load_balancer.provider in const.AMPHORA_PROVIDERS and
318 CONF.load_balancer.test_with_ipv6))
319 def test_ipv4_UDP_RR_alt_monitor_member_create(self):
320 pool_id = self._listener_pool_create(
321 listener_protocol=const.UDP, pool_protocol=const.UDP,
322 algorithm=const.LB_ALGORITHM_ROUND_ROBIN)
323 self._test_member_create(4, pool_id, alternate_monitor=True)
324
325 @decorators.idempotent_id('bc0802dd-633f-42d4-8c6a-b4c70af29870')
326 # Skipping test for amphora driver until "UDP load balancers cannot mix
327 # protocol versions" (https://storyboard.openstack.org/#!/story/2003329) is
328 # fixed
329 @decorators.skip_because(
330 bug='2003329',
331 bug_type='storyboard',
332 condition=(CONF.load_balancer.provider in const.AMPHORA_PROVIDERS and
333 CONF.load_balancer.test_with_ipv6))
334 def test_ipv4_UDP_RR_member_create(self):
335 pool_id = self._listener_pool_create(
336 listener_protocol=const.UDP, pool_protocol=const.UDP,
337 algorithm=const.LB_ALGORITHM_ROUND_ROBIN)
338 self._test_member_create(4, pool_id)
339
340 @decorators.idempotent_id('0d9a8b32-0c13-49ea-8dd3-a124ec4ac6f9')
341 def test_ipv4_HTTP_SI_alt_monitor_member_create(self):
342 pool_id = self._listener_pool_create(
343 listener_protocol=const.HTTP, pool_protocol=const.HTTP,
344 algorithm=const.LB_ALGORITHM_SOURCE_IP)
345 self._test_member_create(4, pool_id, alternate_monitor=True)
346
347 @decorators.idempotent_id('57c52d0c-0a62-4988-a02e-2f9f8b440d08')
348 def test_ipv4_HTTP_SI_member_create(self):
349 pool_id = self._listener_pool_create(
350 listener_protocol=const.HTTP, pool_protocol=const.HTTP,
351 algorithm=const.LB_ALGORITHM_SOURCE_IP)
352 self._test_member_create(4, pool_id)
353
354 @decorators.idempotent_id('df427d31-9843-4840-9137-6b88c633d329')
355 def test_ipv4_HTTPS_SI_alt_monitor_member_create(self):
356 pool_id = self._listener_pool_create(
357 listener_protocol=const.HTTPS, pool_protocol=const.HTTPS,
358 algorithm=const.LB_ALGORITHM_SOURCE_IP)
359 self._test_member_create(4, pool_id, alternate_monitor=True)
360
361 @decorators.idempotent_id('e64c28f6-09f5-4fd8-a59e-bcf90975581a')
362 def test_ipv4_HTTPS_SI_member_create(self):
363 pool_id = self._listener_pool_create(
364 listener_protocol=const.HTTPS, pool_protocol=const.HTTPS,
365 algorithm=const.LB_ALGORITHM_SOURCE_IP)
366 self._test_member_create(4, pool_id)
367
368 @decorators.idempotent_id('5c32e2fd-9148-466c-b788-e11d7a48483b')
369 def test_ipv4_PROXY_SI_alt_monitor_member_create(self):
370 pool_id = self._listener_pool_create(
371 listener_protocol=const.TCP, pool_protocol=const.PROXY,
372 algorithm=const.LB_ALGORITHM_SOURCE_IP)
373 self._test_member_create(4, pool_id, alternate_monitor=True)
374
375 @decorators.idempotent_id('76435fb2-dcb3-4be2-ada9-2dbc375c100b')
376 def test_ipv4_PROXY_SI_member_create(self):
377 pool_id = self._listener_pool_create(
378 listener_protocol=const.TCP, pool_protocol=const.PROXY,
379 algorithm=const.LB_ALGORITHM_SOURCE_IP)
380 self._test_member_create(4, pool_id)
381
382 @decorators.idempotent_id('62db0223-1e44-4d6c-8499-9f72c86d30e3')
383 def test_ipv4_TCP_SI_alt_monitor_member_create(self):
384 pool_id = self._listener_pool_create(
385 listener_protocol=const.TCP, pool_protocol=const.TCP,
386 algorithm=const.LB_ALGORITHM_SOURCE_IP)
387 self._test_member_create(4, pool_id, alternate_monitor=True)
388
389 @decorators.idempotent_id('2da54523-cefc-4a44-ab07-c33ffe891bf0')
390 def test_ipv4_TCP_SI_member_create(self):
391 pool_id = self._listener_pool_create(
392 listener_protocol=const.TCP, pool_protocol=const.TCP,
393 algorithm=const.LB_ALGORITHM_SOURCE_IP)
394 self._test_member_create(4, pool_id)
395
396 @decorators.idempotent_id('9a298318-89a5-416f-b027-af5eda94f813')
397 # Skipping test for amphora driver until "UDP load balancers cannot mix
398 # protocol versions" (https://storyboard.openstack.org/#!/story/2003329) is
399 # fixed
400 @decorators.skip_because(
401 bug='2003329',
402 bug_type='storyboard',
403 condition=(CONF.load_balancer.provider in const.AMPHORA_PROVIDERS and
404 CONF.load_balancer.test_with_ipv6))
405 def test_ipv4_UDP_SI_alt_monitor_member_create(self):
406 pool_id = self._listener_pool_create(
407 listener_protocol=const.UDP, pool_protocol=const.UDP,
408 algorithm=const.LB_ALGORITHM_SOURCE_IP)
409 self._test_member_create(4, pool_id, alternate_monitor=True)
410
411 @decorators.idempotent_id('b0455c5e-3702-41d7-8069-6ce55563767c')
412 # Skipping test for amphora driver until "UDP load balancers cannot mix
413 # protocol versions" (https://storyboard.openstack.org/#!/story/2003329) is
414 # fixed
415 @decorators.skip_because(
416 bug='2003329',
417 bug_type='storyboard',
418 condition=(CONF.load_balancer.provider in const.AMPHORA_PROVIDERS and
419 CONF.load_balancer.test_with_ipv6))
420 def test_ipv4_UDP_SI_member_create(self):
421 pool_id = self._listener_pool_create(
422 listener_protocol=const.UDP, pool_protocol=const.UDP,
423 algorithm=const.LB_ALGORITHM_SOURCE_IP)
424 self._test_member_create(4, pool_id)
425
426 @decorators.idempotent_id('a2dbf216-a974-45e1-822d-859f76c89ed6')
427 def test_ipv4_HTTP_SIP_alt_monitor_member_create(self):
428 pool_id = self._listener_pool_create(
429 listener_protocol=const.HTTP, pool_protocol=const.HTTP,
430 algorithm=const.LB_ALGORITHM_SOURCE_IP_PORT)
431 self._test_member_create(4, pool_id, alternate_monitor=True)
432
433 @decorators.idempotent_id('926eeed9-ecf4-4d22-9417-ef7a7e0a7788')
434 def test_ipv4_HTTP_SIP_member_create(self):
435 pool_id = self._listener_pool_create(
436 listener_protocol=const.HTTP, pool_protocol=const.HTTP,
437 algorithm=const.LB_ALGORITHM_SOURCE_IP_PORT)
438 self._test_member_create(4, pool_id)
439
440 @decorators.idempotent_id('55da07bc-bf2c-4924-aba3-a03456843e14')
441 def test_ipv4_HTTPS_SIP_alt_monitor_member_create(self):
442 pool_id = self._listener_pool_create(
443 listener_protocol=const.HTTPS, pool_protocol=const.HTTPS,
444 algorithm=const.LB_ALGORITHM_SOURCE_IP_PORT)
445 self._test_member_create(4, pool_id, alternate_monitor=True)
446
447 @decorators.idempotent_id('6773a8bd-1c51-4040-84ba-1aa2b6c4280d')
448 def test_ipv4_HTTPS_SIP_member_create(self):
449 pool_id = self._listener_pool_create(
450 listener_protocol=const.HTTPS, pool_protocol=const.HTTPS,
451 algorithm=const.LB_ALGORITHM_SOURCE_IP_PORT)
452 self._test_member_create(4, pool_id)
453
454 @decorators.idempotent_id('ab462d7c-069d-4b55-b6a7-dd199bde65b3')
455 def test_ipv4_PROXY_SIP_alt_monitor_member_create(self):
456 pool_id = self._listener_pool_create(
457 listener_protocol=const.TCP, pool_protocol=const.PROXY,
458 algorithm=const.LB_ALGORITHM_SOURCE_IP_PORT)
459 self._test_member_create(4, pool_id, alternate_monitor=True)
460
461 @decorators.idempotent_id('b1f6f779-2535-4e47-add2-24561545ba59')
462 def test_ipv4_PROXY_SIP_member_create(self):
463 pool_id = self._listener_pool_create(
464 listener_protocol=const.TCP, pool_protocol=const.PROXY,
465 algorithm=const.LB_ALGORITHM_SOURCE_IP_PORT)
466 self._test_member_create(4, pool_id)
467
468 @decorators.idempotent_id('73673efc-5b70-4394-b831-1d59fe283e7d')
469 def test_ipv4_TCP_SIP_alt_monitor_member_create(self):
470 pool_id = self._listener_pool_create(
471 listener_protocol=const.TCP, pool_protocol=const.TCP,
472 algorithm=const.LB_ALGORITHM_SOURCE_IP_PORT)
473 self._test_member_create(4, pool_id, alternate_monitor=True)
474
475 @decorators.idempotent_id('0a08da1e-84f5-4068-84ec-1312b6b8bee3')
476 def test_ipv4_TCP_SIP_member_create(self):
477 pool_id = self._listener_pool_create(
478 listener_protocol=const.TCP, pool_protocol=const.TCP,
479 algorithm=const.LB_ALGORITHM_SOURCE_IP_PORT)
480 self._test_member_create(4, pool_id)
481
482 @decorators.idempotent_id('caf68a97-1911-466c-b392-50b946e2395c')
483 # Skipping test for amphora driver until "UDP load balancers cannot mix
484 # protocol versions" (https://storyboard.openstack.org/#!/story/2003329) is
485 # fixed
486 @decorators.skip_because(
487 bug='2003329',
488 bug_type='storyboard',
489 condition=(CONF.load_balancer.provider in const.AMPHORA_PROVIDERS and
490 CONF.load_balancer.test_with_ipv6))
491 def test_ipv4_UDP_SIP_alt_monitor_member_create(self):
492 pool_id = self._listener_pool_create(
493 listener_protocol=const.UDP, pool_protocol=const.UDP,
494 algorithm=const.LB_ALGORITHM_SOURCE_IP_PORT)
495 self._test_member_create(4, pool_id, alternate_monitor=True)
496
497 @decorators.idempotent_id('bb750dc5-73a8-4722-bf3b-cdafaefe7914')
498 # Skipping test for amphora driver until "UDP load balancers cannot mix
499 # protocol versions" (https://storyboard.openstack.org/#!/story/2003329) is
500 # fixed
501 @decorators.skip_because(
502 bug='2003329',
503 bug_type='storyboard',
504 condition=(CONF.load_balancer.provider in const.AMPHORA_PROVIDERS and
505 CONF.load_balancer.test_with_ipv6))
506 def test_ipv4_UDP_SIP_member_create(self):
507 pool_id = self._listener_pool_create(
508 listener_protocol=const.UDP, pool_protocol=const.UDP,
509 algorithm=const.LB_ALGORITHM_SOURCE_IP_PORT)
510 self._test_member_create(4, pool_id)
511
512 @decorators.idempotent_id('cd894c4f-2256-405f-aa6e-2f77973c749a')
513 def test_ipv6_HTTP_LC_alt_monitor_member_create(self):
514 pool_id = self._listener_pool_create(
515 listener_protocol=const.HTTP, pool_protocol=const.HTTP,
516 algorithm=const.LB_ALGORITHM_LEAST_CONNECTIONS)
517 self._test_member_create(6, pool_id, alternate_monitor=True)
518
519 @decorators.idempotent_id('3bbb8554-f757-4673-92e3-8593eef83f19')
520 def test_ipv6_HTTP_LC_member_create(self):
521 pool_id = self._listener_pool_create(
522 listener_protocol=const.HTTP, pool_protocol=const.HTTP,
523 algorithm=const.LB_ALGORITHM_LEAST_CONNECTIONS)
524 self._test_member_create(6, pool_id)
525
526 @decorators.idempotent_id('b1994c5d-74b8-44be-b9e5-5e18e9219b61')
527 def test_ipv6_HTTP_LC_backup_member_create(self):
528 if not self.mem_member_client.is_version_supported(
529 self.api_version, '2.1'):
530 raise self.skipException('Backup member support is only available '
531 'in Octavia API version 2.1 or newer')
532 pool_id = self._listener_pool_create(
533 listener_protocol=const.HTTP, pool_protocol=const.HTTP,
534 algorithm=const.LB_ALGORITHM_LEAST_CONNECTIONS)
535 self._test_member_create(6, pool_id, backup_member=True)
536
537 @decorators.idempotent_id('6056724b-d046-497a-ae31-c02af67d4fbb')
538 def test_ipv6_HTTPS_LC_alt_monitor_member_create(self):
539 pool_id = self._listener_pool_create(
540 listener_protocol=const.HTTPS, pool_protocol=const.HTTPS,
541 algorithm=const.LB_ALGORITHM_LEAST_CONNECTIONS)
542 self._test_member_create(6, pool_id, alternate_monitor=True)
543
544 @decorators.idempotent_id('354e44d3-db08-4ba9-8e3e-8c3210542a86')
545 def test_ipv6_HTTPS_LC_member_create(self):
546 pool_id = self._listener_pool_create(
547 listener_protocol=const.HTTPS, pool_protocol=const.HTTPS,
548 algorithm=const.LB_ALGORITHM_LEAST_CONNECTIONS)
549 self._test_member_create(6, pool_id)
550
551 @decorators.idempotent_id('0f8b924e-dd0b-44f9-92b6-8f3dfb0a720c')
552 def test_ipv6_PROXY_LC_alt_monitor_member_create(self):
553 pool_id = self._listener_pool_create(
554 listener_protocol=const.TCP, pool_protocol=const.PROXY,
555 algorithm=const.LB_ALGORITHM_LEAST_CONNECTIONS)
556 self._test_member_create(6, pool_id, alternate_monitor=True)
557
558 @decorators.idempotent_id('d1efbfab-b674-4b78-8014-7ecf7ab464ac')
559 def test_ipv6_PROXY_LC_member_create(self):
560 pool_id = self._listener_pool_create(
561 listener_protocol=const.TCP, pool_protocol=const.PROXY,
562 algorithm=const.LB_ALGORITHM_LEAST_CONNECTIONS)
563 self._test_member_create(6, pool_id)
564
565 @decorators.idempotent_id('699f1c0d-65ae-40d7-9abd-2cef0a1560b9')
566 def test_ipv6_TCP_LC_alt_monitor_member_create(self):
567 pool_id = self._listener_pool_create(
568 listener_protocol=const.TCP, pool_protocol=const.TCP,
569 algorithm=const.LB_ALGORITHM_LEAST_CONNECTIONS)
570 self._test_member_create(6, pool_id, alternate_monitor=True)
571
572 @decorators.idempotent_id('595255f9-f595-43e7-a398-80dd76719aa8')
573 def test_ipv6_TCP_LC_member_create(self):
574 pool_id = self._listener_pool_create(
575 listener_protocol=const.TCP, pool_protocol=const.TCP,
576 algorithm=const.LB_ALGORITHM_LEAST_CONNECTIONS)
577 self._test_member_create(6, pool_id)
578
579 @decorators.idempotent_id('0c2c2d5f-9602-4602-82e7-94a1393c295d')
580 # Skipping test for amphora driver until "UDP load balancers cannot mix
581 # protocol versions" (https://storyboard.openstack.org/#!/story/2003329) is
582 # fixed
583 @decorators.skip_because(
584 bug='2003329',
585 bug_type='storyboard',
586 condition=(CONF.load_balancer.provider in const.AMPHORA_PROVIDERS and
587 not CONF.load_balancer.test_with_ipv6))
588 def test_ipv6_UDP_LC_alt_monitor_member_create(self):
589 pool_id = self._listener_pool_create(
590 listener_protocol=const.UDP, pool_protocol=const.UDP,
591 algorithm=const.LB_ALGORITHM_LEAST_CONNECTIONS)
592 self._test_member_create(6, pool_id, alternate_monitor=True)
593
594 @decorators.idempotent_id('d41f5b46-ba06-42bf-a320-0fda106a7543')
595 # Skipping test for amphora driver until "UDP load balancers cannot mix
596 # protocol versions" (https://storyboard.openstack.org/#!/story/2003329) is
597 # fixed
598 @decorators.skip_because(
599 bug='2003329',
600 bug_type='storyboard',
601 condition=(CONF.load_balancer.provider in const.AMPHORA_PROVIDERS and
602 not CONF.load_balancer.test_with_ipv6))
603 def test_ipv6_UDP_LC_member_create(self):
604 pool_id = self._listener_pool_create(
605 listener_protocol=const.UDP, pool_protocol=const.UDP,
606 algorithm=const.LB_ALGORITHM_LEAST_CONNECTIONS)
607 self._test_member_create(6, pool_id)
608
609 @decorators.idempotent_id('141944cc-5e2c-4e83-88f8-f61a6797c9b7')
610 def test_ipv6_HTTP_RR_alt_monitor_member_create(self):
611 pool_id = self._listener_pool_create(
612 listener_protocol=const.HTTP, pool_protocol=const.HTTP,
613 algorithm=const.LB_ALGORITHM_ROUND_ROBIN)
614 self._test_member_create(6, pool_id, alternate_monitor=True)
615
616 @decorators.idempotent_id('883db951-adb1-4e05-8369-99f38fde6b3c')
617 def test_ipv6_HTTP_RR_member_create(self):
618 pool_id = self._listener_pool_create(
619 listener_protocol=const.HTTP, pool_protocol=const.HTTP,
620 algorithm=const.LB_ALGORITHM_ROUND_ROBIN)
621 self._test_member_create(6, pool_id)
622
623 @decorators.idempotent_id('364ba4b9-825a-4f92-9bf2-8d76bcba0288')
624 def test_ipv6_HTTPS_RR_alt_monitor_member_create(self):
625 pool_id = self._listener_pool_create(
626 listener_protocol=const.HTTPS, pool_protocol=const.HTTPS,
627 algorithm=const.LB_ALGORITHM_ROUND_ROBIN)
628 self._test_member_create(6, pool_id, alternate_monitor=True)
629
630 @decorators.idempotent_id('70ba1deb-d644-437f-af80-4299461b20af')
631 def test_ipv6_HTTPS_RR_member_create(self):
632 pool_id = self._listener_pool_create(
633 listener_protocol=const.HTTPS, pool_protocol=const.HTTPS,
634 algorithm=const.LB_ALGORITHM_ROUND_ROBIN)
635 self._test_member_create(6, pool_id)
636
637 @decorators.idempotent_id('06facdb2-5b7e-4e8b-810d-8f829c619a6d')
638 def test_ipv6_PROXY_RR_alt_monitor_member_create(self):
639 pool_id = self._listener_pool_create(
640 listener_protocol=const.TCP, pool_protocol=const.PROXY,
641 algorithm=const.LB_ALGORITHM_ROUND_ROBIN)
642 self._test_member_create(6, pool_id, alternate_monitor=True)
643
644 @decorators.idempotent_id('4ec5a74b-06bd-4005-8fcc-25d1bced4807')
645 def test_ipv6_PROXY_RR_member_create(self):
646 pool_id = self._listener_pool_create(
647 listener_protocol=const.TCP, pool_protocol=const.PROXY,
648 algorithm=const.LB_ALGORITHM_ROUND_ROBIN)
649 self._test_member_create(6, pool_id)
650
651 @decorators.idempotent_id('22600457-ffe5-44a0-90b0-da4f48051023')
652 def test_ipv6_TCP_RR_alt_monitor_member_create(self):
653 pool_id = self._listener_pool_create(
654 listener_protocol=const.TCP, pool_protocol=const.TCP,
655 algorithm=const.LB_ALGORITHM_ROUND_ROBIN)
656 self._test_member_create(6, pool_id, alternate_monitor=True)
657
658 @decorators.idempotent_id('57e6f861-5a55-43a5-9cae-a966bd2a48eb')
659 def test_ipv6_TCP_RR_member_create(self):
660 pool_id = self._listener_pool_create(
661 listener_protocol=const.TCP, pool_protocol=const.TCP,
662 algorithm=const.LB_ALGORITHM_ROUND_ROBIN)
663 self._test_member_create(6, pool_id)
664
665 @decorators.idempotent_id('4cddcf8a-566e-4a5a-bf81-99026b17f676')
666 # Skipping test for amphora driver until "UDP load balancers cannot mix
667 # protocol versions" (https://storyboard.openstack.org/#!/story/2003329) is
668 # fixed
669 @decorators.skip_because(
670 bug='2003329',
671 bug_type='storyboard',
672 condition=(CONF.load_balancer.provider in const.AMPHORA_PROVIDERS and
673 not CONF.load_balancer.test_with_ipv6))
674 def test_ipv6_UDP_RR_alt_monitor_member_create(self):
675 pool_id = self._listener_pool_create(
676 listener_protocol=const.UDP, pool_protocol=const.UDP,
677 algorithm=const.LB_ALGORITHM_ROUND_ROBIN)
678 self._test_member_create(6, pool_id, alternate_monitor=True)
679
680 @decorators.idempotent_id('26547c9a-6bbc-429a-9436-e94f2930b9e1')
681 # Skipping test for amphora driver until "UDP load balancers cannot mix
682 # protocol versions" (https://storyboard.openstack.org/#!/story/2003329) is
683 # fixed
684 @decorators.skip_because(
685 bug='2003329',
686 bug_type='storyboard',
687 condition=(CONF.load_balancer.provider in const.AMPHORA_PROVIDERS and
688 not CONF.load_balancer.test_with_ipv6))
689 def test_ipv6_UDP_RR_member_create(self):
690 pool_id = self._listener_pool_create(
691 listener_protocol=const.UDP, pool_protocol=const.UDP,
692 algorithm=const.LB_ALGORITHM_ROUND_ROBIN)
693 self._test_member_create(6, pool_id)
694
695 @decorators.idempotent_id('6759674b-dca0-4a48-b166-3f87dc1cc727')
696 def test_ipv6_HTTP_SI_alt_monitor_member_create(self):
697 pool_id = self._listener_pool_create(
698 listener_protocol=const.HTTP, pool_protocol=const.HTTP,
699 algorithm=const.LB_ALGORITHM_SOURCE_IP)
700 self._test_member_create(6, pool_id, alternate_monitor=True)
701
702 @decorators.idempotent_id('683d9ef4-6af3-48e2-aba4-9f404d493467')
703 def test_ipv6_HTTP_SI_member_create(self):
704 pool_id = self._listener_pool_create(
705 listener_protocol=const.HTTP, pool_protocol=const.HTTP,
706 algorithm=const.LB_ALGORITHM_SOURCE_IP)
707 self._test_member_create(6, pool_id)
708
709 @decorators.idempotent_id('3d308996-3522-4c91-9bfd-48fedc2ed2f2')
710 def test_ipv6_HTTPS_SI_alt_monitor_member_create(self):
711 pool_id = self._listener_pool_create(
712 listener_protocol=const.HTTPS, pool_protocol=const.HTTPS,
713 algorithm=const.LB_ALGORITHM_SOURCE_IP)
714 self._test_member_create(6, pool_id, alternate_monitor=True)
715
716 @decorators.idempotent_id('dc26ce07-d580-4a55-b7cd-1b4f09c13572')
717 def test_ipv6_HTTPS_SI_member_create(self):
718 pool_id = self._listener_pool_create(
719 listener_protocol=const.HTTPS, pool_protocol=const.HTTPS,
720 algorithm=const.LB_ALGORITHM_SOURCE_IP)
721 self._test_member_create(6, pool_id)
722
723 @decorators.idempotent_id('56944f91-bf4b-4e9a-9b05-6207e8184c75')
724 def test_ipv6_PROXY_SI_alt_monitor_member_create(self):
725 pool_id = self._listener_pool_create(
726 listener_protocol=const.TCP, pool_protocol=const.PROXY,
727 algorithm=const.LB_ALGORITHM_SOURCE_IP)
728 self._test_member_create(6, pool_id, alternate_monitor=True)
729
730 @decorators.idempotent_id('e8f4eb38-8e8b-485a-b70a-b1679ad58b66')
731 def test_ipv6_PROXY_SI_member_create(self):
732 pool_id = self._listener_pool_create(
733 listener_protocol=const.TCP, pool_protocol=const.PROXY,
734 algorithm=const.LB_ALGORITHM_SOURCE_IP)
735 self._test_member_create(6, pool_id)
736
737 @decorators.idempotent_id('fc0e77b1-e115-4ec7-80e3-c00d79932549')
738 def test_ipv6_TCP_SI_alt_monitor_member_create(self):
739 pool_id = self._listener_pool_create(
740 listener_protocol=const.TCP, pool_protocol=const.TCP,
741 algorithm=const.LB_ALGORITHM_SOURCE_IP)
742 self._test_member_create(6, pool_id, alternate_monitor=True)
743
744 @decorators.idempotent_id('66ddafd2-ace3-43ea-b78b-78b6b0a4d9eb')
745 def test_ipv6_TCP_SI_member_create(self):
746 pool_id = self._listener_pool_create(
747 listener_protocol=const.TCP, pool_protocol=const.TCP,
748 algorithm=const.LB_ALGORITHM_SOURCE_IP)
749 self._test_member_create(6, pool_id)
750
751 @decorators.idempotent_id('ccfc1283-9e8e-4aa5-a5d3-1d18d57bec65')
752 # Skipping test for amphora driver until "UDP load balancers cannot mix
753 # protocol versions" (https://storyboard.openstack.org/#!/story/2003329) is
754 # fixed
755 @decorators.skip_because(
756 bug='2003329',
757 bug_type='storyboard',
758 condition=(CONF.load_balancer.provider in const.AMPHORA_PROVIDERS and
759 not CONF.load_balancer.test_with_ipv6))
760 def test_ipv6_UDP_SI_alt_monitor_member_create(self):
761 pool_id = self._listener_pool_create(
762 listener_protocol=const.UDP, pool_protocol=const.UDP,
763 algorithm=const.LB_ALGORITHM_SOURCE_IP)
764 self._test_member_create(6, pool_id, alternate_monitor=True)
765
766 @decorators.idempotent_id('b62c8562-fdbb-4989-a5ae-d9e1c1b76cd5')
767 # Skipping test for amphora driver until "UDP load balancers cannot mix
768 # protocol versions" (https://storyboard.openstack.org/#!/story/2003329) is
769 # fixed
770 @decorators.skip_because(
771 bug='2003329',
772 bug_type='storyboard',
773 condition=(CONF.load_balancer.provider in const.AMPHORA_PROVIDERS and
774 not CONF.load_balancer.test_with_ipv6))
775 def test_ipv6_UDP_SI_member_create(self):
776 pool_id = self._listener_pool_create(
777 listener_protocol=const.UDP, pool_protocol=const.UDP,
778 algorithm=const.LB_ALGORITHM_SOURCE_IP)
779 self._test_member_create(6, pool_id)
780
781 @decorators.idempotent_id('d816d324-2434-4812-9b3e-a3f0d4949008')
782 def test_ipv6_HTTP_SIP_alt_monitor_member_create(self):
783 pool_id = self._listener_pool_create(
784 listener_protocol=const.HTTP, pool_protocol=const.HTTP,
785 algorithm=const.LB_ALGORITHM_SOURCE_IP_PORT)
786 self._test_member_create(6, pool_id, alternate_monitor=True)
787
788 @decorators.idempotent_id('d4cfe315-b6d6-4940-8ff6-5f5252028eec')
789 def test_ipv6_HTTP_SIP_member_create(self):
790 pool_id = self._listener_pool_create(
791 listener_protocol=const.HTTP, pool_protocol=const.HTTP,
792 algorithm=const.LB_ALGORITHM_SOURCE_IP_PORT)
793 self._test_member_create(6, pool_id)
794
795 @decorators.idempotent_id('05684ab0-dff3-41aa-8b42-7f95fd6aa4ab')
796 def test_ipv6_HTTPS_SIP_alt_monitor_member_create(self):
797 pool_id = self._listener_pool_create(
798 listener_protocol=const.HTTPS, pool_protocol=const.HTTPS,
799 algorithm=const.LB_ALGORITHM_SOURCE_IP_PORT)
800 self._test_member_create(6, pool_id, alternate_monitor=True)
801
802 @decorators.idempotent_id('ed42872c-1ffc-4210-9f69-5f7eb8ec732f')
803 def test_ipv6_HTTPS_SIP_member_create(self):
804 pool_id = self._listener_pool_create(
805 listener_protocol=const.HTTPS, pool_protocol=const.HTTPS,
806 algorithm=const.LB_ALGORITHM_SOURCE_IP_PORT)
807 self._test_member_create(6, pool_id)
808
809 @decorators.idempotent_id('ab87132f-5a0e-40a1-9498-9883780d31a9')
810 def test_ipv6_PROXY_SIP_alt_monitor_member_create(self):
811 pool_id = self._listener_pool_create(
812 listener_protocol=const.TCP, pool_protocol=const.PROXY,
813 algorithm=const.LB_ALGORITHM_SOURCE_IP_PORT)
814 self._test_member_create(6, pool_id, alternate_monitor=True)
815
816 @decorators.idempotent_id('227d7f40-a224-4e67-8844-2d28abc5171e')
817 def test_ipv6_PROXY_SIP_member_create(self):
818 pool_id = self._listener_pool_create(
819 listener_protocol=const.TCP, pool_protocol=const.PROXY,
820 algorithm=const.LB_ALGORITHM_SOURCE_IP_PORT)
821 self._test_member_create(6, pool_id)
822
823 @decorators.idempotent_id('b8394de8-a898-4cab-aa0c-f3168d702ee0')
824 def test_ipv6_TCP_SIP_alt_monitor_member_create(self):
825 pool_id = self._listener_pool_create(
826 listener_protocol=const.TCP, pool_protocol=const.TCP,
827 algorithm=const.LB_ALGORITHM_SOURCE_IP_PORT)
828 self._test_member_create(6, pool_id, alternate_monitor=True)
829
830 @decorators.idempotent_id('7a86e00b-90bf-4fd3-8636-ae7264929106')
831 def test_ipv6_TCP_SIP_member_create(self):
832 pool_id = self._listener_pool_create(
833 listener_protocol=const.TCP, pool_protocol=const.TCP,
834 algorithm=const.LB_ALGORITHM_SOURCE_IP_PORT)
835 self._test_member_create(6, pool_id)
836
837 @decorators.idempotent_id('5abdfbcd-d1cd-4e6a-b98f-79afea442ad8')
838 # Skipping test for amphora driver until "UDP load balancers cannot mix
839 # protocol versions" (https://storyboard.openstack.org/#!/story/2003329) is
840 # fixed
841 @decorators.skip_because(
842 bug='2003329',
843 bug_type='storyboard',
844 condition=(CONF.load_balancer.provider in const.AMPHORA_PROVIDERS and
845 not CONF.load_balancer.test_with_ipv6))
846 def test_ipv6_UDP_SIP_alt_monitor_member_create(self):
847 pool_id = self._listener_pool_create(
848 listener_protocol=const.UDP, pool_protocol=const.UDP,
849 algorithm=const.LB_ALGORITHM_SOURCE_IP_PORT)
850 self._test_member_create(6, pool_id, alternate_monitor=True)
851
852 @decorators.idempotent_id('63f558b4-d2f8-4e4c-828b-3651e50844b7')
853 # Skipping test for amphora driver until "UDP load balancers cannot mix
854 # protocol versions" (https://storyboard.openstack.org/#!/story/2003329) is
855 # fixed
856 @decorators.skip_because(
857 bug='2003329',
858 bug_type='storyboard',
859 condition=(CONF.load_balancer.provider in const.AMPHORA_PROVIDERS and
860 not CONF.load_balancer.test_with_ipv6))
861 def test_ipv6_UDP_SIP_member_create(self):
862 pool_id = self._listener_pool_create(
863 listener_protocol=const.UDP, pool_protocol=const.UDP,
864 algorithm=const.LB_ALGORITHM_SOURCE_IP_PORT)
865 self._test_member_create(6, pool_id)
866
867 def _test_member_create(self, ip_version, pool_id,
868 alternate_monitor=False, backup_member=False):
869 """Tests member create and basic show APIs.
870
871 * Tests that users without the loadbalancer member role cannot
872 create members.
873 * Create a fully populated member or backup member.
874 * If driver doesnt support Monitors, allow to create without monitor
875 * Show member details.
876 * Validate the show reflects the requested values.
877 """
878 if ip_version == 6 and not CONF.load_balancer.test_with_ipv6:
879 raise testtools.TestCase.skipException(
880 'Skipping this test as test_with_ipv6 is not "True" in '
881 'the tempest.conf [load_balancer] section. Testing with '
882 'IPv6 is disabled. :-(')
883
884 if ip_version == 4:
885 member_address = '192.0.2.1'
886 member_monitor_address = '192.0.2.2'
887 else:
888 member_address = '2001:db8:0:0:0:0:0:1'
889 member_monitor_address = '2001:db8:0:0:0:0:0:2'
890
891 member_name = data_utils.rand_name("lb_member_member1-create")
892 member_kwargs = {
893 const.NAME: member_name,
894 const.ADMIN_STATE_UP: True,
895 const.POOL_ID: pool_id,
896 const.ADDRESS: member_address,
897 const.PROTOCOL_PORT: self.member_port.increment(),
898 const.WEIGHT: 50,
899 }
900
901 if alternate_monitor:
902 member_kwargs[const.MONITOR_ADDRESS] = member_monitor_address
903 member_kwargs[const.MONITOR_PORT] = 8080
904
905 if self.mem_member_client.is_version_supported(
906 self.api_version, '2.1'):
907 member_kwargs.update({
908 const.BACKUP: backup_member,
909 })
910
911 if self.mem_member_client.is_version_supported(
912 self.api_version, '2.5'):
913 member_tags = ["hello", "world"]
914 member_kwargs.update({
915 const.TAGS: member_tags
916 })
917
918 if self.lb_member_vip_subnet:
919 member_kwargs[const.SUBNET_ID] = self.lb_member_vip_subnet[
920 const.ID]
921
922 # Test that a user without the load balancer role cannot
923 # create a member
924 if CONF.load_balancer.RBAC_test_type == const.ADVANCED:
925 member_client = self.os_primary.load_balancer_v2.MemberClient()
926 self.assertRaises(
927 exceptions.Forbidden,
928 member_client.create_member,
929 **member_kwargs)
930
931 # Test that a user without the loadbalancer role cannot
932 # create a member.
933 expected_allowed = ['os_admin', 'os_roles_lb_admin',
934 'os_roles_lb_member']
935 self.check_create_RBAC_enforcement(
936 'MemberClient', 'create_member',
937 expected_allowed,
938 status_method=self.mem_lb_client.show_loadbalancer,
939 obj_id=self.lb_id, **member_kwargs)
940
941 member = self.mem_member_client.create_member(**member_kwargs)
942
943 self.addCleanup(
944 self.mem_member_client.cleanup_member,
945 member[const.ID], pool_id=pool_id,
946 lb_client=self.mem_lb_client, lb_id=self.lb_id)
947
948 waiters.wait_for_status(
949 self.mem_lb_client.show_loadbalancer, self.lb_id,
950 const.PROVISIONING_STATUS, const.ACTIVE,
951 CONF.load_balancer.build_interval,
952 CONF.load_balancer.build_timeout)
953 member = waiters.wait_for_status(
954 self.mem_member_client.show_member,
955 member[const.ID], const.PROVISIONING_STATUS,
956 const.ACTIVE,
957 CONF.load_balancer.build_interval,
958 CONF.load_balancer.build_timeout,
959 pool_id=pool_id)
960
961 parser.parse(member[const.CREATED_AT])
962 parser.parse(member[const.UPDATED_AT])
963 UUID(member[const.ID])
964 self.assertEqual(const.NO_MONITOR, member[const.OPERATING_STATUS])
965
966 equal_items = [const.NAME, const.ADMIN_STATE_UP, const.ADDRESS,
967 const.PROTOCOL_PORT, const.WEIGHT]
968 if self.mem_member_client.is_version_supported(
969 self.api_version, '2.1'):
970 equal_items.append(const.BACKUP)
971
972 if self.mem_member_client.is_version_supported(
973 self.api_version, '2.5'):
974 self.assertCountEqual(member_kwargs[const.TAGS],
975 member[const.TAGS])
976
977 if alternate_monitor:
978 equal_items += [const.MONITOR_ADDRESS, const.MONITOR_PORT]
979
980 if const.SUBNET_ID in member_kwargs:
981 equal_items.append(const.SUBNET_ID)
982 else:
983 self.assertIsNone(member.get(const.SUBNET_ID))
984
985 for item in equal_items:
986 self.assertEqual(member_kwargs[item], member[item])
987
988 @decorators.skip_because(bug='2045803')
989 @decorators.idempotent_id('b982188a-d55f-438a-a1b2-224f0ec8ff12')
990 def test_HTTP_LC_backup_member_list(self):
991 if not self.mem_member_client.is_version_supported(
992 self.api_version, '2.1'):
993 raise self.skipException('Backup member support is only available '
994 'in Octavia API version 2.1 or newer')
995 self._test_member_list(const.HTTP,
996 const.LB_ALGORITHM_LEAST_CONNECTIONS,
997 backup_member=True)
998
999 @decorators.idempotent_id('fcc5c6cd-d1c2-4a49-8d26-2268608e59a6')
1000 def test_HTTP_LC_member_list(self):
1001 self._test_member_list(const.HTTP,
1002 const.LB_ALGORITHM_LEAST_CONNECTIONS)
1003
1004 @decorators.idempotent_id('33450ca2-db09-451a-bd46-6f260bf520f5')
1005 def test_HTTPS_LC_member_list(self):
1006 self._test_member_list(const.HTTPS,
1007 const.LB_ALGORITHM_LEAST_CONNECTIONS)
1008
1009 @decorators.idempotent_id('c17241d4-5cff-41e2-9742-047647d61546')
1010 def test_PROXY_LC_member_list(self):
1011 self._test_member_list(const.PROXY,
1012 const.LB_ALGORITHM_LEAST_CONNECTIONS)
1013
1014 @decorators.idempotent_id('d1300e9a-64ba-4d02-baf6-2523439b80d7')
1015 def test_TCP_LC_member_list(self):
1016 self._test_member_list(const.TCP,
1017 const.LB_ALGORITHM_LEAST_CONNECTIONS)
1018
1019 @decorators.idempotent_id('dffc1dfb-7506-4f81-b1e5-5835b9690079')
1020 def test_UDP_LC_member_list(self):
1021 self._test_member_list(const.UDP,
1022 const.LB_ALGORITHM_LEAST_CONNECTIONS)
1023
1024 @decorators.idempotent_id('9ce7ad78-915b-42ce-b0d8-44d88a929f3d')
1025 def test_HTTP_RR_member_list(self):
1026 self._test_member_list(const.HTTP,
1027 const.LB_ALGORITHM_ROUND_ROBIN)
1028
1029 @decorators.idempotent_id('8f6362a1-d98b-4696-b88d-41e1eb4a9f70')
1030 def test_HTTPS_RR_member_list(self):
1031 self._test_member_list(const.HTTPS,
1032 const.LB_ALGORITHM_ROUND_ROBIN)
1033
1034 @decorators.idempotent_id('ce4109f8-3bad-4965-95ec-7170519e4a3f')
1035 def test_PROXY_RR_member_list(self):
1036 self._test_member_list(const.PROXY,
1037 const.LB_ALGORITHM_ROUND_ROBIN)
1038
1039 @decorators.idempotent_id('5c35df5d-8951-4506-905b-502f623cc9e4')
1040 def test_TCP_RR_member_list(self):
1041 self._test_member_list(const.TCP,
1042 const.LB_ALGORITHM_ROUND_ROBIN)
1043
1044 @decorators.idempotent_id('c7de7d31-2910-4864-84df-61a883e916fb')
1045 def test_UDP_RR_member_list(self):
1046 self._test_member_list(const.UDP,
1047 const.LB_ALGORITHM_ROUND_ROBIN)
1048
1049 @decorators.idempotent_id('0d142f26-c9e4-45bf-8cd7-1f5659301047')
1050 def test_HTTP_SI_member_list(self):
1051 self._test_member_list(const.HTTP,
1052 const.LB_ALGORITHM_SOURCE_IP)
1053
1054 @decorators.idempotent_id('a2be8c21-c7b1-4c1d-ab39-43042bf75a19')
1055 def test_HTTPS_SI_member_list(self):
1056 self._test_member_list(const.HTTPS,
1057 const.LB_ALGORITHM_SOURCE_IP)
1058
1059 @decorators.idempotent_id('1ab3978b-8a37-45d3-8e2c-aab4c2187d43')
1060 def test_PROXY_SI_member_list(self):
1061 self._test_member_list(const.PROXY,
1062 const.LB_ALGORITHM_SOURCE_IP)
1063
1064 @decorators.idempotent_id('2da08931-bc4c-4339-b16a-43d40ca7734d')
1065 def test_TCP_SI_member_list(self):
1066 self._test_member_list(const.TCP,
1067 const.LB_ALGORITHM_SOURCE_IP)
1068
1069 @decorators.idempotent_id('ea12a6bc-6267-4790-b2b3-cbd6a146533b')
1070 def test_UDP_SI_member_list(self):
1071 self._test_member_list(const.UDP,
1072 const.LB_ALGORITHM_SOURCE_IP)
1073
1074 @decorators.idempotent_id('2f9d0974-2e55-49c1-b83a-8bdd6dfdb46c')
1075 def test_HTTP_SIP_member_list(self):
1076 self._test_member_list(const.HTTP,
1077 const.LB_ALGORITHM_SOURCE_IP_PORT)
1078
1079 @decorators.idempotent_id('d31c5b8b-7ec1-4e78-a821-30e9a1e05139')
1080 def test_HTTPS_SIP_member_list(self):
1081 self._test_member_list(const.HTTPS,
1082 const.LB_ALGORITHM_SOURCE_IP_PORT)
1083
1084 @decorators.idempotent_id('15f8690b-f345-413c-9b4e-af39d546fbec')
1085 def test_PROXY_SIP_member_list(self):
1086 self._test_member_list(const.PROXY,
1087 const.LB_ALGORITHM_SOURCE_IP_PORT)
1088
1089 @decorators.idempotent_id('db5769ce-f4b0-4a0f-92a7-4eeed66b6730')
1090 def test_TCP_SIP_member_list(self):
1091 self._test_member_list(const.TCP,
1092 const.LB_ALGORITHM_SOURCE_IP_PORT)
1093
1094 @decorators.idempotent_id('638811fa-26ce-44f3-8ac7-29cf1ef41838')
1095 def test_UDP_SIP_member_list(self):
1096 self._test_member_list(const.UDP,
1097 const.LB_ALGORITHM_SOURCE_IP_PORT)
1098
1099 def _test_member_list(self, pool_protocol, algorithm, backup_member=False):
1100 """Tests member list API and field filtering.
1101
1102 * Create a clean pool.
1103 * Create three members (one backup member if backup_member is True).
1104 * Validates that other accounts cannot list the members.
1105 * List the members using the default sort order.
1106 * List the members using descending sort order.
1107 * List the members using ascending sort order.
1108 * List the members returning one field at a time.
1109 * List the members returning two fields.
1110 * List the members filtering to one of the three.
1111 * List the members filtered, one field, and sorted.
1112 """
1113 # IDs of members created in the test
1114 test_ids = []
1115
1116 if (algorithm == const.LB_ALGORITHM_SOURCE_IP_PORT and not
1117 self.mem_listener_client.is_version_supported(
1118 self.api_version, '2.13')):
1119 raise testtools.TestCase.skipException(
1120 'Skipping this test as load balancing algorithm '
1121 'SOURCE_IP_PORT requires API version 2.13 or newer.')
1122 if (pool_protocol == const.UDP and
1123 not self.mem_listener_client.is_version_supported(
1124 self.api_version, '2.1')):
1125 raise self.skipException('UDP support is only available '
1126 'in Octavia API version 2.1 or newer')
1127
1128 pool_name = data_utils.rand_name("lb_member_pool2_member-list")
1129 # This is a special case as the reference driver does not support
1130 # SOURCE-IP-PORT. Since it runs with not_implemented_is_error, we must
1131 # handle this test case special.
1132 try:
1133 pool = self.mem_pool_client.create_pool(
1134 name=pool_name, loadbalancer_id=self.lb_id,
1135 protocol=pool_protocol,
1136 lb_algorithm=algorithm)
1137 except exceptions.NotImplemented as e:
1138 if algorithm != const.LB_ALGORITHM_SOURCE_IP_PORT:
1139 raise
1140 message = ("The configured provider driver '{driver}' "
1141 "does not support a feature required for this "
1142 "test.".format(driver=CONF.load_balancer.provider))
1143 if hasattr(e, 'resp_body'):
1144 message = e.resp_body.get('faultstring', message)
1145 raise testtools.TestCase.skipException(message)
1146
1147 pool_id = pool[const.ID]
1148 self.addCleanup(
1149 self.mem_pool_client.cleanup_pool, pool_id,
1150 lb_client=self.mem_lb_client, lb_id=self.lb_id)
1151
1152 waiters.wait_for_status(self.mem_lb_client.show_loadbalancer,
1153 self.lb_id,
1154 const.PROVISIONING_STATUS,
1155 const.ACTIVE,
1156 CONF.load_balancer.build_interval,
1157 CONF.load_balancer.build_timeout)
1158
1159 member1_name = data_utils.rand_name("lb_member_member2-list")
1160 member1_kwargs = {
1161 const.POOL_ID: pool_id,
1162 const.NAME: member1_name,
1163 const.ADMIN_STATE_UP: True,
1164 const.ADDRESS: '192.0.2.1',
1165 const.PROTOCOL_PORT: 101,
1166 }
1167
1168 if backup_member:
1169 member1_kwargs[const.BACKUP] = True
1170
1171 if self.mem_member_client.is_version_supported(
1172 self.api_version, '2.5'):
1173 member1_tags = ["English", "Mathematics",
1174 "Marketing", "Creativity"]
1175 member1_kwargs.update({const.TAGS: member1_tags})
1176
1177 member1 = self.mem_member_client.create_member(
1178 **member1_kwargs)
1179 self.addCleanup(
1180 self.mem_member_client.cleanup_member,
1181 member1[const.ID], pool_id=pool_id,
1182 lb_client=self.mem_lb_client, lb_id=self.lb_id)
1183 member1 = waiters.wait_for_status(
1184 self.mem_member_client.show_member, member1[const.ID],
1185 const.PROVISIONING_STATUS, const.ACTIVE,
1186 CONF.load_balancer.build_interval,
1187 CONF.load_balancer.build_timeout,
1188 pool_id=pool_id)
1189 waiters.wait_for_status(self.mem_lb_client.show_loadbalancer,
1190 self.lb_id,
1191 const.PROVISIONING_STATUS,
1192 const.ACTIVE,
1193 CONF.load_balancer.check_interval,
1194 CONF.load_balancer.check_timeout)
1195 test_ids.append(member1[const.ID])
1196 # Time resolution for created_at is only to the second, and we need to
1197 # ensure that each object has a distinct creation time. Delaying one
1198 # second is both a simple and a reliable way to accomplish this.
1199 time.sleep(1)
1200
1201 member2_name = data_utils.rand_name("lb_member_member1-list")
1202 member2_kwargs = {
1203 const.POOL_ID: pool_id,
1204 const.NAME: member2_name,
1205 const.ADMIN_STATE_UP: True,
1206 const.ADDRESS: '192.0.2.1',
1207 const.PROTOCOL_PORT: 100,
1208 }
1209
1210 if self.mem_member_client.is_version_supported(
1211 self.api_version, '2.5'):
1212 member2_tags = ["English", "Spanish",
1213 "Soft_skills", "Creativity"]
1214 member2_kwargs.update({const.TAGS: member2_tags})
1215
1216 member2 = self.mem_member_client.create_member(
1217 **member2_kwargs)
1218 self.addCleanup(
1219 self.mem_member_client.cleanup_member,
1220 member2[const.ID], pool_id=pool_id,
1221 lb_client=self.mem_lb_client, lb_id=self.lb_id)
1222 member2 = waiters.wait_for_status(
1223 self.mem_member_client.show_member, member2[const.ID],
1224 const.PROVISIONING_STATUS, const.ACTIVE,
1225 CONF.load_balancer.build_interval,
1226 CONF.load_balancer.build_timeout,
1227 pool_id=pool_id)
1228 waiters.wait_for_status(self.mem_lb_client.show_loadbalancer,
1229 self.lb_id,
1230 const.PROVISIONING_STATUS,
1231 const.ACTIVE,
1232 CONF.load_balancer.check_interval,
1233 CONF.load_balancer.check_timeout)
1234 test_ids.append(member2[const.ID])
1235 # Time resolution for created_at is only to the second, and we need to
1236 # ensure that each object has a distinct creation time. Delaying one
1237 # second is both a simple and a reliable way to accomplish this.
1238 time.sleep(1)
1239
1240 member3_name = data_utils.rand_name("lb_member_member3-list")
1241 member3_kwargs = {
1242 const.POOL_ID: pool_id,
1243 const.NAME: member3_name,
1244 const.ADMIN_STATE_UP: False,
1245 const.ADDRESS: '192.0.2.1',
1246 const.PROTOCOL_PORT: 102,
1247 }
1248
1249 if self.mem_member_client.is_version_supported(
1250 self.api_version, '2.5'):
1251 member3_tags = ["English", "Project_management",
1252 "Communication", "Creativity"]
1253 member3_kwargs.update({const.TAGS: member3_tags})
1254
1255 member3 = self.mem_member_client.create_member(
1256 **member3_kwargs)
1257 self.addCleanup(
1258 self.mem_member_client.cleanup_member,
1259 member3[const.ID], pool_id=pool_id,
1260 lb_client=self.mem_lb_client, lb_id=self.lb_id)
1261 member3 = waiters.wait_for_status(
1262 self.mem_member_client.show_member, member3[const.ID],
1263 const.PROVISIONING_STATUS, const.ACTIVE,
1264 CONF.load_balancer.build_interval,
1265 CONF.load_balancer.build_timeout,
1266 pool_id=pool_id)
1267 waiters.wait_for_status(self.mem_lb_client.show_loadbalancer,
1268 self.lb_id,
1269 const.PROVISIONING_STATUS,
1270 const.ACTIVE,
1271 CONF.load_balancer.check_interval,
1272 CONF.load_balancer.check_timeout)
1273 test_ids.append(member3[const.ID])
1274
1275 # Test credentials that should see these members can see them.
1276 expected_allowed = []
1277 if CONF.load_balancer.RBAC_test_type == const.OWNERADMIN:
1278 expected_allowed = ['os_admin', 'os_roles_lb_member']
1279 if CONF.load_balancer.RBAC_test_type == const.KEYSTONE_DEFAULT_ROLES:
1280 expected_allowed = ['os_admin', 'os_roles_lb_admin',
1281 'os_roles_lb_member']
1282 if CONF.load_balancer.RBAC_test_type == const.ADVANCED:
1283 expected_allowed = ['os_admin', 'os_roles_lb_admin',
1284 'os_roles_lb_member',
1285 'os_roles_lb_global_observer']
1286 if expected_allowed:
1287 self.check_list_IDs_RBAC_enforcement(
1288 'MemberClient', 'list_members', expected_allowed,
1289 test_ids, pool_id)
1290
1291 # Test that users without the lb member role cannot list members
1292 # Note: The parent pool ID blocks non-owners from listing members.
1293 expected_allowed = []
1294 if CONF.load_balancer.RBAC_test_type == const.OWNERADMIN:
1295 expected_allowed = ['os_admin', 'os_roles_lb_admin',
1296 'os_roles_lb_member']
1297 # Note: os_admin is here because it evaluaties to "project_admin"
1298 # in oslo_policy and since keystone considers "project_admin"
1299 # a superscope of "project_reader". This means it can read
1300 # objects in the "admin" credential's project.
1301 if CONF.load_balancer.RBAC_test_type == const.KEYSTONE_DEFAULT_ROLES:
1302 expected_allowed = ['os_admin', 'os_roles_lb_admin',
1303 'os_roles_lb_member']
1304 if CONF.load_balancer.RBAC_test_type == const.ADVANCED:
1305 expected_allowed = ['os_admin', 'os_roles_lb_admin',
1306 'os_roles_lb_global_observer',
1307 'os_roles_lb_member']
1308 if expected_allowed:
1309 self.check_list_RBAC_enforcement(
1310 'MemberClient', 'list_members', expected_allowed, pool_id)
1311
1312 # Check the default sort order, created_at
1313 members = self.mem_member_client.list_members(pool_id)
1314 self.assertEqual(member1[const.PROTOCOL_PORT],
1315 members[0][const.PROTOCOL_PORT])
1316 self.assertEqual(member2[const.PROTOCOL_PORT],
1317 members[1][const.PROTOCOL_PORT])
1318 self.assertEqual(member3[const.PROTOCOL_PORT],
1319 members[2][const.PROTOCOL_PORT])
1320
1321 # Test sort descending by protocol_port
1322 members = self.mem_member_client.list_members(
1323 pool_id, query_params='{sort}={descr}:{desc}'.format(
1324 sort=const.SORT, descr=const.PROTOCOL_PORT, desc=const.DESC))
1325 self.assertEqual(member1[const.PROTOCOL_PORT],
1326 members[1][const.PROTOCOL_PORT])
1327 self.assertEqual(member2[const.PROTOCOL_PORT],
1328 members[2][const.PROTOCOL_PORT])
1329 self.assertEqual(member3[const.PROTOCOL_PORT],
1330 members[0][const.PROTOCOL_PORT])
1331
1332 # Test sort ascending by protocol_port
1333 members = self.mem_member_client.list_members(
1334 pool_id, query_params='{sort}={descr}:{asc}'.format(
1335 sort=const.SORT, descr=const.PROTOCOL_PORT, asc=const.ASC))
1336 self.assertEqual(member1[const.PROTOCOL_PORT],
1337 members[1][const.PROTOCOL_PORT])
1338 self.assertEqual(member2[const.PROTOCOL_PORT],
1339 members[0][const.PROTOCOL_PORT])
1340 self.assertEqual(member3[const.PROTOCOL_PORT],
1341 members[2][const.PROTOCOL_PORT])
1342
1343 # Test fields
1344 show_member_response_fields = const.SHOW_MEMBER_RESPONSE_FIELDS
1345 if self.mem_member_client.is_version_supported(
1346 self.api_version, '2.1'):
1347 show_member_response_fields.append('backup')
1348 for field in show_member_response_fields:
1349 members = self.mem_member_client.list_members(
1350 pool_id, query_params='{fields}={field}'.format(
1351 fields=const.FIELDS, field=field))
1352 self.assertEqual(1, len(members[0]))
1353 self.assertEqual(member1[field], members[0][field])
1354 self.assertEqual(member2[field], members[1][field])
1355 self.assertEqual(member3[field], members[2][field])
1356
1357 # Test multiple fields at the same time
1358 members = self.mem_member_client.list_members(
1359 pool_id,
1360 query_params='{fields}={admin}&{fields}={created}'.format(
1361 fields=const.FIELDS, admin=const.ADMIN_STATE_UP,
1362 created=const.CREATED_AT))
1363 self.assertEqual(2, len(members[0]))
1364 self.assertTrue(members[0][const.ADMIN_STATE_UP])
1365 parser.parse(members[0][const.CREATED_AT])
1366 self.assertTrue(members[1][const.ADMIN_STATE_UP])
1367 parser.parse(members[1][const.CREATED_AT])
1368 self.assertFalse(members[2][const.ADMIN_STATE_UP])
1369 parser.parse(members[2][const.CREATED_AT])
1370
1371 # Test filtering
1372 members = self.mem_member_client.list_members(
1373 pool_id,
1374 query_params='{desc}={lb_desc}'.format(
1375 desc=const.PROTOCOL_PORT,
1376 lb_desc=member2[const.PROTOCOL_PORT]))
1377 self.assertEqual(1, len(members))
1378 self.assertEqual(member2[const.PROTOCOL_PORT],
1379 members[0][const.PROTOCOL_PORT])
1380
1381 # Test filtering using the backup flag
1382 if backup_member:
1383 members = self.mem_member_client.list_members(
1384 pool_id,
1385 query_params='{backup}={backup_value}'.format(
1386 backup=const.BACKUP,
1387 backup_value=const.BACKUP_TRUE))
1388 self.assertEqual(1, len(members))
1389 self.assertEqual(member1_name, members[0][const.NAME])
1390 self.assertTrue(members[0][const.BACKUP])
1391
1392 # Test combined params
1393 members = self.mem_member_client.list_members(
1394 pool_id,
1395 query_params='{admin}={true}&'
1396 '{fields}={descr}&{fields}={id}&'
1397 '{sort}={descr}:{desc}'.format(
1398 admin=const.ADMIN_STATE_UP,
1399 true=const.ADMIN_STATE_UP_TRUE,
1400 fields=const.FIELDS, descr=const.PROTOCOL_PORT,
1401 id=const.ID, sort=const.SORT, desc=const.DESC))
1402 # Should get two members
1403 self.assertEqual(2, len(members))
1404 # members should have two fields
1405 self.assertEqual(2, len(members[0]))
1406 # Should be in descending order
1407 self.assertEqual(member2[const.PROTOCOL_PORT],
1408 members[1][const.PROTOCOL_PORT])
1409 self.assertEqual(member1[const.PROTOCOL_PORT],
1410 members[0][const.PROTOCOL_PORT])
1411
1412 # Creating a list of 3 members, each one contains different tags
1413 if self.mem_member_client.is_version_supported(
1414 self.api_version, '2.5'):
1415 list_of_members = [member1, member2, member3]
1416 test_list = []
1417 for member in list_of_members:
1418
1419 # If tags "English" and "Creativity" are in the member's tags
1420 # and "Spanish" is not, add the member to the list
1421 if "English" in member[const.TAGS] and "Creativity" in (
1422 member[const.TAGS]) and "Spanish" not in (
1423 member[const.TAGS]):
1424 test_list.append(member[const.NAME])
1425
1426 # Tests if only the first and the third ones have those tags
1427 self.assertEqual(
1428 test_list, [member1[const.NAME], member3[const.NAME]])
1429
1430 # Tests that filtering by an empty tag will return an empty list
1431 self.assertTrue(not any(["" in member[const.TAGS]
1432 for member in list_of_members]))
1433
1434
1435 class MemberAPITest2(MemberAPITest):
1436 @decorators.idempotent_id('048f4b15-1cb4-49ac-82d6-b2ac7fe9d03b')
1437 def test_HTTP_LC_backup_member_show(self):
1438 if not self.mem_member_client.is_version_supported(
1439 self.api_version, '2.1'):
1440 raise self.skipException('Backup member support is only available '
1441 'in Octavia API version 2.1 or newer')
1442 pool_id = self._listener_pool_create(
1443 listener_protocol=const.HTTP, pool_protocol=const.HTTP,
1444 algorithm=const.LB_ALGORITHM_LEAST_CONNECTIONS)
1445 self._test_member_show(pool_id, backup_member=True)
1446
1447 @decorators.idempotent_id('2674b363-7922-494a-b121-cf415dbbb716')
1448 def test_HTTP_LC_alt_monitor_member_show(self):
1449 pool_id = self._listener_pool_create(
1450 listener_protocol=const.HTTP, pool_protocol=const.HTTP,
1451 algorithm=const.LB_ALGORITHM_LEAST_CONNECTIONS)
1452 self._test_member_show(pool_id, alternate_monitor=True)
1453
1454 @decorators.idempotent_id('a99da0e8-0595-49a5-a788-efc37fad2dc2')
1455 def test_HTTP_LC_member_show(self):
1456 pool_id = self._listener_pool_create(
1457 listener_protocol=const.HTTP, pool_protocol=const.HTTP,
1458 algorithm=const.LB_ALGORITHM_LEAST_CONNECTIONS)
1459 self._test_member_show(pool_id)
1460
1461 @decorators.idempotent_id('c3db94b3-a38c-4a0a-8c53-85888c2e1876')
1462 def test_HTTPS_LC_alt_monitor_member_show(self):
1463 pool_id = self._listener_pool_create(
1464 listener_protocol=const.HTTPS, pool_protocol=const.HTTPS,
1465 algorithm=const.LB_ALGORITHM_LEAST_CONNECTIONS)
1466 self._test_member_show(pool_id, alternate_monitor=True)
1467
1468 @decorators.idempotent_id('5844580e-6d01-42dc-b951-d995c9612167')
1469 def test_HTTPS_LC_member_show(self):
1470 pool_id = self._listener_pool_create(
1471 listener_protocol=const.HTTPS, pool_protocol=const.HTTPS,
1472 algorithm=const.LB_ALGORITHM_LEAST_CONNECTIONS)
1473 self._test_member_show(pool_id)
1474
1475 @decorators.idempotent_id('ebc52abf-9133-4922-902c-505f890bb44e')
1476 def test_PROXY_LC_alt_monitor_member_show(self):
1477 pool_id = self._listener_pool_create(
1478 listener_protocol=const.TCP, pool_protocol=const.PROXY,
1479 algorithm=const.LB_ALGORITHM_LEAST_CONNECTIONS)
1480 self._test_member_show(pool_id, alternate_monitor=True)
1481
1482 @decorators.idempotent_id('43f90043-65d4-483a-99ab-564f25acc0d7')
1483 def test_PROXY_LC_member_show(self):
1484 pool_id = self._listener_pool_create(
1485 listener_protocol=const.TCP, pool_protocol=const.PROXY,
1486 algorithm=const.LB_ALGORITHM_LEAST_CONNECTIONS)
1487 self._test_member_show(pool_id)
1488
1489 @decorators.idempotent_id('ecec1c11-2c2c-408c-9b4e-01620266dab6')
1490 def test_TCP_LC_alt_monitor_member_show(self):
1491 pool_id = self._listener_pool_create(
1492 listener_protocol=const.TCP, pool_protocol=const.TCP,
1493 algorithm=const.LB_ALGORITHM_LEAST_CONNECTIONS)
1494 self._test_member_show(pool_id, alternate_monitor=True)
1495
1496 @decorators.idempotent_id('baa9b4ec-1ac5-431f-bae0-f2ef68d1c81a')
1497 def test_TCP_LC_member_show(self):
1498 pool_id = self._listener_pool_create(
1499 listener_protocol=const.TCP, pool_protocol=const.TCP,
1500 algorithm=const.LB_ALGORITHM_LEAST_CONNECTIONS)
1501 self._test_member_show(pool_id)
1502
1503 @decorators.idempotent_id('3a291344-0a88-46fc-9eca-c2c6b9048076')
1504 # Skipping test for amphora driver until "UDP load balancers cannot mix
1505 # protocol versions" (https://storyboard.openstack.org/#!/story/2003329) is
1506 # fixed
1507 @decorators.skip_because(
1508 bug='2003329',
1509 bug_type='storyboard',
1510 condition=(CONF.load_balancer.provider in const.AMPHORA_PROVIDERS and
1511 CONF.load_balancer.test_with_ipv6))
1512 def test_UDP_LC_alt_monitor_member_show(self):
1513 pool_id = self._listener_pool_create(
1514 listener_protocol=const.UDP, pool_protocol=const.UDP,
1515 algorithm=const.LB_ALGORITHM_LEAST_CONNECTIONS)
1516 self._test_member_show(pool_id, alternate_monitor=True)
1517
1518 @decorators.idempotent_id('e53b2d6a-ad3f-46be-b899-56324874ad24')
1519 # Skipping test for amphora driver until "UDP load balancers cannot mix
1520 # protocol versions" (https://storyboard.openstack.org/#!/story/2003329) is
1521 # fixed
1522 @decorators.skip_because(
1523 bug='2003329',
1524 bug_type='storyboard',
1525 condition=(CONF.load_balancer.provider in const.AMPHORA_PROVIDERS and
1526 CONF.load_balancer.test_with_ipv6))
1527 def test_UDP_LC_member_show(self):
1528 pool_id = self._listener_pool_create(
1529 listener_protocol=const.UDP, pool_protocol=const.UDP,
1530 algorithm=const.LB_ALGORITHM_LEAST_CONNECTIONS)
1531 self._test_member_show(pool_id)
1532
1533 @decorators.idempotent_id('7674ae04-7e92-44ef-9adf-40718d7ec705')
1534 def test_HTTP_RR_alt_monitor_member_show(self):
1535 pool_id = self._listener_pool_create(
1536 listener_protocol=const.HTTP, pool_protocol=const.HTTP,
1537 algorithm=const.LB_ALGORITHM_ROUND_ROBIN)
1538 self._test_member_show(pool_id, alternate_monitor=True)
1539
1540 @decorators.idempotent_id('2c4a29f4-be25-416c-9546-9585298cfe4c')
1541 def test_HTTP_RR_member_show(self):
1542 pool_id = self._listener_pool_create(
1543 listener_protocol=const.HTTP, pool_protocol=const.HTTP,
1544 algorithm=const.LB_ALGORITHM_ROUND_ROBIN)
1545 self._test_member_show(pool_id)
1546
1547 @decorators.idempotent_id('a06a137d-f6d1-44a6-978b-22fe8e23752c')
1548 def test_HTTPS_RR_alt_monitor_member_show(self):
1549 pool_id = self._listener_pool_create(
1550 listener_protocol=const.HTTPS, pool_protocol=const.HTTPS,
1551 algorithm=const.LB_ALGORITHM_ROUND_ROBIN)
1552 self._test_member_show(pool_id, alternate_monitor=True)
1553
1554 @decorators.idempotent_id('bfe7dfea-878e-4e7c-afd8-9860d7282930')
1555 def test_HTTPS_RR_member_show(self):
1556 pool_id = self._listener_pool_create(
1557 listener_protocol=const.HTTPS, pool_protocol=const.HTTPS,
1558 algorithm=const.LB_ALGORITHM_ROUND_ROBIN)
1559 self._test_member_show(pool_id)
1560
1561 @decorators.idempotent_id('007c4f0c-8192-4806-9c25-c2f27ea4ba57')
1562 def test_PROXY_RR_alt_monitor_member_show(self):
1563 pool_id = self._listener_pool_create(
1564 listener_protocol=const.TCP, pool_protocol=const.PROXY,
1565 algorithm=const.LB_ALGORITHM_ROUND_ROBIN)
1566 self._test_member_show(pool_id, alternate_monitor=True)
1567
1568 @decorators.idempotent_id('0d6d2875-d1b3-4508-8e17-1c656a5f31ec')
1569 def test_PROXY_RR_member_show(self):
1570 pool_id = self._listener_pool_create(
1571 listener_protocol=const.TCP, pool_protocol=const.PROXY,
1572 algorithm=const.LB_ALGORITHM_ROUND_ROBIN)
1573 self._test_member_show(pool_id)
1574
1575 @decorators.idempotent_id('9c968920-1fcc-4a71-8dc9-fdf2ff59af7c')
1576 def test_TCP_RR_alt_monitor_member_show(self):
1577 pool_id = self._listener_pool_create(
1578 listener_protocol=const.TCP, pool_protocol=const.TCP,
1579 algorithm=const.LB_ALGORITHM_ROUND_ROBIN)
1580 self._test_member_show(pool_id, alternate_monitor=True)
1581
1582 @decorators.idempotent_id('1acd8a34-dd13-411e-bdf3-414b3fcc569d')
1583 def test_TCP_RR_member_show(self):
1584 pool_id = self._listener_pool_create(
1585 listener_protocol=const.TCP, pool_protocol=const.TCP,
1586 algorithm=const.LB_ALGORITHM_ROUND_ROBIN)
1587 self._test_member_show(pool_id)
1588
1589 @decorators.idempotent_id('2d154e0c-4955-4b00-92d5-e9df7b2fbf63')
1590 # Skipping test for amphora driver until "UDP load balancers cannot mix
1591 # protocol versions" (https://storyboard.openstack.org/#!/story/2003329) is
1592 # fixed
1593 @decorators.skip_because(
1594 bug='2003329',
1595 bug_type='storyboard',
1596 condition=(CONF.load_balancer.provider in const.AMPHORA_PROVIDERS and
1597 CONF.load_balancer.test_with_ipv6))
1598 def test_UDP_RR_alt_monitor_member_show(self):
1599 pool_id = self._listener_pool_create(
1600 listener_protocol=const.UDP, pool_protocol=const.UDP,
1601 algorithm=const.LB_ALGORITHM_ROUND_ROBIN)
1602 self._test_member_show(pool_id, alternate_monitor=True)
1603
1604 @decorators.idempotent_id('06de8b15-caf3-4a75-b278-cdfe6208c8db')
1605 # Skipping test for amphora driver until "UDP load balancers cannot mix
1606 # protocol versions" (https://storyboard.openstack.org/#!/story/2003329) is
1607 # fixed
1608 @decorators.skip_because(
1609 bug='2003329',
1610 bug_type='storyboard',
1611 condition=(CONF.load_balancer.provider in const.AMPHORA_PROVIDERS and
1612 CONF.load_balancer.test_with_ipv6))
1613 def test_UDP_RR_member_show(self):
1614 pool_id = self._listener_pool_create(
1615 listener_protocol=const.UDP, pool_protocol=const.UDP,
1616 algorithm=const.LB_ALGORITHM_ROUND_ROBIN)
1617 self._test_member_show(pool_id)
1618
1619 @decorators.idempotent_id('6c88a35e-b7c1-4b14-bdae-1a710890555a')
1620 def test_HTTP_SI_alt_monitor_member_show(self):
1621 pool_id = self._listener_pool_create(
1622 listener_protocol=const.HTTP, pool_protocol=const.HTTP,
1623 algorithm=const.LB_ALGORITHM_SOURCE_IP)
1624 self._test_member_show(pool_id, alternate_monitor=True)
1625
1626 @decorators.idempotent_id('266b60e2-7c3a-4edb-950b-66d57aa64b80')
1627 def test_HTTP_SI_member_show(self):
1628 pool_id = self._listener_pool_create(
1629 listener_protocol=const.HTTP, pool_protocol=const.HTTP,
1630 algorithm=const.LB_ALGORITHM_SOURCE_IP)
1631 self._test_member_show(pool_id)
1632
1633 @decorators.idempotent_id('c2c8ba90-6ade-4fd3-bf12-e15627983917')
1634 def test_HTTPS_SI_alt_monitor_member_show(self):
1635 pool_id = self._listener_pool_create(
1636 listener_protocol=const.HTTPS, pool_protocol=const.HTTPS,
1637 algorithm=const.LB_ALGORITHM_SOURCE_IP)
1638 self._test_member_show(pool_id, alternate_monitor=True)
1639
1640 @decorators.idempotent_id('4af933ae-5c6d-4849-af85-e06f7d5a661c')
1641 def test_HTTPS_SI_member_show(self):
1642 pool_id = self._listener_pool_create(
1643 listener_protocol=const.HTTPS, pool_protocol=const.HTTPS,
1644 algorithm=const.LB_ALGORITHM_SOURCE_IP)
1645 self._test_member_show(pool_id)
1646
1647 @decorators.idempotent_id('383148a5-a9ec-413a-a44c-85c1bbb39729')
1648 def test_PROXY_SI_alt_monitor_member_show(self):
1649 pool_id = self._listener_pool_create(
1650 listener_protocol=const.TCP, pool_protocol=const.PROXY,
1651 algorithm=const.LB_ALGORITHM_SOURCE_IP)
1652 self._test_member_show(pool_id, alternate_monitor=True)
1653
1654 @decorators.idempotent_id('518c4d3f-2b5a-4f8a-9c5e-fad15127502e')
1655 def test_PROXY_SI_member_show(self):
1656 pool_id = self._listener_pool_create(
1657 listener_protocol=const.TCP, pool_protocol=const.PROXY,
1658 algorithm=const.LB_ALGORITHM_SOURCE_IP)
1659 self._test_member_show(pool_id)
1660
1661 @decorators.idempotent_id('9b95b5f2-8823-4019-be86-311a1bde5b20')
1662 def test_TCP_SI_alt_monitor_member_show(self):
1663 pool_id = self._listener_pool_create(
1664 listener_protocol=const.TCP, pool_protocol=const.TCP,
1665 algorithm=const.LB_ALGORITHM_SOURCE_IP)
1666 self._test_member_show(pool_id, alternate_monitor=True)
1667
1668 @decorators.idempotent_id('d8576e58-e8ff-491d-beee-b7c439d2c41c')
1669 def test_TCP_SI_member_show(self):
1670 pool_id = self._listener_pool_create(
1671 listener_protocol=const.TCP, pool_protocol=const.TCP,
1672 algorithm=const.LB_ALGORITHM_SOURCE_IP)
1673 self._test_member_show(pool_id)
1674
1675 @decorators.idempotent_id('896acc77-3b73-4565-ad87-9467218b143b')
1676 # Skipping test for amphora driver until "UDP load balancers cannot mix
1677 # protocol versions" (https://storyboard.openstack.org/#!/story/2003329) is
1678 # fixed
1679 @decorators.skip_because(
1680 bug='2003329',
1681 bug_type='storyboard',
1682 condition=(CONF.load_balancer.provider in const.AMPHORA_PROVIDERS and
1683 CONF.load_balancer.test_with_ipv6))
1684 def test_UDP_SI_alt_monitor_member_show(self):
1685 pool_id = self._listener_pool_create(
1686 listener_protocol=const.UDP, pool_protocol=const.UDP,
1687 algorithm=const.LB_ALGORITHM_SOURCE_IP)
1688 self._test_member_show(pool_id, alternate_monitor=True)
1689
1690 @decorators.idempotent_id('ffc64ff1-ec8c-4201-a295-a179adc0c7e0')
1691 # Skipping test for amphora driver until "UDP load balancers cannot mix
1692 # protocol versions" (https://storyboard.openstack.org/#!/story/2003329) is
1693 # fixed
1694 @decorators.skip_because(
1695 bug='2003329',
1696 bug_type='storyboard',
1697 condition=(CONF.load_balancer.provider in const.AMPHORA_PROVIDERS and
1698 CONF.load_balancer.test_with_ipv6))
1699 def test_UDP_SI_member_show(self):
1700 pool_id = self._listener_pool_create(
1701 listener_protocol=const.UDP, pool_protocol=const.UDP,
1702 algorithm=const.LB_ALGORITHM_SOURCE_IP)
1703 self._test_member_show(pool_id)
1704
1705 @decorators.idempotent_id('7c4fcb3e-a994-4d39-97cc-929c022c001e')
1706 def test_HTTP_SIP_alt_monitor_member_show(self):
1707 pool_id = self._listener_pool_create(
1708 listener_protocol=const.HTTP, pool_protocol=const.HTTP,
1709 algorithm=const.LB_ALGORITHM_SOURCE_IP_PORT)
1710 self._test_member_show(pool_id, alternate_monitor=True)
1711
1712 @decorators.idempotent_id('704d04c3-e639-4dee-b55d-09ebf55f8a0d')
1713 def test_HTTP_SIP_member_show(self):
1714 pool_id = self._listener_pool_create(
1715 listener_protocol=const.HTTP, pool_protocol=const.HTTP,
1716 algorithm=const.LB_ALGORITHM_SOURCE_IP_PORT)
1717 self._test_member_show(pool_id)
1718
1719 @decorators.idempotent_id('69de0c60-3e4f-40cf-9bf7-d2b1e6c83715')
1720 def test_HTTPS_SIP_alt_monitor_member_show(self):
1721 pool_id = self._listener_pool_create(
1722 listener_protocol=const.HTTPS, pool_protocol=const.HTTPS,
1723 algorithm=const.LB_ALGORITHM_SOURCE_IP_PORT)
1724 self._test_member_show(pool_id, alternate_monitor=True)
1725
1726 @decorators.idempotent_id('2d970b1c-c157-4974-b605-b8e08d97e874')
1727 def test_HTTPS_SIP_member_show(self):
1728 pool_id = self._listener_pool_create(
1729 listener_protocol=const.HTTPS, pool_protocol=const.HTTPS,
1730 algorithm=const.LB_ALGORITHM_SOURCE_IP_PORT)
1731 self._test_member_show(pool_id)
1732
1733 @decorators.idempotent_id('28e1e3e7-454b-409d-84c3-1826f82ca9dd')
1734 def test_PROXY_SIP_alt_monitor_member_show(self):
1735 pool_id = self._listener_pool_create(
1736 listener_protocol=const.TCP, pool_protocol=const.PROXY,
1737 algorithm=const.LB_ALGORITHM_SOURCE_IP_PORT)
1738 self._test_member_show(pool_id, alternate_monitor=True)
1739
1740 @decorators.idempotent_id('189ec327-b1c5-47a8-a843-10963cba0a9c')
1741 def test_PROXY_SIP_member_show(self):
1742 pool_id = self._listener_pool_create(
1743 listener_protocol=const.TCP, pool_protocol=const.PROXY,
1744 algorithm=const.LB_ALGORITHM_SOURCE_IP_PORT)
1745 self._test_member_show(pool_id)
1746
1747 @decorators.idempotent_id('6953a9a4-5fac-4470-bfda-4fafbd67288b')
1748 def test_TCP_SIP_alt_monitor_member_show(self):
1749 pool_id = self._listener_pool_create(
1750 listener_protocol=const.TCP, pool_protocol=const.TCP,
1751 algorithm=const.LB_ALGORITHM_SOURCE_IP_PORT)
1752 self._test_member_show(pool_id, alternate_monitor=True)
1753
1754 @decorators.idempotent_id('6d8d546f-8c41-49b9-bd9d-8f8ea3975816')
1755 def test_TCP_SIP_member_show(self):
1756 pool_id = self._listener_pool_create(
1757 listener_protocol=const.TCP, pool_protocol=const.TCP,
1758 algorithm=const.LB_ALGORITHM_SOURCE_IP_PORT)
1759 self._test_member_show(pool_id)
1760
1761 @decorators.idempotent_id('9c0d4668-5a0e-41b3-b3b4-3d0372fe28af')
1762 # Skipping test for amphora driver until "UDP load balancers cannot mix
1763 # protocol versions" (https://storyboard.openstack.org/#!/story/2003329) is
1764 # fixed
1765 @decorators.skip_because(
1766 bug='2003329',
1767 bug_type='storyboard',
1768 condition=(CONF.load_balancer.provider in const.AMPHORA_PROVIDERS and
1769 CONF.load_balancer.test_with_ipv6))
1770 def test_UDP_SIP_alt_monitor_member_show(self):
1771 pool_id = self._listener_pool_create(
1772 listener_protocol=const.UDP, pool_protocol=const.UDP,
1773 algorithm=const.LB_ALGORITHM_SOURCE_IP_PORT)
1774 self._test_member_show(pool_id, alternate_monitor=True)
1775
1776 @decorators.idempotent_id('a03d02d0-830c-4aad-a10b-96c47974483c')
1777 # Skipping test for amphora driver until "UDP load balancers cannot mix
1778 # protocol versions" (https://storyboard.openstack.org/#!/story/2003329) is
1779 # fixed
1780 @decorators.skip_because(
1781 bug='2003329',
1782 bug_type='storyboard',
1783 condition=(CONF.load_balancer.provider in const.AMPHORA_PROVIDERS and
1784 CONF.load_balancer.test_with_ipv6))
1785 def test_UDP_SIP_member_show(self):
1786 pool_id = self._listener_pool_create(
1787 listener_protocol=const.UDP, pool_protocol=const.UDP,
1788 algorithm=const.LB_ALGORITHM_SOURCE_IP_PORT)
1789 self._test_member_show(pool_id)
1790
1791 def _test_member_show(self, pool_id, alternate_monitor=False,
1792 backup_member=False):
1793 """Tests member show API.
1794
1795 * Create a fully populated member.
1796 * Show member details.
1797 * Validate the show reflects the requested values.
1798 * Validates that other accounts cannot see the member.
1799 """
1800 member_name = data_utils.rand_name("lb_member_member1-show")
1801 member_kwargs = {
1802 const.NAME: member_name,
1803 const.ADMIN_STATE_UP: True,
1804 const.POOL_ID: pool_id,
1805 const.ADDRESS: '192.0.2.1',
1806 const.PROTOCOL_PORT: self.member_port.increment(),
1807 const.WEIGHT: 50,
1808 }
1809 if alternate_monitor:
1810 member_kwargs[const.MONITOR_ADDRESS] = '192.0.2.2'
1811 member_kwargs[const.MONITOR_PORT] = 8080
1812
1813 if self.mem_member_client.is_version_supported(
1814 self.api_version, '2.1'):
1815 member_kwargs.update({
1816 const.BACKUP: backup_member,
1817 })
1818 if self.lb_member_vip_subnet:
1819 member_kwargs[const.SUBNET_ID] = self.lb_member_vip_subnet[
1820 const.ID]
1821
1822 member = self.mem_member_client.create_member(**member_kwargs)
1823
1824 self.addCleanup(
1825 self.mem_member_client.cleanup_member,
1826 member[const.ID], pool_id=pool_id,
1827 lb_client=self.mem_lb_client, lb_id=self.lb_id)
1828
1829 waiters.wait_for_status(
1830 self.mem_lb_client.show_loadbalancer, self.lb_id,
1831 const.PROVISIONING_STATUS, const.ACTIVE,
1832 CONF.load_balancer.build_interval,
1833 CONF.load_balancer.build_timeout)
1834 member = waiters.wait_for_status(
1835 self.mem_member_client.show_member,
1836 member[const.ID], const.PROVISIONING_STATUS,
1837 const.ACTIVE,
1838 CONF.load_balancer.build_interval,
1839 CONF.load_balancer.build_timeout,
1840 pool_id=pool_id)
1841
1842 parser.parse(member[const.CREATED_AT])
1843 parser.parse(member[const.UPDATED_AT])
1844 UUID(member[const.ID])
1845 self.assertEqual(const.NO_MONITOR, member[const.OPERATING_STATUS])
1846
1847 equal_items = [const.NAME, const.ADMIN_STATE_UP, const.ADDRESS,
1848 const.PROTOCOL_PORT, const.WEIGHT]
1849
1850 if self.mem_member_client.is_version_supported(
1851 self.api_version, '2.1'):
1852 equal_items.append(const.BACKUP)
1853
1854 if alternate_monitor:
1855 equal_items += [const.MONITOR_ADDRESS, const.MONITOR_PORT]
1856
1857 if const.SUBNET_ID in member_kwargs:
1858 equal_items.append(const.SUBNET_ID)
1859 else:
1860 self.assertIsNone(member.get(const.SUBNET_ID))
1861
1862 for item in equal_items:
1863 self.assertEqual(member_kwargs[item], member[item])
1864
1865 # Test that the appropriate users can see or not see the member
1866 # based on the API RBAC.
1867 if CONF.load_balancer.RBAC_test_type == const.ADVANCED:
1868 expected_allowed = ['os_admin', 'os_roles_lb_admin',
1869 'os_roles_lb_global_observer',
1870 'os_roles_lb_member']
1871 else:
1872 expected_allowed = ['os_admin', 'os_roles_lb_admin',
1873 'os_roles_lb_member']
1874 self.check_show_RBAC_enforcement(
1875 'MemberClient', 'show_member', expected_allowed, member[const.ID],
1876 pool_id=pool_id)
1877
1878 @decorators.idempotent_id('592c19c3-1e0d-4d6d-b2ff-0d39d8654c99')
1879 def test_HTTP_LC_backup_member_update(self):
1880 if not self.mem_member_client.is_version_supported(
1881 self.api_version, '2.1'):
1882 raise self.skipException('Backup member support is only available '
1883 'in Octavia API version 2.1 or newer')
1884 pool_id = self._listener_pool_create(
1885 listener_protocol=const.HTTP, pool_protocol=const.HTTP,
1886 algorithm=const.LB_ALGORITHM_LEAST_CONNECTIONS)
1887 self._test_member_update(pool_id, backup_member=True)
1888
1889 @decorators.idempotent_id('65680d48-1d49-4959-a7d1-677797e54f6b')
1890 def test_HTTP_LC_alt_monitor_member_update(self):
1891 pool_id = self._listener_pool_create(
1892 listener_protocol=const.HTTP, pool_protocol=const.HTTP,
1893 algorithm=const.LB_ALGORITHM_LEAST_CONNECTIONS)
1894 self._test_member_update(pool_id, alternate_monitor=True)
1895
1896 @decorators.idempotent_id('52124440-c95c-48fb-af26-70377bcba7d6')
1897 def test_HTTP_LC_member_update(self):
1898 pool_id = self._listener_pool_create(
1899 listener_protocol=const.HTTP, pool_protocol=const.HTTP,
1900 algorithm=const.LB_ALGORITHM_LEAST_CONNECTIONS)
1901 self._test_member_update(pool_id)
1902
1903 @decorators.idempotent_id('caf95728-5e9c-4295-bd4a-a15263ba5714')
1904 def test_HTTPS_LC_alt_monitor_member_update(self):
1905 pool_id = self._listener_pool_create(
1906 listener_protocol=const.HTTPS, pool_protocol=const.HTTPS,
1907 algorithm=const.LB_ALGORITHM_LEAST_CONNECTIONS)
1908 self._test_member_update(pool_id, alternate_monitor=True)
1909
1910 @decorators.idempotent_id('d1d98798-20cb-4290-818c-e814911d25e5')
1911 def test_HTTPS_LC_member_update(self):
1912 pool_id = self._listener_pool_create(
1913 listener_protocol=const.HTTPS, pool_protocol=const.HTTPS,
1914 algorithm=const.LB_ALGORITHM_LEAST_CONNECTIONS)
1915 self._test_member_update(pool_id)
1916
1917 @decorators.idempotent_id('b22288fa-4e25-4779-bd78-6b4802926457')
1918 def test_PROXY_LC_alt_monitor_member_update(self):
1919 pool_id = self._listener_pool_create(
1920 listener_protocol=const.TCP, pool_protocol=const.PROXY,
1921 algorithm=const.LB_ALGORITHM_LEAST_CONNECTIONS)
1922 self._test_member_update(pool_id, alternate_monitor=True)
1923
1924 @decorators.idempotent_id('5ee3df40-381a-4497-9e31-df82d8c2e514')
1925 def test_PROXY_LC_member_update(self):
1926 pool_id = self._listener_pool_create(
1927 listener_protocol=const.TCP, pool_protocol=const.PROXY,
1928 algorithm=const.LB_ALGORITHM_LEAST_CONNECTIONS)
1929 self._test_member_update(pool_id)
1930
1931 @decorators.idempotent_id('b693b5ba-d8e7-4b89-ad6c-41b56cf258f7')
1932 def test_TCP_LC_alt_monitor_member_update(self):
1933 pool_id = self._listener_pool_create(
1934 listener_protocol=const.TCP, pool_protocol=const.TCP,
1935 algorithm=const.LB_ALGORITHM_LEAST_CONNECTIONS)
1936 self._test_member_update(pool_id, alternate_monitor=True)
1937
1938 @decorators.idempotent_id('0df9463f-de6b-43c1-934f-6523873f3530')
1939 def test_TCP_LC_member_update(self):
1940 pool_id = self._listener_pool_create(
1941 listener_protocol=const.TCP, pool_protocol=const.TCP,
1942 algorithm=const.LB_ALGORITHM_LEAST_CONNECTIONS)
1943 self._test_member_update(pool_id)
1944
1945 @decorators.idempotent_id('60baa2d7-927a-4b58-80b9-a2e5196985ee')
1946 # Skipping test for amphora driver until "UDP load balancers cannot mix
1947 # protocol versions" (https://storyboard.openstack.org/#!/story/2003329) is
1948 # fixed
1949 @decorators.skip_because(
1950 bug='2003329',
1951 bug_type='storyboard',
1952 condition=(CONF.load_balancer.provider in const.AMPHORA_PROVIDERS and
1953 CONF.load_balancer.test_with_ipv6))
1954 def test_UDP_LC_alt_monitor_member_update(self):
1955 pool_id = self._listener_pool_create(
1956 listener_protocol=const.UDP, pool_protocol=const.UDP,
1957 algorithm=const.LB_ALGORITHM_LEAST_CONNECTIONS)
1958 self._test_member_update(pool_id, alternate_monitor=True)
1959
1960 @decorators.idempotent_id('b036a40f-d220-4be6-abc9-8ca8e01b96c3')
1961 # Skipping test for amphora driver until "UDP load balancers cannot mix
1962 # protocol versions" (https://storyboard.openstack.org/#!/story/2003329) is
1963 # fixed
1964 @decorators.skip_because(
1965 bug='2003329',
1966 bug_type='storyboard',
1967 condition=(CONF.load_balancer.provider in const.AMPHORA_PROVIDERS and
1968 CONF.load_balancer.test_with_ipv6))
1969 def test_UDP_LC_member_update(self):
1970 pool_id = self._listener_pool_create(
1971 listener_protocol=const.UDP, pool_protocol=const.UDP,
1972 algorithm=const.LB_ALGORITHM_LEAST_CONNECTIONS)
1973 self._test_member_update(pool_id)
1974
1975 @decorators.idempotent_id('c07572b8-e853-48f3-a8ea-37fc293a4724')
1976 def test_HTTP_RR_alt_monitor_member_update(self):
1977 pool_id = self._listener_pool_create(
1978 listener_protocol=const.HTTP, pool_protocol=const.HTTP,
1979 algorithm=const.LB_ALGORITHM_ROUND_ROBIN)
1980 self._test_member_update(pool_id, alternate_monitor=True)
1981
1982 @decorators.idempotent_id('f83993ce-b053-42ff-9022-612ed67e8db6')
1983 def test_HTTP_RR_member_update(self):
1984 pool_id = self._listener_pool_create(
1985 listener_protocol=const.HTTP, pool_protocol=const.HTTP,
1986 algorithm=const.LB_ALGORITHM_ROUND_ROBIN)
1987 self._test_member_update(pool_id)
1988
1989 @decorators.idempotent_id('e419d49f-22e4-4331-985e-3a1cc8d0b6b0')
1990 def test_HTTPS_RR_alt_monitor_member_update(self):
1991 pool_id = self._listener_pool_create(
1992 listener_protocol=const.HTTPS, pool_protocol=const.HTTPS,
1993 algorithm=const.LB_ALGORITHM_ROUND_ROBIN)
1994 self._test_member_update(pool_id, alternate_monitor=True)
1995
1996 @decorators.idempotent_id('42ac5187-799a-4714-972c-fea6e1c6a7b2')
1997 def test_HTTPS_RR_member_update(self):
1998 pool_id = self._listener_pool_create(
1999 listener_protocol=const.HTTPS, pool_protocol=const.HTTPS,
2000 algorithm=const.LB_ALGORITHM_ROUND_ROBIN)
2001 self._test_member_update(pool_id)
2002
2003 @decorators.idempotent_id('43d30b1d-0f99-4b46-ad37-542e899ceae7')
2004 def test_PROXY_RR_alt_monitor_member_update(self):
2005 pool_id = self._listener_pool_create(
2006 listener_protocol=const.TCP, pool_protocol=const.PROXY,
2007 algorithm=const.LB_ALGORITHM_ROUND_ROBIN)
2008 self._test_member_update(pool_id, alternate_monitor=True)
2009
2010 @decorators.idempotent_id('d5cf47a6-a3bb-4238-a5cf-a74b122edce4')
2011 def test_PROXY_RR_member_update(self):
2012 pool_id = self._listener_pool_create(
2013 listener_protocol=const.TCP, pool_protocol=const.PROXY,
2014 algorithm=const.LB_ALGORITHM_ROUND_ROBIN)
2015 self._test_member_update(pool_id)
2016
2017 @decorators.idempotent_id('5a05f8b0-52ca-4ed7-a1a7-c62aee16c960')
2018 def test_TCP_RR_alt_monitor_member_update(self):
2019 pool_id = self._listener_pool_create(
2020 listener_protocol=const.TCP, pool_protocol=const.TCP,
2021 algorithm=const.LB_ALGORITHM_ROUND_ROBIN)
2022 self._test_member_update(pool_id, alternate_monitor=True)
2023
2024 @decorators.idempotent_id('46e5d4e8-0ecc-40a7-87bd-f9ccdfc9a2d3')
2025 def test_TCP_RR_member_update(self):
2026 pool_id = self._listener_pool_create(
2027 listener_protocol=const.TCP, pool_protocol=const.TCP,
2028 algorithm=const.LB_ALGORITHM_ROUND_ROBIN)
2029 self._test_member_update(pool_id)
2030
2031 @decorators.idempotent_id('7609cd2f-32ac-4488-869a-7e14827df6ef')
2032 # Skipping test for amphora driver until "UDP load balancers cannot mix
2033 # protocol versions" (https://storyboard.openstack.org/#!/story/2003329) is
2034 # fixed
2035 @decorators.skip_because(
2036 bug='2003329',
2037 bug_type='storyboard',
2038 condition=(CONF.load_balancer.provider in const.AMPHORA_PROVIDERS and
2039 CONF.load_balancer.test_with_ipv6))
2040 def test_UDP_RR_alt_monitor_member_update(self):
2041 pool_id = self._listener_pool_create(
2042 listener_protocol=const.UDP, pool_protocol=const.UDP,
2043 algorithm=const.LB_ALGORITHM_ROUND_ROBIN)
2044 self._test_member_update(pool_id, alternate_monitor=True)
2045
2046 @decorators.idempotent_id('171ae461-af7d-4fe1-961d-78376fcc2b3f')
2047 # Skipping test for amphora driver until "UDP load balancers cannot mix
2048 # protocol versions" (https://storyboard.openstack.org/#!/story/2003329) is
2049 # fixed
2050 @decorators.skip_because(
2051 bug='2003329',
2052 bug_type='storyboard',
2053 condition=(CONF.load_balancer.provider in const.AMPHORA_PROVIDERS and
2054 CONF.load_balancer.test_with_ipv6))
2055 def test_UDP_RR_member_update(self):
2056 pool_id = self._listener_pool_create(
2057 listener_protocol=const.UDP, pool_protocol=const.UDP,
2058 algorithm=const.LB_ALGORITHM_ROUND_ROBIN)
2059 self._test_member_update(pool_id)
2060
2061 @decorators.idempotent_id('af40e333-caed-4808-a46c-05c977f3cebc')
2062 def test_HTTP_SI_alt_monitor_member_update(self):
2063 pool_id = self._listener_pool_create(
2064 listener_protocol=const.HTTP, pool_protocol=const.HTTP,
2065 algorithm=const.LB_ALGORITHM_SOURCE_IP)
2066 self._test_member_update(pool_id, alternate_monitor=True)
2067
2068 @decorators.idempotent_id('f63a9deb-4a45-42c4-9aeb-f7c304ecbc16')
2069 def test_HTTP_SI_member_update(self):
2070 pool_id = self._listener_pool_create(
2071 listener_protocol=const.HTTP, pool_protocol=const.HTTP,
2072 algorithm=const.LB_ALGORITHM_SOURCE_IP)
2073 self._test_member_update(pool_id)
2074
2075 @decorators.idempotent_id('27c17512-51b4-49ae-ac92-3e141599cdda')
2076 def test_HTTPS_SI_alt_monitor_member_update(self):
2077 pool_id = self._listener_pool_create(
2078 listener_protocol=const.HTTPS, pool_protocol=const.HTTPS,
2079 algorithm=const.LB_ALGORITHM_SOURCE_IP)
2080 self._test_member_update(pool_id, alternate_monitor=True)
2081
2082 @decorators.idempotent_id('cc67064f-becc-4e31-b9e5-b3ea7e78a187')
2083 def test_HTTPS_SI_member_update(self):
2084 pool_id = self._listener_pool_create(
2085 listener_protocol=const.HTTPS, pool_protocol=const.HTTPS,
2086 algorithm=const.LB_ALGORITHM_SOURCE_IP)
2087 self._test_member_update(pool_id)
2088
2089 @decorators.idempotent_id('2061a0cf-49e0-49b8-af4d-f197cf84ef11')
2090 def test_PROXY_SI_alt_monitor_member_update(self):
2091 pool_id = self._listener_pool_create(
2092 listener_protocol=const.TCP, pool_protocol=const.PROXY,
2093 algorithm=const.LB_ALGORITHM_SOURCE_IP)
2094 self._test_member_update(pool_id, alternate_monitor=True)
2095
2096 @decorators.idempotent_id('5946b163-8684-402a-b228-c0648a3e0734')
2097 def test_PROXY_SI_member_update(self):
2098 pool_id = self._listener_pool_create(
2099 listener_protocol=const.TCP, pool_protocol=const.PROXY,
2100 algorithm=const.LB_ALGORITHM_SOURCE_IP)
2101 self._test_member_update(pool_id)
2102
2103 @decorators.idempotent_id('7a6314dd-83c5-41ee-92f6-e18409ac213d')
2104 def test_TCP_SI_alt_monitor_member_update(self):
2105 pool_id = self._listener_pool_create(
2106 listener_protocol=const.TCP, pool_protocol=const.TCP,
2107 algorithm=const.LB_ALGORITHM_SOURCE_IP)
2108 self._test_member_update(pool_id, alternate_monitor=True)
2109
2110 @decorators.idempotent_id('93818084-a9fb-480d-a7e1-04066ee0e393')
2111 def test_TCP_SI_member_update(self):
2112 pool_id = self._listener_pool_create(
2113 listener_protocol=const.TCP, pool_protocol=const.TCP,
2114 algorithm=const.LB_ALGORITHM_SOURCE_IP)
2115 self._test_member_update(pool_id)
2116
2117 @decorators.idempotent_id('523cf4e8-c071-4778-bc89-367a0b8469e6')
2118 # Skipping test for amphora driver until "UDP load balancers cannot mix
2119 # protocol versions" (https://storyboard.openstack.org/#!/story/2003329) is
2120 # fixed
2121 @decorators.skip_because(
2122 bug='2003329',
2123 bug_type='storyboard',
2124 condition=(CONF.load_balancer.provider in const.AMPHORA_PROVIDERS and
2125 CONF.load_balancer.test_with_ipv6))
2126 def test_UDP_SI_alt_monitor_member_update(self):
2127 pool_id = self._listener_pool_create(
2128 listener_protocol=const.UDP, pool_protocol=const.UDP,
2129 algorithm=const.LB_ALGORITHM_SOURCE_IP)
2130 self._test_member_update(pool_id, alternate_monitor=True)
2131
2132 @decorators.idempotent_id('9f655415-13d6-4ceb-9ea6-9a32baf0e093')
2133 # Skipping test for amphora driver until "UDP load balancers cannot mix
2134 # protocol versions" (https://storyboard.openstack.org/#!/story/2003329) is
2135 # fixed
2136 @decorators.skip_because(
2137 bug='2003329',
2138 bug_type='storyboard',
2139 condition=(CONF.load_balancer.provider in const.AMPHORA_PROVIDERS and
2140 CONF.load_balancer.test_with_ipv6))
2141 def test_UDP_SI_member_update(self):
2142 pool_id = self._listener_pool_create(
2143 listener_protocol=const.UDP, pool_protocol=const.UDP,
2144 algorithm=const.LB_ALGORITHM_SOURCE_IP)
2145 self._test_member_update(pool_id)
2146
2147 @decorators.idempotent_id('5215ecc4-fd47-451a-b073-399bad8b522c')
2148 def test_HTTP_SIP_alt_monitor_member_update(self):
2149 pool_id = self._listener_pool_create(
2150 listener_protocol=const.HTTP, pool_protocol=const.HTTP,
2151 algorithm=const.LB_ALGORITHM_SOURCE_IP_PORT)
2152 self._test_member_update(pool_id, alternate_monitor=True)
2153
2154 @decorators.idempotent_id('7c89fb05-d949-4c0f-8c61-7e55e494c76f')
2155 def test_HTTP_SIP_member_update(self):
2156 pool_id = self._listener_pool_create(
2157 listener_protocol=const.HTTP, pool_protocol=const.HTTP,
2158 algorithm=const.LB_ALGORITHM_SOURCE_IP_PORT)
2159 self._test_member_update(pool_id)
2160
2161 @decorators.idempotent_id('edff98be-6208-4f1c-9cd3-376b7ac47f80')
2162 def test_HTTPS_SIP_alt_monitor_member_update(self):
2163 pool_id = self._listener_pool_create(
2164 listener_protocol=const.HTTPS, pool_protocol=const.HTTPS,
2165 algorithm=const.LB_ALGORITHM_SOURCE_IP_PORT)
2166 self._test_member_update(pool_id, alternate_monitor=True)
2167
2168 @decorators.idempotent_id('a1f214fe-6c09-4298-b03e-7069b615dec2')
2169 def test_HTTPS_SIP_member_update(self):
2170 pool_id = self._listener_pool_create(
2171 listener_protocol=const.HTTPS, pool_protocol=const.HTTPS,
2172 algorithm=const.LB_ALGORITHM_SOURCE_IP_PORT)
2173 self._test_member_update(pool_id)
2174
2175 @decorators.idempotent_id('56a21d8e-825a-4780-a073-41061a0d55ca')
2176 def test_PROXY_SIP_alt_monitor_member_update(self):
2177 pool_id = self._listener_pool_create(
2178 listener_protocol=const.TCP, pool_protocol=const.PROXY,
2179 algorithm=const.LB_ALGORITHM_SOURCE_IP_PORT)
2180 self._test_member_update(pool_id, alternate_monitor=True)
2181
2182 @decorators.idempotent_id('25a24e27-218b-4dcd-99aa-e9ca9f8163e5')
2183 def test_PROXY_SIP_member_update(self):
2184 pool_id = self._listener_pool_create(
2185 listener_protocol=const.TCP, pool_protocol=const.PROXY,
2186 algorithm=const.LB_ALGORITHM_SOURCE_IP_PORT)
2187 self._test_member_update(pool_id)
2188
2189 @decorators.idempotent_id('d6625773-2665-423d-8500-cf9b1b38b53e')
2190 def test_TCP_SIP_alt_monitor_member_update(self):
2191 pool_id = self._listener_pool_create(
2192 listener_protocol=const.TCP, pool_protocol=const.TCP,
2193 algorithm=const.LB_ALGORITHM_SOURCE_IP_PORT)
2194 self._test_member_update(pool_id, alternate_monitor=True)
2195
2196 @decorators.idempotent_id('87a3e3aa-580a-41ca-bc15-8cb2995c9125')
2197 def test_TCP_SIP_member_update(self):
2198 pool_id = self._listener_pool_create(
2199 listener_protocol=const.TCP, pool_protocol=const.TCP,
2200 algorithm=const.LB_ALGORITHM_SOURCE_IP_PORT)
2201 self._test_member_update(pool_id)
2202
2203 @decorators.idempotent_id('796a2972-38e6-41fc-a885-6316195acd70')
2204 # Skipping test for amphora driver until "UDP load balancers cannot mix
2205 # protocol versions" (https://storyboard.openstack.org/#!/story/2003329) is
2206 # fixed
2207 @decorators.skip_because(
2208 bug='2003329',
2209 bug_type='storyboard',
2210 condition=(CONF.load_balancer.provider in const.AMPHORA_PROVIDERS and
2211 CONF.load_balancer.test_with_ipv6))
2212 def test_UDP_SIP_alt_monitor_member_update(self):
2213 pool_id = self._listener_pool_create(
2214 listener_protocol=const.UDP, pool_protocol=const.UDP,
2215 algorithm=const.LB_ALGORITHM_SOURCE_IP_PORT)
2216 self._test_member_update(pool_id, alternate_monitor=True)
2217
2218 @decorators.idempotent_id('2f4efa91-e61d-4dd6-8006-ebfdb00c1246')
2219 # Skipping test for amphora driver until "UDP load balancers cannot mix
2220 # protocol versions" (https://storyboard.openstack.org/#!/story/2003329) is
2221 # fixed
2222 @decorators.skip_because(
2223 bug='2003329',
2224 bug_type='storyboard',
2225 condition=(CONF.load_balancer.provider in const.AMPHORA_PROVIDERS and
2226 CONF.load_balancer.test_with_ipv6))
2227 def test_UDP_SIP_member_update(self):
2228 pool_id = self._listener_pool_create(
2229 listener_protocol=const.UDP, pool_protocol=const.UDP,
2230 algorithm=const.LB_ALGORITHM_SOURCE_IP_PORT)
2231 self._test_member_update(pool_id)
2232
2233 def _test_member_update(self, pool_id, alternate_monitor=False,
2234 backup_member=False):
2235 """Tests member show API and field filtering.
2236
2237 * Create a fully populated member.
2238 * Show member details.
2239 * Validate the show reflects the initial values.
2240 * Validates that other accounts cannot update the member.
2241 * Update the member details.
2242 * Show member details.
2243 * Validate the show reflects the initial values.
2244 """
2245 member_name = data_utils.rand_name("lb_member_member1-update")
2246 member_kwargs = {
2247 const.NAME: member_name,
2248 const.ADMIN_STATE_UP: False,
2249 const.POOL_ID: pool_id,
2250 const.ADDRESS: '192.0.2.1',
2251 const.PROTOCOL_PORT: self.member_port.increment(),
2252 const.WEIGHT: 50,
2253 }
2254 if alternate_monitor:
2255 member_kwargs[const.MONITOR_ADDRESS] = '192.0.2.2'
2256 member_kwargs[const.MONITOR_PORT] = 8080
2257
2258 if self.mem_member_client.is_version_supported(
2259 self.api_version, '2.1'):
2260 member_kwargs.update({
2261 const.BACKUP: backup_member,
2262 })
2263
2264 if self.mem_member_client.is_version_supported(
2265 self.api_version, '2.5'):
2266 member_tags = ["Hello", "World"]
2267 member_kwargs.update({
2268 const.TAGS: member_tags
2269 })
2270
2271 if self.lb_member_vip_subnet:
2272 member_kwargs[const.SUBNET_ID] = self.lb_member_vip_subnet[
2273 const.ID]
2274
2275 member = self.mem_member_client.create_member(**member_kwargs)
2276
2277 self.addCleanup(
2278 self.mem_member_client.cleanup_member,
2279 member[const.ID], pool_id=pool_id,
2280 lb_client=self.mem_lb_client, lb_id=self.lb_id)
2281
2282 waiters.wait_for_status(
2283 self.mem_lb_client.show_loadbalancer, self.lb_id,
2284 const.PROVISIONING_STATUS, const.ACTIVE,
2285 CONF.load_balancer.build_interval,
2286 CONF.load_balancer.build_timeout)
2287 member = waiters.wait_for_status(
2288 self.mem_member_client.show_member,
2289 member[const.ID], const.PROVISIONING_STATUS,
2290 const.ACTIVE,
2291 CONF.load_balancer.build_interval,
2292 CONF.load_balancer.build_timeout,
2293 pool_id=pool_id)
2294 status = const.OFFLINE
2295 if CONF.load_balancer.test_with_noop:
2296 status = const.NO_MONITOR
2297 member = waiters.wait_for_status(
2298 self.mem_member_client.show_member,
2299 member[const.ID], const.OPERATING_STATUS,
2300 status,
2301 CONF.load_balancer.build_interval,
2302 CONF.load_balancer.build_timeout,
2303 pool_id=pool_id)
2304
2305 parser.parse(member[const.CREATED_AT])
2306 parser.parse(member[const.UPDATED_AT])
2307 UUID(member[const.ID])
2308
2309 equal_items = [const.NAME, const.ADMIN_STATE_UP, const.ADDRESS,
2310 const.PROTOCOL_PORT, const.WEIGHT]
2311
2312 if self.mem_member_client.is_version_supported(
2313 self.api_version, '2.1'):
2314 equal_items.append(const.BACKUP)
2315
2316 if self.mem_member_client.is_version_supported(
2317 self.api_version, '2.5'):
2318 self.assertCountEqual(member_kwargs[const.TAGS],
2319 member[const.TAGS])
2320
2321 if alternate_monitor:
2322 equal_items += [const.MONITOR_ADDRESS, const.MONITOR_PORT]
2323
2324 if const.SUBNET_ID in member_kwargs:
2325 equal_items.append(const.SUBNET_ID)
2326 else:
2327 self.assertIsNone(member.get(const.SUBNET_ID))
2328
2329 for item in equal_items:
2330 self.assertEqual(member_kwargs[item], member[item])
2331
2332 # Test that a user, without the loadbalancer member role, cannot
2333 # update this member.
2334 expected_allowed = ['os_admin', 'os_roles_lb_admin',
2335 'os_roles_lb_member']
2336 self.check_update_RBAC_enforcement(
2337 'MemberClient', 'update_member',
2338 expected_allowed, None, None, member[const.ID],
2339 pool_id=pool_id, admin_state_up=True)
2340
2341 # Assert we didn't go into PENDING_*
2342 member_check = self.mem_member_client.show_member(
2343 member[const.ID], pool_id=pool_id)
2344 self.assertEqual(const.ACTIVE,
2345 member_check[const.PROVISIONING_STATUS])
2346 self.assertEqual(member_kwargs[const.ADMIN_STATE_UP],
2347 member_check[const.ADMIN_STATE_UP])
2348
2349 new_name = data_utils.rand_name("lb_member_member1-UPDATED")
2350 member_update_kwargs = {
2351 const.POOL_ID: member_kwargs[const.POOL_ID],
2352 const.NAME: new_name,
2353 const.ADMIN_STATE_UP: not member[const.ADMIN_STATE_UP],
2354 const.WEIGHT: member[const.WEIGHT] + 1,
2355 }
2356 if self.mem_member_client.is_version_supported(
2357 self.api_version, '2.1'):
2358 member_update_kwargs.update({
2359 const.BACKUP: not member[const.BACKUP]
2360 })
2361
2362 if self.mem_member_client.is_version_supported(
2363 self.api_version, '2.5'):
2364 new_tags = ["Hola", "Mundo"]
2365 member_update_kwargs.update({
2366 const.TAGS: new_tags
2367 })
2368
2369 if alternate_monitor:
2370 member_update_kwargs[const.MONITOR_ADDRESS] = '192.0.2.3'
2371 member_update_kwargs[const.MONITOR_PORT] = member[
2372 const.MONITOR_PORT] + 1
2373 member = self.mem_member_client.update_member(
2374 member[const.ID], **member_update_kwargs)
2375 waiters.wait_for_status(
2376 self.mem_lb_client.show_loadbalancer, self.lb_id,
2377 const.PROVISIONING_STATUS, const.ACTIVE,
2378 CONF.load_balancer.build_interval,
2379 CONF.load_balancer.build_timeout)
2380 member = waiters.wait_for_status(
2381 self.mem_member_client.show_member,
2382 member[const.ID], const.PROVISIONING_STATUS,
2383 const.ACTIVE,
2384 CONF.load_balancer.build_interval,
2385 CONF.load_balancer.build_timeout,
2386 pool_id=pool_id)
2387 # Operating status will be NO_MONITOR regardless of noop
2388 member = waiters.wait_for_status(
2389 self.mem_member_client.show_member,
2390 member[const.ID], const.OPERATING_STATUS,
2391 const.NO_MONITOR,
2392 CONF.load_balancer.build_interval,
2393 CONF.load_balancer.build_timeout,
2394 pool_id=pool_id)
2395
2396 # Test changed items
2397 equal_items = [const.NAME, const.ADMIN_STATE_UP, const.WEIGHT]
2398
2399 if self.mem_member_client.is_version_supported(
2400 self.api_version, '2.1'):
2401 equal_items.append(const.BACKUP)
2402
2403 if self.mem_member_client.is_version_supported(
2404 self.api_version, '2.5'):
2405 self.assertCountEqual(member_update_kwargs[const.TAGS],
2406 member[const.TAGS])
2407
2408 if alternate_monitor:
2409 equal_items += [const.MONITOR_ADDRESS, const.MONITOR_PORT]
2410
2411 for item in equal_items:
2412 self.assertEqual(member_update_kwargs[item], member[item])
2413
2414 # Test unchanged items
2415 equal_items = [const.ADDRESS, const.PROTOCOL_PORT]
2416 if const.SUBNET_ID in member_kwargs:
2417 equal_items.append(const.SUBNET_ID)
2418 else:
2419 self.assertIsNone(member.get(const.SUBNET_ID))
2420
2421 for item in equal_items:
2422 self.assertEqual(member_kwargs[item], member[item])
2423
2424 @decorators.idempotent_id('8104628d-6f30-4037-ae65-c6f6c1b3af42')
2425 def test_HTTP_LC_member_batch_update(self):
2426 self._test_member_batch_update(const.HTTP,
2427 const.LB_ALGORITHM_LEAST_CONNECTIONS)
2428
2429 @decorators.idempotent_id('c4331afe-c129-44e8-8388-fcbbd28cf783')
2430 def test_HTTP_LC_alt_monitor_member_batch_update(self):
2431 self._test_member_batch_update(const.HTTP,
2432 const.LB_ALGORITHM_LEAST_CONNECTIONS,
2433 alternate_monitor=True)
2434
2435 @decorators.idempotent_id('5ed41de6-8994-4ba4-8107-29eab89fab1e')
2436 def test_HTTPS_LC_member_batch_update(self):
2437 self._test_member_batch_update(const.HTTPS,
2438 const.LB_ALGORITHM_LEAST_CONNECTIONS)
2439
2440 @decorators.idempotent_id('dd4d0a10-0473-47a2-8ec5-815fbdf0c5ee')
2441 def test_HTTPS_LC_alt_monitor_member_batch_update(self):
2442 self._test_member_batch_update(const.HTTPS,
2443 const.LB_ALGORITHM_LEAST_CONNECTIONS,
2444 alternate_monitor=True)
2445
2446 @decorators.idempotent_id('7ae0bd6f-d04c-4d53-bb7e-fef0680726db')
2447 def test_PROXY_LC_member_batch_update(self):
2448 self._test_member_batch_update(const.PROXY,
2449 const.LB_ALGORITHM_LEAST_CONNECTIONS)
2450
2451 @decorators.idempotent_id('de033003-1dcb-4896-ad5d-9e68e31addf0')
2452 def test_PROXY_LC_alt_monitor_member_batch_update(self):
2453 self._test_member_batch_update(const.PROXY,
2454 const.LB_ALGORITHM_LEAST_CONNECTIONS,
2455 alternate_monitor=True)
2456
2457 @decorators.idempotent_id('1d79ab5a-1110-43f1-bfc3-1cb4e2ab5011')
2458 def test_TCP_LC_member_batch_update(self):
2459 self._test_member_batch_update(const.TCP,
2460 const.LB_ALGORITHM_LEAST_CONNECTIONS)
2461
2462 @decorators.idempotent_id('69bd512a-d561-43b1-9a4a-ea7134ee8f9e')
2463 def test_TCP_LC_alt_monitor_member_batch_update(self):
2464 self._test_member_batch_update(const.TCP,
2465 const.LB_ALGORITHM_LEAST_CONNECTIONS,
2466 alternate_monitor=True)
2467
2468 @decorators.idempotent_id('b9fadfe2-c3f2-48a4-97a4-04c58c40df87')
2469 def test_UDP_LC_member_batch_update(self):
2470 self._test_member_batch_update(const.UDP,
2471 const.LB_ALGORITHM_LEAST_CONNECTIONS)
2472
2473 @decorators.idempotent_id('f9a125e0-84c4-4f7e-8a82-fe84ca3175e5')
2474 def test_UDP_LC_alt_monitor_member_batch_update(self):
2475 self._test_member_batch_update(const.UDP,
2476 const.LB_ALGORITHM_LEAST_CONNECTIONS,
2477 alternate_monitor=True)
2478
2479 @decorators.idempotent_id('5f412e52-8ee0-4ee5-8b0e-0e8fc68279a6')
2480 def test_HTTP_RR_member_batch_update(self):
2481 self._test_member_batch_update(const.HTTP,
2482 const.LB_ALGORITHM_ROUND_ROBIN)
2483
2484 @decorators.idempotent_id('83e0a9f2-491f-46a8-b3ce-6969d70a4e9f')
2485 def test_HTTP_RR_alt_monitor_member_batch_update(self):
2486 self._test_member_batch_update(const.HTTP,
2487 const.LB_ALGORITHM_ROUND_ROBIN,
2488 alternate_monitor=True)
2489
2490 @decorators.idempotent_id('ee622c92-a4b4-41a6-96e3-b3b2429276a2')
2491 def test_HTTPS_RR_member_batch_update(self):
2492 self._test_member_batch_update(const.HTTPS,
2493 const.LB_ALGORITHM_ROUND_ROBIN)
2494
2495 @decorators.idempotent_id('7bed4b1c-f862-45bf-ae30-3b4ad0b48870')
2496 def test_HTTPS_RR_alt_monitor_member_batch_update(self):
2497 self._test_member_batch_update(const.HTTPS,
2498 const.LB_ALGORITHM_ROUND_ROBIN,
2499 alternate_monitor=True)
2500
2501 @decorators.idempotent_id('82325d1a-ad01-471e-bfb3-b75ca86ae8eb')
2502 def test_PROXY_RR_member_batch_update(self):
2503 self._test_member_batch_update(const.PROXY,
2504 const.LB_ALGORITHM_ROUND_ROBIN)
2505
2506 @decorators.idempotent_id('098f73c5-e3c1-4dfa-bd7f-c87df90743e6')
2507 def test_PROXY_RR_alt_monitor_member_batch_update(self):
2508 self._test_member_batch_update(const.PROXY,
2509 const.LB_ALGORITHM_ROUND_ROBIN,
2510 alternate_monitor=True)
2511
2512 @decorators.idempotent_id('176cd46e-f5b1-47d1-9403-a0246272eea4')
2513 def test_TCP_RR_member_batch_update(self):
2514 self._test_member_batch_update(const.TCP,
2515 const.LB_ALGORITHM_ROUND_ROBIN)
2516
2517 @decorators.idempotent_id('e952a399-c817-461e-9e37-fdf7e7b34983')
2518 def test_TCP_RR_alt_monitor_member_batch_update(self):
2519 self._test_member_batch_update(const.TCP,
2520 const.LB_ALGORITHM_ROUND_ROBIN,
2521 alternate_monitor=True)
2522
2523 @decorators.idempotent_id('dec6b06d-6a69-48d9-b7a9-67eb287fe95a')
2524 def test_UDP_RR_member_batch_update(self):
2525 self._test_member_batch_update(const.UDP,
2526 const.LB_ALGORITHM_ROUND_ROBIN)
2527
2528 @decorators.idempotent_id('fdf2423c-c312-466a-b021-130a52b5be35')
2529 def test_UDP_RR_alt_monitor_member_batch_update(self):
2530 self._test_member_batch_update(const.UDP,
2531 const.LB_ALGORITHM_ROUND_ROBIN,
2532 alternate_monitor=True)
2533
2534 @decorators.idempotent_id('546ac0c3-4025-4c88-8276-1c05e7198e82')
2535 def test_HTTP_SI_member_batch_update(self):
2536 self._test_member_batch_update(const.HTTP,
2537 const.LB_ALGORITHM_SOURCE_IP)
2538
2539 @decorators.idempotent_id('6c1fe175-8e99-4adf-934d-bee79c89fa02')
2540 def test_HTTP_SI_alt_monitor_member_batch_update(self):
2541 self._test_member_batch_update(const.HTTP,
2542 const.LB_ALGORITHM_SOURCE_IP,
2543 alternate_monitor=True)
2544
2545 @decorators.idempotent_id('3e6c76e0-3630-45f0-a674-5d79b662812b')
2546 def test_HTTPS_SI_member_batch_update(self):
2547 self._test_member_batch_update(const.HTTPS,
2548 const.LB_ALGORITHM_SOURCE_IP)
2549
2550 @decorators.idempotent_id('59303a97-cc97-441e-b1a6-395271ec2287')
2551 def test_HTTPS_SI_alt_monitor_member_batch_update(self):
2552 self._test_member_batch_update(const.HTTPS,
2553 const.LB_ALGORITHM_SOURCE_IP,
2554 alternate_monitor=True)
2555
2556 @decorators.idempotent_id('963d7e71-d8b7-4257-9b01-f1d7ab57cbc8')
2557 def test_PROXY_SI_member_batch_update(self):
2558 self._test_member_batch_update(const.PROXY,
2559 const.LB_ALGORITHM_SOURCE_IP)
2560
2561 @decorators.idempotent_id('f55d8bff-ac68-4e3b-8f05-a9bb69bb0881')
2562 def test_PROXY_SI_alt_monitor_member_batch_update(self):
2563 self._test_member_batch_update(const.PROXY,
2564 const.LB_ALGORITHM_SOURCE_IP,
2565 alternate_monitor=True)
2566
2567 @decorators.idempotent_id('71d20f78-ffe3-49a3-b0c6-38cd5804f255')
2568 def test_TCP_SI_member_batch_update(self):
2569 self._test_member_batch_update(const.TCP,
2570 const.LB_ALGORITHM_SOURCE_IP)
2571
2572 @decorators.idempotent_id('fee72f7a-928d-477f-b09b-5a866be717a3')
2573 def test_TCP_SI_alt_monitor_member_batch_update(self):
2574 self._test_member_batch_update(const.TCP,
2575 const.LB_ALGORITHM_SOURCE_IP,
2576 alternate_monitor=True)
2577
2578 @decorators.idempotent_id('086b407e-3ace-47a8-94e4-cf563674ceb6')
2579 def test_UDP_SI_member_batch_update(self):
2580 self._test_member_batch_update(const.UDP,
2581 const.LB_ALGORITHM_SOURCE_IP)
2582
2583 @decorators.idempotent_id('04259015-b6d7-411b-8c19-f21e05994b7c')
2584 def test_UDP_SI_alt_monitor_member_batch_update(self):
2585 self._test_member_batch_update(const.UDP,
2586 const.LB_ALGORITHM_SOURCE_IP,
2587 alternate_monitor=True)
2588
2589 @decorators.idempotent_id('617028e2-89fb-4e7e-ba62-1a8a7af697ca')
2590 def test_HTTP_SIP_member_batch_update(self):
2591 self._test_member_batch_update(const.HTTP,
2592 const.LB_ALGORITHM_SOURCE_IP_PORT)
2593
2594 @decorators.idempotent_id('44a2508d-ecea-4f92-ba66-a64d6d7f12da')
2595 def test_HTTP_SIP_alt_monitor_member_batch_update(self):
2596 self._test_member_batch_update(const.HTTP,
2597 const.LB_ALGORITHM_SOURCE_IP_PORT,
2598 alternate_monitor=True)
2599
2600 @decorators.idempotent_id('794137e5-28c1-4b0e-bc2f-fc030d03a689')
2601 def test_HTTPS_SIP_member_batch_update(self):
2602 self._test_member_batch_update(const.HTTPS,
2603 const.LB_ALGORITHM_SOURCE_IP_PORT)
2604
2605 @decorators.idempotent_id('c1c8930d-0436-4075-b47a-f3bd263ab8a8')
2606 def test_HTTPS_SIP_alt_monitor_member_batch_update(self):
2607 self._test_member_batch_update(const.HTTPS,
2608 const.LB_ALGORITHM_SOURCE_IP_PORT,
2609 alternate_monitor=True)
2610
2611 @decorators.idempotent_id('1ab05cf2-265e-4291-b17c-19caa0a1b6ff')
2612 def test_PROXY_SIP_member_batch_update(self):
2613 self._test_member_batch_update(const.PROXY,
2614 const.LB_ALGORITHM_SOURCE_IP_PORT)
2615
2616 @decorators.idempotent_id('4de187b6-4948-4394-af6b-8828e96d8f3e')
2617 def test_PROXY_SIP_alt_monitor_member_batch_update(self):
2618 self._test_member_batch_update(const.PROXY,
2619 const.LB_ALGORITHM_SOURCE_IP_PORT,
2620 alternate_monitor=True)
2621
2622 @decorators.idempotent_id('1d171080-c7e5-4ee0-83d4-51bb1655cb21')
2623 def test_TCP_SIP_member_batch_update(self):
2624 self._test_member_batch_update(const.TCP,
2625 const.LB_ALGORITHM_SOURCE_IP_PORT)
2626
2627 @decorators.idempotent_id('52328f7a-bec4-4f23-9293-f5f1283c0af9')
2628 def test_TCP_SIP_alt_monitor_member_batch_update(self):
2629 self._test_member_batch_update(const.TCP,
2630 const.LB_ALGORITHM_SOURCE_IP_PORT,
2631 alternate_monitor=True)
2632
2633 @decorators.idempotent_id('00b3ebda-c28c-471b-bbf8-01de6567b4b5')
2634 def test_UDP_SIP_member_batch_update(self):
2635 self._test_member_batch_update(const.UDP,
2636 const.LB_ALGORITHM_SOURCE_IP_PORT)
2637
2638 @decorators.idempotent_id('e4a357a3-1d07-46f4-a8ff-67a279783b24')
2639 def test_UDP_SIP_alt_monitor_member_batch_update(self):
2640 self._test_member_batch_update(const.UDP,
2641 const.LB_ALGORITHM_SOURCE_IP_PORT,
2642 alternate_monitor=True)
2643
2644 def _test_member_batch_update(self, pool_protocol, algorithm,
2645 alternate_monitor=False):
2646 """Tests member batch update.
2647
2648 * Create two members.
2649 * Batch update the members so one is deleted, created, and updated
2650 * Validate the member list is correct.
2651 """
2652 if (algorithm == const.LB_ALGORITHM_SOURCE_IP_PORT and not
2653 self.mem_listener_client.is_version_supported(
2654 self.api_version, '2.13')):
2655 raise testtools.TestCase.skipException(
2656 'Skipping this test as load balancing algorithm '
2657 'SOURCE_IP_PORT requires API version 2.13 or newer.')
2658 if (pool_protocol == const.UDP and
2659 not self.mem_listener_client.is_version_supported(
2660 self.api_version, '2.1')):
2661 raise self.skipException('UDP support is only available '
2662 'in Octavia API version 2.1 or newer')
2663
2664 pool_name = data_utils.rand_name("lb_member_pool3_member-batch")
2665 # This is a special case as the reference driver does not support
2666 # SOURCE-IP-PORT. Since it runs with not_implemented_is_error, we must
2667 # handle this test case special.
2668 try:
2669 pool = self.mem_pool_client.create_pool(
2670 name=pool_name, loadbalancer_id=self.lb_id,
2671 protocol=pool_protocol,
2672 lb_algorithm=algorithm)
2673 except exceptions.NotImplemented as e:
2674 if algorithm != const.LB_ALGORITHM_SOURCE_IP_PORT:
2675 raise
2676 message = ("The configured provider driver '{driver}' "
2677 "does not support a feature required for this "
2678 "test.".format(driver=CONF.load_balancer.provider))
2679 if hasattr(e, 'resp_body'):
2680 message = e.resp_body.get('faultstring', message)
2681 raise testtools.TestCase.skipException(message)
2682
2683 pool_id = pool[const.ID]
2684
2685 waiters.wait_for_status(self.mem_lb_client.show_loadbalancer,
2686 self.lb_id,
2687 const.PROVISIONING_STATUS,
2688 const.ACTIVE,
2689 CONF.load_balancer.build_interval,
2690 CONF.load_balancer.build_timeout)
2691
2692 member1_name = data_utils.rand_name("lb_member_member1-batch")
2693 member1_kwargs = {
2694 const.NAME: member1_name,
2695 const.ADMIN_STATE_UP: True,
2696 const.POOL_ID: pool_id,
2697 const.ADDRESS: '192.0.2.1',
2698 const.PROTOCOL_PORT: 80,
2699 const.WEIGHT: 50,
2700 }
2701 if alternate_monitor:
2702 member1_kwargs[const.MONITOR_ADDRESS] = '192.0.2.2'
2703 member1_kwargs[const.MONITOR_PORT] = 8080
2704
2705 if self.mem_member_client.is_version_supported(
2706 self.api_version, '2.1'):
2707 member1_kwargs.update({
2708 const.BACKUP: False,
2709 })
2710
2711 if self.lb_member_vip_subnet:
2712 member1_kwargs[const.SUBNET_ID] = self.lb_member_vip_subnet[
2713 const.ID]
2714 member1 = self.mem_member_client.create_member(**member1_kwargs)
2715
2716 self.addCleanup(
2717 self.mem_member_client.cleanup_member,
2718 member1[const.ID], pool_id=pool_id,
2719 lb_client=self.mem_lb_client, lb_id=self.lb_id)
2720
2721 waiters.wait_for_status(self.mem_lb_client.show_loadbalancer,
2722 self.lb_id,
2723 const.PROVISIONING_STATUS,
2724 const.ACTIVE,
2725 CONF.load_balancer.build_interval,
2726 CONF.load_balancer.build_timeout)
2727
2728 member2_name = data_utils.rand_name("lb_member_member2-batch")
2729 member2_kwargs = {
2730 const.NAME: member2_name,
2731 const.ADMIN_STATE_UP: True,
2732 const.POOL_ID: pool_id,
2733 const.ADDRESS: '192.0.2.3',
2734 const.PROTOCOL_PORT: 81,
2735 const.WEIGHT: 51,
2736 }
2737 if self.mem_member_client.is_version_supported(
2738 self.api_version, '2.1'):
2739 member2_kwargs.update({
2740 const.BACKUP: True,
2741 })
2742
2743 if alternate_monitor:
2744 member2_kwargs[const.MONITOR_ADDRESS] = '192.0.2.4'
2745 member2_kwargs[const.MONITOR_PORT] = 8081
2746
2747 if self.lb_member_vip_subnet:
2748 member2_kwargs[const.SUBNET_ID] = self.lb_member_vip_subnet[
2749 const.ID]
2750
2751 member2 = self.mem_member_client.create_member(**member2_kwargs)
2752
2753 self.addCleanup(
2754 self.mem_member_client.cleanup_member,
2755 member2[const.ID], pool_id=pool_id,
2756 lb_client=self.mem_lb_client, lb_id=self.lb_id)
2757
2758 waiters.wait_for_status(self.mem_lb_client.show_loadbalancer,
2759 self.lb_id,
2760 const.PROVISIONING_STATUS,
2761 const.ACTIVE,
2762 CONF.load_balancer.build_interval,
2763 CONF.load_balancer.build_timeout)
2764
2765 member3_name = data_utils.rand_name("lb_member_member3-batch")
2766 member3_kwargs = {
2767 const.NAME: member3_name,
2768 const.ADMIN_STATE_UP: True,
2769 const.ADDRESS: '192.0.2.5',
2770 const.PROTOCOL_PORT: 82,
2771 const.WEIGHT: 52,
2772 }
2773 if self.mem_member_client.is_version_supported(
2774 self.api_version, '2.1'):
2775 member3_kwargs.update({
2776 const.BACKUP: True,
2777 })
2778
2779 if alternate_monitor:
2780 member2_kwargs[const.MONITOR_ADDRESS] = '192.0.2.6'
2781 member2_kwargs[const.MONITOR_PORT] = 8082
2782
2783 if self.lb_member_vip_subnet:
2784 member3_kwargs[const.SUBNET_ID] = self.lb_member_vip_subnet[
2785 const.ID]
2786
2787 member2_name_update = data_utils.rand_name("lb_member_member2-new")
2788 member2_kwargs[const.NAME] = member2_name_update
2789 member2_kwargs.pop(const.POOL_ID)
2790 batch_update_list = [member2_kwargs, member3_kwargs]
2791
2792 # Test that a user, without the loadbalancer member role, cannot
2793 # batch update this member.
2794 expected_allowed = ['os_admin', 'os_roles_lb_admin',
2795 'os_roles_lb_member']
2796 self.check_update_RBAC_enforcement(
2797 'MemberClient', 'update_members',
2798 expected_allowed, None, None,
2799 pool_id=pool_id, members_list=batch_update_list)
2800
2801 # Assert we didn't go into PENDING_*
2802 member_check = self.mem_member_client.show_member(
2803 member2[const.ID], pool_id=pool_id)
2804 self.assertEqual(const.ACTIVE, member_check[const.PROVISIONING_STATUS])
2805 self.assertEqual(member2_name, member_check[const.NAME])
2806
2807 self.mem_member_client.update_members(
2808 pool_id=pool_id, members_list=batch_update_list)
2809
2810 waiters.wait_for_status(
2811 self.mem_lb_client.show_loadbalancer,
2812 self.lb_id, const.PROVISIONING_STATUS,
2813 const.ACTIVE,
2814 CONF.load_balancer.build_interval,
2815 CONF.load_balancer.build_timeout)
2816
2817 members = self.mem_member_client.list_members(
2818 pool_id,
2819 query_params='{sort}={port}:{asc}'.format(
2820 sort=const.SORT, port=const.PROTOCOL_PORT, asc=const.ASC))
2821
2822 # We should have two members: member2 and member3, in that order
2823 self.assertEqual(2, len(members))
2824 # Member2 is the same ID
2825 self.assertEqual(member2[const.ID], members[0][const.ID])
2826 # Member3 will have a different ID (not member1)
2827 self.assertNotEqual(member1[const.ID], members[1][const.ID])
2828
2829 # Member2's name should be updated, and member3 should exist
2830 self.assertEqual(member2_name_update, members[0][const.NAME])
2831 self.assertEqual(member3_name, members[1][const.NAME])
2832
2833 @decorators.idempotent_id('eab8f0dc-0959-4b50-aea2-2f2319305d15')
2834 def test_HTTP_LC_backup_member_delete(self):
2835 if not self.mem_member_client.is_version_supported(
2836 self.api_version, '2.1'):
2837 raise self.skipException('Backup member support is only available '
2838 'in Octavia API version 2.1 or newer')
2839 pool_id = self._listener_pool_create(
2840 listener_protocol=const.HTTP, pool_protocol=const.HTTP,
2841 algorithm=const.LB_ALGORITHM_LEAST_CONNECTIONS)
2842 self._test_member_delete(pool_id, backup_member=True)
2843
2844 @decorators.idempotent_id('8b6574a3-17e8-4950-b24e-66d0c28960d3')
2845 def test_HTTP_LC_member_delete(self):
2846 pool_id = self._listener_pool_create(
2847 listener_protocol=const.HTTP, pool_protocol=const.HTTP,
2848 algorithm=const.LB_ALGORITHM_LEAST_CONNECTIONS)
2849 self._test_member_delete(pool_id)
2850
2851 @decorators.idempotent_id('a122557b-4824-4a4f-87f0-6ba5c9ca1e32')
2852 def test_HTTPS_LC_member_delete(self):
2853 pool_id = self._listener_pool_create(
2854 listener_protocol=const.HTTPS, pool_protocol=const.HTTPS,
2855 algorithm=const.LB_ALGORITHM_LEAST_CONNECTIONS)
2856 self._test_member_delete(pool_id)
2857
2858 @decorators.idempotent_id('069b8558-138f-4d6c-a3ec-9e803d5e2a14')
2859 def test_PROXY_LC_member_delete(self):
2860 pool_id = self._listener_pool_create(
2861 listener_protocol=const.TCP, pool_protocol=const.PROXY,
2862 algorithm=const.LB_ALGORITHM_LEAST_CONNECTIONS)
2863 self._test_member_delete(pool_id)
2864
2865 @decorators.idempotent_id('9b2a08cf-c9ae-4f8a-a15c-2acab09a7613')
2866 def test_TCP_LC_member_delete(self):
2867 pool_id = self._listener_pool_create(
2868 listener_protocol=const.TCP, pool_protocol=const.TCP,
2869 algorithm=const.LB_ALGORITHM_LEAST_CONNECTIONS)
2870 self._test_member_delete(pool_id)
2871
2872 @decorators.idempotent_id('5824438d-cda2-4cea-a7d0-e7f5e5a11cac')
2873 # Skipping test for amphora driver until "UDP load balancers cannot mix
2874 # protocol versions" (https://storyboard.openstack.org/#!/story/2003329) is
2875 # fixed
2876 @decorators.skip_because(
2877 bug='2003329',
2878 bug_type='storyboard',
2879 condition=(CONF.load_balancer.provider in const.AMPHORA_PROVIDERS and
2880 CONF.load_balancer.test_with_ipv6))
2881 def test_UDP_LC_member_delete(self):
2882 pool_id = self._listener_pool_create(
2883 listener_protocol=const.UDP, pool_protocol=const.UDP,
2884 algorithm=const.LB_ALGORITHM_LEAST_CONNECTIONS)
2885 self._test_member_delete(pool_id)
2886
2887 @decorators.idempotent_id('f129ba5e-a16e-4178-924f-6a9c5b8b1589')
2888 def test_HTTP_RR_member_delete(self):
2889 pool_id = self._listener_pool_create(
2890 listener_protocol=const.HTTP, pool_protocol=const.HTTP,
2891 algorithm=const.LB_ALGORITHM_ROUND_ROBIN)
2892 self._test_member_delete(pool_id)
2893
2894 @decorators.idempotent_id('f961105a-9874-4765-b457-3de9f342e226')
2895 def test_HTTPS_RR_member_delete(self):
2896 pool_id = self._listener_pool_create(
2897 listener_protocol=const.HTTPS, pool_protocol=const.HTTPS,
2898 algorithm=const.LB_ALGORITHM_ROUND_ROBIN)
2899 self._test_member_delete(pool_id)
2900
2901 @decorators.idempotent_id('6bca4760-bfb4-4cee-b77f-a77abec3e38e')
2902 def test_PROXY_RR_member_delete(self):
2903 pool_id = self._listener_pool_create(
2904 listener_protocol=const.TCP, pool_protocol=const.PROXY,
2905 algorithm=const.LB_ALGORITHM_ROUND_ROBIN)
2906 self._test_member_delete(pool_id)
2907
2908 @decorators.idempotent_id('f0f5a651-f7f0-40d7-a051-32da07c28252')
2909 def test_TCP_RR_member_delete(self):
2910 pool_id = self._listener_pool_create(
2911 listener_protocol=const.TCP, pool_protocol=const.TCP,
2912 algorithm=const.LB_ALGORITHM_ROUND_ROBIN)
2913 self._test_member_delete(pool_id)
2914
2915 @decorators.idempotent_id('03424069-302d-4020-996c-0a346a97c847')
2916 # Skipping test for amphora driver until "UDP load balancers cannot mix
2917 # protocol versions" (https://storyboard.openstack.org/#!/story/2003329) is
2918 # fixed
2919 @decorators.skip_because(
2920 bug='2003329',
2921 bug_type='storyboard',
2922 condition=(CONF.load_balancer.provider in const.AMPHORA_PROVIDERS and
2923 CONF.load_balancer.test_with_ipv6))
2924 def test_UDP_RR_member_delete(self):
2925 pool_id = self._listener_pool_create(
2926 listener_protocol=const.UDP, pool_protocol=const.UDP,
2927 algorithm=const.LB_ALGORITHM_ROUND_ROBIN)
2928 self._test_member_delete(pool_id)
2929
2930 @decorators.idempotent_id('87d0eac7-e391-4633-88cb-e691eeeab4fc')
2931 def test_HTTP_SI_member_delete(self):
2932 pool_id = self._listener_pool_create(
2933 listener_protocol=const.HTTP, pool_protocol=const.HTTP,
2934 algorithm=const.LB_ALGORITHM_SOURCE_IP)
2935 self._test_member_delete(pool_id)
2936
2937 @decorators.idempotent_id('a919aa78-5221-4321-aa26-fcd3432d843c')
2938 def test_HTTPS_SI_member_delete(self):
2939 pool_id = self._listener_pool_create(
2940 listener_protocol=const.HTTPS, pool_protocol=const.HTTPS,
2941 algorithm=const.LB_ALGORITHM_SOURCE_IP)
2942 self._test_member_delete(pool_id)
2943
2944 @decorators.idempotent_id('92368eef-d9ce-47d9-b3f2-7624601010a0')
2945 def test_PROXY_SI_member_delete(self):
2946 pool_id = self._listener_pool_create(
2947 listener_protocol=const.TCP, pool_protocol=const.PROXY,
2948 algorithm=const.LB_ALGORITHM_SOURCE_IP)
2949 self._test_member_delete(pool_id)
2950
2951 @decorators.idempotent_id('1631c730-f34a-4ae7-91eb-5f5b5052cb55')
2952 def test_TCP_SI_member_delete(self):
2953 pool_id = self._listener_pool_create(
2954 listener_protocol=const.TCP, pool_protocol=const.TCP,
2955 algorithm=const.LB_ALGORITHM_SOURCE_IP)
2956 self._test_member_delete(pool_id)
2957
2958 @decorators.idempotent_id('8e05deee-f385-44d8-a112-2649aeea6006')
2959 # Skipping test for amphora driver until "UDP load balancers cannot mix
2960 # protocol versions" (https://storyboard.openstack.org/#!/story/2003329) is
2961 # fixed
2962 @decorators.skip_because(
2963 bug='2003329',
2964 bug_type='storyboard',
2965 condition=(CONF.load_balancer.provider in const.AMPHORA_PROVIDERS and
2966 CONF.load_balancer.test_with_ipv6))
2967 def test_UDP_SI_member_delete(self):
2968 pool_id = self._listener_pool_create(
2969 listener_protocol=const.UDP, pool_protocol=const.UDP,
2970 algorithm=const.LB_ALGORITHM_SOURCE_IP)
2971 self._test_member_delete(pool_id)
2972
2973 @decorators.idempotent_id('1c9f9dc5-4ba3-44cd-a840-fd0629abfddd')
2974 def test_HTTP_SIP_member_delete(self):
2975 pool_id = self._listener_pool_create(
2976 listener_protocol=const.HTTP, pool_protocol=const.HTTP,
2977 algorithm=const.LB_ALGORITHM_SOURCE_IP_PORT)
2978 self._test_member_delete(pool_id)
2979
2980 @decorators.idempotent_id('93ef7ac1-da00-420d-a367-22e86d968e1c')
2981 def test_HTTPS_SIP_member_delete(self):
2982 pool_id = self._listener_pool_create(
2983 listener_protocol=const.HTTPS, pool_protocol=const.HTTPS,
2984 algorithm=const.LB_ALGORITHM_SOURCE_IP_PORT)
2985 self._test_member_delete(pool_id)
2986
2987 @decorators.idempotent_id('e83b9389-768f-4bcf-a650-17af01243d2b')
2988 def test_PROXY_SIP_member_delete(self):
2989 pool_id = self._listener_pool_create(
2990 listener_protocol=const.TCP, pool_protocol=const.PROXY,
2991 algorithm=const.LB_ALGORITHM_SOURCE_IP_PORT)
2992 self._test_member_delete(pool_id)
2993
2994 @decorators.idempotent_id('eca3d41d-21bd-4547-b8b8-8f87867eb4ad')
2995 def test_TCP_SIP_member_delete(self):
2996 pool_id = self._listener_pool_create(
2997 listener_protocol=const.TCP, pool_protocol=const.TCP,
2998 algorithm=const.LB_ALGORITHM_SOURCE_IP_PORT)
2999 self._test_member_delete(pool_id)
3000
3001 @decorators.idempotent_id('23788358-ac5f-46c4-922a-164e6a13fe0d')
3002 # Skipping test for amphora driver until "UDP load balancers cannot mix
3003 # protocol versions" (https://storyboard.openstack.org/#!/story/2003329) is
3004 # fixed
3005 @decorators.skip_because(
3006 bug='2003329',
3007 bug_type='storyboard',
3008 condition=(CONF.load_balancer.provider in const.AMPHORA_PROVIDERS and
3009 CONF.load_balancer.test_with_ipv6))
3010 def test_UDP_SIP_member_delete(self):
3011 pool_id = self._listener_pool_create(
3012 listener_protocol=const.UDP, pool_protocol=const.UDP,
3013 algorithm=const.LB_ALGORITHM_SOURCE_IP_PORT)
3014 self._test_member_delete(pool_id)
3015
3016 def _test_member_delete(self, pool_id, backup_member=False):
3017 """Tests member create and delete APIs.
3018
3019 * Creates a member.
3020 * Validates that other accounts cannot delete the member
3021 * Deletes the member.
3022 * Validates the member is in the DELETED state.
3023 """
3024 member_name = data_utils.rand_name("lb_member_member1-delete")
3025 member_kwargs = {
3026 const.POOL_ID: pool_id,
3027 const.NAME: member_name,
3028 const.ADDRESS: '192.0.2.1',
3029 const.PROTOCOL_PORT: self.member_port.increment(),
3030 }
3031
3032 if self.mem_member_client.is_version_supported(
3033 self.api_version, '2.1'):
3034 member_kwargs.update({
3035 const.BACKUP: backup_member,
3036 })
3037
3038 member = self.mem_member_client.create_member(**member_kwargs)
3039
3040 self.addCleanup(
3041 self.mem_member_client.cleanup_member,
3042 member[const.ID], pool_id=pool_id,
3043 lb_client=self.mem_lb_client, lb_id=self.lb_id)
3044
3045 waiters.wait_for_status(
3046 self.mem_lb_client.show_loadbalancer,
3047 self.lb_id, const.PROVISIONING_STATUS,
3048 const.ACTIVE,
3049 CONF.load_balancer.build_interval,
3050 CONF.load_balancer.build_timeout)
3051
3052 # Test that a user without the loadbalancer role cannot delete this
3053 # member.
3054 expected_allowed = ['os_admin', 'os_roles_lb_admin',
3055 'os_roles_lb_member']
3056 self.check_delete_RBAC_enforcement(
3057 'MemberClient', 'delete_member', expected_allowed, None, None,
3058 member[const.ID], pool_id=pool_id)
3059
3060 self.mem_member_client.delete_member(member[const.ID],
3061 pool_id=pool_id)
3062
3063 waiters.wait_for_deleted_status_or_not_found(
3064 self.mem_member_client.show_member, member[const.ID],
3065 const.PROVISIONING_STATUS,
3066 CONF.load_balancer.check_interval,
3067 CONF.load_balancer.check_timeout,
3068 pool_id=pool_id)
3069
3070 waiters.wait_for_status(
3071 self.mem_lb_client.show_loadbalancer,
3072 self.lb_id, const.PROVISIONING_STATUS,
3073 const.ACTIVE,
3074 CONF.load_balancer.check_interval,
3075 CONF.load_balancer.check_timeout)