[Apic-mapping] Reuse BD option for L2 Policy CLI
Partial-bug: 1642784 Change-Id: I51247322143eecc9d6ef035bccbd79e0ba529e07 Signed-off-by: Amit Bose <amitbose@gmail.com>
This commit is contained in:
parent
42bbf31cc7
commit
43d49d0601
@ -393,6 +393,11 @@ class CreateL2Policy(neutronV20.CreateCommand):
|
||||
n_utils.add_boolean_argument(
|
||||
parser, '--shared', dest='shared',
|
||||
help=_('Enable or disable resource sharing, default is False'))
|
||||
parser.add_argument(
|
||||
'--reuse-bd',
|
||||
default=None,
|
||||
help=_('Name or UUID of L2 Policy whose BridgeDomain should '
|
||||
'be reused (APIC only)'))
|
||||
|
||||
def args2body(self, parsed_args):
|
||||
body = {self.resource: {}, }
|
||||
@ -408,7 +413,11 @@ class CreateL2Policy(neutronV20.CreateCommand):
|
||||
if parsed_args.network:
|
||||
body[self.resource]['network_id'] = (
|
||||
parsed_args.network)
|
||||
|
||||
if parsed_args.reuse_bd:
|
||||
body[self.resource]['reuse_bd'] = \
|
||||
neutronV20.find_resourceid_by_name_or_id(
|
||||
self.get_client(), 'l2_policy',
|
||||
parsed_args.reuse_bd)
|
||||
return body
|
||||
|
||||
|
||||
|
@ -63,6 +63,23 @@ class CLITestV20L2PolicyJSON(test_cli20.CLITestV20Base):
|
||||
tenant_id=tenant_id, shared=shared,
|
||||
inject_default_route=inject_default_route)
|
||||
|
||||
def test_create_l2_policy_with_reuse_bd(self):
|
||||
"""l2-policy-create with reuse_bd option."""
|
||||
resource = 'l2_policy'
|
||||
cmd = gbp.CreateL2Policy(test_cli20.MyApp(sys.stdout), None)
|
||||
my_id = 'my-id'
|
||||
tenant_id = 'my-tenant'
|
||||
name = 'my-name'
|
||||
target_l2p = 'another-l2p'
|
||||
args = [name,
|
||||
'--tenant-id', tenant_id,
|
||||
'--reuse-bd', target_l2p]
|
||||
position_names = ['name', 'reuse_bd']
|
||||
position_values = [name, target_l2p]
|
||||
self._test_create_resource(resource, cmd, name, my_id, args,
|
||||
position_names, position_values,
|
||||
tenant_id=tenant_id)
|
||||
|
||||
def test_list_l2_policies(self):
|
||||
resource = 'l2_policies'
|
||||
cmd = gbp.ListL2Policy(test_cli20.MyApp(sys.stdout), None)
|
||||
|
Loading…
x
Reference in New Issue
Block a user