fix 1137: SDN-assist issue connecting only one port 98/9398/1
authortierno <alfonso.tiernosepulveda@telefonica.com>
Fri, 10 Jul 2020 13:54:58 +0000 (13:54 +0000)
committertierno <alfonso.tiernosepulveda@telefonica.com>
Mon, 13 Jul 2020 14:20:33 +0000 (14:20 +0000)
Change-Id: Id09e833ad425c5d1621b5a1e370a9ee389b4b5e7
Signed-off-by: tierno <alfonso.tiernosepulveda@telefonica.com>
RO/osm_ro/vim_thread.py

index 75ab863..e7bf891 100644 (file)
@@ -1114,7 +1114,7 @@ class vim_thread(threading.Thread):
         connected_ports = task["extra"].get("connected_ports", [])
         new_connected_ports = []
         last_update = task["extra"].get("last_update", 0)
-        sdn_status = "BUILD"
+        sdn_status = task["extra"].get("vim_status", "BUILD")
         sdn_info = None
 
         task_id = task["instance_action_id"] + "." + str(task["task_index"])
@@ -1212,18 +1212,21 @@ class vim_thread(threading.Thread):
 
             # if there are more ports to connect or they have been modified, call create/update
             try:
-                if (set(connected_ports) != set(new_connected_ports) or sdn_need_update) and len(sdn_ports) >= 2:
+                if set(connected_ports) != set(new_connected_ports) or sdn_need_update:
                     last_update = time.time()
                     if not wimconn_net_id:
-                        if params[0] == "data":
-                            net_type = "ELAN"
-                        elif params[0] == "ptp":
-                            net_type = "ELINE"
+                        if len(sdn_ports) < 2:
+                            if not pending_ports:
+                                sdn_status = "ACTIVE"
                         else:
-                            net_type = "L3"
-
-                        wimconn_net_id, created_items = self.sdnconnector.create_connectivity_service(
-                            net_type, sdn_ports)
+                            if params[0] == "data":
+                                net_type = "ELAN"
+                            elif params[0] == "ptp":
+                                net_type = "ELINE"
+                            else:
+                                net_type = "L3"
+                            wimconn_net_id, created_items = self.sdnconnector.create_connectivity_service(
+                                net_type, sdn_ports)
                     else:
                         created_items = self.sdnconnector.edit_connectivity_service(
                             wimconn_net_id, conn_info=created_items, connection_points=sdn_ports)