2 Documentation This test template encapsulates the VNF Orchestration use case.
4 Resource ../vid/create_service_instance.robot
5 Resource ../vid/vid_interface.robot
6 Resource ../aai/service_instance.robot
7 Resource ../vid/create_vid_vnf.robot
8 Resource ../vid/teardown_vid.robot
9 Resource ../sdngc_interface.robot
10 Resource model_test_template.robot
12 Resource ../aai/create_zone.robot
13 Resource ../aai/create_customer.robot
14 Resource ../aai/create_complex.robot
15 Resource ../aai/create_tenant.robot
16 Resource ../aai/create_service.robot
17 Resource ../openstack/neutron_interface.robot
18 Resource ../heatbridge.robot
21 Library OpenstackLibrary
22 Library ExtendedSelenium2Library
31 #**************** TEST CASE VARIABLES **************************
40 ${SERVICE_INSTANCE_ID}
43 Orchestrate VNF Template
44 [Documentation] Use openECOMP to Orchestrate a service.
45 [Arguments] ${customer_name} ${service} ${product_family} ${tenant}
46 Orchestrate VNF ${customer_name} ${service} ${product_family} ${tenant}
50 [Documentation] Use openECOMP to Orchestrate a service.
51 [Arguments] ${customer_name} ${service} ${product_family} ${tenant} ${project_name}=Project-Demonstration ${owning_entity}=OE-Demonstration
52 ${lcp_region}= Get Openstack Region
53 ${uuid}= Generate UUID
54 Set Test Variable ${CUSTOMER_NAME} ${customer_name}_${uuid}
55 Set Test Variable ${SERVICE} ${service}
57 Set Test Variable ${STACK_NAMES} ${list}
58 ${service_name}= Catenate Service_Ete_Name${uuid}
59 ${service_type}= Set Variable ${service}
60 ${service_model_type} ${vnf_type} ${vf_modules} ${catalog_resources}= Model Distribution For Directory ${service}
61 Set Suite Variable ${SUITE_SERVICE_MODEL_NAME} ${service_model_type}
62 Run Keyword If '${service}' == 'vVG' Create VVG Server ${uuid}
63 Create Customer For VNF ${CUSTOMER_NAME} ${CUSTOMER_NAME} INFRA ${service_type} ${GLOBAL_AAI_CLOUD_OWNER}
66 ${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}
67 Set Test Variable ${SERVICE_INSTANCE_ID} ${service_instance_id}
68 Validate Service Instance ${service_instance_id} ${service} ${customer_name}
69 ${vnflist}= Get From Dictionary ${GLOBAL_SERVICE_VNF_MAPPING} ${service}
70 :for ${vnf} in @{vnflist}
71 \ ${vnf_name}= Catenate Ete_${vnf}_${uuid}
72 \ ${vf_module_name}= Catenate Vfmodule_Ete_${vnf}_${uuid}
73 \ ${vnf_type}= Get VNF Type ${catalog_resources} ${vnf}
74 \ ${vf_module}= Get VF Module ${catalog_resources} ${vnf}
75 \ Append To List ${STACK_NAMES} ${vf_module_name}
76 \ Wait Until Keyword Succeeds 300s 5s Create VID VNF ${service_instance_id} ${vnf_name} ${product_family} ${lcp_region} ${tenant} ${vnf_type} ${CUSTOMER_NAME}
77 \ ${vf_module_type} ${closedloop_vf_module}= Preload Vnf ${service_instance_id} ${vnf_name} ${vnf_type} ${vf_module_name} ${vf_module} ${vnf} ${uuid}
78 \ ${vf_module_id}= Create VID VNF module ${service_instance_id} ${vf_module_name} ${lcp_region} ${tenant} ${vf_module_type} ${CUSTOMER_NAME} ${vnf_name}
79 \ ${generic_vnf}= Validate Generic VNF ${vnf_name} ${vnf_type} ${service_instance_id}
80 \ VLB Closed Loop Hack ${service} ${generic_vnf} ${closedloop_vf_module}
81 \ Set Test Variable ${STACK_NAME} ${vf_module_name}
82 \ Append To List ${STACK_NAMES} ${STACK_NAME}
83 \ Run Keyword and Ignore Error Execute Heatbridge ${vf_module_name} ${service_instance_id} ${vnf}
84 \ Run Keyword and Ignore Error Validate VF Module ${vf_module_name} ${vnf}
85 [Return] ${vf_module_name} ${service}
89 [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
90 [Arguments] ${resources} ${vnf}
91 ${cr}= Get Catalog Resource ${resources} ${vnf}
92 ${vnf_type}= Get From Dictionary ${cr} name
96 [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
97 [Arguments] ${resources} ${vnf}
98 ${cr}= Get Catalog Resource ${resources} ${vnf}
99 ${vf_module}= Find Element In Array ${cr['groups']} type org.openecomp.groups.VfModule
100 [Return] ${vf_module}
103 [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
104 [Arguments] ${resources} ${vnf}
106 ${base_name}= Get Name Pattern ${vnf}
107 ${keys}= Get Dictionary Keys ${resources}
109 :for ${key} in @{keys}
110 \ ${cr}= Get From Dictionary ${resources} ${key}
111 \ Return From Keyword If '${base_name}' in '${cr['allArtifacts']['heat1']['artifactDisplayName']}' ${cr}
112 \ Run Keyword If 'heat2' in ${cr['allArtifacts']} Return From Keyword If '${base_name}' in '${cr['allArtifacts']['heat2']['artifactDisplayName']}' ${cr}
113 Fail Unable to find catalog resource for ${vnf} ${base_name}
116 [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
118 ${list}= Get From Dictionary ${GLOBAL_SERVICE_TEMPLATE_MAPPING} ${vnf}
119 :for ${dict} in @{list}
120 \ ${base_name}= Get From Dictionary ${dict} name_pattern
121 \ Return From Keyword If '${dict['isBase']}' == 'true' ${base_name}
122 Fail Unable to locate base name pattern
126 Create Customer For VNF
127 [Documentation] VNF Orchestration Test setup....
128 ... Create Tenant if not exists, Create Customer, Create Service and related relationships
129 [Arguments] ${customer_name} ${customer_id} ${customer_type} ${service_type} ${cloud_owner}
130 ${cloud_region_id}= Get Openstack Region
131 Create Service If Not Exists ${service_type}
132 ${resp}= Create Customer ${customer_name} ${customer_id} ${customer_type} ${service_type} ${cloud_owner} ${cloud_region_id} ${TENANT_ID}
133 Should Be Equal As Strings ${resp} 201
135 Setup Orchestrate VNF
136 [Documentation] Called before each test case to ensure tenant and region data
137 ... required by the Orchstrate VNF exists in A&AI
138 [Arguments] ${cloud_owner} ${cloud_type} ${owner_defined_type} ${cloud_region_version} ${cloud_zone}
139 Initialize Tenant From Openstack
140 Initialize Regions From Openstack
141 :FOR ${region} IN @{REGIONS}
142 \ Inventory Tenant If Not Exists ${cloud_owner} ${region} ${cloud_type} ${owner_defined_type} ${cloud_region_version} ${cloud_zone} ${TENANT_ID} ${TENANT_NAME}
143 Inventory Zone If Not Exists
144 Inventory Complex If Not Exists ${GLOBAL_AAI_COMPLEX_NAME} ${GLOBAL_AAI_PHYSICAL_LOCATION_ID} ${GLOBAL_AAI_CLOUD_OWNER} ${GLOBAL_INJECTED_REGION} ${GLOBAL_AAI_CLOUD_OWNER_DEFINED_TYPE}
145 Log Orchestrate VNF setup complete
147 Initialize Tenant From Openstack
148 [Documentation] Initialize the tenant test variables
149 Run Openstack Auth Request auth
150 ${tenants}= Get Current Openstack Tenant auth
151 ${tenant_name}= Evaluate $tenants.get("name")
152 ${tenant_id}= Evaluate $tenants.get("id")
153 Set Test Variable ${TENANT_NAME} ${tenant_name}
154 Set Test Variable ${TENANT_ID} ${tenant_id}
156 Initialize Regions From Openstack
157 [Documentation] Initialize the regions test variable
158 Run Openstack Auth Request auth
159 ${regs}= Get Openstack Regions auth
160 Set Test Variable ${REGIONS} ${regs}
163 [Documentation] For the VolumeGroup test case, create a server to attach the volume group to be orchestrated.
165 Run Openstack Auth Request auth
166 ${vvg_server_name}= Catenate vVG_${uuid}
167 ${server}= Add Server For Image Name auth ${vvg_server_name} ${GLOBAL_INJECTED_VM_IMAGE_NAME} ${GLOBAL_INJECTED_VM_FLAVOR} ${GLOBAL_INJECTED_PUBLIC_NET_ID}
168 ${server}= Get From Dictionary ${server} server
169 ${server_id}= Get From Dictionary ${server} id
170 Set Test Variable ${VVG_SERVER_ID} ${server_id}
171 ${vvg_params}= Get VVG Preload Parameters
172 Set To Dictionary ${vvg_params} nova_instance ${server_id}
173 Wait for Server to Be Active auth ${server_id}
175 Get VVG Preload Parameters
176 [Documentation] Get preload parameters for the VVG test case so we can include
177 ... the nova_instance id of the attached server
178 ${test_dict}= Get From Dictionary ${GLOBAL_PRELOAD_PARAMETERS} Vnf-Orchestration
179 ${vvg_params} Get From Dictionary ${test_dict} vvg_preload.template
180 [Return] ${vvg_params}
183 [Documentation] Called at the end of a test case to tear down the VNF created by Orchestrate VNF
184 ${lcp_region}= Get Openstack Region
186 Set Test Variable ${KEYPAIRS} ${list}
187 # remove duplicates, sort vFW-> vPKG , revers to get vPKG > vFWSNK
188 ${sorted_stack_names}= Create List
189 ${sorted_stack_names}= Remove Duplicates ${STACK_NAMES}
190 Sort List ${sorted_stack_names}
191 Reverse List ${sorted_stack_names}
192 :for ${stack} in @{sorted_stack_names}
193 \ Get Stack Keypairs ${stack}
195 Teardown VLB Closed Loop Hack
196 Run Keyword and Ignore Error Teardown VID ${SERVICE_INSTANCE_ID} ${lcp_region} ${TENANT_NAME} ${CUSTOMER_NAME}
198 :for ${stack} in @{sorted_stack_names}
199 \ Run Keyword and Ignore Error Teardown Stack ${stack}
200 \ Log Stack Deleted ${stack}
201 # only needed if stack deleted but not keypair
202 :for ${key_pair} in @{KEYPAIRS}
203 \ Run Keyword and Ignore Error Delete Stack Keypair ${key_pair}
204 \ Log Key pair Deleted ${key_pair}
208 [Documentation] Called at the end of a test case to tear down the VNF created by Orchestrate VNF
209 Run Keyword If '${TEST STATUS}' == 'PASS' Teardown Model Distribution
210 Run Keyword If '${TEST STATUS}' == 'PASS' Clean A&AI Inventory
212 Log Teardown VNF implemented for successful tests only
215 [Documentation] Teardown the server created as a place to mount the Volume Group.
216 Return From Keyword if '${VVG_SERVER_ID}' == ''
217 Delete Server auth ${VVG_SERVER_ID}
218 Wait for Server To Be Deleted auth ${VVG_SERVER_ID}
219 ${vvg_params}= Get VVG Preload Parameters
220 Remove from Dictionary ${vvg_params} nova_instance
221 Log Teardown VVG Server Completed
224 [Documentation] Get keypairs from openstack
226 Run Openstack Auth Request auth
227 ${stack_info}= Get Stack Details auth ${stack}
229 ${stack_id}= Get From Dictionary ${stack_info} id
230 ${key_pair_status} ${keypair_name}= Run Keyword And Ignore Error Get From Dictionary ${stack_info} key_name
231 Append To List ${KEYPAIRS} ${keypair_name}
234 [Documentation] Delete keypairs from openstack
235 [Arguments] ${keypair_name}
236 Run Openstack Auth Request auth
237 Run Keyword Delete Openstack Keypair auth ${keypair_name}
240 [Documentation] OBSOLETE - Called at the end of a test case to tear down the Stack created by Orchestrate VNF
242 Run Openstack Auth Request auth
243 ${stack_info}= Get Stack Details auth ${stack}
245 ${stack_id}= Get From Dictionary ${stack_info} id
246 ${key_pair_status} ${keypair_name}= Run Keyword And Ignore Error Get From Dictionary ${stack_info} key_name
247 Delete Openstack Stack auth ${stack} ${stack_id}
248 Log Deleted ${stack} ${stack_id}
249 Run Keyword If '${key_pair_status}' == 'PASS' Delete Openstack Keypair auth ${keypair_name}
250 #Teardown VLB Closed Loop Hack
253 [Documentation] Clean up Tenant in A&AI, Create Customer, Create Service and related relationships
254 Delete Customer ${CUSTOMER_NAME}