aboutsummaryrefslogtreecommitdiffstats
path: root/src/onaptests/scenario
diff options
context:
space:
mode:
Diffstat (limited to 'src/onaptests/scenario')
-rw-r--r--src/onaptests/scenario/basic_vm.py48
-rw-r--r--src/onaptests/scenario/clearwater_ims.py34
2 files changed, 57 insertions, 25 deletions
diff --git a/src/onaptests/scenario/basic_vm.py b/src/onaptests/scenario/basic_vm.py
index 48fd169..35cedbc 100644
--- a/src/onaptests/scenario/basic_vm.py
+++ b/src/onaptests/scenario/basic_vm.py
@@ -5,6 +5,7 @@ import time
from xtesting.core import testcase
from onapsdk.configuration import settings
+import onaptests.utils.exceptions as onap_test_exceptions
from onaptests.steps.instantiate.vf_module_ala_carte import YamlTemplateVfModuleAlaCarteInstantiateStep
class BasicVm(testcase.TestCase):
@@ -29,18 +30,41 @@ class BasicVm(testcase.TestCase):
"""Run onap_tests with ubuntu16 VM."""
self.start_time = time.time()
self.__logger.debug("start time")
- self.test.execute()
- self.__logger.info("VNF basic_vm successfully created")
- self.stop_time = time.time()
- # The cleanup is part of the test, not only a teardown action
- if settings.CLEANUP_FLAG:
- self.__logger.info("VNF basic_vm cleanup called")
- time.sleep(settings.CLEANUP_ACTIVITY_TIMER)
- self.test.cleanup()
- self.result = 100
- else:
- self.__logger.info("No cleanup requested. Test completed.")
- self.result = 100
+ try:
+ self.test.execute()
+ self.__logger.info("VNF basic_vm successfully created")
+ # The cleanup is part of the test, not only a teardown action
+ if settings.CLEANUP_FLAG:
+ self.__logger.info("VNF basic_vm cleanup called")
+ time.sleep(settings.CLEANUP_ACTIVITY_TIMER)
+ self.test.cleanup()
+ self.result = 100
+ else:
+ self.__logger.info("No cleanup requested. Test completed.")
+ self.result = 100
+ except onap_test_exceptions.TestConfigurationException:
+ self.result = 0
+ self.__logger.error("Basic VM configuration error")
+ except onap_test_exceptions.ServiceInstantiateException:
+ self.result = 0
+ self.__logger.error("Basic VM instantiation error")
+ except onap_test_exceptions.ServiceCleanupException:
+ self.result = 0
+ self.__logger.error("Basic VM instance cleanup error")
+ except onap_test_exceptions.VnfInstantiateException:
+ self.result = 0
+ self.__logger.error("Basic VM Vnf instantiation error")
+ except onap_test_exceptions.VnfCleanupException:
+ self.result = 0
+ self.__logger.error("Basic VM Vnf instance cleanup error")
+ except onap_test_exceptions.VfModuleInstantiateException:
+ self.result = 0
+ self.__logger.error("Basic VM Module instantiation error")
+ except onap_test_exceptions.VfModuleCleanupException:
+ self.__logger.error("Basic VM Module cleanup failed.")
+ self.result = 0
+ 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 83a654e..0177e02 100644
--- a/src/onaptests/scenario/clearwater_ims.py
+++ b/src/onaptests/scenario/clearwater_ims.py
@@ -29,19 +29,27 @@ class ClearwaterIms(testcase.TestCase):
"""Run vIMS test."""
self.start_time = time.time()
self.__logger.debug("start time")
- self.test.execute()
- self.__logger.info("VNF clearwater IMS successfully created")
- self.stop_time = time.time()
- # The cleanup is part of the test, not only a teardown action
- if settings.CLEANUP_FLAG:
- self.__logger.info("VNF clearwater IMS cleanup called")
- time.sleep(settings.CLEANUP_ACTIVITY_TIMER)
- self.test.cleanup()
- self.result = 100
- else:
- self.__logger.info("No cleanup requested. Test completed.")
- self.result = 100
+ try:
+ self.test.execute()
+ self.__logger.info("VNF clearwater IMS successfully created")
+ # The cleanup is part of the test, not only a teardown action
+ if settings.CLEANUP_FLAG:
+ self.__logger.info("VNF clearwater IMS cleanup called")
+ time.sleep(settings.CLEANUP_ACTIVITY_TIMER)
+ self.test.cleanup()
+ self.result = 100
+ else:
+ self.__logger.info("No cleanup requested. Test completed.")
+ self.result = 100
+ self.stop_time = time.time()
+ except:
+ self.__logger.error("Clearwater IMS test case failed.")
+ self.result = 0
+ self.stop_time = time.time()
def clean(self):
"""Clean Additional resources if needed."""
- pass
+ try:
+ self.test.reports_collection.generate_report()
+ except:
+ self.__logger.error("Impossible to generate reporting")