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
17 class CDSResourceResolutionStep(BaseStep):
18 """Step created to run scenario and generate report."""
20 def __init__(self, cleanup=False):
24 - CdsMockserverCnfConfigureStep,
27 super().__init__(cleanup=cleanup)
28 self.add_step(CdsMockserverCnfConfigureStep(
31 self.add_step(CbaProcessStep(
36 def description(self) -> str:
45 return "CDS resource-resoulution base step"
48 def component(self) -> str:
51 Name of the component this step relates to.
52 Usually the name of ONAP component.
58 return "PythonSDK-tests"
61 class CDSResourceResolution(ScenarioBase):
62 """Enrich simple blueprint using CDS blueprintprocessor."""
64 __logger = logging.getLogger(__name__)
66 def __init__(self, **kwargs):
67 """Init CDS resource resolution use case."""
68 super().__init__('basic_cds', **kwargs)
69 self.test = CDSResourceResolutionStep(
70 cleanup=settings.CLEANUP_FLAG)
71 self.start_time = None
76 self.__logger.debug("CDS resource resolution run")
77 self.start_time = time.time()
79 for test_phase in (self.test.execute, self.test.cleanup):
83 except OnapTestException as exc:
84 self.__logger.exception(exc.error_message)
86 self.__logger.exception("SDK Exception")
88 self.stop_time = time.time()
91 """Clean Additional resources if needed."""
92 self.__logger.info("Generate Test report")
93 self.test.reports_collection.generate_report()