From 55fa0bb312eebc5899abca6124b2114db1682f7b Mon Sep 17 00:00:00 2001 From: tierno Date: Tue, 8 Dec 2020 23:11:53 +0000 Subject: [PATCH] fix error on task_depends not defined Change-Id: If65158e44cf43558c8eada9c78c11971e6be4af0 Signed-off-by: tierno --- NG-RO/osm_ng_ro/ns.py | 6 +++++- NG-RO/osm_ng_ro/ns_thread.py | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/NG-RO/osm_ng_ro/ns.py b/NG-RO/osm_ng_ro/ns.py index 1b4e9ebc..aa1040d7 100644 --- a/NG-RO/osm_ng_ro/ns.py +++ b/NG-RO/osm_ng_ro/ns.py @@ -548,8 +548,12 @@ class Ns(object): for iface_index, interface in enumerate(target_vdu["interfaces"]): if interface.get("ns-vld-id"): net_text = ns_preffix + ":vld." + interface["ns-vld-id"] - else: + elif interface.get("vnf-vld-id"): net_text = vnf_preffix + ":vld." + interface["vnf-vld-id"] + else: + self.logger.error("Interface {} from vdu {} not connected to any vld".format( + iface_index, target_vdu["vdu-name"])) + continue # interface not connected to any vld extra_dict["depends_on"].append(net_text) net_item = {x: v for x, v in interface.items() if x in ("name", "vpci", "port_security", "port_security_disable_strategy", "floating_ip")} diff --git a/NG-RO/osm_ng_ro/ns_thread.py b/NG-RO/osm_ng_ro/ns_thread.py index 013cae9e..0ec84525 100644 --- a/NG-RO/osm_ng_ro/ns_thread.py +++ b/NG-RO/osm_ng_ro/ns_thread.py @@ -1222,6 +1222,7 @@ class NsWorker(threading.Thread): for task_index, task in enumerate(ro_task["tasks"]): if not task: continue # task deleted + task_depends = {} target_update = None if (task_action in ("DELETE", "EXEC") and task["status"] not in ("SCHEDULED", "BUILD")) or \ task["action"] != task_action or \ @@ -1231,7 +1232,6 @@ class NsWorker(threading.Thread): try: db_vim_info_update = None if task["status"] == "SCHEDULED": - task_depends = {} # check if tasks that this depends on have been completed dependency_not_completed = False for dependency_task_id in (task.get("depends_on") or ()): -- 2.17.1