+ if sdn_controller:
+ sdnc = self._client.sdnc.get(sdn_controller)
+ vim_config["sdn-controller"] = sdnc["_id"]
+ if sdn_port_mapping:
+ with open(sdn_port_mapping, "r") as f:
+ vim_config["sdn-port-mapping"] = yaml.safe_load(f.read())
+ vim_account["config"] = vim_config
+ # vim_account['config'] = json.dumps(vim_config)
+ http_code, resp = self._http.patch_cmd(
+ endpoint="{}/{}".format(self._apiBase, vim["_id"]),
+ postfields_dict=vim_account,
+ )
+ # 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 = vim_id_for_wait
+ # Wait for status for VI instance update
+ self._wait(wait_id, wait)
+ # else:
+ # pass
+ # else:
+ # msg = ""
+ # if resp:
+ # try:
+ # msg = json.loads(resp)
+ # except ValueError:
+ # msg = resp
+ # raise ClientException("failed to update vim {} - {}".format(vim_name, msg))