bug 1079 capture SDN plugin unhandled exceptions 12/9012/1
authortierno <alfonso.tiernosepulveda@telefonica.com>
Wed, 27 May 2020 18:19:19 +0000 (18:19 +0000)
committertierno <alfonso.tiernosepulveda@telefonica.com>
Mon, 1 Jun 2020 07:27:31 +0000 (07:27 +0000)
get network vlan for PT ports at openstack

Change-Id: I63dc5f5b3b57c1c7f1086690cfd8073f9356b233
Signed-off-by: tierno <alfonso.tiernosepulveda@telefonica.com>
RO-VIM-openstack/osm_rovim_openstack/vimconn_openstack.py
RO/osm_ro/vim_thread.py

index 8cb19ff..f1cccf6 100644 (file)
@@ -1665,7 +1665,7 @@ class vimconnector(vimconn.vimconnector):
                         #if network is of type vlan and port is of type direct (sr-iov) then set vlan id
                         network = self.neutron.show_network(port["network_id"])
                         if network['network'].get('provider:network_type') == 'vlan' and \
-                            port.get("binding:vnic_type") == "direct":
+                            port.get("binding:vnic_type") in ("direct", "direct-physical"):
                             interface["vlan"] = network['network'].get('provider:segmentation_id')
                         ips=[]
                         #look for floating ip address
index 380bd6a..3039bab 100644 (file)
@@ -1211,23 +1211,24 @@ class vim_thread(threading.Thread):
                 new_connected_ports.append(external_port_id)
 
             # if there are more ports to connect or they have been modified, call create/update
-            if (set(connected_ports) != set(new_connected_ports) or sdn_need_update) and len(sdn_ports) >= 2:
-                last_update = time.time()
-                if not wimconn_net_id:
-                    if params[0] == "data":
-                        net_type = "ELAN"
-                    elif params[0] == "ptp":
-                        net_type = "ELINE"
-                    else:
-                        net_type = "L3"
+            try:
+                if (set(connected_ports) != set(new_connected_ports) or sdn_need_update) and len(sdn_ports) >= 2:
+                    last_update = time.time()
+                    if not wimconn_net_id:
+                        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)
-                connected_ports = new_connected_ports
-            elif wimconn_net_id:
-                try:
+                        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)
+                    connected_ports = new_connected_ports
+                elif wimconn_net_id:
                     wim_status_dict = self.sdnconnector.get_connectivity_service_status(wimconn_net_id,
                                                                                         conn_info=created_items)
                     sdn_status = wim_status_dict["sdn_status"]
@@ -1235,8 +1236,8 @@ class vim_thread(threading.Thread):
                         error_list.append(wim_status_dict.get("error_msg"))
                     if wim_status_dict.get("sdn_info"):
                         sdn_info = str(wim_status_dict.get("sdn_info"))
-                except Exception as e:
-                    self._proccess_sdn_exception(e)
+            except Exception as e:
+                self._proccess_sdn_exception(e)
 
             task["status"] = "DONE"
             task["extra"]["vim_info"] = {}
@@ -1258,6 +1259,7 @@ class vim_thread(threading.Thread):
             # task["extra"]["sdn_net_id"] = sdn_net_id
             instance_element_update = {"wim_internal_id": wimconn_net_id, "status": "WIM_ERROR",
                                        "error_msg": task["error_msg"]}
+
         if sdn_info:
             instance_element_update["wim_info"] = sdn_info
         return instance_element_update