- self._apiName = '/admin'
- self._apiVersion = '/v1'
- self._apiResource = '/vim_accounts'
- self._apiBase = '{}{}{}'.format(self._apiName,
- self._apiVersion, self._apiResource)
- def create(self, name, vim_access, sdn_controller=None, sdn_port_mapping=None):
- if 'vim-type' not in vim_access:
- #'openstack' not in vim_access['vim-type']):
- raise Exception("vim type not provided")
+ self._logger = logging.getLogger("osmclient")
+ self._apiName = "/admin"
+ self._apiVersion = "/v1"
+ self._apiResource = "/vim_accounts"
+ self._apiBase = "{}{}{}".format(
+ self._apiName, self._apiVersion, self._apiResource
+ )
+
+ # VIM '--wait' option
+ def _wait(self, id, wait_time, deleteFlag=False):
+ self._logger.debug("")
+ self._client.get_token()
+ # Endpoint to get operation status
+ apiUrlStatus = "{}{}{}".format(self._apiName, self._apiVersion, "/vim_accounts")
+ # Wait for status for VIM instance creation/deletion
+ if isinstance(wait_time, bool):
+ wait_time = WaitForStatus.TIMEOUT_VIM_OPERATION
+ WaitForStatus.wait_for_status(
+ "VIM",
+ str(id),
+ wait_time,
+ apiUrlStatus,
+ self._http.get2_cmd,
+ deleteFlag=deleteFlag,
+ )
+
+ def _get_id_for_wait(self, name):
+ """Returns id of name, or the id itself if given as argument"""
+ self._logger.debug("")
+ self._client.get_token()
+ for vim in self.list():
+ if name == vim["uuid"]:
+ return vim["uuid"]
+ for vim in self.list():
+ if name == vim["name"]:
+ return vim["uuid"]
+ return ""
+
+ def create(
+ self,
+ name,
+ vim_access,
+ config={},
+ sdn_controller=None,
+ sdn_port_mapping=None,
+ wait=False,
+ ):
+ vca_id = None