-xtesting
+xtesting==0.91.0
+avionix>=0.4.5
openstacksdk
-onapsdk==9.0.0
+onapsdk==9.2.2
jinja2
kubernetes
-avionix==0.4.4
\ No newline at end of file
--- /dev/null
+import logging.config
+import time
+import onaptests.utils.exceptions as onap_test_exceptions
+from onapsdk.configuration import settings
+from onaptests.scenario.basic_cnf_macro import BasicCnfMacro
+
+if __name__ == "__main__":
+ # logging configuration for onapsdk, it is not requested for onaptests
+ # Correction requested in onapsdk to avoid having this duplicate code
+ logging.config.dictConfig(settings.LOG_CONFIG)
+ logger = logging.getLogger("Instantiate Apache CNF with macro procedure")
+ step = BasicCnfMacro(cleanup=settings.CLEANUP_FLAG)
+ try:
+ step.execute()
+ if settings.CLEANUP_FLAG:
+ logger.info("Starting to clean up in {} seconds".format(settings.CLEANUP_ACTIVITY_TIMER))
+ time.sleep(settings.CLEANUP_ACTIVITY_TIMER)
+ step.cleanup()
+ except onap_test_exceptions.TestConfigurationException:
+ logger.error("Ubuntu NSO VM configuration error")
+ except onap_test_exceptions.ServiceInstantiateException:
+ logger.error("Ubuntu NSO VM instantiation error")
+ except onap_test_exceptions.ServiceCleanupException:
+ logger.error("Ubuntu NSO VM instance cleanup error")
+ except onap_test_exceptions.VnfInstantiateException:
+ logger.error("Ubuntu NSO VM Vnf instantiation error")
+ except onap_test_exceptions.VnfCleanupException:
+ logger.error("Ubuntu NSO VM Vnf instance cleanup error")
+ except onap_test_exceptions.VfModuleInstantiateException:
+ logger.error("Ubuntu NSO VM Module instantiation error")
+ except onap_test_exceptions.VfModuleCleanupException:
+ logger.error("Ubuntu NSO VM Module cleanup error")
basic_clamp = onaptests.scenario.basic_clamp:BasicClamp
cds_resource_resolution = onaptests.scenario.cds_resource_resolution:CDSResourceResolution
multi_vnf_ubuntu_macro = onaptests.scenario.multi_vnf_macro:MultiVnfUbuntuMacro
+ basic_cnf_macro = onaptests.scenario.basic_cnf_macro:BasicCnfMacro
-import sys
-from yaml import load
+from yaml import load, SafeLoader
+from onaptests.utils.resources import get_resource_location
from .settings import * # pylint: disable=W0614
# if a yaml file is define, retrieve info from this yaml files
# if not declare the parameters in the settings
-SERVICE_YAML_TEMPLATE = (sys.path[-1] + "/onaptests/templates/vnf-services/" +
- "basic_clamp-service.yaml")
-CONFIGURATION_PATH = sys.path[-1] + "/onaptests/configuration/"
+SERVICE_YAML_TEMPLATE = get_resource_location("templates/vnf-services/basic_clamp-service.yaml")
+CONFIGURATION_PATH = get_resource_location("configuration/")
try:
# Try to retrieve the SERVICE NAME from the yaml file
with open(SERVICE_YAML_TEMPLATE, "r") as yaml_template:
- yaml_config_file = load(yaml_template)
+ yaml_config_file = load(yaml_template, SafeLoader)
SERVICE_NAME = next(iter(yaml_config_file.keys()))
VF_NAME = SERVICE_NAME
except ValueError:
--- /dev/null
+import os
+from pathlib import Path
+from uuid import uuid4
+from yaml import load, SafeLoader
+
+from onaptests.utils.resources import get_resource_location
+import onaptests.utils.exceptions as onap_test_exceptions
+from .settings import * # pylint: disable=W0614
+
+""" Specific basic_cnf_macro with multicloud-k8s and yaml config scenario."""
+SERVICE_DETAILS = ("Onboarding, distribution and instantiation of a Apache CNF" +
+ "using macro and native CNF path: cnf-adapter + K8sPlugin")
+SERVICE_COMPONENTS = "SDC, DMAAP, AAI, SO, SDNC, CDS, Multicloud K8S"
+
+CLEANUP_FLAG = True
+
+# CDS_DD_FILE = Path(get_resource_location("templates/artifacts/dd.json"))
+CDS_CBA_UNENRICHED = Path("no_such_file")
+CDS_CBA_ENRICHED = Path(get_resource_location("templates/artifacts/basic_cnf_cba_enriched.zip"))
+
+# This scenario uses multicloud-k8s and not multicloud
+# (no registration requested)
+USE_MULTICLOUD = False
+# Set ONLY_INSTANTIATE to true to run an instantiation without repeating
+# onboarding and related AAI configuration (Cloud config)
+ONLY_INSTANTIATE = False
+
+# Relative path to config file to set k8s connectivity information
+K8S_CONFIG = get_resource_location("templates/artifacts/config")
+
+VENDOR_NAME = "basiccnf_macro_vendor"
+
+CLOUD_REGION_CLOUD_OWNER = "basiccnf-cloud-owner" # must not contain _
+CLOUD_REGION_ID = "k8sregion"
+CLOUD_REGION_TYPE = "k8s"
+CLOUD_REGION_VERSION = "1.0"
+CLOUD_DOMAIN = "Default"
+CLOUD_OWNER_DEFINED_TYPE = "t1"
+
+COMPLEX_PHYSICAL_LOCATION_ID = "lannion"
+COMPLEX_DATA_CENTER_CODE = "1234-5"
+AVAILABILITY_ZONE_NAME = "basiccnf-availability-zone"
+AVAILABILITY_ZONE_TYPE = "nova"
+
+GLOBAL_CUSTOMER_ID = "basiccnf-macro-customer"
+
+OWNING_ENTITY = "basicnf_macro_owning_entity"
+PROJECT = "basicnf_macro_project"
+LINE_OF_BUSINESS = "basicnf_macro_lob"
+PLATFORM = "basicnf_macro_platform"
+
+# The cloud Part
+# Assuming a cloud.yaml is available, use the openstack client
+# to retrieve cloud info and avoid data duplication
+# For basic_cnf, no tenant information is required but some dummy
+# information shall be provided by default
+# So it is not requested to set OS_TEST_CLOUD
+TEST_CLOUD = os.getenv('OS_TEST_CLOUD')
+VIM_USERNAME = 'dummy'
+VIM_PASSWORD = 'dummy123'
+VIM_SERVICE_URL = 'http://10.12.25.2:5000/v3'
+TENANT_ID = '123456'
+TENANT_NAME = 'dummy_test'
+
+
+SERVICE_YAML_TEMPLATE = Path(get_resource_location("templates/vnf-services/basic_cnf_macro-service.yaml"))
+
+try:
+ # Try to retrieve the SERVICE NAME from the yaml file
+ with open(SERVICE_YAML_TEMPLATE, "r") as yaml_template:
+ yaml_config_file = load(yaml_template, SafeLoader)
+ SERVICE_NAME = next(iter(yaml_config_file.keys()))
+except (FileNotFoundError, ValueError):
+ raise onap_test_exceptions.TestConfigurationException
+
+SERVICE_INSTANCE_NAME = f"basic_cnf_macro_{str(uuid4())}"
+
+MODEL_YAML_TEMPLATE = None
import os
-import openstack
-import sys
-from yaml import load
-
+from yaml import load, SafeLoader
+from onaptests.utils.resources import get_resource_location
import onaptests.utils.exceptions as onap_test_exceptions
from .settings import * # pylint: disable=W0614
""" Specific basic_cnf with multicloud-k8s and yaml config scenario."""
SERVICE_DETAILS = ("Onboarding, distribution and instantiation of a CNF" +
"using à la carte and Multicloud K8S module")
-SERVICE_COMPONENTS="SDC, DMAAP, AAI, SO, SDNC, Multicloud K8S"
+SERVICE_COMPONENTS = "SDC, DMAAP, AAI, SO, SDNC, Multicloud K8S"
# This scenario uses multicloud-k8s and not multicloud
# (no registration requested)
USE_MULTICLOUD = False
# Set ONLY_INSTANTIATE to true to run an instantiation without repeating
# onboarding and related AAI configuration (Cloud config)
-ONLY_INSTANTIATE= False
+ONLY_INSTANTIATE = False
# if a yaml file is define, retrieve info from this yaml files
# if not declare the parameters in the settings
-SERVICE_YAML_TEMPLATE = (sys.path[-1] + "/onaptests/templates/vnf-services/" +
- "basic_cnf-service.yaml")
+SERVICE_YAML_TEMPLATE = get_resource_location("templates/vnf-services/basic_cnf-service.yaml")
try:
# Try to retrieve the SERVICE NAME from the yaml file
with open(SERVICE_YAML_TEMPLATE, "r") as yaml_template:
- yaml_config_file = load(yaml_template)
+ yaml_config_file = load(yaml_template, SafeLoader)
SERVICE_NAME = next(iter(yaml_config_file.keys()))
except (FileNotFoundError, ValueError):
raise onap_test_exceptions.TestConfigurationException
# Definition of k8s profile version
K8S_PROFILE_K8S_VERSION = "1.0"
# Relative path to k8s profile artifact in the python package (so under /src)
-K8S_PROFILE_ARTIFACT_PATH = (sys.path[-1] +
- "/onaptests/templates/artifacts/k8sprof.tar.gz")
+K8S_PROFILE_ARTIFACT_PATH = get_resource_location("templates/artifacts/k8sprof.tar.gz")
# Relative path to config file to set k8s connectivity information
-K8S_CONFIG = (sys.path[-1] +
- "/onaptests/templates/artifacts/config")
+K8S_CONFIG = get_resource_location("templates/artifacts/config")
VENDOR_NAME = "basicnf_vendor"
-CLOUD_REGION_CLOUD_OWNER = "basicnf-owner" # must not contain _
+CLOUD_REGION_CLOUD_OWNER = "basicnf-owner" # must not contain _
CLOUD_REGION_ID = "k8sregion"
CLOUD_REGION_TYPE = "k8s"
CLOUD_REGION_VERSION = "1.0"
# information shall be provided by default
# So it is not requested to set OS_TEST_CLOUD
TEST_CLOUD = os.getenv('OS_TEST_CLOUD')
-cloud = openstack.connect(cloud=TEST_CLOUD)
-VIM_USERNAME = cloud.config.auth.get('username','dummy')
-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')
+VIM_USERNAME = 'dummy'
+VIM_PASSWORD = 'dummy123'
+VIM_SERVICE_URL = 'http://10.12.25.2:5000/v3'
+TENANT_ID = '123456'
+TENANT_NAME = 'dummy_test'
MODEL_YAML_TEMPLATE = None
import os
import openstack
-import sys
-from yaml import load
-
+from yaml import load, SafeLoader
+from onaptests.utils.resources import get_resource_location
import onaptests.utils.exceptions as onap_test_exceptions
from .settings import * # pylint: disable=W0614
# if a yaml file is define, retrieve info from this yaml files
# if not declare the parameters in the settings
-SERVICE_YAML_TEMPLATE = (sys.path[-1] + "/onaptests/templates/vnf-services/" +
- "basic_network-service.yaml")
+SERVICE_YAML_TEMPLATE = get_resource_location("templates/vnf-services/basic_network-service.yaml")
try:
# Try to retrieve the SERVICE NAME from the yaml file
with open(SERVICE_YAML_TEMPLATE, "r") as yaml_template:
- yaml_config_file = load(yaml_template)
+ yaml_config_file = load(yaml_template, SafeLoader)
SERVICE_NAME = next(iter(yaml_config_file.keys()))
except (FileNotFoundError, ValueError):
raise onap_test_exceptions.TestConfigurationException
-import sys
import random
import string
-from yaml import load
+from yaml import load, SafeLoader
from jinja2 import Environment, PackageLoader
+
import onaptests.utils.exceptions as onap_test_exceptions
+from onaptests.utils.resources import get_resource_location
from .settings import * # pylint: disable=W0614
""" Creation of service to onboard"""
+
# 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():
rendered_template = template.render(service_name=service_name)
- file_name = (sys.path[-1] + "/onaptests/templates/vnf-services/" +
- "basic-onboard-service.yaml")
-
- with open(file_name, 'w+') as file_to_write:
+ with open(SERVICE_YAML_TEMPLATE, 'w+') as file_to_write:
file_to_write.write(rendered_template)
"""Basic onboard service to only onboard a service in SDC"""
# if a yaml file is define, retrieve info from this yaml files
# if not declare the parameters in the settings
+
+SERVICE_YAML_TEMPLATE = get_resource_location("templates/vnf-services/basic-onboard-service.yaml")
generate_service_config_yaml_file()
-SERVICE_YAML_TEMPLATE = (sys.path[-1] + "/onaptests/templates/vnf-services/" +
- "basic-onboard-service.yaml")
try:
# Try to retrieve the SERVICE NAME from the yaml file
with open(SERVICE_YAML_TEMPLATE, "r") as yaml_template:
- yaml_config_file = load(yaml_template)
+ yaml_config_file = load(yaml_template, SafeLoader)
SERVICE_NAME = next(iter(yaml_config_file.keys()))
except (FileNotFoundError, ValueError):
raise onap_test_exceptions.TestConfigurationException
import openstack
from pathlib import Path
from uuid import uuid4
-
-from yaml import load
+from yaml import load, SafeLoader
import onaptests.utils.exceptions as onap_test_exceptions
+from onaptests.utils.resources import get_resource_location
from .settings import * # pylint: disable=W0614
CLEANUP_FLAG = True
-CDS_DD_FILE = Path(Path(__file__).parent.parent, "templates/artifacts/dd.json")
-CDS_CBA_UNENRICHED = Path(Path(__file__).parent.parent, "templates/artifacts/basic_vm_cba.zip")
-CDS_CBA_ENRICHED = "/tmp/BASIC_VM_enriched.zip"
+CDS_DD_FILE = Path(get_resource_location("templates/artifacts/dd.json"))
+CDS_CBA_UNENRICHED = Path(get_resource_location("templates/artifacts/basic_vm_cba.zip"))
+CDS_CBA_ENRICHED = Path("/tmp/BASIC_VM_enriched.zip")
ONLY_INSTANTIATE = False
USE_MULTICLOUD = False
LINE_OF_BUSINESS = "basicvm-lob"
PLATFORM = "basicvm-platform"
CLOUD_DOMAIN = "Default"
-SERVICE_YAML_TEMPLATE = Path(Path(__file__).parent.parent, "templates/vnf-services/" +
- "basic_vm_macro-service.yaml")
+SERVICE_YAML_TEMPLATE = Path(get_resource_location("templates/vnf-services/basic_vm_macro-service.yaml"))
try:
# Try to retrieve the SERVICE NAME from the yaml file
with open(SERVICE_YAML_TEMPLATE, "r") as yaml_template:
- yaml_config_file = load(yaml_template)
+ yaml_config_file = load(yaml_template, SafeLoader)
SERVICE_NAME = next(iter(yaml_config_file.keys()))
except (FileNotFoundError, ValueError):
raise onap_test_exceptions.TestConfigurationException
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")
+SERVICE_YAML_TEMPLATE = Path(get_resource_location("templates/vnf-services/basic_vm_macro_stability-service.yaml"))
MODEL_YAML_TEMPLATE = None
-import sys
+from onaptests.utils.resources import get_resource_location
from .settings import * # pylint: disable=W0614
""" Specific Basic VM with multicloud and yaml config scenario."""
SERVICE_INSTANCE_NAME = "sdktests_service_instance_name"
-SERVICE_YAML_TEMPLATE = sys.path[-1] + "/onaptests/templates/vnf-services/basic_vm-service.yaml"
+SERVICE_YAML_TEMPLATE = get_resource_location("templates/vnf-services/basic_vm-service.yaml")
MODEL_YAML_TEMPLATE = None
import os
import openstack
-import sys
-from yaml import load
-
+from yaml import load, SafeLoader
+from onaptests.utils.resources import get_resource_location
import onaptests.utils.exceptions as onap_test_exceptions
from .settings import * # pylint: disable=W0614
# if a yaml file is define, retrieve info from this yaml files
# if not declare the parameters in the settings
-SERVICE_YAML_TEMPLATE = (sys.path[-1] + "/onaptests/templates/vnf-services/" +
- "basic_vm-service.yaml")
+SERVICE_YAML_TEMPLATE = get_resource_location("templates/vnf-services/basic_vm-service.yaml")
try:
# Try to retrieve the SERVICE NAME from the yaml file
with open(SERVICE_YAML_TEMPLATE, "r") as yaml_template:
- yaml_config_file = load(yaml_template)
+ yaml_config_file = load(yaml_template, SafeLoader)
SERVICE_NAME = next(iter(yaml_config_file.keys()))
except (FileNotFoundError, ValueError):
raise onap_test_exceptions.TestConfigurationException
from pathlib import Path
+from onaptests.utils.resources import get_resource_location
from .settings import * # pylint: disable=W0614
SERVICE_NAME = "CDS blueprint enrichment"
CLEANUP_FLAG = True
-CDS_DD_FILE = Path(Path(__file__).parent.parent, "templates/artifacts/dd.json")
-CDS_CBA_UNENRICHED = Path(Path(__file__).parent.parent, "templates/artifacts/PNF_DEMO.zip")
+CDS_DD_FILE = Path(get_resource_location("templates/artifacts/dd.json"))
+CDS_CBA_UNENRICHED = Path(get_resource_location("templates/artifacts/PNF_DEMO.zip"))
CDS_CBA_ENRICHED = "/tmp/PNF_DEMO_enriched.zip"
from pathlib import Path
from uuid import uuid4
+from onaptests.utils.resources import get_resource_location
from .settings import * # pylint: disable=W0614
CLEANUP_FLAG = True
CLOUD_OWNER_DEFINED_TYPE = "N/A"
COMPLEX_PHYSICAL_LOCATION_ID = "sdktests"
-MSB_K8S_DEFINITION_ATRIFACT_FILE_PATH = Path(Path(__file__).parent.parent,
- "templates/artifacts/cds-resource-resolution/cds-mock-server.tar.gz")
+MSB_K8S_DEFINITION_ATRIFACT_FILE_PATH = Path(get_resource_location(
+ "templates/artifacts/cds-resource-resolution/cds-mock-server.tar.gz"))
MSB_K8S_RB_NAME = f"cds-ms-rb-{str(uuid4())}"
MSB_K8S_RB_VERSION = "v1"
-MSB_K8S_PROFILE_ARTIFACT_FILE_PATH = Path(Path(__file__).parent.parent,
- "templates/artifacts/profile.tar.gz")
+MSB_K8S_PROFILE_ARTIFACT_FILE_PATH = Path(get_resource_location(
+ "templates/artifacts/profile.tar.gz"))
MSB_K8S_PROFILE_NAME = f"cds-ms-prof-{str(uuid4())}"
K8S_VERSION = "1.0"
-K8S_CONFIG = str(Path(Path(__file__).parent.parent, "templates/artifacts/config"))
+K8S_CONFIG = get_resource_location("templates/artifacts/config")
K8S_ADDITIONAL_RESOURCES_NAMESPACE = "onap-tests"
CDS_MOCKSERVER_EXPECTATIONS = [
{
}
]
-CDS_DD_FILE = Path(Path(__file__).parent.parent, "templates/artifacts/cds-resource-resolution/dd.json")
-CDS_CBA_UNENRICHED = Path(Path(__file__).parent.parent, "templates/artifacts/cds-resource-resolution/resource-resolution.zip")
-CDS_CBA_ENRICHED = "/tmp/resource-resolution-enriched.zip"
+CDS_DD_FILE = Path(get_resource_location("templates/artifacts/cds-resource-resolution/dd.json"))
+CDS_CBA_UNENRICHED = Path(get_resource_location("templates/artifacts/cds-resource-resolution/resource-resolution.zip"))
+CDS_CBA_ENRICHED = Path("/tmp/resource-resolution-enriched.zip")
CDS_WORKFLOW_NAME = "resource-resolution"
CDS_WORKFLOW_INPUT = {
"template-prefix": [
import os
-import sys
import openstack
-from yaml import load
-
+from yaml import load, SafeLoader
+from onaptests.utils.resources import get_resource_location
from .settings import * # pylint: disable=W0614
""" Specific clearwater IMS without multicloud."""
VSP_NAME = "clearwater-ims_ubuntu_vsp"
# if a yaml file is define, retrieve info from this yaml files
# if not declare the parameters in the settings
-SERVICE_YAML_TEMPLATE = (sys.path[-1] + "/onaptests/templates/vnf-services/" +
- "clearwater-ims-service.yaml")
+SERVICE_YAML_TEMPLATE = get_resource_location("templates/vnf-services/clearwater-ims-service.yaml")
try:
# Try to retrieve the SERVICE NAME from the yaml file
with open(SERVICE_YAML_TEMPLATE, "r") as yaml_template:
- yaml_config_file = load(yaml_template)
+ yaml_config_file = load(yaml_template, SafeLoader)
SERVICE_NAME = next(iter(yaml_config_file.keys()))
except ValueError:
SERVICE_NAME = "" # Fill me
import uuid
import os
-import sys
from pathlib import Path
import openstack
from jinja2 import Environment, PackageLoader
+from onaptests.utils.resources import get_resource_location
from .settings import * # pylint: disable=W0614
VNF_FILENAME_PREFIX = "multi-vnf-ubuntu"
rendered_template = template.render(service_name=SERVICE_NAME)
- file_name = (sys.path[-1] + "/onaptests/templates/vnf-services/" +
- f"{filename}.yaml")
+ file_name = get_resource_location(f"templates/vnf-services/{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_DD_FILE = Path(get_resource_location("templates/artifacts/dd_nso_ubuntu.json"))
+CDS_CBA_UNENRICHED = Path(get_resource_location("templates/artifacts/nso_ubuntuvnf.zip"))
CDS_CBA_ENRICHED = "/tmp/UBUNTUVNF_enriched.zip"
ONLY_INSTANTIATE = False
VENDOR_NAME = 'ubuntu_xtesting_vendor'
-SERVICE_YAML_TEMPLATE = Path(Path(__file__).parent.parent, "templates/vnf-services/" +
- f"{VNF_FILENAME_PREFIX}-service.yaml")
+SERVICE_YAML_TEMPLATE = Path(get_resource_location("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")
+MODEL_YAML_TEMPLATE = Path(get_resource_location("templates/vnf-services/" +
+ f"{VNF_FILENAME_PREFIX}-model.yaml"))
generate_service_config_yaml_file(f"{VNF_FILENAME_PREFIX}-service")
from pathlib import Path
from uuid import uuid4
+from onaptests.utils.resources import get_resource_location
from .settings import * # pylint: disable=W0614
ONLY_INSTANTIATE = False
VENDOR_NAME = "pnf_macro_vendor"
SERVICE_NAME = "test_pnf_macro"
SERVICE_INSTANCE_NAME = "TestPNFMacroInstantiation"
-SERVICE_YAML_TEMPLATE = Path(Path(__file__).parent.parent,
- "templates/vnf-services/pnf-service.yaml")
+SERVICE_YAML_TEMPLATE = Path(get_resource_location("templates/vnf-services/pnf-service.yaml"))
-CDS_DD_FILE = Path(Path(__file__).parent.parent,
- "templates/artifacts/dd.json")
-CDS_CBA_UNENRICHED = Path(Path(__file__).parent.parent,
- "templates/artifacts/PNF_DEMO.zip")
+CDS_DD_FILE = Path(get_resource_location("templates/artifacts/dd.json"))
+CDS_CBA_UNENRICHED = Path(get_resource_location("templates/artifacts/PNF_DEMO.zip"))
CDS_CBA_ENRICHED = "/tmp/PNF_DEMO_enriched.zip"
CLOUD_REGION_CLOUD_OWNER = "basicnf-owner" # must not contain _
INSTANTIATION_TIMEOUT = 600
-MSB_K8S_DEFINITION_ATRIFACT_FILE_PATH = Path(Path(__file__).parent.parent,
- "templates/artifacts/pnf-simulator.tar.gz")
+MSB_K8S_DEFINITION_ATRIFACT_FILE_PATH = Path(get_resource_location("templates/artifacts/pnf-simulator.tar.gz"))
MSB_K8S_RB_NAME = f"pnf-cnf-rb-{str(uuid4())}"
MSB_K8S_RB_VERSION = "v1"
-MSB_K8S_PROFILE_ARTIFACT_FILE_PATH = Path(Path(__file__).parent.parent,
- "templates/artifacts/profile.tar.gz")
+MSB_K8S_PROFILE_ARTIFACT_FILE_PATH = Path(get_resource_location("templates/artifacts/profile.tar.gz"))
MSB_K8S_PROFILE_NAME = f"pnf-cnf-profile-{str(uuid4())}"
K8S_VERSION = "1.0"
-K8S_CONFIG = str(Path(Path(__file__).parent.parent, "templates/artifacts/config"))
+K8S_CONFIG = get_resource_location("templates/artifacts/config")
K8S_ADDITIONAL_RESOURCES_NAMESPACE = "onap-tests"
-SERVICE_INSTANCE_NAME = "TestPNFMacroInstantiation"
+SERVICE_INSTANCE_NAME = f"TestPNFMacroInstantiation_{str(uuid4())}"
DCAE_VES_COLLECTOR_POD_NAME = "dcae-ves-collector"
PNF_WAIT_TIME = 60.0
--- /dev/null
+"""Instantiate basic cnf using SO macro flow."""
+import logging
+import time
+from yaml import load, SafeLoader
+
+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 BasicCnfMacroStep(YamlTemplateBaseStep):
+
+ def __init__(self, cleanup=False):
+ """Initialize step.
+
+ Substeps:
+ - CbaPublishStep
+ - YamlTemplateServiceMacroInstantiateStep.
+ """
+ super().__init__(cleanup=cleanup)
+ self._yaml_template: dict = None
+ self.add_step(CbaPublishStep(
+ cleanup=cleanup
+ ))
+ self.add_step(YamlTemplateServiceMacroInstantiateStep(
+ cleanup=cleanup
+ ))
+
+ @property
+ def description(self) -> str:
+ """Step description.
+
+ Used for reports
+
+ Returns:
+ str: Step description
+
+ """
+ return "Basic CNF 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, SafeLoader)
+ return self._yaml_template
+
+ @property
+ def model_yaml_template(self) -> dict:
+ return {}
+
+ @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 BasicCnfMacro(testcase.TestCase):
+ """Instantiate a basic cnf macro."""
+
+ __logger = logging.getLogger()
+
+ def __init__(self, **kwargs):
+ """Init Basic Cnf Macro use case."""
+ if "case_name" not in kwargs:
+ kwargs["case_name"] = 'basic_cnf_macro'
+ super().__init__(**kwargs)
+ self.__logger.debug("Basic Cnf macro init started")
+ self.test = BasicCnfMacroStep(cleanup=settings.CLEANUP_FLAG)
+
+ def run(self):
+ """Run basic cnf macro test."""
+ self.start_time = time.time()
+ try:
+ self.test.execute()
+ 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()
"""Instantiate basic vm using SO macro flow."""
import logging
import time
-from yaml import load
+from yaml import load, SafeLoader
from onapsdk.configuration import settings
from onapsdk.exceptions import SDKException
Substeps:
- CbaPublishStep
- - YamlTemplateServiceAlaCarteInstantiateStep.
+ - YamlTemplateServiceMacroInstantiateStep.
"""
super().__init__(cleanup=cleanup)
self._yaml_template: dict = None
"""
if not self._yaml_template:
with open(settings.SERVICE_YAML_TEMPLATE, "r") as yaml_template:
- self._yaml_template: dict = load(yaml_template)
+ self._yaml_template: dict = load(yaml_template, SafeLoader)
return self._yaml_template
@property
import logging
import time
-from yaml import load
+from yaml import load, SafeLoader
from onapsdk.configuration import settings
from onapsdk.exceptions import SDKException
"""
if not self._yaml_template:
with open(settings.SERVICE_YAML_TEMPLATE, "r") as yaml_template:
- self._yaml_template: dict = load(yaml_template)
+ self._yaml_template: dict = load(yaml_template, SafeLoader)
return self._yaml_template
@property
"""Instantiate service with PNF using SO macro flow."""
import logging
import time
-from yaml import load
+from yaml import load, SafeLoader
from xtesting.core import testcase
from onapsdk.configuration import settings
"""
if not self._yaml_template:
with open(settings.SERVICE_YAML_TEMPLATE, "r") as yaml_template:
- self._yaml_template: dict = load(yaml_template)
+ self._yaml_template: dict = load(yaml_template, SafeLoader)
return self._yaml_template
@property
try:
if cleanup:
self._start_cleanup_time = time.time()
+ self._logger.info("*****************************************************")
+ self._logger.info(f"START [{self.component}] {self.name} cleanup: {self.description}")
+ self._logger.info("*****************************************************")
+ else:
+ self._logger.info("*****************************************************")
+ self._logger.info(f"START [{self.component}] {self.name}: {self.description}")
+ self._logger.info("*****************************************************")
execution_status: Optional[ReportStepStatus] = None
ret = fun(self, *args, **kwargs)
execution_status = ReportStepStatus.PASS
raise
finally:
if cleanup:
+ self._logger.info("*****************************************************")
+ self._logger.info(f"STOP [{self.component}] {self.name} cleanup: {self.description}")
+ self._logger.info("*****************************************************")
self._cleanup_report = Report(
step_description=f"[{self.component}] {self.name} cleanup: {self.description}",
step_execution_status=execution_status,
step_execution_duration=time.time() - self._start_cleanup_time
)
else:
+ self._logger.info("*****************************************************")
+ self._logger.info(f"STOP [{self.component}] {self.name}: {self.description}")
+ self._logger.info("*****************************************************")
if not self._start_execution_time:
if execution_status != ReportStepStatus.NOT_EXECUTED:
self._logger.error("No execution start time saved for %s step. Fix it by call `super.execute()` "
step.execute()
except (OnapTestException, SDKException) as substep_err:
raise SubstepExecutionException from substep_err
+ if self._steps:
+ self._logger.info("*****************************************************")
+ self._logger.info(f"CONTINUE [{self.component}] {self.name}: {self.description}")
+ self._logger.info("*****************************************************")
self._start_execution_time = time.time()
def cleanup(self) -> None:
Not all steps has to have cleanup method
"""
+ self._logger.info("*****************************")
+ self._logger.info("Start Cleanup step: " + self.name)
+ self._logger.info("*****************************")
if self._cleanup:
for step in self._steps:
try:
super().execute()
service = Service(name=settings.SERVICE_NAME)
customer = Customer.get_by_global_customer_id(settings.GLOBAL_CUSTOMER_ID)
- customer.subscribe_service(service)
+ customer.subscribe_service(service.name)
from typing import Iterable
from uuid import uuid4
-from yaml import load
+from yaml import load, SafeLoader
from onapsdk.aai.business import Customer, ServiceInstance, ServiceSubscription
from onapsdk.configuration import settings
if 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)
+ self._yaml_template: dict = load(yaml_template, SafeLoader)
return self._yaml_template
return self.parent.yaml_template
for vf_module in vnf_instance.vnf.vf_modules:
# Define profile (rb_profile) for resource bundle definition
# Retrieve resource bundle definition (rbdef) corresponding to vf module
- rbdef_name = vf_module.metadata["vfModuleModelInvariantUUID"]
- rbdef_version = vf_module.metadata["vfModuleModelCustomizationUUID"]
+ rbdef_name = vf_module.model_invariant_uuid
+ rbdef_version = vf_module.model_customization_id
rbdef = Definition.get_definition_by_name_version(rbdef_name, rbdef_version)
# Get k8s profile name from yaml service template
vnf_parameters = self.get_vnf_parameters(vnf_instance.vnf.name)
# possible to have several modules for 1 VNF
for vf_module in vnf_instance.vnf.vf_modules:
# Retrieve resource bundle definition (rbdef) corresponding to vf module
- rbdef_name = vf_module.metadata["vfModuleModelInvariantUUID"]
- rbdef_version = vf_module.metadata["vfModuleModelCustomizationUUID"]
+ rbdef_name = vf_module.model_invariant_uuid
+ rbdef_version = vf_module.model_customization_id
rbdef = Definition.get_definition_by_name_version(rbdef_name, rbdef_version)
# Get k8s profile name from yaml service template
vnf_parameters = self.get_vnf_parameters(vnf_instance.vnf.name)
import time
from uuid import uuid4
-from yaml import load
+from yaml import load, SafeLoader
from onapsdk.aai.cloud_infrastructure import CloudRegion, Tenant
from onapsdk.aai.business import Customer, ServiceInstance, ServiceSubscription
if 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)
+ self._yaml_template: dict = load(yaml_template, SafeLoader)
return self._yaml_template
return self.parent.yaml_template
super().execute()
service = Service(self.service_name)
customer: Customer = Customer.get_by_global_customer_id(settings.GLOBAL_CUSTOMER_ID)
+ service_subscription: ServiceSubscription = customer.get_service_subscription_by_service_type(service.name)
cloud_region: CloudRegion = CloudRegion.get_by_id(
cloud_owner=settings.CLOUD_REGION_CLOUD_OWNER,
cloud_region_id=settings.CLOUD_REGION_ID,
customer,
owning_entity,
settings.PROJECT,
+ service_subscription,
service_instance_name=self.service_instance_name
)
try:
from typing import List
from uuid import uuid4
from onapsdk.aai.business.service import ServiceInstance
-from yaml import load
+from yaml import load, SafeLoader
from onapsdk.aai.business.customer import Customer, ServiceSubscription
from onapsdk.aai.business.owning_entity import OwningEntity
from onapsdk.exceptions import ResourceNotFound
from onapsdk.sdc.service import Service
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
if 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)
+ self._yaml_template: dict = load(yaml_template, SafeLoader)
return self._yaml_template
return self.parent.yaml_template
super().execute()
service = Service(self.service_name)
customer: Customer = Customer.get_by_global_customer_id(settings.GLOBAL_CUSTOMER_ID)
+ service_subscription: ServiceSubscription = customer.get_service_subscription_by_service_type(service.name)
if any(
filter(lambda x: x in self.yaml_template[self.service_name].keys(),
["vnfs", "networks"])):
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 *******")
sdc_service=service,
customer=customer,
owning_entity=owning_entity,
- project=vid_project,
- line_of_business=line_of_business,
- platform=platform,
+ project=settings.PROJECT,
+ line_of_business=settings.LINE_OF_BUSINESS,
+ platform=settings.PLATFORM,
cloud_region=cloud_region,
tenant=tenant,
+ service_subscription=service_subscription,
service_instance_name=self.service_instance_name,
vnf_parameters=vnf_params_list,
enable_multicloud=settings.USE_MULTICLOUD,
from typing import Iterable
from uuid import uuid4
-from yaml import load
+from yaml import load, SafeLoader
from onapsdk.aai.cloud_infrastructure import CloudRegion, Tenant
from onapsdk.aai.business import Customer, ServiceInstance, ServiceSubscription
if 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)
+ self._yaml_template: dict = load(yaml_template, SafeLoader)
return self._yaml_template
return self.parent.yaml_template
import re
from typing import Iterable
from uuid import uuid4
-from yaml import load
+from yaml import load, SafeLoader
from onapsdk.aai.business import Customer, ServiceInstance, ServiceSubscription
from onapsdk.configuration import settings
if 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)
+ self._yaml_template: dict = load(yaml_template, SafeLoader)
return self._yaml_template
return self.parent.yaml_template
from uuid import uuid4
-from yaml import load
+from yaml import load, SafeLoader
from onapsdk.aai.cloud_infrastructure import CloudRegion, Tenant
from onapsdk.aai.business import Customer, ServiceInstance, ServiceSubscription
if 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)
+ self._yaml_template: dict = load(yaml_template, SafeLoader)
return self._yaml_template
return self.parent.yaml_template
#
# http://www.apache.org/licenses/LICENSE-2.0
"""Clamp Scenario class."""
-from yaml import load
+from yaml import load, SafeLoader
import random
import string
import time
if 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)
+ self._yaml_template: dict = load(yaml_template, SafeLoader)
return self._yaml_template
return self.parent.yaml_template
def __init__(self, cleanup=False) -> None:
"""Initialize CBA publish step."""
super().__init__(cleanup=cleanup)
- self.add_step(CbaEnrichStep(cleanup=cleanup))
+ """Let's skip enrichment if enriched CBA is already present"""
+ if Path.is_file(settings.CDS_CBA_UNENRICHED):
+ self.add_step(CbaEnrichStep(cleanup=cleanup))
@property
def description(self) -> str:
#!/usr/bin/python
# http://www.apache.org/licenses/LICENSE-2.0
"""Clamp Onboard service class."""
-from yaml import load
+from yaml import load, SafeLoader
from onapsdk.sdc.service import Service
from onapsdk.sdc.vf import Vf
if 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)
+ self._yaml_template: dict = load(yaml_template, SafeLoader)
return self._yaml_template
return self.parent.yaml_template
import time
from typing import Any, Dict
-from yaml import load
+from yaml import load, SafeLoader
from onapsdk.configuration import settings
from onapsdk.exceptions import APIError, ResourceNotFound
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)
+ self._yaml_template: dict = load(yaml_template, SafeLoader)
return self._yaml_template
return self.parent.yaml_template
from pathlib import Path
-import sys
import time
from onapsdk.configuration import settings
from onapsdk.sdc.vf import Vf
from onapsdk.sdc.vsp import Vsp
+from onaptests.utils.resources import get_resource_location
from ..base import BaseStep, YamlTemplateBaseStep
from .vsp import VspOnboardStep, YamlTemplateVspOnboardStep
vf.create()
artifact_file_path: Path = Path(vnf["vnf_artifact_file_path"])
if not artifact_file_path.exists():
- artifact_file_path = Path(sys.path[-1], artifact_file_path)
+ artifact_file_path = Path(get_resource_location(artifact_file_path))
vf.add_deployment_artifact(
artifact_type=vnf["vnf_artifact_type"],
artifact_name=vnf["vnf_artifact_name"],
-import sys
from onapsdk.configuration import settings
from onapsdk.sdc.vendor import Vendor
from onapsdk.sdc.vsp import Vsp
+from onaptests.utils.resources import get_resource_location
from ..base import BaseStep, YamlTemplateBaseStep
from .vendor import VendorOnboardStep
vendor: Vendor = Vendor(name=settings.VENDOR_NAME)
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:
+ with open(get_resource_location(vnf["heat_files_to_upload"]), "rb") as package:
vsp: Vsp = Vsp(name=f"{vnf['vnf_name']}_VSP",
vendor=vendor,
package=package)
elif "pnfs" in self.yaml_template:
for pnf in self.yaml_template["pnfs"]:
if "heat_files_to_upload" in pnf:
- with open(
- sys.path[-1] + "/" + pnf["heat_files_to_upload"], "rb") as package:
+ with open(get_resource_location(pnf["heat_files_to_upload"]), "rb") as package:
vsp: Vsp = Vsp(name=f"{pnf['pnf_name']}_VSP",
vendor=vendor,
package=package)
-import sys
from dataclasses import dataclass
from enum import Enum
from typing import List
from jinja2 import Environment, FileSystemLoader, select_autoescape
from onapsdk.configuration import settings
from onapsdk.exceptions import SettingsError
+from onaptests.utils.resources import get_resource_location
class ReportStepStatus(Enum):
int: How many steps failed
"""
- return sum((1 for step_report in self.report if \
- step_report.step_execution_status == ReportStepStatus.FAIL))
+ return sum((1 for step_report in self.report if
+ step_report.step_execution_status == ReportStepStatus.FAIL))
def generate_report(self) -> None:
usecase = settings.SERVICE_NAME
jinja_env = Environment(
autoescape=select_autoescape(['html']),
- loader=FileSystemLoader(sys.path[-1] + '/onaptests/templates/reporting'))
+ loader=FileSystemLoader(get_resource_location('templates/reporting')))
jinja_env.get_template('reporting.html.j2').stream(
report=self,
from avionix import ChartBuilder, ChartDependency, ChartInfo
from avionix.errors import HelmError
from onaptests.steps.base import BaseStep
-from onaptests.utils.simulators import get_local_dir
+from onaptests.utils.resources import get_local_dir
from onaptests.utils.exceptions import (
EnvironmentPreparationException,
EnvironmentCleanupException)
basicclamp:
vnfs:
- vnf_name: basicclamp
- heat_files_to_upload: onaptests/templates/heat-files/ubuntu18/ubuntu18agent.zip
+ heat_files_to_upload: templates/heat-files/ubuntu18/ubuntu18agent.zip
vnf_parameters: [
{"name": "ubuntu18_image_name",
"value": "ubuntu-agent"
subscription_type: "basic_cnf"
vnfs:
- vnf_name: basic_cnf
- heat_files_to_upload: onaptests/templates/heat-files/basic_cnf/basic_cnf.zip
+ heat_files_to_upload: templates/heat-files/basic_cnf/basic_cnf.zip
vnf_parameters: [
{"name": "dummy_name_0",
"value": "dummy_name"
--- /dev/null
+---
+basic_cnf_macro:
+ tosca_file_from_SDC: service-basic_cnf_macro-template
+ version: "1.0"
+ subscription_type: "basic_cnf_macro"
+ vnfs:
+ - vnf_name: basic_cnf_macro
+ properties:
+ controller_actor: "CDS"
+ skip_post_instantiation_configuration: False
+ sdnc_artifact_name: "vnf"
+ sdnc_model_version: "1.0.0"
+ sdnc_model_name: "APACHE"
+ vnf_artifact_type: "CONTROLLER_BLUEPRINT_ARCHIVE"
+ vnf_artifact_name: "basic_cnf_cba_enriched.zip"
+ vnf_artifact_label: "vnfcba"
+ vnf_artifact_file_path: templates/artifacts/basic_cnf_cba_enriched.zip
+ heat_files_to_upload: templates/heat-files/basic_cnf_macro/basic_cnf_macro.zip
+ vnf_parameters: [
+ {
+ "name": "k8s-rb-profile-namespace",
+ "value": "apache"
+ },
+ {
+ "name": "k8s-rb-profile-k8s-version",
+ "value": "1.19.0"
+ }
+ ]
+ vf_module_parameters:
+ - vf_module_name: helm_apache
+ parameters: [
+ {
+ "name": "vf_module_label",
+ "value": "helm_apache"
+ },
+ {
+ "name": "k8s-rb-profile-name",
+ "value": "node-port-profile"
+ },
+ {
+ "name": "k8s-rb-profile-source",
+ "value": "node-port-profile"
+ },
+ {
+ "name": "k8s-rb-profile-namespace",
+ "value": "apache"
+ },
+ {
+ "name": "k8s-rb-instance-release-name",
+ "value": "rel-1-apache"
+ },
+ {
+ "name": "k8s-rb-config-template-name",
+ "value": "replica-count-template"
+ },
+ {
+ "name": "k8s-rb-config-template-source",
+ "value": "deployment-config"
+ },
+ {
+ "name": "k8s-rb-config-name",
+ "value": "replica-count-change"
+ },
+ {
+ "name": "k8s-rb-config-value-source",
+ "value": "custom-values"
+ }
+ ]
{{ service_name }}:
vnfs:
- vnf_name: {{ service_name }}
- heat_files_to_upload: onaptests/templates/heat-files/ubuntu18/ubuntu18agent.zip
+ heat_files_to_upload: templates/heat-files/ubuntu18/ubuntu18agent.zip
vnf_parameters: [
{"name": "ubuntu18_image_name",
"value": "ubuntu-agent"
basic_vm:
vnfs:
- vnf_name: basic_vm
- heat_files_to_upload: onaptests/templates/heat-files/ubuntu20/ubuntu20agent.zip
+ heat_files_to_upload: templates/heat-files/ubuntu20/ubuntu20agent.zip
vnf_parameters: [
{"name": "ubuntu20_image_name",
"value": "ubuntu-20.04"
vnf_artifact_name: "BASIC_VM_enriched.zip"
vnf_artifact_label: "vnfcds"
vnf_artifact_file_path: "/tmp/BASIC_VM_enriched.zip"
- heat_files_to_upload: onaptests/templates/heat-files/ubuntu20/ubuntu20agent.zip
+ heat_files_to_upload: templates/heat-files/ubuntu20/ubuntu20agent.zip
vf_module_parameters:
- vf_module_name: base_ubuntu20
parameters: [
vnf_artifact_type: "CONTROLLER_BLUEPRINT_ARCHIVE"
vnf_artifact_name: "BASIC_VM_enriched.zip"
vnf_artifact_label: "vnfcds"
- vnf_artifact_file_path: onaptests/templates/artifacts/basic_vm_cba_enriched.zip
- heat_files_to_upload: onaptests/templates/heat-files/ubuntu20/ubuntu20agent.zip
+ vnf_artifact_file_path: templates/artifacts/basic_vm_cba_enriched.zip
+ heat_files_to_upload: templates/heat-files/ubuntu20/ubuntu20agent.zip
vf_module_parameters:
- vf_module_name: base_ubuntu20
parameters: [
clearwater_ims:
vnfs:
- vnf_name: clearwater_ims_vnf
- heat_files_to_upload: onaptests/templates/heat-files/clearwater_ims/clearwater_ims.zip
+ heat_files_to_upload: templates/heat-files/clearwater_ims/clearwater_ims.zip
vnf_parameters: [
{"name": "public_net_id",
"value": "FILL ME"},
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
+ heat_files_to_upload: templates/heat-files/nso_ubuntu/nso_ubuntu.zip
instantiation_type: "Macro"
pnfs:
- pnf_name: "test-pnf"
- heat_files_to_upload: onaptests/templates/artifacts/pNF.csar
+ heat_files_to_upload: templates/artifacts/pNF.csar
pnf_artifact_type: "CONTROLLER_BLUEPRINT_ARCHIVE"
pnf_artifact_name: "CBA_enriched.zip"
pnf_artifact_label: "cbapnf"
"""Standard functions for the simulator wrapper."""
+import os
from importlib.resources import path
+import onaptests
+
+
+def get_resource_location(relative_path: str):
+ return os.path.join(os.path.dirname(os.path.realpath(onaptests.__file__)),
+ relative_path)
+
def get_local_dir():
"""Get the default path for helm charts.
git
bash
deps =
+ pyyaml == 3.13
+ bandit == 1.3
coala-bears
nodeenv