diff options
-rw-r--r-- | setup.cfg | 1 | ||||
-rw-r--r-- | src/onaptests/configuration/basic_vm_macro_stability_settings.py | 4 | ||||
-rw-r--r-- | src/onaptests/scenario/basic_vm_macro_stability.py | 44 | ||||
-rw-r--r-- | src/onaptests/steps/onboard/vf.py | 7 | ||||
-rw-r--r-- | src/onaptests/templates/artifacts/basic_vm_cba_enriched.zip | bin | 0 -> 9502 bytes | |||
-rw-r--r-- | src/onaptests/templates/vnf-services/basic_vm_macro_stability-service.yaml | 54 |
6 files changed, 109 insertions, 1 deletions
@@ -46,6 +46,7 @@ testpaths = tests xtesting.testcase = basic_vm = onaptests.scenario.basic_vm:BasicVm basic_vm_macro = onaptests.scenario.basic_vm_macro:BasicVmMacro + basic_vm_macro_stability = onaptests.scenario.basic_vm_macro_stability:BasicVmMacroStability basic_network = onaptests.scenario.basic_network:BasicNetwork basic_cnf = onaptests.scenario.basic_cnf:BasicCnf basic_cds = onaptests.scenario.cds_blueprint_enrichment:CDSBlueprintEnrichment diff --git a/src/onaptests/configuration/basic_vm_macro_stability_settings.py b/src/onaptests/configuration/basic_vm_macro_stability_settings.py new file mode 100644 index 0000000..06938c4 --- /dev/null +++ b/src/onaptests/configuration/basic_vm_macro_stability_settings.py @@ -0,0 +1,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") diff --git a/src/onaptests/scenario/basic_vm_macro_stability.py b/src/onaptests/scenario/basic_vm_macro_stability.py new file mode 100644 index 0000000..552a331 --- /dev/null +++ b/src/onaptests/scenario/basic_vm_macro_stability.py @@ -0,0 +1,44 @@ +"""Instantiate basic vm using SO macro flow.""" +import logging +import time + +from onapsdk.configuration import settings +from onapsdk.exceptions import SDKException +from xtesting.core import testcase + +from onaptests.utils.exceptions import OnapTestException +from onaptests.steps.instantiate.service_macro import YamlTemplateServiceMacroInstantiateStep + + +class BasicVmMacroStability(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"] = 'basic_vm_macro_stability' + super().__init__(**kwargs) + self.__logger.debug("Basic VM macro stability init started") + self.test = YamlTemplateServiceMacroInstantiateStep(cleanup=settings.CLEANUP_FLAG) + + def run(self): + """Run basic vm 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() diff --git a/src/onaptests/steps/onboard/vf.py b/src/onaptests/steps/onboard/vf.py index 7e4882e..76aaf2e 100644 --- a/src/onaptests/steps/onboard/vf.py +++ b/src/onaptests/steps/onboard/vf.py @@ -1,3 +1,5 @@ +from pathlib import Path +import sys import time from onapsdk.configuration import settings @@ -94,11 +96,14 @@ class YamlTemplateVfOnboardStep(YamlTemplateBaseStep): "vnf_artifact_label", "vnf_artifact_file_path"]]): 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) vf.add_deployment_artifact( artifact_type=vnf["vnf_artifact_type"], artifact_name=vnf["vnf_artifact_name"], artifact_label=vnf["vnf_artifact_label"], - artifact=vnf["vnf_artifact_file_path"] + artifact=str(artifact_file_path) ) time.sleep(10) vf.onboard() diff --git a/src/onaptests/templates/artifacts/basic_vm_cba_enriched.zip b/src/onaptests/templates/artifacts/basic_vm_cba_enriched.zip Binary files differnew file mode 100644 index 0000000..eb63639 --- /dev/null +++ b/src/onaptests/templates/artifacts/basic_vm_cba_enriched.zip diff --git a/src/onaptests/templates/vnf-services/basic_vm_macro_stability-service.yaml b/src/onaptests/templates/vnf-services/basic_vm_macro_stability-service.yaml new file mode 100644 index 0000000..fd56a37 --- /dev/null +++ b/src/onaptests/templates/vnf-services/basic_vm_macro_stability-service.yaml @@ -0,0 +1,54 @@ +--- +basic_vm_macro: + instantiation_type: "Macro" + vnfs: + - vnf_name: basic_vm_macro + properties: + controller_actor: "CDS" + skip_post_instantiation_configuration: False + sdnc_artifact_name: "vnf" + sdnc_model_version: "1.0.0" + sdnc_model_name: "ubuntu20" + 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 + vf_module_parameters: + - vf_module_name: base_ubuntu20 + parameters: [ + {"name": "ubuntu20_image_name", + "value": "Ubuntu_2004" + }, + {"name": "ubuntu20_key_name", + "value": "cleouverte" + }, + {"name": "ubuntu20_pub_key", + "value": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAA\ + BAQDY15cdBmIs2XOpe4EiFCsaY6bmUmK/GysMoLl4UG51JCfJwvwoWCoA+6mDIbymZxhxq9IGx\ + ilp/yTA6WQ9s/5pBag1cUMJmFuda9PjOkXl04jgqh5tR6I+GZ97AvCg93KAECis5ubSqw1xOCj4\ + utfEUtPoF1OuzqM/lE5mY4N6VKXn+fT7pCD6cifBEs6JHhVNvs5OLLp/tO8Pa3kKYQOdyS0xc3r\ + h+t2lrzvKUSWGZbX+dLiFiEpjsUL3tDqzkEMNUn4pdv69OJuzWHCxRWPfdrY9Wg0j3mJesP29EBh\ + t+w+EC9/kBKq+1VKdmsXUXAcjEvjovVL8l1BrX3BY0R8D imported-openssh-key" + }, + {"name": "ubuntu20_flavor_name", + "value": "m1.smaller" + }, + {"name": "VM_name", + "value": "ubuntu20agent-VM-01" + }, + {"name": "vnf_id", + "value": "ubuntu20agent-VNF-instance" + }, + {"name": "vf_module_id", + "value": "ubuntu20agent-vfmodule-instance" + }, + {"name": "vnf_name", + "value": "ubuntu20agent-VNF" + }, + {"name": "admin_plane_net_name", + "value": "admin" + }, + {"name": "ubuntu20_name_0", + "value": "ubuntu20agent-VNF"} + ] |