diff options
author | mrichomme <morgan.richomme@orange.com> | 2020-10-13 12:52:24 +0200 |
---|---|---|
committer | mrichomme <morgan.richomme@orange.com> | 2020-10-14 11:27:35 +0200 |
commit | b7b9796d16a2e53e0e58ae9888dade1e89a0cc19 (patch) | |
tree | 379944906ed2c5a837dc1e09810235fd03a37e8b /src/onaptests/steps | |
parent | 6276bed4df9b8458c4b6805edab81652fb15de76 (diff) |
Improve xtesting integration
All the exceptions shall be caught by the use case
Issue-ID: TEST-257
Signed-off-by: mrichomme <morgan.richomme@orange.com>
Change-Id: Ie2762ad869d8984ce2125db4a8ef4990ee50f82a
Signed-off-by: mrichomme <morgan.richomme@orange.com>
Diffstat (limited to 'src/onaptests/steps')
4 files changed, 14 insertions, 9 deletions
diff --git a/src/onaptests/steps/instantiate/service_ala_carte.py b/src/onaptests/steps/instantiate/service_ala_carte.py index b3b56c4..3a99f4d 100644 --- a/src/onaptests/steps/instantiate/service_ala_carte.py +++ b/src/onaptests/steps/instantiate/service_ala_carte.py @@ -10,6 +10,7 @@ from onapsdk.sdc.service import Service from onapsdk.so.instantiation import ServiceInstantiation from onapsdk.vid import Project +import onaptests.utils.exceptions as onap_test_exceptions from ..base import BaseStep, YamlTemplateBaseStep from ..cloud.connect_service_subscription_to_cloud_region import ConnectServiceSubToCloudRegionStep from ..onboard.service import ServiceOnboardStep, YamlTemplateServiceOnboardStep @@ -192,7 +193,7 @@ class YamlTemplateServiceAlaCarteInstantiateStep(YamlTemplateBaseStep): if distribution_completed is False: self._logger.error( "Service Distribution for %s failed !!",service.name) - exit(1) + raise onap_test_exceptions.ServiceDistributionException service_instantiation = ServiceInstantiation.instantiate_so_ala_carte( service, @@ -206,7 +207,7 @@ class YamlTemplateServiceAlaCarteInstantiateStep(YamlTemplateBaseStep): while not service_instantiation.finished: time.sleep(10) if service_instantiation.failed: - raise Exception("Service instantiation failed") + raise onap_test_exceptions.ServiceInstantiateException else: service_subscription: ServiceSubscription = customer.get_service_subscription_by_service_type(self.service_name) self._service_instance: ServiceInstance = service_subscription.get_service_instance_by_name(self.service_instance_name) @@ -231,4 +232,4 @@ class YamlTemplateServiceAlaCarteInstantiateStep(YamlTemplateBaseStep): self._logger.info("Service %s deleted", self._service_instance_name) else: self._logger.error("Service deletion %s failed", self._service_instance_name) - raise Exception("Service cleanup failed") + raise onap_test_exceptions.ServiceCleanupException diff --git a/src/onaptests/steps/instantiate/vf_module_ala_carte.py b/src/onaptests/steps/instantiate/vf_module_ala_carte.py index 14ef2d8..b5fd7eb 100644 --- a/src/onaptests/steps/instantiate/vf_module_ala_carte.py +++ b/src/onaptests/steps/instantiate/vf_module_ala_carte.py @@ -8,6 +8,7 @@ from onapsdk.aai.business import Customer, ServiceInstance, ServiceSubscription from onapsdk.configuration import settings from onapsdk.so.instantiation import VnfParameter +import onaptests.utils.exceptions as onap_test_exceptions from ..base import YamlTemplateBaseStep from .vnf_ala_carte import YamlTemplateVnfAlaCarteInstantiateStep @@ -129,7 +130,7 @@ class YamlTemplateVfModuleAlaCarteInstantiateStep(YamlTemplateBaseStep): while not vf_module_instantiation.finished: time.sleep(10) if vf_module_instantiation.failed: - raise Exception("Vf module instantiation failed") + raise onap_test_exceptions.VfModuleInstantiateException def cleanup(self) -> None: @@ -159,4 +160,4 @@ class YamlTemplateVfModuleAlaCarteInstantiateStep(YamlTemplateBaseStep): self._logger.info("VfModule %s deleted", vf_module.name) else: self._logger.error("VfModule deletion %s failed", vf_module.name) - raise Exception("Vf module cleanup failed") + raise onap_test_exceptions.VfModuleCleanupException diff --git a/src/onaptests/steps/instantiate/vnf_ala_carte.py b/src/onaptests/steps/instantiate/vnf_ala_carte.py index 0ab498d..d529219 100644 --- a/src/onaptests/steps/instantiate/vnf_ala_carte.py +++ b/src/onaptests/steps/instantiate/vnf_ala_carte.py @@ -8,6 +8,7 @@ from onapsdk.configuration import settings from onapsdk.sdc.service import Service from onapsdk.vid import LineOfBusiness, Platform +import onaptests.utils.exceptions as onap_test_exceptions from ..base import YamlTemplateBaseStep from .service_ala_carte import YamlTemplateServiceAlaCarteInstantiateStep @@ -110,7 +111,7 @@ class YamlTemplateVnfAlaCarteInstantiateStep(YamlTemplateBaseStep): while not vnf_instantiation.finished: time.sleep(10) if vnf_instantiation.failed: - raise Exception("Vnf instantiation failed") + raise onap_test_exceptions.VnfInstantiateException def cleanup(self) -> None: """Cleanup VNF. @@ -134,4 +135,4 @@ class YamlTemplateVnfAlaCarteInstantiateStep(YamlTemplateBaseStep): self._logger.info("VNF %s deleted", vnf_instance.name) else: self._logger.error("VNF deletion %s failed", vnf_instance.name) - raise Exception("VNF Cleanup failed") + raise onap_test_exceptions.VnfCleanupException diff --git a/src/onaptests/steps/reports_collection.py b/src/onaptests/steps/reports_collection.py index 62c0447..bcb199f 100644 --- a/src/onaptests/steps/reports_collection.py +++ b/src/onaptests/steps/reports_collection.py @@ -43,12 +43,14 @@ class ReportsCollection: usecase = settings.SERVICE_NAME try: details = settings.SERVICE_DETAILS - except: + except NameError: details = "" + try: components = settings.SERVICE_COMPONENTS - except: + except NameError: components = "" + log_path = settings.LOG_CONFIG['handlers']['file']['filename'] jinja_env = Environment( autoescape=select_autoescape(['html']), |