From 7d851893951a8c0932d9e5efc179b39ee6e1b8c5 Mon Sep 17 00:00:00 2001 From: Rodolfo Alonso Hernandez Date: Fri, 3 Feb 2017 16:51:10 +0000 Subject: [PATCH] Add new parameter "is_default" to Network QoS policy. Closes-Bug: #1639220 Depends-On: If5ff2b00fa828f93aa089e275ddbd1ff542b79d4 Change-Id: Ibe7b7881cb190bfd5582f35b6de51a8bc21135de --- openstack/network/v2/qos_policy.py | 8 ++++++-- openstack/tests/functional/network/v2/test_qos_policy.py | 3 +++ openstack/tests/unit/network/v2/test_qos_policy.py | 4 +++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/openstack/network/v2/qos_policy.py b/openstack/network/v2/qos_policy.py index 68a6295e..f14de70a 100644 --- a/openstack/network/v2/qos_policy.py +++ b/openstack/network/v2/qos_policy.py @@ -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) diff --git a/openstack/tests/functional/network/v2/test_qos_policy.py b/openstack/tests/functional/network/v2/test_qos_policy.py index d9e16497..9643015b 100644 --- a/openstack/tests/functional/network/v2/test_qos_policy.py +++ b/openstack/tests/functional/network/v2/test_qos_policy.py @@ -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()] diff --git a/openstack/tests/unit/network/v2/test_qos_policy.py b/openstack/tests/unit/network/v2/test_qos_policy.py index d91633d3..7c5e6c4d 100644 --- a/openstack/tests/unit/network/v2/test_qos_policy.py +++ b/openstack/tests/unit/network/v2/test_qos_policy.py @@ -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)