blob: eba91f91e267baaa30c5fd0463ac8e0d2d77d96c [file] [log] [blame]
jf986075010a42017-02-22 16:52:54 -05001*** Settings ***
jf98601aa4c9d2017-03-02 16:35:04 -05002Documentation This test template encapsulates the VNF Orchestration use case.
jf986075010a42017-02-22 16:52:54 -05003
jf98601aa4c9d2017-03-02 16:35:04 -05004Resource test_templates/model_test_template.robot
5Resource test_templates/vnf_orchestration_test_template.robot
6Resource asdc_interface.robot
jf986075010a42017-02-22 16:52:54 -05007
8Library UUID
9Library Collections
10Library OperatingSystem
11Library HttpLibrary.HTTP
12Library 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
jf98601aa4c9d2017-03-02 16:35:04 -050019${FILE_CACHE} /share/
jf986075010a42017-02-22 16:52:54 -050020
jf98601aa4c9d2017-03-02 16:35:04 -050021*** Keywords ***
jf986075010a42017-02-22 16:52:54 -050022Load Customer And Models
23 [Documentation] Use openECOMP to Orchestrate a service.
24 [Arguments] ${customer_name}
25 Setup Orchestrate VNF ${GLOBAL_AAI_CLOUD_OWNER} ${GLOBAL_OPENSTACK_SERVICE_REGION} SharedNode OwnerType v1 CloudZone
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
jf98601aa4c9d2017-03-02 16:35:04 -050030 Sleep 60s
31 Create Customer For VNF Demo ${CUSTOMER_NAME} ${CUSTOMER_NAME} INFRA ${GLOBAL_AAI_CLOUD_OWNER} ${GLOBAL_OPENSTACK_SERVICE_REGION} ${TENANT_ID}
jf986075010a42017-02-22 16:52:54 -050032
33Distribute Model
34 [Arguments] ${service} ${modelName}
35 ${service_model_type} ${vnf_type} ${vf_modules}= Model Distribution For Directory ${service} ${modelName}
36 ${jsonString}= Evaluate json.dumps(${vf_modules}) json
37 OperatingSystem.Create File ${FILE_CACHE}${service}${VF_MODULES_NAME} ${jsonString}
jf98601aa4c9d2017-03-02 16:35:04 -050038
jf986075010a42017-02-22 16:52:54 -050039Create Customer For VNF Demo
40 [Documentation] Create demo customer for the demo
jf98601aa4c9d2017-03-02 16:35:04 -050041 [Arguments] ${customer_name} ${customer_id} ${customer_type} ${clouder_owner} ${cloud_region_id} ${tenant_id}
42 ${data_template}= OperatingSystem.Get File ${ADD_DEMO_CUSTOMER_BODY}
43 ${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}
44 Set To Dictionary ${arguments} service1=vFW service2=vLB
45 ${data}= Fill JSON Template ${data_template} ${arguments}
jf986075010a42017-02-22 16:52:54 -050046 ${put_resp}= Run A&AI Put Request ${INDEX PATH}${ROOT_CUSTOMER_PATH}${customer_id} ${data}
47 ${status_string}= Convert To String ${put_resp.status_code}
jf98601aa4c9d2017-03-02 16:35:04 -050048 Should Match Regexp ${status_string} ^(201|412)$
jf986075010a42017-02-22 16:52:54 -050049 Create Service If Not Exists vFW
50 Create Service If Not Exists vLB
51
52
53Preload Demo
54 [Arguments] ${vnf_name} ${vf_module_name}
55 ${vf_modules}= Create List
jf98601aa4c9d2017-03-02 16:35:04 -050056 ${status} ${generic_vnf}= Run Keyword And Ignore Error Get Service Instance ${vnf_name}
jf986075010a42017-02-22 16:52:54 -050057 Run Keyword If '${status}' == 'FAIL' FAIL VNF Name: ${vnf_name} is not found.
58 ${vnf_type}= Set Variable ${generic_vnf['vnf-type']}
59 ${relationships}= Set Variable ${generic_vnf['relationship-list']['relationship']}
60 ${relationship_data}= Get Relationship Data ${relationships}
jf98601aa4c9d2017-03-02 16:35:04 -050061 :for ${r} in @{relationship_data}
62 \ ${service}= Set Variable If '${r['relationship-key']}' == 'service-subscription.service-type' ${r['relationship-value']} ${service}
63 \ ${service_instance_id}= Set Variable If '${r['relationship-key']}' == 'service-instance.service-instance-id' ${r['relationship-value']} ${service_instance_id}
jf986075010a42017-02-22 16:52:54 -050064 ${data}= OperatingSystem.Get File ${FILE_CACHE}${service}${VF_MODULES_NAME}
65 ${vf_modules}= Evaluate json.loads('''${data}''') json
66 Log ${generic_vnf}
67 Log ${service_instance_id},${vnf_name},${vnf_type},${vf_module_name},${vf_modules},${service}
68 Setup Browser
69 Preload Vnf ${service_instance_id} ${vnf_name} ${vnf_type} ${vf_module_name} ${vf_modules} ${service} demo
70 [Teardown] Close All Browsers
jf98601aa4c9d2017-03-02 16:35:04 -050071
jf986075010a42017-02-22 16:52:54 -050072Get Relationship Data
73 [Arguments] ${relationships}
74 :for ${r} in @{relationships}
jf98601aa4c9d2017-03-02 16:35:04 -050075 \ ${status} ${relationship_data} Run Keyword And Ignore Error Set Variable ${r['relationship-data']}
76 \ Return From Keyword If '${status}' == 'PASS' ${relationship_data}
77
78
jf986075010a42017-02-22 16:52:54 -050079Get Service Instance
80 [Arguments] ${vnf_name}
jf98601aa4c9d2017-03-02 16:35:04 -050081 ${resp}= Run A&AI Get Request ${AAI_INDEX PATH}/network/generic-vnfs/generic-vnf?vnf-name=${vnf_name}
jf986075010a42017-02-22 16:52:54 -050082 Should Be Equal As Strings ${resp.status_code} 200
jf98601aa4c9d2017-03-02 16:35:04 -050083 [Return] ${resp.json()}
84
85APPC Mount Point
jf986075010a42017-02-22 16:52:54 -050086 [Arguments] ${vf_module_name}
87 Run Openstack Auth Request auth
88 ${status} ${stack_info}= Run Keyword and Ignore Error Wait for Stack to Be Deployed auth ${vf_module_name} timeout=120s
89 Run Keyword if '${status}' == 'FAIL' FAIL ${vf_module_name} Stack is not found
90 ${stack_id}= Get From Dictionary ${stack_info} id
jf98601aa4c9d2017-03-02 16:35:04 -050091 ${server_list}= Get Openstack Servers auth
jf986075010a42017-02-22 16:52:54 -050092 ${vpg_name_0}= Get From Dictionary ${stack_info} vpg_name_0
jf98601aa4c9d2017-03-02 16:35:04 -050093 ${vpg_public_ip}= Get Server Ip ${server_list} ${stack_info} vpg_name_0 network_name=public
94 ${vpg_oam_ip}= Get From Dictionary ${stack_info} vpg_private_ip_1
95 ${appc}= Create Mount Point In APPC ${vpg_name_0} ${vpg_oam_ip}