X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=osmclient%2Fsol005%2Fvim.py;h=d540c638afadfcb541888f764ef1ce0cc4f566d6;hb=refs%2Fchanges%2F20%2F6120%2F1;hp=8a0b11ab5aac9ec009f927902c44286e7bb6661c;hpb=c508429478c61e528ec6f5ddd4af8a1958add122;p=osm%2Fosmclient.git diff --git a/osmclient/sol005/vim.py b/osmclient/sol005/vim.py index 8a0b11a..d540c63 100644 --- a/osmclient/sol005/vim.py +++ b/osmclient/sol005/vim.py @@ -59,13 +59,14 @@ class Vim(object): def update(self, vim_name, vim_account): vim = self.get(vim_name) - resp = self._http.put_cmd(endpoint='{}/{}'.format(self._apiBase,vim['_id']), + #resp = self._http.put_cmd(endpoint='{}/{}'.format(self._apiBase,vim['_id']), + resp = self._http.patch_cmd(endpoint='{}/{}'.format(self._apiBase,vim['_id']), postfields_dict=vim_account) - if not resp or '_id' not in resp: - raise ClientException('failed to update vim: '.format( - resp)) + #print 'RESP: {}'.format(resp) + if not resp or 'id' not in resp: + raise ClientException('failed to update vim: '.format(resp)) else: - print resp['_id'] + print resp['id'] def update_vim_account_dict(self, vim_account, vim_access): vim_account['vim_type'] = vim_access['vim-type'] @@ -88,8 +89,11 @@ class Vim(object): vim_id = vim_name if not utils.validate_uuid4(vim_name): vim_id = self.get_id(vim_name) - resp = self._http.delete_cmd('{}/{}'.format(self._apiBase,vim_id)) - if resp is None: + http_code, resp = self._http.delete_cmd('{}/{}'.format(self._apiBase,vim_id)) + #print 'RESP: {}'.format(resp) + if http_code == 202: + print 'Deletion in progress' + elif http_code == 204: print 'Deleted' else: raise ClientException("failed to delete vim {} - {}".format(vim_name, resp))