X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=NG-RO%2Fosm_ng_ro%2Fns_thread.py;h=d2b00d65beaa9a262b91542ef07eee49d7518ac6;hb=bf3e9a819a7c0153fa58b5140d1898147740977a;hp=7656a5448511c7eb28633cfd1227039a943786b8;hpb=1ac189e7d842e8aa09133b769097e8703ec1352c;p=osm%2FRO.git diff --git a/NG-RO/osm_ng_ro/ns_thread.py b/NG-RO/osm_ng_ro/ns_thread.py index 7656a544..d2b00d65 100644 --- a/NG-RO/osm_ng_ro/ns_thread.py +++ b/NG-RO/osm_ng_ro/ns_thread.py @@ -504,8 +504,10 @@ class VimInteractionVdu(VimInteractionBase): vim_info_info = yaml.safe_load(vim_info["vim_info"]) if vim_info_info.get("name"): vim_info["name"] = vim_info_info["name"] - except Exception: - pass + except Exception as vim_info_error: + self.logger.exception( + f"{vim_info_error} occured while getting the vim_info from yaml" + ) except vimconn.VimConnException as e: # Mark all tasks at VIM_ERROR status self.logger.error( @@ -746,7 +748,7 @@ class VimInteractionFlavor(VimInteractionBase): flavor_data = task["find_params"]["flavor_data"] vim_flavor_id = target_vim.get_flavor_id_from_data(flavor_data) except vimconn.VimConnNotFoundException: - pass + self.logger.warning("VimConnNotFoundException occured.") if not vim_flavor_id and task.get("params"): # CREATE @@ -1053,11 +1055,15 @@ class VimInteractionSdnNet(VimInteractionBase): try: # CREATE params = task["params"] - vlds_to_connect = params["vlds"] - associated_vim = params["target_vim"] + vlds_to_connect = params.get("vlds", []) + associated_vim = params.get("target_vim") # external additional ports additional_ports = params.get("sdn-ports") or () - _, _, vim_account_id = associated_vim.partition(":") + _, _, vim_account_id = ( + (None, None, None) + if associated_vim is None + else associated_vim.partition(":") + ) if associated_vim: # get associated VIM @@ -1600,7 +1606,9 @@ class NsWorker(threading.Thread): try: mkdir(file_name) except FileExistsError: - pass + self.logger.exception( + "FileExistsError occured while processing vim_config." + ) file_name = file_name + "/ca_cert" @@ -1653,7 +1661,8 @@ class NsWorker(threading.Thread): self.logger.info("Unloaded {}".format(target_id)) rmtree("{}:{}".format(target_id, self.worker_index)) except FileNotFoundError: - pass # this is raised by rmtree if folder does not exist + # This is raised by rmtree if folder does not exist. + self.logger.exception("FileNotFoundError occured while unloading VIM.") except Exception as e: self.logger.error("Cannot unload {}: {}".format(target_id, e)) @@ -1825,7 +1834,7 @@ class NsWorker(threading.Thread): persistent_info={}, ) else: # sdn - plugin_name = "rosdn_" + vim["type"] + plugin_name = "rosdn_" + (vim.get("type") or vim.get("wim_type")) step = "Loading plugin '{}'".format(plugin_name) vim_module_conn = self._load_plugin(plugin_name, "sdn") step = "Loading {}'".format(target_id) @@ -2068,7 +2077,7 @@ class NsWorker(threading.Thread): "created_items", False ) - self.logger.warning("Needed delete: {}".format(needed_delete)) + self.logger.debug("Needed delete: {}".format(needed_delete)) if my_task["status"] == "FAILED": return None, None # TODO need to be retry?? @@ -2092,7 +2101,7 @@ class NsWorker(threading.Thread): needed_delete = False if needed_delete: - self.logger.warning( + self.logger.debug( "Deleting ro_task={} task_index={}".format(ro_task, task_index) ) return self.item2class[my_task["item"]].delete(ro_task, task_index) @@ -2197,7 +2206,7 @@ class NsWorker(threading.Thread): fail_on_empty=False, ) - self.logger.warning("ro_task_dependency={}".format(ro_task_dependency)) + self.logger.debug("ro_task_dependency={}".format(ro_task_dependency)) if ro_task_dependency: for task_index, task in enumerate(ro_task_dependency["tasks"]): if task["task_id"] == task_id: @@ -2350,7 +2359,7 @@ class NsWorker(threading.Thread): dependency_task = dependency_ro_task["tasks"][ dependency_task_index ] - self.logger.warning( + self.logger.debug( "dependency_ro_task={} dependency_task_index={}".format( dependency_ro_task, dependency_task_index ) @@ -2819,7 +2828,7 @@ class NsWorker(threading.Thread): """ ro_task = self._get_db_task() if ro_task: - self.logger.warning("Task to process: {}".format(ro_task)) + self.logger.debug("Task to process: {}".format(ro_task)) time.sleep(1) self._process_pending_tasks(ro_task) busy = True