Add rbac_policy/subnetpool support for OS::Neutron::Quota resource

Change-Id: I1f5e28f08594d6ecdfc4b6d276f3275197189bc5
Story: 2004504
Task: 28226
This commit is contained in:
Victor Coutellier 2018-12-03 14:08:55 +01:00
parent 0b83b05115
commit 0a7f174826
3 changed files with 35 additions and 8 deletions

View File

@ -33,6 +33,8 @@ class NeutronQuota(neutron.NeutronResource):
- security_group
- router
- port
- subnetpool
- rbac_policy
Note that default neutron security policy usage of this resource
is limited to being used by administrators only. Administrators should be
@ -46,10 +48,10 @@ class NeutronQuota(neutron.NeutronResource):
PROPERTIES = (
PROJECT, SUBNET, NETWORK, FLOATINGIP, SECURITY_GROUP_RULE,
SECURITY_GROUP, ROUTER, PORT
SECURITY_GROUP, ROUTER, PORT, SUBNETPOOL, RBAC_POLICY
) = (
'project', 'subnet', 'network', 'floatingip', 'security_group_rule',
'security_group', 'router', 'port'
'security_group', 'router', 'port', 'subnetpool', 'rbac_policy'
)
properties_schema = {
@ -109,6 +111,22 @@ class NeutronQuota(neutron.NeutronResource):
'Setting -1 means unlimited.'),
constraints=[constraints.Range(min=-1)],
update_allowed=True
),
SUBNETPOOL: properties.Schema(
properties.Schema.INTEGER,
_('Quota for the number of subnet pools. '
'Setting -1 means unlimited.'),
constraints=[constraints.Range(min=-1)],
update_allowed=True,
support_status=support.SupportStatus(version='12.0.0')
),
RBAC_POLICY: properties.Schema(
properties.Schema.INTEGER,
_('Quota for the number of rbac policies. '
'Setting -1 means unlimited.'),
constraints=[constraints.Range(min=-1)],
update_allowed=True,
support_status=support.SupportStatus(version='12.0.0')
)
}

View File

@ -40,11 +40,13 @@ resources:
security_group: 5
router: 5
port: 5
subnetpool: 5
rbac_policy: 5
'''
valid_properties = [
'subnet', 'network', 'floatingip', 'security_group_rule',
'security_group', 'router', 'port'
'security_group', 'router', 'port', 'subnetpool', 'rbac_policy'
]
@ -90,8 +92,9 @@ class NeutronQuotaTest(common.HeatTestCase):
my_quota.reparse()
msg = ('At least one of the following properties must be specified: '
'floatingip, network, port, router, '
'security_group, security_group_rule, subnet.')
'floatingip, network, port, rbac_policy, router, '
'security_group, security_group_rule, subnet, '
'subnetpool.')
self.assertRaisesRegex(exception.PropertyUnspecifiedError, msg,
my_quota.validate)
@ -108,7 +111,9 @@ class NeutronQuotaTest(common.HeatTestCase):
'security_group_rule': 5,
'security_group': 5,
'router': 5,
'port': 5
'port': 5,
'subnetpool': 5,
'rbac_policy': 5
}
}
self.update_quota.assert_called_once_with(
@ -121,7 +126,7 @@ class NeutronQuotaTest(common.HeatTestCase):
tmpl_diff = mock.MagicMock()
prop_diff = mock.MagicMock()
props = {'project': 'some_project_id', 'floatingip': 1,
'security_group': 4}
'security_group': 4, 'rbac_policy': 8}
json_snippet = rsrc_defn.ResourceDefinition(
self.my_quota.name,
'OS::Neutron::Quota',
@ -131,7 +136,8 @@ class NeutronQuotaTest(common.HeatTestCase):
body = {
"quota": {
'floatingip': 1,
'security_group': 4
'security_group': 4,
'rbac_policy': 8
}
}
self.update_quota.assert_called_once_with(

View File

@ -0,0 +1,3 @@
---
features:
- Add rbac_policy and subnetpool support for OS::Neutron::Quota resource.