summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeriyasamy Palanisamy <periyasamy.palanisamy@ericsson.com>2018-03-12 13:13:24 +0100
committerPeriyasamy Palanisamy <periyasamy.palanisamy@ericsson.com>2018-03-12 13:13:24 +0100
commit90204b0850c38e2c9eeb2cbb4dfccc2053beafb4 (patch)
tree00f54a141db45564e904223a0f2ceb957ed8d3a7
parent6a8c7ac31bbf7c93ce971c216528fb609641b0d9 (diff)
testcase execution halt fix
It's found that sys.exit is used in utils.py which caused testcase execution is stopped abruptly while running bgpvpn testsuite. This is now replaced with Exception. Change-Id: I69df4be705985994318f58d57b152d6db4087610 Signed-off-by: Periyasamy Palanisamy <periyasamy.palanisamy@ericsson.com>
-rw-r--r--sdnvpn/lib/utils.py19
1 files changed, 12 insertions, 7 deletions
diff --git a/sdnvpn/lib/utils.py b/sdnvpn/lib/utils.py
index 8fde5e4..ad8215c 100644
--- a/sdnvpn/lib/utils.py
+++ b/sdnvpn/lib/utils.py
@@ -9,7 +9,6 @@
#
import logging
import os
-import sys
import time
import requests
import re
@@ -69,7 +68,8 @@ def create_net(neutron_client, name):
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
@@ -83,7 +83,8 @@ def create_subnet(neutron_client, name, cidr, 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
@@ -100,7 +101,8 @@ def create_network(neutron_client, net, subnet1, cidr1,
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"]
@@ -112,7 +114,8 @@ def create_network(neutron_client, net, subnet1, cidr1,
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
@@ -183,7 +186,7 @@ def create_instance(nova_client,
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]))
@@ -429,7 +432,9 @@ def assert_and_get_compute_nodes(nova_client, required_node_number=2):
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