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} ${delete_flag}=DELETE
46 Orchestrate VNF ${customer_name} ${service} ${product_family} ${tenant}
47 Run Keyword If '${delete_flag}' == 'DELETE' Delete VNF
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 ${generic_vnfs}= Create Dictionary
71 ${vnf_name_index}= Set Variable 0
72 ${vf_module_name_list}= Create List
73 ${uuid}= Evaluate str("${uuid}")[:8]
74 :for ${vnf} in @{vnflist}
75 # APPC max is 50 characters
76 \ ${vnf_name}= Catenate Ete_${vnf}_${uuid}_${vnf_name_index}
77 \ ${vf_module_name}= Catenate Vfmodule_Ete_${vnf}_${uuid}_${vnf_name_index}
78 \ ${vnf_name_index}= Evaluate ${vnf_name_index} + 1
79 \ ${vnf_type}= Get VNF Type ${catalog_resources} ${vnf}
80 \ ${vf_module}= Get VF Module ${catalog_resources} ${vnf}
81 \ Append To List ${STACK_NAMES} ${vf_module_name}
82 \ Wait Until Keyword Succeeds 300s 5s Create VID VNF ${service_instance_id} ${vnf_name} ${product_family} ${lcp_region} ${tenant} ${vnf_type} ${CUSTOMER_NAME}
83 \ ${vf_module_type} ${closedloop_vf_module}= Preload Vnf ${service_instance_id} ${vnf_name} ${vnf_type} ${vf_module_name} ${vf_module} ${vnf} ${uuid}
84 \ ${vf_module_id}= Create VID VNF module ${service_instance_id} ${vf_module_name} ${lcp_region} ${tenant} ${vf_module_type} ${CUSTOMER_NAME} ${vnf_name}
85 \ ${generic_vnf}= Validate Generic VNF ${vnf_name} ${vnf_type} ${service_instance_id}
86 \ Set To Dictionary ${generic_vnfs} ${vf_module_type} ${generic_vnf}
87 #\ Run Keyword If '${service}' == 'vLB' VLB Closed Loop Hack ${service} ${generic_vnf} ${closedloop_vf_module}
88 \ Set Test Variable ${STACK_NAME} ${vf_module_name}
89 # TODO: Need to look at a better way to default ipv4_oam_interface search for Heatbridge
90 \ Execute Heatbridge ${vf_module_name} ${service_instance_id} ${vnf} ipv4_oam_interface
91 \ Validate VF Module ${vf_module_name} ${vnf}
92 \ Append To List ${vf_module_name_list} ${vf_module_name}
93 [Return] ${vf_module_name_list} ${service} ${generic_vnfs}
97 [Documentation] Use ONAP to Orchestrate a service from Demonstration Models.
98 [Arguments] ${customer_name} ${service} ${product_family} ${tenant} ${project_name}=Project-Demonstration ${owning_entity}=OE-Demonstration
99 ${service_model_type}= Set Variable If
100 ... '${service}'=='vFWCL' demoVFWCL
101 ... '${service}'=='vFW' demoVFW
102 ... '${service}'=='vLB' demoVLB
103 ${lcp_region}= Get Openstack Region
104 ${uuid}= Generate UUID
105 Set Test Variable ${CUSTOMER_NAME} ${customer_name}_${uuid}
106 Set Test Variable ${SERVICE} ${service}
108 Set Test Variable ${STACK_NAMES} ${list}
109 ${service_name}= Catenate Service_Ete_Name${uuid}
110 ${service_type}= Set Variable ${service}
111 ${vnf_json_resources}= Get SDC Demo Vnf Catalog Resource ${service_model_type}
112 Set Suite Variable ${SUITE_SERVICE_MODEL_NAME} ${service_model_type}
113 Create Customer For VNF ${CUSTOMER_NAME} ${CUSTOMER_NAME} INFRA ${service_type} ${GLOBAL_AAI_CLOUD_OWNER}
116 ${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}
117 Set Test Variable ${SERVICE_INSTANCE_ID} ${service_instance_id}
118 Validate Service Instance ${service_instance_id} ${service} ${customer_name}
119 ${vnflist}= Get From Dictionary ${GLOBAL_SERVICE_VNF_MAPPING} ${service}
120 ${generic_vnfs}= Create Dictionary
121 :for ${vnf} in @{vnflist}
122 \ ${vnf_name}= Catenate Ete_${vnf}_${uuid}
123 \ ${vf_module_name}= Catenate Vfmodule_Demo_${vnf}_${uuid}
124 \ ${vnf_type}= Set Variable ${vnf_json_resources['${vnf}']['vnf_type']}
125 \ ${vf_module}= Set Variable ${vnf_json_resources['${vnf}']['vf_module']}
126 \ Append To List ${STACK_NAMES} ${vf_module_name}
127 \ Wait Until Keyword Succeeds 300s 5s Create VID VNF ${service_instance_id} ${vnf_name} ${product_family} ${lcp_region} ${tenant} ${vnf_type} ${CUSTOMER_NAME}
128 \ ${vf_module_entry}= Create Dictionary name=${vf_module}
129 \ ${vf_modules}= Create List ${vf_module_entry}
130 \ ${vf_module_type} ${closedloop_vf_module}= Preload Vnf ${service_instance_id} ${vnf_name} ${vnf_type} ${vf_module_name} ${vf_modules} ${vnf} ${uuid}
131 \ ${vf_module_id}= Create VID VNF module ${service_instance_id} ${vf_module_name} ${lcp_region} ${tenant} ${vf_module_type} ${CUSTOMER_NAME} ${vnf_name}
132 \ ${generic_vnf}= Validate Generic VNF ${vnf_name} ${vnf_type} ${service_instance_id}
133 \ Set To Dictionary ${generic_vnfs} ${vf_module_type} ${generic_vnf}
134 #\ Run Keyword If '${service}' == 'vLB' VLB Closed Loop Hack ${service} ${generic_vnf} ${closedloop_vf_module}
135 \ Set Test Variable ${STACK_NAME} ${vf_module_name}
136 # TODO: Need to look at a better way to default ipv4_oam_interface search for Heatbridge
137 \ Execute Heatbridge ${vf_module_name} ${service_instance_id} ${vnf} ipv4_oam_interface
138 \ Validate VF Module ${vf_module_name} ${vnf}
139 [Return] ${vf_module_name} ${service} ${generic_vnfs}
143 [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
144 [Arguments] ${resources} ${vnf}
145 ${cr}= Get Catalog Resource ${resources} ${vnf}
146 ${vnf_type}= Get From Dictionary ${cr} name
150 [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
151 [Arguments] ${resources} ${vnf}
152 ${cr}= Get Catalog Resource ${resources} ${vnf}
153 ${vf_module}= Find Element In Array ${cr['groups']} type org.openecomp.groups.VfModule
154 [Return] ${vf_module}
157 [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
158 [Arguments] ${resources} ${vnf}
160 ${base_name}= Get Name Pattern ${vnf}
161 ${keys}= Get Dictionary Keys ${resources}
163 :for ${key} in @{keys}
164 \ ${cr}= Get From Dictionary ${resources} ${key}
165 \ Return From Keyword If '${base_name}' in '${cr['allArtifacts']['heat1']['artifactDisplayName']}' ${cr}
166 \ Run Keyword If 'heat2' in ${cr['allArtifacts']} Return From Keyword If '${base_name}' in '${cr['allArtifacts']['heat2']['artifactDisplayName']}' ${cr}
167 Fail Unable to find catalog resource for ${vnf} ${base_name}
170 [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
172 ${list}= Get From Dictionary ${GLOBAL_SERVICE_TEMPLATE_MAPPING} ${vnf}
173 :for ${dict} in @{list}
174 \ ${base_name}= Get From Dictionary ${dict} name_pattern
175 \ Return From Keyword If '${dict['isBase']}' == 'true' ${base_name}
176 Fail Unable to locate base name pattern
180 Create Customer For VNF
181 [Documentation] VNF Orchestration Test setup....
182 ... Create Tenant if not exists, Create Customer, Create Service and related relationships
183 [Arguments] ${customer_name} ${customer_id} ${customer_type} ${service_type} ${cloud_owner}
184 ${cloud_region_id}= Get Openstack Region
185 Create Service If Not Exists ${service_type}
186 ${resp}= Create Customer ${customer_name} ${customer_id} ${customer_type} ${service_type} ${cloud_owner} ${cloud_region_id} ${TENANT_ID}
187 Should Be Equal As Strings ${resp} 201
189 Setup Orchestrate VNF
190 [Documentation] Called before each test case to ensure tenant and region data
191 ... required by the Orchstrate VNF exists in A&AI
192 [Arguments] ${cloud_owner} ${cloud_type} ${owner_defined_type} ${cloud_region_version} ${cloud_zone}
193 Initialize Tenant From Openstack
194 Initialize Regions From Openstack
195 :FOR ${region} IN @{REGIONS}
196 \ Inventory Tenant If Not Exists ${cloud_owner} ${region} ${cloud_type} ${owner_defined_type} ${cloud_region_version} ${cloud_zone} ${TENANT_ID} ${TENANT_NAME}
197 Inventory Zone If Not Exists
198 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}
199 Log Orchestrate VNF setup complete
201 Initialize Tenant From Openstack
202 [Documentation] Initialize the tenant test variables
203 Run Openstack Auth Request auth
204 ${tenants}= Get Current Openstack Tenant auth
205 ${tenant_name}= Evaluate $tenants.get("name")
206 ${tenant_id}= Evaluate $tenants.get("id")
207 Set Test Variable ${TENANT_NAME} ${tenant_name}
208 Set Test Variable ${TENANT_ID} ${tenant_id}
210 Initialize Regions From Openstack
211 [Documentation] Initialize the regions test variable
212 Run Openstack Auth Request auth
213 ${regs}= Get Openstack Regions auth
214 Set Test Variable ${REGIONS} ${regs}
217 [Documentation] For the VolumeGroup test case, create a server to attach the volume group to be orchestrated.
219 Run Openstack Auth Request auth
220 ${vvg_server_name}= Catenate vVG_${uuid}
221 ${server}= Add Server For Image Name auth ${vvg_server_name} ${GLOBAL_INJECTED_VM_IMAGE_NAME} ${GLOBAL_INJECTED_VM_FLAVOR} ${GLOBAL_INJECTED_PUBLIC_NET_ID}
222 ${server}= Get From Dictionary ${server} server
223 ${server_id}= Get From Dictionary ${server} id
224 Set Test Variable ${VVG_SERVER_ID} ${server_id}
225 ${vvg_params}= Get VVG Preload Parameters
226 Set To Dictionary ${vvg_params} nova_instance ${server_id}
227 Wait for Server to Be Active auth ${server_id}
229 Get VVG Preload Parameters
230 [Documentation] Get preload parameters for the VVG test case so we can include
231 ... the nova_instance id of the attached server
232 ${test_dict}= Get From Dictionary ${GLOBAL_PRELOAD_PARAMETERS} Vnf-Orchestration
233 ${vvg_params} Get From Dictionary ${test_dict} vvg_preload.template
234 [Return] ${vvg_params}
237 [Documentation] Called at the end of a test case to tear down the VNF created by Orchestrate VNF
238 ${lcp_region}= Get Openstack Region
240 Set Test Variable ${KEYPAIRS} ${list}
241 # remove duplicates, sort vFW-> vPKG , revers to get vPKG > vFWSNK
242 ${sorted_stack_names}= Create List
243 ${sorted_stack_names}= Remove Duplicates ${STACK_NAMES}
244 Sort List ${sorted_stack_names}
245 Reverse List ${sorted_stack_names}
246 :for ${stack} in @{sorted_stack_names}
247 \ Get Stack Keypairs ${stack}
249 #Teardown VLB Closed Loop Hack
250 Run Keyword and Ignore Error Teardown VID ${SERVICE_INSTANCE_ID} ${lcp_region} ${TENANT_NAME} ${CUSTOMER_NAME}
252 :for ${stack} in @{sorted_stack_names}
253 \ Run Keyword and Ignore Error Teardown Stack ${stack}
254 \ Log Stack Deleted ${stack}
255 # only needed if stack deleted but not keypair
256 :for ${key_pair} in @{KEYPAIRS}
257 \ Run Keyword and Ignore Error Delete Stack Keypair ${key_pair}
258 \ Log Key pair Deleted ${key_pair}
262 [Documentation] Called at the end of a test case to tear down the VNF created by Orchestrate VNF
263 Run Keyword If '${TEST STATUS}' == 'PASS' Teardown Model Distribution
264 Run Keyword If '${TEST STATUS}' == 'PASS' Clean A&AI Inventory
266 Log Teardown VNF implemented for successful tests only
269 [Documentation] Teardown the server created as a place to mount the Volume Group.
270 Return From Keyword if '${VVG_SERVER_ID}' == ''
271 Delete Server auth ${VVG_SERVER_ID}
272 Wait for Server To Be Deleted auth ${VVG_SERVER_ID}
273 ${vvg_params}= Get VVG Preload Parameters
274 Remove from Dictionary ${vvg_params} nova_instance
275 Log Teardown VVG Server Completed
278 [Documentation] Get keypairs from openstack
280 Run Openstack Auth Request auth
281 ${stack_info}= Get Stack Details auth ${stack}
283 ${stack_id}= Get From Dictionary ${stack_info} id
284 ${key_pair_status} ${keypair_name}= Run Keyword And Ignore Error Get From Dictionary ${stack_info} key_name
285 Append To List ${KEYPAIRS} ${keypair_name}
288 [Documentation] Delete keypairs from openstack
289 [Arguments] ${keypair_name}
290 Run Openstack Auth Request auth
291 Run Keyword Delete Openstack Keypair auth ${keypair_name}
294 [Documentation] OBSOLETE - Called at the end of a test case to tear down the Stack created by Orchestrate VNF
296 Run Openstack Auth Request auth
297 ${stack_info}= Get Stack Details auth ${stack}
299 ${stack_id}= Get From Dictionary ${stack_info} id
300 ${key_pair_status} ${keypair_name}= Run Keyword And Ignore Error Get From Dictionary ${stack_info} key_name
301 Delete Openstack Stack auth ${stack} ${stack_id}
302 Log Deleted ${stack} ${stack_id}
303 Run Keyword If '${key_pair_status}' == 'PASS' Delete Openstack Keypair auth ${keypair_name}
304 #Teardown VLB Closed Loop Hack
307 [Documentation] Clean up Tenant in A&AI, Create Customer, Create Service and related relationships
308 Delete Customer ${CUSTOMER_NAME}