From cb8b6eaadc25834091bf020b0c6d50907780cca5 Mon Sep 17 00:00:00 2001 From: Michal Jagiello Date: Fri, 16 Feb 2024 11:35:32 +0100 Subject: Do not verify SO onboarding if test is not running inside cluster Fix bug with invalid base class for one of instantiation step Issue-ID: TEST-404 Signed-off-by: Michal Jagiello Change-Id: Ife972dbf9954b130c37562cb0c293b0e1da86133 --- src/onaptests/steps/instantiate/service_macro.py | 14 ++++++-------- src/onaptests/steps/onboard/service.py | 3 ++- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/onaptests/steps/instantiate/service_macro.py b/src/onaptests/steps/instantiate/service_macro.py index fb5e9d4..5588a33 100644 --- a/src/onaptests/steps/instantiate/service_macro.py +++ b/src/onaptests/steps/instantiate/service_macro.py @@ -7,7 +7,7 @@ from onapsdk.aai.business.owning_entity import OwningEntity from onapsdk.aai.cloud_infrastructure.cloud_region import CloudRegion from onapsdk.aai.cloud_infrastructure.tenant import Tenant from onapsdk.configuration import settings -from onapsdk.exceptions import ResourceNotFound +from onapsdk.exceptions import ResourceNotFound, SDKException from onapsdk.sdc.service import Service from onapsdk.so.instantiation import (InstantiationParameter, ServiceInstantiation, SoService, @@ -25,10 +25,10 @@ from onaptests.steps.onboard.service import (VerifyServiceDistributionStep, YamlTemplateServiceOnboardStep) -class YamlTemplateServiceMacroInstantiateStep(YamlTemplateBaseStep): +class YamlTemplateServiceMacroInstantiateBaseStep(YamlTemplateBaseStep): """Instantiate service a'la carte using YAML template.""" - def __init__(self): + def __init__(self, cleanup=settings.CLEANUP_FLAG): """Initialize step. Substeps: @@ -38,7 +38,7 @@ class YamlTemplateServiceMacroInstantiateStep(YamlTemplateBaseStep): - VerifyServiceDistributionStep - TestSdncStep """ - super().__init__(cleanup=settings.CLEANUP_FLAG) + super().__init__(cleanup=cleanup) self._yaml_template: dict = None self._model_yaml_template: dict = None self._service_instance_name: str = None @@ -117,8 +117,7 @@ class YamlTemplateServiceMacroInstantiateStep(YamlTemplateBaseStep): return self._service_instance_name return self.parent.service_instance_name - @YamlTemplateBaseStep.store_state - def execute(self): # noqa + def base_execute(self): # noqa """Instantiate service. Use settings values: @@ -133,7 +132,6 @@ class YamlTemplateServiceMacroInstantiateStep(YamlTemplateBaseStep): Exception: Service instantiation failed """ - super().execute() service = Service(self.service_name) self._load_customer_and_subscription() try: @@ -206,7 +204,7 @@ class YamlTemplateServiceMacroInstantiateStep(YamlTemplateServiceMacroInstantiat def execute(self): super().execute() (service, _, _, cloud_region, tenant, owning_entity, so_service, - skip_pnf_registration_event, vnf_params_list) = self.base_execute() + _, vnf_params_list) = self.base_execute() # remove leftover self._cleanup_logic() diff --git a/src/onaptests/steps/onboard/service.py b/src/onaptests/steps/onboard/service.py index 77456ff..f4761ff 100644 --- a/src/onaptests/steps/onboard/service.py +++ b/src/onaptests/steps/onboard/service.py @@ -203,7 +203,8 @@ class VerifyServiceDistributionStep(BaseScenarioStep): for notified_module in settings.SDC_SERVICE_DISTRIBUTION_COMPONENTS: self.add_step(VerifyServiceDistributionStatusStep( notified_module=notified_module)) - self.add_step(VerifyServiceDistributionInSoStep()) + if settings.IN_CLUSTER: + self.add_step(VerifyServiceDistributionInSoStep()) self.add_step(VerifyServiceDistributionInAaiStep()) self.add_step(VerifyServiceDistributionInSdncStep()) -- cgit 1.2.3-korg