jf9860 | 75010a4 | 2017-02-22 16:52:54 -0500 | [diff] [blame] | 1 | *** Settings *** |
jf9860 | 1aa4c9d | 2017-03-02 16:35:04 -0500 | [diff] [blame] | 2 | Documentation This test template encapsulates the VNF Orchestration use case. |
jf9860 | 75010a4 | 2017-02-22 16:52:54 -0500 | [diff] [blame] | 3 | |
jf9860 | 1aa4c9d | 2017-03-02 16:35:04 -0500 | [diff] [blame] | 4 | Resource test_templates/model_test_template.robot |
| 5 | Resource test_templates/vnf_orchestration_test_template.robot |
| 6 | Resource asdc_interface.robot |
jf9860 | 75010a4 | 2017-02-22 16:52:54 -0500 | [diff] [blame] | 7 | |
| 8 | Library UUID |
| 9 | Library Collections |
| 10 | Library OperatingSystem |
| 11 | Library HttpLibrary.HTTP |
| 12 | Library ExtendedSelenium2Library |
| 13 | |
| 14 | *** Variables *** |
| 15 | |
| 16 | ${ADD_DEMO_CUSTOMER_BODY} robot/assets/templates/aai/add_demo_customer.template |
| 17 | ${AAI_INDEX_PATH} /aai/v8 |
| 18 | ${VF_MODULES_NAME} _Demo_VFModules.json |
jf9860 | 1aa4c9d | 2017-03-02 16:35:04 -0500 | [diff] [blame] | 19 | ${FILE_CACHE} /share/ |
jf9860 | 75010a4 | 2017-02-22 16:52:54 -0500 | [diff] [blame] | 20 | |
jf9860 | 1aa4c9d | 2017-03-02 16:35:04 -0500 | [diff] [blame] | 21 | *** Keywords *** |
jf9860 | 75010a4 | 2017-02-22 16:52:54 -0500 | [diff] [blame] | 22 | Load Customer And Models |
| 23 | [Documentation] Use openECOMP to Orchestrate a service. |
| 24 | [Arguments] ${customer_name} |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame] | 25 | Setup Orchestrate VNF ${GLOBAL_AAI_CLOUD_OWNER} SharedNode OwnerType v1 CloudZone |
jf9860 | 75010a4 | 2017-02-22 16:52:54 -0500 | [diff] [blame] | 26 | Set Test Variable ${CUSTOMER_NAME} ${customer_name} |
| 27 | ${status} ${value}= Run Keyword And Ignore Error Distribute Model vFW demoVFW |
| 28 | ${status} ${value}= Run Keyword And Ignore Error Distribute Model vLB demoVLB |
| 29 | ## MSO polling is 60 second intervals |
jf9860 | 1aa4c9d | 2017-03-02 16:35:04 -0500 | [diff] [blame] | 30 | Sleep 60s |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame] | 31 | ${region}= Get Openstack Region |
| 32 | Create Customer For VNF Demo ${CUSTOMER_NAME} ${CUSTOMER_NAME} INFRA ${GLOBAL_AAI_CLOUD_OWNER} ${region} ${TENANT_ID} |
jf9860 | 75010a4 | 2017-02-22 16:52:54 -0500 | [diff] [blame] | 33 | |
| 34 | Distribute Model |
| 35 | [Arguments] ${service} ${modelName} |
| 36 | ${service_model_type} ${vnf_type} ${vf_modules}= Model Distribution For Directory ${service} ${modelName} |
| 37 | ${jsonString}= Evaluate json.dumps(${vf_modules}) json |
| 38 | OperatingSystem.Create File ${FILE_CACHE}${service}${VF_MODULES_NAME} ${jsonString} |
jf9860 | 1aa4c9d | 2017-03-02 16:35:04 -0500 | [diff] [blame] | 39 | |
jf9860 | 75010a4 | 2017-02-22 16:52:54 -0500 | [diff] [blame] | 40 | Create Customer For VNF Demo |
| 41 | [Documentation] Create demo customer for the demo |
jf9860 | 1aa4c9d | 2017-03-02 16:35:04 -0500 | [diff] [blame] | 42 | [Arguments] ${customer_name} ${customer_id} ${customer_type} ${clouder_owner} ${cloud_region_id} ${tenant_id} |
| 43 | ${data_template}= OperatingSystem.Get File ${ADD_DEMO_CUSTOMER_BODY} |
| 44 | ${arguments}= Create Dictionary subscriber_name=${customer_name} global_customer_id=${customer_id} subscriber_type=${customer_type} cloud_owner=${clouder_owner} cloud_region_id=${cloud_region_id} tenant_id=${tenant_id} |
| 45 | Set To Dictionary ${arguments} service1=vFW service2=vLB |
| 46 | ${data}= Fill JSON Template ${data_template} ${arguments} |
jf9860 | 75010a4 | 2017-02-22 16:52:54 -0500 | [diff] [blame] | 47 | ${put_resp}= Run A&AI Put Request ${INDEX PATH}${ROOT_CUSTOMER_PATH}${customer_id} ${data} |
| 48 | ${status_string}= Convert To String ${put_resp.status_code} |
jf9860 | 1aa4c9d | 2017-03-02 16:35:04 -0500 | [diff] [blame] | 49 | Should Match Regexp ${status_string} ^(201|412)$ |
jf9860 | 75010a4 | 2017-02-22 16:52:54 -0500 | [diff] [blame] | 50 | Create Service If Not Exists vFW |
| 51 | Create Service If Not Exists vLB |
| 52 | |
| 53 | |
| 54 | Preload Demo |
| 55 | [Arguments] ${vnf_name} ${vf_module_name} |
| 56 | ${vf_modules}= Create List |
jf9860 | 1aa4c9d | 2017-03-02 16:35:04 -0500 | [diff] [blame] | 57 | ${status} ${generic_vnf}= Run Keyword And Ignore Error Get Service Instance ${vnf_name} |
jf9860 | 75010a4 | 2017-02-22 16:52:54 -0500 | [diff] [blame] | 58 | Run Keyword If '${status}' == 'FAIL' FAIL VNF Name: ${vnf_name} is not found. |
| 59 | ${vnf_type}= Set Variable ${generic_vnf['vnf-type']} |
| 60 | ${relationships}= Set Variable ${generic_vnf['relationship-list']['relationship']} |
| 61 | ${relationship_data}= Get Relationship Data ${relationships} |
jf9860 | 1aa4c9d | 2017-03-02 16:35:04 -0500 | [diff] [blame] | 62 | :for ${r} in @{relationship_data} |
| 63 | \ ${service}= Set Variable If '${r['relationship-key']}' == 'service-subscription.service-type' ${r['relationship-value']} ${service} |
| 64 | \ ${service_instance_id}= Set Variable If '${r['relationship-key']}' == 'service-instance.service-instance-id' ${r['relationship-value']} ${service_instance_id} |
jf9860 | 75010a4 | 2017-02-22 16:52:54 -0500 | [diff] [blame] | 65 | ${data}= OperatingSystem.Get File ${FILE_CACHE}${service}${VF_MODULES_NAME} |
| 66 | ${vf_modules}= Evaluate json.loads('''${data}''') json |
| 67 | Log ${generic_vnf} |
| 68 | Log ${service_instance_id},${vnf_name},${vnf_type},${vf_module_name},${vf_modules},${service} |
| 69 | Setup Browser |
| 70 | Preload Vnf ${service_instance_id} ${vnf_name} ${vnf_type} ${vf_module_name} ${vf_modules} ${service} demo |
| 71 | [Teardown] Close All Browsers |
jf9860 | 1aa4c9d | 2017-03-02 16:35:04 -0500 | [diff] [blame] | 72 | |
jf9860 | 75010a4 | 2017-02-22 16:52:54 -0500 | [diff] [blame] | 73 | Get Relationship Data |
| 74 | [Arguments] ${relationships} |
| 75 | :for ${r} in @{relationships} |
jf9860 | 1aa4c9d | 2017-03-02 16:35:04 -0500 | [diff] [blame] | 76 | \ ${status} ${relationship_data} Run Keyword And Ignore Error Set Variable ${r['relationship-data']} |
| 77 | \ Return From Keyword If '${status}' == 'PASS' ${relationship_data} |
| 78 | |
| 79 | |
jf9860 | 75010a4 | 2017-02-22 16:52:54 -0500 | [diff] [blame] | 80 | Get Service Instance |
| 81 | [Arguments] ${vnf_name} |
jf9860 | 1aa4c9d | 2017-03-02 16:35:04 -0500 | [diff] [blame] | 82 | ${resp}= Run A&AI Get Request ${AAI_INDEX PATH}/network/generic-vnfs/generic-vnf?vnf-name=${vnf_name} |
jf9860 | 75010a4 | 2017-02-22 16:52:54 -0500 | [diff] [blame] | 83 | Should Be Equal As Strings ${resp.status_code} 200 |
jf9860 | 1aa4c9d | 2017-03-02 16:35:04 -0500 | [diff] [blame] | 84 | [Return] ${resp.json()} |
| 85 | |
| 86 | APPC Mount Point |
jf9860 | 75010a4 | 2017-02-22 16:52:54 -0500 | [diff] [blame] | 87 | [Arguments] ${vf_module_name} |
| 88 | Run Openstack Auth Request auth |
| 89 | ${status} ${stack_info}= Run Keyword and Ignore Error Wait for Stack to Be Deployed auth ${vf_module_name} timeout=120s |
| 90 | Run Keyword if '${status}' == 'FAIL' FAIL ${vf_module_name} Stack is not found |
| 91 | ${stack_id}= Get From Dictionary ${stack_info} id |
jf9860 | 1aa4c9d | 2017-03-02 16:35:04 -0500 | [diff] [blame] | 92 | ${server_list}= Get Openstack Servers auth |
jf9860 | 75010a4 | 2017-02-22 16:52:54 -0500 | [diff] [blame] | 93 | ${vpg_name_0}= Get From Dictionary ${stack_info} vpg_name_0 |
jf9860 | 1aa4c9d | 2017-03-02 16:35:04 -0500 | [diff] [blame] | 94 | ${vpg_public_ip}= Get Server Ip ${server_list} ${stack_info} vpg_name_0 network_name=public |
| 95 | ${vpg_oam_ip}= Get From Dictionary ${stack_info} vpg_private_ip_1 |
| 96 | ${appc}= Create Mount Point In APPC ${vpg_name_0} ${vpg_oam_ip} |