operation_state = 'COMPLETED'
operation_details = 'Done'
- # await asyncio.sleep(15) # TODO remove. This is for test
self.logger.debug(logging_text + "Exit Ok VIM account created at RO_vim_account_id={}".format(desc["uuid"]))
return
vim_RO.pop("vim_password", None)
if RO_sdn_id:
vim_RO["config"]["sdn-controller"] = RO_sdn_id
- # TODO make a deep update of sdn-port-mapping
+ # TODO make a deep update of sdn-port-mapping
if vim_RO:
await RO.edit("vim", RO_vim_id, descriptor=vim_RO)
try:
# wait for any previous tasks in process
await self.lcm_tasks.waitfor_related_HA('vim', 'delete', op_id)
-
- db_vim = self.db.get_one("vim_accounts", {"_id": vim_id})
- if db_vim.get("_admin") and db_vim["_admin"].get("deployed") and db_vim["_admin"]["deployed"].get("RO"):
- RO_vim_id = db_vim["_admin"]["deployed"]["RO"]
- RO = ROclient.ROClient(self.loop, **self.ro_config)
- step = "Detaching vim from RO tenant"
- try:
- await RO.detach("vim_account", RO_vim_id)
- except ROclient.ROClientException as e:
- if e.http_code == 404: # not found
- self.logger.debug(logging_text + "RO_vim_id={} already detached".format(RO_vim_id))
- else:
- raise
-
- step = "Deleting vim from RO"
- try:
- await RO.delete("vim", RO_vim_id)
- except ROclient.ROClientException as e:
- if e.http_code == 404: # not found
- self.logger.debug(logging_text + "RO_vim_id={} already deleted".format(RO_vim_id))
- else:
- raise
- else:
- # nothing to delete
- self.logger.error(logging_text + "Nothing to remove at RO")
+ if not self.ro_config.get("ng"):
+ db_vim = self.db.get_one("vim_accounts", {"_id": vim_id})
+ if db_vim.get("_admin") and db_vim["_admin"].get("deployed") and db_vim["_admin"]["deployed"].get("RO"):
+ RO_vim_id = db_vim["_admin"]["deployed"]["RO"]
+ RO = ROclient.ROClient(self.loop, **self.ro_config)
+ step = "Detaching vim from RO tenant"
+ try:
+ await RO.detach("vim_account", RO_vim_id)
+ except ROclient.ROClientException as e:
+ if e.http_code == 404: # not found
+ self.logger.debug(logging_text + "RO_vim_id={} already detached".format(RO_vim_id))
+ else:
+ raise
+
+ step = "Deleting vim from RO"
+ try:
+ await RO.delete("vim", RO_vim_id)
+ except ROclient.ROClientException as e:
+ if e.http_code == 404: # not found
+ self.logger.debug(logging_text + "RO_vim_id={} already deleted".format(RO_vim_id))
+ else:
+ raise
+ else:
+ # nothing to delete
+ self.logger.debug(logging_text + "Nothing to remove at RO")
self.db.del_one("vim_accounts", {"_id": vim_id})
db_vim = None
self.logger.debug(logging_text + "Exit Ok")