diff options
author | Lukasz Rajewski <lukasz.rajewski@t-mobile.pl> | 2023-07-27 14:59:15 +0000 |
---|---|---|
committer | Lukasz Rajewski <lukasz.rajewski@t-mobile.pl> | 2023-08-05 17:11:09 +0000 |
commit | 4bccbde3060931c8fcf61fbf8b61db4a85b3200e (patch) | |
tree | f3e58c61d142d84e96718215355c1ce6913b57c9 /src/onaptests/scenario/multi_vnf_macro.py | |
parent | 2ffd98c9d0b85b7c6c6b0bf61cd9e848234914ce (diff) |
Change cleanup process of tests
Issue-ID: TEST-402
Signed-off-by: Lukasz Rajewski <lukasz.rajewski@t-mobile.pl>
Change-Id: Iffe3aeaa4eab6adcabc94d143d1f94a684cd4657
Diffstat (limited to 'src/onaptests/scenario/multi_vnf_macro.py')
-rw-r--r-- | src/onaptests/scenario/multi_vnf_macro.py | 49 |
1 files changed, 7 insertions, 42 deletions
diff --git a/src/onaptests/scenario/multi_vnf_macro.py b/src/onaptests/scenario/multi_vnf_macro.py index 82a0511..96ade6d 100644 --- a/src/onaptests/scenario/multi_vnf_macro.py +++ b/src/onaptests/scenario/multi_vnf_macro.py @@ -1,36 +1,26 @@ """Instantiate basic vm using SO macro flow.""" -import logging -import time - from onapsdk.configuration import settings -from onapsdk.exceptions import SDKException -from onaptests.scenario.scenario_base import ScenarioBase -from onaptests.steps.base import YamlTemplateBaseStep +from onaptests.scenario.scenario_base import BaseStep, ScenarioBase, YamlTemplateBaseScenarioStep from onaptests.steps.instantiate.service_macro import \ YamlTemplateServiceMacroInstantiateStep from onaptests.steps.onboard.cds import CbaPublishStep -from onaptests.utils.exceptions import OnapTestException from yaml import SafeLoader, load -class MultiVnfUbuntuMacroStep(YamlTemplateBaseStep): +class MultiVnfUbuntuMacroStep(YamlTemplateBaseScenarioStep): - def __init__(self, cleanup=False): + def __init__(self): """Initialize step. Substeps: - CbaPublishStep - YamlTemplateServiceAlaCarteInstantiateStep. """ - super().__init__(cleanup=cleanup) + super().__init__(cleanup=BaseStep.HAS_NO_CLEANUP) self._yaml_template: dict = None self._model_yaml_template: dict = None - self.add_step(CbaPublishStep( - cleanup=settings.CLEANUP_FLAG - )) - self.add_step(YamlTemplateServiceMacroInstantiateStep( - cleanup=settings.CLEANUP_FLAG - )) + self.add_step(CbaPublishStep()) + self.add_step(YamlTemplateServiceMacroInstantiateStep()) @property def description(self) -> str: @@ -105,32 +95,7 @@ class MultiVnfUbuntuMacroStep(YamlTemplateBaseStep): class MultiVnfUbuntuMacro(ScenarioBase): """Instantiate a basic vm macro.""" - __logger = logging.getLogger(__name__) - def __init__(self, **kwargs): """Init Basic Macro use case.""" super().__init__('nso_ubuntu_macro', **kwargs) - self.test = MultiVnfUbuntuMacroStep(cleanup=settings.CLEANUP_FLAG) - - def run(self): - """Run NSO Ubuntu macro test.""" - self.start_time = time.time() - try: - self.test.execute() - self.__logger.info("Starting to clean up in {} seconds".format( - settings.CLEANUP_ACTIVITY_TIMER)) - time.sleep(settings.CLEANUP_ACTIVITY_TIMER) - self.test.cleanup() - self.result = 100 - 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() - - def clean(self): - """Generate report.""" - self.test.reports_collection.generate_report() + self.test = MultiVnfUbuntuMacroStep() |