Transition default VIM to API and DB operation
Set the default-vim in the tacker-db and provide API to manage it. Change-Id: Ie447f13c1d30e3cf5c1756c424fe60882082c211 Partial-Bug: 1592957
This commit is contained in:
parent
3c6f82dfaf
commit
00d87bde7e
tackerclient
@ -60,6 +60,11 @@ class CreateVIM(tackerV10.CreateCommand):
|
|||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--description',
|
'--description',
|
||||||
help='Set a description for the VIM')
|
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):
|
def args2body(self, parsed_args):
|
||||||
body = {self.resource: {}}
|
body = {self.resource: {}}
|
||||||
@ -81,7 +86,8 @@ class CreateVIM(tackerV10.CreateCommand):
|
|||||||
vim_obj['type'] = config_param.pop('type', 'openstack')
|
vim_obj['type'] = config_param.pop('type', 'openstack')
|
||||||
vim_utils.args2body_vim(config_param, vim_obj)
|
vim_utils.args2body_vim(config_param, vim_obj)
|
||||||
tackerV10.update_dict(parsed_args, body[self.resource],
|
tackerV10.update_dict(parsed_args, body[self.resource],
|
||||||
['tenant_id', 'name', 'description'])
|
['tenant_id', 'name', 'description',
|
||||||
|
'is_default'])
|
||||||
return body
|
return body
|
||||||
|
|
||||||
|
|
||||||
@ -98,6 +104,11 @@ class UpdateVIM(tackerV10.UpdateCommand):
|
|||||||
group.add_argument(
|
group.add_argument(
|
||||||
'--config',
|
'--config',
|
||||||
help='Specify VIM config parameters as a direct input')
|
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):
|
def args2body(self, parsed_args):
|
||||||
body = {self.resource: {}}
|
body = {self.resource: {}}
|
||||||
@ -115,7 +126,8 @@ class UpdateVIM(tackerV10.UpdateCommand):
|
|||||||
status_code=404)
|
status_code=404)
|
||||||
vim_obj = body[self.resource]
|
vim_obj = body[self.resource]
|
||||||
vim_utils.args2body_vim(config_param, vim_obj)
|
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
|
return body
|
||||||
|
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ class CLITestV10VIMJSON(test_cli10.CLITestV10Base):
|
|||||||
position_names = ['auth_cred', 'vim_project', 'auth_url']
|
position_names = ['auth_cred', 'vim_project', 'auth_url']
|
||||||
position_values = [self.auth_cred, self.vim_project, self.auth_url]
|
position_values = [self.auth_cred, self.vim_project, self.auth_url]
|
||||||
extra_body = {'type': 'openstack', 'name': name, 'description':
|
extra_body = {'type': 'openstack', 'name': name, 'description':
|
||||||
description}
|
description, 'is_default': False}
|
||||||
self._test_create_resource(self._RESOURCE, cmd, None, my_id,
|
self._test_create_resource(self._RESOURCE, cmd, None, my_id,
|
||||||
args, position_names, position_values,
|
args, position_names, position_values,
|
||||||
extra_body=extra_body)
|
extra_body=extra_body)
|
||||||
@ -69,7 +69,7 @@ class CLITestV10VIMJSON(test_cli10.CLITestV10Base):
|
|||||||
]
|
]
|
||||||
position_names = ['auth_cred', 'vim_project', 'auth_url']
|
position_names = ['auth_cred', 'vim_project', 'auth_url']
|
||||||
position_values = [self.auth_cred, self.vim_project, self.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,
|
self._test_create_resource(self._RESOURCE, cmd, None, my_id, args,
|
||||||
position_names, position_values,
|
position_names, position_values,
|
||||||
extra_body=extra_body)
|
extra_body=extra_body)
|
||||||
@ -131,7 +131,7 @@ class CLITestV10VIMJSON(test_cli10.CLITestV10Base):
|
|||||||
key = 'config'
|
key = 'config'
|
||||||
value = str(update_config)
|
value = str(update_config)
|
||||||
extra_fields = {'vim_project': self.vim_project, 'auth_cred':
|
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,
|
self._test_update_resource(self._RESOURCE, cmd, my_id, [my_id,
|
||||||
'--%s' %
|
'--%s' %
|
||||||
key, value],
|
key, value],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user