aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/onaptests/configuration/basic_clamp_settings.py2
-rw-r--r--src/onaptests/configuration/basic_cnf_yaml_settings.py2
-rw-r--r--src/onaptests/configuration/basic_network_nomulticloud_settings.py2
-rw-r--r--src/onaptests/configuration/basic_onboard_settings.py2
-rw-r--r--src/onaptests/configuration/basic_vm_macro_settings.py2
-rw-r--r--src/onaptests/configuration/basic_vm_macro_stability_settings.py1
-rw-r--r--src/onaptests/configuration/basic_vm_multicloud_yaml_settings.py1
-rw-r--r--src/onaptests/configuration/basic_vm_settings.py2
-rw-r--r--src/onaptests/configuration/clearwater_ims_nomulticloud_settings.py2
-rw-r--r--src/onaptests/configuration/multi_vnf_ubuntu_settings.py82
-rw-r--r--src/onaptests/configuration/pnf_macro_settings.py3
-rw-r--r--src/onaptests/scenario/basic_vm_macro.py4
-rw-r--r--src/onaptests/scenario/multi_vnf_macro.py139
-rw-r--r--src/onaptests/scenario/pnf_macro.py4
-rw-r--r--src/onaptests/steps/base.py12
-rw-r--r--src/onaptests/steps/instantiate/service_ala_carte.py4
-rw-r--r--src/onaptests/steps/instantiate/service_macro.py65
-rw-r--r--src/onaptests/steps/instantiate/vf_module_ala_carte.py4
-rw-r--r--src/onaptests/steps/instantiate/vl_ala_carte.py4
-rw-r--r--src/onaptests/steps/instantiate/vnf_ala_carte.py4
-rw-r--r--src/onaptests/steps/loop/clamp.py4
-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
-rw-r--r--src/onaptests/templates/vnf-services/multi-vnf-ubuntu-model.yaml.j216
-rw-r--r--src/onaptests/templates/vnf-services/multi-vnf-ubuntu-service.yaml.j235
28 files changed, 440 insertions, 20 deletions
diff --git a/src/onaptests/configuration/basic_clamp_settings.py b/src/onaptests/configuration/basic_clamp_settings.py
index 1c6ad61..c26c4e9 100644
--- a/src/onaptests/configuration/basic_clamp_settings.py
+++ b/src/onaptests/configuration/basic_clamp_settings.py
@@ -52,3 +52,5 @@ try:
except ValueError:
SERVICE_NAME = "" # Fill me
VF_NAME = "" # Fill me
+
+MODEL_YAML_TEMPLATE = None
diff --git a/src/onaptests/configuration/basic_cnf_yaml_settings.py b/src/onaptests/configuration/basic_cnf_yaml_settings.py
index b68b7df..38e551c 100644
--- a/src/onaptests/configuration/basic_cnf_yaml_settings.py
+++ b/src/onaptests/configuration/basic_cnf_yaml_settings.py
@@ -79,3 +79,5 @@ VIM_PASSWORD = cloud.config.auth.get('password','dummy123')
VIM_SERVICE_URL = cloud.config.auth.get('auth_url','http://10.12.25.2:5000/v3')
TENANT_ID = cloud.config.auth.get('project_id','123456')
TENANT_NAME = cloud.config.auth.get('project_name','dummy_test')
+
+MODEL_YAML_TEMPLATE = None
diff --git a/src/onaptests/configuration/basic_network_nomulticloud_settings.py b/src/onaptests/configuration/basic_network_nomulticloud_settings.py
index cc22601..ab9e5ab 100644
--- a/src/onaptests/configuration/basic_network_nomulticloud_settings.py
+++ b/src/onaptests/configuration/basic_network_nomulticloud_settings.py
@@ -66,3 +66,5 @@ TENANT_ID = cloud.config.auth.get('project_id','Fill me')
TENANT_NAME = cloud.config.auth.get('project_name','Fill me')
CLOUD_REGION_ID = cloud.config.auth.get('region_name','RegionOne')
CLOUD_DOMAIN = cloud.config.auth.get('project_domain_name','Default')
+
+MODEL_YAML_TEMPLATE = None
diff --git a/src/onaptests/configuration/basic_onboard_settings.py b/src/onaptests/configuration/basic_onboard_settings.py
index db7680d..2fa1820 100644
--- a/src/onaptests/configuration/basic_onboard_settings.py
+++ b/src/onaptests/configuration/basic_onboard_settings.py
@@ -66,3 +66,5 @@ VENDOR_NAME = "basic_onboard_vendor"
VF_NAME = "basic_onboard_vf"
VSP_NAME = "basic_onboard_vsp"
+
+MODEL_YAML_TEMPLATE = None
diff --git a/src/onaptests/configuration/basic_vm_macro_settings.py b/src/onaptests/configuration/basic_vm_macro_settings.py
index b29cd1d..2784f86 100644
--- a/src/onaptests/configuration/basic_vm_macro_settings.py
+++ b/src/onaptests/configuration/basic_vm_macro_settings.py
@@ -59,3 +59,5 @@ except (FileNotFoundError, ValueError):
raise onap_test_exceptions.TestConfigurationException
SERVICE_INSTANCE_NAME = f"basic_macro_{str(uuid4())}"
+
+MODEL_YAML_TEMPLATE = None
diff --git a/src/onaptests/configuration/basic_vm_macro_stability_settings.py b/src/onaptests/configuration/basic_vm_macro_stability_settings.py
index 06938c4..b2fe037 100644
--- a/src/onaptests/configuration/basic_vm_macro_stability_settings.py
+++ b/src/onaptests/configuration/basic_vm_macro_stability_settings.py
@@ -2,3 +2,4 @@ from .basic_vm_macro_settings import * # pylint: disable=W0614
SERVICE_YAML_TEMPLATE = Path(Path(__file__).parent.parent, "templates/vnf-services/" +
"basic_vm_macro_stability-service.yaml")
+MODEL_YAML_TEMPLATE = None
diff --git a/src/onaptests/configuration/basic_vm_multicloud_yaml_settings.py b/src/onaptests/configuration/basic_vm_multicloud_yaml_settings.py
index 437bd13..51c74e5 100644
--- a/src/onaptests/configuration/basic_vm_multicloud_yaml_settings.py
+++ b/src/onaptests/configuration/basic_vm_multicloud_yaml_settings.py
@@ -41,3 +41,4 @@ PLATFORM = "sdktests_platform"
SERVICE_INSTANCE_NAME = "sdktests_service_instance_name"
SERVICE_YAML_TEMPLATE = sys.path[-1] + "/onaptests/templates/vnf-services/basic_vm-service.yaml"
+MODEL_YAML_TEMPLATE = None
diff --git a/src/onaptests/configuration/basic_vm_settings.py b/src/onaptests/configuration/basic_vm_settings.py
index a62e0b1..2c7d85f 100644
--- a/src/onaptests/configuration/basic_vm_settings.py
+++ b/src/onaptests/configuration/basic_vm_settings.py
@@ -70,3 +70,5 @@ TENANT_ID = cloud.config.auth.get('project_id','Fill me')
TENANT_NAME = cloud.config.auth.get('project_name','Fill me')
CLOUD_REGION_ID = cloud.config.auth.get('region_name','RegionOne')
CLOUD_DOMAIN = cloud.config.auth.get('project_domain_name','Default')
+
+MODEL_YAML_TEMPLATE = None
diff --git a/src/onaptests/configuration/clearwater_ims_nomulticloud_settings.py b/src/onaptests/configuration/clearwater_ims_nomulticloud_settings.py
index 1a1cb3c..d20d9ff 100644
--- a/src/onaptests/configuration/clearwater_ims_nomulticloud_settings.py
+++ b/src/onaptests/configuration/clearwater_ims_nomulticloud_settings.py
@@ -62,3 +62,5 @@ TENANT_ID = cloud.config.auth.get('project_id','Fill me')
TENANT_NAME = cloud.config.auth.get('project_name','Fill me')
CLOUD_REGION_ID = cloud.config.get('region_name','RegionOne')
CLOUD_DOMAIN = cloud.config.auth.get('project_domain_name','Default')
+
+MODEL_YAML_TEMPLATE = None
diff --git a/src/onaptests/configuration/multi_vnf_ubuntu_settings.py b/src/onaptests/configuration/multi_vnf_ubuntu_settings.py
new file mode 100644
index 0000000..47795fd
--- /dev/null
+++ b/src/onaptests/configuration/multi_vnf_ubuntu_settings.py
@@ -0,0 +1,82 @@
+import uuid
+import os
+import sys
+from pathlib import Path
+import openstack
+from jinja2 import Environment, PackageLoader
+from .settings import * # pylint: disable=W0614
+
+VNF_FILENAME_PREFIX = "multi-vnf-ubuntu"
+SERVICE_NAME = f"multivnfubuntu{str(uuid.uuid4().hex)[:6]}"
+
+
+# We need to create a service file with a random service name,
+# to be sure that we force onboarding
+def generate_service_config_yaml_file(filename):
+ """ generate the service file with a random service name
+ from a jinja template"""
+
+ env = Environment(
+ loader=PackageLoader('onaptests', 'templates/vnf-services'),
+ )
+ template = env.get_template(f"{filename}.yaml.j2")
+
+ rendered_template = template.render(service_name=SERVICE_NAME)
+
+ file_name = (sys.path[-1] + "/onaptests/templates/vnf-services/" +
+ f"{filename}.yaml")
+
+ with open(file_name, 'w+') as file_to_write:
+ file_to_write.write(rendered_template)
+
+
+CLEANUP_FLAG = True
+
+CDS_DD_FILE = Path(Path(__file__).parent.parent, "templates/artifacts/dd_nso_ubuntu.json")
+CDS_CBA_UNENRICHED = Path(Path(__file__).parent.parent, "templates/artifacts/nso_ubuntuvnf.zip")
+CDS_CBA_ENRICHED = "/tmp/UBUNTUVNF_enriched.zip"
+
+ONLY_INSTANTIATE = False
+USE_MULTICLOUD = False
+
+CLOUD_REGION_CLOUD_OWNER = "Bell-IaaS"
+CLOUD_REGION_TYPE = "openstack"
+CLOUD_REGION_VERSION = "v1"
+CLOUD_OWNER_DEFINED_TYPE = "VNF"
+
+AVAILABILITY_ZONE_NAME = "z1"
+AVAILABILITY_ZONE_TYPE = "nova"
+COMPLEX_PHYSICAL_LOCATION_ID = "nso-lab-ltec"
+COMPLEX_DATA_CENTER_CODE = "nlt"
+
+GLOBAL_CUSTOMER_ID = "ubuntu-customer"
+
+TEST_CLOUD = os.getenv('OS_TEST_CLOUD') # Get values from clouds.yaml
+cloud = openstack.connect(cloud=TEST_CLOUD)
+VIM_USERNAME = cloud.config.auth.get('username', 'nso')
+VIM_PASSWORD = cloud.config.auth.get('password', 'Password123')
+VIM_SERVICE_URL = cloud.config.auth.get('auth_url', 'https://10.195.194.215:5000')
+TENANT_ID = cloud.config.auth.get('project_id', 'e2710e84063b421fab08189818761d55')
+TENANT_NAME = cloud.config.auth.get('project_name', 'nso')
+CLOUD_REGION_ID = cloud.config.auth.get('region_name', 'nso215')
+CLOUD_DOMAIN = cloud.config.auth.get('project_domain_name', 'Default')
+
+OWNING_ENTITY = "seb"
+PROJECT = "Project-UbuntuDemo"
+LINE_OF_BUSINESS = "wireless"
+PLATFORM = "iaas-openstack"
+CLOUD_DOMAIN = "Default"
+
+VENDOR_NAME = 'ubuntu_xtesting_vendor'
+
+SERVICE_YAML_TEMPLATE = Path(Path(__file__).parent.parent, "templates/vnf-services/" +
+ f"{VNF_FILENAME_PREFIX}-service.yaml")
+
+MODEL_YAML_TEMPLATE = Path(Path(__file__).parent.parent, "templates/vnf-services/" +
+ f"{VNF_FILENAME_PREFIX}-model.yaml")
+
+
+generate_service_config_yaml_file(f"{VNF_FILENAME_PREFIX}-service")
+generate_service_config_yaml_file(f"{VNF_FILENAME_PREFIX}-model")
+
+SERVICE_INSTANCE_NAME = f"{SERVICE_NAME}_svc"
diff --git a/src/onaptests/configuration/pnf_macro_settings.py b/src/onaptests/configuration/pnf_macro_settings.py
index d9ccb1b..515fce1 100644
--- a/src/onaptests/configuration/pnf_macro_settings.py
+++ b/src/onaptests/configuration/pnf_macro_settings.py
@@ -48,3 +48,6 @@ SERVICE_INSTANCE_NAME = "TestPNFMacroInstantiation"
DCAE_VES_COLLECTOR_POD_NAME = "dcae-ves-collector"
PNF_WAIT_TIME = 60.0
PNF_REGISTRATION_NUMBER_OF_TRIES = 20
+
+# Disable YAML SDC model definition which means all SDC config reside in SERVICE_YAML_TEMPLATE
+MODEL_YAML_TEMPLATE = None
diff --git a/src/onaptests/scenario/basic_vm_macro.py b/src/onaptests/scenario/basic_vm_macro.py
index f22ee12..67dded9 100644
--- a/src/onaptests/scenario/basic_vm_macro.py
+++ b/src/onaptests/scenario/basic_vm_macro.py
@@ -72,6 +72,10 @@ class BasicVmMacroStep(YamlTemplateBaseStep):
return self._yaml_template
@property
+ def model_yaml_template(self) -> dict:
+ return {}
+
+ @property
def service_name(self) -> dict:
"""Service name.
diff --git a/src/onaptests/scenario/multi_vnf_macro.py b/src/onaptests/scenario/multi_vnf_macro.py
new file mode 100644
index 0000000..284baf0
--- /dev/null
+++ b/src/onaptests/scenario/multi_vnf_macro.py
@@ -0,0 +1,139 @@
+"""Instantiate basic vm using SO macro flow."""
+import logging
+import time
+
+from yaml import load
+
+from onapsdk.configuration import settings
+from onapsdk.exceptions import SDKException
+from xtesting.core import testcase
+
+from onaptests.steps.base import YamlTemplateBaseStep
+from onaptests.steps.onboard.cds import CbaPublishStep
+from onaptests.utils.exceptions import OnapTestException
+from onaptests.steps.instantiate.service_macro import YamlTemplateServiceMacroInstantiateStep
+
+
+class MultiVnfUbuntuMacroStep(YamlTemplateBaseStep):
+
+ def __init__(self, cleanup=False):
+ """Initialize step.
+
+ Substeps:
+ - CbaPublishStep
+ - YamlTemplateServiceAlaCarteInstantiateStep.
+ """
+ super().__init__(cleanup=cleanup)
+ self._yaml_template: dict = None
+ self._model_yaml_template: dict = None
+ self.add_step(CbaPublishStep(
+ cleanup=settings.CLEANUP_FLAG
+ ))
+ self.add_step(YamlTemplateServiceMacroInstantiateStep(
+ cleanup=settings.CLEANUP_FLAG
+ ))
+
+ @property
+ def description(self) -> str:
+ """Step description.
+
+ Used for reports
+
+ Returns:
+ str: Step description
+
+ """
+ return "Multi VNF Ubuntu macro 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 "PythonSDK-tests"
+
+ @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") as yaml_template:
+ self._yaml_template: dict = load(yaml_template)
+ return self._yaml_template
+
+ @property
+ def model_yaml_template(self) -> dict:
+ 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
+
+ @property
+ def service_name(self) -> dict:
+ """Service name.
+
+ Get from YAML template.
+
+ Returns:
+ str: Service name
+
+ """
+ return next(iter(self.yaml_template.keys()))
+
+ @property
+ def service_instance_name(self) -> str:
+ """Service instance name.
+
+ Returns:
+ str: Service instance name
+
+ """
+ return settings.SERVICE_INSTANCE_NAME
+
+
+class MultiVnfUbuntuMacro(testcase.TestCase):
+ """Instantiate a basic vm macro."""
+
+ __logger = logging.getLogger(__name__)
+
+ def __init__(self, **kwargs):
+ """Init Basic Macro use case."""
+ if "case_name" not in kwargs:
+ kwargs["case_name"] = 'nso_ubuntu_macro'
+ super().__init__(**kwargs)
+ self.__logger.debug("NSO Ubuntu macro init started")
+ self.test = MultiVnfUbuntuMacro(cleanup=settings.CLEANUP_FLAG)
+
+ def run(self):
+ """Run NSO Ubuntu macro test."""
+ self.start_time = time.time()
+ try:
+ self.test.execute()
+ self.__logger.info("Starting to clean up in {} seconds".format(settings.CLEANUP_ACTIVITY_TIMER))
+ time.sleep(settings.CLEANUP_ACTIVITY_TIMER)
+ self.test.cleanup()
+ self.result = 100
+ except OnapTestException as exc:
+ self.result = 0
+ self.__logger.error(exc.error_message)
+ except SDKException:
+ self.result = 0
+ self.__logger.error("SDK Exception")
+ finally:
+ self.stop_time = time.time()
+
+ def clean(self):
+ """Generate report."""
+ self.test.reports_collection.generate_report()
diff --git a/src/onaptests/scenario/pnf_macro.py b/src/onaptests/scenario/pnf_macro.py
index e86557b..73a2adf 100644
--- a/src/onaptests/scenario/pnf_macro.py
+++ b/src/onaptests/scenario/pnf_macro.py
@@ -76,6 +76,10 @@ class PnfMacroScenarioStep(YamlTemplateBaseStep):
return self._yaml_template
@property
+ def model_yaml_template(self) -> dict:
+ return {}
+
+ @property
def service_name(self) -> dict:
"""Service name.
diff --git a/src/onaptests/steps/base.py b/src/onaptests/steps/base.py
index 744fc7b..4d6858d 100644
--- a/src/onaptests/steps/base.py
+++ b/src/onaptests/steps/base.py
@@ -247,3 +247,15 @@ class YamlTemplateBaseStep(BaseStep, ABC):
dict: YAML template
"""
+
+ @property
+ @abstractmethod
+ def model_yaml_template(self) -> dict:
+ """Model YAML template abstract property.
+
+ Every YAML template step need to implement that property.
+
+ Returns:
+ dict: YAML template
+
+ """
diff --git a/src/onaptests/steps/instantiate/service_ala_carte.py b/src/onaptests/steps/instantiate/service_ala_carte.py
index dd62f52..3407e8e 100644
--- a/src/onaptests/steps/instantiate/service_ala_carte.py
+++ b/src/onaptests/steps/instantiate/service_ala_carte.py
@@ -135,6 +135,10 @@ class YamlTemplateServiceAlaCarteInstantiateStep(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/instantiate/service_macro.py b/src/onaptests/steps/instantiate/service_macro.py
index d83d2fe..b169049 100644
--- a/src/onaptests/steps/instantiate/service_macro.py
+++ b/src/onaptests/steps/instantiate/service_macro.py
@@ -12,7 +12,8 @@ from onapsdk.aai.cloud_infrastructure.tenant import Tenant
from onapsdk.configuration import settings
from onapsdk.exceptions import ResourceNotFound
from onapsdk.sdc.service import Service
-from onapsdk.so.instantiation import InstantiationParameter, ServiceInstantiation, VfmoduleParameters, VnfParameters
+from onapsdk.so.instantiation import InstantiationParameter, ServiceInstantiation, VfmoduleParameters, VnfParameters, SoService
+from onapsdk.vid import LineOfBusiness, Platform, Project
from onaptests.steps.cloud.customer_service_subscription_create import CustomerServiceSubscriptionCreateStep
import onaptests.utils.exceptions as onap_test_exceptions
@@ -34,6 +35,7 @@ class YamlTemplateServiceMacroInstantiateStep(YamlTemplateBaseStep):
"""
super().__init__(cleanup=cleanup)
self._yaml_template: dict = None
+ self._model_yaml_template: dict = None
self._service_instance_name: str = None
self._service_instance: str = None
if not settings.ONLY_INSTANTIATE:
@@ -76,6 +78,23 @@ class YamlTemplateServiceMacroInstantiateStep(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.
@@ -142,6 +161,9 @@ class YamlTemplateServiceMacroInstantiateStep(YamlTemplateBaseStep):
except ResourceNotFound:
self._logger.info("Owning entity not found, create it")
owning_entity = OwningEntity.create(settings.OWNING_ENTITY)
+ vid_project: Project = Project(settings.PROJECT)
+ line_of_business: LineOfBusiness = LineOfBusiness(settings.LINE_OF_BUSINESS)
+ platform: Platform = Platform(settings.PLATFORM)
# Before instantiating, be sure that the service has been distributed
self._logger.info("******** Check Service Distribution *******")
@@ -163,31 +185,40 @@ class YamlTemplateServiceMacroInstantiateStep(YamlTemplateBaseStep):
if distribution_completed is False:
self._logger.error(
- "Service Distribution for %s failed !!",service.name)
+ "Service Distribution for %s failed !!", service.name)
raise onap_test_exceptions.ServiceDistributionException
+ so_service = None
vnf_params_list: List[VnfParameters] = []
- for vnf_data in self.yaml_template[self.service_name].get("vnfs", []):
- vnf_params_list.append(VnfParameters(
- vnf_data["vnf_name"],
- [InstantiationParameter(name=parameter["name"], value=parameter["value"]) for parameter in vnf_data.get("vnf_parameters", [])],
- [VfmoduleParameters(vf_module_data["vf_module_name"],
- [InstantiationParameter(name=parameter["name"], value=parameter["value"]) for parameter in vf_module_data.get("parameters", [])]) \
+ if settings.MODEL_YAML_TEMPLATE:
+ so_data = self.yaml_template[self.service_name]
+ so_service = SoService(vnfs=so_data.get("vnfs", []),
+ subscription_service_type=so_data.get('subscription_service_type'))
+ else:
+ for vnf_data in self.yaml_template[self.service_name].get("vnfs", []):
+ vnf_params_list.append(VnfParameters(
+ vnf_data["vnf_name"],
+ [InstantiationParameter(name=parameter["name"], value=parameter["value"]) for parameter in
+ vnf_data.get("vnf_parameters", [])],
+ [VfmoduleParameters(vf_module_data["vf_module_name"],
+ [InstantiationParameter(name=parameter["name"], value=parameter["value"]) for
+ parameter in vf_module_data.get("parameters", [])]) \
for vf_module_data in vnf_data.get("vf_module_parameters", [])]
- ))
+ ))
service_instantiation = ServiceInstantiation.instantiate_macro(
- service,
+ sdc_service=service,
customer=customer,
owning_entity=owning_entity,
- project=settings.PROJECT,
- line_of_business=settings.LINE_OF_BUSINESS,
- platform=settings.PLATFORM,
+ project=vid_project,
+ line_of_business=line_of_business,
+ platform=platform,
cloud_region=cloud_region,
tenant=tenant,
service_instance_name=self.service_instance_name,
vnf_parameters=vnf_params_list,
- enable_multicloud=settings.USE_MULTICLOUD
+ enable_multicloud=settings.USE_MULTICLOUD,
+ so_service=so_service
)
try:
service_instantiation.wait_for_finish(timeout=settings.ORCHESTRATION_REQUEST_TIMEOUT)
@@ -197,9 +228,9 @@ class YamlTemplateServiceMacroInstantiateStep(YamlTemplateBaseStep):
if service_instantiation.failed:
self._logger.error("Service instantiation %s failed", self.service_instance_name)
raise onap_test_exceptions.ServiceInstantiateException
- else:
- service_subscription: ServiceSubscription = customer.get_service_subscription_by_service_type(self.service_name)
- self._service_instance: ServiceInstance = service_subscription.get_service_instance_by_name(self.service_instance_name)
+
+ service_subscription: ServiceSubscription = customer.get_service_subscription_by_service_type(self.service_name)
+ self._service_instance: ServiceInstance = service_subscription.get_service_instance_by_name(self.service_instance_name)
@YamlTemplateBaseStep.store_state(cleanup=True)
def cleanup(self) -> None:
diff --git a/src/onaptests/steps/instantiate/vf_module_ala_carte.py b/src/onaptests/steps/instantiate/vf_module_ala_carte.py
index aacecc3..af569fe 100644
--- a/src/onaptests/steps/instantiate/vf_module_ala_carte.py
+++ b/src/onaptests/steps/instantiate/vf_module_ala_carte.py
@@ -61,6 +61,10 @@ class YamlTemplateVfModuleAlaCarteInstantiateStep(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/instantiate/vl_ala_carte.py b/src/onaptests/steps/instantiate/vl_ala_carte.py
index 3bb293a..158e437 100644
--- a/src/onaptests/steps/instantiate/vl_ala_carte.py
+++ b/src/onaptests/steps/instantiate/vl_ala_carte.py
@@ -56,6 +56,10 @@ class YamlTemplateVlAlaCarteInstantiateStep(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/instantiate/vnf_ala_carte.py b/src/onaptests/steps/instantiate/vnf_ala_carte.py
index b02c7ea..8dbec78 100644
--- a/src/onaptests/steps/instantiate/vnf_ala_carte.py
+++ b/src/onaptests/steps/instantiate/vnf_ala_carte.py
@@ -54,6 +54,10 @@ class YamlTemplateVnfAlaCarteInstantiateStep(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/loop/clamp.py b/src/onaptests/steps/loop/clamp.py
index 86bcbb0..9a705f2 100644
--- a/src/onaptests/steps/loop/clamp.py
+++ b/src/onaptests/steps/loop/clamp.py
@@ -62,6 +62,10 @@ class ClampStep(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/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):
diff --git a/src/onaptests/templates/vnf-services/multi-vnf-ubuntu-model.yaml.j2 b/src/onaptests/templates/vnf-services/multi-vnf-ubuntu-model.yaml.j2
new file mode 100644
index 0000000..96037c9
--- /dev/null
+++ b/src/onaptests/templates/vnf-services/multi-vnf-ubuntu-model.yaml.j2
@@ -0,0 +1,16 @@
+---
+{{ service_name }}:
+ instantiation_type: "Macro"
+ vnfs:
+ - vnf_name: {{ service_name }}VF0
+ properties:
+ controller_actor: "CDS"
+ skip_post_instantiation_configuration: False
+ sdnc_artifact_name: "UbuntuVNF"
+ sdnc_model_version: "1.0.0"
+ sdnc_model_name: "UbuntuVNF"
+ vnf_artifact_type: "CONTROLLER_BLUEPRINT_ARCHIVE"
+ vnf_artifact_name: "UBUNTUVNF_enriched.zip"
+ vnf_artifact_label: "UbuntuVNF"
+ vnf_artifact_file_path: "/tmp/UBUNTUVNF_enriched.zip"
+ heat_files_to_upload: onaptests/templates/heat-files/nso_ubuntu/nso_ubuntu.zip
diff --git a/src/onaptests/templates/vnf-services/multi-vnf-ubuntu-service.yaml.j2 b/src/onaptests/templates/vnf-services/multi-vnf-ubuntu-service.yaml.j2
new file mode 100644
index 0000000..9403a7d
--- /dev/null
+++ b/src/onaptests/templates/vnf-services/multi-vnf-ubuntu-service.yaml.j2
@@ -0,0 +1,35 @@
+---
+{{ service_name }}:
+ subscription_service_type: {{ service_name }}
+ vnfs:
+ - model_name: {{ service_name }}VF0
+ vnf_name: {{ service_name }}00
+ parameters:
+ vnf-name: "multi_vnf_ubuntu_0_0"
+ vnf_name: "MultiVnfUbuntu00"
+ vf_modules:
+ - vf_module_name: {{ service_name }}00network0
+ model_name: base
+ parameters:
+ name: "multi_vnf_ubuntu_0_0_network_0"
+ cidr: "10.10.10.0/24"
+ - model_name: {{ service_name }}VF0
+ vnf_name: {{ service_name }}01
+ parameters:
+ vnf-name: "multi_vnf_ubuntu_0_1"
+ vnf_name: "MultiVnfUbuntu01"
+ vf_modules:
+ - vf_module_name: {{ service_name }}01vfm0
+ model_name: ubuntu-vf-module
+ parameters:
+ name: "multi_vnf_ubuntu_0_1_vfm_0"
+ network_mgmt: "vlan197_net"
+ key_name: "sebastien"
+ network_name: "multi_vnf_ubuntu_0_0_network_0"
+ - vf_module_name: {{ service_name }}01vfm1
+ model_name: ubuntu-vf-module
+ parameters:
+ name: "multi_vnf_ubuntu_0_1_vfm_1"
+ network_mgmt: "vlan197_net"
+ key_name: "sebastien"
+ network_name: "multi_vnf_ubuntu_0_0_network_0"