aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authormorganrol <morgan.richomme@orange.com>2021-04-21 14:45:24 +0200
committermorganrol <morgan.richomme@orange.com>2021-04-21 14:45:24 +0200
commit0a9bc9eba1ada15ec1a2934f3baa465804f20e76 (patch)
treebf411d29ec69e1841bab69cfa91c64b00761ddaa /src
parente94d90fb8fb843ee577d0fb05809c9e48c223ba8 (diff)
[EXCEPTIONS] Distinguish onaptests and onapsdk exception
there is no error_message method on onapsdk exception as a consequence we may raise a new excpetion when catching sdk exception leading to the non generation of the report Issue-ID: TEST-332 Signed-off-by: morganrol <morgan.richomme@orange.com> Change-Id: I42d1413ef142e29eeafdfe701f136ae45b097de4
Diffstat (limited to 'src')
-rw-r--r--src/onaptests/scenario/basic_clamp.py5
-rw-r--r--src/onaptests/scenario/basic_cnf.py5
-rw-r--r--src/onaptests/scenario/basic_network.py5
-rw-r--r--src/onaptests/scenario/basic_onboard.py5
-rw-r--r--src/onaptests/scenario/basic_vm.py5
-rw-r--r--src/onaptests/scenario/basic_vm_macro.py5
-rw-r--r--src/onaptests/scenario/cds_blueprint_enrichment.py8
-rw-r--r--src/onaptests/scenario/clearwater_ims.py5
-rw-r--r--src/onaptests/scenario/pnf_macro.py5
9 files changed, 38 insertions, 10 deletions
diff --git a/src/onaptests/scenario/basic_clamp.py b/src/onaptests/scenario/basic_clamp.py
index d3a9ba1..3669ab1 100644
--- a/src/onaptests/scenario/basic_clamp.py
+++ b/src/onaptests/scenario/basic_clamp.py
@@ -36,9 +36,12 @@ class BasicClamp(testcase.TestCase):
else:
self.__logger.info("No cleanup requested. Test completed.")
self.result = 100
- except (OnapTestException, SDKException, APIError) as exc:
+ except OnapTestException as exc:
self.result = 0
self.__logger.error(exc.error_message)
+ except (SDKException, APIError):
+ self.result = 0
+ self.__logger.error("SDK exception")
finally:
self.stop_time = time.time()
def clean(self):
diff --git a/src/onaptests/scenario/basic_cnf.py b/src/onaptests/scenario/basic_cnf.py
index 4d98398..77884bc 100644
--- a/src/onaptests/scenario/basic_cnf.py
+++ b/src/onaptests/scenario/basic_cnf.py
@@ -43,9 +43,12 @@ class BasicCnf(testcase.TestCase):
else:
self.__logger.info("No cleanup requested. Test completed.")
self.result = 100
- except (OnapTestException, SDKException) as exc:
+ except OnapTestException as exc:
self.result = 0
self.__logger.error(exc.error_message)
+ except SDKException:
+ self.result = 0
+ self.__logger.error("SDK exception")
finally:
self.stop_time = time.time()
diff --git a/src/onaptests/scenario/basic_network.py b/src/onaptests/scenario/basic_network.py
index 1b7bd14..6238ee1 100644
--- a/src/onaptests/scenario/basic_network.py
+++ b/src/onaptests/scenario/basic_network.py
@@ -47,9 +47,12 @@ class BasicNetwork(testcase.TestCase):
else:
self.__logger.info("No cleanup requested. Test completed.")
self.result = 100
- except (OnapTestException, SDKException) as exc:
+ except OnapTestException as exc:
self.result = 0
self.__logger.error(exc.error_message)
+ except SDKException:
+ self.result = 0
+ self.__logger.error("SDK Exception")
finally:
self.stop_time = time.time()
diff --git a/src/onaptests/scenario/basic_onboard.py b/src/onaptests/scenario/basic_onboard.py
index 6277f9d..af689bd 100644
--- a/src/onaptests/scenario/basic_onboard.py
+++ b/src/onaptests/scenario/basic_onboard.py
@@ -34,9 +34,12 @@ class BasicOnboard(testcase.TestCase):
self.test.execute()
self.__logger.info("VNF basic_vm successfully onboarded")
self.result = 100
- except (OnapTestException, SDKException) as exc:
+ except OnapTestException as exc:
self.result = 0
self.__logger.error(exc.error_message)
+ except SDKException:
+ self.result = 0
+ self.__logger.error("SDK Exception")
finally:
self.stop_time = time.time()
diff --git a/src/onaptests/scenario/basic_vm.py b/src/onaptests/scenario/basic_vm.py
index b758088..3ad6392 100644
--- a/src/onaptests/scenario/basic_vm.py
+++ b/src/onaptests/scenario/basic_vm.py
@@ -43,9 +43,12 @@ class BasicVm(testcase.TestCase):
else:
self.__logger.info("No cleanup requested. Test completed.")
self.result = 100
- except (OnapTestException, SDKException) as exc:
+ except OnapTestException as exc:
self.result = 0
self.__logger.error(exc.error_message)
+ except SDKException:
+ self.result = 0
+ self.__logger.error("SDK Exception")
finally:
self.stop_time = time.time()
diff --git a/src/onaptests/scenario/basic_vm_macro.py b/src/onaptests/scenario/basic_vm_macro.py
index c90d48b..f22ee12 100644
--- a/src/onaptests/scenario/basic_vm_macro.py
+++ b/src/onaptests/scenario/basic_vm_macro.py
@@ -114,9 +114,12 @@ class BasicVmMacro(testcase.TestCase):
self.test.execute()
self.test.cleanup()
self.result = 100
- except (OnapTestException, SDKException) as exc:
+ except OnapTestException as exc:
self.result = 0
self.__logger.error(exc.error_message)
+ except SDKException:
+ self.result = 0
+ self.__logger.error("SDK Exception")
finally:
self.stop_time = time.time()
diff --git a/src/onaptests/scenario/cds_blueprint_enrichment.py b/src/onaptests/scenario/cds_blueprint_enrichment.py
index c1df63e..3354ee1 100644
--- a/src/onaptests/scenario/cds_blueprint_enrichment.py
+++ b/src/onaptests/scenario/cds_blueprint_enrichment.py
@@ -35,10 +35,14 @@ class CDSBlueprintEnrichment(testcase.TestCase):
try:
self.test.execute()
self.result = 100
- except (OnapTestException, SDKException) as exc:
+ except OnapTestException as exc:
self.result = 0
self.__logger.error(exc.error_message)
- self.stop_time = time.time()
+ except SDKException:
+ self.result = 0
+ self.__logger.error("SDK Exception")
+ finally:
+ self.stop_time = time.time()
def clean(self):
"""Clean Additional resources if needed."""
diff --git a/src/onaptests/scenario/clearwater_ims.py b/src/onaptests/scenario/clearwater_ims.py
index 2a035bb..c79e6f7 100644
--- a/src/onaptests/scenario/clearwater_ims.py
+++ b/src/onaptests/scenario/clearwater_ims.py
@@ -45,9 +45,12 @@ class ClearwaterIms(testcase.TestCase):
self.__logger.info("No cleanup requested. Test completed.")
self.result = 100
self.stop_time = time.time()
- except (OnapTestException, SDKException) as exc:
+ except OnapTestException as exc:
self.result = 0
self.__logger.error(exc.error_message)
+ except SDKException:
+ self.result = 0
+ self.__logger.error("SDK Exception")
finally:
self.stop_time = time.time()
diff --git a/src/onaptests/scenario/pnf_macro.py b/src/onaptests/scenario/pnf_macro.py
index fef8b83..e86557b 100644
--- a/src/onaptests/scenario/pnf_macro.py
+++ b/src/onaptests/scenario/pnf_macro.py
@@ -118,9 +118,12 @@ class PnfMacro(testcase.TestCase):
self.test.execute()
self.test.cleanup()
self.result = 100
- except (OnapTestException, SDKException) as exc:
+ except OnapTestException as exc:
self.result = 0
self.__logger.error(exc.error_message)
+ except SDKException:
+ self.result = 0
+ self.__logger.error("SDK Exception")
finally:
self.stop_time = time.time()