blob: 4f93577ac6ed4e3097f1aa069f4c7b253e5fe397 [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)
Federico Ressi2d7db2c2018-07-06 08:11:20 +0200212 network = self.create_network('test network', shared=True,
213 qos_policy_id=policy['id'])
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000214
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)
Federico Ressi2d7db2c2018-07-06 08:11:20 +0200254 network = self.create_network('test network', shared=True)
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000255 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)
Federico Ressi2d7db2c2018-07-06 08:11:20 +0200269 network = self.create_network('test network', shared=True)
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000270 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):
Federico Ressi2d7db2c2018-07-06 08:11:20 +0200278 network = self.create_network('test network', shared=True)
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000279 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)
Federico Ressi2d7db2c2018-07-06 08:11:20 +0200290 network = self.create_network('test network', shared=True)
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000291 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)
Federico Ressi2d7db2c2018-07-06 08:11:20 +0200301 network = self.create_network('test network', shared=True)
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000302 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)
Federico Ressi2d7db2c2018-07-06 08:11:20 +0200316 self.create_network('test network', qos_policy_id=policy['id'],
317 shared=True)
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000318 self.assertRaises(
319 exceptions.Conflict,
320 self.admin_client.delete_qos_policy, policy['id'])
321
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000322 @decorators.idempotent_id('24153230-84a9-4dd5-9525-bad6d2343c75')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000323 def test_delete_not_allowed_if_policy_in_use_by_port(self):
324 policy = self.create_qos_policy(name='test-policy',
325 description='test policy',
326 shared=True)
Federico Ressi2d7db2c2018-07-06 08:11:20 +0200327 network = self.create_network('test network', shared=True)
Sławek Kapłońskie100c4d2017-08-23 21:18:34 +0000328 self.create_port(network, qos_policy_id=policy['id'])
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000329 self.assertRaises(
330 exceptions.Conflict,
331 self.admin_client.delete_qos_policy, policy['id'])
332
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000333 @decorators.idempotent_id('a2a5849b-dd06-4b18-9664-0b6828a1fc27')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000334 def test_qos_policy_delete_with_rules(self):
335 policy = self.create_qos_policy(name='test-policy',
336 description='test policy',
337 shared=False)
338 self.admin_client.create_bandwidth_limit_rule(
339 policy['id'], 200, 1337)['bandwidth_limit_rule']
340
341 self.admin_client.delete_qos_policy(policy['id'])
342
343 with testtools.ExpectedException(exceptions.NotFound):
344 self.admin_client.show_qos_policy(policy['id'])
345
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000346 @decorators.idempotent_id('fb384bde-a973-41c3-a542-6f77a092155f')
Jakub Libosvarab42ca82016-06-07 07:56:13 +0000347 def test_get_policy_that_is_shared(self):
348 policy = self.create_qos_policy(
349 name='test-policy-shared',
350 description='shared policy',
351 shared=True,
352 tenant_id=self.admin_client.tenant_id)
353 obtained_policy = self.client.show_qos_policy(policy['id'])['policy']
354 self.assertEqual(obtained_policy, policy)
355
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000356 @decorators.idempotent_id('aed8e2a6-22da-421b-89b9-935a2c1a1b50')
Rodolfo Alonso Hernandeze4c099f2016-07-18 11:52:12 +0100357 def test_policy_create_forbidden_for_regular_tenants(self):
358 self.assertRaises(
359 exceptions.Forbidden,
360 self.client.create_qos_policy,
361 'test-policy', 'test policy', False)
362
Hirofumi Ichihara39a6ee12017-08-23 13:55:12 +0900363 @decorators.idempotent_id('18d94f22-b9d5-4390-af12-d30a0cfc4cd3')
364 def test_default_policy_creating_network_without_policy(self):
Chandan Kumarc125fd12017-11-15 19:41:01 +0530365 project_id = self.create_project()['id']
Hirofumi Ichihara39a6ee12017-08-23 13:55:12 +0900366 policy = self.create_qos_policy(name='test-policy',
367 tenant_id=project_id,
368 is_default=True)
369 network = self.create_network('test network', client=self.admin_client,
370 project_id=project_id)
Hirofumi Ichihara39a6ee12017-08-23 13:55:12 +0900371 retrieved_network = self.admin_client.show_network(network['id'])
372 self.assertEqual(
373 policy['id'], retrieved_network['network']['qos_policy_id'])
374
375 @decorators.idempotent_id('807cce45-38e5-482d-94db-36e1796aba73')
376 def test_default_policy_creating_network_with_policy(self):
Chandan Kumarc125fd12017-11-15 19:41:01 +0530377 project_id = self.create_project()['id']
Hirofumi Ichihara39a6ee12017-08-23 13:55:12 +0900378 self.create_qos_policy(name='test-policy',
379 tenant_id=project_id,
380 is_default=True)
381 policy = self.create_qos_policy(name='test-policy',
382 tenant_id=project_id)
383 network = self.create_network('test network', client=self.admin_client,
384 project_id=project_id,
385 qos_policy_id=policy['id'])
Hirofumi Ichihara39a6ee12017-08-23 13:55:12 +0900386 retrieved_network = self.admin_client.show_network(network['id'])
387 self.assertEqual(
388 policy['id'], retrieved_network['network']['qos_policy_id'])
389
Sławek Kapłoński508dd292018-02-22 13:41:01 +0100390 @decorators.idempotent_id('06060880-2956-4c16-9a63-f284c3879229')
391 def test_user_create_port_with_admin_qos_policy(self):
392 qos_policy = self.create_qos_policy(
393 name='test-policy',
394 tenant_id=self.admin_client.tenant_id,
395 shared=False)
396 network = self.create_network(
397 'test network', client=self.admin_client,
398 project_id=self.client.tenant_id,
399 qos_policy_id=qos_policy['id'])
400 port = self.create_port(network)
401 self.assertEqual(network['id'], port['network_id'])
402
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000403
404class QosBandwidthLimitRuleTestJSON(base.BaseAdminNetworkTest):
Sławek Kapłoński153f3452017-03-24 22:04:53 +0000405
406 direction = None
Chandan Kumarc125fd12017-11-15 19:41:01 +0530407 required_extensions = [qos_apidef.ALIAS]
Sławek Kapłoński153f3452017-03-24 22:04:53 +0000408
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000409 @classmethod
YAMAMOTO Takashi3bd3d0f2016-12-12 11:14:58 +0900410 @base.require_qos_rule_type(qos_consts.RULE_TYPE_BANDWIDTH_LIMIT)
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000411 def resource_setup(cls):
412 super(QosBandwidthLimitRuleTestJSON, cls).resource_setup()
413
Sławek Kapłoński153f3452017-03-24 22:04:53 +0000414 @property
415 def opposite_direction(self):
416 if self.direction == "ingress":
417 return "egress"
418 elif self.direction == "egress":
419 return "ingress"
420 else:
421 return None
422
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000423 @decorators.idempotent_id('8a59b00b-3e9c-4787-92f8-93a5cdf5e378')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000424 def test_rule_create(self):
425 policy = self.create_qos_policy(name='test-policy',
426 description='test policy',
427 shared=False)
Sławek Kapłoński153f3452017-03-24 22:04:53 +0000428 rule = self.create_qos_bandwidth_limit_rule(
429 policy_id=policy['id'],
430 max_kbps=200,
431 max_burst_kbps=1337,
432 direction=self.direction)
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000433
434 # Test 'show rule'
435 retrieved_rule = self.admin_client.show_bandwidth_limit_rule(
436 policy['id'], rule['id'])
437 retrieved_rule = retrieved_rule['bandwidth_limit_rule']
438 self.assertEqual(rule['id'], retrieved_rule['id'])
439 self.assertEqual(200, retrieved_rule['max_kbps'])
440 self.assertEqual(1337, retrieved_rule['max_burst_kbps'])
Sławek Kapłoński153f3452017-03-24 22:04:53 +0000441 if self.direction:
442 self.assertEqual(self.direction, retrieved_rule['direction'])
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000443
444 # Test 'list rules'
445 rules = self.admin_client.list_bandwidth_limit_rules(policy['id'])
446 rules = rules['bandwidth_limit_rules']
447 rules_ids = [r['id'] for r in rules]
448 self.assertIn(rule['id'], rules_ids)
449
450 # Test 'show policy'
451 retrieved_policy = self.admin_client.show_qos_policy(policy['id'])
452 policy_rules = retrieved_policy['policy']['rules']
453 self.assertEqual(1, len(policy_rules))
454 self.assertEqual(rule['id'], policy_rules[0]['id'])
455 self.assertEqual(qos_consts.RULE_TYPE_BANDWIDTH_LIMIT,
456 policy_rules[0]['type'])
457
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000458 @decorators.idempotent_id('8a59b00b-ab01-4787-92f8-93a5cdf5e378')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000459 def test_rule_create_fail_for_the_same_type(self):
460 policy = self.create_qos_policy(name='test-policy',
461 description='test policy',
462 shared=False)
463 self.create_qos_bandwidth_limit_rule(policy_id=policy['id'],
464 max_kbps=200,
Sławek Kapłoński153f3452017-03-24 22:04:53 +0000465 max_burst_kbps=1337,
466 direction=self.direction)
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000467
468 self.assertRaises(exceptions.Conflict,
469 self.create_qos_bandwidth_limit_rule,
470 policy_id=policy['id'],
Sławek Kapłoński153f3452017-03-24 22:04:53 +0000471 max_kbps=201, max_burst_kbps=1338,
472 direction=self.direction)
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000473
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000474 @decorators.idempotent_id('149a6988-2568-47d2-931e-2dbc858943b3')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000475 def test_rule_update(self):
476 policy = self.create_qos_policy(name='test-policy',
477 description='test policy',
478 shared=False)
479 rule = self.create_qos_bandwidth_limit_rule(policy_id=policy['id'],
480 max_kbps=1,
Sławek Kapłoński153f3452017-03-24 22:04:53 +0000481 max_burst_kbps=1,
482 direction=self.direction)
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000483
Sławek Kapłoński153f3452017-03-24 22:04:53 +0000484 self.admin_client.update_bandwidth_limit_rule(
485 policy['id'],
486 rule['id'],
487 max_kbps=200,
488 max_burst_kbps=1337,
489 direction=self.opposite_direction)
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000490
491 retrieved_policy = self.admin_client.show_bandwidth_limit_rule(
492 policy['id'], rule['id'])
493 retrieved_policy = retrieved_policy['bandwidth_limit_rule']
494 self.assertEqual(200, retrieved_policy['max_kbps'])
495 self.assertEqual(1337, retrieved_policy['max_burst_kbps'])
Sławek Kapłoński153f3452017-03-24 22:04:53 +0000496 if self.opposite_direction:
497 self.assertEqual(self.opposite_direction,
498 retrieved_policy['direction'])
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000499
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000500 @decorators.idempotent_id('67ee6efd-7b33-4a68-927d-275b4f8ba958')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000501 def test_rule_delete(self):
502 policy = self.create_qos_policy(name='test-policy',
503 description='test policy',
504 shared=False)
505 rule = self.admin_client.create_bandwidth_limit_rule(
Sławek Kapłoński153f3452017-03-24 22:04:53 +0000506 policy['id'], 200, 1337, self.direction)['bandwidth_limit_rule']
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000507
508 retrieved_policy = self.admin_client.show_bandwidth_limit_rule(
509 policy['id'], rule['id'])
510 retrieved_policy = retrieved_policy['bandwidth_limit_rule']
511 self.assertEqual(rule['id'], retrieved_policy['id'])
512
513 self.admin_client.delete_bandwidth_limit_rule(policy['id'], rule['id'])
514 self.assertRaises(exceptions.NotFound,
515 self.admin_client.show_bandwidth_limit_rule,
516 policy['id'], rule['id'])
517
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000518 @decorators.idempotent_id('f211222c-5808-46cb-a961-983bbab6b852')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000519 def test_rule_create_rule_nonexistent_policy(self):
520 self.assertRaises(
521 exceptions.NotFound,
522 self.create_qos_bandwidth_limit_rule,
Sławek Kapłoński153f3452017-03-24 22:04:53 +0000523 'policy', 200, 1337, self.direction)
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000524
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000525 @decorators.idempotent_id('a4a2e7ad-786f-4927-a85a-e545a93bd274')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000526 def test_rule_create_forbidden_for_regular_tenants(self):
527 self.assertRaises(
528 exceptions.Forbidden,
529 self.client.create_bandwidth_limit_rule,
Sławek Kapłoński153f3452017-03-24 22:04:53 +0000530 'policy', 1, 2, self.direction)
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000531
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000532 @decorators.idempotent_id('1bfc55d9-6fd8-4293-ab3a-b1d69bf7cd2e')
Sławek Kapłoński0acecc62016-08-20 21:00:51 +0000533 def test_rule_update_forbidden_for_regular_tenants_own_policy(self):
534 policy = self.create_qos_policy(name='test-policy',
535 description='test policy',
536 shared=False,
537 tenant_id=self.client.tenant_id)
538 rule = self.create_qos_bandwidth_limit_rule(policy_id=policy['id'],
539 max_kbps=1,
Sławek Kapłoński153f3452017-03-24 22:04:53 +0000540 max_burst_kbps=1,
541 direction=self.direction)
Sławek Kapłoński0acecc62016-08-20 21:00:51 +0000542 self.assertRaises(
Matthew Edmondsc13d3502017-04-14 08:22:43 -0400543 exceptions.Forbidden,
Sławek Kapłoński0acecc62016-08-20 21:00:51 +0000544 self.client.update_bandwidth_limit_rule,
545 policy['id'], rule['id'], max_kbps=2, max_burst_kbps=4)
546
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000547 @decorators.idempotent_id('9a607936-4b6f-4c2f-ad21-bd5b3d4fc91f')
Sławek Kapłoński0acecc62016-08-20 21:00:51 +0000548 def test_rule_update_forbidden_for_regular_tenants_foreign_policy(self):
549 policy = self.create_qos_policy(name='test-policy',
550 description='test policy',
551 shared=False,
552 tenant_id=self.admin_client.tenant_id)
553 rule = self.create_qos_bandwidth_limit_rule(policy_id=policy['id'],
554 max_kbps=1,
Sławek Kapłoński153f3452017-03-24 22:04:53 +0000555 max_burst_kbps=1,
556 direction=self.direction)
Sławek Kapłoński0acecc62016-08-20 21:00:51 +0000557 self.assertRaises(
558 exceptions.NotFound,
559 self.client.update_bandwidth_limit_rule,
560 policy['id'], rule['id'], max_kbps=2, max_burst_kbps=4)
561
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000562 @decorators.idempotent_id('ce0bd0c2-54d9-4e29-85f1-cfb36ac3ebe2')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000563 def test_get_rules_by_policy(self):
564 policy1 = self.create_qos_policy(name='test-policy1',
565 description='test policy1',
566 shared=False)
567 rule1 = self.create_qos_bandwidth_limit_rule(policy_id=policy1['id'],
568 max_kbps=200,
Sławek Kapłoński153f3452017-03-24 22:04:53 +0000569 max_burst_kbps=1337,
570 direction=self.direction)
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000571
572 policy2 = self.create_qos_policy(name='test-policy2',
573 description='test policy2',
574 shared=False)
575 rule2 = self.create_qos_bandwidth_limit_rule(policy_id=policy2['id'],
576 max_kbps=5000,
Sławek Kapłoński153f3452017-03-24 22:04:53 +0000577 max_burst_kbps=2523,
578 direction=self.direction)
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000579
580 # Test 'list rules'
581 rules = self.admin_client.list_bandwidth_limit_rules(policy1['id'])
582 rules = rules['bandwidth_limit_rules']
583 rules_ids = [r['id'] for r in rules]
584 self.assertIn(rule1['id'], rules_ids)
585 self.assertNotIn(rule2['id'], rules_ids)
586
587
Sławek Kapłoński153f3452017-03-24 22:04:53 +0000588class QosBandwidthLimitRuleWithDirectionTestJSON(
Brian Haley6767cec2018-04-10 15:30:23 -0400589 QosBandwidthLimitRuleTestJSON):
Sławek Kapłoński153f3452017-03-24 22:04:53 +0000590
Jakub Libosvar1982aa12017-05-30 11:15:33 +0000591 required_extensions = (
592 QosBandwidthLimitRuleTestJSON.required_extensions +
593 ['qos-bw-limit-direction']
594 )
Sławek Kapłoński153f3452017-03-24 22:04:53 +0000595 scenarios = [
596 ('ingress', {'direction': 'ingress'}),
597 ('egress', {'direction': 'egress'}),
598 ]
599
Sławek Kapłoński153f3452017-03-24 22:04:53 +0000600
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000601class RbacSharedQosPoliciesTest(base.BaseAdminNetworkTest):
602
603 force_tenant_isolation = True
604 credentials = ['primary', 'alt', 'admin']
Chandan Kumarc125fd12017-11-15 19:41:01 +0530605 required_extensions = [qos_apidef.ALIAS]
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000606
607 @classmethod
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000608 def resource_setup(cls):
609 super(RbacSharedQosPoliciesTest, cls).resource_setup()
rajat294495c042017-06-28 15:37:16 +0530610 cls.client2 = cls.os_alt.network_client
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000611
612 def _create_qos_policy(self, tenant_id=None):
613 args = {'name': data_utils.rand_name('test-policy'),
614 'description': 'test policy',
615 'shared': False,
616 'tenant_id': tenant_id}
617 qos_policy = self.admin_client.create_qos_policy(**args)['policy']
618 self.addCleanup(self.admin_client.delete_qos_policy, qos_policy['id'])
619
620 return qos_policy
621
622 def _make_admin_policy_shared_to_tenant_id(self, tenant_id):
623 policy = self._create_qos_policy()
624 rbac_policy = self.admin_client.create_rbac_policy(
625 object_type='qos_policy',
626 object_id=policy['id'],
627 action='access_as_shared',
628 target_tenant=tenant_id,
629 )['rbac_policy']
630
631 return {'policy': policy, 'rbac_policy': rbac_policy}
632
633 def _create_network(self, qos_policy_id, client, should_cleanup=True):
634 net = client.create_network(
635 name=data_utils.rand_name('test-network'),
636 qos_policy_id=qos_policy_id)['network']
637 if should_cleanup:
638 self.addCleanup(client.delete_network, net['id'])
639
640 return net
641
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000642 @decorators.idempotent_id('b9dcf582-d3b3-11e5-950a-54ee756c66df')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000643 def test_policy_sharing_with_wildcard(self):
644 qos_pol = self.create_qos_policy(
645 name=data_utils.rand_name('test-policy'),
Rodolfo Alonso Hernandez1e9d1fe2017-02-01 15:15:16 +0000646 description='test-shared-policy', shared=False,
647 tenant_id=self.admin_client.tenant_id)
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000648 self.assertNotIn(qos_pol, self.client2.list_qos_policies()['policies'])
649
650 # test update shared False -> True
651 self.admin_client.update_qos_policy(qos_pol['id'], shared=True)
652 qos_pol['shared'] = True
653 self.client2.show_qos_policy(qos_pol['id'])
654 rbac_pol = {'target_tenant': '*',
655 'tenant_id': self.admin_client.tenant_id,
Dariusz Smigielf5fb4c62016-08-19 15:41:17 +0000656 'project_id': self.admin_client.tenant_id,
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000657 'object_type': 'qos_policy',
658 'object_id': qos_pol['id'],
659 'action': 'access_as_shared'}
660
661 rbac_policies = self.admin_client.list_rbac_policies()['rbac_policies']
662 rbac_policies = [r for r in rbac_policies if r.pop('id')]
663 self.assertIn(rbac_pol, rbac_policies)
664
665 # update shared True -> False should fail because the policy is bound
666 # to a network
667 net = self._create_network(qos_pol['id'], self.admin_client, False)
668 with testtools.ExpectedException(exceptions.Conflict):
669 self.admin_client.update_qos_policy(qos_pol['id'], shared=False)
670
671 # delete the network, and update shared True -> False should pass now
672 self.admin_client.delete_network(net['id'])
673 self.admin_client.update_qos_policy(qos_pol['id'], shared=False)
674 qos_pol['shared'] = False
675 self.assertNotIn(qos_pol, self.client2.list_qos_policies()['policies'])
676
677 def _create_net_bound_qos_rbacs(self):
678 res = self._make_admin_policy_shared_to_tenant_id(
679 self.client.tenant_id)
680 qos_policy, rbac_for_client_tenant = res['policy'], res['rbac_policy']
681
682 # add a wildcard rbac rule - now the policy globally shared
683 rbac_wildcard = self.admin_client.create_rbac_policy(
684 object_type='qos_policy',
685 object_id=qos_policy['id'],
686 action='access_as_shared',
687 target_tenant='*',
688 )['rbac_policy']
689
690 # tenant1 now uses qos policy for net
691 self._create_network(qos_policy['id'], self.client)
692
693 return rbac_for_client_tenant, rbac_wildcard
694
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000695 @decorators.idempotent_id('328b1f70-d424-11e5-a57f-54ee756c66df')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000696 def test_net_bound_shared_policy_wildcard_and_tenant_id_wild_remove(self):
697 client_rbac, wildcard_rbac = self._create_net_bound_qos_rbacs()
698 # globally unshare the qos-policy, the specific share should remain
699 self.admin_client.delete_rbac_policy(wildcard_rbac['id'])
700 self.client.list_rbac_policies(id=client_rbac['id'])
701
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000702 @decorators.idempotent_id('1997b00c-0c75-4e43-8ce2-999f9fa555ee')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000703 def test_net_bound_shared_policy_wildcard_and_tenant_id_wild_remains(self):
704 client_rbac, wildcard_rbac = self._create_net_bound_qos_rbacs()
705 # remove client_rbac policy the wildcard share should remain
706 self.admin_client.delete_rbac_policy(client_rbac['id'])
707 self.client.list_rbac_policies(id=wildcard_rbac['id'])
708
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000709 @decorators.idempotent_id('2ace9adc-da6e-11e5-aafe-54ee756c66df')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000710 def test_policy_sharing_with_wildcard_and_tenant_id(self):
711 res = self._make_admin_policy_shared_to_tenant_id(
712 self.client.tenant_id)
713 qos_policy, rbac = res['policy'], res['rbac_policy']
714 qos_pol = self.client.show_qos_policy(qos_policy['id'])['policy']
715 self.assertTrue(qos_pol['shared'])
716 with testtools.ExpectedException(exceptions.NotFound):
717 self.client2.show_qos_policy(qos_policy['id'])
718
719 # make the qos-policy globally shared
720 self.admin_client.update_qos_policy(qos_policy['id'], shared=True)
721 qos_pol = self.client2.show_qos_policy(qos_policy['id'])['policy']
722 self.assertTrue(qos_pol['shared'])
723
724 # globally unshare the qos-policy, the specific share should remain
725 self.admin_client.update_qos_policy(qos_policy['id'], shared=False)
726 self.client.show_qos_policy(qos_policy['id'])
727 with testtools.ExpectedException(exceptions.NotFound):
728 self.client2.show_qos_policy(qos_policy['id'])
729 self.assertIn(rbac,
730 self.admin_client.list_rbac_policies()['rbac_policies'])
731
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000732 @decorators.idempotent_id('9f85c76a-a350-11e5-8ae5-54ee756c66df')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000733 def test_policy_target_update(self):
734 res = self._make_admin_policy_shared_to_tenant_id(
735 self.client.tenant_id)
736 # change to client2
737 update_res = self.admin_client.update_rbac_policy(
738 res['rbac_policy']['id'], target_tenant=self.client2.tenant_id)
739 self.assertEqual(self.client2.tenant_id,
740 update_res['rbac_policy']['target_tenant'])
741 # make sure everything else stayed the same
742 res['rbac_policy'].pop('target_tenant')
743 update_res['rbac_policy'].pop('target_tenant')
744 self.assertEqual(res['rbac_policy'], update_res['rbac_policy'])
745
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000746 @decorators.idempotent_id('a9b39f46-a350-11e5-97c7-54ee756c66df')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000747 def test_network_presence_prevents_policy_rbac_policy_deletion(self):
748 res = self._make_admin_policy_shared_to_tenant_id(
749 self.client2.tenant_id)
750 qos_policy_id = res['policy']['id']
751 self._create_network(qos_policy_id, self.client2)
752 # a network with shared qos-policy should prevent the deletion of an
753 # rbac-policy required for it to be shared
754 with testtools.ExpectedException(exceptions.Conflict):
755 self.admin_client.delete_rbac_policy(res['rbac_policy']['id'])
756
757 # a wildcard policy should allow the specific policy to be deleted
758 # since it allows the remaining port
759 wild = self.admin_client.create_rbac_policy(
760 object_type='qos_policy', object_id=res['policy']['id'],
761 action='access_as_shared', target_tenant='*')['rbac_policy']
762 self.admin_client.delete_rbac_policy(res['rbac_policy']['id'])
763
764 # now that wildcard is the only remaining, it should be subjected to
765 # the same restriction
766 with testtools.ExpectedException(exceptions.Conflict):
767 self.admin_client.delete_rbac_policy(wild['id'])
768
769 # we can't update the policy to a different tenant
770 with testtools.ExpectedException(exceptions.Conflict):
771 self.admin_client.update_rbac_policy(
772 wild['id'], target_tenant=self.client2.tenant_id)
773
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000774 @decorators.idempotent_id('b0fe87e8-a350-11e5-9f08-54ee756c66df')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000775 def test_regular_client_shares_to_another_regular_client(self):
776 # owned by self.admin_client
777 policy = self._create_qos_policy()
778 with testtools.ExpectedException(exceptions.NotFound):
779 self.client.show_qos_policy(policy['id'])
780 rbac_policy = self.admin_client.create_rbac_policy(
781 object_type='qos_policy', object_id=policy['id'],
782 action='access_as_shared',
783 target_tenant=self.client.tenant_id)['rbac_policy']
784 self.client.show_qos_policy(policy['id'])
785
786 self.assertIn(rbac_policy,
787 self.admin_client.list_rbac_policies()['rbac_policies'])
788 # ensure that 'client2' can't see the rbac-policy sharing the
789 # qos-policy to it because the rbac-policy belongs to 'client'
790 self.assertNotIn(rbac_policy['id'], [p['id'] for p in
791 self.client2.list_rbac_policies()['rbac_policies']])
792
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000793 @decorators.idempotent_id('ba88d0ca-a350-11e5-a06f-54ee756c66df')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000794 def test_filter_fields(self):
795 policy = self._create_qos_policy()
796 self.admin_client.create_rbac_policy(
797 object_type='qos_policy', object_id=policy['id'],
798 action='access_as_shared', target_tenant=self.client2.tenant_id)
799 field_args = (('id',), ('id', 'action'), ('object_type', 'object_id'),
800 ('tenant_id', 'target_tenant'))
801 for fields in field_args:
802 res = self.admin_client.list_rbac_policies(fields=fields)
803 self.assertEqual(set(fields), set(res['rbac_policies'][0].keys()))
804
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000805 @decorators.idempotent_id('c10d993a-a350-11e5-9c7a-54ee756c66df')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000806 def test_rbac_policy_show(self):
807 res = self._make_admin_policy_shared_to_tenant_id(
808 self.client.tenant_id)
809 p1 = res['rbac_policy']
810 p2 = self.admin_client.create_rbac_policy(
811 object_type='qos_policy', object_id=res['policy']['id'],
812 action='access_as_shared',
813 target_tenant='*')['rbac_policy']
814
815 self.assertEqual(
816 p1, self.admin_client.show_rbac_policy(p1['id'])['rbac_policy'])
817 self.assertEqual(
818 p2, self.admin_client.show_rbac_policy(p2['id'])['rbac_policy'])
819
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000820 @decorators.idempotent_id('c7496f86-a350-11e5-b380-54ee756c66df')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000821 def test_filter_rbac_policies(self):
822 policy = self._create_qos_policy()
823 rbac_pol1 = self.admin_client.create_rbac_policy(
824 object_type='qos_policy', object_id=policy['id'],
825 action='access_as_shared',
826 target_tenant=self.client2.tenant_id)['rbac_policy']
827 rbac_pol2 = self.admin_client.create_rbac_policy(
828 object_type='qos_policy', object_id=policy['id'],
829 action='access_as_shared',
830 target_tenant=self.admin_client.tenant_id)['rbac_policy']
831 res1 = self.admin_client.list_rbac_policies(id=rbac_pol1['id'])[
832 'rbac_policies']
833 res2 = self.admin_client.list_rbac_policies(id=rbac_pol2['id'])[
834 'rbac_policies']
835 self.assertEqual(1, len(res1))
836 self.assertEqual(1, len(res2))
837 self.assertEqual(rbac_pol1['id'], res1[0]['id'])
838 self.assertEqual(rbac_pol2['id'], res2[0]['id'])
839
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000840 @decorators.idempotent_id('cd7d755a-a350-11e5-a344-54ee756c66df')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000841 def test_regular_client_blocked_from_sharing_anothers_policy(self):
842 qos_policy = self._make_admin_policy_shared_to_tenant_id(
843 self.client.tenant_id)['policy']
844 with testtools.ExpectedException(exceptions.BadRequest):
845 self.client.create_rbac_policy(
846 object_type='qos_policy', object_id=qos_policy['id'],
847 action='access_as_shared',
848 target_tenant=self.client2.tenant_id)
849
850 # make sure the rbac-policy is invisible to the tenant for which it's
851 # being shared
852 self.assertFalse(self.client.list_rbac_policies()['rbac_policies'])
853
854
855class QosDscpMarkingRuleTestJSON(base.BaseAdminNetworkTest):
856 VALID_DSCP_MARK1 = 56
857 VALID_DSCP_MARK2 = 48
858
Chandan Kumarc125fd12017-11-15 19:41:01 +0530859 required_extensions = [qos_apidef.ALIAS]
Jakub Libosvar1982aa12017-05-30 11:15:33 +0000860
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000861 @classmethod
YAMAMOTO Takashi3bd3d0f2016-12-12 11:14:58 +0900862 @base.require_qos_rule_type(qos_consts.RULE_TYPE_DSCP_MARKING)
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000863 def resource_setup(cls):
864 super(QosDscpMarkingRuleTestJSON, cls).resource_setup()
865
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000866 @decorators.idempotent_id('f5cbaceb-5829-497c-9c60-ad70969e9a08')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000867 def test_rule_create(self):
868 policy = self.create_qos_policy(name='test-policy',
869 description='test policy',
870 shared=False)
871 rule = self.admin_client.create_dscp_marking_rule(
872 policy['id'], self.VALID_DSCP_MARK1)['dscp_marking_rule']
873
874 # Test 'show rule'
875 retrieved_rule = self.admin_client.show_dscp_marking_rule(
876 policy['id'], rule['id'])
877 retrieved_rule = retrieved_rule['dscp_marking_rule']
878 self.assertEqual(rule['id'], retrieved_rule['id'])
879 self.assertEqual(self.VALID_DSCP_MARK1, retrieved_rule['dscp_mark'])
880
881 # Test 'list rules'
882 rules = self.admin_client.list_dscp_marking_rules(policy['id'])
883 rules = rules['dscp_marking_rules']
884 rules_ids = [r['id'] for r in rules]
885 self.assertIn(rule['id'], rules_ids)
886
887 # Test 'show policy'
888 retrieved_policy = self.admin_client.show_qos_policy(policy['id'])
889 policy_rules = retrieved_policy['policy']['rules']
890 self.assertEqual(1, len(policy_rules))
891 self.assertEqual(rule['id'], policy_rules[0]['id'])
David Shaughnessydbf24822016-03-14 16:27:54 +0000892 self.assertEqual(qos_consts.RULE_TYPE_DSCP_MARKING,
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000893 policy_rules[0]['type'])
894
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000895 @decorators.idempotent_id('08553ffe-030f-4037-b486-7e0b8fb9385a')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000896 def test_rule_create_fail_for_the_same_type(self):
897 policy = self.create_qos_policy(name='test-policy',
898 description='test policy',
899 shared=False)
900 self.admin_client.create_dscp_marking_rule(
901 policy['id'], self.VALID_DSCP_MARK1)['dscp_marking_rule']
902
903 self.assertRaises(exceptions.Conflict,
904 self.admin_client.create_dscp_marking_rule,
905 policy_id=policy['id'],
906 dscp_mark=self.VALID_DSCP_MARK2)
907
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000908 @decorators.idempotent_id('76f632e5-3175-4408-9a32-3625e599c8a2')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000909 def test_rule_update(self):
910 policy = self.create_qos_policy(name='test-policy',
911 description='test policy',
912 shared=False)
913 rule = self.admin_client.create_dscp_marking_rule(
914 policy['id'], self.VALID_DSCP_MARK1)['dscp_marking_rule']
915
916 self.admin_client.update_dscp_marking_rule(
917 policy['id'], rule['id'], dscp_mark=self.VALID_DSCP_MARK2)
918
919 retrieved_policy = self.admin_client.show_dscp_marking_rule(
920 policy['id'], rule['id'])
921 retrieved_policy = retrieved_policy['dscp_marking_rule']
922 self.assertEqual(self.VALID_DSCP_MARK2, retrieved_policy['dscp_mark'])
923
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000924 @decorators.idempotent_id('74f81904-c35f-48a3-adae-1f5424cb3c18')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000925 def test_rule_delete(self):
926 policy = self.create_qos_policy(name='test-policy',
927 description='test policy',
928 shared=False)
929 rule = self.admin_client.create_dscp_marking_rule(
930 policy['id'], self.VALID_DSCP_MARK1)['dscp_marking_rule']
931
932 retrieved_policy = self.admin_client.show_dscp_marking_rule(
933 policy['id'], rule['id'])
934 retrieved_policy = retrieved_policy['dscp_marking_rule']
935 self.assertEqual(rule['id'], retrieved_policy['id'])
936
937 self.admin_client.delete_dscp_marking_rule(policy['id'], rule['id'])
938 self.assertRaises(exceptions.NotFound,
939 self.admin_client.show_dscp_marking_rule,
940 policy['id'], rule['id'])
941
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000942 @decorators.idempotent_id('9cb8ef5c-96fc-4978-9ee0-e3b02bab628a')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000943 def test_rule_create_rule_nonexistent_policy(self):
944 self.assertRaises(
945 exceptions.NotFound,
946 self.admin_client.create_dscp_marking_rule,
947 'policy', self.VALID_DSCP_MARK1)
948
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000949 @decorators.idempotent_id('bf6002ea-29de-486f-b65d-08aea6d4c4e2')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000950 def test_rule_create_forbidden_for_regular_tenants(self):
951 self.assertRaises(
952 exceptions.Forbidden,
953 self.client.create_dscp_marking_rule,
954 'policy', self.VALID_DSCP_MARK1)
955
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000956 @decorators.idempotent_id('33646b08-4f05-4493-a48a-bde768a18533')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000957 def test_invalid_rule_create(self):
958 policy = self.create_qos_policy(name='test-policy',
959 description='test policy',
960 shared=False)
961 self.assertRaises(
962 exceptions.BadRequest,
963 self.admin_client.create_dscp_marking_rule,
964 policy['id'], 58)
965
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000966 @decorators.idempotent_id('c565131d-4c80-4231-b0f3-9ae2be4de129')
Daniel Mellado3c0aeab2016-01-29 11:30:25 +0000967 def test_get_rules_by_policy(self):
968 policy1 = self.create_qos_policy(name='test-policy1',
969 description='test policy1',
970 shared=False)
971 rule1 = self.admin_client.create_dscp_marking_rule(
972 policy1['id'], self.VALID_DSCP_MARK1)['dscp_marking_rule']
973
974 policy2 = self.create_qos_policy(name='test-policy2',
975 description='test policy2',
976 shared=False)
977 rule2 = self.admin_client.create_dscp_marking_rule(
978 policy2['id'], self.VALID_DSCP_MARK2)['dscp_marking_rule']
979
980 # Test 'list rules'
981 rules = self.admin_client.list_dscp_marking_rules(policy1['id'])
982 rules = rules['dscp_marking_rules']
983 rules_ids = [r['id'] for r in rules]
984 self.assertIn(rule1['id'], rules_ids)
985 self.assertNotIn(rule2['id'], rules_ids)
Ihar Hrachyshkab7940d92016-06-10 13:44:22 +0200986
987
Rodolfo Alonso Hernandeze4c099f2016-07-18 11:52:12 +0100988class QosMinimumBandwidthRuleTestJSON(base.BaseAdminNetworkTest):
989 DIRECTION_EGRESS = "egress"
990 DIRECTION_INGRESS = "ingress"
991 RULE_NAME = qos_consts.RULE_TYPE_MINIMUM_BANDWIDTH + "_rule"
992 RULES_NAME = RULE_NAME + "s"
Chandan Kumarc125fd12017-11-15 19:41:01 +0530993 required_extensions = [qos_apidef.ALIAS]
Rodolfo Alonso Hernandeze4c099f2016-07-18 11:52:12 +0100994
995 @classmethod
YAMAMOTO Takashi3bd3d0f2016-12-12 11:14:58 +0900996 @base.require_qos_rule_type(qos_consts.RULE_TYPE_MINIMUM_BANDWIDTH)
Rodolfo Alonso Hernandeze4c099f2016-07-18 11:52:12 +0100997 def resource_setup(cls):
998 super(QosMinimumBandwidthRuleTestJSON, cls).resource_setup()
999
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +00001000 @decorators.idempotent_id('aa59b00b-3e9c-4787-92f8-93a5cdf5e378')
Rodolfo Alonso Hernandeze4c099f2016-07-18 11:52:12 +01001001 def test_rule_create(self):
1002 policy = self.create_qos_policy(name='test-policy',
1003 description='test policy',
1004 shared=False)
1005 rule = self.admin_client.create_minimum_bandwidth_rule(
Ihar Hrachyshka33034bf2016-08-31 18:48:14 +00001006 policy_id=policy['id'],
1007 direction=self.DIRECTION_EGRESS,
1008 min_kbps=1138)[self.RULE_NAME]
Rodolfo Alonso Hernandeze4c099f2016-07-18 11:52:12 +01001009
1010 # Test 'show rule'
1011 retrieved_rule = self.admin_client.show_minimum_bandwidth_rule(
1012 policy['id'], rule['id'])
1013 retrieved_rule = retrieved_rule[self.RULE_NAME]
1014 self.assertEqual(rule['id'], retrieved_rule['id'])
1015 self.assertEqual(1138, retrieved_rule['min_kbps'])
1016 self.assertEqual(self.DIRECTION_EGRESS, retrieved_rule['direction'])
1017
1018 # Test 'list rules'
1019 rules = self.admin_client.list_minimum_bandwidth_rules(policy['id'])
1020 rules = rules[self.RULES_NAME]
1021 rules_ids = [r['id'] for r in rules]
1022 self.assertIn(rule['id'], rules_ids)
1023
1024 # Test 'show policy'
1025 retrieved_policy = self.admin_client.show_qos_policy(policy['id'])
1026 policy_rules = retrieved_policy['policy']['rules']
1027 self.assertEqual(1, len(policy_rules))
1028 self.assertEqual(rule['id'], policy_rules[0]['id'])
1029 self.assertEqual(qos_consts.RULE_TYPE_MINIMUM_BANDWIDTH,
1030 policy_rules[0]['type'])
1031
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +00001032 @decorators.idempotent_id('266d9b87-e51c-48bd-9aa7-8269573621be')
Ihar Hrachyshka33034bf2016-08-31 18:48:14 +00001033 def test_rule_create_fail_for_missing_min_kbps(self):
1034 policy = self.create_qos_policy(name='test-policy',
1035 description='test policy',
1036 shared=False)
1037 self.assertRaises(exceptions.BadRequest,
1038 self.admin_client.create_minimum_bandwidth_rule,
1039 policy_id=policy['id'],
1040 direction=self.DIRECTION_EGRESS)
1041
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +00001042 @decorators.idempotent_id('aa59b00b-ab01-4787-92f8-93a5cdf5e378')
Rodolfo Alonso Hernandeze4c099f2016-07-18 11:52:12 +01001043 def test_rule_create_fail_for_the_same_type(self):
1044 policy = self.create_qos_policy(name='test-policy',
1045 description='test policy',
1046 shared=False)
1047 self.admin_client.create_minimum_bandwidth_rule(
Ihar Hrachyshka33034bf2016-08-31 18:48:14 +00001048 policy_id=policy['id'],
1049 direction=self.DIRECTION_EGRESS, min_kbps=200)
Rodolfo Alonso Hernandeze4c099f2016-07-18 11:52:12 +01001050
1051 self.assertRaises(exceptions.Conflict,
1052 self.admin_client.create_minimum_bandwidth_rule,
1053 policy_id=policy['id'],
Ihar Hrachyshka33034bf2016-08-31 18:48:14 +00001054 direction=self.DIRECTION_EGRESS, min_kbps=201)
Rodolfo Alonso Hernandeze4c099f2016-07-18 11:52:12 +01001055
Lajos Katonadc9c6d62018-08-27 16:08:51 +02001056 @decorators.idempotent_id('35baf998-ae65-495c-9902-35a0d11e8936')
1057 @utils.requires_ext(extension="qos-bw-minimum-ingress",
1058 service="network")
1059 def test_rule_create_pass_for_direction_ingress(self):
1060 policy = self.create_qos_policy(name='test-policy',
1061 description='test policy',
1062 shared=False)
1063 self.admin_client.create_minimum_bandwidth_rule(
1064 policy_id=policy['id'],
1065 direction=self.DIRECTION_INGRESS,
1066 min_kbps=201)
1067
1068 retrieved_policy = self.admin_client.show_qos_policy(policy['id'])
1069 policy_rules = retrieved_policy['policy']['rules']
1070 self.assertEqual(1, len(policy_rules))
1071 self.assertEqual(qos_consts.RULE_TYPE_MINIMUM_BANDWIDTH,
1072 policy_rules[0]['type'])
1073 self.assertEqual(self.DIRECTION_INGRESS, policy_rules[0]['direction'])
1074
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +00001075 @decorators.idempotent_id('a49a6988-2568-47d2-931e-2dbc858943b3')
Rodolfo Alonso Hernandeze4c099f2016-07-18 11:52:12 +01001076 def test_rule_update(self):
1077 policy = self.create_qos_policy(name='test-policy',
1078 description='test policy',
1079 shared=False)
1080 rule = self.admin_client.create_minimum_bandwidth_rule(
Ihar Hrachyshka33034bf2016-08-31 18:48:14 +00001081 policy_id=policy['id'],
1082 direction=self.DIRECTION_EGRESS,
1083 min_kbps=300)[self.RULE_NAME]
Rodolfo Alonso Hernandeze4c099f2016-07-18 11:52:12 +01001084
1085 self.admin_client.update_minimum_bandwidth_rule(policy['id'],
1086 rule['id'], min_kbps=350, direction=self.DIRECTION_EGRESS)
1087
1088 retrieved_policy = self.admin_client.show_minimum_bandwidth_rule(
1089 policy['id'], rule['id'])
1090 retrieved_policy = retrieved_policy[self.RULE_NAME]
1091 self.assertEqual(350, retrieved_policy['min_kbps'])
1092 self.assertEqual(self.DIRECTION_EGRESS, retrieved_policy['direction'])
1093
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +00001094 @decorators.idempotent_id('a7ee6efd-7b33-4a68-927d-275b4f8ba958')
Rodolfo Alonso Hernandeze4c099f2016-07-18 11:52:12 +01001095 def test_rule_delete(self):
1096 policy = self.create_qos_policy(name='test-policy',
1097 description='test policy',
1098 shared=False)
1099 rule = self.admin_client.create_minimum_bandwidth_rule(
Ihar Hrachyshka33034bf2016-08-31 18:48:14 +00001100 policy['id'], self.DIRECTION_EGRESS, min_kbps=200)[self.RULE_NAME]
Rodolfo Alonso Hernandeze4c099f2016-07-18 11:52:12 +01001101
1102 retrieved_policy = self.admin_client.show_minimum_bandwidth_rule(
1103 policy['id'], rule['id'])
1104 retrieved_policy = retrieved_policy[self.RULE_NAME]
1105 self.assertEqual(rule['id'], retrieved_policy['id'])
1106
1107 self.admin_client.delete_minimum_bandwidth_rule(policy['id'],
1108 rule['id'])
1109 self.assertRaises(exceptions.NotFound,
1110 self.admin_client.show_minimum_bandwidth_rule,
1111 policy['id'], rule['id'])
1112
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +00001113 @decorators.idempotent_id('a211222c-5808-46cb-a961-983bbab6b852')
Rodolfo Alonso Hernandeze4c099f2016-07-18 11:52:12 +01001114 def test_rule_create_rule_nonexistent_policy(self):
1115 self.assertRaises(
1116 exceptions.NotFound,
1117 self.admin_client.create_minimum_bandwidth_rule,
Ihar Hrachyshka33034bf2016-08-31 18:48:14 +00001118 'policy', self.DIRECTION_EGRESS, min_kbps=200)
Rodolfo Alonso Hernandeze4c099f2016-07-18 11:52:12 +01001119
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +00001120 @decorators.idempotent_id('b4a2e7ad-786f-4927-a85a-e545a93bd274')
Rodolfo Alonso Hernandeze4c099f2016-07-18 11:52:12 +01001121 def test_rule_create_forbidden_for_regular_tenants(self):
1122 self.assertRaises(
1123 exceptions.Forbidden,
1124 self.client.create_minimum_bandwidth_rule,
Ihar Hrachyshka33034bf2016-08-31 18:48:14 +00001125 'policy', self.DIRECTION_EGRESS, min_kbps=300)
Rodolfo Alonso Hernandeze4c099f2016-07-18 11:52:12 +01001126
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +00001127 @decorators.idempotent_id('de0bd0c2-54d9-4e29-85f1-cfb36ac3ebe2')
Rodolfo Alonso Hernandeze4c099f2016-07-18 11:52:12 +01001128 def test_get_rules_by_policy(self):
1129 policy1 = self.create_qos_policy(name='test-policy1',
1130 description='test policy1',
1131 shared=False)
1132 rule1 = self.admin_client.create_minimum_bandwidth_rule(
Ihar Hrachyshka33034bf2016-08-31 18:48:14 +00001133 policy_id=policy1['id'],
1134 direction=self.DIRECTION_EGRESS,
1135 min_kbps=200)[self.RULE_NAME]
Rodolfo Alonso Hernandeze4c099f2016-07-18 11:52:12 +01001136
1137 policy2 = self.create_qos_policy(name='test-policy2',
1138 description='test policy2',
1139 shared=False)
1140 rule2 = self.admin_client.create_minimum_bandwidth_rule(
Ihar Hrachyshka33034bf2016-08-31 18:48:14 +00001141 policy_id=policy2['id'],
1142 direction=self.DIRECTION_EGRESS,
1143 min_kbps=5000)[self.RULE_NAME]
Rodolfo Alonso Hernandeze4c099f2016-07-18 11:52:12 +01001144
1145 # Test 'list rules'
1146 rules = self.admin_client.list_minimum_bandwidth_rules(policy1['id'])
1147 rules = rules[self.RULES_NAME]
1148 rules_ids = [r['id'] for r in rules]
1149 self.assertIn(rule1['id'], rules_ids)
1150 self.assertNotIn(rule2['id'], rules_ids)
1151
1152
Ihar Hrachyshkab7940d92016-06-10 13:44:22 +02001153class QosSearchCriteriaTest(base.BaseSearchCriteriaTest,
1154 base.BaseAdminNetworkTest):
1155
1156 resource = 'policy'
1157 plural_name = 'policies'
1158
1159 # Use unique description to isolate the tests from other QoS tests
1160 list_kwargs = {'description': 'search-criteria-test'}
1161 list_as_admin = True
1162
Chandan Kumarc125fd12017-11-15 19:41:01 +05301163 required_extensions = [qos_apidef.ALIAS]
Jakub Libosvar1982aa12017-05-30 11:15:33 +00001164
Ihar Hrachyshkab7940d92016-06-10 13:44:22 +02001165 @classmethod
Ihar Hrachyshkab7940d92016-06-10 13:44:22 +02001166 def resource_setup(cls):
1167 super(QosSearchCriteriaTest, cls).resource_setup()
1168 for name in cls.resource_names:
1169 cls.create_qos_policy(
1170 name=name, description='search-criteria-test')
1171
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +00001172 @decorators.idempotent_id('55fc0103-fdc1-4d34-ab62-c579bb739a91')
Ihar Hrachyshkab7940d92016-06-10 13:44:22 +02001173 def test_list_sorts_asc(self):
1174 self._test_list_sorts_asc()
1175
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +00001176 @decorators.idempotent_id('13e08ac3-bfed-426b-892a-b3b158560c23')
Ihar Hrachyshkab7940d92016-06-10 13:44:22 +02001177 def test_list_sorts_desc(self):
1178 self._test_list_sorts_desc()
1179
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +00001180 @decorators.idempotent_id('719e61cc-e33c-4918-aa4d-1a791e6e0e86')
Ihar Hrachyshkab7940d92016-06-10 13:44:22 +02001181 def test_list_pagination(self):
1182 self._test_list_pagination()
1183
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +00001184 @decorators.idempotent_id('3bd8fb58-c0f8-4954-87fb-f286e1eb096a')
Ihar Hrachyshkab7940d92016-06-10 13:44:22 +02001185 def test_list_pagination_with_marker(self):
1186 self._test_list_pagination_with_marker()
1187
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +00001188 @decorators.idempotent_id('3bad0747-8082-46e9-be4d-c428a842db41')
Ihar Hrachyshkab7940d92016-06-10 13:44:22 +02001189 def test_list_pagination_with_href_links(self):
1190 self._test_list_pagination_with_href_links()
1191
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +00001192 @decorators.idempotent_id('d6a8bacd-d5e8-4ef3-bc55-23ca6998d208')
Ihar Hrachyshkab7940d92016-06-10 13:44:22 +02001193 def test_list_pagination_page_reverse_asc(self):
1194 self._test_list_pagination_page_reverse_asc()
1195
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +00001196 @decorators.idempotent_id('0b9aecdc-2b27-421b-b104-53d24e905ae8')
Ihar Hrachyshkab7940d92016-06-10 13:44:22 +02001197 def test_list_pagination_page_reverse_desc(self):
1198 self._test_list_pagination_page_reverse_desc()
1199
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +00001200 @decorators.idempotent_id('1a3dc257-dafd-4870-8c71-639ae7ddc6ea')
Ihar Hrachyshkab7940d92016-06-10 13:44:22 +02001201 def test_list_pagination_page_reverse_with_href_links(self):
1202 self._test_list_pagination_page_reverse_with_href_links()
1203
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +00001204 @decorators.idempotent_id('40e09b53-4eb8-4526-9181-d438c8005a20')
Ihar Hrachyshkab7940d92016-06-10 13:44:22 +02001205 def test_list_no_pagination_limit_0(self):
1206 self._test_list_no_pagination_limit_0()