diff --git a/tackerclient/tacker/v1_0/nfvo/vim.py b/tackerclient/tacker/v1_0/nfvo/vim.py index 106bedaf..59f48a0b 100644 --- a/tackerclient/tacker/v1_0/nfvo/vim.py +++ b/tackerclient/tacker/v1_0/nfvo/vim.py @@ -55,6 +55,11 @@ class CreateVIM(tackerV10.CreateCommand): parser.add_argument( '--description', help='Set a description for the VIM') + parser.add_argument( + '--is-default', + action='store_true', + default=False, + help='Set as default VIM') def args2body(self, parsed_args): body = {self.resource: {}} @@ -76,7 +81,8 @@ class CreateVIM(tackerV10.CreateCommand): vim_obj['type'] = config_param.pop('type', 'openstack') vim_utils.args2body_vim(config_param, vim_obj) tackerV10.update_dict(parsed_args, body[self.resource], - ['tenant_id', 'name', 'description']) + ['tenant_id', 'name', 'description', + 'is_default']) return body @@ -93,6 +99,11 @@ class UpdateVIM(tackerV10.UpdateCommand): group.add_argument( '--config', help='Specify VIM config parameters as a direct input') + parser.add_argument( + '--is-default', + action='store_true', + default=False, + help='Set as default VIM') def args2body(self, parsed_args): body = {self.resource: {}} @@ -110,7 +121,8 @@ class UpdateVIM(tackerV10.UpdateCommand): status_code=404) vim_obj = body[self.resource] vim_utils.args2body_vim(config_param, vim_obj) - tackerV10.update_dict(parsed_args, body[self.resource], ['tenant_id']) + tackerV10.update_dict(parsed_args, body[self.resource], + ['tenant_id', 'is_default']) return body diff --git a/tackerclient/tests/unit/vm/test_cli10_vim.py b/tackerclient/tests/unit/vm/test_cli10_vim.py index 987bc2e6..a3af7df2 100644 --- a/tackerclient/tests/unit/vm/test_cli10_vim.py +++ b/tackerclient/tests/unit/vm/test_cli10_vim.py @@ -51,7 +51,7 @@ class CLITestV10VIMJSON(test_cli10.CLITestV10Base): position_names = ['auth_cred', 'vim_project', 'auth_url'] position_values = [self.auth_cred, self.vim_project, self.auth_url] extra_body = {'type': 'openstack', 'name': name, 'description': - description} + description, 'is_default': False} self._test_create_resource(self._RESOURCE, cmd, None, my_id, args, position_names, position_values, extra_body=extra_body) @@ -67,7 +67,7 @@ class CLITestV10VIMJSON(test_cli10.CLITestV10Base): ] position_names = ['auth_cred', 'vim_project', 'auth_url'] position_values = [self.auth_cred, self.vim_project, self.auth_url] - extra_body = {'type': 'openstack'} + extra_body = {'type': 'openstack', 'is_default': False} self._test_create_resource(self._RESOURCE, cmd, None, my_id, args, position_names, position_values, extra_body=extra_body) @@ -96,7 +96,7 @@ class CLITestV10VIMJSON(test_cli10.CLITestV10Base): key = 'config' value = str(update_config) extra_fields = {'vim_project': self.vim_project, 'auth_cred': - self.auth_cred} + self.auth_cred, 'is_default': False} self._test_update_resource(self._RESOURCE, cmd, my_id, [my_id, '--%s' % key, value],