blob: 673fc47a2891bd5a4a256a798c3649374dc76cd1 [file] [log] [blame]
ZhiQiang Fan39f97222013-09-20 04:49:44 +08001# Copyright 2013 OpenStack Foundation
raiesmh080fe76852013-09-13 11:52:56 +05302# All Rights Reserved.
3#
4# Licensed under the Apache License, Version 2.0 (the "License"); you may
5# not use this file except in compliance with the License. You may obtain
6# a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13# License for the specific language governing permissions and limitations
14# under the License.
15
16from tempest.api.network import base
Masayuki Igawa259c1132013-10-31 17:48:44 +090017from tempest.common.utils import data_utils
mouad benchchaouiea2440d2013-12-22 00:38:06 +010018from tempest import test
raiesmh080fe76852013-09-13 11:52:56 +053019
20
Ken'ichi Ohmichi91c675d2014-02-06 02:15:21 +090021class LoadBalancerTestJSON(base.BaseNetworkTest):
raiesmh080fe76852013-09-13 11:52:56 +053022 _interface = 'json'
23
24 """
25 Tests the following operations in the Neutron API using the REST client for
26 Neutron:
27
28 create vIP, and Pool
29 show vIP
30 list vIP
31 update vIP
32 delete vIP
33 update pool
34 delete pool
raiesmh08f5153f72013-09-16 13:38:37 +053035 show pool
36 list pool
raiesmh0832580d02013-09-17 13:11:34 +053037 health monitoring operations
raiesmh080fe76852013-09-13 11:52:56 +053038 """
39
40 @classmethod
Masayuki Igawa6d495d62014-03-19 16:38:57 +090041 @test.safe_setup
raiesmh080fe76852013-09-13 11:52:56 +053042 def setUpClass(cls):
Ken'ichi Ohmichi91c675d2014-02-06 02:15:21 +090043 super(LoadBalancerTestJSON, cls).setUpClass()
mouad benchchaouiea2440d2013-12-22 00:38:06 +010044 if not test.is_extension_enabled('lbaas', 'network'):
45 msg = "lbaas extension not enabled."
46 raise cls.skipException(msg)
raiesmh080fe76852013-09-13 11:52:56 +053047 cls.network = cls.create_network()
48 cls.name = cls.network['name']
49 cls.subnet = cls.create_subnet(cls.network)
Masayuki Igawa259c1132013-10-31 17:48:44 +090050 pool_name = data_utils.rand_name('pool-')
51 vip_name = data_utils.rand_name('vip-')
raiesmh080fe76852013-09-13 11:52:56 +053052 cls.pool = cls.create_pool(pool_name, "ROUND_ROBIN",
53 "HTTP", cls.subnet)
Elena Ezhova43c70a22014-01-14 12:42:51 +040054 cls.vip = cls.create_vip(name=vip_name,
55 protocol="HTTP",
56 protocol_port=80,
57 subnet=cls.subnet,
58 pool=cls.pool)
raiesmh08f8437ed2013-09-17 10:59:38 +053059 cls.member = cls.create_member(80, cls.pool)
Elena Ezhova43c70a22014-01-14 12:42:51 +040060 cls.health_monitor = cls.create_health_monitor(delay=4,
61 max_retries=3,
62 Type="TCP",
63 timeout=1)
raiesmh080fe76852013-09-13 11:52:56 +053064
Ann Kamyshnikova2bc1c432013-12-10 17:31:50 +040065 def _check_list_with_filter(self, obj_name, attr_exceptions, **kwargs):
66 create_obj = getattr(self.client, 'create_' + obj_name)
67 delete_obj = getattr(self.client, 'delete_' + obj_name)
68 list_objs = getattr(self.client, 'list_' + obj_name + 's')
69
70 resp, body = create_obj(**kwargs)
71 self.assertEqual('201', resp['status'])
72 obj = body[obj_name]
73 self.addCleanup(delete_obj, obj['id'])
74 for key, value in obj.iteritems():
75 # It is not relevant to filter by all arguments. That is why
76 # there is a list of attr to except
77 if key not in attr_exceptions:
78 resp, body = list_objs(**{key: value})
79 self.assertEqual('200', resp['status'])
80 objs = [v[key] for v in body[obj_name + 's']]
81 self.assertIn(value, objs)
82
mouad benchchaouiea2440d2013-12-22 00:38:06 +010083 @test.attr(type='smoke')
raiesmh080fe76852013-09-13 11:52:56 +053084 def test_list_vips(self):
85 # Verify the vIP exists in the list of all vIPs
86 resp, body = self.client.list_vips()
87 self.assertEqual('200', resp['status'])
88 vips = body['vips']
Ann Kamyshnikova2bc1c432013-12-10 17:31:50 +040089 self.assertIn(self.vip['id'], [v['id'] for v in vips])
raiesmh080fe76852013-09-13 11:52:56 +053090
Ann Kamyshnikova2bc1c432013-12-10 17:31:50 +040091 @test.attr(type='smoke')
92 def test_list_vips_with_filter(self):
93 name = data_utils.rand_name('vip-')
94 resp, body = self.client.create_pool(
95 name=data_utils.rand_name("pool-"), lb_method="ROUND_ROBIN",
96 protocol="HTTPS", subnet_id=self.subnet['id'])
97 self.assertEqual('201', resp['status'])
98 pool = body['pool']
99 self.addCleanup(self.client.delete_pool, pool['id'])
100 attr_exceptions = ['status', 'session_persistence',
101 'status_description']
102 self._check_list_with_filter(
103 'vip', attr_exceptions, name=name, protocol="HTTPS",
104 protocol_port=81, subnet_id=self.subnet['id'], pool_id=pool['id'],
105 description=data_utils.rand_name('description-'),
106 admin_state_up=False)
107
108 @test.attr(type='smoke')
raiesmh080fe76852013-09-13 11:52:56 +0530109 def test_create_update_delete_pool_vip(self):
110 # Creates a vip
Masayuki Igawa259c1132013-10-31 17:48:44 +0900111 name = data_utils.rand_name('vip-')
Elena Ezhovab40848f2014-01-15 10:17:35 +0400112 address = self.subnet['allocation_pools'][0]['end']
Eugene Nikanorov431e04a2013-12-17 15:44:27 +0400113 resp, body = self.client.create_pool(
114 name=data_utils.rand_name("pool-"),
115 lb_method='ROUND_ROBIN',
116 protocol='HTTP',
117 subnet_id=self.subnet['id'])
raiesmh080fe76852013-09-13 11:52:56 +0530118 pool = body['pool']
Elena Ezhova43c70a22014-01-14 12:42:51 +0400119 resp, body = self.client.create_vip(name=name,
120 protocol="HTTP",
121 protocol_port=80,
122 subnet_id=self.subnet['id'],
Elena Ezhovab40848f2014-01-15 10:17:35 +0400123 pool_id=pool['id'],
124 address=address)
raiesmh080fe76852013-09-13 11:52:56 +0530125 self.assertEqual('201', resp['status'])
126 vip = body['vip']
127 vip_id = vip['id']
Elena Ezhovab40848f2014-01-15 10:17:35 +0400128 # Confirm VIP's address correctness with a show
129 resp, body = self.client.show_vip(vip_id)
130 self.assertEqual('200', resp['status'])
131 vip = body['vip']
132 self.assertEqual(address, vip['address'])
raiesmh080fe76852013-09-13 11:52:56 +0530133 # Verification of vip update
134 new_name = "New_vip"
Elena Ezhovab40848f2014-01-15 10:17:35 +0400135 new_description = "New description"
136 persistence_type = "HTTP_COOKIE"
137 update_data = {"session_persistence": {
138 "type": persistence_type}}
139 resp, body = self.client.update_vip(vip_id,
140 name=new_name,
141 description=new_description,
142 connection_limit=10,
143 admin_state_up=False,
144 **update_data)
raiesmh080fe76852013-09-13 11:52:56 +0530145 self.assertEqual('200', resp['status'])
146 updated_vip = body['vip']
Elena Ezhovab40848f2014-01-15 10:17:35 +0400147 self.assertEqual(new_name, updated_vip['name'])
148 self.assertEqual(new_description, updated_vip['description'])
149 self.assertEqual(10, updated_vip['connection_limit'])
150 self.assertFalse(updated_vip['admin_state_up'])
151 self.assertEqual(persistence_type,
152 updated_vip['session_persistence']['type'])
raiesmh080fe76852013-09-13 11:52:56 +0530153 # Verification of vip delete
154 resp, body = self.client.delete_vip(vip['id'])
155 self.assertEqual('204', resp['status'])
izikpensod9a01a62014-02-17 20:02:32 +0200156 self.client.wait_for_resource_deletion('vip', vip['id'])
raiesmh080fe76852013-09-13 11:52:56 +0530157 # Verification of pool update
158 new_name = "New_pool"
Eugene Nikanorov431e04a2013-12-17 15:44:27 +0400159 resp, body = self.client.update_pool(pool['id'],
Ann Kamyshnikovab6659402014-01-09 17:50:31 +0400160 name=new_name,
161 description="new_description",
162 lb_method='LEAST_CONNECTIONS')
raiesmh080fe76852013-09-13 11:52:56 +0530163 self.assertEqual('200', resp['status'])
164 updated_pool = body['pool']
Ann Kamyshnikovab6659402014-01-09 17:50:31 +0400165 self.assertEqual(new_name, updated_pool['name'])
166 self.assertEqual('new_description', updated_pool['description'])
167 self.assertEqual('LEAST_CONNECTIONS', updated_pool['lb_method'])
raiesmh080fe76852013-09-13 11:52:56 +0530168 # Verification of pool delete
169 resp, body = self.client.delete_pool(pool['id'])
170 self.assertEqual('204', resp['status'])
171
mouad benchchaouiea2440d2013-12-22 00:38:06 +0100172 @test.attr(type='smoke')
raiesmh080fe76852013-09-13 11:52:56 +0530173 def test_show_vip(self):
174 # Verifies the details of a vip
175 resp, body = self.client.show_vip(self.vip['id'])
176 self.assertEqual('200', resp['status'])
177 vip = body['vip']
Ann Kamyshnikova2bc1c432013-12-10 17:31:50 +0400178 for key, value in vip.iteritems():
179 # 'status' should not be confirmed in api tests
180 if key != 'status':
181 self.assertEqual(self.vip[key], value)
raiesmh0802d04b02013-09-16 12:10:10 +0530182
mouad benchchaouiea2440d2013-12-22 00:38:06 +0100183 @test.attr(type='smoke')
raiesmh08f5153f72013-09-16 13:38:37 +0530184 def test_show_pool(self):
Ann Kamyshnikova2bc1c432013-12-10 17:31:50 +0400185 # Here we need to new pool without any dependence with vips
186 resp, body = self.client.create_pool(
187 name=data_utils.rand_name("pool-"),
188 lb_method='ROUND_ROBIN',
189 protocol='HTTP',
190 subnet_id=self.subnet['id'])
191 self.assertEqual('201', resp['status'])
raiesmh08f5153f72013-09-16 13:38:37 +0530192 pool = body['pool']
Ann Kamyshnikova2bc1c432013-12-10 17:31:50 +0400193 self.addCleanup(self.client.delete_pool, pool['id'])
194 # Verifies the details of a pool
195 resp, body = self.client.show_pool(pool['id'])
196 self.assertEqual('200', resp['status'])
197 shown_pool = body['pool']
198 for key, value in pool.iteritems():
199 # 'status' should not be confirmed in api tests
200 if key != 'status':
201 self.assertEqual(value, shown_pool[key])
raiesmh08f5153f72013-09-16 13:38:37 +0530202
mouad benchchaouiea2440d2013-12-22 00:38:06 +0100203 @test.attr(type='smoke')
raiesmh08f5153f72013-09-16 13:38:37 +0530204 def test_list_pools(self):
205 # Verify the pool exists in the list of all pools
206 resp, body = self.client.list_pools()
207 self.assertEqual('200', resp['status'])
208 pools = body['pools']
209 self.assertIn(self.pool['id'], [p['id'] for p in pools])
210
mouad benchchaouiea2440d2013-12-22 00:38:06 +0100211 @test.attr(type='smoke')
Ann Kamyshnikova2bc1c432013-12-10 17:31:50 +0400212 def test_list_pools_with_filters(self):
213 attr_exceptions = ['status', 'vip_id', 'members', 'provider',
214 'status_description']
215 self._check_list_with_filter(
216 'pool', attr_exceptions, name=data_utils.rand_name("pool-"),
217 lb_method="ROUND_ROBIN", protocol="HTTPS",
218 subnet_id=self.subnet['id'],
219 description=data_utils.rand_name('description-'),
220 admin_state_up=False)
221
222 @test.attr(type='smoke')
raiesmh08f8437ed2013-09-17 10:59:38 +0530223 def test_list_members(self):
224 # Verify the member exists in the list of all members
225 resp, body = self.client.list_members()
226 self.assertEqual('200', resp['status'])
227 members = body['members']
228 self.assertIn(self.member['id'], [m['id'] for m in members])
229
mouad benchchaouiea2440d2013-12-22 00:38:06 +0100230 @test.attr(type='smoke')
Ann Kamyshnikova2bc1c432013-12-10 17:31:50 +0400231 def test_list_members_with_filters(self):
232 attr_exceptions = ['status', 'status_description']
233 self._check_list_with_filter('member', attr_exceptions,
234 address="10.0.9.47", protocol_port=80,
235 pool_id=self.pool['id'])
236
237 @test.attr(type='smoke')
raiesmh08f8437ed2013-09-17 10:59:38 +0530238 def test_create_update_delete_member(self):
239 # Creates a member
Ann Kamyshnikova2bc1c432013-12-10 17:31:50 +0400240 resp, body = self.client.create_member(address="10.0.9.47",
241 protocol_port=80,
242 pool_id=self.pool['id'])
raiesmh08f8437ed2013-09-17 10:59:38 +0530243 self.assertEqual('201', resp['status'])
244 member = body['member']
245 # Verification of member update
Ann Kamyshnikova2bc1c432013-12-10 17:31:50 +0400246 resp, body = self.client.update_member(member['id'],
247 admin_state_up=False)
raiesmh08f8437ed2013-09-17 10:59:38 +0530248 self.assertEqual('200', resp['status'])
249 updated_member = body['member']
Elena Ezhova43c70a22014-01-14 12:42:51 +0400250 self.assertFalse(updated_member['admin_state_up'])
raiesmh08f8437ed2013-09-17 10:59:38 +0530251 # Verification of member delete
252 resp, body = self.client.delete_member(member['id'])
253 self.assertEqual('204', resp['status'])
254
mouad benchchaouiea2440d2013-12-22 00:38:06 +0100255 @test.attr(type='smoke')
raiesmh08f8437ed2013-09-17 10:59:38 +0530256 def test_show_member(self):
257 # Verifies the details of a member
258 resp, body = self.client.show_member(self.member['id'])
259 self.assertEqual('200', resp['status'])
260 member = body['member']
Ann Kamyshnikova2bc1c432013-12-10 17:31:50 +0400261 for key, value in member.iteritems():
262 # 'status' should not be confirmed in api tests
263 if key != 'status':
264 self.assertEqual(self.member[key], value)
raiesmh08f8437ed2013-09-17 10:59:38 +0530265
mouad benchchaouiea2440d2013-12-22 00:38:06 +0100266 @test.attr(type='smoke')
raiesmh0832580d02013-09-17 13:11:34 +0530267 def test_list_health_monitors(self):
268 # Verify the health monitor exists in the list of all health monitors
269 resp, body = self.client.list_health_monitors()
270 self.assertEqual('200', resp['status'])
271 health_monitors = body['health_monitors']
272 self.assertIn(self.health_monitor['id'],
273 [h['id'] for h in health_monitors])
274
mouad benchchaouiea2440d2013-12-22 00:38:06 +0100275 @test.attr(type='smoke')
Ann Kamyshnikova2bc1c432013-12-10 17:31:50 +0400276 def test_list_health_monitors_with_filters(self):
277 attr_exceptions = ['status', 'status_description', 'pools']
278 self._check_list_with_filter('health_monitor', attr_exceptions,
279 delay=5, max_retries=4, type="TCP",
280 timeout=2)
281
282 @test.attr(type='smoke')
raiesmh0832580d02013-09-17 13:11:34 +0530283 def test_create_update_delete_health_monitor(self):
284 # Creates a health_monitor
Elena Ezhova43c70a22014-01-14 12:42:51 +0400285 resp, body = self.client.create_health_monitor(delay=4,
286 max_retries=3,
287 type="TCP",
288 timeout=1)
raiesmh0832580d02013-09-17 13:11:34 +0530289 self.assertEqual('201', resp['status'])
290 health_monitor = body['health_monitor']
291 # Verification of health_monitor update
Elena Ezhova43c70a22014-01-14 12:42:51 +0400292 resp, body = (self.client.update_health_monitor
293 (health_monitor['id'],
294 admin_state_up=False))
raiesmh0832580d02013-09-17 13:11:34 +0530295 self.assertEqual('200', resp['status'])
296 updated_health_monitor = body['health_monitor']
Elena Ezhova43c70a22014-01-14 12:42:51 +0400297 self.assertFalse(updated_health_monitor['admin_state_up'])
raiesmh0832580d02013-09-17 13:11:34 +0530298 # Verification of health_monitor delete
299 resp, body = self.client.delete_health_monitor(health_monitor['id'])
300 self.assertEqual('204', resp['status'])
301
mouad benchchaouiea2440d2013-12-22 00:38:06 +0100302 @test.attr(type='smoke')
Elena Ezhovab40848f2014-01-15 10:17:35 +0400303 def test_create_health_monitor_http_type(self):
304 hm_type = "HTTP"
305 resp, body = self.client.create_health_monitor(delay=4,
306 max_retries=3,
307 type=hm_type,
308 timeout=1)
309 self.assertEqual('201', resp['status'])
310 health_monitor = body['health_monitor']
311 self.addCleanup(self.client.delete_health_monitor,
312 health_monitor['id'])
313 self.assertEqual(hm_type, health_monitor['type'])
314
315 @test.attr(type='smoke')
316 def test_update_health_monitor_http_method(self):
317 resp, body = self.client.create_health_monitor(delay=4,
318 max_retries=3,
319 type="HTTP",
320 timeout=1)
321 self.assertEqual('201', resp['status'])
322 health_monitor = body['health_monitor']
323 self.addCleanup(self.client.delete_health_monitor,
324 health_monitor['id'])
325 resp, body = (self.client.update_health_monitor
326 (health_monitor['id'],
327 http_method="POST",
328 url_path="/home/user",
329 expected_codes="290"))
330 self.assertEqual('200', resp['status'])
331 updated_health_monitor = body['health_monitor']
332 self.assertEqual("POST", updated_health_monitor['http_method'])
333 self.assertEqual("/home/user", updated_health_monitor['url_path'])
334 self.assertEqual("290", updated_health_monitor['expected_codes'])
335
336 @test.attr(type='smoke')
raiesmh0832580d02013-09-17 13:11:34 +0530337 def test_show_health_monitor(self):
338 # Verifies the details of a health_monitor
339 resp, body = self.client.show_health_monitor(self.health_monitor['id'])
340 self.assertEqual('200', resp['status'])
341 health_monitor = body['health_monitor']
Ann Kamyshnikova2bc1c432013-12-10 17:31:50 +0400342 for key, value in health_monitor.iteritems():
343 # 'status' should not be confirmed in api tests
344 if key != 'status':
345 self.assertEqual(self.health_monitor[key], value)
raiesmh0832580d02013-09-17 13:11:34 +0530346
mouad benchchaouiea2440d2013-12-22 00:38:06 +0100347 @test.attr(type='smoke')
raiesmh0832580d02013-09-17 13:11:34 +0530348 def test_associate_disassociate_health_monitor_with_pool(self):
349 # Verify that a health monitor can be associated with a pool
350 resp, body = (self.client.associate_health_monitor_with_pool
351 (self.health_monitor['id'], self.pool['id']))
352 self.assertEqual('201', resp['status'])
Ann Kamyshnikova2bc1c432013-12-10 17:31:50 +0400353 resp, body = self.client.show_health_monitor(
354 self.health_monitor['id'])
355 health_monitor = body['health_monitor']
356 resp, body = self.client.show_pool(self.pool['id'])
357 pool = body['pool']
358 self.assertIn(pool['id'],
359 [p['pool_id'] for p in health_monitor['pools']])
360 self.assertIn(health_monitor['id'], pool['health_monitors'])
raiesmh0832580d02013-09-17 13:11:34 +0530361 # Verify that a health monitor can be disassociated from a pool
362 resp, body = (self.client.disassociate_health_monitor_with_pool
363 (self.health_monitor['id'], self.pool['id']))
364 self.assertEqual('204', resp['status'])
Ann Kamyshnikova2bc1c432013-12-10 17:31:50 +0400365 resp, body = self.client.show_pool(self.pool['id'])
366 pool = body['pool']
367 resp, body = self.client.show_health_monitor(
368 self.health_monitor['id'])
369 health_monitor = body['health_monitor']
370 self.assertNotIn(health_monitor['id'], pool['health_monitors'])
371 self.assertNotIn(pool['id'],
372 [p['pool_id'] for p in health_monitor['pools']])
raiesmh0832580d02013-09-17 13:11:34 +0530373
nayna-patel87b4ef22014-02-07 10:24:59 +0000374 @test.attr(type='smoke')
375 def test_get_lb_pool_stats(self):
376 # Verify the details of pool stats
377 resp, body = self.client.list_lb_pool_stats(self.pool['id'])
378 self.assertEqual('200', resp['status'])
379 stats = body['stats']
380 self.assertIn("bytes_in", stats)
381 self.assertIn("total_connections", stats)
382 self.assertIn("active_connections", stats)
383 self.assertIn("bytes_out", stats)
384
Ann Kamyshnikovab6659402014-01-09 17:50:31 +0400385 @test.attr(type='smoke')
386 def test_update_list_of_health_monitors_associated_with_pool(self):
387 resp, _ = (self.client.associate_health_monitor_with_pool
388 (self.health_monitor['id'], self.pool['id']))
389 self.assertEqual('201', resp['status'])
390 resp, _ = self.client.update_health_monitor(
391 self.health_monitor['id'], admin_state_up=False)
392 self.assertEqual('200', resp['status'])
393 resp, body = self.client.show_pool(self.pool['id'])
394 self.assertEqual('200', resp['status'])
395 health_monitors = body['pool']['health_monitors']
396 for health_monitor_id in health_monitors:
397 resp, body = self.client.show_health_monitor(health_monitor_id)
398 self.assertEqual('200', resp['status'])
399 self.assertFalse(body['health_monitor']['admin_state_up'])
400 resp, _ = (self.client.disassociate_health_monitor_with_pool
401 (self.health_monitor['id'], self.pool['id']))
402 self.assertEqual('204', resp['status'])
403
404 @test.attr(type='smoke')
405 def test_update_admin_state_up_of_pool(self):
406 resp, _ = self.client.update_pool(self.pool['id'],
407 admin_state_up=False)
408 self.assertEqual('200', resp['status'])
409 resp, body = self.client.show_pool(self.pool['id'])
410 self.assertEqual('200', resp['status'])
411 pool = body['pool']
412 self.assertFalse(pool['admin_state_up'])
413
414 @test.attr(type='smoke')
415 def test_show_vip_associated_with_pool(self):
416 resp, body = self.client.show_pool(self.pool['id'])
417 self.assertEqual('200', resp['status'])
418 pool = body['pool']
419 resp, body = self.client.show_vip(pool['vip_id'])
420 self.assertEqual('200', resp['status'])
421 vip = body['vip']
422 self.assertEqual(self.vip['name'], vip['name'])
423 self.assertEqual(self.vip['id'], vip['id'])
424
425 @test.attr(type='smoke')
426 def test_show_members_associated_with_pool(self):
427 resp, body = self.client.show_pool(self.pool['id'])
428 self.assertEqual('200', resp['status'])
429 members = body['pool']['members']
430 for member_id in members:
431 resp, body = self.client.show_member(member_id)
432 self.assertEqual('200', resp['status'])
433 self.assertIsNotNone(body['member']['status'])
434 self.assertEqual(member_id, body['member']['id'])
435 self.assertIsNotNone(body['member']['admin_state_up'])
436
Ann Kamyshnikova4f5d0b92014-01-13 16:53:48 +0400437 @test.attr(type='smoke')
438 def test_update_pool_related_to_member(self):
439 # Create new pool
440 resp, body = self.client.create_pool(
441 name=data_utils.rand_name("pool-"),
442 lb_method='ROUND_ROBIN',
443 protocol='HTTP',
444 subnet_id=self.subnet['id'])
445 self.assertEqual('201', resp['status'])
446 new_pool = body['pool']
447 self.addCleanup(self.client.delete_pool, new_pool['id'])
448 # Update member with new pool's id
449 resp, body = self.client.update_member(self.member['id'],
450 pool_id=new_pool['id'])
451 self.assertEqual('200', resp['status'])
452 # Confirm with show that pool_id change
453 resp, body = self.client.show_member(self.member['id'])
454 member = body['member']
455 self.assertEqual(member['pool_id'], new_pool['id'])
456 # Update member with old pool id, this is needed for clean up
457 resp, body = self.client.update_member(self.member['id'],
458 pool_id=self.pool['id'])
459 self.assertEqual('200', resp['status'])
460
461 @test.attr(type='smoke')
462 def test_update_member_weight(self):
463 resp, _ = self.client.update_member(self.member['id'],
464 weight=2)
465 self.assertEqual('200', resp['status'])
466 resp, body = self.client.show_member(self.member['id'])
467 self.assertEqual('200', resp['status'])
468 member = body['member']
469 self.assertEqual(2, member['weight'])
470
raiesmh0802d04b02013-09-16 12:10:10 +0530471
Ken'ichi Ohmichi91c675d2014-02-06 02:15:21 +0900472class LoadBalancerTestXML(LoadBalancerTestJSON):
raiesmh0802d04b02013-09-16 12:10:10 +0530473 _interface = 'xml'