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/service.py27
-rw-r--r--src/onaptests/steps/onboard/vf.py9
-rw-r--r--src/onaptests/steps/onboard/vsp.py15
3 files changed, 35 insertions, 16 deletions
diff --git a/src/onaptests/steps/onboard/service.py b/src/onaptests/steps/onboard/service.py
index 87211bd..86a2e6a 100644
--- a/src/onaptests/steps/onboard/service.py
+++ b/src/onaptests/steps/onboard/service.py
@@ -3,6 +3,7 @@ from yaml import load
from onapsdk.configuration import settings
from onapsdk.sdc.service import Service
from onapsdk.sdc.vf import Vf
+from onapsdk.sdc.vl import Vl
from ..base import BaseStep, YamlTemplateBaseStep
from .vf import VfOnboardStep, YamlTemplateVfOnboardStep
@@ -25,13 +26,21 @@ class ServiceOnboardStep(BaseStep):
"""Onboard service.
Use settings values:
+ - VL_NAME,
- VF_NAME,
- SERVICE_NAME.
"""
super().execute()
- vf: Vf = Vf(name=settings.VF_NAME)
- service: Service = Service(name=settings.SERVICE_NAME, resources=[vf])
+ service: Service = Service(name=settings.SERVICE_NAME)
+ service.create()
+ if settings.VL_NAME != "":
+ vl: Vl = Vl(name=settings.VL_NAME)
+ service.add_resource(vl)
+ if settings.VF_NAME != "":
+ vf: Vf = Vf(name=settings.VF_NAME)
+ service.add_resource(vf)
+ service.checkin()
service.onboard()
@@ -84,7 +93,15 @@ class YamlTemplateServiceOnboardStep(YamlTemplateBaseStep):
def execute(self):
"""Onboard service."""
super().execute()
- service: Service = Service(name=self.service_name,
- resources=[Vf(name=vnf["vnf_name"]) \
- for vnf in self.yaml_template[self.service_name]["vnfs"]])
+ service: Service = Service(name=settings.SERVICE_NAME)
+ service.create()
+ if "networks" in self.yaml_template[self.service_name]:
+ for net in self.yaml_template[self.service_name]["networks"]:
+ vl: Vl = Vl(name=net['vl_name'])
+ service.add_resource(vl)
+ if "vnfs" in self.yaml_template[self.service_name]:
+ for vnf in self.yaml_template[self.service_name]["vnfs"]:
+ vf: Vf = Vf(name=vnf["vnf_name"])
+ service.add_resource(vf)
+ service.checkin()
service.onboard()
diff --git a/src/onaptests/steps/onboard/vf.py b/src/onaptests/steps/onboard/vf.py
index f26d66d..18b56f3 100644
--- a/src/onaptests/steps/onboard/vf.py
+++ b/src/onaptests/steps/onboard/vf.py
@@ -61,7 +61,8 @@ class YamlTemplateVfOnboardStep(YamlTemplateBaseStep):
def execute(self):
"""Onboard Vfs from YAML template."""
super().execute()
- for vnf in self.yaml_template["vnfs"]:
- vsp: Vsp = Vsp(name=f"{vnf['vnf_name']}_VSP")
- vf: Vf = Vf(name=vnf['vnf_name'], vsp=vsp)
- vf.onboard()
+ if "vnfs" in self.yaml_template:
+ for vnf in self.yaml_template["vnfs"]:
+ vsp: Vsp = Vsp(name=f"{vnf['vnf_name']}_VSP")
+ vf: Vf = Vf(name=vnf['vnf_name'], vsp=vsp)
+ vf.onboard()
diff --git a/src/onaptests/steps/onboard/vsp.py b/src/onaptests/steps/onboard/vsp.py
index ba6020a..e0761ab 100644
--- a/src/onaptests/steps/onboard/vsp.py
+++ b/src/onaptests/steps/onboard/vsp.py
@@ -68,10 +68,11 @@ class YamlTemplateVspOnboardStep(YamlTemplateBaseStep):
"""
super().execute()
vendor: Vendor = Vendor(name=settings.VENDOR_NAME)
- for vnf in self.yaml_template["vnfs"]:
- with open(
- sys.path[-1] + "/" + vnf["heat_files_to_upload"], "rb") as package:
- vsp: Vsp = Vsp(name=f"{vnf['vnf_name']}_VSP",
- vendor=vendor,
- package=package)
- vsp.onboard()
+ if "vnfs" in self.yaml_template:
+ for vnf in self.yaml_template["vnfs"]:
+ with open(
+ sys.path[-1] + "/" + vnf["heat_files_to_upload"], "rb") as package:
+ vsp: Vsp = Vsp(name=f"{vnf['vnf_name']}_VSP",
+ vendor=vendor,
+ package=package)
+ vsp.onboard()