Add shared parameter for metering labels

With this patch metering labels can
be set as shared so that the rules
associated with this label will be
applied to all routers for all tenants.

Partially implements
blueprint l3-metering-mgnt-ext

Change-Id: I23f9fb9cf17c7a20069616bb1c4ae19a5dc55d68
This commit is contained in:
Sylvain Afchain
2014-01-30 12:36:05 +01:00
parent 8aacb125df
commit 2dbe21382c
2 changed files with 11 additions and 4 deletions

View File

@@ -25,7 +25,7 @@ class ListMeteringLabel(neutronv20.ListCommand):
resource = 'metering_label'
log = logging.getLogger(__name__ + '.ListMeteringLabel')
list_columns = ['id', 'name', 'description']
list_columns = ['id', 'name', 'description', 'shared']
pagination_support = True
sorting_support = True
@@ -51,6 +51,10 @@ class CreateMeteringLabel(neutronv20.CreateCommand):
parser.add_argument(
'--description',
help=_('Description of metering label to create'))
parser.add_argument(
'--shared',
action='store_true',
help=_('Set the label as shared'))
def args2body(self, parsed_args):
body = {'metering_label': {
@@ -61,6 +65,9 @@ class CreateMeteringLabel(neutronv20.CreateCommand):
if parsed_args.description:
body['metering_label'].update(
{'description': parsed_args.description})
if parsed_args.shared:
body['metering_label'].update(
{'shared': True})
return body

View File

@@ -29,9 +29,9 @@ class CLITestV20MeteringJSON(test_cli20.CLITestV20Base):
name = 'my label'
myid = 'myid'
description = 'my description'
args = [name, '--description', description]
position_names = ['name', 'description']
position_values = [name, description]
args = [name, '--description', description, '--shared']
position_names = ['name', 'description', 'shared']
position_values = [name, description, True]
self._test_create_resource(resource, cmd, name, myid, args,
position_names, position_values)