aboutsummaryrefslogtreecommitdiffstats
path: root/src/onaptests/steps/onboard
diff options
context:
space:
mode:
authorandreasgeissler <andreas-geissler@telekom.de>2020-10-12 18:05:46 +0200
committermrichomme <morgan.richomme@orange.com>2020-10-16 10:06:41 +0200
commit8642324e0b95b9efef53a7d62b419d72aed617b6 (patch)
tree40d76e3b8d312033aad592e8629cf538d36d2eb3 /src/onaptests/steps/onboard
parente39466fadd289f279509e460f6222d9c08f53c56 (diff)
Added basic_network testcase
Issue-ID: TEST-255 Signed-off-by: andreasgeissler <andreas-geissler@telekom.de> Change-Id: I86b34c0980cee7a5824231591a60d1f50dfe4f37 Signed-off-by: mrichomme <morgan.richomme@orange.com>
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()