#
 import logging
 import os
-import sys
 import time
 import requests
 import re
     if not net_id:
         logger.error(
             "There has been a problem when creating the neutron network")
-        sys.exit(-1)
+        raise Exception("There has been a problem when creating"
+                        " the neutron network {}".format(name))
     return net_id
 
 
     if not subnet_id:
         logger.error(
             "There has been a problem when creating the neutron subnet")
-        sys.exit(-1)
+        raise Exception("There has been a problem when creating"
+                        " the neutron subnet {}".format(name))
     return subnet_id
 
 
     if not network_dic:
         logger.error(
             "There has been a problem when creating the neutron network")
-        sys.exit(-1)
+        raise Exception("There has been a problem when creating"
+                        " the neutron network {}".format(net))
     net_id = network_dic["net_id"]
     subnet_id = network_dic["subnet_id"]
     router_id = network_dic["router_id"]
         if not subnet_id:
             logger.error(
                 "There has been a problem when creating the second subnet")
-            sys.exit(-1)
+            raise Exception("There has been a problem when creating"
+                            " the second subnet {}".format(subnet2))
         logger.debug("Subnet '%s' created successfully" % subnet_id)
     return net_id, subnet_id, router_id
 
 
     if instance is None:
         logger.error("Error while booting instance.")
-        sys.exit(-1)
+        raise Exception("Error while booting instance {}".format(name))
     else:
         logger.debug("Instance '%s' booted successfully. IP='%s'." %
                      (name, instance.networks.itervalues().next()[0]))
         logger.error("There are %s compute nodes in the deployment. "
                      "Minimum number of nodes to complete the test is 2."
                      % num_compute_nodes)
-        sys.exit(-1)
+        raise Exception("There are {} compute nodes in the deployment. "
+                        "Minimum number of nodes to complete the test"
+                        " is 2.".format(num_compute_nodes))
 
     logger.debug("Compute nodes: %s" % compute_nodes)
     return compute_nodes