diff options
author | Jerry Flood <jf9860@att.com> | 2017-04-21 09:18:54 -0400 |
---|---|---|
committer | Jerry Flood <jf9860@att.com> | 2017-04-21 09:19:05 -0400 |
commit | e96f72abf06a0708cbe6a174ad49447b7c7544f5 (patch) | |
tree | 901a13682b4782c156299cf64aa9238271c4a9d6 | |
parent | fe31756139f033078bf7d6b583fb7b6bf595edaa (diff) |
[TEST-25] Add commands to demo.sh
Add suuport for
init_customer
distribute
instantiateVFW
deleteVNF
Fix red.xml
Remove deletion of regions, tenant etc
from A&AI durinf terdown which pulls the rug out
from under the demo customer.
Change-Id: Iab76c980d4c3b6b79d4f5a72a71c3a79d6423a13
Signed-off-by: Jerry Flood <jf9860@att.com>
-rw-r--r-- | red.xml | 6 | ||||
-rw-r--r-- | robot/resources/demo_preload.robot | 130 | ||||
-rw-r--r-- | robot/resources/test_templates/vnf_orchestration_test_template.robot | 4 | ||||
-rw-r--r-- | robot/testsuites/demo.robot | 36 |
4 files changed, 148 insertions, 28 deletions
@@ -23,9 +23,9 @@ <path location="robot/library"/> </pythonpath> <classpath/> - <variableFiles path="testsuite/ete-properties/dfw_robot_properties_local.py"/> - <variableFiles path="testsuite/ete-properties/dfw_preload_parameters.py"/> - <variableFiles path="testsuite/ete-properties/dfw_vm_properties.py"/> + <variableFiles path="../properties/integration_robot_properties.py"/> + <variableFiles path="../properties/integration_preload_parameters.py"/> + <variableFiles path="../properties/sample_vm_properties.py"/> <variableFiles path="testsuite/robot/assets/service_mappings.py"/> <excludedForValidation/> <isValidatedFileSizeCheckingEnabled>true</isValidatedFileSizeCheckingEnabled> diff --git a/robot/resources/demo_preload.robot b/robot/resources/demo_preload.robot index 02e4ce69..76a114ce 100644 --- a/robot/resources/demo_preload.robot +++ b/robot/resources/demo_preload.robot @@ -10,6 +10,7 @@ Library Collections Library OperatingSystem Library HttpLibrary.HTTP Library ExtendedSelenium2Library +Library RequestsLibrary *** Variables *** @@ -22,20 +23,27 @@ ${FILE_CACHE} /share/ Load Customer And Models [Documentation] Use openECOMP to Orchestrate a service. [Arguments] ${customer_name} + Load Customer ${customer_name} + Load Models ${customer_name} + +Load Customer + [Documentation] Use openECOMP to Orchestrate a service. + [Arguments] ${customer_name} Setup Orchestrate VNF ${GLOBAL_AAI_CLOUD_OWNER} SharedNode OwnerType v1 CloudZone Set Test Variable ${CUSTOMER_NAME} ${customer_name} - ${status} ${value}= Run Keyword And Ignore Error Distribute Model vFW demoVFW - ${status} ${value}= Run Keyword And Ignore Error Distribute Model vLB demoVLB - ## MSO polling is 60 second intervals - Sleep 60s ${region}= Get Openstack Region Create Customer For VNF Demo ${CUSTOMER_NAME} ${CUSTOMER_NAME} INFRA ${GLOBAL_AAI_CLOUD_OWNER} ${region} ${TENANT_ID} +Load Models + [Documentation] Use openECOMP to Orchestrate a service. + [Arguments] ${customer_name} + Set Test Variable ${CUSTOMER_NAME} ${customer_name} + ${status} ${value}= Run Keyword And Ignore Error Distribute Model vFW demoVFW + ${status} ${value}= Run Keyword And Ignore Error Distribute Model vLB demoVLB + Distribute Model [Arguments] ${service} ${modelName} ${service_model_type} ${vnf_type} ${vf_modules}= Model Distribution For Directory ${service} ${modelName} - ${jsonString}= Evaluate json.dumps(${vf_modules}) json - OperatingSystem.Create File ${FILE_CACHE}${service}${VF_MODULES_NAME} ${jsonString} Create Customer For VNF Demo [Documentation] Create demo customer for the demo @@ -50,26 +58,32 @@ Create Customer For VNF Demo Create Service If Not Exists vFW Create Service If Not Exists vLB - -Preload Demo +Preload User Model + [Documentation] Preload the demo data for the passed VNF with the passed module name [Arguments] ${vnf_name} ${vf_module_name} - ${vf_modules}= Create List + # Go to A&AI and get information about the VNF we need to preload ${status} ${generic_vnf}= Run Keyword And Ignore Error Get Service Instance ${vnf_name} Run Keyword If '${status}' == 'FAIL' FAIL VNF Name: ${vnf_name} is not found. ${vnf_type}= Set Variable ${generic_vnf['vnf-type']} ${relationships}= Set Variable ${generic_vnf['relationship-list']['relationship']} ${relationship_data}= Get Relationship Data ${relationships} + ${customer_id}= Catenate :for ${r} in @{relationship_data} \ ${service}= Set Variable If '${r['relationship-key']}' == 'service-subscription.service-type' ${r['relationship-value']} ${service} \ ${service_instance_id}= Set Variable If '${r['relationship-key']}' == 'service-instance.service-instance-id' ${r['relationship-value']} ${service_instance_id} - ${data}= OperatingSystem.Get File ${FILE_CACHE}${service}${VF_MODULES_NAME} - ${vf_modules}= Evaluate json.loads('''${data}''') json + \ ${customer_id}= Set Variable If '${r['relationship-key']}' == 'customer.global-customer-id' ${r['relationship-value']} ${customer_id} + ${invariantUUID}= Get Persona Model Id ${service_instance_id} ${service} ${customer_id} + + # We still need the vf module names. We can get them from VID using the persona_model_id (invariantUUID) from A&AI + Setup Browser + Login To VID GUI + ${vf_modules}= Get Module Names from VID ${invariantUUID} Log ${generic_vnf} Log ${service_instance_id},${vnf_name},${vnf_type},${vf_module_name},${vf_modules},${service} - Setup Browser Preload Vnf ${service_instance_id} ${vnf_name} ${vnf_type} ${vf_module_name} ${vf_modules} ${service} demo [Teardown] Close All Browsers + Get Relationship Data [Arguments] ${relationships} :for ${r} in @{relationships} @@ -83,6 +97,58 @@ Get Service Instance Should Be Equal As Strings ${resp.status_code} 200 [Return] ${resp.json()} +Get Persona Model Id + [Documentation] Query and Validates A&AI Service Instance + [Arguments] ${service_instance_id} ${service_type} ${customer_id} + ${resp}= Run A&AI Get Request ${INDEX PATH}${CUSTOMER SPEC PATH}${customer_id}${SERVICE SUBSCRIPTIONS}${service_type}${SERVICE INSTANCE}${service_instance_id} + ${persona_model_id}= Get From DIctionary ${resp.json()['service-instance'][0]} persona-model-id + [Return] ${persona_model_id} + + +Get Model UUID from VID + [Documentation] Must use UI since rest call get redirect to portal and get DNS error + ... Search all services and match on the invariantUUID + [Arguments] ${invariantUUID} + Go To ${GLOBAL_VID_SERVER}${VID_ENV}/rest/models/services + ${resp}= Get Text xpath=//body/pre + ${json}= To Json ${resp} + :for ${dict} in @{json} + \ ${uuid}= Get From DIctionary ${dict} uuid + \ ${inv}= Get From DIctionary ${dict} invariantUUID + \ Return From Keyword If "${invariantUUID}" == "${inv}" ${uuid} + [Return] "" + + +Get Module Names from VID + [Documentation] Must use UI since rest call get redirect to portal and get DNS error + ... Given the invariantUUID of the model, mock up the vf_modules list passed to Preload VNF + [Arguments] ${invariantUUID} + ${id}= Get Model UUID from VID ${invariantUUID} + Go To ${GLOBAL_VID_SERVER}${VID_ENV}/rest/models/services/${id} + ${resp}= Get Text xpath=//body/pre + ${json}= To Json ${resp} + ${modules}= Create List + ${vnfs}= Get From Dictionary ${json} vnfs + ${keys}= Get Dictionary Keys ${vnfs} + :for ${key} in @{keys} + \ Add VFModule ${vnfs['${key}']} ${modules} + [Return] ${modules} + +Add VFModule + [Documentation] Dig the vf module names from the VID service model + [Arguments] ${vnf} ${modules} + ${vfModules}= Get From Dictionary ${vnf} vfModules + ${keys}= Get Dictionary Keys ${vfModules} + :for ${key} in @{keys} + \ ${module}= Get From Dictionary ${vfModules} ${key} + \ ${dict}= Create Dictionary name=${module['name']} + \ Append to List ${modules} ${dict} + + + + + + APPC Mount Point [Arguments] ${vf_module_name} Run Openstack Auth Request auth @@ -94,3 +160,43 @@ APPC Mount Point ${vpg_public_ip}= Get Server Ip ${server_list} ${stack_info} vpg_name_0 network_name=public ${vpg_oam_ip}= Get From Dictionary ${stack_info} vpg_private_ip_1 ${appc}= Create Mount Point In APPC ${vpg_name_0} ${vpg_oam_ip} + +Instantiate VNF + [Arguments] ${service} + Setup Orchestrate VNF ${GLOBAL_AAI_CLOUD_OWNER} SharedNode OwnerType v1 CloudZone + ${vf_module_name} ${service}= Orchestrate VNF DemoCust ${service} ${service} ${TENANT_NAME} + Save For Delete + Log to Console Customer Name=${CUSTOMER_NAME} + Log to Console VNF Module Name=${vf_module_name} + +Save For Delete + [Documentation] Create a variable file to be loaded for save for delete + ${dict}= Create Dictionary + Set To Dictionary ${dict} TENANT_NAME=${TENANT_NAME} + Set To Dictionary ${dict} TENANT_ID=${TENANT_ID} + Set To Dictionary ${dict} CUSTOMER_NAME=${CUSTOMER_NAME} + Set To Dictionary ${dict} STACK_NAME=${STACK_NAME} + Set To Dictionary ${dict} SERVICE=${SERVICE} + Set To Dictionary ${dict} VVG_SERVER_ID=${VVG_SERVER_ID} + Set To Dictionary ${dict} SERVICE_INSTANCE_ID=${SERVICE_INSTANCE_ID} + + Set To Dictionary ${dict} VLB_CLOSED_LOOP_DELETE=${VLB_CLOSED_LOOP_DELETE} + Set To Dictionary ${dict} VLB_CLOSED_LOOP_VNF_ID=${VLB_CLOSED_LOOP_VNF_ID} + + Set To Dictionary ${dict} CATALOG_SERVICE_ID=${CATALOG_SERVICE_ID} + + ${vars}= Catenate + ${keys}= Get Dictionary Keys ${dict} + :for ${key} in @{keys} + \ ${value}= Get From Dictionary ${dict} ${key} + \ ${vars}= Catenate ${vars}${key} = "${value}"\n + + ${comma}= Catenate + ${vars}= Catenate ${vars}CATALOG_RESOURCE_IDS = [ + :for ${id} in @{CATALOG_RESOURCE_IDS} + \ ${vars}= Catenate ${vars}${comma} "${id}" + \ ${comma}= Catenate , + ${vars}= Catenate ${vars}]\n + OperatingSystem.Create File ${FILE_CACHE}/${STACK_NAME}.py ${vars} + + diff --git a/robot/resources/test_templates/vnf_orchestration_test_template.robot b/robot/resources/test_templates/vnf_orchestration_test_template.robot index 9de590b9..63da86b7 100644 --- a/robot/resources/test_templates/vnf_orchestration_test_template.robot +++ b/robot/resources/test_templates/vnf_orchestration_test_template.robot @@ -156,9 +156,5 @@ Teardown Stack Clean A&AI Inventory [Documentation] Clean up Tenant in A&AI, Create Customer, Create Service and related relationships - :FOR ${region} IN @{REGIONS} - \ Delete Tenant ${TENANT_ID} ${GLOBAL_AAI_CLOUD_OWNER} ${region} - \ Delete Cloud Region ${TENANT_ID} ${GLOBAL_AAI_CLOUD_OWNER} ${region} Delete Customer ${CUSTOMER_NAME} - Delete Service If Exists ${SERVICE} diff --git a/robot/testsuites/demo.robot b/robot/testsuites/demo.robot index 5c8f415b..f5788d50 100644 --- a/robot/testsuites/demo.robot +++ b/robot/testsuites/demo.robot @@ -1,25 +1,43 @@ *** Settings *** Documentation Executes the VNF Orchestration Test cases including setup and teardown ... - +Library Collections Resource ../resources/demo_preload.robot *** Variables *** ${VNF_NAME} DemoVNF ${MODULE_NAME} DemoModuleName -*** Test Cases *** +*** Test Cases *** Initialize Customer And Models - [Tags] InitDemo - Load Customer And Models Demonstration + [Tags] InitDemo + Load Customer And Models Demonstration + +Initialize Customer + [Tags] InitCustomer + Load Customer Demonstration + +Initialize Models + [Tags] InitDistribution + Load Models Demonstration Preload VNF - [Tags] PreloadDemo - Preload Demo ${VNF_NAME} ${MODULE_NAME} - + [Tags] PreloadDemo + Preload User Model ${VNF_NAME} ${MODULE_NAME} + Create APPC Mount Point - [Tags] APPCMountPointDemo - APPC Mount Point ${MODULE_NAME} + [Tags] APPCMountPointDemo + APPC Mount Point ${MODULE_NAME} +Instantiate VFW + [Tags] instantiateVFW + Instantiate VNF vFW +Delete Instantiated VNF + [Documentation] This test assumes all necessary variables are loaded via the variable file create in Save For Delete + ... The Teardown VNF needs to be in the teardown step of the test case... + [Tags] deleteVNF + Setup Browser + Login To VID GUI + [Teardown] Teardown VNF |