From 6fecf2adf785f1f619b87e027a3134add5e5b659 Mon Sep 17 00:00:00 2001 From: Manikantha Srinivas Tadi Date: Tue, 14 Jun 2016 11:14:18 -0400 Subject: [PATCH] Add "Description" parameter while creating VNF with CLI. Partial-Bug: #1586300 Change-Id: Ifaea2344b7f00414de743be1c035bd750e0af87b --- tackerclient/tacker/v1_0/vm/vnf.py | 6 +++- tackerclient/tests/unit/vm/test_cli10_vnf.py | 35 ++++++++++++++++++-- 2 files changed, 38 insertions(+), 3 deletions(-) diff --git a/tackerclient/tacker/v1_0/vm/vnf.py b/tackerclient/tacker/v1_0/vm/vnf.py index b7732018..7898afe5 100644 --- a/tackerclient/tacker/v1_0/vm/vnf.py +++ b/tackerclient/tacker/v1_0/vm/vnf.py @@ -45,6 +45,9 @@ class CreateVNF(tackerV10.CreateCommand): parser.add_argument( 'name', metavar='NAME', help='Set a name for the VNF') + parser.add_argument( + '--description', + help='Set description for the VNF') vnfd_group = parser.add_mutually_exclusive_group(required=True) vnfd_group.add_argument( '--vnfd-id', @@ -108,7 +111,8 @@ class CreateVNF(tackerV10.CreateCommand): param_yaml = f.read() args['attributes']['param_values'] = param_yaml tackerV10.update_dict(parsed_args, body[self.resource], - ['tenant_id', 'name', 'vnfd_id', 'vim_id']) + ['tenant_id', 'name', 'description', + 'vnfd_id', 'vim_id']) return body diff --git a/tackerclient/tests/unit/vm/test_cli10_vnf.py b/tackerclient/tests/unit/vm/test_cli10_vnf.py index 6d2025c7..5fc2712c 100644 --- a/tackerclient/tests/unit/vm/test_cli10_vnf.py +++ b/tackerclient/tests/unit/vm/test_cli10_vnf.py @@ -95,6 +95,7 @@ class CLITestV10VmVNFJSON(test_cli10.CLITestV10Base): my_id = 'my-id' vnfd_id = 'vnfd' vim_id = 'vim_id' + description = 'my-description' region_name = 'region' key = 'key' value = 'value' @@ -103,10 +104,23 @@ class CLITestV10VmVNFJSON(test_cli10.CLITestV10Base): name, '--vnfd-id', vnfd_id, '--vim-id', vim_id, + '--description', description, '--vim-region-name', region_name, '--%s' % key, value] - position_names = ['name', 'vnfd_id', 'vim_id', 'attributes'] - position_values = [name, vnfd_id, vim_id, {}] + position_names = [ + 'name', + 'vnfd_id', + 'vim_id', + 'description', + 'attributes' + ] + position_values = [ + name, + vnfd_id, + vim_id, + description, + {} + ] extra_body = {key: value, 'placement_attr': {'region_name': region_name}} self._test_create_resource(self._RESOURCE, cmd, name, my_id, @@ -127,6 +141,23 @@ class CLITestV10VmVNFJSON(test_cli10.CLITestV10Base): self._test_create_resource(self._RESOURCE, cmd, name, my_id, args, position_names, position_values) + def test_create_vnf_with_description_param(self): + cmd = vnf.CreateVNF(test_cli10.MyApp(sys.stdout), None) + name = 'my_name' + my_id = 'my-id' + vnfd_id = 'vnfd' + description = 'my-description' + args = [ + name, + '--vnfd-id', vnfd_id, + '--description', description, + ] + position_names = ['name', 'vnfd_id', 'description', + 'attributes'] + position_values = [name, vnfd_id, description, {}] + self._test_create_resource(self._RESOURCE, cmd, None, my_id, + args, position_names, position_values) + def test_list_vnfs(self): cmd = vnf.ListVNF(test_cli10.MyApp(sys.stdout), None) self._test_list_resources(self._RESOURCES, cmd, True)