+ if wait:
+ # Wait for status for SDNC instance creation
+ self._wait(resp.get('id'))
+ print(resp['id'])
+ #else:
+ # msg = ""
+ # if resp:
+ # try:
+ # msg = json.loads(resp)
+ # except ValueError:
+ # msg = resp
+ # raise ClientException("failed to create SDN controller {} - {}".format(name, msg))
+
+ def update(self, name, sdn_controller, wait=False):
+ self._logger.debug("")
+ self._client.get_token()
+ sdnc = self.get(name)
+ sdnc_id_for_wait = self._get_id_for_wait(name)
+ http_code, resp = self._http.patch_cmd(endpoint='{}/{}'.format(self._apiBase,sdnc['_id']),
+ postfields_dict=sdn_controller)
+ # print('HTTP CODE: {}'.format(http_code))
+ # print('RESP: {}'.format(resp))
+ #if http_code in (200, 201, 202, 204):
+ if wait:
+ # In this case, 'resp' always returns None, so 'resp['id']' cannot be used.
+ # Use the previously obtained id instead.
+ wait_id = sdnc_id_for_wait
+ # Wait for status for VI instance update
+ self._wait(wait_id)
+ # else:
+ # pass
+ #else:
+ # msg = ""
+ # if resp:
+ # try:
+ # msg = json.loads(resp)
+ # except ValueError:
+ # msg = resp
+ # raise ClientException("failed to update SDN controller {} - {}".format(name, msg))