aboutsummaryrefslogtreecommitdiffstats
path: root/src/onaptests/steps/onboard
diff options
context:
space:
mode:
Diffstat (limited to 'src/onaptests/steps/onboard')
-rw-r--r--src/onaptests/steps/onboard/clamp.py4
-rw-r--r--src/onaptests/steps/onboard/pnf.py4
-rw-r--r--src/onaptests/steps/onboard/service.py22
-rw-r--r--src/onaptests/steps/onboard/vf.py17
-rw-r--r--src/onaptests/steps/onboard/vsp.py17
5 files changed, 61 insertions, 3 deletions
diff --git a/src/onaptests/steps/onboard/clamp.py b/src/onaptests/steps/onboard/clamp.py
index afbd7cb..9d73a8e 100644
--- a/src/onaptests/steps/onboard/clamp.py
+++ b/src/onaptests/steps/onboard/clamp.py
@@ -54,6 +54,10 @@ class OnboardClampStep(YamlTemplateBaseStep):
return self.parent.yaml_template
@property
+ def model_yaml_template(self) -> dict:
+ return {}
+
+ @property
def service_name(self) -> str:
"""Service name.
diff --git a/src/onaptests/steps/onboard/pnf.py b/src/onaptests/steps/onboard/pnf.py
index 2ec44e2..4e3303e 100644
--- a/src/onaptests/steps/onboard/pnf.py
+++ b/src/onaptests/steps/onboard/pnf.py
@@ -99,6 +99,10 @@ class YamlTemplatePnfOnboardStep(YamlTemplateBaseStep):
"""
return self.parent.yaml_template[self.parent.service_name]
+ @property
+ def model_yaml_template(self) -> dict:
+ return {}
+
@YamlTemplateBaseStep.store_state
def execute(self):
"""Onboard PNFs from YAML template."""
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.
diff --git a/src/onaptests/steps/onboard/vf.py b/src/onaptests/steps/onboard/vf.py
index 76aaf2e..44c3749 100644
--- a/src/onaptests/steps/onboard/vf.py
+++ b/src/onaptests/steps/onboard/vf.py
@@ -80,7 +80,22 @@ class YamlTemplateVfOnboardStep(YamlTemplateBaseStep):
dict: YAML template
"""
- return self.parent.yaml_template[self.parent.service_name]
+ if settings.MODEL_YAML_TEMPLATE:
+ return self.model_yaml_template
+ else:
+ return self.parent.yaml_template[self.parent.service_name]
+
+ @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
+
+ """
+ return self.parent.model_yaml_template[self.parent.service_name]
@YamlTemplateBaseStep.store_state
def execute(self):
diff --git a/src/onaptests/steps/onboard/vsp.py b/src/onaptests/steps/onboard/vsp.py
index 6f8fbf6..5462c55 100644
--- a/src/onaptests/steps/onboard/vsp.py
+++ b/src/onaptests/steps/onboard/vsp.py
@@ -77,7 +77,22 @@ class YamlTemplateVspOnboardStep(YamlTemplateBaseStep):
dict: YAML template
"""
- return self.parent.yaml_template
+ if settings.MODEL_YAML_TEMPLATE:
+ return self.model_yaml_template
+ else:
+ return self.parent.yaml_template
+
+ @property
+ def model_yaml_template(self) -> dict:
+ """Model YAML template.
+
+ Get model YAML template from parent.
+
+ Returns:
+ dict: YAML template
+
+ """
+ return self.parent.model_yaml_template
@YamlTemplateBaseStep.store_state
def execute(self):