diff options
author | Lukasz Rajewski <lukasz.rajewski@t-mobile.pl> | 2024-02-10 16:17:20 +0100 |
---|---|---|
committer | Lukasz Rajewski <lukasz.rajewski@t-mobile.pl> | 2024-02-12 10:05:15 +0100 |
commit | 858f92861731a4e73668eff3d7a665507965d9a4 (patch) | |
tree | 7113d6a02e55befbb71dbd091d0cf75b1063441b /src/onaptests/scenario | |
parent | af615065352ab1bb059f221cc1fdb0b9b05eacac (diff) |
Improve verification of distribution status
- distribution excluded from instantiation
- more steps to get details of error
Issue-ID: TEST-404
Signed-off-by: Lukasz Rajewski <lukasz.rajewski@t-mobile.pl>
Change-Id: I2770a4d6ec6887b6e7b54e31ee4979c2b18e5d20
Diffstat (limited to 'src/onaptests/scenario')
-rw-r--r-- | src/onaptests/scenario/basic_onboard.py | 72 |
1 files changed, 69 insertions, 3 deletions
diff --git a/src/onaptests/scenario/basic_onboard.py b/src/onaptests/scenario/basic_onboard.py index 6f10765..ae1ba8c 100644 --- a/src/onaptests/scenario/basic_onboard.py +++ b/src/onaptests/scenario/basic_onboard.py @@ -1,7 +1,73 @@ #!/usr/bin/env python """Basic Onboard test case.""" -from onaptests.scenario.scenario_base import ScenarioBase -from onaptests.steps.onboard.service import YamlTemplateServiceOnboardStep +from onapsdk.configuration import settings +from yaml import SafeLoader, load + +from onaptests.scenario.scenario_base import (BaseStep, ScenarioBase, + YamlTemplateBaseScenarioStep) +from onaptests.steps.onboard.service import (VerifyServiceDistributionStep, + YamlTemplateServiceOnboardStep) + + +class BasicSdcOnboardStep(YamlTemplateBaseScenarioStep): + """Main basic onboard scenario step.""" + + def __init__(self): + """Initialize step. + + Substeps: + - YamlTemplateServiceOnboardStep + - VerifyServiceDistributionStep (optional). + """ + super().__init__(cleanup=BaseStep.HAS_NO_CLEANUP) + self._yaml_template: dict = None + self.add_step(YamlTemplateServiceOnboardStep()) + if settings.VERIFY_DISTRIBUTION: + self.add_step(VerifyServiceDistributionStep()) + + @property + def description(self) -> str: + """Step description. + + Used for reports + + Returns: + str: Step description + + """ + return "Basic SDC Onboard scenario step" + + @property + def component(self) -> str: + """Component name. + + Name of component which step is related with. + Most is the name of ONAP component. + + Returns: + str: Component name + + """ + return "SDC" + + @property + def yaml_template(self) -> dict: + """YAML template abstract property. + + Every YAML template step need to implement that property. + + Returns: + dict: YAML template + + """ + if not self._yaml_template: + with open(settings.SERVICE_YAML_TEMPLATE, "r", encoding="utf-8") as yaml_template: + self._yaml_template: dict = load(yaml_template, SafeLoader) + return self._yaml_template + + @property + def model_yaml_template(self) -> dict: + return {} class BasicOnboard(ScenarioBase): @@ -11,4 +77,4 @@ class BasicOnboard(ScenarioBase): """Init BasicOnboard.""" # import basic_onboard_settings needed super().__init__('basic_onboard', **kwargs) - self.test = YamlTemplateServiceOnboardStep() + self.test = BasicSdcOnboardStep() |