aboutsummaryrefslogtreecommitdiffstats
path: root/src/onaptests/scenario/cds_resource_resolution.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/onaptests/scenario/cds_resource_resolution.py')
-rw-r--r--src/onaptests/scenario/cds_resource_resolution.py54
1 files changed, 8 insertions, 46 deletions
diff --git a/src/onaptests/scenario/cds_resource_resolution.py b/src/onaptests/scenario/cds_resource_resolution.py
index 470f030..fcc3e93 100644
--- a/src/onaptests/scenario/cds_resource_resolution.py
+++ b/src/onaptests/scenario/cds_resource_resolution.py
@@ -1,36 +1,24 @@
#!/usr/bin/env python
"""CDS resource resolution test scenario."""
-
-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 BaseStep
+from onaptests.scenario.scenario_base import BaseStep, ScenarioBase, BaseScenarioStep
from onaptests.steps.onboard.cds import CbaProcessStep
from onaptests.steps.simulator.cds_mockserver import \
CdsMockserverCnfConfigureStep
-from onaptests.utils.exceptions import OnapTestException
-class CDSResourceResolutionStep(BaseStep):
+class CDSResourceResolutionStep(BaseScenarioStep):
"""Step created to run scenario and generate report."""
- def __init__(self, cleanup=False):
+ def __init__(self):
"""Initialize step.
Substeps:
- CdsMockserverCnfConfigureStep,
- CbaProcessStep.
"""
- super().__init__(cleanup=cleanup)
- self.add_step(CdsMockserverCnfConfigureStep(
- cleanup=cleanup
- ))
- self.add_step(CbaProcessStep(
- cleanup=cleanup
- ))
+ super().__init__(cleanup=BaseStep.HAS_NO_CLEANUP)
+ self.add_step(CdsMockserverCnfConfigureStep())
+ self.add_step(CbaProcessStep())
@property
def description(self) -> str:
@@ -55,39 +43,13 @@ class CDSResourceResolutionStep(BaseStep):
str: Component name
"""
- return "PythonSDK-tests"
+ return "TEST"
class CDSResourceResolution(ScenarioBase):
"""Enrich simple blueprint using CDS blueprintprocessor."""
- __logger = logging.getLogger(__name__)
-
def __init__(self, **kwargs):
"""Init CDS resource resolution use case."""
super().__init__('basic_cds', **kwargs)
- self.test = CDSResourceResolutionStep(
- cleanup=settings.CLEANUP_FLAG)
- self.start_time = None
- self.stop_time = None
- self.result = 0
-
- def run(self):
- self.__logger.debug("CDS resource resolution run")
- 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):
- """Clean Additional resources if needed."""
- self.__logger.info("Generate Test report")
- self.test.reports_collection.generate_report()
+ self.test = CDSResourceResolutionStep()