aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorBartek Grzybowski <b.grzybowski@partner.samsung.com>2019-10-30 10:55:55 +0100
committerBartek Grzybowski <b.grzybowski@partner.samsung.com>2019-10-30 10:57:57 +0100
commit68d93c2a8cf5417cca2d4f9dafb30f08451ed24f (patch)
tree855d79e9165d00562592efe66287e8c6e2df0f0f /test
parent2a75ad689a5024b38c53354973588d2f68da2596 (diff)
Fix failures return codes in vcpe scripts
Conditional exits on failures should return with non zero exit code for better behavior in testing pipelines. Change-Id: Ied2e699a2cd38cc741e6d9d9a5c88082f09fa549 Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com> Issue-ID: TEST-226
Diffstat (limited to 'test')
-rwxr-xr-xtest/vcpe/preload.py6
-rwxr-xr-xtest/vcpe/soutils.py8
-rwxr-xr-xtest/vcpe/vcpe.py10
-rwxr-xr-xtest/vcpe/vcpecommon.py22
4 files changed, 23 insertions, 23 deletions
diff --git a/test/vcpe/preload.py b/test/vcpe/preload.py
index f4a2895f1..513d6e8e4 100755
--- a/test/vcpe/preload.py
+++ b/test/vcpe/preload.py
@@ -47,7 +47,7 @@ class Preload:
if 2 != r.status_code / 100:
self.logger.debug(r.content)
self.logger.error('Clearing SNIRO date failed.')
- sys.exit()
+ sys.exit(1)
def preload_sniro(self, template_sniro_data, template_sniro_request, tunnelxconn_ar_name, vgw_name, vbrg_ar_name,
vgmux_svc_instance_uuid, vbrg_svc_instance_uuid):
@@ -76,7 +76,7 @@ class Preload:
response = r.json()
self.logger.debug(json.dumps(response, indent=4, sort_keys=True))
self.logger.error('SNIRO preloading failed.')
- sys.exit()
+ sys.exit(1)
return True
@@ -220,7 +220,7 @@ class Preload:
if not (tunnelxconn_ar_name and brg_ar_name and vgw_name):
self.logger.error('Cannot find all names from %s.', vcperescust_csar)
- sys.exit()
+ sys.exit(1)
vgmux_svc_instance_uuid = '88888888888888'
vbrg_svc_instance_uuid = '999999999999999'
diff --git a/test/vcpe/soutils.py b/test/vcpe/soutils.py
index 7ab429099..2a953e795 100755
--- a/test/vcpe/soutils.py
+++ b/test/vcpe/soutils.py
@@ -23,7 +23,7 @@ class SoUtils:
self.vcpecommon = vcpecommon
if api_version not in self.vcpecommon.so_req_api_url:
self.logger.error('Incorrect SO API version: %s', api_version)
- sys.exit()
+ sys.exit(1)
self.service_req_api_url = self.vcpecommon.so_req_api_url[api_version]
def submit_create_req(self, req_json, req_type, service_instance_id=None, vnf_instance_id=None):
@@ -240,7 +240,7 @@ class SoUtils:
self.logger.error("AAI traversal didn't finish in 30 seconds. Something is wrong. Type {0}, UUID {1}".format(
node_type, uuid))
- sys.exit()
+ sys.exit(1)
def create_entire_service(self, csar_file, vnf_template_file, preload_dict, name_suffix, heatbridge=False):
"""
@@ -319,7 +319,7 @@ class SoUtils:
# wait for AAI to complete traversal
if not vnf_instance_id:
self.logger.error('No VNF instance ID returned!')
- sys.exit()
+ sys.exit(1)
self.wait_for_aai('vnf', vnf_instance_id)
preloader = preload.Preload(self.vcpecommon)
@@ -329,7 +329,7 @@ class SoUtils:
if len(parser.vfmodule_models) == 1:
if not vnf_instance_id or not vnf_model:
self.logger.error('Invalid VNF instance ID or VNF model!')
- sys.exit()
+ sys.exit(1)
model = parser.vfmodule_models[0]
vfmodule_instance_name = '_'.join([self.vcpecommon.instance_name_prefix['vfmodule'],
diff --git a/test/vcpe/vcpe.py b/test/vcpe/vcpe.py
index 3677e80a3..3356e2ba3 100755
--- a/test/vcpe/vcpe.py
+++ b/test/vcpe/vcpe.py
@@ -45,7 +45,7 @@ def config_sniro(vcpecommon, vgmux_svc_instance_uuid, vbrg_svc_instance_uuid):
if not (tunnelxconn_ar_name and brg_ar_name and vgw_name):
logger.error('Cannot find all names from %s.', vcperescust_csar)
- sys.exit()
+ sys.exit(1)
preloader.preload_sniro(template_sniro_data, template_sniro_request, tunnelxconn_ar_name, vgw_name, brg_ar_name,
vgmux_svc_instance_uuid, vbrg_svc_instance_uuid)
@@ -77,7 +77,7 @@ def deploy_brg_only():
svc_instance_uuid[keyword] = create_one_service(vcpecommon, csar_file, vnf_template_file, preload_dict,
name_suffix, heatbridge)
if not svc_instance_uuid[keyword]:
- sys.exit()
+ sys.exit(1)
# Setting up SNIRO
config_sniro(vcpecommon, svc_instance_uuid['gmux'], svc_instance_uuid['brg'])
@@ -97,7 +97,7 @@ def deploy_infra():
logger.debug(json.dumps(preload_dict, indent=4, sort_keys=True))
if not preload_dict:
logger.error("Failed to preload networks.")
- sys.exit()
+ sys.exit(1)
vcpecommon.save_preload_data(preload_dict)
# create multiple services based on the pre-determined order
@@ -109,7 +109,7 @@ def deploy_infra():
svc_instance_uuid[keyword] = create_one_service(vcpecommon, csar_file, vnf_template_file, preload_dict,
name_suffix, heatbridge)
if not svc_instance_uuid[keyword]:
- sys.exit()
+ sys.exit(1)
vcpecommon.save_object(svc_instance_uuid, vcpecommon.svc_instance_uuid_file)
# Setting up SNIRO
@@ -141,7 +141,7 @@ def deploy_custom_service():
host_dic = {k: vcpecommon.hosts[k] for k in nodes}
if False:
if not vcpecommon.delete_vxlan_interfaces(host_dic):
- sys.exit()
+ sys.exit(1)
custom_service.del_all_vgw_stacks(vcpecommon.vgw_name_keyword)
#custom_service.clean_up_sdnc()
diff --git a/test/vcpe/vcpecommon.py b/test/vcpe/vcpecommon.py
index acad39454..58f91a777 100755
--- a/test/vcpe/vcpecommon.py
+++ b/test/vcpe/vcpecommon.py
@@ -301,14 +301,14 @@ class VcpeCommon:
if filenamepath:
self.logger.error('Multiple files found for *{0}*.{1} in '
'directory {2}'.format(file_name_keyword, file_ext, search_dir))
- sys.exit()
+ sys.exit(1)
filenamepath = os.path.abspath(os.path.join(search_dir, file_name))
if filenamepath:
return filenamepath
else:
self.logger.error("Cannot find *{0}*{1} in directory {2}".format(file_name_keyword, file_ext, search_dir))
- sys.exit()
+ sys.exit(1)
@staticmethod
def network_name_to_subnet_name(network_name):
@@ -359,7 +359,7 @@ class VcpeCommon:
policy_json = json.load(f)
except ValueError:
self.logger.error(policy_template_file + " doesn't seem to contain valid JSON data")
- sys.exit()
+ sys.exit(1)
# Check policy already applied
requests.packages.urllib3.disable_warnings()
@@ -370,13 +370,13 @@ class VcpeCommon:
self.logger.error('Failure in checking CL policy existence. '
'Policy-pap responded with HTTP code {0}'.format(
policy_exists_req.status_code))
- sys.exit()
+ sys.exit(1)
try:
policy_exists_json = policy_exists_req.json()
except ValueError as e:
self.logger.error('Policy-pap request failed: ' + e.message)
- sys.exit()
+ sys.exit(1)
try:
assert policy_exists_json['groups'][0]['pdpSubgroups'] \
@@ -396,7 +396,7 @@ class VcpeCommon:
if policy_create_req.status_code != 200:
self.logger.error('Failed creating policy. Policy-api responded'
' with HTTP code {0}'.format(policy_create_req.status_code))
- sys.exit()
+ sys.exit(1)
try:
policy_version = json.loads(policy_create_req.text)['policy-version']
@@ -413,7 +413,7 @@ class VcpeCommon:
if policy_insert_req.status_code != 200:
self.logger.error('Policy PAP request failed with HTTP code'
'{0}'.format(policy_insert_req.status_code))
- sys.exit()
+ sys.exit(1)
self.logger.info('Successully pushed closed loop Policy')
def is_node_in_aai(self, node_type, node_uuid):
@@ -427,7 +427,7 @@ class VcpeCommon:
key = 'vnf-id'
else:
logging.error('Invalid node_type: ' + node_type)
- sys.exit()
+ sys.exit(1)
url = 'https://{0}:{1}/aai/v11/search/nodes-query?search-node-type={2}&filter={3}:EQUALS:{4}'.format(
self.hosts['aai-inst1'], self.aai_query_port, search_node_type, key, node_uuid)
@@ -545,7 +545,7 @@ class VcpeCommon:
self.logger.error('Cannot find all desired IP addresses for %s.', keywords)
self.logger.error(json.dumps(ip_dict, indent=4, sort_keys=True))
self.logger.error('Temporarily continue.. remember to check back vcpecommon.py line: 396')
-# sys.exit()
+# sys.exit(1)
return ip_dict
def get_oom_onap_vm_ip(self, keywords):
@@ -569,7 +569,7 @@ class VcpeCommon:
resp = api.read_namespaced_service(service, self.onap_namespace)
except client.rest.ApiException as e:
self.logger.error('Error while making k8s API request: ' + e.body)
- sys.exit()
+ sys.exit(1)
return resp.spec.cluster_ip
@@ -590,7 +590,7 @@ class VcpeCommon:
resp = api.read_namespaced_endpoints(service, self.onap_namespace)
except client.rest.ApiException as e:
self.logger.error('Error while making k8s API request: ' + e.body)
- sys.exit()
+ sys.exit(1)
if subset == "ip":
return resp.subsets[0].addresses[0].ip