Add new parameter "is_default" to Network QoS policy.

Closes-Bug: #1639220
Depends-On: If5ff2b00fa828f93aa089e275ddbd1ff542b79d4
Change-Id: Ibe7b7881cb190bfd5582f35b6de51a8bc21135de
This commit is contained in:
Rodolfo Alonso Hernandez 2017-02-03 16:51:10 +00:00
parent bc4a0c4066
commit 7d85189395
3 changed files with 12 additions and 3 deletions

View File

@ -28,9 +28,9 @@ class QoSPolicy(resource.Resource):
allow_list = True
_query_mapping = resource.QueryParameters(
'name', 'description',
'name', 'description', 'is_default',
project_id='tenant_id',
is_shared='shared'
is_shared='shared',
)
# Properties
@ -41,6 +41,10 @@ class QoSPolicy(resource.Resource):
project_id = resource.Body('tenant_id')
#: The QoS policy description.
description = resource.Body('description')
#: Indicates whether this QoS policy is the default policy for this
#: project.
#: *Type: bool*
is_default = resource.Body('is_default', type=bool)
#: Indicates whether this QoS policy is shared across all projects.
#: *Type: bool*
is_shared = resource.Body('shared', type=bool)

View File

@ -22,6 +22,7 @@ class TestQoSPolicy(base.BaseFunctionalTest):
QOS_POLICY_NAME = uuid.uuid4().hex
QOS_POLICY_NAME_UPDATED = uuid.uuid4().hex
IS_SHARED = False
IS_DEFAULT = False
RULES = []
QOS_POLICY_DESCRIPTION = "QoS policy description"
@ -32,6 +33,7 @@ class TestQoSPolicy(base.BaseFunctionalTest):
description=cls.QOS_POLICY_DESCRIPTION,
name=cls.QOS_POLICY_NAME,
shared=cls.IS_SHARED,
is_default=cls.IS_DEFAULT,
)
assert isinstance(qos, _qos_policy.QoSPolicy)
cls.assertIs(cls.QOS_POLICY_NAME, qos.name)
@ -52,6 +54,7 @@ class TestQoSPolicy(base.BaseFunctionalTest):
self.assertEqual(self.IS_SHARED, sot.is_shared)
self.assertEqual(self.RULES, sot.rules)
self.assertEqual(self.QOS_POLICY_DESCRIPTION, sot.description)
self.assertEqual(self.IS_DEFAULT, sot.is_default)
def test_list(self):
names = [o.name for o in self.conn.network.qos_policies()]

View File

@ -21,7 +21,8 @@ EXAMPLE = {
'name': 'qos-policy-name',
'shared': True,
'tenant_id': '2',
'rules': [uuid.uuid4().hex]
'rules': [uuid.uuid4().hex],
'is_default': False
}
@ -47,3 +48,4 @@ class TestQoSPolicy(testtools.TestCase):
self.assertTrue(sot.is_shared)
self.assertEqual(EXAMPLE['tenant_id'], sot.project_id)
self.assertEqual(EXAMPLE['rules'], sot.rules)
self.assertEqual(EXAMPLE['is_default'], sot.is_default)