| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
import testtools |
| 16 |
from uuid import UUID |
| 17 |
|
| 18 |
from dateutil import parser |
| 19 |
from tempest import config |
| 20 |
from tempest.lib.common.utils import data_utils |
| 21 |
from tempest.lib.common.utils import misc |
| 22 |
from tempest.lib import decorators |
| 23 |
from tempest.lib import exceptions |
| 24 |
|
| 25 |
from octavia_tempest_plugin.common import constants as const |
| 26 |
from octavia_tempest_plugin.tests import test_base |
| 27 |
from octavia_tempest_plugin.tests import waiters |
| 28 |
|
| 29 |
CONF = config.CONF |
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
@misc.singleton |
| 34 |
class MemberPort(object): |
| 35 |
|
| 36 |
current_port = 8000 |
| 37 |
|
| 38 |
def increment(self): |
| 39 |
self.current_port += 1 |
| 40 |
return self.current_port |
| 41 |
|
| 42 |
|
| 43 |
class MemberScenarioTest(test_base.LoadBalancerBaseTest): |
| 44 |
|
| 45 |
member_address = '2001:db8:0:0:0:0:0:1' |
| 46 |
|
| 47 |
@classmethod |
| 48 |
def resource_setup(cls): |
| 49 |
"""Setup shared resources needed by the tests.""" |
| 50 |
super(MemberScenarioTest, 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 |
|
| 56 |
cls._setup_lb_network_kwargs(lb_kwargs, |
| 57 |
ip_version=4) |
| 58 |
|
| 59 |
cls.current_listener_port = 8000 |
| 60 |
cls.listener_pool_cache = {} |
| 61 |
cls.member_port = MemberPort() |
| 62 |
|
| 63 |
lb = cls.mem_lb_client.create_loadbalancer(**lb_kwargs) |
| 64 |
cls.lb_id = lb[const.ID] |
| 65 |
cls.addClassResourceCleanup( |
| 66 |
cls.mem_lb_client.cleanup_loadbalancer, |
| 67 |
cls.lb_id, cascade=True) |
| 68 |
|
| 69 |
waiters.wait_for_status(cls.mem_lb_client.show_loadbalancer, |
| 70 |
cls.lb_id, const.PROVISIONING_STATUS, |
| 71 |
const.ACTIVE, |
| 72 |
CONF.load_balancer.lb_build_interval, |
| 73 |
CONF.load_balancer.lb_build_timeout) |
| 74 |
|
| 75 |
@classmethod |
| 76 |
def _listener_pool_create(cls, listener_protocol, pool_protocol, |
| 77 |
algorithm): |
| 78 |
"""Setup resources needed by the tests.""" |
| 79 |
if (algorithm == const.LB_ALGORITHM_SOURCE_IP_PORT and not |
| 80 |
cls.mem_listener_client.is_version_supported( |
| 81 |
cls.api_version, '2.13')): |
| 82 |
raise testtools.TestCase.skipException( |
| 83 |
'Skipping this test as load balancing algorithm ' |
| 84 |
'SOURCE_IP_PORT requires API version 2.13 or newer.') |
| 85 |
if (listener_protocol == const.UDP and |
| 86 |
not cls.mem_listener_client.is_version_supported( |
| 87 |
cls.api_version, '2.1')): |
| 88 |
raise cls.skipException('UDP listener support is only available ' |
| 89 |
'in Octavia API version 2.1 or newer') |
| 90 |
|
| 91 |
|
| 92 |
|
| 93 |
listener_pool_key = listener_protocol + pool_protocol + algorithm |
| 94 |
pool_id = cls.listener_pool_cache.get(listener_pool_key, None) |
| 95 |
if pool_id is not None: |
| 96 |
return pool_id |
| 97 |
|
| 98 |
listener_name = data_utils.rand_name("lb_member_listener1_member") |
| 99 |
listener_kwargs = { |
| 100 |
const.NAME: listener_name, |
| 101 |
const.PROTOCOL: listener_protocol, |
| 102 |
const.PROTOCOL_PORT: cls.current_listener_port, |
| 103 |
const.LOADBALANCER_ID: cls.lb_id, |
| 104 |
|
| 105 |
|
| 106 |
const.CONNECTION_LIMIT: 200, |
| 107 |
} |
| 108 |
cls.current_listener_port += 1 |
| 109 |
listener = cls.mem_listener_client.create_listener(**listener_kwargs) |
| 110 |
|
| 111 |
waiters.wait_for_status(cls.mem_lb_client.show_loadbalancer, |
| 112 |
cls.lb_id, const.PROVISIONING_STATUS, |
| 113 |
const.ACTIVE, |
| 114 |
CONF.load_balancer.build_interval, |
| 115 |
CONF.load_balancer.build_timeout) |
| 116 |
|
| 117 |
pool_name = data_utils.rand_name("lb_member_pool1_member") |
| 118 |
pool_kwargs = { |
| 119 |
const.NAME: pool_name, |
| 120 |
const.PROTOCOL: pool_protocol, |
| 121 |
const.LB_ALGORITHM: algorithm, |
| 122 |
const.LISTENER_ID: listener[const.ID], |
| 123 |
} |
| 124 |
try: |
| 125 |
pool = cls.mem_pool_client.create_pool(**pool_kwargs) |
| 126 |
except exceptions.NotImplemented as e: |
| 127 |
if algorithm != const.LB_ALGORITHM_SOURCE_IP_PORT: |
| 128 |
raise |
| 129 |
message = ("The configured provider driver '{driver}' " |
| 130 |
"does not support a feature required for this " |
| 131 |
"test.".format(driver=CONF.load_balancer.provider)) |
| 132 |
if hasattr(e, 'resp_body'): |
| 133 |
message = e.resp_body.get('faultstring', message) |
| 134 |
raise testtools.TestCase.skipException(message) |
| 135 |
|
| 136 |
waiters.wait_for_status(cls.mem_lb_client.show_loadbalancer, |
| 137 |
cls.lb_id, const.PROVISIONING_STATUS, |
| 138 |
const.ACTIVE, |
| 139 |
CONF.load_balancer.build_interval, |
| 140 |
CONF.load_balancer.build_timeout) |
| 141 |
cls.listener_pool_cache[listener_pool_key] = pool[const.ID] |
| 142 |
return pool[const.ID] |
| 143 |
|
| 144 |
@decorators.idempotent_id('33abafca-ce57-479e-8480-843ef412d6a6') |
| 145 |
def test_HTTP_LC_member_crud(self): |
| 146 |
pool_id = self._listener_pool_create( |
| 147 |
const.HTTP, const.HTTP, const.LB_ALGORITHM_LEAST_CONNECTIONS) |
| 148 |
self._test_member_CRUD(pool_id) |
| 149 |
|
| 150 |
@decorators.idempotent_id('eab4eb32-b26f-4fe1-a606-1574b5b6182c') |
| 151 |
def test_HTTP_LC_alt_monitor_member_crud(self): |
| 152 |
pool_id = self._listener_pool_create( |
| 153 |
const.HTTP, const.HTTP, const.LB_ALGORITHM_LEAST_CONNECTIONS) |
| 154 |
self._test_member_CRUD(pool_id, alternate_monitoring=True) |
| 155 |
|
| 156 |
@decorators.idempotent_id('80355701-bc68-4cba-a9b3-4f35fc192b6a') |
| 157 |
def test_HTTPS_LC_member_crud(self): |
| 158 |
pool_id = self._listener_pool_create( |
| 159 |
const.HTTPS, const.HTTPS, const.LB_ALGORITHM_LEAST_CONNECTIONS) |
| 160 |
self._test_member_CRUD(pool_id) |
| 161 |
|
| 162 |
@decorators.idempotent_id('6f8fce94-b2aa-4497-b80f-74293d977d25') |
| 163 |
def test_HTTPS_LC_alt_monitor_member_crud(self): |
| 164 |
pool_id = self._listener_pool_create( |
| 165 |
const.HTTPS, const.HTTPS, const.LB_ALGORITHM_LEAST_CONNECTIONS) |
| 166 |
self._test_member_CRUD(pool_id, alternate_monitoring=True) |
| 167 |
|
| 168 |
@decorators.idempotent_id('0e45c423-db43-4fee-8442-d9daabe6b2aa') |
| 169 |
def test_PROXY_LC_member_crud(self): |
| 170 |
pool_id = self._listener_pool_create( |
| 171 |
const.TCP, const.PROXY, const.LB_ALGORITHM_LEAST_CONNECTIONS) |
| 172 |
self._test_member_CRUD(pool_id) |
| 173 |
|
| 174 |
@decorators.idempotent_id('3ea2aad1-5650-4ec6-8394-501de33cce70') |
| 175 |
def test_PROXY_LC_alt_monitor_member_crud(self): |
| 176 |
pool_id = self._listener_pool_create( |
| 177 |
const.TCP, const.PROXY, const.LB_ALGORITHM_LEAST_CONNECTIONS) |
| 178 |
self._test_member_CRUD(pool_id, alternate_monitoring=True) |
| 179 |
|
| 180 |
@decorators.idempotent_id('9b2e7e2d-776b-419c-9717-ab4fef9cd5ca') |
| 181 |
def test_TCP_LC_member_crud(self): |
| 182 |
pool_id = self._listener_pool_create( |
| 183 |
const.TCP, const.TCP, const.LB_ALGORITHM_LEAST_CONNECTIONS) |
| 184 |
self._test_member_CRUD(pool_id) |
| 185 |
|
| 186 |
@decorators.idempotent_id('06b95367-dc81-41e5-9a53-981833fb2979') |
| 187 |
def test_TCP_LC_alt_monitor_member_crud(self): |
| 188 |
pool_id = self._listener_pool_create( |
| 189 |
const.TCP, const.TCP, const.LB_ALGORITHM_LEAST_CONNECTIONS) |
| 190 |
self._test_member_CRUD(pool_id, alternate_monitoring=True) |
| 191 |
|
| 192 |
@decorators.idempotent_id('c70bd8c6-0f6a-4ee7-840f-a3355aefd471') |
| 193 |
def test_UDP_LC_member_crud(self): |
| 194 |
pool_id = self._listener_pool_create( |
| 195 |
const.UDP, const.UDP, const.LB_ALGORITHM_LEAST_CONNECTIONS) |
| 196 |
self._test_member_CRUD(pool_id) |
| 197 |
|
| 198 |
@decorators.idempotent_id('0b4ec248-c6a0-4d29-b77e-189453ec0535') |
| 199 |
def test_UDP_LC_alt_monitor_member_crud(self): |
| 200 |
pool_id = self._listener_pool_create( |
| 201 |
const.UDP, const.UDP, const.LB_ALGORITHM_LEAST_CONNECTIONS) |
| 202 |
self._test_member_CRUD(pool_id, alternate_monitoring=True) |
| 203 |
|
| 204 |
@decorators.idempotent_id('15c8c3e3-569c-4029-95df-a9f72049e267') |
| 205 |
def test_HTTP_RR_member_crud(self): |
| 206 |
pool_id = self._listener_pool_create( |
| 207 |
const.HTTP, const.HTTP, const.LB_ALGORITHM_ROUND_ROBIN) |
| 208 |
self._test_member_CRUD(pool_id) |
| 209 |
|
| 210 |
@decorators.idempotent_id('a0f02494-ffb3-47be-8670-f56c0df9ec94') |
| 211 |
def test_HTTP_RR_alt_monitor_member_crud(self): |
| 212 |
pool_id = self._listener_pool_create( |
| 213 |
const.HTTP, const.HTTP, const.LB_ALGORITHM_ROUND_ROBIN) |
| 214 |
self._test_member_CRUD(pool_id, alternate_monitoring=True) |
| 215 |
|
| 216 |
@decorators.idempotent_id('57aee0db-3295-42b7-a7d3-aae942a6cb41') |
| 217 |
def test_HTTPS_RR_member_crud(self): |
| 218 |
pool_id = self._listener_pool_create( |
| 219 |
const.HTTPS, const.HTTPS, const.LB_ALGORITHM_ROUND_ROBIN) |
| 220 |
self._test_member_CRUD(pool_id) |
| 221 |
|
| 222 |
@decorators.idempotent_id('6c3e5bd7-4573-4f6d-ac64-31b238c9ea51') |
| 223 |
def test_HTTPS_RR_alt_monitor_member_crud(self): |
| 224 |
pool_id = self._listener_pool_create( |
| 225 |
const.HTTPS, const.HTTPS, const.LB_ALGORITHM_ROUND_ROBIN) |
| 226 |
self._test_member_CRUD(pool_id, alternate_monitoring=True) |
| 227 |
|
| 228 |
@decorators.idempotent_id('e0ad1fa0-1fdb-472d-9d69-8968631c9239') |
| 229 |
def test_PROXY_RR_member_crud(self): |
| 230 |
pool_id = self._listener_pool_create( |
| 231 |
const.TCP, const.PROXY, const.LB_ALGORITHM_ROUND_ROBIN) |
| 232 |
self._test_member_CRUD(pool_id) |
| 233 |
|
| 234 |
@decorators.idempotent_id('534fbc38-1c70-4c67-8f89-74a6905b1c98') |
| 235 |
def test_PROXY_RR_alt_monitor_member_crud(self): |
| 236 |
pool_id = self._listener_pool_create( |
| 237 |
const.TCP, const.PROXY, const.LB_ALGORITHM_ROUND_ROBIN) |
| 238 |
self._test_member_CRUD(pool_id, alternate_monitoring=True) |
| 239 |
|
| 240 |
@decorators.idempotent_id('c4c72e4b-5abe-41df-9f1d-6a8a27c75a80') |
| 241 |
def test_TCP_RR_member_crud(self): |
| 242 |
pool_id = self._listener_pool_create( |
| 243 |
const.TCP, const.TCP, const.LB_ALGORITHM_ROUND_ROBIN) |
| 244 |
self._test_member_CRUD(pool_id) |
| 245 |
|
| 246 |
@decorators.idempotent_id('673425e0-2a57-4c92-a416-7b4e0824708f') |
| 247 |
def test_TCP_RR_alt_monitor_member_crud(self): |
| 248 |
pool_id = self._listener_pool_create( |
| 249 |
const.TCP, const.TCP, const.LB_ALGORITHM_ROUND_ROBIN) |
| 250 |
self._test_member_CRUD(pool_id, alternate_monitoring=True) |
| 251 |
|
| 252 |
@decorators.idempotent_id('f08c9efc-b69c-4c0f-a731-74ec8c17fc91') |
| 253 |
def test_UDP_RR_member_crud(self): |
| 254 |
pool_id = self._listener_pool_create( |
| 255 |
const.UDP, const.UDP, const.LB_ALGORITHM_ROUND_ROBIN) |
| 256 |
self._test_member_CRUD(pool_id) |
| 257 |
|
| 258 |
@decorators.idempotent_id('94829e1e-506e-4f3c-ab04-4e338787ccfd') |
| 259 |
def test_UDP_RR_alt_monitor_member_crud(self): |
| 260 |
pool_id = self._listener_pool_create( |
| 261 |
const.UDP, const.UDP, const.LB_ALGORITHM_ROUND_ROBIN) |
| 262 |
self._test_member_CRUD(pool_id, alternate_monitoring=True) |
| 263 |
|
| 264 |
@decorators.idempotent_id('07d1e571-d12c-4e04-90d1-8f4f42610df3') |
| 265 |
def test_HTTP_SI_member_crud(self): |
| 266 |
pool_id = self._listener_pool_create( |
| 267 |
const.HTTP, const.HTTP, const.LB_ALGORITHM_SOURCE_IP) |
| 268 |
self._test_member_CRUD(pool_id) |
| 269 |
|
| 270 |
@decorators.idempotent_id('3910a7ec-63c5-4152-9fe1-ce21d3e1cdca') |
| 271 |
def test_HTTP_SI_alt_monitor_member_crud(self): |
| 272 |
pool_id = self._listener_pool_create( |
| 273 |
const.HTTP, const.HTTP, const.LB_ALGORITHM_SOURCE_IP) |
| 274 |
self._test_member_CRUD(pool_id, alternate_monitoring=True) |
| 275 |
|
| 276 |
@decorators.idempotent_id('32b0b541-29dc-464b-91c1-115413539de7') |
| 277 |
def test_HTTPS_SI_member_crud(self): |
| 278 |
pool_id = self._listener_pool_create( |
| 279 |
const.HTTPS, const.HTTPS, const.LB_ALGORITHM_SOURCE_IP) |
| 280 |
self._test_member_CRUD(pool_id) |
| 281 |
|
| 282 |
@decorators.idempotent_id('d59ea523-8dac-4e19-8df4-a7076a17296c') |
| 283 |
def test_HTTPS_SI_alt_monitor_member_crud(self): |
| 284 |
pool_id = self._listener_pool_create( |
| 285 |
const.HTTPS, const.HTTPS, const.LB_ALGORITHM_SOURCE_IP) |
| 286 |
self._test_member_CRUD(pool_id, alternate_monitoring=True) |
| 287 |
|
| 288 |
@decorators.idempotent_id('12348506-1cfc-4d62-9cc2-d380776a9154') |
| 289 |
def test_PROXY_SI_member_crud(self): |
| 290 |
pool_id = self._listener_pool_create( |
| 291 |
const.TCP, const.PROXY, const.LB_ALGORITHM_SOURCE_IP) |
| 292 |
self._test_member_CRUD(pool_id) |
| 293 |
|
| 294 |
@decorators.idempotent_id('5d3879a6-d103-4800-bca4-1ef18ecbee68') |
| 295 |
def test_PROXY_SI_alt_monitor_member_crud(self): |
| 296 |
pool_id = self._listener_pool_create( |
| 297 |
const.TCP, const.PROXY, const.LB_ALGORITHM_SOURCE_IP) |
| 298 |
self._test_member_CRUD(pool_id, alternate_monitoring=True) |
| 299 |
|
| 300 |
@decorators.idempotent_id('efb158e2-de75-4d8b-8566-a0fa5fd75173') |
| 301 |
def test_TCP_SI_member_crud(self): |
| 302 |
pool_id = self._listener_pool_create( |
| 303 |
const.TCP, const.TCP, const.LB_ALGORITHM_SOURCE_IP) |
| 304 |
self._test_member_CRUD(pool_id) |
| 305 |
|
| 306 |
@decorators.idempotent_id('4f1661e5-1dff-4910-9ecd-96327ea3e873') |
| 307 |
def test_TCP_SI_alt_monitor_member_crud(self): |
| 308 |
pool_id = self._listener_pool_create( |
| 309 |
const.TCP, const.TCP, const.LB_ALGORITHM_SOURCE_IP) |
| 310 |
self._test_member_CRUD(pool_id, alternate_monitoring=True) |
| 311 |
|
| 312 |
@decorators.idempotent_id('0984583b-daaf-4509-bf1f-ff3acf33836b') |
| 313 |
def test_UDP_SI_member_crud(self): |
| 314 |
pool_id = self._listener_pool_create( |
| 315 |
const.UDP, const.UDP, const.LB_ALGORITHM_SOURCE_IP) |
| 316 |
self._test_member_CRUD(pool_id) |
| 317 |
|
| 318 |
@decorators.idempotent_id('16b84495-e8f8-4e7b-b242-43a6e00fb8ad') |
| 319 |
def test_UDP_SI_alt_monitor_member_crud(self): |
| 320 |
pool_id = self._listener_pool_create( |
| 321 |
const.UDP, const.UDP, const.LB_ALGORITHM_SOURCE_IP) |
| 322 |
self._test_member_CRUD(pool_id, alternate_monitoring=True) |
| 323 |
|
| 324 |
@decorators.idempotent_id('ab8f46fe-0c84-4755-a9a2-80cc1fbdea18') |
| 325 |
def test_HTTP_SIP_member_crud(self): |
| 326 |
pool_id = self._listener_pool_create( |
| 327 |
const.HTTP, const.HTTP, const.LB_ALGORITHM_SOURCE_IP_PORT) |
| 328 |
self._test_member_CRUD(pool_id) |
| 329 |
|
| 330 |
@decorators.idempotent_id('7470bea5-9ea0-4e04-a82f-a0bed202b97d') |
| 331 |
def test_HTTP_SIP_alt_monitor_member_crud(self): |
| 332 |
pool_id = self._listener_pool_create( |
| 333 |
const.HTTP, const.HTTP, const.LB_ALGORITHM_SOURCE_IP_PORT) |
| 334 |
self._test_member_CRUD(pool_id, alternate_monitoring=True) |
| 335 |
|
| 336 |
@decorators.idempotent_id('e59e9a7d-b6e7-43e9-b9d5-0717f113d769') |
| 337 |
def test_HTTPS_SIP_member_crud(self): |
| 338 |
pool_id = self._listener_pool_create( |
| 339 |
const.HTTPS, const.HTTPS, const.LB_ALGORITHM_SOURCE_IP_PORT) |
| 340 |
self._test_member_CRUD(pool_id) |
| 341 |
|
| 342 |
@decorators.idempotent_id('761e1acd-3f4c-4e02-89e1-f89adfe2e3f9') |
| 343 |
def test_HTTPS_SIP_alt_monitor_member_crud(self): |
| 344 |
pool_id = self._listener_pool_create( |
| 345 |
const.HTTPS, const.HTTPS, const.LB_ALGORITHM_SOURCE_IP_PORT) |
| 346 |
self._test_member_CRUD(pool_id, alternate_monitoring=True) |
| 347 |
|
| 348 |
@decorators.idempotent_id('ba7b0c73-df44-4a1a-a610-a107daabc36d') |
| 349 |
def test_PROXY_SIP_member_crud(self): |
| 350 |
pool_id = self._listener_pool_create( |
| 351 |
const.TCP, const.PROXY, const.LB_ALGORITHM_SOURCE_IP_PORT) |
| 352 |
self._test_member_CRUD(pool_id) |
| 353 |
|
| 354 |
@decorators.idempotent_id('ad43bc3f-2664-42c4-999f-9763facb8d15') |
| 355 |
def test_PROXY_SIP_alt_monitor_member_crud(self): |
| 356 |
pool_id = self._listener_pool_create( |
| 357 |
const.TCP, const.PROXY, const.LB_ALGORITHM_SOURCE_IP_PORT) |
| 358 |
self._test_member_CRUD(pool_id, alternate_monitoring=True) |
| 359 |
|
| 360 |
@decorators.idempotent_id('3341d05c-c199-496f-ac40-6248818ce831') |
| 361 |
def test_TCP_SIP_member_crud(self): |
| 362 |
pool_id = self._listener_pool_create( |
| 363 |
const.TCP, const.TCP, const.LB_ALGORITHM_SOURCE_IP_PORT) |
| 364 |
self._test_member_CRUD(pool_id) |
| 365 |
|
| 366 |
@decorators.idempotent_id('5872f1de-1a33-4c20-bc02-7d058e3c3b55') |
| 367 |
def test_TCP_SIP_alt_monitor_member_crud(self): |
| 368 |
pool_id = self._listener_pool_create( |
| 369 |
const.TCP, const.TCP, const.LB_ALGORITHM_SOURCE_IP_PORT) |
| 370 |
self._test_member_CRUD(pool_id, alternate_monitoring=True) |
| 371 |
|
| 372 |
@decorators.idempotent_id('9550835b-c9ef-44e3-8087-151c25a95168') |
| 373 |
def test_UDP_SIP_member_crud(self): |
| 374 |
pool_id = self._listener_pool_create( |
| 375 |
const.UDP, const.UDP, const.LB_ALGORITHM_SOURCE_IP_PORT) |
| 376 |
self._test_member_CRUD(pool_id) |
| 377 |
|
| 378 |
@decorators.idempotent_id('5f40b080-0f2c-4791-a509-da7cfe9eace4') |
| 379 |
def test_UDP_SIP_alt_monitor_member_crud(self): |
| 380 |
pool_id = self._listener_pool_create( |
| 381 |
const.UDP, const.UDP, const.LB_ALGORITHM_SOURCE_IP_PORT) |
| 382 |
self._test_member_CRUD(pool_id, alternate_monitoring=True) |
| 383 |
|
| 384 |
def _test_member_CRUD(self, pool_id, alternate_monitoring=False): |
| 385 |
"""Tests member create, read, update, delete |
| 386 |
|
| 387 |
* Create a fully populated member. |
| 388 |
* Show member details. |
| 389 |
* Update the member. |
| 390 |
* Delete the member. |
| 391 |
""" |
| 392 |
|
| 393 |
|
| 394 |
member_name = data_utils.rand_name("lb_member_member1-CRUD") |
| 395 |
member_kwargs = { |
| 396 |
const.NAME: member_name, |
| 397 |
const.ADMIN_STATE_UP: True, |
| 398 |
const.POOL_ID: pool_id, |
| 399 |
const.ADDRESS: '192.0.2.1', |
| 400 |
const.PROTOCOL_PORT: 80, |
| 401 |
const.WEIGHT: 50, |
| 402 |
} |
| 403 |
if alternate_monitoring: |
| 404 |
member_kwargs[const.MONITOR_ADDRESS] = '192.0.2.2' |
| 405 |
member_kwargs[const.MONITOR_PORT] = 8080 |
| 406 |
|
| 407 |
if self.mem_member_client.is_version_supported( |
| 408 |
self.api_version, '2.1'): |
| 409 |
member_kwargs.update({ |
| 410 |
const.BACKUP: False, |
| 411 |
}) |
| 412 |
|
| 413 |
if self.lb_member_vip_subnet: |
| 414 |
member_kwargs[const.SUBNET_ID] = self.lb_member_vip_subnet[ |
| 415 |
const.ID] |
| 416 |
|
| 417 |
member = self.mem_member_client.create_member(**member_kwargs) |
| 418 |
self.addCleanup( |
| 419 |
self.mem_member_client.cleanup_member, |
| 420 |
member[const.ID], pool_id=pool_id, |
| 421 |
lb_client=self.mem_lb_client, lb_id=self.lb_id) |
| 422 |
|
| 423 |
waiters.wait_for_status( |
| 424 |
self.mem_lb_client.show_loadbalancer, self.lb_id, |
| 425 |
const.PROVISIONING_STATUS, const.ACTIVE, |
| 426 |
CONF.load_balancer.build_interval, |
| 427 |
CONF.load_balancer.build_timeout) |
| 428 |
member = waiters.wait_for_status( |
| 429 |
self.mem_member_client.show_member, |
| 430 |
member[const.ID], const.PROVISIONING_STATUS, |
| 431 |
const.ACTIVE, |
| 432 |
CONF.load_balancer.build_interval, |
| 433 |
CONF.load_balancer.build_timeout, |
| 434 |
pool_id=pool_id) |
| 435 |
|
| 436 |
parser.parse(member[const.CREATED_AT]) |
| 437 |
parser.parse(member[const.UPDATED_AT]) |
| 438 |
UUID(member[const.ID]) |
| 439 |
|
| 440 |
|
| 441 |
|
| 442 |
|
| 443 |
member = waiters.wait_for_status( |
| 444 |
self.mem_member_client.show_member, |
| 445 |
member[const.ID], const.OPERATING_STATUS, |
| 446 |
const.NO_MONITOR, |
| 447 |
CONF.load_balancer.check_interval, |
| 448 |
CONF.load_balancer.check_timeout, |
| 449 |
pool_id=pool_id) |
| 450 |
|
| 451 |
equal_items = [const.NAME, const.ADMIN_STATE_UP, const.ADDRESS, |
| 452 |
const.PROTOCOL_PORT, const.WEIGHT] |
| 453 |
if alternate_monitoring: |
| 454 |
equal_items += [const.MONITOR_ADDRESS, const.MONITOR_PORT] |
| 455 |
|
| 456 |
if self.mem_member_client.is_version_supported( |
| 457 |
self.api_version, '2.1'): |
| 458 |
equal_items.append(const.BACKUP) |
| 459 |
|
| 460 |
if const.SUBNET_ID in member_kwargs: |
| 461 |
equal_items.append(const.SUBNET_ID) |
| 462 |
else: |
| 463 |
self.assertIsNone(member.get(const.SUBNET_ID)) |
| 464 |
|
| 465 |
for item in equal_items: |
| 466 |
self.assertEqual(member_kwargs[item], member[item]) |
| 467 |
|
| 468 |
|
| 469 |
new_name = data_utils.rand_name("lb_member_member1-update") |
| 470 |
member_update_kwargs = { |
| 471 |
const.POOL_ID: member_kwargs[const.POOL_ID], |
| 472 |
const.NAME: new_name, |
| 473 |
const.ADMIN_STATE_UP: not member[const.ADMIN_STATE_UP], |
| 474 |
const.WEIGHT: member[const.WEIGHT] + 1, |
| 475 |
} |
| 476 |
if self.mem_member_client.is_version_supported( |
| 477 |
self.api_version, '2.1'): |
| 478 |
member_update_kwargs.update({ |
| 479 |
const.BACKUP: not member[const.BACKUP], |
| 480 |
}) |
| 481 |
|
| 482 |
if alternate_monitoring: |
| 483 |
member_update_kwargs[const.MONITOR_ADDRESS] = '192.0.2.3' |
| 484 |
member_update_kwargs[const.MONITOR_PORT] = member[ |
| 485 |
const.MONITOR_PORT] + 1 |
| 486 |
member = self.mem_member_client.update_member( |
| 487 |
member[const.ID], **member_update_kwargs) |
| 488 |
|
| 489 |
waiters.wait_for_status( |
| 490 |
self.mem_lb_client.show_loadbalancer, self.lb_id, |
| 491 |
const.PROVISIONING_STATUS, const.ACTIVE, |
| 492 |
CONF.load_balancer.build_interval, |
| 493 |
CONF.load_balancer.build_timeout) |
| 494 |
member = waiters.wait_for_status( |
| 495 |
self.mem_member_client.show_member, |
| 496 |
member[const.ID], const.PROVISIONING_STATUS, |
| 497 |
const.ACTIVE, |
| 498 |
CONF.load_balancer.build_interval, |
| 499 |
CONF.load_balancer.build_timeout, |
| 500 |
pool_id=pool_id) |
| 501 |
|
| 502 |
|
| 503 |
equal_items = [const.NAME, const.ADMIN_STATE_UP, const.WEIGHT] |
| 504 |
if alternate_monitoring: |
| 505 |
equal_items += [const.MONITOR_ADDRESS, const.MONITOR_PORT] |
| 506 |
if self.mem_member_client.is_version_supported( |
| 507 |
self.api_version, '2.1'): |
| 508 |
equal_items.append(const.BACKUP) |
| 509 |
|
| 510 |
for item in equal_items: |
| 511 |
self.assertEqual(member_update_kwargs[item], member[item]) |
| 512 |
|
| 513 |
|
| 514 |
equal_items = [const.ADDRESS, const.PROTOCOL_PORT] |
| 515 |
if const.SUBNET_ID in member_kwargs: |
| 516 |
equal_items.append(const.SUBNET_ID) |
| 517 |
else: |
| 518 |
self.assertIsNone(member.get(const.SUBNET_ID)) |
| 519 |
|
| 520 |
for item in equal_items: |
| 521 |
self.assertEqual(member_kwargs[item], member[item]) |
| 522 |
|
| 523 |
|
| 524 |
waiters.wait_for_status( |
| 525 |
self.mem_lb_client.show_loadbalancer, |
| 526 |
self.lb_id, const.PROVISIONING_STATUS, |
| 527 |
const.ACTIVE, |
| 528 |
CONF.load_balancer.check_interval, |
| 529 |
CONF.load_balancer.check_timeout) |
| 530 |
self.mem_member_client.delete_member( |
| 531 |
member[const.ID], |
| 532 |
pool_id=pool_id) |
| 533 |
|
| 534 |
waiters.wait_for_deleted_status_or_not_found( |
| 535 |
self.mem_member_client.show_member, member[const.ID], |
| 536 |
const.PROVISIONING_STATUS, |
| 537 |
CONF.load_balancer.check_interval, |
| 538 |
CONF.load_balancer.check_timeout, |
| 539 |
pool_id=pool_id) |
| 540 |
|
| 541 |
waiters.wait_for_status( |
| 542 |
self.mem_lb_client.show_loadbalancer, |
| 543 |
self.lb_id, const.PROVISIONING_STATUS, |
| 544 |
const.ACTIVE, |
| 545 |
CONF.load_balancer.check_interval, |
| 546 |
CONF.load_balancer.check_timeout) |
| 547 |
|
| 548 |
def _test_mixed_member_create(self, pool_id): |
| 549 |
member_name = data_utils.rand_name("lb_member_member1-create") |
| 550 |
member_kwargs = { |
| 551 |
const.NAME: member_name, |
| 552 |
const.ADMIN_STATE_UP: True, |
| 553 |
const.POOL_ID: pool_id, |
| 554 |
const.ADDRESS: self.member_address, |
| 555 |
const.PROTOCOL_PORT: 80, |
| 556 |
const.WEIGHT: 50, |
| 557 |
} |
| 558 |
|
| 559 |
if self.lb_member_vip_subnet: |
| 560 |
member_kwargs[const.SUBNET_ID] = ( |
| 561 |
self.lb_member_vip_subnet[const.ID]) |
| 562 |
|
| 563 |
member = self.mem_member_client.create_member( |
| 564 |
**member_kwargs) |
| 565 |
self.addCleanup( |
| 566 |
self.mem_member_client.cleanup_member, |
| 567 |
member[const.ID], pool_id=pool_id, |
| 568 |
lb_client=self.mem_lb_client, lb_id=self.lb_id) |
| 569 |
waiters.wait_for_status( |
| 570 |
self.mem_lb_client.show_loadbalancer, self.lb_id, |
| 571 |
const.PROVISIONING_STATUS, const.ACTIVE, |
| 572 |
CONF.load_balancer.check_interval, |
| 573 |
CONF.load_balancer.check_timeout) |
| 574 |
|
| 575 |
@decorators.idempotent_id('f9bc8ef1-cf21-41e5-819d-7561173e5286') |
| 576 |
@testtools.skipUnless(CONF.load_balancer.test_with_ipv6, |
| 577 |
'IPv6 testing is disabled') |
| 578 |
def test_mixed_HTTP_LC_member_create(self): |
| 579 |
"""Test the member creation with mixed IP protocol members/VIP.""" |
| 580 |
pool_id = self._listener_pool_create( |
| 581 |
const.HTTP, const.HTTP, const.LB_ALGORITHM_LEAST_CONNECTIONS) |
| 582 |
self._test_mixed_member_create(pool_id) |
| 583 |
|
| 584 |
@decorators.idempotent_id('e63c89a7-30a3-4eff-8ff5-dd62a5ecec0f') |
| 585 |
@testtools.skipUnless(CONF.load_balancer.test_with_ipv6, |
| 586 |
'IPv6 testing is disabled') |
| 587 |
def test_mixed_HTTPS_LC_member_create(self): |
| 588 |
"""Test the member creation with mixed IP protocol members/VIP.""" |
| 589 |
pool_id = self._listener_pool_create( |
| 590 |
const.HTTPS, const.HTTPS, const.LB_ALGORITHM_LEAST_CONNECTIONS) |
| 591 |
self._test_mixed_member_create(pool_id) |
| 592 |
|
| 593 |
@decorators.idempotent_id('efaa9ed0-c261-4184-9693-0020965606a8') |
| 594 |
@testtools.skipUnless(CONF.load_balancer.test_with_ipv6, |
| 595 |
'IPv6 testing is disabled') |
| 596 |
def test_mixed_PROXY_LC_member_create(self): |
| 597 |
"""Test the member creation with mixed IP protocol members/VIP.""" |
| 598 |
pool_id = self._listener_pool_create( |
| 599 |
const.TCP, const.PROXY, const.LB_ALGORITHM_LEAST_CONNECTIONS) |
| 600 |
self._test_mixed_member_create(pool_id) |
| 601 |
|
| 602 |
@decorators.idempotent_id('f4ac056c-2cb8-457f-b1b1-9b49226f9b9f') |
| 603 |
@testtools.skipUnless(CONF.load_balancer.test_with_ipv6, |
| 604 |
'IPv6 testing is disabled') |
| 605 |
def test_mixed_TCP_LC_member_create(self): |
| 606 |
"""Test the member creation with mixed IP protocol members/VIP.""" |
| 607 |
pool_id = self._listener_pool_create( |
| 608 |
const.TCP, const.TCP, const.LB_ALGORITHM_LEAST_CONNECTIONS) |
| 609 |
self._test_mixed_member_create(pool_id) |
| 610 |
|
| 611 |
@decorators.idempotent_id('90e22b80-d52b-4af2-9c4d-9be44eed9575') |
| 612 |
@testtools.skipUnless(CONF.load_balancer.test_with_ipv6, |
| 613 |
'IPv6 testing is disabled') |
| 614 |
|
| 615 |
|
| 616 |
|
| 617 |
@decorators.skip_because( |
| 618 |
bug='2003329', |
| 619 |
bug_type='storyboard', |
| 620 |
condition=CONF.load_balancer.provider in const.AMPHORA_PROVIDERS) |
| 621 |
def test_mixed_UDP_LC_member_create(self): |
| 622 |
"""Test the member creation with mixed IP protocol members/VIP.""" |
| 623 |
if not self.mem_listener_client.is_version_supported( |
| 624 |
self.api_version, '2.1'): |
| 625 |
raise self.skipException('UDP listener support is only available ' |
| 626 |
'in Octavia API version 2.1 or newer') |
| 627 |
pool_id = self._listener_pool_create( |
| 628 |
const.UDP, const.UDP, const.LB_ALGORITHM_LEAST_CONNECTIONS) |
| 629 |
self._test_mixed_member_create(pool_id) |
| 630 |
|
| 631 |
@decorators.idempotent_id('b8afb91d-9b85-4569-85c7-03453df8990b') |
| 632 |
@testtools.skipUnless(CONF.load_balancer.test_with_ipv6, |
| 633 |
'IPv6 testing is disabled') |
| 634 |
def test_mixed_HTTP_RR_member_create(self): |
| 635 |
"""Test the member creation with mixed IP protocol members/VIP.""" |
| 636 |
pool_id = self._listener_pool_create( |
| 637 |
const.HTTP, const.HTTP, const.LB_ALGORITHM_ROUND_ROBIN) |
| 638 |
self._test_mixed_member_create(pool_id) |
| 639 |
|
| 640 |
@decorators.idempotent_id('a64dc345-4afe-4a2c-8a6a-178dd5a94670') |
| 641 |
@testtools.skipUnless(CONF.load_balancer.test_with_ipv6, |
| 642 |
'IPv6 testing is disabled') |
| 643 |
def test_mixed_HTTPS_RR_member_create(self): |
| 644 |
"""Test the member creation with mixed IP protocol members/VIP.""" |
| 645 |
pool_id = self._listener_pool_create( |
| 646 |
const.HTTPS, const.HTTPS, const.LB_ALGORITHM_ROUND_ROBIN) |
| 647 |
self._test_mixed_member_create(pool_id) |
| 648 |
|
| 649 |
@decorators.idempotent_id('909aebf2-f9e4-4b96-943e-c02b8a415cd2') |
| 650 |
@testtools.skipUnless(CONF.load_balancer.test_with_ipv6, |
| 651 |
'IPv6 testing is disabled') |
| 652 |
def test_mixed_PROXY_RR_member_create(self): |
| 653 |
"""Test the member creation with mixed IP protocol members/VIP.""" |
| 654 |
pool_id = self._listener_pool_create( |
| 655 |
const.TCP, const.PROXY, const.LB_ALGORITHM_ROUND_ROBIN) |
| 656 |
self._test_mixed_member_create(pool_id) |
| 657 |
|
| 658 |
@decorators.idempotent_id('407ff3d4-f0a2-4d27-be69-3f2ec039a6a0') |
| 659 |
@testtools.skipUnless(CONF.load_balancer.test_with_ipv6, |
| 660 |
'IPv6 testing is disabled') |
| 661 |
def test_mixed_TCP_RR_member_create(self): |
| 662 |
"""Test the member creation with mixed IP protocol members/VIP.""" |
| 663 |
pool_id = self._listener_pool_create( |
| 664 |
const.TCP, const.TCP, const.LB_ALGORITHM_ROUND_ROBIN) |
| 665 |
self._test_mixed_member_create(pool_id) |
| 666 |
|
| 667 |
@decorators.idempotent_id('e74b28cf-ab1a-423b-a1c5-d940e3c0a5ab') |
| 668 |
@testtools.skipUnless(CONF.load_balancer.test_with_ipv6, |
| 669 |
'IPv6 testing is disabled') |
| 670 |
|
| 671 |
|
| 672 |
|
| 673 |
@decorators.skip_because( |
| 674 |
bug='2003329', |
| 675 |
bug_type='storyboard', |
| 676 |
condition=CONF.load_balancer.provider in const.AMPHORA_PROVIDERS) |
| 677 |
def test_mixed_UDP_RR_member_create(self): |
| 678 |
"""Test the member creation with mixed IP protocol members/VIP.""" |
| 679 |
if not self.mem_listener_client.is_version_supported( |
| 680 |
self.api_version, '2.1'): |
| 681 |
raise self.skipException('UDP listener support is only available ' |
| 682 |
'in Octavia API version 2.1 or newer') |
| 683 |
pool_id = self._listener_pool_create( |
| 684 |
const.UDP, const.UDP, const.LB_ALGORITHM_ROUND_ROBIN) |
| 685 |
self._test_mixed_member_create(pool_id) |
| 686 |
|
| 687 |
@decorators.idempotent_id('cc7f9272-84a6-436c-a529-171b67a45b62') |
| 688 |
@testtools.skipUnless(CONF.load_balancer.test_with_ipv6, |
| 689 |
'IPv6 testing is disabled') |
| 690 |
def test_mixed_HTTP_SI_member_create(self): |
| 691 |
"""Test the member creation with mixed IP protocol members/VIP.""" |
| 692 |
pool_id = self._listener_pool_create( |
| 693 |
const.HTTP, const.HTTP, const.LB_ALGORITHM_SOURCE_IP) |
| 694 |
self._test_mixed_member_create(pool_id) |
| 695 |
|
| 696 |
@decorators.idempotent_id('704a10ed-d52d-4c75-9445-9ef98f7f540f') |
| 697 |
@testtools.skipUnless(CONF.load_balancer.test_with_ipv6, |
| 698 |
'IPv6 testing is disabled') |
| 699 |
def test_mixed_HTTPS_SI_member_create(self): |
| 700 |
"""Test the member creation with mixed IP protocol members/VIP.""" |
| 701 |
pool_id = self._listener_pool_create( |
| 702 |
const.HTTPS, const.HTTPS, const.LB_ALGORITHM_SOURCE_IP) |
| 703 |
self._test_mixed_member_create(pool_id) |
| 704 |
|
| 705 |
@decorators.idempotent_id('4c516b5b-eb7b-4a4c-9a73-fba823332e25') |
| 706 |
@testtools.skipUnless(CONF.load_balancer.test_with_ipv6, |
| 707 |
'IPv6 testing is disabled') |
| 708 |
def test_mixed_PROXY_SI_member_create(self): |
| 709 |
"""Test the member creation with mixed IP protocol members/VIP.""" |
| 710 |
pool_id = self._listener_pool_create( |
| 711 |
const.TCP, const.PROXY, const.LB_ALGORITHM_SOURCE_IP) |
| 712 |
self._test_mixed_member_create(pool_id) |
| 713 |
|
| 714 |
@decorators.idempotent_id('61973bc8-8bc4-4aec-bf57-b37583887544') |
| 715 |
@testtools.skipUnless(CONF.load_balancer.test_with_ipv6, |
| 716 |
'IPv6 testing is disabled') |
| 717 |
def test_mixed_TCP_SI_member_create(self): |
| 718 |
"""Test the member creation with mixed IP protocol members/VIP.""" |
| 719 |
pool_id = self._listener_pool_create( |
| 720 |
const.TCP, const.TCP, const.LB_ALGORITHM_SOURCE_IP) |
| 721 |
self._test_mixed_member_create(pool_id) |
| 722 |
|
| 723 |
@decorators.idempotent_id('ddab1836-ba9f-42e5-9630-1572d4a63501') |
| 724 |
@testtools.skipUnless(CONF.load_balancer.test_with_ipv6, |
| 725 |
'IPv6 testing is disabled') |
| 726 |
|
| 727 |
|
| 728 |
|
| 729 |
@decorators.skip_because( |
| 730 |
bug='2003329', |
| 731 |
bug_type='storyboard', |
| 732 |
condition=CONF.load_balancer.provider in const.AMPHORA_PROVIDERS) |
| 733 |
def test_mixed_UDP_SI_member_create(self): |
| 734 |
"""Test the member creation with mixed IP protocol members/VIP.""" |
| 735 |
if not self.mem_listener_client.is_version_supported( |
| 736 |
self.api_version, '2.1'): |
| 737 |
raise self.skipException('UDP listener support is only available ' |
| 738 |
'in Octavia API version 2.1 or newer') |
| 739 |
pool_id = self._listener_pool_create( |
| 740 |
const.UDP, const.UDP, const.LB_ALGORITHM_SOURCE_IP) |
| 741 |
self._test_mixed_member_create(pool_id) |
| 742 |
|
| 743 |
@decorators.idempotent_id('b3dc557a-88ec-4bc6-84fd-c3aaab5d5920') |
| 744 |
@testtools.skipUnless(CONF.load_balancer.test_with_ipv6, |
| 745 |
'IPv6 testing is disabled') |
| 746 |
def test_mixed_HTTP_SIP_member_create(self): |
| 747 |
"""Test the member creation with mixed IP protocol members/VIP.""" |
| 748 |
pool_id = self._listener_pool_create( |
| 749 |
const.HTTP, const.HTTP, const.LB_ALGORITHM_SOURCE_IP_PORT) |
| 750 |
self._test_mixed_member_create(pool_id) |
| 751 |
|
| 752 |
@decorators.idempotent_id('d6f3908d-470a-4939-b407-c6d6324c06b6') |
| 753 |
@testtools.skipUnless(CONF.load_balancer.test_with_ipv6, |
| 754 |
'IPv6 testing is disabled') |
| 755 |
def test_mixed_HTTPS_SIP_member_create(self): |
| 756 |
"""Test the member creation with mixed IP protocol members/VIP.""" |
| 757 |
pool_id = self._listener_pool_create( |
| 758 |
const.HTTPS, const.HTTPS, const.LB_ALGORITHM_SOURCE_IP_PORT) |
| 759 |
self._test_mixed_member_create(pool_id) |
| 760 |
|
| 761 |
@decorators.idempotent_id('ab745620-bf92-49e1-ac35-e42f266a7612') |
| 762 |
@testtools.skipUnless(CONF.load_balancer.test_with_ipv6, |
| 763 |
'IPv6 testing is disabled') |
| 764 |
def test_mixed_PROXY_SIP_member_create(self): |
| 765 |
"""Test the member creation with mixed IP protocol members/VIP.""" |
| 766 |
pool_id = self._listener_pool_create( |
| 767 |
const.TCP, const.PROXY, const.LB_ALGORITHM_SOURCE_IP_PORT) |
| 768 |
self._test_mixed_member_create(pool_id) |
| 769 |
|
| 770 |
@decorators.idempotent_id('c7ffbd6e-5d9f-45e8-a5d0-2d26ea6b0ed0') |
| 771 |
@testtools.skipUnless(CONF.load_balancer.test_with_ipv6, |
| 772 |
'IPv6 testing is disabled') |
| 773 |
def test_mixed_TCP_SIP_member_create(self): |
| 774 |
"""Test the member creation with mixed IP protocol members/VIP.""" |
| 775 |
pool_id = self._listener_pool_create( |
| 776 |
const.TCP, const.TCP, const.LB_ALGORITHM_SOURCE_IP_PORT) |
| 777 |
self._test_mixed_member_create(pool_id) |
| 778 |
|
| 779 |
@decorators.idempotent_id('aa6b282c-d1c2-4a39-b085-33c224d4faff') |
| 780 |
@testtools.skipUnless(CONF.load_balancer.test_with_ipv6, |
| 781 |
'IPv6 testing is disabled') |
| 782 |
|
| 783 |
|
| 784 |
|
| 785 |
@decorators.skip_because( |
| 786 |
bug='2003329', |
| 787 |
bug_type='storyboard', |
| 788 |
condition=CONF.load_balancer.provider in const.AMPHORA_PROVIDERS) |
| 789 |
def test_mixed_UDP_SIP_member_create(self): |
| 790 |
"""Test the member creation with mixed IP protocol members/VIP.""" |
| 791 |
if not self.mem_listener_client.is_version_supported( |
| 792 |
self.api_version, '2.1'): |
| 793 |
raise self.skipException('UDP listener support is only available ' |
| 794 |
'in Octavia API version 2.1 or newer') |
| 795 |
pool_id = self._listener_pool_create( |
| 796 |
const.UDP, const.UDP, const.LB_ALGORITHM_SOURCE_IP_PORT) |
| 797 |
self._test_mixed_member_create(pool_id) |