diff options
Diffstat (limited to 'src/onaptests/scenario/pnf_macro.py')
-rw-r--r-- | src/onaptests/scenario/pnf_macro.py | 51 |
1 files changed, 9 insertions, 42 deletions
diff --git a/src/onaptests/scenario/pnf_macro.py b/src/onaptests/scenario/pnf_macro.py index 7ecf3c2..a07404f 100644 --- a/src/onaptests/scenario/pnf_macro.py +++ b/src/onaptests/scenario/pnf_macro.py @@ -1,40 +1,28 @@ """Instantiate service with PNF 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 CbaEnrichStep from onaptests.steps.simulator.pnf_simulator_cnf.pnf_register import \ PnfSimulatorCnfRegisterStep -from onaptests.utils.exceptions import OnapTestException from yaml import SafeLoader, load -class PnfMacroScenarioStep(YamlTemplateBaseStep): +class PnfMacroScenarioStep(YamlTemplateBaseScenarioStep): """Step created to run scenarion and generate report.""" - def __init__(self, cleanup=False): + def __init__(self): """Initialize step. Substeps: - YamlTemplateServiceAlaCarteInstantiateStep. """ - super().__init__(cleanup=cleanup) + super().__init__(cleanup=BaseStep.HAS_NO_CLEANUP) self._yaml_template: dict = None - self.add_step(PnfSimulatorCnfRegisterStep( - cleanup=cleanup - )) - self.add_step(CbaEnrichStep( - cleanup=cleanup - )) - self.add_step(YamlTemplateServiceMacroInstantiateStep( - cleanup=cleanup - )) + self.add_step(PnfSimulatorCnfRegisterStep()) + self.add_step(CbaEnrichStep()) + self.add_step(YamlTemplateServiceMacroInstantiateStep()) @property def description(self) -> str: @@ -59,7 +47,7 @@ class PnfMacroScenarioStep(YamlTemplateBaseStep): str: Component name """ - return "PythonSDK-tests" + return "TEST" @property def yaml_template(self) -> dict: @@ -106,28 +94,7 @@ class PnfMacroScenarioStep(YamlTemplateBaseStep): class PnfMacro(ScenarioBase): """Run PNF simulator and onboard then instantiate a service with PNF.""" - __logger = logging.getLogger(__name__) - def __init__(self, **kwargs): """Init Basic Network use case.""" super().__init__('pnf_macro', **kwargs) - self.test = PnfMacroScenarioStep(cleanup=settings.CLEANUP_FLAG) - - def run(self): - """Run PNF macro test.""" - self.start_time = time.time() - try: - for test_phase in (self.test.execute, self.test.cleanup): - try: - test_phase() - self.result += 50 - except OnapTestException as exc: - self.__logger.exception(exc.error_message) - except SDKException: - self.__logger.exception("SDK Exception") - finally: - self.stop_time = time.time() - - def clean(self): - """Generate report.""" - self.test.reports_collection.generate_report() + self.test = PnfMacroScenarioStep() |