blob: ae0a42025a70eac510afabcf2214715d152439fc [file] [log] [blame]
Daniel Mellado3c0aeab2016-01-29 11:30:25 +00001# Copyright 2015 Red Hat, Inc.
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
Chandan Kumarc125fd12017-11-15 19:41:01 +053015from neutron_lib.api.definitions import qos as qos_apidef
16from neutron_lib.services.qos import constants as qos_consts
17from tempest.common import utils
Daniel Mellado3c0aeab2016-01-29 11:30:25 +000018from tempest.lib.common.utils import data_utils
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +000019from tempest.lib import decorators
Daniel Mellado3c0aeab2016-01-29 11:30:25 +000020from tempest.lib import exceptions
Daniel Mellado3c0aeab2016-01-29 11:30:25 +000021
Sławek Kapłoński153f3452017-03-24 22:04:53 +000022import testscenarios
Daniel Mellado3c0aeab2016-01-29 11:30:25 +000023import testtools
24
Chandan Kumar667d3d32017-09-22 12:24:06 +053025from neutron_tempest_plugin.api import base
Daniel Mellado3c0aeab2016-01-29 11:30:25 +000026
27
Sławek Kapłoński153f3452017-03-24 22:04:53 +000028load_tests = testscenarios.load_tests_apply_scenarios
29
30
Daniel Mellado3c0aeab2016-01-29 11:30:25 +000031class QosTestJSON(base.BaseAdminNetworkTest):
Jakub Libosvar1982aa12017-05-30 11:15:33 +000032
Chandan Kumarc125fd12017-11-15 19:41:01 +053033 required_extensions = [qos_apidef.ALIAS]
Daniel Mellado3c0aeab2016-01-29 11:30:25 +000034
Sławek Kapłoński7aa3a352017-06-19 06:35:25 +000035 @staticmethod
36 def _get_driver_details(rule_type_details, driver_name):
37 for driver in rule_type_details['drivers']:
38 if driver['name'] == driver_name:
39 return driver
40
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +000041 @decorators.idempotent_id('108fbdf7-3463-4e47-9871-d07f3dcf5bbb')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +000042 def test_create_policy(self):
43 policy = self.create_qos_policy(name='test-policy',
44 description='test policy desc1',
45 shared=False)
46
47 # Test 'show policy'
48 retrieved_policy = self.admin_client.show_qos_policy(policy['id'])
49 retrieved_policy = retrieved_policy['policy']
50 self.assertEqual('test-policy', retrieved_policy['name'])
51 self.assertEqual('test policy desc1', retrieved_policy['description'])
52 self.assertFalse(retrieved_policy['shared'])
53
54 # Test 'list policies'
55 policies = self.admin_client.list_qos_policies()['policies']
56 policies_ids = [p['id'] for p in policies]
57 self.assertIn(policy['id'], policies_ids)
58
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +000059 @decorators.idempotent_id('606a48e2-5403-4052-b40f-4d54b855af76')
Chandan Kumarc125fd12017-11-15 19:41:01 +053060 @utils.requires_ext(extension="project-id", service="network")
Henry Gessaufa6c78d2016-10-09 19:56:09 -040061 def test_show_policy_has_project_id(self):
62 policy = self.create_qos_policy(name='test-policy', shared=False)
63 body = self.admin_client.show_qos_policy(policy['id'])
64 show_policy = body['policy']
65 self.assertIn('project_id', show_policy)
66 self.assertIn('tenant_id', show_policy)
67 self.assertEqual(self.admin_client.tenant_id,
68 show_policy['project_id'])
69 self.assertEqual(self.admin_client.tenant_id,
70 show_policy['tenant_id'])
71
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +000072 @decorators.idempotent_id('f8d20e92-f06d-4805-b54f-230f77715815')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +000073 def test_list_policy_filter_by_name(self):
74 self.create_qos_policy(name='test', description='test policy',
75 shared=False)
76 self.create_qos_policy(name='test2', description='test policy',
77 shared=False)
78
79 policies = (self.admin_client.
80 list_qos_policies(name='test')['policies'])
81 self.assertEqual(1, len(policies))
82
83 retrieved_policy = policies[0]
84 self.assertEqual('test', retrieved_policy['name'])
85
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +000086 @decorators.idempotent_id('8e88a54b-f0b2-4b7d-b061-a15d93c2c7d6')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +000087 def test_policy_update(self):
88 policy = self.create_qos_policy(name='test-policy',
89 description='',
Rodolfo Alonso Hernandez1e9d1fe2017-02-01 15:15:16 +000090 shared=False,
91 tenant_id=self.admin_client.tenant_id)
Daniel Mellado3c0aeab2016-01-29 11:30:25 +000092 self.admin_client.update_qos_policy(policy['id'],
93 description='test policy desc2',
94 shared=True)
95
96 retrieved_policy = self.admin_client.show_qos_policy(policy['id'])
97 retrieved_policy = retrieved_policy['policy']
98 self.assertEqual('test policy desc2', retrieved_policy['description'])
99 self.assertTrue(retrieved_policy['shared'])
100 self.assertEqual([], retrieved_policy['rules'])
101
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000102 @decorators.idempotent_id('6e880e0f-bbfc-4e54-87c6-680f90e1b618')
Sławek Kapłoński0acecc62016-08-20 21:00:51 +0000103 def test_policy_update_forbidden_for_regular_tenants_own_policy(self):
104 policy = self.create_qos_policy(name='test-policy',
105 description='',
106 shared=False,
107 tenant_id=self.client.tenant_id)
108 self.assertRaises(
109 exceptions.Forbidden,
110 self.client.update_qos_policy,
111 policy['id'], description='test policy')
112
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000113 @decorators.idempotent_id('4ecfd7e7-47b6-4702-be38-be9235901a87')
Sławek Kapłoński0acecc62016-08-20 21:00:51 +0000114 def test_policy_update_forbidden_for_regular_tenants_foreign_policy(self):
115 policy = self.create_qos_policy(name='test-policy',
116 description='',
117 shared=False,
118 tenant_id=self.admin_client.tenant_id)
119 self.assertRaises(
120 exceptions.NotFound,
121 self.client.update_qos_policy,
122 policy['id'], description='test policy')
123
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000124 @decorators.idempotent_id('ee263db4-009a-4641-83e5-d0e83506ba4c')
Sławek Kapłoński6bfcc752016-06-05 09:49:27 +0000125 def test_shared_policy_update(self):
126 policy = self.create_qos_policy(name='test-policy',
127 description='',
Rodolfo Alonso Hernandez1e9d1fe2017-02-01 15:15:16 +0000128 shared=True,
129 tenant_id=self.admin_client.tenant_id)
Sławek Kapłoński6bfcc752016-06-05 09:49:27 +0000130
131 self.admin_client.update_qos_policy(policy['id'],
132 description='test policy desc2')
133 retrieved_policy = self.admin_client.show_qos_policy(policy['id'])
134 retrieved_policy = retrieved_policy['policy']
135 self.assertTrue(retrieved_policy['shared'])
136
137 self.admin_client.update_qos_policy(policy['id'],
138 shared=False)
139 retrieved_policy = self.admin_client.show_qos_policy(policy['id'])
140 retrieved_policy = retrieved_policy['policy']
141 self.assertFalse(retrieved_policy['shared'])
142
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000143 @decorators.idempotent_id('1cb42653-54bd-4a9a-b888-c55e18199201')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000144 def test_delete_policy(self):
145 policy = self.admin_client.create_qos_policy(
146 'test-policy', 'desc', True)['policy']
147
148 retrieved_policy = self.admin_client.show_qos_policy(policy['id'])
149 retrieved_policy = retrieved_policy['policy']
150 self.assertEqual('test-policy', retrieved_policy['name'])
151
152 self.admin_client.delete_qos_policy(policy['id'])
153 self.assertRaises(exceptions.NotFound,
154 self.admin_client.show_qos_policy, policy['id'])
155
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000156 @decorators.idempotent_id('cf776f77-8d3d-49f2-8572-12d6a1557224')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000157 def test_list_admin_rule_types(self):
158 self._test_list_rule_types(self.admin_client)
159
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000160 @decorators.idempotent_id('49c8ea35-83a9-453a-bd23-239cf3b13929')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000161 def test_list_regular_rule_types(self):
162 self._test_list_rule_types(self.client)
163
164 def _test_list_rule_types(self, client):
165 # List supported rule types
Sławek Kapłoński566ae692017-06-25 08:37:42 +0000166 # Since returned rule types depends on loaded backend drivers this test
167 # is checking only if returned keys are same as expected keys
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000168 #
169 # In theory, we could make the test conditional on which ml2 drivers
170 # are enabled in gate (or more specifically, on which supported qos
171 # rules are claimed by core plugin), but that option doesn't seem to be
karimbd4c68e72016-06-24 14:44:11 +0200172 # available through tempest.lib framework
Sławek Kapłoński566ae692017-06-25 08:37:42 +0000173 expected_rule_keys = ['type']
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000174
175 rule_types = client.list_qos_rule_types()
176 actual_list_rule_types = rule_types['rule_types']
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000177
178 # Verify that only required fields present in rule details
179 for rule in actual_list_rule_types:
Sławek Kapłoński566ae692017-06-25 08:37:42 +0000180 self.assertEqual(tuple(expected_rule_keys), tuple(rule.keys()))
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000181
Sławek Kapłoński7aa3a352017-06-19 06:35:25 +0000182 @decorators.idempotent_id('8ececa21-ef97-4904-a152-9f04c90f484d')
183 def test_show_rule_type_details_as_user(self):
184 self.assertRaises(
185 exceptions.Forbidden,
186 self.client.show_qos_rule_type,
187 qos_consts.RULE_TYPE_BANDWIDTH_LIMIT)
188
189 @decorators.idempotent_id('d0a2460b-7325-481f-a531-050bd96ab25e')
190 def test_show_rule_type_details_as_admin(self):
191 # Since returned rule types depend on loaded backend drivers this test
192 # is checking only if returned keys are same as expected keys
193
194 # In theory, we could make the test conditional on which ml2 drivers
195 # are enabled in gate, but that option doesn't seem to be
196 # available through tempest.lib framework
197 expected_rule_type_details_keys = ['type', 'drivers']
198
199 rule_type_details = self.admin_client.show_qos_rule_type(
200 qos_consts.RULE_TYPE_BANDWIDTH_LIMIT).get("rule_type")
201
202 # Verify that only required fields present in rule details
203 self.assertEqual(
204 sorted(tuple(expected_rule_type_details_keys)),
205 sorted(tuple(rule_type_details.keys())))
206
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000207 @decorators.idempotent_id('65b9ef75-1911-406a-bbdb-ca1d68d528b0')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000208 def test_policy_association_with_admin_network(self):
209 policy = self.create_qos_policy(name='test-policy',
210 description='test policy',
211 shared=False)
212 network = self.create_shared_network('test network',
213 qos_policy_id=policy['id'])
214
215 retrieved_network = self.admin_client.show_network(network['id'])
216 self.assertEqual(
217 policy['id'], retrieved_network['network']['qos_policy_id'])
218
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000219 @decorators.idempotent_id('1738de5d-0476-4163-9022-5e1b548c208e')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000220 def test_policy_association_with_tenant_network(self):
221 policy = self.create_qos_policy(name='test-policy',
222 description='test policy',
223 shared=True)
224 network = self.create_network('test network',
225 qos_policy_id=policy['id'])
226
227 retrieved_network = self.admin_client.show_network(network['id'])
228 self.assertEqual(
229 policy['id'], retrieved_network['network']['qos_policy_id'])
230
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000231 @decorators.idempotent_id('9efe63d0-836f-4cc2-b00c-468e63aa614e')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000232 def test_policy_association_with_network_nonexistent_policy(self):
233 self.assertRaises(
234 exceptions.NotFound,
235 self.create_network,
236 'test network',
237 qos_policy_id='9efe63d0-836f-4cc2-b00c-468e63aa614e')
238
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000239 @decorators.idempotent_id('1aa55a79-324f-47d9-a076-894a8fc2448b')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000240 def test_policy_association_with_network_non_shared_policy(self):
241 policy = self.create_qos_policy(name='test-policy',
242 description='test policy',
243 shared=False)
244 self.assertRaises(
245 exceptions.NotFound,
246 self.create_network,
247 'test network', qos_policy_id=policy['id'])
248
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000249 @decorators.idempotent_id('09a9392c-1359-4cbb-989f-fb768e5834a8')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000250 def test_policy_update_association_with_admin_network(self):
251 policy = self.create_qos_policy(name='test-policy',
252 description='test policy',
253 shared=False)
254 network = self.create_shared_network('test network')
255 retrieved_network = self.admin_client.show_network(network['id'])
256 self.assertIsNone(retrieved_network['network']['qos_policy_id'])
257
258 self.admin_client.update_network(network['id'],
259 qos_policy_id=policy['id'])
260 retrieved_network = self.admin_client.show_network(network['id'])
261 self.assertEqual(
262 policy['id'], retrieved_network['network']['qos_policy_id'])
263
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000264 @decorators.idempotent_id('98fcd95e-84cf-4746-860e-44692e674f2e')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000265 def test_policy_association_with_port_shared_policy(self):
266 policy = self.create_qos_policy(name='test-policy',
267 description='test policy',
268 shared=True)
269 network = self.create_shared_network('test network')
270 port = self.create_port(network, qos_policy_id=policy['id'])
271
272 retrieved_port = self.admin_client.show_port(port['id'])
273 self.assertEqual(
274 policy['id'], retrieved_port['port']['qos_policy_id'])
275
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000276 @decorators.idempotent_id('49e02f5a-e1dd-41d5-9855-cfa37f2d195e')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000277 def test_policy_association_with_port_nonexistent_policy(self):
278 network = self.create_shared_network('test network')
279 self.assertRaises(
280 exceptions.NotFound,
281 self.create_port,
282 network,
283 qos_policy_id='49e02f5a-e1dd-41d5-9855-cfa37f2d195e')
284
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000285 @decorators.idempotent_id('f53d961c-9fe5-4422-8b66-7add972c6031')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000286 def test_policy_association_with_port_non_shared_policy(self):
287 policy = self.create_qos_policy(name='test-policy',
288 description='test policy',
289 shared=False)
290 network = self.create_shared_network('test network')
291 self.assertRaises(
292 exceptions.NotFound,
293 self.create_port,
294 network, qos_policy_id=policy['id'])
295
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000296 @decorators.idempotent_id('f8163237-fba9-4db5-9526-bad6d2343c76')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000297 def test_policy_update_association_with_port_shared_policy(self):
298 policy = self.create_qos_policy(name='test-policy',
299 description='test policy',
300 shared=True)
301 network = self.create_shared_network('test network')
302 port = self.create_port(network)
303 retrieved_port = self.admin_client.show_port(port['id'])
304 self.assertIsNone(retrieved_port['port']['qos_policy_id'])
305
306 self.client.update_port(port['id'], qos_policy_id=policy['id'])
307 retrieved_port = self.admin_client.show_port(port['id'])
308 self.assertEqual(
309 policy['id'], retrieved_port['port']['qos_policy_id'])
310
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000311 @decorators.idempotent_id('18163237-8ba9-4db5-9525-bad6d2343c75')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000312 def test_delete_not_allowed_if_policy_in_use_by_network(self):
313 policy = self.create_qos_policy(name='test-policy',
314 description='test policy',
315 shared=True)
Sławek Kapłońskie100c4d2017-08-23 21:18:34 +0000316 self.create_shared_network('test network', qos_policy_id=policy['id'])
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000317 self.assertRaises(
318 exceptions.Conflict,
319 self.admin_client.delete_qos_policy, policy['id'])
320
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000321 @decorators.idempotent_id('24153230-84a9-4dd5-9525-bad6d2343c75')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000322 def test_delete_not_allowed_if_policy_in_use_by_port(self):
323 policy = self.create_qos_policy(name='test-policy',
324 description='test policy',
325 shared=True)
326 network = self.create_shared_network('test network')
Sławek Kapłońskie100c4d2017-08-23 21:18:34 +0000327 self.create_port(network, qos_policy_id=policy['id'])
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000328 self.assertRaises(
329 exceptions.Conflict,
330 self.admin_client.delete_qos_policy, policy['id'])
331
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000332 @decorators.idempotent_id('a2a5849b-dd06-4b18-9664-0b6828a1fc27')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000333 def test_qos_policy_delete_with_rules(self):
334 policy = self.create_qos_policy(name='test-policy',
335 description='test policy',
336 shared=False)
337 self.admin_client.create_bandwidth_limit_rule(
338 policy['id'], 200, 1337)['bandwidth_limit_rule']
339
340 self.admin_client.delete_qos_policy(policy['id'])
341
342 with testtools.ExpectedException(exceptions.NotFound):
343 self.admin_client.show_qos_policy(policy['id'])
344
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000345 @decorators.idempotent_id('fb384bde-a973-41c3-a542-6f77a092155f')
Jakub Libosvarab42ca82016-06-07 07:56:13 +0000346 def test_get_policy_that_is_shared(self):
347 policy = self.create_qos_policy(
348 name='test-policy-shared',
349 description='shared policy',
350 shared=True,
351 tenant_id=self.admin_client.tenant_id)
352 obtained_policy = self.client.show_qos_policy(policy['id'])['policy']
353 self.assertEqual(obtained_policy, policy)
354
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000355 @decorators.idempotent_id('aed8e2a6-22da-421b-89b9-935a2c1a1b50')
Rodolfo Alonso Hernandeze4c099f2016-07-18 11:52:12 +0100356 def test_policy_create_forbidden_for_regular_tenants(self):
357 self.assertRaises(
358 exceptions.Forbidden,
359 self.client.create_qos_policy,
360 'test-policy', 'test policy', False)
361
Hirofumi Ichihara39a6ee12017-08-23 13:55:12 +0900362 @decorators.idempotent_id('18d94f22-b9d5-4390-af12-d30a0cfc4cd3')
363 def test_default_policy_creating_network_without_policy(self):
Chandan Kumarc125fd12017-11-15 19:41:01 +0530364 project_id = self.create_project()['id']
Hirofumi Ichihara39a6ee12017-08-23 13:55:12 +0900365 policy = self.create_qos_policy(name='test-policy',
366 tenant_id=project_id,
367 is_default=True)
368 network = self.create_network('test network', client=self.admin_client,
369 project_id=project_id)
Hirofumi Ichihara39a6ee12017-08-23 13:55:12 +0900370 retrieved_network = self.admin_client.show_network(network['id'])
371 self.assertEqual(
372 policy['id'], retrieved_network['network']['qos_policy_id'])
373
374 @decorators.idempotent_id('807cce45-38e5-482d-94db-36e1796aba73')
375 def test_default_policy_creating_network_with_policy(self):
Chandan Kumarc125fd12017-11-15 19:41:01 +0530376 project_id = self.create_project()['id']
Hirofumi Ichihara39a6ee12017-08-23 13:55:12 +0900377 self.create_qos_policy(name='test-policy',
378 tenant_id=project_id,
379 is_default=True)
380 policy = self.create_qos_policy(name='test-policy',
381 tenant_id=project_id)
382 network = self.create_network('test network', client=self.admin_client,
383 project_id=project_id,
384 qos_policy_id=policy['id'])
Hirofumi Ichihara39a6ee12017-08-23 13:55:12 +0900385 retrieved_network = self.admin_client.show_network(network['id'])
386 self.assertEqual(
387 policy['id'], retrieved_network['network']['qos_policy_id'])
388
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000389
390class QosBandwidthLimitRuleTestJSON(base.BaseAdminNetworkTest):
Sławek Kapłoński153f3452017-03-24 22:04:53 +0000391
392 direction = None
Chandan Kumarc125fd12017-11-15 19:41:01 +0530393 required_extensions = [qos_apidef.ALIAS]
Sławek Kapłoński153f3452017-03-24 22:04:53 +0000394
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000395 @classmethod
YAMAMOTO Takashi3bd3d0f2016-12-12 11:14:58 +0900396 @base.require_qos_rule_type(qos_consts.RULE_TYPE_BANDWIDTH_LIMIT)
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000397 def resource_setup(cls):
398 super(QosBandwidthLimitRuleTestJSON, cls).resource_setup()
399
Sławek Kapłoński153f3452017-03-24 22:04:53 +0000400 @property
401 def opposite_direction(self):
402 if self.direction == "ingress":
403 return "egress"
404 elif self.direction == "egress":
405 return "ingress"
406 else:
407 return None
408
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000409 @decorators.idempotent_id('8a59b00b-3e9c-4787-92f8-93a5cdf5e378')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000410 def test_rule_create(self):
411 policy = self.create_qos_policy(name='test-policy',
412 description='test policy',
413 shared=False)
Sławek Kapłoński153f3452017-03-24 22:04:53 +0000414 rule = self.create_qos_bandwidth_limit_rule(
415 policy_id=policy['id'],
416 max_kbps=200,
417 max_burst_kbps=1337,
418 direction=self.direction)
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000419
420 # Test 'show rule'
421 retrieved_rule = self.admin_client.show_bandwidth_limit_rule(
422 policy['id'], rule['id'])
423 retrieved_rule = retrieved_rule['bandwidth_limit_rule']
424 self.assertEqual(rule['id'], retrieved_rule['id'])
425 self.assertEqual(200, retrieved_rule['max_kbps'])
426 self.assertEqual(1337, retrieved_rule['max_burst_kbps'])
Sławek Kapłoński153f3452017-03-24 22:04:53 +0000427 if self.direction:
428 self.assertEqual(self.direction, retrieved_rule['direction'])
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000429
430 # Test 'list rules'
431 rules = self.admin_client.list_bandwidth_limit_rules(policy['id'])
432 rules = rules['bandwidth_limit_rules']
433 rules_ids = [r['id'] for r in rules]
434 self.assertIn(rule['id'], rules_ids)
435
436 # Test 'show policy'
437 retrieved_policy = self.admin_client.show_qos_policy(policy['id'])
438 policy_rules = retrieved_policy['policy']['rules']
439 self.assertEqual(1, len(policy_rules))
440 self.assertEqual(rule['id'], policy_rules[0]['id'])
441 self.assertEqual(qos_consts.RULE_TYPE_BANDWIDTH_LIMIT,
442 policy_rules[0]['type'])
443
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000444 @decorators.idempotent_id('8a59b00b-ab01-4787-92f8-93a5cdf5e378')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000445 def test_rule_create_fail_for_the_same_type(self):
446 policy = self.create_qos_policy(name='test-policy',
447 description='test policy',
448 shared=False)
449 self.create_qos_bandwidth_limit_rule(policy_id=policy['id'],
450 max_kbps=200,
Sławek Kapłoński153f3452017-03-24 22:04:53 +0000451 max_burst_kbps=1337,
452 direction=self.direction)
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000453
454 self.assertRaises(exceptions.Conflict,
455 self.create_qos_bandwidth_limit_rule,
456 policy_id=policy['id'],
Sławek Kapłoński153f3452017-03-24 22:04:53 +0000457 max_kbps=201, max_burst_kbps=1338,
458 direction=self.direction)
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000459
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000460 @decorators.idempotent_id('149a6988-2568-47d2-931e-2dbc858943b3')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000461 def test_rule_update(self):
462 policy = self.create_qos_policy(name='test-policy',
463 description='test policy',
464 shared=False)
465 rule = self.create_qos_bandwidth_limit_rule(policy_id=policy['id'],
466 max_kbps=1,
Sławek Kapłoński153f3452017-03-24 22:04:53 +0000467 max_burst_kbps=1,
468 direction=self.direction)
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000469
Sławek Kapłoński153f3452017-03-24 22:04:53 +0000470 self.admin_client.update_bandwidth_limit_rule(
471 policy['id'],
472 rule['id'],
473 max_kbps=200,
474 max_burst_kbps=1337,
475 direction=self.opposite_direction)
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000476
477 retrieved_policy = self.admin_client.show_bandwidth_limit_rule(
478 policy['id'], rule['id'])
479 retrieved_policy = retrieved_policy['bandwidth_limit_rule']
480 self.assertEqual(200, retrieved_policy['max_kbps'])
481 self.assertEqual(1337, retrieved_policy['max_burst_kbps'])
Sławek Kapłoński153f3452017-03-24 22:04:53 +0000482 if self.opposite_direction:
483 self.assertEqual(self.opposite_direction,
484 retrieved_policy['direction'])
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000485
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000486 @decorators.idempotent_id('67ee6efd-7b33-4a68-927d-275b4f8ba958')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000487 def test_rule_delete(self):
488 policy = self.create_qos_policy(name='test-policy',
489 description='test policy',
490 shared=False)
491 rule = self.admin_client.create_bandwidth_limit_rule(
Sławek Kapłoński153f3452017-03-24 22:04:53 +0000492 policy['id'], 200, 1337, self.direction)['bandwidth_limit_rule']
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000493
494 retrieved_policy = self.admin_client.show_bandwidth_limit_rule(
495 policy['id'], rule['id'])
496 retrieved_policy = retrieved_policy['bandwidth_limit_rule']
497 self.assertEqual(rule['id'], retrieved_policy['id'])
498
499 self.admin_client.delete_bandwidth_limit_rule(policy['id'], rule['id'])
500 self.assertRaises(exceptions.NotFound,
501 self.admin_client.show_bandwidth_limit_rule,
502 policy['id'], rule['id'])
503
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000504 @decorators.idempotent_id('f211222c-5808-46cb-a961-983bbab6b852')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000505 def test_rule_create_rule_nonexistent_policy(self):
506 self.assertRaises(
507 exceptions.NotFound,
508 self.create_qos_bandwidth_limit_rule,
Sławek Kapłoński153f3452017-03-24 22:04:53 +0000509 'policy', 200, 1337, self.direction)
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000510
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000511 @decorators.idempotent_id('a4a2e7ad-786f-4927-a85a-e545a93bd274')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000512 def test_rule_create_forbidden_for_regular_tenants(self):
513 self.assertRaises(
514 exceptions.Forbidden,
515 self.client.create_bandwidth_limit_rule,
Sławek Kapłoński153f3452017-03-24 22:04:53 +0000516 'policy', 1, 2, self.direction)
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000517
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000518 @decorators.idempotent_id('1bfc55d9-6fd8-4293-ab3a-b1d69bf7cd2e')
Sławek Kapłoński0acecc62016-08-20 21:00:51 +0000519 def test_rule_update_forbidden_for_regular_tenants_own_policy(self):
520 policy = self.create_qos_policy(name='test-policy',
521 description='test policy',
522 shared=False,
523 tenant_id=self.client.tenant_id)
524 rule = self.create_qos_bandwidth_limit_rule(policy_id=policy['id'],
525 max_kbps=1,
Sławek Kapłoński153f3452017-03-24 22:04:53 +0000526 max_burst_kbps=1,
527 direction=self.direction)
Sławek Kapłoński0acecc62016-08-20 21:00:51 +0000528 self.assertRaises(
Matthew Edmondsc13d3502017-04-14 08:22:43 -0400529 exceptions.Forbidden,
Sławek Kapłoński0acecc62016-08-20 21:00:51 +0000530 self.client.update_bandwidth_limit_rule,
531 policy['id'], rule['id'], max_kbps=2, max_burst_kbps=4)
532
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000533 @decorators.idempotent_id('9a607936-4b6f-4c2f-ad21-bd5b3d4fc91f')
Sławek Kapłoński0acecc62016-08-20 21:00:51 +0000534 def test_rule_update_forbidden_for_regular_tenants_foreign_policy(self):
535 policy = self.create_qos_policy(name='test-policy',
536 description='test policy',
537 shared=False,
538 tenant_id=self.admin_client.tenant_id)
539 rule = self.create_qos_bandwidth_limit_rule(policy_id=policy['id'],
540 max_kbps=1,
Sławek Kapłoński153f3452017-03-24 22:04:53 +0000541 max_burst_kbps=1,
542 direction=self.direction)
Sławek Kapłoński0acecc62016-08-20 21:00:51 +0000543 self.assertRaises(
544 exceptions.NotFound,
545 self.client.update_bandwidth_limit_rule,
546 policy['id'], rule['id'], max_kbps=2, max_burst_kbps=4)
547
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000548 @decorators.idempotent_id('ce0bd0c2-54d9-4e29-85f1-cfb36ac3ebe2')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000549 def test_get_rules_by_policy(self):
550 policy1 = self.create_qos_policy(name='test-policy1',
551 description='test policy1',
552 shared=False)
553 rule1 = self.create_qos_bandwidth_limit_rule(policy_id=policy1['id'],
554 max_kbps=200,
Sławek Kapłoński153f3452017-03-24 22:04:53 +0000555 max_burst_kbps=1337,
556 direction=self.direction)
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000557
558 policy2 = self.create_qos_policy(name='test-policy2',
559 description='test policy2',
560 shared=False)
561 rule2 = self.create_qos_bandwidth_limit_rule(policy_id=policy2['id'],
562 max_kbps=5000,
Sławek Kapłoński153f3452017-03-24 22:04:53 +0000563 max_burst_kbps=2523,
564 direction=self.direction)
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000565
566 # Test 'list rules'
567 rules = self.admin_client.list_bandwidth_limit_rules(policy1['id'])
568 rules = rules['bandwidth_limit_rules']
569 rules_ids = [r['id'] for r in rules]
570 self.assertIn(rule1['id'], rules_ids)
571 self.assertNotIn(rule2['id'], rules_ids)
572
573
Sławek Kapłoński153f3452017-03-24 22:04:53 +0000574class QosBandwidthLimitRuleWithDirectionTestJSON(
575 QosBandwidthLimitRuleTestJSON):
576
Jakub Libosvar1982aa12017-05-30 11:15:33 +0000577 required_extensions = (
578 QosBandwidthLimitRuleTestJSON.required_extensions +
579 ['qos-bw-limit-direction']
580 )
Sławek Kapłoński153f3452017-03-24 22:04:53 +0000581 scenarios = [
582 ('ingress', {'direction': 'ingress'}),
583 ('egress', {'direction': 'egress'}),
584 ]
585
Sławek Kapłoński153f3452017-03-24 22:04:53 +0000586
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000587class RbacSharedQosPoliciesTest(base.BaseAdminNetworkTest):
588
589 force_tenant_isolation = True
590 credentials = ['primary', 'alt', 'admin']
Chandan Kumarc125fd12017-11-15 19:41:01 +0530591 required_extensions = [qos_apidef.ALIAS]
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000592
593 @classmethod
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000594 def resource_setup(cls):
595 super(RbacSharedQosPoliciesTest, cls).resource_setup()
rajat294495c042017-06-28 15:37:16 +0530596 cls.client2 = cls.os_alt.network_client
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000597
598 def _create_qos_policy(self, tenant_id=None):
599 args = {'name': data_utils.rand_name('test-policy'),
600 'description': 'test policy',
601 'shared': False,
602 'tenant_id': tenant_id}
603 qos_policy = self.admin_client.create_qos_policy(**args)['policy']
604 self.addCleanup(self.admin_client.delete_qos_policy, qos_policy['id'])
605
606 return qos_policy
607
608 def _make_admin_policy_shared_to_tenant_id(self, tenant_id):
609 policy = self._create_qos_policy()
610 rbac_policy = self.admin_client.create_rbac_policy(
611 object_type='qos_policy',
612 object_id=policy['id'],
613 action='access_as_shared',
614 target_tenant=tenant_id,
615 )['rbac_policy']
616
617 return {'policy': policy, 'rbac_policy': rbac_policy}
618
619 def _create_network(self, qos_policy_id, client, should_cleanup=True):
620 net = client.create_network(
621 name=data_utils.rand_name('test-network'),
622 qos_policy_id=qos_policy_id)['network']
623 if should_cleanup:
624 self.addCleanup(client.delete_network, net['id'])
625
626 return net
627
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000628 @decorators.idempotent_id('b9dcf582-d3b3-11e5-950a-54ee756c66df')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000629 def test_policy_sharing_with_wildcard(self):
630 qos_pol = self.create_qos_policy(
631 name=data_utils.rand_name('test-policy'),
Rodolfo Alonso Hernandez1e9d1fe2017-02-01 15:15:16 +0000632 description='test-shared-policy', shared=False,
633 tenant_id=self.admin_client.tenant_id)
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000634 self.assertNotIn(qos_pol, self.client2.list_qos_policies()['policies'])
635
636 # test update shared False -> True
637 self.admin_client.update_qos_policy(qos_pol['id'], shared=True)
638 qos_pol['shared'] = True
639 self.client2.show_qos_policy(qos_pol['id'])
640 rbac_pol = {'target_tenant': '*',
641 'tenant_id': self.admin_client.tenant_id,
Dariusz Smigielf5fb4c62016-08-19 15:41:17 +0000642 'project_id': self.admin_client.tenant_id,
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000643 'object_type': 'qos_policy',
644 'object_id': qos_pol['id'],
645 'action': 'access_as_shared'}
646
647 rbac_policies = self.admin_client.list_rbac_policies()['rbac_policies']
648 rbac_policies = [r for r in rbac_policies if r.pop('id')]
649 self.assertIn(rbac_pol, rbac_policies)
650
651 # update shared True -> False should fail because the policy is bound
652 # to a network
653 net = self._create_network(qos_pol['id'], self.admin_client, False)
654 with testtools.ExpectedException(exceptions.Conflict):
655 self.admin_client.update_qos_policy(qos_pol['id'], shared=False)
656
657 # delete the network, and update shared True -> False should pass now
658 self.admin_client.delete_network(net['id'])
659 self.admin_client.update_qos_policy(qos_pol['id'], shared=False)
660 qos_pol['shared'] = False
661 self.assertNotIn(qos_pol, self.client2.list_qos_policies()['policies'])
662
663 def _create_net_bound_qos_rbacs(self):
664 res = self._make_admin_policy_shared_to_tenant_id(
665 self.client.tenant_id)
666 qos_policy, rbac_for_client_tenant = res['policy'], res['rbac_policy']
667
668 # add a wildcard rbac rule - now the policy globally shared
669 rbac_wildcard = self.admin_client.create_rbac_policy(
670 object_type='qos_policy',
671 object_id=qos_policy['id'],
672 action='access_as_shared',
673 target_tenant='*',
674 )['rbac_policy']
675
676 # tenant1 now uses qos policy for net
677 self._create_network(qos_policy['id'], self.client)
678
679 return rbac_for_client_tenant, rbac_wildcard
680
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000681 @decorators.idempotent_id('328b1f70-d424-11e5-a57f-54ee756c66df')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000682 def test_net_bound_shared_policy_wildcard_and_tenant_id_wild_remove(self):
683 client_rbac, wildcard_rbac = self._create_net_bound_qos_rbacs()
684 # globally unshare the qos-policy, the specific share should remain
685 self.admin_client.delete_rbac_policy(wildcard_rbac['id'])
686 self.client.list_rbac_policies(id=client_rbac['id'])
687
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000688 @decorators.idempotent_id('1997b00c-0c75-4e43-8ce2-999f9fa555ee')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000689 def test_net_bound_shared_policy_wildcard_and_tenant_id_wild_remains(self):
690 client_rbac, wildcard_rbac = self._create_net_bound_qos_rbacs()
691 # remove client_rbac policy the wildcard share should remain
692 self.admin_client.delete_rbac_policy(client_rbac['id'])
693 self.client.list_rbac_policies(id=wildcard_rbac['id'])
694
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000695 @decorators.idempotent_id('2ace9adc-da6e-11e5-aafe-54ee756c66df')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000696 def test_policy_sharing_with_wildcard_and_tenant_id(self):
697 res = self._make_admin_policy_shared_to_tenant_id(
698 self.client.tenant_id)
699 qos_policy, rbac = res['policy'], res['rbac_policy']
700 qos_pol = self.client.show_qos_policy(qos_policy['id'])['policy']
701 self.assertTrue(qos_pol['shared'])
702 with testtools.ExpectedException(exceptions.NotFound):
703 self.client2.show_qos_policy(qos_policy['id'])
704
705 # make the qos-policy globally shared
706 self.admin_client.update_qos_policy(qos_policy['id'], shared=True)
707 qos_pol = self.client2.show_qos_policy(qos_policy['id'])['policy']
708 self.assertTrue(qos_pol['shared'])
709
710 # globally unshare the qos-policy, the specific share should remain
711 self.admin_client.update_qos_policy(qos_policy['id'], shared=False)
712 self.client.show_qos_policy(qos_policy['id'])
713 with testtools.ExpectedException(exceptions.NotFound):
714 self.client2.show_qos_policy(qos_policy['id'])
715 self.assertIn(rbac,
716 self.admin_client.list_rbac_policies()['rbac_policies'])
717
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000718 @decorators.idempotent_id('9f85c76a-a350-11e5-8ae5-54ee756c66df')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000719 def test_policy_target_update(self):
720 res = self._make_admin_policy_shared_to_tenant_id(
721 self.client.tenant_id)
722 # change to client2
723 update_res = self.admin_client.update_rbac_policy(
724 res['rbac_policy']['id'], target_tenant=self.client2.tenant_id)
725 self.assertEqual(self.client2.tenant_id,
726 update_res['rbac_policy']['target_tenant'])
727 # make sure everything else stayed the same
728 res['rbac_policy'].pop('target_tenant')
729 update_res['rbac_policy'].pop('target_tenant')
730 self.assertEqual(res['rbac_policy'], update_res['rbac_policy'])
731
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000732 @decorators.idempotent_id('a9b39f46-a350-11e5-97c7-54ee756c66df')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000733 def test_network_presence_prevents_policy_rbac_policy_deletion(self):
734 res = self._make_admin_policy_shared_to_tenant_id(
735 self.client2.tenant_id)
736 qos_policy_id = res['policy']['id']
737 self._create_network(qos_policy_id, self.client2)
738 # a network with shared qos-policy should prevent the deletion of an
739 # rbac-policy required for it to be shared
740 with testtools.ExpectedException(exceptions.Conflict):
741 self.admin_client.delete_rbac_policy(res['rbac_policy']['id'])
742
743 # a wildcard policy should allow the specific policy to be deleted
744 # since it allows the remaining port
745 wild = self.admin_client.create_rbac_policy(
746 object_type='qos_policy', object_id=res['policy']['id'],
747 action='access_as_shared', target_tenant='*')['rbac_policy']
748 self.admin_client.delete_rbac_policy(res['rbac_policy']['id'])
749
750 # now that wildcard is the only remaining, it should be subjected to
751 # the same restriction
752 with testtools.ExpectedException(exceptions.Conflict):
753 self.admin_client.delete_rbac_policy(wild['id'])
754
755 # we can't update the policy to a different tenant
756 with testtools.ExpectedException(exceptions.Conflict):
757 self.admin_client.update_rbac_policy(
758 wild['id'], target_tenant=self.client2.tenant_id)
759
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000760 @decorators.idempotent_id('b0fe87e8-a350-11e5-9f08-54ee756c66df')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000761 def test_regular_client_shares_to_another_regular_client(self):
762 # owned by self.admin_client
763 policy = self._create_qos_policy()
764 with testtools.ExpectedException(exceptions.NotFound):
765 self.client.show_qos_policy(policy['id'])
766 rbac_policy = self.admin_client.create_rbac_policy(
767 object_type='qos_policy', object_id=policy['id'],
768 action='access_as_shared',
769 target_tenant=self.client.tenant_id)['rbac_policy']
770 self.client.show_qos_policy(policy['id'])
771
772 self.assertIn(rbac_policy,
773 self.admin_client.list_rbac_policies()['rbac_policies'])
774 # ensure that 'client2' can't see the rbac-policy sharing the
775 # qos-policy to it because the rbac-policy belongs to 'client'
776 self.assertNotIn(rbac_policy['id'], [p['id'] for p in
777 self.client2.list_rbac_policies()['rbac_policies']])
778
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000779 @decorators.idempotent_id('ba88d0ca-a350-11e5-a06f-54ee756c66df')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000780 def test_filter_fields(self):
781 policy = self._create_qos_policy()
782 self.admin_client.create_rbac_policy(
783 object_type='qos_policy', object_id=policy['id'],
784 action='access_as_shared', target_tenant=self.client2.tenant_id)
785 field_args = (('id',), ('id', 'action'), ('object_type', 'object_id'),
786 ('tenant_id', 'target_tenant'))
787 for fields in field_args:
788 res = self.admin_client.list_rbac_policies(fields=fields)
789 self.assertEqual(set(fields), set(res['rbac_policies'][0].keys()))
790
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000791 @decorators.idempotent_id('c10d993a-a350-11e5-9c7a-54ee756c66df')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000792 def test_rbac_policy_show(self):
793 res = self._make_admin_policy_shared_to_tenant_id(
794 self.client.tenant_id)
795 p1 = res['rbac_policy']
796 p2 = self.admin_client.create_rbac_policy(
797 object_type='qos_policy', object_id=res['policy']['id'],
798 action='access_as_shared',
799 target_tenant='*')['rbac_policy']
800
801 self.assertEqual(
802 p1, self.admin_client.show_rbac_policy(p1['id'])['rbac_policy'])
803 self.assertEqual(
804 p2, self.admin_client.show_rbac_policy(p2['id'])['rbac_policy'])
805
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000806 @decorators.idempotent_id('c7496f86-a350-11e5-b380-54ee756c66df')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000807 def test_filter_rbac_policies(self):
808 policy = self._create_qos_policy()
809 rbac_pol1 = self.admin_client.create_rbac_policy(
810 object_type='qos_policy', object_id=policy['id'],
811 action='access_as_shared',
812 target_tenant=self.client2.tenant_id)['rbac_policy']
813 rbac_pol2 = self.admin_client.create_rbac_policy(
814 object_type='qos_policy', object_id=policy['id'],
815 action='access_as_shared',
816 target_tenant=self.admin_client.tenant_id)['rbac_policy']
817 res1 = self.admin_client.list_rbac_policies(id=rbac_pol1['id'])[
818 'rbac_policies']
819 res2 = self.admin_client.list_rbac_policies(id=rbac_pol2['id'])[
820 'rbac_policies']
821 self.assertEqual(1, len(res1))
822 self.assertEqual(1, len(res2))
823 self.assertEqual(rbac_pol1['id'], res1[0]['id'])
824 self.assertEqual(rbac_pol2['id'], res2[0]['id'])
825
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000826 @decorators.idempotent_id('cd7d755a-a350-11e5-a344-54ee756c66df')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000827 def test_regular_client_blocked_from_sharing_anothers_policy(self):
828 qos_policy = self._make_admin_policy_shared_to_tenant_id(
829 self.client.tenant_id)['policy']
830 with testtools.ExpectedException(exceptions.BadRequest):
831 self.client.create_rbac_policy(
832 object_type='qos_policy', object_id=qos_policy['id'],
833 action='access_as_shared',
834 target_tenant=self.client2.tenant_id)
835
836 # make sure the rbac-policy is invisible to the tenant for which it's
837 # being shared
838 self.assertFalse(self.client.list_rbac_policies()['rbac_policies'])
839
840
841class QosDscpMarkingRuleTestJSON(base.BaseAdminNetworkTest):
842 VALID_DSCP_MARK1 = 56
843 VALID_DSCP_MARK2 = 48
844
Chandan Kumarc125fd12017-11-15 19:41:01 +0530845 required_extensions = [qos_apidef.ALIAS]
Jakub Libosvar1982aa12017-05-30 11:15:33 +0000846
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000847 @classmethod
YAMAMOTO Takashi3bd3d0f2016-12-12 11:14:58 +0900848 @base.require_qos_rule_type(qos_consts.RULE_TYPE_DSCP_MARKING)
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000849 def resource_setup(cls):
850 super(QosDscpMarkingRuleTestJSON, cls).resource_setup()
851
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000852 @decorators.idempotent_id('f5cbaceb-5829-497c-9c60-ad70969e9a08')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000853 def test_rule_create(self):
854 policy = self.create_qos_policy(name='test-policy',
855 description='test policy',
856 shared=False)
857 rule = self.admin_client.create_dscp_marking_rule(
858 policy['id'], self.VALID_DSCP_MARK1)['dscp_marking_rule']
859
860 # Test 'show rule'
861 retrieved_rule = self.admin_client.show_dscp_marking_rule(
862 policy['id'], rule['id'])
863 retrieved_rule = retrieved_rule['dscp_marking_rule']
864 self.assertEqual(rule['id'], retrieved_rule['id'])
865 self.assertEqual(self.VALID_DSCP_MARK1, retrieved_rule['dscp_mark'])
866
867 # Test 'list rules'
868 rules = self.admin_client.list_dscp_marking_rules(policy['id'])
869 rules = rules['dscp_marking_rules']
870 rules_ids = [r['id'] for r in rules]
871 self.assertIn(rule['id'], rules_ids)
872
873 # Test 'show policy'
874 retrieved_policy = self.admin_client.show_qos_policy(policy['id'])
875 policy_rules = retrieved_policy['policy']['rules']
876 self.assertEqual(1, len(policy_rules))
877 self.assertEqual(rule['id'], policy_rules[0]['id'])
David Shaughnessydbf24822016-03-14 16:27:54 +0000878 self.assertEqual(qos_consts.RULE_TYPE_DSCP_MARKING,
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000879 policy_rules[0]['type'])
880
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000881 @decorators.idempotent_id('08553ffe-030f-4037-b486-7e0b8fb9385a')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000882 def test_rule_create_fail_for_the_same_type(self):
883 policy = self.create_qos_policy(name='test-policy',
884 description='test policy',
885 shared=False)
886 self.admin_client.create_dscp_marking_rule(
887 policy['id'], self.VALID_DSCP_MARK1)['dscp_marking_rule']
888
889 self.assertRaises(exceptions.Conflict,
890 self.admin_client.create_dscp_marking_rule,
891 policy_id=policy['id'],
892 dscp_mark=self.VALID_DSCP_MARK2)
893
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000894 @decorators.idempotent_id('76f632e5-3175-4408-9a32-3625e599c8a2')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000895 def test_rule_update(self):
896 policy = self.create_qos_policy(name='test-policy',
897 description='test policy',
898 shared=False)
899 rule = self.admin_client.create_dscp_marking_rule(
900 policy['id'], self.VALID_DSCP_MARK1)['dscp_marking_rule']
901
902 self.admin_client.update_dscp_marking_rule(
903 policy['id'], rule['id'], dscp_mark=self.VALID_DSCP_MARK2)
904
905 retrieved_policy = self.admin_client.show_dscp_marking_rule(
906 policy['id'], rule['id'])
907 retrieved_policy = retrieved_policy['dscp_marking_rule']
908 self.assertEqual(self.VALID_DSCP_MARK2, retrieved_policy['dscp_mark'])
909
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000910 @decorators.idempotent_id('74f81904-c35f-48a3-adae-1f5424cb3c18')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000911 def test_rule_delete(self):
912 policy = self.create_qos_policy(name='test-policy',
913 description='test policy',
914 shared=False)
915 rule = self.admin_client.create_dscp_marking_rule(
916 policy['id'], self.VALID_DSCP_MARK1)['dscp_marking_rule']
917
918 retrieved_policy = self.admin_client.show_dscp_marking_rule(
919 policy['id'], rule['id'])
920 retrieved_policy = retrieved_policy['dscp_marking_rule']
921 self.assertEqual(rule['id'], retrieved_policy['id'])
922
923 self.admin_client.delete_dscp_marking_rule(policy['id'], rule['id'])
924 self.assertRaises(exceptions.NotFound,
925 self.admin_client.show_dscp_marking_rule,
926 policy['id'], rule['id'])
927
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000928 @decorators.idempotent_id('9cb8ef5c-96fc-4978-9ee0-e3b02bab628a')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000929 def test_rule_create_rule_nonexistent_policy(self):
930 self.assertRaises(
931 exceptions.NotFound,
932 self.admin_client.create_dscp_marking_rule,
933 'policy', self.VALID_DSCP_MARK1)
934
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000935 @decorators.idempotent_id('bf6002ea-29de-486f-b65d-08aea6d4c4e2')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000936 def test_rule_create_forbidden_for_regular_tenants(self):
937 self.assertRaises(
938 exceptions.Forbidden,
939 self.client.create_dscp_marking_rule,
940 'policy', self.VALID_DSCP_MARK1)
941
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000942 @decorators.idempotent_id('33646b08-4f05-4493-a48a-bde768a18533')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000943 def test_invalid_rule_create(self):
944 policy = self.create_qos_policy(name='test-policy',
945 description='test policy',
946 shared=False)
947 self.assertRaises(
948 exceptions.BadRequest,
949 self.admin_client.create_dscp_marking_rule,
950 policy['id'], 58)
951
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000952 @decorators.idempotent_id('c565131d-4c80-4231-b0f3-9ae2be4de129')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000953 def test_get_rules_by_policy(self):
954 policy1 = self.create_qos_policy(name='test-policy1',
955 description='test policy1',
956 shared=False)
957 rule1 = self.admin_client.create_dscp_marking_rule(
958 policy1['id'], self.VALID_DSCP_MARK1)['dscp_marking_rule']
959
960 policy2 = self.create_qos_policy(name='test-policy2',
961 description='test policy2',
962 shared=False)
963 rule2 = self.admin_client.create_dscp_marking_rule(
964 policy2['id'], self.VALID_DSCP_MARK2)['dscp_marking_rule']
965
966 # Test 'list rules'
967 rules = self.admin_client.list_dscp_marking_rules(policy1['id'])
968 rules = rules['dscp_marking_rules']
969 rules_ids = [r['id'] for r in rules]
970 self.assertIn(rule1['id'], rules_ids)
971 self.assertNotIn(rule2['id'], rules_ids)
Ihar Hrachyshkab7940d92016-06-10 13:44:22 +0200972
973
Rodolfo Alonso Hernandeze4c099f2016-07-18 11:52:12 +0100974class QosMinimumBandwidthRuleTestJSON(base.BaseAdminNetworkTest):
975 DIRECTION_EGRESS = "egress"
976 DIRECTION_INGRESS = "ingress"
977 RULE_NAME = qos_consts.RULE_TYPE_MINIMUM_BANDWIDTH + "_rule"
978 RULES_NAME = RULE_NAME + "s"
Chandan Kumarc125fd12017-11-15 19:41:01 +0530979 required_extensions = [qos_apidef.ALIAS]
Rodolfo Alonso Hernandeze4c099f2016-07-18 11:52:12 +0100980
981 @classmethod
YAMAMOTO Takashi3bd3d0f2016-12-12 11:14:58 +0900982 @base.require_qos_rule_type(qos_consts.RULE_TYPE_MINIMUM_BANDWIDTH)
Rodolfo Alonso Hernandeze4c099f2016-07-18 11:52:12 +0100983 def resource_setup(cls):
984 super(QosMinimumBandwidthRuleTestJSON, cls).resource_setup()
985
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000986 @decorators.idempotent_id('aa59b00b-3e9c-4787-92f8-93a5cdf5e378')
Rodolfo Alonso Hernandeze4c099f2016-07-18 11:52:12 +0100987 def test_rule_create(self):
988 policy = self.create_qos_policy(name='test-policy',
989 description='test policy',
990 shared=False)
991 rule = self.admin_client.create_minimum_bandwidth_rule(
Ihar Hrachyshka33034bf2016-08-31 18:48:14 +0000992 policy_id=policy['id'],
993 direction=self.DIRECTION_EGRESS,
994 min_kbps=1138)[self.RULE_NAME]
Rodolfo Alonso Hernandeze4c099f2016-07-18 11:52:12 +0100995
996 # Test 'show rule'
997 retrieved_rule = self.admin_client.show_minimum_bandwidth_rule(
998 policy['id'], rule['id'])
999 retrieved_rule = retrieved_rule[self.RULE_NAME]
1000 self.assertEqual(rule['id'], retrieved_rule['id'])
1001 self.assertEqual(1138, retrieved_rule['min_kbps'])
1002 self.assertEqual(self.DIRECTION_EGRESS, retrieved_rule['direction'])
1003
1004 # Test 'list rules'
1005 rules = self.admin_client.list_minimum_bandwidth_rules(policy['id'])
1006 rules = rules[self.RULES_NAME]
1007 rules_ids = [r['id'] for r in rules]
1008 self.assertIn(rule['id'], rules_ids)
1009
1010 # Test 'show policy'
1011 retrieved_policy = self.admin_client.show_qos_policy(policy['id'])
1012 policy_rules = retrieved_policy['policy']['rules']
1013 self.assertEqual(1, len(policy_rules))
1014 self.assertEqual(rule['id'], policy_rules[0]['id'])
1015 self.assertEqual(qos_consts.RULE_TYPE_MINIMUM_BANDWIDTH,
1016 policy_rules[0]['type'])
1017
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +00001018 @decorators.idempotent_id('266d9b87-e51c-48bd-9aa7-8269573621be')
Ihar Hrachyshka33034bf2016-08-31 18:48:14 +00001019 def test_rule_create_fail_for_missing_min_kbps(self):
1020 policy = self.create_qos_policy(name='test-policy',
1021 description='test policy',
1022 shared=False)
1023 self.assertRaises(exceptions.BadRequest,
1024 self.admin_client.create_minimum_bandwidth_rule,
1025 policy_id=policy['id'],
1026 direction=self.DIRECTION_EGRESS)
1027
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +00001028 @decorators.idempotent_id('aa59b00b-ab01-4787-92f8-93a5cdf5e378')
Rodolfo Alonso Hernandeze4c099f2016-07-18 11:52:12 +01001029 def test_rule_create_fail_for_the_same_type(self):
1030 policy = self.create_qos_policy(name='test-policy',
1031 description='test policy',
1032 shared=False)
1033 self.admin_client.create_minimum_bandwidth_rule(
Ihar Hrachyshka33034bf2016-08-31 18:48:14 +00001034 policy_id=policy['id'],
1035 direction=self.DIRECTION_EGRESS, min_kbps=200)
Rodolfo Alonso Hernandeze4c099f2016-07-18 11:52:12 +01001036
1037 self.assertRaises(exceptions.Conflict,
1038 self.admin_client.create_minimum_bandwidth_rule,
1039 policy_id=policy['id'],
Ihar Hrachyshka33034bf2016-08-31 18:48:14 +00001040 direction=self.DIRECTION_EGRESS, min_kbps=201)
Rodolfo Alonso Hernandeze4c099f2016-07-18 11:52:12 +01001041
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +00001042 @decorators.idempotent_id('d6fce764-e511-4fa6-9f86-f4b41cf142cf')
Rodolfo Alonso Hernandeze4c099f2016-07-18 11:52:12 +01001043 def test_rule_create_fail_for_direction_ingress(self):
1044 policy = self.create_qos_policy(name='test-policy',
1045 description='test policy',
1046 shared=False)
1047 self.assertRaises(exceptions.BadRequest,
1048 self.admin_client.create_minimum_bandwidth_rule,
1049 policy_id=policy['id'],
Ihar Hrachyshka33034bf2016-08-31 18:48:14 +00001050 direction=self.DIRECTION_INGRESS,
1051 min_kbps=201)
Rodolfo Alonso Hernandeze4c099f2016-07-18 11:52:12 +01001052
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +00001053 @decorators.idempotent_id('a49a6988-2568-47d2-931e-2dbc858943b3')
Rodolfo Alonso Hernandeze4c099f2016-07-18 11:52:12 +01001054 def test_rule_update(self):
1055 policy = self.create_qos_policy(name='test-policy',
1056 description='test policy',
1057 shared=False)
1058 rule = self.admin_client.create_minimum_bandwidth_rule(
Ihar Hrachyshka33034bf2016-08-31 18:48:14 +00001059 policy_id=policy['id'],
1060 direction=self.DIRECTION_EGRESS,
1061 min_kbps=300)[self.RULE_NAME]
Rodolfo Alonso Hernandeze4c099f2016-07-18 11:52:12 +01001062
1063 self.admin_client.update_minimum_bandwidth_rule(policy['id'],
1064 rule['id'], min_kbps=350, direction=self.DIRECTION_EGRESS)
1065
1066 retrieved_policy = self.admin_client.show_minimum_bandwidth_rule(
1067 policy['id'], rule['id'])
1068 retrieved_policy = retrieved_policy[self.RULE_NAME]
1069 self.assertEqual(350, retrieved_policy['min_kbps'])
1070 self.assertEqual(self.DIRECTION_EGRESS, retrieved_policy['direction'])
1071
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +00001072 @decorators.idempotent_id('a7ee6efd-7b33-4a68-927d-275b4f8ba958')
Rodolfo Alonso Hernandeze4c099f2016-07-18 11:52:12 +01001073 def test_rule_delete(self):
1074 policy = self.create_qos_policy(name='test-policy',
1075 description='test policy',
1076 shared=False)
1077 rule = self.admin_client.create_minimum_bandwidth_rule(
Ihar Hrachyshka33034bf2016-08-31 18:48:14 +00001078 policy['id'], self.DIRECTION_EGRESS, min_kbps=200)[self.RULE_NAME]
Rodolfo Alonso Hernandeze4c099f2016-07-18 11:52:12 +01001079
1080 retrieved_policy = self.admin_client.show_minimum_bandwidth_rule(
1081 policy['id'], rule['id'])
1082 retrieved_policy = retrieved_policy[self.RULE_NAME]
1083 self.assertEqual(rule['id'], retrieved_policy['id'])
1084
1085 self.admin_client.delete_minimum_bandwidth_rule(policy['id'],
1086 rule['id'])
1087 self.assertRaises(exceptions.NotFound,
1088 self.admin_client.show_minimum_bandwidth_rule,
1089 policy['id'], rule['id'])
1090
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +00001091 @decorators.idempotent_id('a211222c-5808-46cb-a961-983bbab6b852')
Rodolfo Alonso Hernandeze4c099f2016-07-18 11:52:12 +01001092 def test_rule_create_rule_nonexistent_policy(self):
1093 self.assertRaises(
1094 exceptions.NotFound,
1095 self.admin_client.create_minimum_bandwidth_rule,
Ihar Hrachyshka33034bf2016-08-31 18:48:14 +00001096 'policy', self.DIRECTION_EGRESS, min_kbps=200)
Rodolfo Alonso Hernandeze4c099f2016-07-18 11:52:12 +01001097
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +00001098 @decorators.idempotent_id('b4a2e7ad-786f-4927-a85a-e545a93bd274')
Rodolfo Alonso Hernandeze4c099f2016-07-18 11:52:12 +01001099 def test_rule_create_forbidden_for_regular_tenants(self):
1100 self.assertRaises(
1101 exceptions.Forbidden,
1102 self.client.create_minimum_bandwidth_rule,
Ihar Hrachyshka33034bf2016-08-31 18:48:14 +00001103 'policy', self.DIRECTION_EGRESS, min_kbps=300)
Rodolfo Alonso Hernandeze4c099f2016-07-18 11:52:12 +01001104
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +00001105 @decorators.idempotent_id('de0bd0c2-54d9-4e29-85f1-cfb36ac3ebe2')
Rodolfo Alonso Hernandeze4c099f2016-07-18 11:52:12 +01001106 def test_get_rules_by_policy(self):
1107 policy1 = self.create_qos_policy(name='test-policy1',
1108 description='test policy1',
1109 shared=False)
1110 rule1 = self.admin_client.create_minimum_bandwidth_rule(
Ihar Hrachyshka33034bf2016-08-31 18:48:14 +00001111 policy_id=policy1['id'],
1112 direction=self.DIRECTION_EGRESS,
1113 min_kbps=200)[self.RULE_NAME]
Rodolfo Alonso Hernandeze4c099f2016-07-18 11:52:12 +01001114
1115 policy2 = self.create_qos_policy(name='test-policy2',
1116 description='test policy2',
1117 shared=False)
1118 rule2 = self.admin_client.create_minimum_bandwidth_rule(
Ihar Hrachyshka33034bf2016-08-31 18:48:14 +00001119 policy_id=policy2['id'],
1120 direction=self.DIRECTION_EGRESS,
1121 min_kbps=5000)[self.RULE_NAME]
Rodolfo Alonso Hernandeze4c099f2016-07-18 11:52:12 +01001122
1123 # Test 'list rules'
1124 rules = self.admin_client.list_minimum_bandwidth_rules(policy1['id'])
1125 rules = rules[self.RULES_NAME]
1126 rules_ids = [r['id'] for r in rules]
1127 self.assertIn(rule1['id'], rules_ids)
1128 self.assertNotIn(rule2['id'], rules_ids)
1129
1130
Ihar Hrachyshkab7940d92016-06-10 13:44:22 +02001131class QosSearchCriteriaTest(base.BaseSearchCriteriaTest,
1132 base.BaseAdminNetworkTest):
1133
1134 resource = 'policy'
1135 plural_name = 'policies'
1136
1137 # Use unique description to isolate the tests from other QoS tests
1138 list_kwargs = {'description': 'search-criteria-test'}
1139 list_as_admin = True
1140
Chandan Kumarc125fd12017-11-15 19:41:01 +05301141 required_extensions = [qos_apidef.ALIAS]
Jakub Libosvar1982aa12017-05-30 11:15:33 +00001142
Ihar Hrachyshkab7940d92016-06-10 13:44:22 +02001143 @classmethod
Ihar Hrachyshkab7940d92016-06-10 13:44:22 +02001144 def resource_setup(cls):
1145 super(QosSearchCriteriaTest, cls).resource_setup()
1146 for name in cls.resource_names:
1147 cls.create_qos_policy(
1148 name=name, description='search-criteria-test')
1149
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +00001150 @decorators.idempotent_id('55fc0103-fdc1-4d34-ab62-c579bb739a91')
Ihar Hrachyshkab7940d92016-06-10 13:44:22 +02001151 def test_list_sorts_asc(self):
1152 self._test_list_sorts_asc()
1153
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +00001154 @decorators.idempotent_id('13e08ac3-bfed-426b-892a-b3b158560c23')
Ihar Hrachyshkab7940d92016-06-10 13:44:22 +02001155 def test_list_sorts_desc(self):
1156 self._test_list_sorts_desc()
1157
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +00001158 @decorators.idempotent_id('719e61cc-e33c-4918-aa4d-1a791e6e0e86')
Ihar Hrachyshkab7940d92016-06-10 13:44:22 +02001159 def test_list_pagination(self):
1160 self._test_list_pagination()
1161
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +00001162 @decorators.idempotent_id('3bd8fb58-c0f8-4954-87fb-f286e1eb096a')
Ihar Hrachyshkab7940d92016-06-10 13:44:22 +02001163 def test_list_pagination_with_marker(self):
1164 self._test_list_pagination_with_marker()
1165
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +00001166 @decorators.idempotent_id('3bad0747-8082-46e9-be4d-c428a842db41')
Ihar Hrachyshkab7940d92016-06-10 13:44:22 +02001167 def test_list_pagination_with_href_links(self):
1168 self._test_list_pagination_with_href_links()
1169
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +00001170 @decorators.idempotent_id('d6a8bacd-d5e8-4ef3-bc55-23ca6998d208')
Ihar Hrachyshkab7940d92016-06-10 13:44:22 +02001171 def test_list_pagination_page_reverse_asc(self):
1172 self._test_list_pagination_page_reverse_asc()
1173
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +00001174 @decorators.idempotent_id('0b9aecdc-2b27-421b-b104-53d24e905ae8')
Ihar Hrachyshkab7940d92016-06-10 13:44:22 +02001175 def test_list_pagination_page_reverse_desc(self):
1176 self._test_list_pagination_page_reverse_desc()
1177
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +00001178 @decorators.idempotent_id('1a3dc257-dafd-4870-8c71-639ae7ddc6ea')
Ihar Hrachyshkab7940d92016-06-10 13:44:22 +02001179 def test_list_pagination_page_reverse_with_href_links(self):
1180 self._test_list_pagination_page_reverse_with_href_links()
1181
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +00001182 @decorators.idempotent_id('40e09b53-4eb8-4526-9181-d438c8005a20')
Ihar Hrachyshkab7940d92016-06-10 13:44:22 +02001183 def test_list_no_pagination_limit_0(self):
1184 self._test_list_no_pagination_limit_0()