fix 1190 enhanced reported error text 73/9573/1
authortierno <alfonso.tiernosepulveda@telefonica.com>
Tue, 11 Aug 2020 11:19:44 +0000 (11:19 +0000)
committertierno <alfonso.tiernosepulveda@telefonica.com>
Wed, 12 Aug 2020 12:09:09 +0000 (12:09 +0000)
Change-Id: I0c65daa0b934694c3b741952bee95d7c4b976365
Signed-off-by: tierno <alfonso.tiernosepulveda@telefonica.com>
RO-VIM-openstack/osm_rovim_openstack/vimconn_openstack.py
RO/osm_ro/nfvo.py

index 7cf5e88..c365db7 100644 (file)
@@ -410,13 +410,16 @@ class vimconnector(vimconn.VimConnector):
         """Transform a keystone, nova, neutron  exception into a vimconn exception discovering the cause"""
 
         message_error = str(exception)
         """Transform a keystone, nova, neutron  exception into a vimconn exception discovering the cause"""
 
         message_error = str(exception)
+        tip = ""
 
         if isinstance(exception, (neExceptions.NetworkNotFoundClient, nvExceptions.NotFound, ksExceptions.NotFound,
                                   gl1Exceptions.HTTPNotFound)):
             raise vimconn.VimConnNotFoundException(type(exception).__name__ + ": " + message_error)
         elif isinstance(exception, (HTTPException, gl1Exceptions.HTTPException, gl1Exceptions.CommunicationError,
                                     ConnectionError, ksExceptions.ConnectionError, neExceptions.ConnectionFailed)):
 
         if isinstance(exception, (neExceptions.NetworkNotFoundClient, nvExceptions.NotFound, ksExceptions.NotFound,
                                   gl1Exceptions.HTTPNotFound)):
             raise vimconn.VimConnNotFoundException(type(exception).__name__ + ": " + message_error)
         elif isinstance(exception, (HTTPException, gl1Exceptions.HTTPException, gl1Exceptions.CommunicationError,
                                     ConnectionError, ksExceptions.ConnectionError, neExceptions.ConnectionFailed)):
-            raise vimconn.VimConnConnectionException(type(exception).__name__ + ": " + message_error)
+            if type(exception).__name__ == "SSLError":
+                tip = " (maybe option 'insecure' must be added to the VIM)"
+            raise vimconn.VimConnConnectionException("Invalid URL or credentials{}: {}".format(tip, message_error))
         elif isinstance(exception, (KeyError, nvExceptions.BadRequest, ksExceptions.BadRequest)):
             raise vimconn.VimConnException(type(exception).__name__ + ": " + message_error)
         elif isinstance(exception, (nvExceptions.ClientException, ksExceptions.ClientException,
         elif isinstance(exception, (KeyError, nvExceptions.BadRequest, ksExceptions.BadRequest)):
             raise vimconn.VimConnException(type(exception).__name__ + ": " + message_error)
         elif isinstance(exception, (nvExceptions.ClientException, ksExceptions.ClientException,
@@ -566,9 +569,10 @@ class vimconnector(vimconn.VimConnector):
                         provider_physical_network = provider_physical_network[0]
 
                 if not provider_physical_network:
                         provider_physical_network = provider_physical_network[0]
 
                 if not provider_physical_network:
-                    raise vimconn.VimConnConflictException("You must provide a 'dataplane_physical_net' at VIM_config "
-                                                           "for creating underlay networks. or use the NS instantiation"
-                                                           " parameter provider-network:physical-network for the VLD")
+                    raise vimconn.VimConnConflictException(
+                        "missing information needed for underlay networks. Provide 'dataplane_physical_net' "
+                        "configuration at VIM or use the NS instantiation parameter 'provider-network.physical-network'"
+                        " for the VLD")
 
                 if not self.config.get('multisegment_support'):
                     network_dict["provider:physical_network"] = provider_physical_network
 
                 if not self.config.get('multisegment_support'):
                     network_dict["provider:physical_network"] = provider_physical_network
index 74258af..29b9dcc 100644 (file)
@@ -490,9 +490,9 @@ def rollback(mydb,  vims, rollback_list):
                 logger.error("Error in rollback. Not possible to delete %s '%s' from DB. Message: %s", item['what'], item["uuid"], str(e))
                 undeleted_items.append("{} '{}'".format(item['what'], item["uuid"]))
     if len(undeleted_items)==0:
                 logger.error("Error in rollback. Not possible to delete %s '%s' from DB. Message: %s", item['what'], item["uuid"], str(e))
                 undeleted_items.append("{} '{}'".format(item['what'], item["uuid"]))
     if len(undeleted_items)==0:
-        return True,Rollback successful."
+        return True, "Rollback successful."
     else:
     else:
-        return False,Rollback fails to delete: " + str(undeleted_items)
+        return False, "Rollback fails to delete: " + str(undeleted_items)
 
 
 def check_vnf_descriptor(vnf_descriptor, vnf_descriptor_version=1):
 
 
 def check_vnf_descriptor(vnf_descriptor, vnf_descriptor_version=1):
@@ -3789,7 +3789,7 @@ def create_instance(mydb, tenant_id, instance_dict):
         returned_instance["action_id"] = instance_action_id
         return returned_instance
     except (NfvoException, vimconn.VimConnException, sdnconn.SdnConnectorError, db_base_Exception) as e:
         returned_instance["action_id"] = instance_action_id
         return returned_instance
     except (NfvoException, vimconn.VimConnException, sdnconn.SdnConnectorError, db_base_Exception) as e:
-        message = rollback(mydb, myvims, rollbackList)
+        _, message = rollback(mydb, myvims, rollbackList)
         if isinstance(e, db_base_Exception):
             error_text = "database Exception"
         elif isinstance(e, vimconn.VimConnException):
         if isinstance(e, db_base_Exception):
             error_text = "database Exception"
         elif isinstance(e, vimconn.VimConnException):
@@ -3797,8 +3797,8 @@ def create_instance(mydb, tenant_id, instance_dict):
         elif isinstance(e, sdnconn.SdnConnectorError):
             error_text = "WIM Exception"
         else:
         elif isinstance(e, sdnconn.SdnConnectorError):
             error_text = "WIM Exception"
         else:
-            error_text = "Exception"
-        error_text += " {} {}. {}".format(type(e).__name__, str(e), message)
+            error_text = "Exception " + str(type(e).__name__)
+        error_text += " {}. {}".format(e, message)
         # logger.error("create_instance: %s", error_text)
         logger.exception(e)
         raise NfvoException(error_text, e.http_code)
         # logger.error("create_instance: %s", error_text)
         logger.exception(e)
         raise NfvoException(error_text, e.http_code)