blob: 41294f632755174fc9cca4d877d62fcdce227ba4 [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
Andrea Frittolida4a2452014-09-15 13:12:08 +010041 def resource_setup(cls):
42 super(LoadBalancerTestJSON, cls).resource_setup()
mouad benchchaouiea2440d2013-12-22 00:38:06 +010043 if not test.is_extension_enabled('lbaas', 'network'):
44 msg = "lbaas extension not enabled."
45 raise cls.skipException(msg)
raiesmh080fe76852013-09-13 11:52:56 +053046 cls.network = cls.create_network()
47 cls.name = cls.network['name']
48 cls.subnet = cls.create_subnet(cls.network)
Masayuki Igawa259c1132013-10-31 17:48:44 +090049 pool_name = data_utils.rand_name('pool-')
50 vip_name = data_utils.rand_name('vip-')
raiesmh080fe76852013-09-13 11:52:56 +053051 cls.pool = cls.create_pool(pool_name, "ROUND_ROBIN",
52 "HTTP", cls.subnet)
Elena Ezhova43c70a22014-01-14 12:42:51 +040053 cls.vip = cls.create_vip(name=vip_name,
54 protocol="HTTP",
55 protocol_port=80,
56 subnet=cls.subnet,
57 pool=cls.pool)
Sergey Shnaidman97e6a0f2014-11-12 20:00:53 +030058 cls.member = cls.create_member(80, cls.pool, cls._ip_version)
59 cls.member_address = ("10.0.9.47" if cls._ip_version == 4
60 else "2015::beef")
Elena Ezhova43c70a22014-01-14 12:42:51 +040061 cls.health_monitor = cls.create_health_monitor(delay=4,
62 max_retries=3,
63 Type="TCP",
64 timeout=1)
raiesmh080fe76852013-09-13 11:52:56 +053065
Ann Kamyshnikova2bc1c432013-12-10 17:31:50 +040066 def _check_list_with_filter(self, obj_name, attr_exceptions, **kwargs):
67 create_obj = getattr(self.client, 'create_' + obj_name)
68 delete_obj = getattr(self.client, 'delete_' + obj_name)
69 list_objs = getattr(self.client, 'list_' + obj_name + 's')
70
Rohan Kanadeeeb21642014-08-14 12:00:26 +020071 _, body = create_obj(**kwargs)
Ann Kamyshnikova2bc1c432013-12-10 17:31:50 +040072 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:
Rohan Kanadeeeb21642014-08-14 12:00:26 +020078 _, body = list_objs(**{key: value})
Ann Kamyshnikova2bc1c432013-12-10 17:31:50 +040079 objs = [v[key] for v in body[obj_name + 's']]
80 self.assertIn(value, objs)
81
mouad benchchaouiea2440d2013-12-22 00:38:06 +010082 @test.attr(type='smoke')
raiesmh080fe76852013-09-13 11:52:56 +053083 def test_list_vips(self):
84 # Verify the vIP exists in the list of all vIPs
Rohan Kanadeeeb21642014-08-14 12:00:26 +020085 _, body = self.client.list_vips()
raiesmh080fe76852013-09-13 11:52:56 +053086 vips = body['vips']
Ann Kamyshnikova2bc1c432013-12-10 17:31:50 +040087 self.assertIn(self.vip['id'], [v['id'] for v in vips])
raiesmh080fe76852013-09-13 11:52:56 +053088
Ann Kamyshnikova2bc1c432013-12-10 17:31:50 +040089 @test.attr(type='smoke')
90 def test_list_vips_with_filter(self):
91 name = data_utils.rand_name('vip-')
Rohan Kanadeeeb21642014-08-14 12:00:26 +020092 _, body = self.client.create_pool(name=data_utils.rand_name("pool-"),
93 lb_method="ROUND_ROBIN",
94 protocol="HTTPS",
95 subnet_id=self.subnet['id'])
Ann Kamyshnikova2bc1c432013-12-10 17:31:50 +040096 pool = body['pool']
97 self.addCleanup(self.client.delete_pool, pool['id'])
98 attr_exceptions = ['status', 'session_persistence',
99 'status_description']
100 self._check_list_with_filter(
101 'vip', attr_exceptions, name=name, protocol="HTTPS",
102 protocol_port=81, subnet_id=self.subnet['id'], pool_id=pool['id'],
103 description=data_utils.rand_name('description-'),
104 admin_state_up=False)
105
106 @test.attr(type='smoke')
raiesmh080fe76852013-09-13 11:52:56 +0530107 def test_create_update_delete_pool_vip(self):
108 # Creates a vip
Masayuki Igawa259c1132013-10-31 17:48:44 +0900109 name = data_utils.rand_name('vip-')
Elena Ezhovab40848f2014-01-15 10:17:35 +0400110 address = self.subnet['allocation_pools'][0]['end']
Eugene Nikanorov431e04a2013-12-17 15:44:27 +0400111 resp, body = self.client.create_pool(
112 name=data_utils.rand_name("pool-"),
113 lb_method='ROUND_ROBIN',
114 protocol='HTTP',
115 subnet_id=self.subnet['id'])
raiesmh080fe76852013-09-13 11:52:56 +0530116 pool = body['pool']
Rohan Kanadeeeb21642014-08-14 12:00:26 +0200117 _, body = self.client.create_vip(name=name,
118 protocol="HTTP",
119 protocol_port=80,
120 subnet_id=self.subnet['id'],
121 pool_id=pool['id'],
122 address=address)
raiesmh080fe76852013-09-13 11:52:56 +0530123 vip = body['vip']
124 vip_id = vip['id']
Elena Ezhovab40848f2014-01-15 10:17:35 +0400125 # Confirm VIP's address correctness with a show
Rohan Kanadeeeb21642014-08-14 12:00:26 +0200126 _, body = self.client.show_vip(vip_id)
Elena Ezhovab40848f2014-01-15 10:17:35 +0400127 vip = body['vip']
128 self.assertEqual(address, vip['address'])
raiesmh080fe76852013-09-13 11:52:56 +0530129 # Verification of vip update
130 new_name = "New_vip"
Elena Ezhovab40848f2014-01-15 10:17:35 +0400131 new_description = "New description"
132 persistence_type = "HTTP_COOKIE"
133 update_data = {"session_persistence": {
134 "type": persistence_type}}
Rohan Kanadeeeb21642014-08-14 12:00:26 +0200135 _, body = self.client.update_vip(vip_id,
136 name=new_name,
137 description=new_description,
138 connection_limit=10,
139 admin_state_up=False,
140 **update_data)
raiesmh080fe76852013-09-13 11:52:56 +0530141 updated_vip = body['vip']
Elena Ezhovab40848f2014-01-15 10:17:35 +0400142 self.assertEqual(new_name, updated_vip['name'])
143 self.assertEqual(new_description, updated_vip['description'])
144 self.assertEqual(10, updated_vip['connection_limit'])
145 self.assertFalse(updated_vip['admin_state_up'])
146 self.assertEqual(persistence_type,
147 updated_vip['session_persistence']['type'])
Rohan Kanadeeeb21642014-08-14 12:00:26 +0200148 self.client.delete_vip(vip['id'])
izikpensod9a01a62014-02-17 20:02:32 +0200149 self.client.wait_for_resource_deletion('vip', vip['id'])
raiesmh080fe76852013-09-13 11:52:56 +0530150 # Verification of pool update
151 new_name = "New_pool"
Rohan Kanadeeeb21642014-08-14 12:00:26 +0200152 _, body = self.client.update_pool(pool['id'],
153 name=new_name,
154 description="new_description",
155 lb_method='LEAST_CONNECTIONS')
raiesmh080fe76852013-09-13 11:52:56 +0530156 updated_pool = body['pool']
Ann Kamyshnikovab6659402014-01-09 17:50:31 +0400157 self.assertEqual(new_name, updated_pool['name'])
158 self.assertEqual('new_description', updated_pool['description'])
159 self.assertEqual('LEAST_CONNECTIONS', updated_pool['lb_method'])
Rohan Kanadeeeb21642014-08-14 12:00:26 +0200160 self.client.delete_pool(pool['id'])
raiesmh080fe76852013-09-13 11:52:56 +0530161
mouad benchchaouiea2440d2013-12-22 00:38:06 +0100162 @test.attr(type='smoke')
raiesmh080fe76852013-09-13 11:52:56 +0530163 def test_show_vip(self):
164 # Verifies the details of a vip
Rohan Kanadeeeb21642014-08-14 12:00:26 +0200165 _, body = self.client.show_vip(self.vip['id'])
raiesmh080fe76852013-09-13 11:52:56 +0530166 vip = body['vip']
Ann Kamyshnikova2bc1c432013-12-10 17:31:50 +0400167 for key, value in vip.iteritems():
168 # 'status' should not be confirmed in api tests
169 if key != 'status':
170 self.assertEqual(self.vip[key], value)
raiesmh0802d04b02013-09-16 12:10:10 +0530171
mouad benchchaouiea2440d2013-12-22 00:38:06 +0100172 @test.attr(type='smoke')
raiesmh08f5153f72013-09-16 13:38:37 +0530173 def test_show_pool(self):
Ann Kamyshnikova2bc1c432013-12-10 17:31:50 +0400174 # Here we need to new pool without any dependence with vips
Rohan Kanadeeeb21642014-08-14 12:00:26 +0200175 _, body = self.client.create_pool(name=data_utils.rand_name("pool-"),
176 lb_method='ROUND_ROBIN',
177 protocol='HTTP',
178 subnet_id=self.subnet['id'])
raiesmh08f5153f72013-09-16 13:38:37 +0530179 pool = body['pool']
Ann Kamyshnikova2bc1c432013-12-10 17:31:50 +0400180 self.addCleanup(self.client.delete_pool, pool['id'])
181 # Verifies the details of a pool
Rohan Kanadeeeb21642014-08-14 12:00:26 +0200182 _, body = self.client.show_pool(pool['id'])
Ann Kamyshnikova2bc1c432013-12-10 17:31:50 +0400183 shown_pool = body['pool']
184 for key, value in pool.iteritems():
185 # 'status' should not be confirmed in api tests
186 if key != 'status':
187 self.assertEqual(value, shown_pool[key])
raiesmh08f5153f72013-09-16 13:38:37 +0530188
mouad benchchaouiea2440d2013-12-22 00:38:06 +0100189 @test.attr(type='smoke')
raiesmh08f5153f72013-09-16 13:38:37 +0530190 def test_list_pools(self):
191 # Verify the pool exists in the list of all pools
Rohan Kanadeeeb21642014-08-14 12:00:26 +0200192 _, body = self.client.list_pools()
raiesmh08f5153f72013-09-16 13:38:37 +0530193 pools = body['pools']
194 self.assertIn(self.pool['id'], [p['id'] for p in pools])
195
mouad benchchaouiea2440d2013-12-22 00:38:06 +0100196 @test.attr(type='smoke')
Ann Kamyshnikova2bc1c432013-12-10 17:31:50 +0400197 def test_list_pools_with_filters(self):
198 attr_exceptions = ['status', 'vip_id', 'members', 'provider',
199 'status_description']
200 self._check_list_with_filter(
201 'pool', attr_exceptions, name=data_utils.rand_name("pool-"),
202 lb_method="ROUND_ROBIN", protocol="HTTPS",
203 subnet_id=self.subnet['id'],
204 description=data_utils.rand_name('description-'),
205 admin_state_up=False)
206
207 @test.attr(type='smoke')
raiesmh08f8437ed2013-09-17 10:59:38 +0530208 def test_list_members(self):
209 # Verify the member exists in the list of all members
Rohan Kanadeeeb21642014-08-14 12:00:26 +0200210 _, body = self.client.list_members()
raiesmh08f8437ed2013-09-17 10:59:38 +0530211 members = body['members']
212 self.assertIn(self.member['id'], [m['id'] for m in members])
213
mouad benchchaouiea2440d2013-12-22 00:38:06 +0100214 @test.attr(type='smoke')
Ann Kamyshnikova2bc1c432013-12-10 17:31:50 +0400215 def test_list_members_with_filters(self):
216 attr_exceptions = ['status', 'status_description']
217 self._check_list_with_filter('member', attr_exceptions,
Sergey Shnaidman97e6a0f2014-11-12 20:00:53 +0300218 address=self.member_address,
219 protocol_port=80,
Ann Kamyshnikova2bc1c432013-12-10 17:31:50 +0400220 pool_id=self.pool['id'])
221
222 @test.attr(type='smoke')
raiesmh08f8437ed2013-09-17 10:59:38 +0530223 def test_create_update_delete_member(self):
224 # Creates a member
Sergey Shnaidman97e6a0f2014-11-12 20:00:53 +0300225 _, body = self.client.create_member(address=self.member_address,
Rohan Kanadeeeb21642014-08-14 12:00:26 +0200226 protocol_port=80,
227 pool_id=self.pool['id'])
raiesmh08f8437ed2013-09-17 10:59:38 +0530228 member = body['member']
229 # Verification of member update
Rohan Kanadeeeb21642014-08-14 12:00:26 +0200230 _, body = self.client.update_member(member['id'],
231 admin_state_up=False)
raiesmh08f8437ed2013-09-17 10:59:38 +0530232 updated_member = body['member']
Elena Ezhova43c70a22014-01-14 12:42:51 +0400233 self.assertFalse(updated_member['admin_state_up'])
raiesmh08f8437ed2013-09-17 10:59:38 +0530234 # Verification of member delete
Rohan Kanadeeeb21642014-08-14 12:00:26 +0200235 self.client.delete_member(member['id'])
raiesmh08f8437ed2013-09-17 10:59:38 +0530236
mouad benchchaouiea2440d2013-12-22 00:38:06 +0100237 @test.attr(type='smoke')
raiesmh08f8437ed2013-09-17 10:59:38 +0530238 def test_show_member(self):
239 # Verifies the details of a member
Rohan Kanadeeeb21642014-08-14 12:00:26 +0200240 _, body = self.client.show_member(self.member['id'])
raiesmh08f8437ed2013-09-17 10:59:38 +0530241 member = body['member']
Ann Kamyshnikova2bc1c432013-12-10 17:31:50 +0400242 for key, value in member.iteritems():
Matthew Treinishc795b9e2014-06-09 17:01:10 -0400243 # 'status' should not be confirmed in api tests
Ann Kamyshnikova2bc1c432013-12-10 17:31:50 +0400244 if key != 'status':
245 self.assertEqual(self.member[key], value)
raiesmh08f8437ed2013-09-17 10:59:38 +0530246
mouad benchchaouiea2440d2013-12-22 00:38:06 +0100247 @test.attr(type='smoke')
raiesmh0832580d02013-09-17 13:11:34 +0530248 def test_list_health_monitors(self):
249 # Verify the health monitor exists in the list of all health monitors
Rohan Kanadeeeb21642014-08-14 12:00:26 +0200250 _, body = self.client.list_health_monitors()
raiesmh0832580d02013-09-17 13:11:34 +0530251 health_monitors = body['health_monitors']
252 self.assertIn(self.health_monitor['id'],
253 [h['id'] for h in health_monitors])
254
mouad benchchaouiea2440d2013-12-22 00:38:06 +0100255 @test.attr(type='smoke')
Ann Kamyshnikova2bc1c432013-12-10 17:31:50 +0400256 def test_list_health_monitors_with_filters(self):
257 attr_exceptions = ['status', 'status_description', 'pools']
258 self._check_list_with_filter('health_monitor', attr_exceptions,
259 delay=5, max_retries=4, type="TCP",
260 timeout=2)
261
262 @test.attr(type='smoke')
raiesmh0832580d02013-09-17 13:11:34 +0530263 def test_create_update_delete_health_monitor(self):
264 # Creates a health_monitor
Rohan Kanadeeeb21642014-08-14 12:00:26 +0200265 _, body = self.client.create_health_monitor(delay=4,
266 max_retries=3,
267 type="TCP",
268 timeout=1)
raiesmh0832580d02013-09-17 13:11:34 +0530269 health_monitor = body['health_monitor']
270 # Verification of health_monitor update
Rohan Kanadeeeb21642014-08-14 12:00:26 +0200271 _, body = (self.client.update_health_monitor
272 (health_monitor['id'],
273 admin_state_up=False))
raiesmh0832580d02013-09-17 13:11:34 +0530274 updated_health_monitor = body['health_monitor']
Elena Ezhova43c70a22014-01-14 12:42:51 +0400275 self.assertFalse(updated_health_monitor['admin_state_up'])
raiesmh0832580d02013-09-17 13:11:34 +0530276 # Verification of health_monitor delete
Rohan Kanadeeeb21642014-08-14 12:00:26 +0200277 _, body = self.client.delete_health_monitor(health_monitor['id'])
raiesmh0832580d02013-09-17 13:11:34 +0530278
mouad benchchaouiea2440d2013-12-22 00:38:06 +0100279 @test.attr(type='smoke')
Elena Ezhovab40848f2014-01-15 10:17:35 +0400280 def test_create_health_monitor_http_type(self):
281 hm_type = "HTTP"
Rohan Kanadeeeb21642014-08-14 12:00:26 +0200282 _, body = self.client.create_health_monitor(delay=4,
283 max_retries=3,
284 type=hm_type,
285 timeout=1)
Elena Ezhovab40848f2014-01-15 10:17:35 +0400286 health_monitor = body['health_monitor']
287 self.addCleanup(self.client.delete_health_monitor,
288 health_monitor['id'])
289 self.assertEqual(hm_type, health_monitor['type'])
290
291 @test.attr(type='smoke')
292 def test_update_health_monitor_http_method(self):
Rohan Kanadeeeb21642014-08-14 12:00:26 +0200293 _, body = self.client.create_health_monitor(delay=4,
294 max_retries=3,
295 type="HTTP",
296 timeout=1)
Elena Ezhovab40848f2014-01-15 10:17:35 +0400297 health_monitor = body['health_monitor']
298 self.addCleanup(self.client.delete_health_monitor,
299 health_monitor['id'])
Rohan Kanadeeeb21642014-08-14 12:00:26 +0200300 _, body = (self.client.update_health_monitor
301 (health_monitor['id'],
302 http_method="POST",
303 url_path="/home/user",
304 expected_codes="290"))
Elena Ezhovab40848f2014-01-15 10:17:35 +0400305 updated_health_monitor = body['health_monitor']
306 self.assertEqual("POST", updated_health_monitor['http_method'])
307 self.assertEqual("/home/user", updated_health_monitor['url_path'])
308 self.assertEqual("290", updated_health_monitor['expected_codes'])
309
310 @test.attr(type='smoke')
raiesmh0832580d02013-09-17 13:11:34 +0530311 def test_show_health_monitor(self):
312 # Verifies the details of a health_monitor
Rohan Kanadeeeb21642014-08-14 12:00:26 +0200313 _, body = self.client.show_health_monitor(self.health_monitor['id'])
raiesmh0832580d02013-09-17 13:11:34 +0530314 health_monitor = body['health_monitor']
Ann Kamyshnikova2bc1c432013-12-10 17:31:50 +0400315 for key, value in health_monitor.iteritems():
Matthew Treinishc795b9e2014-06-09 17:01:10 -0400316 # 'status' should not be confirmed in api tests
Ann Kamyshnikova2bc1c432013-12-10 17:31:50 +0400317 if key != 'status':
318 self.assertEqual(self.health_monitor[key], value)
raiesmh0832580d02013-09-17 13:11:34 +0530319
mouad benchchaouiea2440d2013-12-22 00:38:06 +0100320 @test.attr(type='smoke')
raiesmh0832580d02013-09-17 13:11:34 +0530321 def test_associate_disassociate_health_monitor_with_pool(self):
322 # Verify that a health monitor can be associated with a pool
Rohan Kanadeeeb21642014-08-14 12:00:26 +0200323 _, body = (self.client.associate_health_monitor_with_pool
324 (self.health_monitor['id'], self.pool['id']))
Ann Kamyshnikova2bc1c432013-12-10 17:31:50 +0400325 resp, body = self.client.show_health_monitor(
326 self.health_monitor['id'])
327 health_monitor = body['health_monitor']
328 resp, body = self.client.show_pool(self.pool['id'])
329 pool = body['pool']
330 self.assertIn(pool['id'],
331 [p['pool_id'] for p in health_monitor['pools']])
332 self.assertIn(health_monitor['id'], pool['health_monitors'])
raiesmh0832580d02013-09-17 13:11:34 +0530333 # Verify that a health monitor can be disassociated from a pool
Rohan Kanadeeeb21642014-08-14 12:00:26 +0200334 (self.client.disassociate_health_monitor_with_pool
335 (self.health_monitor['id'], self.pool['id']))
336 _, body = self.client.show_pool(self.pool['id'])
Ann Kamyshnikova2bc1c432013-12-10 17:31:50 +0400337 pool = body['pool']
338 resp, body = self.client.show_health_monitor(
339 self.health_monitor['id'])
340 health_monitor = body['health_monitor']
341 self.assertNotIn(health_monitor['id'], pool['health_monitors'])
342 self.assertNotIn(pool['id'],
343 [p['pool_id'] for p in health_monitor['pools']])
raiesmh0832580d02013-09-17 13:11:34 +0530344
nayna-patel87b4ef22014-02-07 10:24:59 +0000345 @test.attr(type='smoke')
346 def test_get_lb_pool_stats(self):
347 # Verify the details of pool stats
Rohan Kanadeeeb21642014-08-14 12:00:26 +0200348 _, body = self.client.list_lb_pool_stats(self.pool['id'])
nayna-patel87b4ef22014-02-07 10:24:59 +0000349 stats = body['stats']
350 self.assertIn("bytes_in", stats)
351 self.assertIn("total_connections", stats)
352 self.assertIn("active_connections", stats)
353 self.assertIn("bytes_out", stats)
354
Ann Kamyshnikovab6659402014-01-09 17:50:31 +0400355 @test.attr(type='smoke')
356 def test_update_list_of_health_monitors_associated_with_pool(self):
Rohan Kanadeeeb21642014-08-14 12:00:26 +0200357 (self.client.associate_health_monitor_with_pool
358 (self.health_monitor['id'], self.pool['id']))
359 self.client.update_health_monitor(
Ann Kamyshnikovab6659402014-01-09 17:50:31 +0400360 self.health_monitor['id'], admin_state_up=False)
Rohan Kanadeeeb21642014-08-14 12:00:26 +0200361 _, body = self.client.show_pool(self.pool['id'])
Ann Kamyshnikovab6659402014-01-09 17:50:31 +0400362 health_monitors = body['pool']['health_monitors']
363 for health_monitor_id in health_monitors:
Rohan Kanadeeeb21642014-08-14 12:00:26 +0200364 _, body = self.client.show_health_monitor(health_monitor_id)
Ann Kamyshnikovab6659402014-01-09 17:50:31 +0400365 self.assertFalse(body['health_monitor']['admin_state_up'])
Rohan Kanadeeeb21642014-08-14 12:00:26 +0200366 (self.client.disassociate_health_monitor_with_pool
367 (self.health_monitor['id'], self.pool['id']))
Ann Kamyshnikovab6659402014-01-09 17:50:31 +0400368
369 @test.attr(type='smoke')
370 def test_update_admin_state_up_of_pool(self):
Rohan Kanadeeeb21642014-08-14 12:00:26 +0200371 self.client.update_pool(self.pool['id'],
372 admin_state_up=False)
373 _, body = self.client.show_pool(self.pool['id'])
Ann Kamyshnikovab6659402014-01-09 17:50:31 +0400374 pool = body['pool']
375 self.assertFalse(pool['admin_state_up'])
376
377 @test.attr(type='smoke')
378 def test_show_vip_associated_with_pool(self):
Rohan Kanadeeeb21642014-08-14 12:00:26 +0200379 _, body = self.client.show_pool(self.pool['id'])
Ann Kamyshnikovab6659402014-01-09 17:50:31 +0400380 pool = body['pool']
Rohan Kanadeeeb21642014-08-14 12:00:26 +0200381 _, body = self.client.show_vip(pool['vip_id'])
Ann Kamyshnikovab6659402014-01-09 17:50:31 +0400382 vip = body['vip']
383 self.assertEqual(self.vip['name'], vip['name'])
384 self.assertEqual(self.vip['id'], vip['id'])
385
386 @test.attr(type='smoke')
387 def test_show_members_associated_with_pool(self):
Rohan Kanadeeeb21642014-08-14 12:00:26 +0200388 _, body = self.client.show_pool(self.pool['id'])
Ann Kamyshnikovab6659402014-01-09 17:50:31 +0400389 members = body['pool']['members']
390 for member_id in members:
Rohan Kanadeeeb21642014-08-14 12:00:26 +0200391 _, body = self.client.show_member(member_id)
Ann Kamyshnikovab6659402014-01-09 17:50:31 +0400392 self.assertIsNotNone(body['member']['status'])
393 self.assertEqual(member_id, body['member']['id'])
394 self.assertIsNotNone(body['member']['admin_state_up'])
395
Ann Kamyshnikova4f5d0b92014-01-13 16:53:48 +0400396 @test.attr(type='smoke')
397 def test_update_pool_related_to_member(self):
398 # Create new pool
Rohan Kanadeeeb21642014-08-14 12:00:26 +0200399 _, body = self.client.create_pool(name=data_utils.rand_name("pool-"),
400 lb_method='ROUND_ROBIN',
401 protocol='HTTP',
402 subnet_id=self.subnet['id'])
Ann Kamyshnikova4f5d0b92014-01-13 16:53:48 +0400403 new_pool = body['pool']
404 self.addCleanup(self.client.delete_pool, new_pool['id'])
405 # Update member with new pool's id
Rohan Kanadeeeb21642014-08-14 12:00:26 +0200406 _, body = self.client.update_member(self.member['id'],
407 pool_id=new_pool['id'])
Ann Kamyshnikova4f5d0b92014-01-13 16:53:48 +0400408 # Confirm with show that pool_id change
409 resp, body = self.client.show_member(self.member['id'])
410 member = body['member']
411 self.assertEqual(member['pool_id'], new_pool['id'])
412 # Update member with old pool id, this is needed for clean up
Rohan Kanadeeeb21642014-08-14 12:00:26 +0200413 _, body = self.client.update_member(self.member['id'],
414 pool_id=self.pool['id'])
Ann Kamyshnikova4f5d0b92014-01-13 16:53:48 +0400415
416 @test.attr(type='smoke')
417 def test_update_member_weight(self):
Rohan Kanadeeeb21642014-08-14 12:00:26 +0200418 self.client.update_member(self.member['id'],
419 weight=2)
420 _, body = self.client.show_member(self.member['id'])
Ann Kamyshnikova4f5d0b92014-01-13 16:53:48 +0400421 member = body['member']
422 self.assertEqual(2, member['weight'])
423
raiesmh0802d04b02013-09-16 12:10:10 +0530424
Sergey Shnaidman97e6a0f2014-11-12 20:00:53 +0300425class LoadBalancerIpV6TestJSON(LoadBalancerTestJSON):
426 _ip_version = 6