diff options
Diffstat (limited to 'src/onaptests/steps/onboard/service.py')
-rw-r--r-- | src/onaptests/steps/onboard/service.py | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/onaptests/steps/onboard/service.py b/src/onaptests/steps/onboard/service.py index ee2d3ab..db1b330 100644 --- a/src/onaptests/steps/onboard/service.py +++ b/src/onaptests/steps/onboard/service.py @@ -86,6 +86,7 @@ class YamlTemplateServiceOnboardStep(YamlTemplateBaseStep): """ super().__init__(cleanup=cleanup) self._yaml_template: dict = None + self._model_yaml_template: dict = None if "vnfs" in self.yaml_template[self.service_name]: self.add_step(YamlTemplateVfOnboardStep(cleanup=cleanup)) if "pnfs" in self.yaml_template[self.service_name]: @@ -111,7 +112,9 @@ class YamlTemplateServiceOnboardStep(YamlTemplateBaseStep): dict: Step YAML template """ - if self.is_root: + if settings.MODEL_YAML_TEMPLATE: + return self.model_yaml_template + elif self.is_root: if not self._yaml_template: with open(settings.SERVICE_YAML_TEMPLATE, "r") as yaml_template: self._yaml_template: dict = load(yaml_template) @@ -119,6 +122,23 @@ class YamlTemplateServiceOnboardStep(YamlTemplateBaseStep): return self.parent.yaml_template @property + def model_yaml_template(self) -> dict: + """Step Model YAML template. + + Load from file if it's a root step, get from parent otherwise. + + Returns: + dict: Step YAML template + + """ + if self.is_root: + if not self._model_yaml_template: + with open(settings.MODEL_YAML_TEMPLATE, "r") as model_yaml_template: + self._model_yaml_template: dict = load(model_yaml_template) + return self._model_yaml_template + return self.parent.model_yaml_template + + @property def service_name(self) -> str: """Service name. |