Add CLI support for new inject_default_route attr
Implements blueprint inject-default-route Change-Id: I3cecca2e778017a8b13de15a82028a9147a303b5
This commit is contained in:
parent
ab1adfc70d
commit
6a51342287
@ -301,7 +301,8 @@ class ListL2Policy(neutronV20.ListCommand):
|
|||||||
resource = 'l2_policy'
|
resource = 'l2_policy'
|
||||||
log = logging.getLogger(__name__ + '.ListL2Policy')
|
log = logging.getLogger(__name__ + '.ListL2Policy')
|
||||||
_formatters = {}
|
_formatters = {}
|
||||||
list_columns = ['id', 'name', 'description', 'l3_policy_id', 'network_id']
|
list_columns = ['id', 'name', 'description', 'l3_policy_id', 'network_id',
|
||||||
|
'inject_default_route']
|
||||||
pagination_support = True
|
pagination_support = True
|
||||||
sorting_support = True
|
sorting_support = True
|
||||||
|
|
||||||
@ -335,6 +336,10 @@ class CreateL2Policy(neutronV20.CreateCommand):
|
|||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'name', metavar='NAME',
|
'name', metavar='NAME',
|
||||||
help=_('Name of L2 Policy to create (required argument)'))
|
help=_('Name of L2 Policy to create (required argument)'))
|
||||||
|
n_utils.add_boolean_argument(
|
||||||
|
parser, '--inject-default-route', dest='inject_default_route',
|
||||||
|
help=_('Enable or disable injecting default route, '
|
||||||
|
'default is True'))
|
||||||
n_utils.add_boolean_argument(
|
n_utils.add_boolean_argument(
|
||||||
parser, '--shared', dest='shared',
|
parser, '--shared', dest='shared',
|
||||||
help=_('Enable or disable resource sharing, default is False'))
|
help=_('Enable or disable resource sharing, default is False'))
|
||||||
@ -343,7 +348,8 @@ class CreateL2Policy(neutronV20.CreateCommand):
|
|||||||
body = {self.resource: {}, }
|
body = {self.resource: {}, }
|
||||||
|
|
||||||
neutronV20.update_dict(parsed_args, body[self.resource],
|
neutronV20.update_dict(parsed_args, body[self.resource],
|
||||||
['name', 'tenant_id', 'description', 'shared'])
|
['name', 'tenant_id', 'description', 'shared',
|
||||||
|
'inject_default_route'])
|
||||||
if parsed_args.l3_policy:
|
if parsed_args.l3_policy:
|
||||||
body[self.resource]['l3_policy_id'] = \
|
body[self.resource]['l3_policy_id'] = \
|
||||||
neutronV20.find_resourceid_by_name_or_id(
|
neutronV20.find_resourceid_by_name_or_id(
|
||||||
@ -380,6 +386,9 @@ class UpdateL2Policy(neutronV20.UpdateCommand):
|
|||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--name',
|
'--name',
|
||||||
help=_('New name of the L2 Policy'))
|
help=_('New name of the L2 Policy'))
|
||||||
|
n_utils.add_boolean_argument(
|
||||||
|
parser, '--inject-default-route', dest='inject_default_route',
|
||||||
|
help=_('Enable or disable injecting of default route'))
|
||||||
n_utils.add_boolean_argument(
|
n_utils.add_boolean_argument(
|
||||||
parser, '--shared', dest='shared',
|
parser, '--shared', dest='shared',
|
||||||
help=_('Enable or disable resource sharing'))
|
help=_('Enable or disable resource sharing'))
|
||||||
@ -388,7 +397,8 @@ class UpdateL2Policy(neutronV20.UpdateCommand):
|
|||||||
body = {self.resource: {}, }
|
body = {self.resource: {}, }
|
||||||
|
|
||||||
neutronV20.update_dict(parsed_args, body[self.resource],
|
neutronV20.update_dict(parsed_args, body[self.resource],
|
||||||
['name', 'tenant_id', 'description', 'shared'])
|
['name', 'tenant_id', 'description', 'shared',
|
||||||
|
'inject_default_route'])
|
||||||
if parsed_args.l3_policy:
|
if parsed_args.l3_policy:
|
||||||
body[self.resource]['l3_policy_id'] = \
|
body[self.resource]['l3_policy_id'] = \
|
||||||
neutronV20.find_resourceid_by_name_or_id(
|
neutronV20.find_resourceid_by_name_or_id(
|
||||||
|
@ -48,17 +48,20 @@ class CLITestV20L2PolicyJSON(test_cli20.CLITestV20Base):
|
|||||||
name = 'my-name'
|
name = 'my-name'
|
||||||
description = 'l2p description'
|
description = 'l2p description'
|
||||||
l3_policy_id = 'l3p'
|
l3_policy_id = 'l3p'
|
||||||
|
inject_default_route = 'false'
|
||||||
shared = 'true'
|
shared = 'true'
|
||||||
args = [name,
|
args = [name,
|
||||||
'--tenant-id', tenant_id,
|
'--tenant-id', tenant_id,
|
||||||
'--description', description,
|
'--description', description,
|
||||||
'--l3-policy-id', l3_policy_id,
|
'--l3-policy-id', l3_policy_id,
|
||||||
|
'--inject-default-route', inject_default_route,
|
||||||
'--shared', shared]
|
'--shared', shared]
|
||||||
position_names = ['name', 'description', 'l3_policy_id']
|
position_names = ['name', 'description', 'l3_policy_id']
|
||||||
position_values = [name, description, l3_policy_id]
|
position_values = [name, description, l3_policy_id]
|
||||||
self._test_create_resource(resource, cmd, name, my_id, args,
|
self._test_create_resource(resource, cmd, name, my_id, args,
|
||||||
position_names, position_values,
|
position_names, position_values,
|
||||||
tenant_id=tenant_id, shared=shared)
|
tenant_id=tenant_id, shared=shared,
|
||||||
|
inject_default_route=inject_default_route)
|
||||||
|
|
||||||
def test_list_l2_policies(self):
|
def test_list_l2_policies(self):
|
||||||
resource = 'l2_policies'
|
resource = 'l2_policies'
|
||||||
@ -87,16 +90,19 @@ class CLITestV20L2PolicyJSON(test_cli20.CLITestV20Base):
|
|||||||
name = 'l2policy'
|
name = 'l2policy'
|
||||||
description = 'l2policy description'
|
description = 'l2policy description'
|
||||||
l3_policy_id = 'l3p'
|
l3_policy_id = 'l3p'
|
||||||
|
inject_default_route = 'false'
|
||||||
shared = 'true'
|
shared = 'true'
|
||||||
args = [my_id,
|
args = [my_id,
|
||||||
'--name', name,
|
'--name', name,
|
||||||
'--description', description,
|
'--description', description,
|
||||||
'--l3-policy-id', l3_policy_id,
|
'--l3-policy-id', l3_policy_id,
|
||||||
|
'--inject-default-route', inject_default_route,
|
||||||
'--shared', shared]
|
'--shared', shared]
|
||||||
params = {
|
params = {
|
||||||
'name': name,
|
'name': name,
|
||||||
'description': description,
|
'description': description,
|
||||||
'l3_policy_id': l3_policy_id,
|
'l3_policy_id': l3_policy_id,
|
||||||
|
'inject_default_route': inject_default_route,
|
||||||
'shared': shared
|
'shared': shared
|
||||||
}
|
}
|
||||||
self._test_update_resource(resource, cmd, my_id, args, params)
|
self._test_update_resource(resource, cmd, my_id, args, params)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user