blob: ba7aad8aa011c9dc4d79ab574448c98c9ce43ca8 [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
Sławek Kapłoński508dd292018-02-22 13:41:01 +0100389 @decorators.idempotent_id('06060880-2956-4c16-9a63-f284c3879229')
390 def test_user_create_port_with_admin_qos_policy(self):
391 qos_policy = self.create_qos_policy(
392 name='test-policy',
393 tenant_id=self.admin_client.tenant_id,
394 shared=False)
395 network = self.create_network(
396 'test network', client=self.admin_client,
397 project_id=self.client.tenant_id,
398 qos_policy_id=qos_policy['id'])
399 port = self.create_port(network)
400 self.assertEqual(network['id'], port['network_id'])
401
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000402
403class QosBandwidthLimitRuleTestJSON(base.BaseAdminNetworkTest):
Sławek Kapłoński153f3452017-03-24 22:04:53 +0000404
405 direction = None
Chandan Kumarc125fd12017-11-15 19:41:01 +0530406 required_extensions = [qos_apidef.ALIAS]
Sławek Kapłoński153f3452017-03-24 22:04:53 +0000407
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000408 @classmethod
YAMAMOTO Takashi3bd3d0f2016-12-12 11:14:58 +0900409 @base.require_qos_rule_type(qos_consts.RULE_TYPE_BANDWIDTH_LIMIT)
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000410 def resource_setup(cls):
411 super(QosBandwidthLimitRuleTestJSON, cls).resource_setup()
412
Sławek Kapłoński153f3452017-03-24 22:04:53 +0000413 @property
414 def opposite_direction(self):
415 if self.direction == "ingress":
416 return "egress"
417 elif self.direction == "egress":
418 return "ingress"
419 else:
420 return None
421
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000422 @decorators.idempotent_id('8a59b00b-3e9c-4787-92f8-93a5cdf5e378')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000423 def test_rule_create(self):
424 policy = self.create_qos_policy(name='test-policy',
425 description='test policy',
426 shared=False)
Sławek Kapłoński153f3452017-03-24 22:04:53 +0000427 rule = self.create_qos_bandwidth_limit_rule(
428 policy_id=policy['id'],
429 max_kbps=200,
430 max_burst_kbps=1337,
431 direction=self.direction)
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000432
433 # Test 'show rule'
434 retrieved_rule = self.admin_client.show_bandwidth_limit_rule(
435 policy['id'], rule['id'])
436 retrieved_rule = retrieved_rule['bandwidth_limit_rule']
437 self.assertEqual(rule['id'], retrieved_rule['id'])
438 self.assertEqual(200, retrieved_rule['max_kbps'])
439 self.assertEqual(1337, retrieved_rule['max_burst_kbps'])
Sławek Kapłoński153f3452017-03-24 22:04:53 +0000440 if self.direction:
441 self.assertEqual(self.direction, retrieved_rule['direction'])
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000442
443 # Test 'list rules'
444 rules = self.admin_client.list_bandwidth_limit_rules(policy['id'])
445 rules = rules['bandwidth_limit_rules']
446 rules_ids = [r['id'] for r in rules]
447 self.assertIn(rule['id'], rules_ids)
448
449 # Test 'show policy'
450 retrieved_policy = self.admin_client.show_qos_policy(policy['id'])
451 policy_rules = retrieved_policy['policy']['rules']
452 self.assertEqual(1, len(policy_rules))
453 self.assertEqual(rule['id'], policy_rules[0]['id'])
454 self.assertEqual(qos_consts.RULE_TYPE_BANDWIDTH_LIMIT,
455 policy_rules[0]['type'])
456
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000457 @decorators.idempotent_id('8a59b00b-ab01-4787-92f8-93a5cdf5e378')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000458 def test_rule_create_fail_for_the_same_type(self):
459 policy = self.create_qos_policy(name='test-policy',
460 description='test policy',
461 shared=False)
462 self.create_qos_bandwidth_limit_rule(policy_id=policy['id'],
463 max_kbps=200,
Sławek Kapłoński153f3452017-03-24 22:04:53 +0000464 max_burst_kbps=1337,
465 direction=self.direction)
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000466
467 self.assertRaises(exceptions.Conflict,
468 self.create_qos_bandwidth_limit_rule,
469 policy_id=policy['id'],
Sławek Kapłoński153f3452017-03-24 22:04:53 +0000470 max_kbps=201, max_burst_kbps=1338,
471 direction=self.direction)
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000472
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000473 @decorators.idempotent_id('149a6988-2568-47d2-931e-2dbc858943b3')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000474 def test_rule_update(self):
475 policy = self.create_qos_policy(name='test-policy',
476 description='test policy',
477 shared=False)
478 rule = self.create_qos_bandwidth_limit_rule(policy_id=policy['id'],
479 max_kbps=1,
Sławek Kapłoński153f3452017-03-24 22:04:53 +0000480 max_burst_kbps=1,
481 direction=self.direction)
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000482
Sławek Kapłoński153f3452017-03-24 22:04:53 +0000483 self.admin_client.update_bandwidth_limit_rule(
484 policy['id'],
485 rule['id'],
486 max_kbps=200,
487 max_burst_kbps=1337,
488 direction=self.opposite_direction)
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000489
490 retrieved_policy = self.admin_client.show_bandwidth_limit_rule(
491 policy['id'], rule['id'])
492 retrieved_policy = retrieved_policy['bandwidth_limit_rule']
493 self.assertEqual(200, retrieved_policy['max_kbps'])
494 self.assertEqual(1337, retrieved_policy['max_burst_kbps'])
Sławek Kapłoński153f3452017-03-24 22:04:53 +0000495 if self.opposite_direction:
496 self.assertEqual(self.opposite_direction,
497 retrieved_policy['direction'])
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000498
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000499 @decorators.idempotent_id('67ee6efd-7b33-4a68-927d-275b4f8ba958')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000500 def test_rule_delete(self):
501 policy = self.create_qos_policy(name='test-policy',
502 description='test policy',
503 shared=False)
504 rule = self.admin_client.create_bandwidth_limit_rule(
Sławek Kapłoński153f3452017-03-24 22:04:53 +0000505 policy['id'], 200, 1337, self.direction)['bandwidth_limit_rule']
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000506
507 retrieved_policy = self.admin_client.show_bandwidth_limit_rule(
508 policy['id'], rule['id'])
509 retrieved_policy = retrieved_policy['bandwidth_limit_rule']
510 self.assertEqual(rule['id'], retrieved_policy['id'])
511
512 self.admin_client.delete_bandwidth_limit_rule(policy['id'], rule['id'])
513 self.assertRaises(exceptions.NotFound,
514 self.admin_client.show_bandwidth_limit_rule,
515 policy['id'], rule['id'])
516
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000517 @decorators.idempotent_id('f211222c-5808-46cb-a961-983bbab6b852')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000518 def test_rule_create_rule_nonexistent_policy(self):
519 self.assertRaises(
520 exceptions.NotFound,
521 self.create_qos_bandwidth_limit_rule,
Sławek Kapłoński153f3452017-03-24 22:04:53 +0000522 'policy', 200, 1337, self.direction)
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000523
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000524 @decorators.idempotent_id('a4a2e7ad-786f-4927-a85a-e545a93bd274')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000525 def test_rule_create_forbidden_for_regular_tenants(self):
526 self.assertRaises(
527 exceptions.Forbidden,
528 self.client.create_bandwidth_limit_rule,
Sławek Kapłoński153f3452017-03-24 22:04:53 +0000529 'policy', 1, 2, self.direction)
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000530
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000531 @decorators.idempotent_id('1bfc55d9-6fd8-4293-ab3a-b1d69bf7cd2e')
Sławek Kapłoński0acecc62016-08-20 21:00:51 +0000532 def test_rule_update_forbidden_for_regular_tenants_own_policy(self):
533 policy = self.create_qos_policy(name='test-policy',
534 description='test policy',
535 shared=False,
536 tenant_id=self.client.tenant_id)
537 rule = self.create_qos_bandwidth_limit_rule(policy_id=policy['id'],
538 max_kbps=1,
Sławek Kapłoński153f3452017-03-24 22:04:53 +0000539 max_burst_kbps=1,
540 direction=self.direction)
Sławek Kapłoński0acecc62016-08-20 21:00:51 +0000541 self.assertRaises(
Matthew Edmondsc13d3502017-04-14 08:22:43 -0400542 exceptions.Forbidden,
Sławek Kapłoński0acecc62016-08-20 21:00:51 +0000543 self.client.update_bandwidth_limit_rule,
544 policy['id'], rule['id'], max_kbps=2, max_burst_kbps=4)
545
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000546 @decorators.idempotent_id('9a607936-4b6f-4c2f-ad21-bd5b3d4fc91f')
Sławek Kapłoński0acecc62016-08-20 21:00:51 +0000547 def test_rule_update_forbidden_for_regular_tenants_foreign_policy(self):
548 policy = self.create_qos_policy(name='test-policy',
549 description='test policy',
550 shared=False,
551 tenant_id=self.admin_client.tenant_id)
552 rule = self.create_qos_bandwidth_limit_rule(policy_id=policy['id'],
553 max_kbps=1,
Sławek Kapłoński153f3452017-03-24 22:04:53 +0000554 max_burst_kbps=1,
555 direction=self.direction)
Sławek Kapłoński0acecc62016-08-20 21:00:51 +0000556 self.assertRaises(
557 exceptions.NotFound,
558 self.client.update_bandwidth_limit_rule,
559 policy['id'], rule['id'], max_kbps=2, max_burst_kbps=4)
560
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000561 @decorators.idempotent_id('ce0bd0c2-54d9-4e29-85f1-cfb36ac3ebe2')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000562 def test_get_rules_by_policy(self):
563 policy1 = self.create_qos_policy(name='test-policy1',
564 description='test policy1',
565 shared=False)
566 rule1 = self.create_qos_bandwidth_limit_rule(policy_id=policy1['id'],
567 max_kbps=200,
Sławek Kapłoński153f3452017-03-24 22:04:53 +0000568 max_burst_kbps=1337,
569 direction=self.direction)
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000570
571 policy2 = self.create_qos_policy(name='test-policy2',
572 description='test policy2',
573 shared=False)
574 rule2 = self.create_qos_bandwidth_limit_rule(policy_id=policy2['id'],
575 max_kbps=5000,
Sławek Kapłoński153f3452017-03-24 22:04:53 +0000576 max_burst_kbps=2523,
577 direction=self.direction)
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000578
579 # Test 'list rules'
580 rules = self.admin_client.list_bandwidth_limit_rules(policy1['id'])
581 rules = rules['bandwidth_limit_rules']
582 rules_ids = [r['id'] for r in rules]
583 self.assertIn(rule1['id'], rules_ids)
584 self.assertNotIn(rule2['id'], rules_ids)
585
586
Sławek Kapłoński153f3452017-03-24 22:04:53 +0000587class QosBandwidthLimitRuleWithDirectionTestJSON(
588 QosBandwidthLimitRuleTestJSON):
589
Jakub Libosvar1982aa12017-05-30 11:15:33 +0000590 required_extensions = (
591 QosBandwidthLimitRuleTestJSON.required_extensions +
592 ['qos-bw-limit-direction']
593 )
Sławek Kapłoński153f3452017-03-24 22:04:53 +0000594 scenarios = [
595 ('ingress', {'direction': 'ingress'}),
596 ('egress', {'direction': 'egress'}),
597 ]
598
Sławek Kapłoński153f3452017-03-24 22:04:53 +0000599
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000600class RbacSharedQosPoliciesTest(base.BaseAdminNetworkTest):
601
602 force_tenant_isolation = True
603 credentials = ['primary', 'alt', 'admin']
Chandan Kumarc125fd12017-11-15 19:41:01 +0530604 required_extensions = [qos_apidef.ALIAS]
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000605
606 @classmethod
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000607 def resource_setup(cls):
608 super(RbacSharedQosPoliciesTest, cls).resource_setup()
rajat294495c042017-06-28 15:37:16 +0530609 cls.client2 = cls.os_alt.network_client
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000610
611 def _create_qos_policy(self, tenant_id=None):
612 args = {'name': data_utils.rand_name('test-policy'),
613 'description': 'test policy',
614 'shared': False,
615 'tenant_id': tenant_id}
616 qos_policy = self.admin_client.create_qos_policy(**args)['policy']
617 self.addCleanup(self.admin_client.delete_qos_policy, qos_policy['id'])
618
619 return qos_policy
620
621 def _make_admin_policy_shared_to_tenant_id(self, tenant_id):
622 policy = self._create_qos_policy()
623 rbac_policy = self.admin_client.create_rbac_policy(
624 object_type='qos_policy',
625 object_id=policy['id'],
626 action='access_as_shared',
627 target_tenant=tenant_id,
628 )['rbac_policy']
629
630 return {'policy': policy, 'rbac_policy': rbac_policy}
631
632 def _create_network(self, qos_policy_id, client, should_cleanup=True):
633 net = client.create_network(
634 name=data_utils.rand_name('test-network'),
635 qos_policy_id=qos_policy_id)['network']
636 if should_cleanup:
637 self.addCleanup(client.delete_network, net['id'])
638
639 return net
640
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000641 @decorators.idempotent_id('b9dcf582-d3b3-11e5-950a-54ee756c66df')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000642 def test_policy_sharing_with_wildcard(self):
643 qos_pol = self.create_qos_policy(
644 name=data_utils.rand_name('test-policy'),
Rodolfo Alonso Hernandez1e9d1fe2017-02-01 15:15:16 +0000645 description='test-shared-policy', shared=False,
646 tenant_id=self.admin_client.tenant_id)
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000647 self.assertNotIn(qos_pol, self.client2.list_qos_policies()['policies'])
648
649 # test update shared False -> True
650 self.admin_client.update_qos_policy(qos_pol['id'], shared=True)
651 qos_pol['shared'] = True
652 self.client2.show_qos_policy(qos_pol['id'])
653 rbac_pol = {'target_tenant': '*',
654 'tenant_id': self.admin_client.tenant_id,
Dariusz Smigielf5fb4c62016-08-19 15:41:17 +0000655 'project_id': self.admin_client.tenant_id,
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000656 'object_type': 'qos_policy',
657 'object_id': qos_pol['id'],
658 'action': 'access_as_shared'}
659
660 rbac_policies = self.admin_client.list_rbac_policies()['rbac_policies']
661 rbac_policies = [r for r in rbac_policies if r.pop('id')]
662 self.assertIn(rbac_pol, rbac_policies)
663
664 # update shared True -> False should fail because the policy is bound
665 # to a network
666 net = self._create_network(qos_pol['id'], self.admin_client, False)
667 with testtools.ExpectedException(exceptions.Conflict):
668 self.admin_client.update_qos_policy(qos_pol['id'], shared=False)
669
670 # delete the network, and update shared True -> False should pass now
671 self.admin_client.delete_network(net['id'])
672 self.admin_client.update_qos_policy(qos_pol['id'], shared=False)
673 qos_pol['shared'] = False
674 self.assertNotIn(qos_pol, self.client2.list_qos_policies()['policies'])
675
676 def _create_net_bound_qos_rbacs(self):
677 res = self._make_admin_policy_shared_to_tenant_id(
678 self.client.tenant_id)
679 qos_policy, rbac_for_client_tenant = res['policy'], res['rbac_policy']
680
681 # add a wildcard rbac rule - now the policy globally shared
682 rbac_wildcard = self.admin_client.create_rbac_policy(
683 object_type='qos_policy',
684 object_id=qos_policy['id'],
685 action='access_as_shared',
686 target_tenant='*',
687 )['rbac_policy']
688
689 # tenant1 now uses qos policy for net
690 self._create_network(qos_policy['id'], self.client)
691
692 return rbac_for_client_tenant, rbac_wildcard
693
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000694 @decorators.idempotent_id('328b1f70-d424-11e5-a57f-54ee756c66df')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000695 def test_net_bound_shared_policy_wildcard_and_tenant_id_wild_remove(self):
696 client_rbac, wildcard_rbac = self._create_net_bound_qos_rbacs()
697 # globally unshare the qos-policy, the specific share should remain
698 self.admin_client.delete_rbac_policy(wildcard_rbac['id'])
699 self.client.list_rbac_policies(id=client_rbac['id'])
700
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000701 @decorators.idempotent_id('1997b00c-0c75-4e43-8ce2-999f9fa555ee')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000702 def test_net_bound_shared_policy_wildcard_and_tenant_id_wild_remains(self):
703 client_rbac, wildcard_rbac = self._create_net_bound_qos_rbacs()
704 # remove client_rbac policy the wildcard share should remain
705 self.admin_client.delete_rbac_policy(client_rbac['id'])
706 self.client.list_rbac_policies(id=wildcard_rbac['id'])
707
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000708 @decorators.idempotent_id('2ace9adc-da6e-11e5-aafe-54ee756c66df')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000709 def test_policy_sharing_with_wildcard_and_tenant_id(self):
710 res = self._make_admin_policy_shared_to_tenant_id(
711 self.client.tenant_id)
712 qos_policy, rbac = res['policy'], res['rbac_policy']
713 qos_pol = self.client.show_qos_policy(qos_policy['id'])['policy']
714 self.assertTrue(qos_pol['shared'])
715 with testtools.ExpectedException(exceptions.NotFound):
716 self.client2.show_qos_policy(qos_policy['id'])
717
718 # make the qos-policy globally shared
719 self.admin_client.update_qos_policy(qos_policy['id'], shared=True)
720 qos_pol = self.client2.show_qos_policy(qos_policy['id'])['policy']
721 self.assertTrue(qos_pol['shared'])
722
723 # globally unshare the qos-policy, the specific share should remain
724 self.admin_client.update_qos_policy(qos_policy['id'], shared=False)
725 self.client.show_qos_policy(qos_policy['id'])
726 with testtools.ExpectedException(exceptions.NotFound):
727 self.client2.show_qos_policy(qos_policy['id'])
728 self.assertIn(rbac,
729 self.admin_client.list_rbac_policies()['rbac_policies'])
730
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000731 @decorators.idempotent_id('9f85c76a-a350-11e5-8ae5-54ee756c66df')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000732 def test_policy_target_update(self):
733 res = self._make_admin_policy_shared_to_tenant_id(
734 self.client.tenant_id)
735 # change to client2
736 update_res = self.admin_client.update_rbac_policy(
737 res['rbac_policy']['id'], target_tenant=self.client2.tenant_id)
738 self.assertEqual(self.client2.tenant_id,
739 update_res['rbac_policy']['target_tenant'])
740 # make sure everything else stayed the same
741 res['rbac_policy'].pop('target_tenant')
742 update_res['rbac_policy'].pop('target_tenant')
743 self.assertEqual(res['rbac_policy'], update_res['rbac_policy'])
744
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000745 @decorators.idempotent_id('a9b39f46-a350-11e5-97c7-54ee756c66df')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000746 def test_network_presence_prevents_policy_rbac_policy_deletion(self):
747 res = self._make_admin_policy_shared_to_tenant_id(
748 self.client2.tenant_id)
749 qos_policy_id = res['policy']['id']
750 self._create_network(qos_policy_id, self.client2)
751 # a network with shared qos-policy should prevent the deletion of an
752 # rbac-policy required for it to be shared
753 with testtools.ExpectedException(exceptions.Conflict):
754 self.admin_client.delete_rbac_policy(res['rbac_policy']['id'])
755
756 # a wildcard policy should allow the specific policy to be deleted
757 # since it allows the remaining port
758 wild = self.admin_client.create_rbac_policy(
759 object_type='qos_policy', object_id=res['policy']['id'],
760 action='access_as_shared', target_tenant='*')['rbac_policy']
761 self.admin_client.delete_rbac_policy(res['rbac_policy']['id'])
762
763 # now that wildcard is the only remaining, it should be subjected to
764 # the same restriction
765 with testtools.ExpectedException(exceptions.Conflict):
766 self.admin_client.delete_rbac_policy(wild['id'])
767
768 # we can't update the policy to a different tenant
769 with testtools.ExpectedException(exceptions.Conflict):
770 self.admin_client.update_rbac_policy(
771 wild['id'], target_tenant=self.client2.tenant_id)
772
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000773 @decorators.idempotent_id('b0fe87e8-a350-11e5-9f08-54ee756c66df')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000774 def test_regular_client_shares_to_another_regular_client(self):
775 # owned by self.admin_client
776 policy = self._create_qos_policy()
777 with testtools.ExpectedException(exceptions.NotFound):
778 self.client.show_qos_policy(policy['id'])
779 rbac_policy = self.admin_client.create_rbac_policy(
780 object_type='qos_policy', object_id=policy['id'],
781 action='access_as_shared',
782 target_tenant=self.client.tenant_id)['rbac_policy']
783 self.client.show_qos_policy(policy['id'])
784
785 self.assertIn(rbac_policy,
786 self.admin_client.list_rbac_policies()['rbac_policies'])
787 # ensure that 'client2' can't see the rbac-policy sharing the
788 # qos-policy to it because the rbac-policy belongs to 'client'
789 self.assertNotIn(rbac_policy['id'], [p['id'] for p in
790 self.client2.list_rbac_policies()['rbac_policies']])
791
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000792 @decorators.idempotent_id('ba88d0ca-a350-11e5-a06f-54ee756c66df')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000793 def test_filter_fields(self):
794 policy = self._create_qos_policy()
795 self.admin_client.create_rbac_policy(
796 object_type='qos_policy', object_id=policy['id'],
797 action='access_as_shared', target_tenant=self.client2.tenant_id)
798 field_args = (('id',), ('id', 'action'), ('object_type', 'object_id'),
799 ('tenant_id', 'target_tenant'))
800 for fields in field_args:
801 res = self.admin_client.list_rbac_policies(fields=fields)
802 self.assertEqual(set(fields), set(res['rbac_policies'][0].keys()))
803
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000804 @decorators.idempotent_id('c10d993a-a350-11e5-9c7a-54ee756c66df')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000805 def test_rbac_policy_show(self):
806 res = self._make_admin_policy_shared_to_tenant_id(
807 self.client.tenant_id)
808 p1 = res['rbac_policy']
809 p2 = self.admin_client.create_rbac_policy(
810 object_type='qos_policy', object_id=res['policy']['id'],
811 action='access_as_shared',
812 target_tenant='*')['rbac_policy']
813
814 self.assertEqual(
815 p1, self.admin_client.show_rbac_policy(p1['id'])['rbac_policy'])
816 self.assertEqual(
817 p2, self.admin_client.show_rbac_policy(p2['id'])['rbac_policy'])
818
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000819 @decorators.idempotent_id('c7496f86-a350-11e5-b380-54ee756c66df')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000820 def test_filter_rbac_policies(self):
821 policy = self._create_qos_policy()
822 rbac_pol1 = self.admin_client.create_rbac_policy(
823 object_type='qos_policy', object_id=policy['id'],
824 action='access_as_shared',
825 target_tenant=self.client2.tenant_id)['rbac_policy']
826 rbac_pol2 = self.admin_client.create_rbac_policy(
827 object_type='qos_policy', object_id=policy['id'],
828 action='access_as_shared',
829 target_tenant=self.admin_client.tenant_id)['rbac_policy']
830 res1 = self.admin_client.list_rbac_policies(id=rbac_pol1['id'])[
831 'rbac_policies']
832 res2 = self.admin_client.list_rbac_policies(id=rbac_pol2['id'])[
833 'rbac_policies']
834 self.assertEqual(1, len(res1))
835 self.assertEqual(1, len(res2))
836 self.assertEqual(rbac_pol1['id'], res1[0]['id'])
837 self.assertEqual(rbac_pol2['id'], res2[0]['id'])
838
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000839 @decorators.idempotent_id('cd7d755a-a350-11e5-a344-54ee756c66df')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000840 def test_regular_client_blocked_from_sharing_anothers_policy(self):
841 qos_policy = self._make_admin_policy_shared_to_tenant_id(
842 self.client.tenant_id)['policy']
843 with testtools.ExpectedException(exceptions.BadRequest):
844 self.client.create_rbac_policy(
845 object_type='qos_policy', object_id=qos_policy['id'],
846 action='access_as_shared',
847 target_tenant=self.client2.tenant_id)
848
849 # make sure the rbac-policy is invisible to the tenant for which it's
850 # being shared
851 self.assertFalse(self.client.list_rbac_policies()['rbac_policies'])
852
853
854class QosDscpMarkingRuleTestJSON(base.BaseAdminNetworkTest):
855 VALID_DSCP_MARK1 = 56
856 VALID_DSCP_MARK2 = 48
857
Chandan Kumarc125fd12017-11-15 19:41:01 +0530858 required_extensions = [qos_apidef.ALIAS]
Jakub Libosvar1982aa12017-05-30 11:15:33 +0000859
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000860 @classmethod
YAMAMOTO Takashi3bd3d0f2016-12-12 11:14:58 +0900861 @base.require_qos_rule_type(qos_consts.RULE_TYPE_DSCP_MARKING)
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000862 def resource_setup(cls):
863 super(QosDscpMarkingRuleTestJSON, cls).resource_setup()
864
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000865 @decorators.idempotent_id('f5cbaceb-5829-497c-9c60-ad70969e9a08')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000866 def test_rule_create(self):
867 policy = self.create_qos_policy(name='test-policy',
868 description='test policy',
869 shared=False)
870 rule = self.admin_client.create_dscp_marking_rule(
871 policy['id'], self.VALID_DSCP_MARK1)['dscp_marking_rule']
872
873 # Test 'show rule'
874 retrieved_rule = self.admin_client.show_dscp_marking_rule(
875 policy['id'], rule['id'])
876 retrieved_rule = retrieved_rule['dscp_marking_rule']
877 self.assertEqual(rule['id'], retrieved_rule['id'])
878 self.assertEqual(self.VALID_DSCP_MARK1, retrieved_rule['dscp_mark'])
879
880 # Test 'list rules'
881 rules = self.admin_client.list_dscp_marking_rules(policy['id'])
882 rules = rules['dscp_marking_rules']
883 rules_ids = [r['id'] for r in rules]
884 self.assertIn(rule['id'], rules_ids)
885
886 # Test 'show policy'
887 retrieved_policy = self.admin_client.show_qos_policy(policy['id'])
888 policy_rules = retrieved_policy['policy']['rules']
889 self.assertEqual(1, len(policy_rules))
890 self.assertEqual(rule['id'], policy_rules[0]['id'])
David Shaughnessydbf24822016-03-14 16:27:54 +0000891 self.assertEqual(qos_consts.RULE_TYPE_DSCP_MARKING,
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000892 policy_rules[0]['type'])
893
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000894 @decorators.idempotent_id('08553ffe-030f-4037-b486-7e0b8fb9385a')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000895 def test_rule_create_fail_for_the_same_type(self):
896 policy = self.create_qos_policy(name='test-policy',
897 description='test policy',
898 shared=False)
899 self.admin_client.create_dscp_marking_rule(
900 policy['id'], self.VALID_DSCP_MARK1)['dscp_marking_rule']
901
902 self.assertRaises(exceptions.Conflict,
903 self.admin_client.create_dscp_marking_rule,
904 policy_id=policy['id'],
905 dscp_mark=self.VALID_DSCP_MARK2)
906
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000907 @decorators.idempotent_id('76f632e5-3175-4408-9a32-3625e599c8a2')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000908 def test_rule_update(self):
909 policy = self.create_qos_policy(name='test-policy',
910 description='test policy',
911 shared=False)
912 rule = self.admin_client.create_dscp_marking_rule(
913 policy['id'], self.VALID_DSCP_MARK1)['dscp_marking_rule']
914
915 self.admin_client.update_dscp_marking_rule(
916 policy['id'], rule['id'], dscp_mark=self.VALID_DSCP_MARK2)
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(self.VALID_DSCP_MARK2, retrieved_policy['dscp_mark'])
922
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000923 @decorators.idempotent_id('74f81904-c35f-48a3-adae-1f5424cb3c18')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000924 def test_rule_delete(self):
925 policy = self.create_qos_policy(name='test-policy',
926 description='test policy',
927 shared=False)
928 rule = self.admin_client.create_dscp_marking_rule(
929 policy['id'], self.VALID_DSCP_MARK1)['dscp_marking_rule']
930
931 retrieved_policy = self.admin_client.show_dscp_marking_rule(
932 policy['id'], rule['id'])
933 retrieved_policy = retrieved_policy['dscp_marking_rule']
934 self.assertEqual(rule['id'], retrieved_policy['id'])
935
936 self.admin_client.delete_dscp_marking_rule(policy['id'], rule['id'])
937 self.assertRaises(exceptions.NotFound,
938 self.admin_client.show_dscp_marking_rule,
939 policy['id'], rule['id'])
940
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000941 @decorators.idempotent_id('9cb8ef5c-96fc-4978-9ee0-e3b02bab628a')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000942 def test_rule_create_rule_nonexistent_policy(self):
943 self.assertRaises(
944 exceptions.NotFound,
945 self.admin_client.create_dscp_marking_rule,
946 'policy', self.VALID_DSCP_MARK1)
947
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000948 @decorators.idempotent_id('bf6002ea-29de-486f-b65d-08aea6d4c4e2')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000949 def test_rule_create_forbidden_for_regular_tenants(self):
950 self.assertRaises(
951 exceptions.Forbidden,
952 self.client.create_dscp_marking_rule,
953 'policy', self.VALID_DSCP_MARK1)
954
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000955 @decorators.idempotent_id('33646b08-4f05-4493-a48a-bde768a18533')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000956 def test_invalid_rule_create(self):
957 policy = self.create_qos_policy(name='test-policy',
958 description='test policy',
959 shared=False)
960 self.assertRaises(
961 exceptions.BadRequest,
962 self.admin_client.create_dscp_marking_rule,
963 policy['id'], 58)
964
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000965 @decorators.idempotent_id('c565131d-4c80-4231-b0f3-9ae2be4de129')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000966 def test_get_rules_by_policy(self):
967 policy1 = self.create_qos_policy(name='test-policy1',
968 description='test policy1',
969 shared=False)
970 rule1 = self.admin_client.create_dscp_marking_rule(
971 policy1['id'], self.VALID_DSCP_MARK1)['dscp_marking_rule']
972
973 policy2 = self.create_qos_policy(name='test-policy2',
974 description='test policy2',
975 shared=False)
976 rule2 = self.admin_client.create_dscp_marking_rule(
977 policy2['id'], self.VALID_DSCP_MARK2)['dscp_marking_rule']
978
979 # Test 'list rules'
980 rules = self.admin_client.list_dscp_marking_rules(policy1['id'])
981 rules = rules['dscp_marking_rules']
982 rules_ids = [r['id'] for r in rules]
983 self.assertIn(rule1['id'], rules_ids)
984 self.assertNotIn(rule2['id'], rules_ids)
Ihar Hrachyshkab7940d92016-06-10 13:44:22 +0200985
986
Rodolfo Alonso Hernandeze4c099f2016-07-18 11:52:12 +0100987class QosMinimumBandwidthRuleTestJSON(base.BaseAdminNetworkTest):
988 DIRECTION_EGRESS = "egress"
989 DIRECTION_INGRESS = "ingress"
990 RULE_NAME = qos_consts.RULE_TYPE_MINIMUM_BANDWIDTH + "_rule"
991 RULES_NAME = RULE_NAME + "s"
Chandan Kumarc125fd12017-11-15 19:41:01 +0530992 required_extensions = [qos_apidef.ALIAS]
Rodolfo Alonso Hernandeze4c099f2016-07-18 11:52:12 +0100993
994 @classmethod
YAMAMOTO Takashi3bd3d0f2016-12-12 11:14:58 +0900995 @base.require_qos_rule_type(qos_consts.RULE_TYPE_MINIMUM_BANDWIDTH)
Rodolfo Alonso Hernandeze4c099f2016-07-18 11:52:12 +0100996 def resource_setup(cls):
997 super(QosMinimumBandwidthRuleTestJSON, cls).resource_setup()
998
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000999 @decorators.idempotent_id('aa59b00b-3e9c-4787-92f8-93a5cdf5e378')
Rodolfo Alonso Hernandeze4c099f2016-07-18 11:52:12 +01001000 def test_rule_create(self):
1001 policy = self.create_qos_policy(name='test-policy',
1002 description='test policy',
1003 shared=False)
1004 rule = self.admin_client.create_minimum_bandwidth_rule(
Ihar Hrachyshka33034bf2016-08-31 18:48:14 +00001005 policy_id=policy['id'],
1006 direction=self.DIRECTION_EGRESS,
1007 min_kbps=1138)[self.RULE_NAME]
Rodolfo Alonso Hernandeze4c099f2016-07-18 11:52:12 +01001008
1009 # Test 'show rule'
1010 retrieved_rule = self.admin_client.show_minimum_bandwidth_rule(
1011 policy['id'], rule['id'])
1012 retrieved_rule = retrieved_rule[self.RULE_NAME]
1013 self.assertEqual(rule['id'], retrieved_rule['id'])
1014 self.assertEqual(1138, retrieved_rule['min_kbps'])
1015 self.assertEqual(self.DIRECTION_EGRESS, retrieved_rule['direction'])
1016
1017 # Test 'list rules'
1018 rules = self.admin_client.list_minimum_bandwidth_rules(policy['id'])
1019 rules = rules[self.RULES_NAME]
1020 rules_ids = [r['id'] for r in rules]
1021 self.assertIn(rule['id'], rules_ids)
1022
1023 # Test 'show policy'
1024 retrieved_policy = self.admin_client.show_qos_policy(policy['id'])
1025 policy_rules = retrieved_policy['policy']['rules']
1026 self.assertEqual(1, len(policy_rules))
1027 self.assertEqual(rule['id'], policy_rules[0]['id'])
1028 self.assertEqual(qos_consts.RULE_TYPE_MINIMUM_BANDWIDTH,
1029 policy_rules[0]['type'])
1030
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +00001031 @decorators.idempotent_id('266d9b87-e51c-48bd-9aa7-8269573621be')
Ihar Hrachyshka33034bf2016-08-31 18:48:14 +00001032 def test_rule_create_fail_for_missing_min_kbps(self):
1033 policy = self.create_qos_policy(name='test-policy',
1034 description='test policy',
1035 shared=False)
1036 self.assertRaises(exceptions.BadRequest,
1037 self.admin_client.create_minimum_bandwidth_rule,
1038 policy_id=policy['id'],
1039 direction=self.DIRECTION_EGRESS)
1040
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +00001041 @decorators.idempotent_id('aa59b00b-ab01-4787-92f8-93a5cdf5e378')
Rodolfo Alonso Hernandeze4c099f2016-07-18 11:52:12 +01001042 def test_rule_create_fail_for_the_same_type(self):
1043 policy = self.create_qos_policy(name='test-policy',
1044 description='test policy',
1045 shared=False)
1046 self.admin_client.create_minimum_bandwidth_rule(
Ihar Hrachyshka33034bf2016-08-31 18:48:14 +00001047 policy_id=policy['id'],
1048 direction=self.DIRECTION_EGRESS, min_kbps=200)
Rodolfo Alonso Hernandeze4c099f2016-07-18 11:52:12 +01001049
1050 self.assertRaises(exceptions.Conflict,
1051 self.admin_client.create_minimum_bandwidth_rule,
1052 policy_id=policy['id'],
Ihar Hrachyshka33034bf2016-08-31 18:48:14 +00001053 direction=self.DIRECTION_EGRESS, min_kbps=201)
Rodolfo Alonso Hernandeze4c099f2016-07-18 11:52:12 +01001054
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +00001055 @decorators.idempotent_id('d6fce764-e511-4fa6-9f86-f4b41cf142cf')
Rodolfo Alonso Hernandeze4c099f2016-07-18 11:52:12 +01001056 def test_rule_create_fail_for_direction_ingress(self):
1057 policy = self.create_qos_policy(name='test-policy',
1058 description='test policy',
1059 shared=False)
1060 self.assertRaises(exceptions.BadRequest,
1061 self.admin_client.create_minimum_bandwidth_rule,
1062 policy_id=policy['id'],
Ihar Hrachyshka33034bf2016-08-31 18:48:14 +00001063 direction=self.DIRECTION_INGRESS,
1064 min_kbps=201)
Rodolfo Alonso Hernandeze4c099f2016-07-18 11:52:12 +01001065
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +00001066 @decorators.idempotent_id('a49a6988-2568-47d2-931e-2dbc858943b3')
Rodolfo Alonso Hernandeze4c099f2016-07-18 11:52:12 +01001067 def test_rule_update(self):
1068 policy = self.create_qos_policy(name='test-policy',
1069 description='test policy',
1070 shared=False)
1071 rule = self.admin_client.create_minimum_bandwidth_rule(
Ihar Hrachyshka33034bf2016-08-31 18:48:14 +00001072 policy_id=policy['id'],
1073 direction=self.DIRECTION_EGRESS,
1074 min_kbps=300)[self.RULE_NAME]
Rodolfo Alonso Hernandeze4c099f2016-07-18 11:52:12 +01001075
1076 self.admin_client.update_minimum_bandwidth_rule(policy['id'],
1077 rule['id'], min_kbps=350, direction=self.DIRECTION_EGRESS)
1078
1079 retrieved_policy = self.admin_client.show_minimum_bandwidth_rule(
1080 policy['id'], rule['id'])
1081 retrieved_policy = retrieved_policy[self.RULE_NAME]
1082 self.assertEqual(350, retrieved_policy['min_kbps'])
1083 self.assertEqual(self.DIRECTION_EGRESS, retrieved_policy['direction'])
1084
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +00001085 @decorators.idempotent_id('a7ee6efd-7b33-4a68-927d-275b4f8ba958')
Rodolfo Alonso Hernandeze4c099f2016-07-18 11:52:12 +01001086 def test_rule_delete(self):
1087 policy = self.create_qos_policy(name='test-policy',
1088 description='test policy',
1089 shared=False)
1090 rule = self.admin_client.create_minimum_bandwidth_rule(
Ihar Hrachyshka33034bf2016-08-31 18:48:14 +00001091 policy['id'], self.DIRECTION_EGRESS, min_kbps=200)[self.RULE_NAME]
Rodolfo Alonso Hernandeze4c099f2016-07-18 11:52:12 +01001092
1093 retrieved_policy = self.admin_client.show_minimum_bandwidth_rule(
1094 policy['id'], rule['id'])
1095 retrieved_policy = retrieved_policy[self.RULE_NAME]
1096 self.assertEqual(rule['id'], retrieved_policy['id'])
1097
1098 self.admin_client.delete_minimum_bandwidth_rule(policy['id'],
1099 rule['id'])
1100 self.assertRaises(exceptions.NotFound,
1101 self.admin_client.show_minimum_bandwidth_rule,
1102 policy['id'], rule['id'])
1103
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +00001104 @decorators.idempotent_id('a211222c-5808-46cb-a961-983bbab6b852')
Rodolfo Alonso Hernandeze4c099f2016-07-18 11:52:12 +01001105 def test_rule_create_rule_nonexistent_policy(self):
1106 self.assertRaises(
1107 exceptions.NotFound,
1108 self.admin_client.create_minimum_bandwidth_rule,
Ihar Hrachyshka33034bf2016-08-31 18:48:14 +00001109 'policy', self.DIRECTION_EGRESS, min_kbps=200)
Rodolfo Alonso Hernandeze4c099f2016-07-18 11:52:12 +01001110
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +00001111 @decorators.idempotent_id('b4a2e7ad-786f-4927-a85a-e545a93bd274')
Rodolfo Alonso Hernandeze4c099f2016-07-18 11:52:12 +01001112 def test_rule_create_forbidden_for_regular_tenants(self):
1113 self.assertRaises(
1114 exceptions.Forbidden,
1115 self.client.create_minimum_bandwidth_rule,
Ihar Hrachyshka33034bf2016-08-31 18:48:14 +00001116 'policy', self.DIRECTION_EGRESS, min_kbps=300)
Rodolfo Alonso Hernandeze4c099f2016-07-18 11:52:12 +01001117
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +00001118 @decorators.idempotent_id('de0bd0c2-54d9-4e29-85f1-cfb36ac3ebe2')
Rodolfo Alonso Hernandeze4c099f2016-07-18 11:52:12 +01001119 def test_get_rules_by_policy(self):
1120 policy1 = self.create_qos_policy(name='test-policy1',
1121 description='test policy1',
1122 shared=False)
1123 rule1 = self.admin_client.create_minimum_bandwidth_rule(
Ihar Hrachyshka33034bf2016-08-31 18:48:14 +00001124 policy_id=policy1['id'],
1125 direction=self.DIRECTION_EGRESS,
1126 min_kbps=200)[self.RULE_NAME]
Rodolfo Alonso Hernandeze4c099f2016-07-18 11:52:12 +01001127
1128 policy2 = self.create_qos_policy(name='test-policy2',
1129 description='test policy2',
1130 shared=False)
1131 rule2 = self.admin_client.create_minimum_bandwidth_rule(
Ihar Hrachyshka33034bf2016-08-31 18:48:14 +00001132 policy_id=policy2['id'],
1133 direction=self.DIRECTION_EGRESS,
1134 min_kbps=5000)[self.RULE_NAME]
Rodolfo Alonso Hernandeze4c099f2016-07-18 11:52:12 +01001135
1136 # Test 'list rules'
1137 rules = self.admin_client.list_minimum_bandwidth_rules(policy1['id'])
1138 rules = rules[self.RULES_NAME]
1139 rules_ids = [r['id'] for r in rules]
1140 self.assertIn(rule1['id'], rules_ids)
1141 self.assertNotIn(rule2['id'], rules_ids)
1142
1143
Ihar Hrachyshkab7940d92016-06-10 13:44:22 +02001144class QosSearchCriteriaTest(base.BaseSearchCriteriaTest,
1145 base.BaseAdminNetworkTest):
1146
1147 resource = 'policy'
1148 plural_name = 'policies'
1149
1150 # Use unique description to isolate the tests from other QoS tests
1151 list_kwargs = {'description': 'search-criteria-test'}
1152 list_as_admin = True
1153
Chandan Kumarc125fd12017-11-15 19:41:01 +05301154 required_extensions = [qos_apidef.ALIAS]
Jakub Libosvar1982aa12017-05-30 11:15:33 +00001155
Ihar Hrachyshkab7940d92016-06-10 13:44:22 +02001156 @classmethod
Ihar Hrachyshkab7940d92016-06-10 13:44:22 +02001157 def resource_setup(cls):
1158 super(QosSearchCriteriaTest, cls).resource_setup()
1159 for name in cls.resource_names:
1160 cls.create_qos_policy(
1161 name=name, description='search-criteria-test')
1162
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +00001163 @decorators.idempotent_id('55fc0103-fdc1-4d34-ab62-c579bb739a91')
Ihar Hrachyshkab7940d92016-06-10 13:44:22 +02001164 def test_list_sorts_asc(self):
1165 self._test_list_sorts_asc()
1166
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +00001167 @decorators.idempotent_id('13e08ac3-bfed-426b-892a-b3b158560c23')
Ihar Hrachyshkab7940d92016-06-10 13:44:22 +02001168 def test_list_sorts_desc(self):
1169 self._test_list_sorts_desc()
1170
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +00001171 @decorators.idempotent_id('719e61cc-e33c-4918-aa4d-1a791e6e0e86')
Ihar Hrachyshkab7940d92016-06-10 13:44:22 +02001172 def test_list_pagination(self):
1173 self._test_list_pagination()
1174
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +00001175 @decorators.idempotent_id('3bd8fb58-c0f8-4954-87fb-f286e1eb096a')
Ihar Hrachyshkab7940d92016-06-10 13:44:22 +02001176 def test_list_pagination_with_marker(self):
1177 self._test_list_pagination_with_marker()
1178
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +00001179 @decorators.idempotent_id('3bad0747-8082-46e9-be4d-c428a842db41')
Ihar Hrachyshkab7940d92016-06-10 13:44:22 +02001180 def test_list_pagination_with_href_links(self):
1181 self._test_list_pagination_with_href_links()
1182
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +00001183 @decorators.idempotent_id('d6a8bacd-d5e8-4ef3-bc55-23ca6998d208')
Ihar Hrachyshkab7940d92016-06-10 13:44:22 +02001184 def test_list_pagination_page_reverse_asc(self):
1185 self._test_list_pagination_page_reverse_asc()
1186
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +00001187 @decorators.idempotent_id('0b9aecdc-2b27-421b-b104-53d24e905ae8')
Ihar Hrachyshkab7940d92016-06-10 13:44:22 +02001188 def test_list_pagination_page_reverse_desc(self):
1189 self._test_list_pagination_page_reverse_desc()
1190
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +00001191 @decorators.idempotent_id('1a3dc257-dafd-4870-8c71-639ae7ddc6ea')
Ihar Hrachyshkab7940d92016-06-10 13:44:22 +02001192 def test_list_pagination_page_reverse_with_href_links(self):
1193 self._test_list_pagination_page_reverse_with_href_links()
1194
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +00001195 @decorators.idempotent_id('40e09b53-4eb8-4526-9181-d438c8005a20')
Ihar Hrachyshkab7940d92016-06-10 13:44:22 +02001196 def test_list_no_pagination_limit_0(self):
1197 self._test_list_no_pagination_limit_0()