return fw_policy
@classmethod
- def create_qos_policy(cls, name, description, shared):
+ def create_qos_policy(cls, name, description, shared, tenant_id=None):
"""Wrapper utility that returns a test QoS policy."""
- body = cls.admin_client.create_qos_policy(name, description, shared)
+ body = cls.admin_client.create_qos_policy(
+ name, description, shared, tenant_id)
qos_policy = body['policy']
cls.qos_policies.append(qos_policy)
return qos_policy
self.assertRaises(exceptions.ServerFault,
self.admin_client.show_bandwidth_limit_rule,
policy['id'], rule['id'])
+
+ @test.attr(type='smoke')
+ @test.idempotent_id('f211222c-5808-46cb-a961-983bbab6b852')
+ def test_rule_create_rule_nonexistent_policy(self):
+ self.assertRaises(
+ exceptions.NotFound,
+ self.create_qos_bandwidth_limit_rule,
+ 'policy', 200, 1337)
+
+ @test.attr(type='smoke')
+ @test.idempotent_id('3ba4abf9-7976-4eaf-a5d0-a934a6e09b2d')
+ def test_rule_association_nonshared_policy(self):
+ policy = self.create_qos_policy(name='test-policy',
+ description='test policy',
+ shared=False,
+ tenant_id='tenant-id')
+ self.assertRaises(
+ exceptions.NotFound,
+ self.client.create_bandwidth_limit_rule,
+ policy['id'], 200, 1337)
body = json.loads(body)
return service_client.ResponseBody(resp, body)
- def create_qos_policy(self, name, description, shared):
+ def create_qos_policy(self, name, description, shared, tenant_id=None):
uri = '%s/qos/policies' % self.uri_prefix
- post_data = self.serialize(
- {'policy': {
+ post_data = {'policy': {
'name': name,
'description': description,
'shared': shared
- }})
- resp, body = self.post(uri, post_data)
+ }}
+ if tenant_id is not None:
+ post_data['policy']['tenant_id'] = tenant_id
+ resp, body = self.post(uri, self.serialize(post_data))
body = self.deserialize_single(body)
self.expected_success(201, resp.status)
return service_client.ResponseBody(resp, body)