Merge "Add 'shared' property for OS::Neutron::MeteringLabel"

This commit is contained in:
Jenkins
2015-01-30 23:18:14 +00:00
committed by Gerrit Code Review
2 changed files with 24 additions and 9 deletions

View File

@@ -27,15 +27,15 @@ class MeteringLabel(neutron.NeutronResource):
support_status = support.SupportStatus(version='2014.1')
PROPERTIES = (
NAME, DESCRIPTION,
NAME, DESCRIPTION, SHARED,
) = (
'name', 'description',
'name', 'description', 'shared',
)
ATTRIBUTES = (
NAME_ATTR, DESCRIPTION_ATTR,
NAME_ATTR, DESCRIPTION_ATTR, SHARED_ATTR,
) = (
'name', 'description',
'name', 'description', 'shared',
)
properties_schema = {
@@ -46,7 +46,14 @@ class MeteringLabel(neutron.NeutronResource):
DESCRIPTION: properties.Schema(
properties.Schema.STRING,
_('Description of the metering label.'),
)
),
SHARED: properties.Schema(
properties.Schema.BOOLEAN,
_('Whether the metering label should be shared '
'across all tenants.'),
default=False,
support_status=support.SupportStatus(version='2015.1'),
),
}
attributes_schema = {
@@ -56,6 +63,9 @@ class MeteringLabel(neutron.NeutronResource):
DESCRIPTION_ATTR: attributes.Schema(
_('Description of the metering label.')
),
SHARED_ATTR: attributes.Schema(
_('Shared status of the metering label.')
),
}
def handle_create(self):

View File

@@ -33,7 +33,8 @@ metering_template = '''
"Type": "OS::Neutron::MeteringLabel",
"Properties": {
"name": "TestLabel",
"description": "Description of TestLabel"
"description": "Description of TestLabel",
"shared": True,
}
},
"rule": {
@@ -69,7 +70,8 @@ class MeteringLabelTest(common.HeatTestCase):
neutronclient.Client.create_metering_label({
'metering_label': {
'name': 'TestLabel',
'description': 'Description of TestLabel'}
'description': 'Description of TestLabel',
'shared': True}
}).AndReturn({'metering_label': {'id': '1234'}})
snippet = template_format.parse(metering_template)
@@ -89,7 +91,8 @@ class MeteringLabelTest(common.HeatTestCase):
neutronclient.Client.create_metering_label({
'metering_label': {
'name': 'TestLabel',
'description': 'Description of TestLabel'}
'description': 'Description of TestLabel',
'shared': True}
}).AndRaise(exceptions.NeutronClientException())
self.m.ReplayAll()
@@ -150,12 +153,14 @@ class MeteringLabelTest(common.HeatTestCase):
).AndReturn(
{'metering_label':
{'name': 'TestLabel',
'description': 'Description of TestLabel'}})
'description': 'Description of TestLabel',
'shared': True}})
self.m.ReplayAll()
scheduler.TaskRunner(rsrc.create)()
self.assertEqual('TestLabel', rsrc.FnGetAtt('name'))
self.assertEqual('Description of TestLabel',
rsrc.FnGetAtt('description'))
self.assertEqual(True, rsrc.FnGetAtt('shared'))
self.m.VerifyAll()