From cc2623baa0b64da8d441ead586416807e3e16faa Mon Sep 17 00:00:00 2001 From: Brian Freeman Date: Mon, 29 Oct 2018 09:15:15 -0500 Subject: Distribute Demo VNF from existing model Firt version that uses a static file of the vnf-type and vf-module-id SDC query can be used to get these but that will be a second pass. Issue-ID: INT-704 Change-Id: Icf4571a0ad11d59f7985a253e55fcb5894a3e82f Signed-off-by: Brian Freeman --- robot/resources/demo_preload.robot | 15 ++++-- .../vnf_orchestration_test_template.robot | 62 ++++++++++++++++++++++ robot/testsuites/demo.robot | 4 ++ vnf_resources.json.example | 17 ++++++ 4 files changed, 95 insertions(+), 3 deletions(-) create mode 100644 vnf_resources.json.example diff --git a/robot/resources/demo_preload.robot b/robot/resources/demo_preload.robot index ff7e9bf3..5b03a0b5 100644 --- a/robot/resources/demo_preload.robot +++ b/robot/resources/demo_preload.robot @@ -164,9 +164,18 @@ Instantiate VNF Log to Console ModelInvariantID=${model_invariant_id} ${status} ${value}= Run Keyword And Ignore Error Update vVFWCL Policy ${model_invariant_id} ${status} ${value}= Run Keyword And Ignore Error APPC Mount Point ${vf_module_name} - - - + +Instantiate Demo VNF + [Arguments] ${service} ${vf_module_label}=NULL + Setup Orchestrate VNF ${GLOBAL_AAI_CLOUD_OWNER} SharedNode OwnerType v1 CloudZone + ${vf_module_name} ${service}= Orchestrate Demo VNF Demonstration ${service} ${service} ${TENANT_NAME} + #Save For Delete + Log to Console Customer Name=${CUSTOMER_NAME} + Log to Console VNF Module Name=${vf_module_name} + ${model_invariant_id}= Run MSO Get ModelInvariantId ${SUITE_SERVICE_MODEL_NAME} ${vf_module_label} + Log to Console ModelInvariantID=${model_invariant_id} + ${status} ${value}= Run Keyword And Ignore Error Update vVFWCL Policy ${model_invariant_id} + ${status} ${value}= Run Keyword And Ignore Error APPC Mount Point ${vf_module_name} Save For Delete diff --git a/robot/resources/test_templates/vnf_orchestration_test_template.robot b/robot/resources/test_templates/vnf_orchestration_test_template.robot index 3a9c5570..b13a088b 100644 --- a/robot/resources/test_templates/vnf_orchestration_test_template.robot +++ b/robot/resources/test_templates/vnf_orchestration_test_template.robot @@ -86,6 +86,68 @@ Orchestrate VNF [Return] ${vf_module_name} ${service} +Orchestrate Demo VNF + [Documentation] Use ONAP to Orchestrate a service from Demonstration Models. + [Arguments] ${customer_name} ${service} ${product_family} ${tenant} ${project_name}=Project-Demonstration ${owning_entity}=OE-Demonstration + ${service_model_type}= Set Variable If + ... '${service}'=='vFWCL' demoVFWCL + ... '${service}'=='vFW' demoVFW + ... '${service}'=='vLB' demoVLB + ${lcp_region}= Get Openstack Region + ${uuid}= Generate UUID + Set Test Variable ${CUSTOMER_NAME} ${customer_name} + Set Test Variable ${SERVICE} ${service} + ${list}= Create List + Set Test Variable ${STACK_NAMES} ${list} + ${service_name}= Catenate Service_Ete_Name${uuid} + ${service_type}= Set Variable ${service} + #${service_model_type} ${vnf_type} ${vf_modules} ${catalog_resources}= Model Distribution For Directory ${service} + #${service_model_type} ${vnf_type} ${vf_modules} ${catalog_resources}= Get Demonstration Model Data ${service_model_type} + ${vnf_json_resources} OperatingSystem.Get File /tmp/config/vnf_resources.json + # need dictionary for service with vnf_type vf_module + Set Suite Variable ${SUITE_SERVICE_MODEL_NAME} ${service_model_type} + Setup Browser + Login To VID GUI + ${service_instance_id}= Wait Until Keyword Succeeds 300s 5s Create VID Service Instance ${customer_name} ${service_model_type} ${service} ${service_name} ${project_name} ${owning_entity} + Set Test Variable ${SERVICE_INSTANCE_ID} ${service_instance_id} + Validate Service Instance ${service_instance_id} ${service} ${customer_name} + ${vnflist}= Get From Dictionary ${GLOBAL_SERVICE_VNF_MAPPING} ${service} + :for ${vnf} in @{vnflist} + \ ${vnf_name}= Catenate Ete_${vnf}_${uuid} + \ ${vf_module_name}= Catenate Vfmodule_Demo_${vnf}_${uuid} + \ ${vnf_type}= Get Demo VNF Type ${vnf_json_resources} ${vnf} + \ ${vf_module}= Get Demo VF Module ${vnf_json_resources} ${vnf} + \ Append To List ${STACK_NAMES} ${vf_module_name} + \ Wait Until Keyword Succeeds 300s 5s Create VID VNF ${service_instance_id} ${vnf_name} ${product_family} ${lcp_region} ${tenant} ${vnf_type} ${CUSTOMER_NAME} + \ ${vf_module_entry}= Create Dictionary name=${vf_module} + \ ${vf_modules}= Create List ${vf_module_entry} + \ ${vf_module_type} ${closedloop_vf_module}= Preload Vnf ${service_instance_id} ${vnf_name} ${vnf_type} ${vf_module_name} ${vf_modules} ${vnf} ${uuid} + \ ${vf_module_id}= Create VID VNF module ${service_instance_id} ${vf_module_name} ${lcp_region} ${tenant} ${vf_module_type} ${CUSTOMER_NAME} ${vnf_name} + \ ${generic_vnf}= Validate Generic VNF ${vnf_name} ${vnf_type} ${service_instance_id} + \ VLB Closed Loop Hack ${service} ${generic_vnf} ${closedloop_vf_module} + \ Set Test Variable ${STACK_NAME} ${vf_module_name} + \ Append To List ${STACK_NAMES} ${STACK_NAME} + # TODO: Need to look at a better way to default ipv4_oam_interface search for Heatbridge + \ Run Keyword and Ignore Error Execute Heatbridge ${vf_module_name} ${service_instance_id} ${vnf} ipv4_oam_interface + \ Run Keyword and Ignore Error Validate VF Module ${vf_module_name} ${vnf} + [Return] ${vf_module_name} ${service} + + +Get Demo VNF Type + [Documentation] Get vnf_type from json demo vnf data + [Arguments] ${json_resources} ${vnf} + ${vnf_type}= Get Json Value ${json_resources} /${vnf}/vnf_type + ${vnf_type}= Remove String ${vnf_type} " + [Return] ${vnf_type} + +Get Demo VF Module + [Documentation] Get vf_module from json demo vnf data + [Arguments] ${json_resources} ${vnf} + ${vf_module}= Get Json Value ${json_resources} /${vnf}/vf_module + ${vf_module}= Remove String ${vf_module} " + [Return] ${vf_module} + + Get VNF Type [Documentation] To support services with multiple VNFs, we need to dig the vnf type out of the SDC catalog resources to select in the VID UI [Arguments] ${resources} ${vnf} diff --git a/robot/testsuites/demo.robot b/robot/testsuites/demo.robot index 72a4a8e3..e329671c 100644 --- a/robot/testsuites/demo.robot +++ b/robot/testsuites/demo.robot @@ -39,6 +39,10 @@ Instantiate VFW [Tags] instantiateVFW Instantiate VNF vFW base_vfw +Instantiate Demo VFWCL + [Tags] instantiateDemoVFWCL + Instantiate Demo VNF vFWCL base_vpkg + Instantiate VFWCL [Tags] instantiateVFWCL Instantiate VNF vFWCL base_vpkg diff --git a/vnf_resources.json.example b/vnf_resources.json.example new file mode 100644 index 00000000..e5f187fc --- /dev/null +++ b/vnf_resources.json.example @@ -0,0 +1,17 @@ +{ + "vFWSNK": { + "vnf_type": "53a6f526-7df5-4d96-8646 0", + "vf_module": "53a6f5267df54d968646..base_vfw..module-0" + }, + "vPKG": { + "vnf_type": "6652ddfc-6759-47ec-9ef5 0", + "vf_module": "6652ddfc675947ec9ef5..base_vpkg..module-0" + } +} + +# SDC Query +# http://{{sdc_be_port}}//sdc2/rest/v1/catalog/services/serviceName/demoVFWCL/serviceVersion/1.0 +# componentInstances[].groupInstances[0].groupName +# componentInstances[].name +# groupInstances[]."groupName": "53a6f5267df54d968646..base_vfw..module-0", +# "name": "53a6f526-7df5-4d96-8646 0", -- cgit 1.2.3-korg