2 """CDS resource resolution test scenario."""
7 from onapsdk.configuration import settings
8 from onapsdk.exceptions import SDKException
9 from onaptests.scenario.scenario_base import ScenarioBase
10 from onaptests.steps.base import BaseStep
11 from onaptests.steps.onboard.cds import CbaProcessStep
12 from onaptests.steps.simulator.cds_mockserver import \
13 CdsMockserverCnfConfigureStep
14 from onaptests.utils.exceptions import OnapTestException
18 class CDSResourceResolutionStep(BaseStep):
19 """Step created to run scenario and generate report."""
21 def __init__(self, cleanup=False):
25 - CdsMockserverCnfConfigureStep,
28 super().__init__(cleanup=cleanup)
29 self.add_step(CdsMockserverCnfConfigureStep(
32 self.add_step(CbaProcessStep(
37 def description(self) -> str:
46 return "CDS resource-resoulution base step"
49 def component(self) -> str:
52 Name of the component this step relates to.
53 Usually the name of ONAP component.
59 return "PythonSDK-tests"
62 class CDSResourceResolution(ScenarioBase):
63 """Enrich simple blueprint using CDS blueprintprocessor."""
65 __logger = logging.getLogger(__name__)
67 def __init__(self, **kwargs):
68 """Init CDS resource resolution use case."""
69 super().__init__('basic_cds', **kwargs)
70 self.test = CDSResourceResolutionStep(
71 cleanup=settings.CLEANUP_FLAG)
72 self.start_time = None
77 self.__logger.debug("CDS resource resolution run")
78 self.start_time = time.time()
80 for test_phase in (self.test.execute, self.test.cleanup):
84 except OnapTestException as exc:
85 self.__logger.exception(exc.error_message)
87 self.__logger.exception("SDK Exception")
89 self.stop_time = time.time()
92 """Clean Additional resources if needed."""
93 self.__logger.info("Generate Test report")
94 self.test.reports_collection.generate_report()