Fix attr for vim update

Vim resource attr 'type' does not allow a PUT operation. Updated
the vim args to refelct typeattr for POST operation only. Also
fixed the vim name arg for vnf create command

Change-Id: I3c08945f24343288c2c5614ab4b472d68a1e1d47
This commit is contained in:
Sripriya
2016-03-22 16:26:31 -07:00
parent 28853ac0aa
commit de4aeb2736
4 changed files with 11 additions and 6 deletions

View File

@@ -28,8 +28,9 @@ class ListVIM(tackerV10.ListCommand):
"""List VIMs that belong to a given tenant."""
resource = _VIM
list_columns = ['id', 'name', 'type', 'description', 'auth_url',
'placement_attr', 'auth_cred']
list_columns = ['id', 'tenant_id', 'name', 'type', 'description',
'auth_url', 'placement_attr', 'auth_cred']
class ShowVIM(tackerV10.ShowCommand):
@@ -73,6 +74,7 @@ class CreateVIM(tackerV10.CreateCommand):
'specified',
status_code=404)
vim_obj['auth_url'] = utils.validate_url(auth_url).geturl()
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'])
@@ -103,6 +105,10 @@ class UpdateVIM(tackerV10.UpdateCommand):
if parsed_args.config:
parsed_args.config = parsed_args.config.decode('unicode_escape')
config_param = yaml.load(parsed_args.config)
if 'auth_url' in config_param:
raise exceptions.TackerClientException(message='Auth URL cannot '
'be updated',
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'])

View File

@@ -30,7 +30,6 @@ def args2body_vim(config_param, vim):
raise exceptions.TackerClientException(message='Project Id or name '
'must be specified',
status_code=404)
vim['type'] = config_param.pop('type', 'openstack')
vim['auth_cred'] = {'username': config_param.pop('username', ''),
'password': config_param.pop('password', ''),
'user_id': config_param.pop('user_id', '')}

View File

@@ -97,7 +97,7 @@ class CreateVNF(tackerV10.CreateCommand):
_id = tackerV10.find_resourceid_by_name_or_id(tacker_client,
'vim',
parsed_args.
vim_id)
vim_name)
parsed_args.vim_id = _id
if parsed_args.vnfd_name:
_id = tackerV10.find_resourceid_by_name_or_id(tacker_client,

View File

@@ -95,8 +95,8 @@ class CLITestV10VIMJSON(test_cli10.CLITestV10Base):
my_id = 'my-id'
key = 'config'
value = str(update_config)
extra_fields = {'type': 'openstack', 'vim_project':
self.vim_project, 'auth_cred': self.auth_cred}
extra_fields = {'vim_project': self.vim_project, 'auth_cred':
self.auth_cred}
self._test_update_resource(self._RESOURCE, cmd, my_id, [my_id,
'--%s' %
key, value],