Merge "Transition default VIM to API and DB operation"

This commit is contained in:
Jenkins 2016-07-25 18:05:44 +00:00 committed by Gerrit Code Review
commit e88619e985
2 changed files with 17 additions and 5 deletions

View File

@ -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

View File

@ -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],