From: tierno Date: Wed, 27 May 2020 18:19:19 +0000 (+0000) Subject: bug 1079 capture SDN plugin unhandled exceptions X-Git-Tag: v7.1.0rc4^0 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=f3178455f825fb0ffac2dcb3c8c0de6646ce585a;p=osm%2FRO.git bug 1079 capture SDN plugin unhandled exceptions get network vlan for PT ports at openstack Change-Id: I63dc5f5b3b57c1c7f1086690cfd8073f9356b233 Signed-off-by: tierno --- diff --git a/RO-VIM-openstack/osm_rovim_openstack/vimconn_openstack.py b/RO-VIM-openstack/osm_rovim_openstack/vimconn_openstack.py index 8cb19ffe..f1cccf64 100644 --- a/RO-VIM-openstack/osm_rovim_openstack/vimconn_openstack.py +++ b/RO-VIM-openstack/osm_rovim_openstack/vimconn_openstack.py @@ -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 diff --git a/RO/osm_ro/vim_thread.py b/RO/osm_ro/vim_thread.py index 622cccb5..cc3b08d2 100644 --- a/RO/osm_ro/vim_thread.py +++ b/RO/osm_ro/vim_thread.py @@ -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