blob: 040008c184023f50850218b1d6f78bef09765b39 [file] [log] [blame]
DR695Hc0cf6a42019-07-26 16:42:36 -04001*** Settings ***
2Documentation The main interface for interacting with SDC. It handles low level stuff like managing the http request library and DCAE required fields
3Library RequestsLibrary
4Library ONAPLibrary.Utilities
5Library ONAPLibrary.JSON
6Library OperatingSystem
7Library Collections
8Library SeleniumLibrary
9Library String
10Library ArchiveLibrary
11Library ONAPLibrary.Openstack
12Library DateTime
13Library ONAPLibrary.ServiceMapping WITH NAME ServiceMapping
14Library ONAPLibrary.Templating WITH NAME Templating
15Library ONAPLibrary.SDC WITH NAME SDC
16Resource global_properties.robot
17Resource browser_setup.robot
18
19*** Variables ***
20${SDC_DESIGNER_USER_ID} cs0008
21${SDC_TESTER_USER_ID} jm0007
22${SDC_GOVERNOR_USER_ID} gv0001
23${SDC_OPS_USER_ID} op0001
24${SDC_HEALTH_CHECK_PATH} /sdc1/rest/healthCheck
25${SDC_VENDOR_LICENSE_MODEL_PATH} /onboarding-api/v1.0/vendor-license-models
26${SDC_VENDOR_SOFTWARE_PRODUCT_PATH} /onboarding-api/v1.0/vendor-software-products
27${SDC_VENDOR_KEY_GROUP_PATH} /license-key-groups
28${SDC_VENDOR_ENTITLEMENT_POOL_PATH} /entitlement-pools
29${SDC_VENDOR_FEATURE_GROUP_PATH} /feature-groups
30${SDC_VENDOR_LICENSE_AGREEMENT_PATH} /license-agreements
31${SDC_VENDOR_ACTIONS_PATH} /actions
32${SDC_VENDOR_SOFTWARE_UPLOAD_PATH} /orchestration-template-candidate
33${SDC_FE_CATALOG_RESOURCES_PATH} /sdc1/feProxy/rest/v1/catalog/resources
34${SDC_FE_CATALOG_SERVICES_PATH} /sdc1/feProxy/rest/v1/catalog/services
35${SDC_CATALOG_RESOURCES_PATH} /sdc2/rest/v1/catalog/resources
36${SDC_CATALOG_SERVICES_PATH} /sdc2/rest/v1/catalog/services
37${SDC_CATALOG_INACTIVE_RESOURCES_PATH} /sdc2/rest/v1/inactiveComponents/resource
38${SDC_CATALOG_RESOURCES_QUERY_PATH} /sdc2/rest/v1/catalog/resources/resourceName
39${SDC_CATALOG_INACTIVE_SERVICES_PATH} /sdc2/rest/v1/inactiveComponents/service
40${SDC_CATALOG_LIFECYCLE_PATH} /lifecycleState
41${SDC_CATALOG_SERVICE_RESOURCE_INSTANCE_PATH} /resourceInstance
42${SDC_CATALOG_SERVICE_RESOURCE_ARTIFACT_PATH} /artifacts
43${SDC_CATALOG_SERVICE_DISTRIBUTION_STATE_PATH} /distribution-state
44${SDC_CATALOG_SERVICE_DISTRIBUTION_PATH} /distribution
45${SDC_DISTRIBUTION_STATE_APPROVE_PATH} /approve
46${SDC_CATALOG_SERVICE_DISTRIBUTION_ACTIVATE_PATH} /distribution/PROD/activate
47${SDC_LICENSE_MODEL_TEMPLATE} sdc/license_model.jinja
48${SDC_KEY_GROUP_TEMPLATE} sdc/key_group.jinja
49${SDC_ENTITLEMENT_POOL_TEMPLATE} sdc/entitlement_pool.jinja
50${SDC_FEATURE_GROUP_TEMPLATE} sdc/feature_group.jinja
51${SDC_LICENSE_AGREEMENT_TEMPLATE} sdc/license_agreement.jinja
52${SDC_ACTION_TEMPLATE} sdc/action.jinja
53${SDC_SOFTWARE_PRODUCT_TEMPLATE} sdc/software_product.jinja
54${SDC_ARTIFACT_UPLOAD_TEMPLATE} sdc/artifact_upload.jinja
55${SDC_CATALOG_RESOURCE_TEMPLATE} sdc/catalog_resource.jinja
56${SDC_USER_REMARKS_TEMPLATE} sdc/user_remarks.jinja
57${SDC_CATALOG_SERVICE_TEMPLATE} sdc/catalog_service.jinja
58${SDC_RESOURCE_INSTANCE_TEMPLATE} sdc/resource_instance.jinja
59${SDC_RESOURCE_INSTANCE_VNF_PROPERTIES_TEMPLATE} sdc/catalog_vnf_properties.jinja
60${SDC_RESOURCE_INSTANCE_VNF_INPUTS_TEMPLATE} sdc/catalog_vnf_inputs.jinja
61${SDC_CATALOG_NET_RESOURCE_INPUT_TEMPLATE} sdc/catalog_net_input_properties.jinja
62${SDC_ALLOTTED_RESOURCE_CATALOG_RESOURCE_TEMPLATE} sdc/catalog_resource_alloted_resource.jinja
63${SDC_CATALOG_ALLOTTED_RESOURCE_PROPERTIES_TEMPLATE} sdc/catalog_allotted_properties.jinja
64${SDC_CATALOG_ALLOTTED_RESOURCE_INPUTS_TEMPLATE} sdc/catalog_allotted_inputs.jinja
65${SDC_CATALOG_DEPLOYMENT_ARTIFACT_PATH} robot/assets/sdc/blueprints/
66${SDC_FE_ENDPOINT} ${GLOBAL_SDC_SERVER_PROTOCOL}://${GLOBAL_INJECTED_SDC_FE_IP_ADDR}:${GLOBAL_SDC_FE_PORT}
67${SDC_BE_ENDPOINT} ${GLOBAL_SDC_SERVER_PROTOCOL}://${GLOBAL_INJECTED_SDC_BE_IP_ADDR}:${GLOBAL_SDC_BE_PORT}
68${SDC_BE_ONBOARD_ENDPOINT} ${GLOBAL_SDC_SERVER_PROTOCOL}://${GLOBAL_INJECTED_SDC_BE_ONBOARD_IP_ADDR}:${GLOBAL_SDC_BE_ONBOARD_PORT}
69
70*** Keywords ***
71Distribute Model From SDC
krzysztof kuzmickidadd0e62019-07-31 20:08:36 +020072 [Documentation] Goes end to end creating all the SDC objects based ONAP model and distributing it to the systems. It then returns the service name, VF/PNF name and VF module name
73 [Arguments] ${model_zip_path} ${catalog_service_name}= ${cds}=False ${service}= ${instantiationType}=A-la-carte ${resourceType}=VF
DR695Hc0cf6a42019-07-26 16:42:36 -040074 # For Testing use random service names
75 #${random}= Get Current Date
76 #${catalog_service_id}= Add SDC Catalog Service ${catalog_service_name}_${random}
krzysztof kuzmickidadd0e62019-07-31 20:08:36 +020077 ${catalog_service_id}= Add SDC Catalog Service ${catalog_service_name} ${instantiationType}
DR695Hc0cf6a42019-07-26 16:42:36 -040078 ${catalog_resource_ids}= Create List
79 ${catalog_resources}= Create Dictionary
80 ##### TODO: Support for Multiple resources of one type in a service ######
81 # The zip list is the resources - no mechanism to indicate more than 1 of the items in the zip list
82 # Get Service Vnf Mapping has the logical mapping but it is not the same key as model_zip_path
83 # ${vnflist}= Get Service Vnf Mapping alias ${service}
84 # Save the resource_id in a dictionary keyed by the resource name in the zipfile name (vFWDT_vFWSNK.zip or vFWDT_vPKG.zip)
85 # Create the resources but do not immediately add resource
86 # Add Resource to Service in a separate FOR loop
87 ${resource_types}= Create Dictionary
88
89 :FOR ${zip} IN @{model_zip_path}
krzysztof kuzmickidadd0e62019-07-31 20:08:36 +020090 \ ${loop_catalog_resource_id}= Setup SDC Catalog Resource ${zip} ${cds} ${resourceType}
DR695Hc0cf6a42019-07-26 16:42:36 -040091 # zip can be vFW.zip or vFWDT_VFWSNK.zip
krzysztof kuzmickidadd0e62019-07-31 20:08:36 +020092 \ ${resource_type_match}= Run Keyword If "${resourceType}"=='PNF' Get Regexp Matches ${zip} ${service}_(.*)\.csar 1
DR695Hfacbc292019-08-07 11:15:46 -040093 ... ELSE Get Regexp Matches ${zip} ${service}_(.*)\.zip 1
DR695Hc0cf6a42019-07-26 16:42:36 -040094 # Need to be able to distribute preload for vFWCL vFWSNK and vFWDT vFWSNK to prepend service to vnf_type
95 \ ${resource_type_string}= Set Variable If len(${resource_type_match})==0 ${service} ${service}${resource_type_match[0]}
96 \ Set To Dictionary ${resource_types} ${resource_type_string} ${loop_catalog_resource_id}
97 \ Append To List ${catalog_resource_ids} ${loop_catalog_resource_id}
98
99 ServiceMapping.Set Directory default ${GLOBAL_SERVICE_MAPPING_DIRECTORY}
100 ${vnflist}= ServiceMapping.Get Service Vnf Mapping default ${service}
101
102 # Spread the icons on the pallette starting on the left
103 ${xoffset}= Set Variable ${0}
104
105 :FOR ${vnf} IN @{vnflist}
106 \ ${loop_catalog_resource_resp}= Get SDC Catalog Resource ${resource_types['${vnf}']}
107 \ Set To Dictionary ${catalog_resources} ${resource_types['${vnf}']}=${loop_catalog_resource_resp}
krzysztof kuzmickidadd0e62019-07-31 20:08:36 +0200108 \ ${catalog_resource_unique_name}= Add SDC Resource Instance ${catalog_service_id} ${resource_types['${vnf}']} ${loop_catalog_resource_resp['name']} ${xoffset} resourceType=${resourceType}
DR695Hc0cf6a42019-07-26 16:42:36 -0400109 \ ${xoffset}= Set Variable ${xoffset+100}
110 #
111 # do this here because the loop_catalog_resource_resp is different format after adding networks
krzysztof kuzmickidadd0e62019-07-31 20:08:36 +0200112 ${vf_module}= Run Keyword If "${resourceType}"=='PNF' Set Variable It is PNF
113 ... ELSE Find Element In Array ${loop_catalog_resource_resp['groups']} type org.openecomp.groups.VfModule
DR695Hc0cf6a42019-07-26 16:42:36 -0400114 #
115 # do network
116 ${networklist}= ServiceMapping.Get Service Neutron Mapping default ${service}
117 ${generic_neutron_net_uuid}= Get Generic NeutronNet UUID
118 :FOR ${network} IN @{networklist}
119 \ ${loop_catalog_resource_id}= Set Variable ${generic_neutron_net_uuid}
120 \ Append To List ${catalog_resource_ids} ${loop_catalog_resource_id}
121 \ ${loop_catalog_resource_resp}= Get SDC Catalog Resource ${loop_catalog_resource_id}
122 \ ${loop_catalog_resource_id}= Add SDC Resource Instance ${catalog_service_id} ${loop_catalog_resource_id} ${network} ${xoffset} ${0} VL
123 \ ${nf_role}= Convert To Lowercase ${network}
124 \ Setup SDC Catalog Resource GenericNeutronNet Properties ${catalog_service_id} ${nf_role} ${loop_catalog_resource_id}
125 \ ${xoffset}= Set Variable ${xoffset+100}
126 \ Set To Dictionary ${catalog_resources} ${loop_catalog_resource_id}=${loop_catalog_resource_resp}
127 ${catalog_service_resp}= Get SDC Catalog Service ${catalog_service_id}
128 #
129 # do deployment artifacts
130 #
131 ${deploymentlist}= ServiceMapping.Get Service Deployment Artifact Mapping default ${service}
132 :FOR ${deployment} IN @{deploymentlist}
133 \ ${loop_catalog_resource_resp}= Get SDC Catalog Resource ${loop_catalog_resource_id}
134 \ Setup SDC Catalog Resource Deployment Artifact Properties ${catalog_service_id} ${loop_catalog_resource_resp} ${catalog_resource_unique_name} ${deployment}
135 Run Keyword If ${cds} == True Add CDS Parameters ${catalog_service_name}
136 Checkin SDC Catalog Service ${catalog_service_id}
137 Wait Until Keyword Succeeds 600s 15s Request Certify SDC Catalog Service ${catalog_service_id}
138 Start Certify SDC Catalog Service ${catalog_service_id}
139 # on certify it gets a new id
140 ${catalog_service_id}= Certify SDC Catalog Service ${catalog_service_id}
141 Approve SDC Catalog Service ${catalog_service_id}
142 :FOR ${DIST_INDEX} IN RANGE 1
143 \ Log Distribution Attempt ${DIST_INDEX}
144 \ Distribute SDC Catalog Service ${catalog_service_id}
145 \ ${catalog_service_resp}= Get SDC Catalog Service ${catalog_service_id}
146 \ ${status} ${_} = Run Keyword And Ignore Error Loop Over Check Catalog Service Distributed ${catalog_service_resp['uuid']}
147 \ Exit For Loop If '${status}'=='PASS'
148 Should Be Equal As Strings ${status} PASS
149 [Return] ${catalog_service_resp['name']} ${loop_catalog_resource_resp['name']} ${vf_module} ${catalog_resource_ids} ${catalog_service_id} ${catalog_resources}
150
151Distribute vCPEResCust Model From SDC
152 [Documentation] Goes end to end creating all the SDC objects for the vCPE ResCust Service model and distributing it to the systems. It then returns the service name, VF name and VF module name
153 [Arguments] ${model_zip_path} ${catalog_service_name}= ${cds}= ${service}=
154 # For testing use random service name
155 #${random}= Get Current Date
156 ${uuid}= Generate UUID4
157 ${random}= Evaluate str("${uuid}")[:4]
158 ${catalog_service_id}= Add SDC Catalog Service ${catalog_service_name}_${random}
159 # catalog_service_name already
160 #${catalog_service_id}= Add SDC Catalog Service ${catalog_service_name}
161 Log ${\n}ServiceName: ${catalog_service_name}_${random}
162 #${catalog_service_id}= Add SDC Catalog Service ${catalog_service_name}
163 ${catalog_resource_ids}= Create List
164 ${catalog_resources}= Create Dictionary
165 :FOR ${zip} IN @{model_zip_path}
166 \ ${loop_catalog_resource_id}= Setup SDC Catalog Resource ${zip} ${cds}
167 \ Append To List ${catalog_resource_ids} ${loop_catalog_resource_id}
168 \ ${loop_catalog_resource_resp}= Get SDC Catalog Resource ${loop_catalog_resource_id}
169 \ Add SDC Resource Instance ${catalog_service_id} ${loop_catalog_resource_id} ${loop_catalog_resource_resp['name']}
170 \ Set To Dictionary ${catalog_resources} ${loop_catalog_resource_id}=${loop_catalog_resource_resp}
171 #
172 # do this here because the loop_catalog_resource_resp is different format after adding networks
173 ${vf_module}= Find Element In Array ${loop_catalog_resource_resp['groups']} type org.openecomp.groups.VfModule
174 #
175 # do allottedresource
176 ${allottedresource_list}= Create List TunnelXConn BRG
177 # Example data
178 #${tunnelxconn_dict}= Create Dictionary invariantUUID=8ac029e7-77aa-40d4-b28a-d17c02d5fd82 UUID=2ddc1b37-d7da-4aab-b645-ed7db34a5d03 node_type=org.openecomp.service.Demovcpevgmux
179 #${brg_dict}= Create Dictionary invariantUUID=ff0337b9-dbe2-4d88-bb74-18bf027ae586 UUID=1b6974f1-4aed-47f4-b962-816aa1261927 node_type=org.openecomp.service.Demovcpevbrgemu
180 # Create /tmp/vcpe_allotted_resource_data.json with demo vgmux and brgemu CSARs
181 Create Allotted Resource Data File
182 ${vcpe_ar_data_file} OperatingSystem.Get File /tmp/vcpe_allotted_resource_data.json
183 ${tunnelxconn_invariant_uuid}= Catenate ${vcpe_ar_data_file.json()['tunnelxconn']['invariantUUID']}
184 ${tunnelxconn_uuid}= Catenate ${vcpe_ar_data_file.json()['tunnelxconn']['UUID']}
185 ${tunnelxconn_node_type}= Catenate ${vcpe_ar_data_file.json()['tunnelxconn']['node_type']}
186 ${brg_invariant_uuid}= Catenate ${vcpe_ar_data_file.json()['brg']['invariantUUID']}
187 ${brg_uuid}= Catenate ${vcpe_ar_data_file.json()['brg']['UUID']}
188 ${brg_node_type}= Catenate ${vcpe_ar_data_file.json()['brg']['node_type']}
189 ${tunnelxconn_dict}= Create Dictionary invariantUUID=${tunnelxconn_invariant_uuid} UUID=${tunnelxconn_uuid} node_type=${tunnelxconn_node_type}
190 ${brg_dict}= Create Dictionary invariantUUID=${brg_invariant_uuid} UUID=${brg_uuid} node_type=${brg_node_type}
191 ${xoffset}= Set Variable ${100}
192 ${allottedresource_uuid}= Get AllottedResource UUID
193 ${random}= Get Current Date
194 :FOR ${allottedresource} IN @{allottedresource_list}
195 \ ${loop_catalog_resource_id}= Set Variable ${allottedresource_uuid}
196 \ Append To List ${catalog_resource_ids} ${loop_catalog_resource_id}
197 \ ${loop_catalog_resource_id}= Add SDC Allotted Resource Catalog Resource 00000 ${allottedresource}_${random} ONAP ${loop_catalog_resource_id} ${allottedresource}
198 \ ${loop_catalog_resource_id2}= Add SDC Resource Instance To Resource ${loop_catalog_resource_id} ${allottedresource_uuid} ${allottedresource} ${xoffset} ${0}
199 \ ${loop_catalog_resource_resp}= Get SDC Catalog Resource ${loop_catalog_resource_id}
200 #
201 # Set the properties to relate to the brg and gmux
202 #
203 \ Run Keyword If '${allottedresource}'=='TunnelXConn' Setup SDC Catalog Resource AllottedResource Properties ${catalog_service_id} ${allottedresource} ${loop_catalog_resource_id} ${tunnelxconn_dict['invariantUUID']} ${tunnelxconn_dict['UUID']} ${tunnelxconn_dict['node_type']}
204 \ Run Keyword If '${allottedresource}'=='BRG' Setup SDC Catalog Resource AllottedResource Properties ${catalog_service_id} ${allottedresource} ${loop_catalog_resource_id} ${brg_dict['invariantUUID']} ${brg_dict['UUID']} ${brg_dict['node_type']}
205 #
206 # Set the nf_role nf_type
207 #
208 \ Run Keyword If '${allottedresource}'=='TunnelXConn' Setup SDC Catalog Resource AllottedResource Inputs ${catalog_service_id} ${allottedresource} ${loop_catalog_resource_id}
209 \ Run Keyword If '${allottedresource}'=='BRG' Setup SDC Catalog Resource AllottedResource Inputs ${catalog_service_id} ${allottedresource} ${loop_catalog_resource_id}
210 \ ${loop_catalog_resource_id}= Certify SDC Catalog Resource ${loop_catalog_resource_id} ${SDC_DESIGNER_USER_ID}
211 \ Add SDC Resource Instance ${catalog_service_id} ${loop_catalog_resource_id} ${loop_catalog_resource_resp['name']}
212 \ Set To Dictionary ${catalog_resources} ${loop_catalog_resource_id}=${loop_catalog_resource_resp}
213 ${catalog_service_resp}= Get SDC Catalog Service ${catalog_service_id}
214 Checkin SDC Catalog Service ${catalog_service_id}
215 Request Certify SDC Catalog Service ${catalog_service_id}
216 Start Certify SDC Catalog Service ${catalog_service_id}
217 # on certify it gets a new id
218 ${catalog_service_id}= Certify SDC Catalog Service ${catalog_service_id}
219 Approve SDC Catalog Service ${catalog_service_id}
220 :FOR ${DIST_INDEX} IN RANGE 1
221 \ Log Distribution Attempt ${DIST_INDEX}
222 \ Distribute SDC Catalog Service ${catalog_service_id}
223 \ ${catalog_service_resp}= Get SDC Catalog Service ${catalog_service_id}
224 \ ${status} ${_} = Run Keyword And Ignore Error Loop Over Check Catalog Service Distributed ${catalog_service_resp['uuid']}
225 \ Exit For Loop If '${status}'=='PASS'
226 Should Be Equal As Strings ${status} PASS
227 [Return] ${catalog_service_resp['name']} ${loop_catalog_resource_resp['name']} ${vf_module} ${catalog_resource_ids} ${catalog_service_id} ${catalog_resources}
228
229
230Create Allotted Resource Data File
231 [Documentation] Create Allotted Resource json data file
232 ${allotted_resource}= Create Dictionary
233 ${allotted_csar_map}= Create Dictionary
234 Set To Dictionary ${allotted_csar_map} tunnelxconn=service-Demovcpevgmux-csar.csar
235 Set To Dictionary ${allotted_csar_map} brg=service-Demovcpevbrgemu-csar.csar
236 ${keys}= Get Dictionary Keys ${allotted_csar_map}
237 :FOR ${key} IN @{keys}
238 \ ${csar}= Get From Dictionary ${allotted_csar_map} ${key}
239 \ ${dir} ${ext}= Split String From Right ${csar} - 1
240 \ Extract Zip File /tmp/csar/${csar} /tmp/csar/${dir}
241 \ ${template}= Catenate /tmp/csar/${dir}/Definitions/${dir}-template.yml
242 \ ${json_str}= Template Yaml To Json ${template}
243 \ ${json_obj}= To Json ${json_str}
244 \ ${attrs}= Create Dictionary
245 \ Set To Dictionary ${attrs} invariantUUID=${json_obj['metadata']['invariantUUID']}
246 \ Set To Dictionary ${attrs} UUID=${json_obj['metadata']['UUID']}
247 \ Set To Dictionary ${attrs} node_type=${json_obj['topology_template']['substitution_mappings']['node_type']}
248 \ Set To Dictionary ${allotted_resource} ${key}=${attrs}
249 ${result_str}= Evaluate json.dumps(${allotted_resource}, indent=2) json
250 Log ${result_str}
251 Create File /tmp/vcpe_allotted_resource_data.json ${result_str}
252
253Download CSAR
254 [Documentation] Download CSAR
255 [Arguments] ${catalog_service_id} ${save_directory}=/tmp/csar
256 # get meta data
257 ${resp}= SDC.Run Get Request ${SDC_BE_ENDPOINT} ${SDC_CATALOG_SERVICES_PATH}/${catalog_service_id}/filteredDataByParams?include=toscaArtifacts ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
258 ${csar_resource_id}= Set Variable ${resp.json()['toscaArtifacts']['assettoscacsar']['uniqueId']}
259 ${resp}= SDC.Run Get Request ${SDC_BE_ENDPOINT} ${SDC_CATALOG_SERVICES_PATH}/${catalog_service_id}/artifacts/${csar_resource_id} ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
260 ${csar_file_name}= Set Variable ${resp.json()['artifactName']}
261 ${base64Obj}= Set Variable ${resp.json()['base64Contents']}
262 ${binObj}= Base64 Decode ${base64Obj}
263 Create Binary File ${save_directory}/${csar_file_name} ${binObj}
264 Log ${\n}Downloaded:${csar_file_name}
265
266
267Get Generic NeutronNet UUID
268 [Documentation] Look up the UUID of the Generic NeutronNetwork Resource
269 ${resp}= SDC.Run Get Request ${SDC_BE_ENDPOINT} ${SDC_CATALOG_RESOURCES_QUERY_PATH}/Generic%20NeutronNet/resourceVersion/1.0 ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
270 [Return] ${resp.json()['allVersions']['1.0']}
271
272Get AllottedResource UUID
273 [Documentation] Look up the UUID of the Allotted Resource
274 # if this fails then the AllottedResource template got deleted from SDC by mistake
275 ${resp}= SDC.Run Get Request ${SDC_BE_ENDPOINT} ${SDC_CATALOG_RESOURCES_QUERY_PATH}/AllottedResource/resourceVersion/1.0 ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
276 [Return] ${resp.json()['allVersions']['1.0']}
277
278Loop Over Check Catalog Service Distributed
279 [Arguments] ${catalog_service_id}
280 # SO watchdog timeout is 300 seconds need buffer
281 ${dist_status}= Set Variable CONTINUE
282 :FOR ${CHECK_INDEX} IN RANGE 20
283 \ ${status} ${_} = Run Keyword And Ignore Error Check Catalog Service Distributed ${catalog_service_id} ${dist_status}
284 \ Sleep 20s
285 \ Return From Keyword If '${status}'=='PASS'
286 # need a way to exit the loop early on DISTRIBUTION_COMPLETE_ERROR ${dist_status} doesnt work
287 #\ Exit For Loop If '${dist_status}'=='EXIT'
288 Should Be Equal As Strings ${status} PASS
289
290Setup SDC Catalog Resource
krzysztof kuzmickidadd0e62019-07-31 20:08:36 +0200291 [Documentation] Creates all the steps a VF/PNF needs for an SDC Catalog Resource and returns the id
292 [Arguments] ${model_zip_path} ${cds}=None ${resourceType}=VF
DR695Hc0cf6a42019-07-26 16:42:36 -0400293 ${license_model_id} ${license_model_version_id}= Add SDC License Model
294
295
296 ${license_temp_date}= Get Current Date
297 ${license_start_date}= Get Current Date result_format=%m/%d/%Y
298 ${license_end_date}= Add Time To Date ${license_temp_date} 365 days result_format=%m/%d/%Y
299 ${key_group_id}= Add SDC License Group ${license_model_id} ${license_model_version_id} ${license_start_date} ${license_end_date}
300 ${pool_id}= Add SDC Entitlement Pool ${license_model_id} ${license_model_version_id} ${license_start_date} ${license_end_date}
DR695Hc0cf6a42019-07-26 16:42:36 -0400301 ${feature_group_id}= Add SDC Feature Group ${license_model_id} ${key_group_id} ${pool_id} ${license_model_version_id}
302 ${license_agreement_id}= Add SDC License Agreement ${license_model_id} ${feature_group_id} ${license_model_version_id}
303 Submit SDC License Model ${license_model_id} ${license_model_version_id}
304 ${license_model_resp}= Get SDC License Model ${license_model_id} ${license_model_version_id}
krzysztof kuzmickidadd0e62019-07-31 20:08:36 +0200305 ${matches}= Run Keyword If '${resourceType}'=='PNF' Get Regexp Matches ${model_zip_path} temp/(.*)\.csar 1
306 ... ELSE Get Regexp Matches ${model_zip_path} temp/(.*)\.zip 1
DR695Hc0cf6a42019-07-26 16:42:36 -0400307 ${software_product_name_prefix}= Set Variable ${matches[0]}
308 ${software_product_id} ${software_product_version_id}= Add SDC Software Product ${license_agreement_id} ${feature_group_id} ${license_model_resp['vendorName']} ${license_model_id} ${license_model_version_id} ${software_product_name_prefix}
309 Upload SDC Heat Package ${software_product_id} ${model_zip_path} ${software_product_version_id}
310 Validate SDC Software Product ${software_product_id} ${software_product_version_id}
311 Submit SDC Software Product ${software_product_id} ${software_product_version_id}
312 Package SDC Software Product ${software_product_id} ${software_product_version_id}
313 ${software_product_resp}= Get SDC Software Product ${software_product_id} ${software_product_version_id}
krzysztof kuzmickidadd0e62019-07-31 20:08:36 +0200314 ${catalog_resource_id}= Add SDC Catalog Resource ${license_agreement_id} ${software_product_resp['name']} ${license_model_resp['vendorName']} ${software_product_id} ${resourceType}
DR695Hc0cf6a42019-07-26 16:42:36 -0400315 # Check if need to set up CDS properties
316 Run Keyword If '${cds}' == 'vfwng' Setup SDC Catalog Resource CDS Properties ${catalog_resource_id}
317
318 ${catalog_resource_id}= Certify SDC Catalog Resource ${catalog_resource_id} ${SDC_DESIGNER_USER_ID}
319 [Return] ${catalog_resource_id}
320
DR695Hc0cf6a42019-07-26 16:42:36 -0400321Setup SDC Catalog Resource Deployment Artifact Properties
322 [Documentation] Set up Deployment Artiface properties
323 [Arguments] ${catalog_service_id} ${catalog_parent_service_id} ${catalog_resource_unique_id} ${blueprint_file}
324 ${resp}= Get SDC Catalog Resource Component Instances Properties ${catalog_service_id}
325 ${blueprint_data} OperatingSystem.Get File ${SDC_CATALOG_DEPLOYMENT_ARTIFACT_PATH}${blueprint_file}
326 ${payloadData}= Base64 Encode ${blueprint_data}
327 ${dict}= Create Dictionary artifactLabel=blueprint artifactName=${blueprint_file} artifactType=DCAE_INVENTORY_BLUEPRINT artifactGroupType=DEPLOYMENT description=${blueprint_file} payloadData=${payloadData}
328 Templating.Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER}
329 ${data}= Templating.Apply Template sdc ${SDC_ARTIFACT_UPLOAD_TEMPLATE} ${dict}
330 # POST artifactUpload to resource
331 ${artifact_upload_path}= Catenate ${SDC_CATALOG_SERVICES_PATH}/${catalog_service_id}/resourceInstance/${catalog_resource_unique_id}${SDC_CATALOG_SERVICE_RESOURCE_ARTIFACT_PATH}
332 ${resp}= SDC.Run Post Request ${SDC_BE_ENDPOINT} ${artifact_upload_path} ${data} ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
333 Should Be Equal As Strings ${resp.status_code} 200
334 [Return] ${resp}
335
336
337Setup SDC Catalog Resource GenericNeutronNet Properties
338 [Documentation] Set up GenericNeutronNet properties and inputs
339 [Arguments] ${catalog_service_id} ${nf_role} ${catalog_parent_service_id}
340 ${resp}= Get SDC Catalog Resource Component Instances Properties ${catalog_service_id}
341 ${componentInstances} Set Variable @{resp['componentInstancesProperties']}
342 # componentInstances can have 1 or more than 1 entry
343 ${passed}= Run Keyword And Return Status Evaluate type(${componentInstances})
344 ${type}= Run Keyword If ${passed} Evaluate type(${componentInstances})
345 ${componentInstancesList}= Run Keyword If "${type}"!="<type 'list'>" Create List ${componentInstances}
346 ... ELSE Set Variable ${componentInstances}
347 :FOR ${item} IN @{componentInstancesList}
348 \ ${test} ${v}= Run Keyword and Ignore Error Should Contain ${item} ${nf_role}
349 \ Run Keyword If '${test}' == 'FAIL' Continue For Loop
350 \ ${componentInstance1}= Set Variable ${item}
351 :FOR ${comp} IN @{resp['componentInstancesProperties']["${componentInstance1}"]}
352 \ ${name} Set Variable ${comp['name']}
353 \ ${test} ${v}= Run Keyword and Ignore Error Should Contain ${name} network_role
354 \ Run Keyword If '${test}' == 'FAIL' Continue For Loop
355 \ ${description} Set Variable ${comp['description']}
356 \ ${description}= Replace String ${description} ${\n} \
357 \ ${uniqueId} Set Variable ${comp['uniqueId']}
358 \ ${parentUniqueId} Set Variable ${comp['parentUniqueId']}
359 \ ${ownerId} Set Variable ${comp['ownerId']}
360 \ ${dict}= Create Dictionary parentUniqueId=${parentUniqueId} ownerId=${ownerId} uniqueId=${uniqueId} description=${description}
361 \ Run Keyword If '${name}'=='network_role' Set To Dictionary ${dict} name=${name} value=${nf_role}
362 \ Templating.Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER}
363 \ ${data}= Templating.Apply Template sdc ${SDC_CATALOG_NET_RESOURCE_INPUT_TEMPLATE} ${dict}
364 \ ${response}= Set SDC Catalog Resource Component Instance Properties ${catalog_parent_service_id} ${catalog_service_id} ${data}
365
366
367Setup SDC Catalog Resource AllottedResource Properties
368 [Documentation] Set up Allotted Resource properties and inputs
369 [Arguments] ${catalog_service_id} ${nf_role} ${catalog_resource_id} ${invariantUUID} ${UUID} ${node_type}
370 # Set component instances properties
371 ${nf_role_lc}= Convert To Lowercase ${nf_role}
372 ${resp}= Get SDC Catalog Resource Component Instances Properties For Resource ${catalog_resource_id}
373 ${componentInstances} Set Variable @{resp['componentInstancesProperties']}
374 # componentInstances can have 1 or more than 1 entry
375 ${passed}= Run Keyword And Return Status Evaluate type(${componentInstances})
376 ${type}= Run Keyword If ${passed} Evaluate type(${componentInstances})
377 ${componentInstancesList}= Run Keyword If "${type}"!="<type 'list'>" Create List ${componentInstances}
378 ... ELSE Set Variable ${componentInstances}
379 :FOR ${item} IN @{componentInstancesList}
380 \ ${test} ${v}= Run Keyword and Ignore Error Should Contain ${item} ${nf_role_lc}
381 \ Run Keyword If '${test}' == 'FAIL' Continue For Loop
382 \ ${componentInstance1}= Set Variable ${item}
383 ${dict}= Create Dictionary
384 :FOR ${comp} IN @{resp['componentInstancesProperties']["${componentInstance1}"]}
385 \ ${name} Set Variable ${comp['name']}
386 \ ${test} ${v}= Run Keyword and Ignore Error Should Contain Any ${name} network_role providing_service_invariant_uuid providing_service_uuid providing_service_name uniqueId
387 \ Run Keyword If '${test}' == 'FAIL' Continue For Loop
388 \ ${parentUniqueId} Set Variable ${comp['parentUniqueId']}
389 \ ${ownerId} Set Variable ${comp['ownerId']}
390 \ Set To Dictionary ${dict} parentUniqueId=${parentUniqueId} ownerId=${ownerId}
391 \ Run Keyword If '${name}'=='providing_service_invariant_uuid' Set To Dictionary ${dict} providing_service_invariant_uuid=${invariantUUID}
392 \ Run Keyword If '${name}'=='providing_service_uuid' Set To Dictionary ${dict} providing_service_uuid=${UUID}
393 \ Run Keyword If '${name}'=='providing_service_name' Set To Dictionary ${dict} providing_service_name=${node_type}
394 # Sets it for each loop but should be one
395 \ ${uniqueId} Set Variable ${comp['uniqueId']}
396 \ ${uniqueId} Fetch From Left ${uniqueId} .
397 \ Set To Dictionary ${dict} uniqueId=${uniqueId}
398 Templating.Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER}
399 ${data}= Templating.Apply Template sdc ${SDC_CATALOG_ALLOTTED_RESOURCE_PROPERTIES_TEMPLATE} ${dict}
400 ${response}= Set SDC Catalog Resource Component Instance Properties For Resource ${catalog_resource_id} ${componentInstance1} ${data}
401 Log resp=${response}
402
403
404Setup SDC Catalog Resource AllottedResource Inputs
405 [Documentation] Set up Allotted Resource inputs
406 [Arguments] ${catalog_service_id} ${nf_role} ${catalog_resource_id}
407 # Set vnf inputs
408 ${resp}= Get SDC Catalog Resource Inputs ${catalog_resource_id}
409 ${dict}= Create Dictionary
410 :FOR ${comp} IN @{resp['inputs']}
411 \ ${name} Set Variable ${comp['name']}
412 \ ${uid} Set Variable ${comp['uniqueId']}
413 \ Run Keyword If '${name}'=='nf_type' Set To Dictionary ${dict} nf_type=${nf_role} nf_type_uid=${uid}
414 \ Run Keyword If '${name}'=='nf_role' Set To Dictionary ${dict} nf_role=${nf_role} nf_role_uid=${uid}
415 Templating.Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER}
416 ${data}= Templating.Apply Template sdc ${SDC_CATALOG_ALLOTTED_RESOURCE_INPUTS_TEMPLATE} ${dict}
417 ${response}= Set SDC Catalog Resource VNF Inputs ${catalog_resource_id} ${data}
418 [Return] ${response}
419
420Setup SDC Catalog Resource CDS Properties
421 [Documentation] Set up vfwng VNF properties and inputs for CDS
422 [Arguments] ${catalog_resource_id}
423 # Set vnf module properties
424 ${resp}= Get SDC Catalog Resource Component Instances ${catalog_resource_id}
425 :FOR ${comp} IN @{resp['componentInstances']}
426 \ ${name} Set Variable ${comp['name']}
427 \ ${uniqueId} Set Variable ${comp['uniqueId']}
428 \ ${actualComponentUid} Set Variable ${comp['actualComponentUid']}
429 \ ${test} ${v}= Run Keyword and Ignore Error Should Contain ${name} abstract_
430 \ Run Keyword If '${test}' == 'FAIL' Continue For Loop
431 \ ${response}= Get SDC Catalog Resource Component Instance Properties ${catalog_resource_id} ${uniqueId} ${actualComponentUid}
432 \ ${dict}= Create Dictionary parent_id=${response[6]['parentUniqueId']}
433 \ Run Keyword If '${name}'=='abstract_vfw' Set To Dictionary ${dict} nfc_function=vfw nfc_naming_policy=SDNC_Policy.ONAP_VFW_NAMING_TIMESTAMP
434 \ Run Keyword If '${name}'=='abstract_vpg' Set To Dictionary ${dict} nfc_function=vpg nfc_naming_policy=SDNC_Policy.ONAP_VPG_NAMING_TIMESTAMP
435 \ Run Keyword If '${name}'=='abstract_vsn' Set To Dictionary ${dict} nfc_function=vsn nfc_naming_policy=SDNC_Policy.ONAP_VSN_NAMING_TIMESTAMP
436 \ Templating.Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER}
437 \ ${data}= Templating.Apply Template sdc ${SDC_RESOURCE_INSTANCE_VNF_PROPERTIES_TEMPLATE} ${dict}
438 \ ${response}= Set SDC Catalog Resource Component Instance Properties ${catalog_resource_id} ${uniqueId} ${data}
439 \ Log resp=${response}
440
441 # Set vnf inputs
442 ${resp}= Get SDC Catalog Resource Inputs ${catalog_resource_id}
443 ${dict}= Create Dictionary
444 :FOR ${comp} IN @{resp['inputs']}
445 \ ${name} Set Variable ${comp['name']}
446 \ ${uid} Set Variable ${comp['uniqueId']}
447 \ Run Keyword If '${name}'=='nf_function' Set To Dictionary ${dict} nf_function=ONAP-FIREWALL nf_function_uid=${uid}
448 \ Run Keyword If '${name}'=='nf_type' Set To Dictionary ${dict} nf_type=FIREWALL nf_type_uid=${uid}
449 \ Run Keyword If '${name}'=='nf_naming_code' Set To Dictionary ${dict} nf_naming_code=vfw nf_naming_code_uid=${uid}
450 \ Run Keyword If '${name}'=='nf_role' Set To Dictionary ${dict} nf_role=vFW nf_role_uid=${uid}
451 \ Run Keyword If '${name}'=='cloud_env' Set To Dictionary ${dict} cloud_env=openstack cloud_env_uid=${uid}
452 Templating.Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER}
453 ${data}= Templating.Apply Template sdc ${SDC_RESOURCE_INSTANCE_VNF_INPUTS_TEMPLATE} ${dict}
454 ${response}= Set SDC Catalog Resource VNF Inputs ${catalog_resource_id} ${data}
455
456Add SDC License Model
457 [Documentation] Creates an SDC License Model and returns its id
458 ${uuid}= Generate UUID4
459 ${shortened_uuid}= Evaluate str("${uuid}")[:23]
460 ${map}= Create Dictionary vendor_name=${shortened_uuid}
461 Templating.Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER}
462 ${data}= Templating.Apply Template sdc ${SDC_LICENSE_MODEL_TEMPLATE} ${map}
463 ${resp}= SDC.Run Post Request ${SDC_BE_ONBOARD_ENDPOINT} ${SDC_VENDOR_LICENSE_MODEL_PATH} ${data} ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
464 Should Be Equal As Strings ${resp.status_code} 200
465 [Return] ${resp.json()['itemId']} ${resp.json()['version']['id']}
466
467Get SDC License Model
468 [Documentation] gets an SDC license model by its id
469 [Arguments] ${id} ${version_id}=0.1
470 ${resp}= SDC.Run Get Request ${SDC_BE_ONBOARD_ENDPOINT} ${SDC_VENDOR_LICENSE_MODEL_PATH}/${id}/versions/${version_id} ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
471 [Return] ${resp.json()}
472
473Get SDC License Models
474 [Documentation] Gets all SDC License Models
475 ${resp}= SDC.Run Get Request ${SDC_BE_ONBOARD_ENDPOINT} ${SDC_VENDOR_LICENSE_MODEL_PATH} ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
476 [Return] ${resp.json()}
477
478Checkin SDC License Model
479 [Documentation] Checks in an SDC License Model by its id
480 [Arguments] ${id} ${version_id}=0.1
481 ${map}= Create Dictionary action=Checkin
482 Templating.Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER}
483 ${data}= Templating.Apply Template sdc ${SDC_ACTION_TEMPLATE} ${map}
484 ${resp}= SDC.Run Put Request ${SDC_BE_ONBOARD_ENDPOINT} ${SDC_VENDOR_LICENSE_MODEL_PATH}/${id}/versions/${version_id}${SDC_VENDOR_ACTIONS_PATH} ${data} ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
485 Should Be Equal As Strings ${resp.status_code} 200
486 [Return] ${resp.json()}
487
488Submit SDC License Model
489 [Documentation] Submits an SDC License Model by its id
490 [Arguments] ${id} ${version_id}=0.1
491 ${map}= Create Dictionary action=Submit
492 Templating.Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER}
493 ${data}= Templating.Apply Template sdc ${SDC_ACTION_TEMPLATE} ${map}
494 ${resp}= SDC.Run Put Request ${SDC_BE_ONBOARD_ENDPOINT} ${SDC_VENDOR_LICENSE_MODEL_PATH}/${id}/versions/${version_id}${SDC_VENDOR_ACTIONS_PATH} ${data} ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
495 [Return] ${resp.json()}
496
497Checkin SDC Software Product
498 [Documentation] Checks in an SDC Software Product by its id
499 [Arguments] ${id} ${version_id}=0.1
500 ${map}= Create Dictionary action=Checkin
501 Templating.Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER}
502 ${data}= Templating.Apply Template sdc ${SDC_ACTION_TEMPLATE} ${map}
503 ${resp}= SDC.Run Put Request ${SDC_BE_ONBOARD_ENDPOINT} ${SDC_VENDOR_SOFTWARE_PRODUCT_PATH}/${id}/versions/${version_id}${SDC_VENDOR_ACTIONS_PATH} ${data} ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
504 Should Be Equal As Strings ${resp.status_code} 200
505 [Return] ${resp.json()}
506
507Validate SDC Software Product
508 [Documentation] Validates an SDC Software Product by its id
509 [Arguments] ${id} ${version_id}=0.1
510 ${data}= Catenate
511 ${resp}= SDC.Run Put Request ${SDC_BE_ONBOARD_ENDPOINT} ${SDC_VENDOR_SOFTWARE_PRODUCT_PATH}/${id}/versions/${version_id}/orchestration-template-candidate/process ${data} ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
512 Should Be Equal As Strings ${resp.status_code} 200
513 [Return] ${resp.json()}
514
515Submit SDC Software Product
516 [Documentation] Submits an SDC Software Product by its id
517 [Arguments] ${id} ${version_id}=0.1
518 ${map}= Create Dictionary action=Submit
519 Templating.Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER}
520 ${data}= Templating.Apply Template sdc ${SDC_ACTION_TEMPLATE} ${map}
521 ${resp}= SDC.Run Put Request ${SDC_BE_ONBOARD_ENDPOINT} ${SDC_VENDOR_SOFTWARE_PRODUCT_PATH}/${id}/versions/${version_id}${SDC_VENDOR_ACTIONS_PATH} ${data} ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
522 Should Be Equal As Strings ${resp.status_code} 200
523 [Return] ${resp.json()}
524
525Package SDC Software Product
526 [Documentation] Creates a package of an SDC Software Product by its id
527 [Arguments] ${id} ${version_id}=0.1
528 ${map}= Create Dictionary action=Create_Package
529 Templating.Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER}
530 ${data}= Templating.Apply Template sdc ${SDC_ACTION_TEMPLATE} ${map}
531 ${resp}= SDC.Run Put Request ${SDC_BE_ONBOARD_ENDPOINT} ${SDC_VENDOR_SOFTWARE_PRODUCT_PATH}/${id}/versions/${version_id}${SDC_VENDOR_ACTIONS_PATH} ${data} ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
532 Should Be Equal As Strings ${resp.status_code} 200
533 [Return] ${resp.json()}
534
535Add SDC Entitlement Pool
536 [Documentation] Creates an SDC Entitlement Pool and returns its id
537 [Arguments] ${license_model_id} ${version_id}=0.1 ${license_start_date}="01/01/1960" ${license_end_date}="01/01/1961"
538 ${uuid}= Generate UUID4
539 ${shortened_uuid}= Evaluate str("${uuid}")[:23]
540 ${map}= Create Dictionary entitlement_pool_name=${shortened_uuid} license_start_date=${license_start_date} license_end_date=${license_end_date}
541 Templating.Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER}
542 ${data}= Templating.Apply Template sdc ${SDC_ENTITLEMENT_POOL_TEMPLATE} ${map}
543 ${resp}= SDC.Run Post Request ${SDC_BE_ONBOARD_ENDPOINT} ${SDC_VENDOR_LICENSE_MODEL_PATH}/${license_model_id}/versions/${version_id}${SDC_VENDOR_ENTITLEMENT_POOL_PATH} ${data} ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
544 Should Be Equal As Strings ${resp.status_code} 200
545 [Return] ${resp.json()['value']}
546
547Get SDC Entitlement Pool
548 [Documentation] Gets an SDC Entitlement Pool by its id
549 [Arguments] ${license_model_id} ${pool_id}
550 ${resp}= SDC.Run Get Request ${SDC_BE_ONBOARD_ENDPOINT} ${SDC_VENDOR_LICENSE_MODEL_PATH}/${license_model_id}${SDC_VENDOR_ENTITLEMENT_POOL_PATH}/${pool_id} ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
551 [Return] ${resp.json()}
552
553Add SDC License Group
554 [Documentation] Creates an SDC License Group and returns its id
555 [Arguments] ${license_model_id} ${version_id}=1.0 ${license_start_date}="01/01/1960" ${license_end_date}="01/01/1961"
556 ${uuid}= Generate UUID4
557 ${shortened_uuid}= Evaluate str("${uuid}")[:23]
558 ${map}= Create Dictionary key_group_name=${shortened_uuid} license_start_date=${license_start_date} license_end_date=${license_end_date}
559 Templating.Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER}
560 ${data}= Templating.Apply Template sdc ${SDC_KEY_GROUP_TEMPLATE} ${map}
561 ${resp}= SDC.Run Post Request ${SDC_BE_ONBOARD_ENDPOINT} ${SDC_VENDOR_LICENSE_MODEL_PATH}/${license_model_id}/versions/${version_id}${SDC_VENDOR_KEY_GROUP_PATH} ${data} ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
562 Should Be Equal As Strings ${resp.status_code} 200
563 [Return] ${resp.json()['value']}
564
565Get SDC License Group
566 [Documentation] Gets an SDC License Group by its id
567 [Arguments] ${license_model_id} ${group_id} ${version_id}
568 ${resp}= SDC.Run Get Request ${SDC_BE_ONBOARD_ENDPOINT} ${SDC_VENDOR_LICENSE_MODEL_PATH}/${license_model_id}/versions/${version_id}${SDC_VENDOR_KEY_GROUP_PATH}/${group_id} ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
569 [Return] ${resp.json()}
570
571Add SDC Feature Group
572 [Documentation] Creates an SDC Feature Group and returns its id
573 [Arguments] ${license_model_id} ${key_group_id} ${entitlement_pool_id} ${version_id}=0.1
574 ${uuid}= Generate UUID4
575 ${shortened_uuid}= Evaluate str("${uuid}")[:23]
576 ${map}= Create Dictionary feature_group_name=${shortened_uuid} key_group_id=${key_group_id} entitlement_pool_id=${entitlement_pool_id} manufacturer_reference_number=mrn${shortened_uuid}
577 Templating.Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER}
578 ${data}= Templating.Apply Template sdc ${SDC_FEATURE_GROUP_TEMPLATE} ${map}
579 ${resp}= SDC.Run Post Request ${SDC_BE_ONBOARD_ENDPOINT} ${SDC_VENDOR_LICENSE_MODEL_PATH}/${license_model_id}/versions/${version_id}${SDC_VENDOR_FEATURE_GROUP_PATH} ${data} ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
580 Should Be Equal As Strings ${resp.status_code} 200
581 [Return] ${resp.json()['value']}
582
583Get SDC Feature Group
584 [Documentation] Gets an SDC Feature Group by its id
585 [Arguments] ${license_model_id} ${group_id}
586 ${resp}= SDC.Run Get Request ${SDC_BE_ONBOARD_ENDPOINT} ${SDC_VENDOR_LICENSE_MODEL_PATH}/${license_model_id}${SDC_VENDOR_FEATURE_GROUP_PATH}/${group_id} ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
587 [Return] ${resp.json()}
588
589Add SDC License Agreement
590 [Documentation] Creates an SDC License Agreement and returns its id
591 [Arguments] ${license_model_id} ${feature_group_id} ${version_id}=0.1
592 ${uuid}= Generate UUID4
593 ${shortened_uuid}= Evaluate str("${uuid}")[:23]
594 ${map}= Create Dictionary license_agreement_name=${shortened_uuid} feature_group_id=${feature_group_id}
595 Templating.Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER}
596 ${data}= Templating.Apply Template sdc ${SDC_LICENSE_AGREEMENT_TEMPLATE} ${map}
597 ${resp}= SDC.Run Post Request ${SDC_BE_ONBOARD_ENDPOINT} ${SDC_VENDOR_LICENSE_MODEL_PATH}/${license_model_id}/versions/${version_id}${SDC_VENDOR_LICENSE_AGREEMENT_PATH} ${data} ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
598 Should Be Equal As Strings ${resp.status_code} 200
599 [Return] ${resp.json()['value']}
600
601Get SDC License Agreement
602 [Documentation] Gets an SDC License Agreement by its id
603 [Arguments] ${license_model_id} ${agreement_id}
604 ${resp}= SDC.Run Get Request ${SDC_BE_ONBOARD_ENDPOINT} ${SDC_VENDOR_LICENSE_MODEL_PATH}/${license_model_id}${SDC_VENDOR_LICENSE_AGREEMENT_PATH}/${agreement_id} ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
605 [Return] ${resp.json()}
606
607Add SDC Software Product
608 [Documentation] Creates an SDC Software Product and returns its id
609 [Arguments] ${license_agreement_id} ${feature_group_id} ${license_model_name} ${license_model_id} ${license_model_version_id} ${name_prefix}
610 ${uuid}= Generate UUID4
611 ${shortened_uuid}= Evaluate str("${uuid}")[:13]
612 ${software_product_name}= Catenate ${name_prefix} ${shortened_uuid}
613 ${map}= Create Dictionary software_product_name=${software_product_name} feature_group_id=${feature_group_id} license_agreement_id=${license_agreement_id} vendor_name=${license_model_name} vendor_id=${license_model_id} version_id=${license_model_version_id}
614 Templating.Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER}
615 ${data}= Templating.Apply Template sdc ${SDC_SOFTWARE_PRODUCT_TEMPLATE} ${map}
616 ${resp}= SDC.Run Post Request ${SDC_BE_ONBOARD_ENDPOINT} ${SDC_VENDOR_SOFTWARE_PRODUCT_PATH} ${data} ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
617 Should Be Equal As Strings ${resp.status_code} 200
618 [Return] ${resp.json()['itemId']} ${resp.json()['version']['id']}
619
620Get SDC Software Product
621 [Documentation] Gets an SDC Software Product by its id
622 [Arguments] ${software_product_id} ${version_id}=0.1
623 ${resp}= SDC.Run Get Request ${SDC_BE_ONBOARD_ENDPOINT} ${SDC_VENDOR_SOFTWARE_PRODUCT_PATH}/${software_product_id}/versions/${version_id} ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
624 [Return] ${resp.json()}
625
626Add SDC Catalog Resource
627 [Documentation] Creates an SDC Catalog Resource and returns its id
krzysztof kuzmickidadd0e62019-07-31 20:08:36 +0200628 [Arguments] ${license_agreement_id} ${software_product_name} ${license_model_name} ${software_product_id} ${resourceType}=VF
629 ${map}= Create Dictionary software_product_id=${software_product_id} software_product_name=${software_product_name} license_agreement_id=${license_agreement_id} vendor_name=${license_model_name} resource_type=${resourceType}
DR695Hc0cf6a42019-07-26 16:42:36 -0400630 Templating.Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER}
631 ${data}= Templating.Apply Template sdc ${SDC_CATALOG_RESOURCE_TEMPLATE} ${map}
632 ${resp}= SDC.Run Post Request ${SDC_BE_ENDPOINT} ${SDC_CATALOG_RESOURCES_PATH} ${data} ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
633 Should Be Equal As Strings ${resp.status_code} 201
634 [Return] ${resp.json()['uniqueId']}
635
636Add SDC Allotted Resource Catalog Resource
637 [Documentation] Creates an SDC Allotted Resource Catalog Resource and returns its id
638 [Arguments] ${license_agreement_id} ${software_product_name} ${license_model_name} ${software_product_id} ${subcategory}
639 ${map}= Create Dictionary software_product_id=${software_product_id} software_product_name=${software_product_name} license_agreement_id=${license_agreement_id} vendor_name=${license_model_name} subcategory=${subcategory}
640 Templating.Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER}
641 ${data}= Templating.Apply Template sdc ${SDC_ALLOTTED_RESOURCE_CATALOG_RESOURCE_TEMPLATE} ${map}
642 ${resp}= SDC.Run Post Request ${SDC_BE_ENDPOINT} ${SDC_CATALOG_RESOURCES_PATH} ${data} ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
643 Should Be Equal As Strings ${resp.status_code} 201
644 [Return] ${resp.json()['uniqueId']}
645
646Mark SDC Catalog Resource Inactive
647 [Documentation] Marks SDC Catalog Resource as inactive
648 [Arguments] ${catalog_resource_id}
649 ${resp}= SDC.Run Delete Request ${SDC_BE_ENDPOINT} ${SDC_CATALOG_RESOURCES_PATH}/${catalog_resource_id} ${None} ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
650 Should Be Equal As Strings ${resp.status_code} 204
651 [Return] ${resp}
652
653Delete Inactive SDC Catalog Resources
654 [Documentation] Delete all SDC Catalog Resources that are inactive
655 ${resp}= SDC.Run Delete Request ${SDC_BE_ENDPOINT} ${SDC_CATALOG_INACTIVE_RESOURCES_PATH} ${None} ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
656 Should Be Equal As Strings ${resp.status_code} 200
657 [Return] ${resp.json()}
658
659Get SDC Catalog Resource
660 [Documentation] Gets an SDC Catalog Resource by its id
661 [Arguments] ${catalog_resource_id}
662 ${resp}= SDC.Run Get Request ${SDC_BE_ENDPOINT} ${SDC_CATALOG_RESOURCES_PATH}/${catalog_resource_id} ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
663 [Return] ${resp.json()}
664
665Get SDC Catalog Resource Component Instances
666 [Documentation] Gets component instances of an SDC Catalog Resource by its id
667 [Arguments] ${catalog_resource_id}
668 ${resp}= SDC.Run Get Request ${SDC_FE_ENDPOINT} ${SDC_FE_CATALOG_RESOURCES_PATH}/${catalog_resource_id}/filteredDataByParams?include=componentInstances ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
669 [Return] ${resp.json()}
670
671Get SDC Catalog Resource Deployment Artifact Properties
672 [Documentation] Gets deployment artifact properties of an SDC Catalog Resource by its id
673 [Arguments] ${catalog_resource_id}
674 ${resp}= SDC.Run Get Request ${SDC_FE_ENDPOINT} ${SDC_CATALOG_SERVICES_PATH}/${catalog_resource_id}/filteredDataByParams?include=deploymentArtifacts ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
675 [Return] ${resp.json()}
676
677
678Get SDC Catalog Resource Component Instances Properties
679 [Documentation] Gets SDC Catalog Resource component instances properties by its id
680 [Arguments] ${catalog_resource_id}
681 ${resp}= SDC.Run Get Request ${SDC_BE_ENDPOINT} ${SDC_CATALOG_SERVICES_PATH}/${catalog_resource_id}/filteredDataByParams?include=componentInstancesProperties ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
682 [Return] ${resp.json()}
683
684Get SDC Catalog Resource Component Instances Properties For Resource
685 [Documentation] Gets SDC Catalog Resource component instances properties for a Resource (VF) by its id
686 [Arguments] ${catalog_resource_id}
687 ${resp}= SDC.Run Get Request ${SDC_FE_ENDPOINT} ${SDC_FE_CATALOG_RESOURCES_PATH}/${catalog_resource_id}/filteredDataByParams?include=componentInstancesProperties ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
688 [Return] ${resp.json()}
689
690Get SDC Catalog Resource Inputs
691 [Documentation] Gets SDC Catalog Resource inputs by its id
692 [Arguments] ${catalog_resource_id}
693 ${resp}= SDC.Run Get Request ${SDC_FE_ENDPOINT} ${SDC_FE_CATALOG_RESOURCES_PATH}/${catalog_resource_id}/filteredDataByParams?include=inputs ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
694 [Return] ${resp.json()}
695
696Get SDC Catalog Resource Component Instance Properties
697 [Documentation] Gets component instance properties of an SDC Catalog Resource by their ids
698 [Arguments] ${catalog_resource_id} ${component_instance_id} ${component_id}
699 ${resp}= SDC.Run Get Request ${SDC_FE_ENDPOINT} ${SDC_FE_CATALOG_RESOURCES_PATH}/${catalog_resource_id}/componentInstances/${component_instance_id}/${component_id}/inputs ${SDC_DESIGNER_USER_ID}auth=${GLOBAL_SDC_AUTHENTICATION}
700 [Return] ${resp.json()}
701
702Set SDC Catalog Resource Component Instance Properties
703 [Documentation] Sets SDC Catalog Resource component instance properties by ids
704 [Arguments] ${catalog_resource_id} ${component_parent_service_id} ${data}
705 ${resp}= SDC.Run Post Request ${SDC_FE_ENDPOINT} ${SDC_FE_CATALOG_SERVICES_PATH}/${component_parent_service_id}/resourceInstance/${catalog_resource_id}/properties ${data} ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
706 [Return] ${resp.json()}
707
708Set SDC Catalog Resource Component Instance Properties For Resource
709 [Documentation] Sets SDC Resource component instance properties by ids
710 [Arguments] ${catalog_parent_resource_id} ${catalog_resource_id} ${data}
711 ${resp}= SDC.Run Post Request ${SDC_FE_ENDPOINT} ${SDC_FE_CATALOG_RESOURCES_PATH}/${catalog_parent_resource_id}/resourceInstance/${catalog_resource_id}/properties ${data} ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
712 [Return] ${resp.json()}
713
714Set CDS Catalog Resource Component Instance Properties
715 [Documentation] Sets CDS Catalog Resource component instance properties by ids
716 [Arguments] ${catalog_resource_id} ${component_instance_id} ${data}
717 ${resp}= SDC.Run Post Request ${SDC_FE_ENDPOINT} ${SDC_FE_CATALOG_RESOURCES_PATH}/${catalog_resource_id}/resourceInstance/${component_instance_id}/inputs ${data} ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
718 [Return] ${resp.json()}
719
720Set SDC Catalog Resource VNF Inputs
721 [Documentation] Sets VNF Inputs for an SDC Catalog Resource by its id
722 [Arguments] ${catalog_resource_id} ${data}
723 ${resp}= SDC.Run Post Request ${SDC_FE_ENDPOINT} ${SDC_FE_CATALOG_RESOURCES_PATH}/${catalog_resource_id}/update/inputs ${data} ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
724 [Return] ${resp.json()}
725
726Get SDC Demo Vnf Catalog Resource
727 [Documentation] Gets Resource ids of demonstration VNFs for instantiation
728 [Arguments] ${service_name}
729 ${resp}= SDC.Run Get Request ${SDC_BE_ENDPOINT} ${SDC_CATALOG_SERVICES_PATH}/serviceName/${service_name}/serviceVersion/1.0 ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
730 @{ITEMS}= Copy List ${resp.json()['componentInstances']}
731 ${demo_catalog_resource}= Create Dictionary
732 :FOR ${ELEMENT} IN @{ITEMS}
733 \ Log ${ELEMENT['name']}
734 \ Log ${ELEMENT['groupInstances'][0]['groupName']}
735 \ ${vnf}= Get VNF From Group Name ${ELEMENT['groupInstances'][0]['groupName']} ${service_name}
736 \ ${vnf_data}= Create Dictionary vnf_type=${ELEMENT['name']} vf_module=${ELEMENT['groupInstances'][0]['groupName']}
737 \ LOG ${vnf_data}
738 \ Set To Dictionary ${demo_catalog_resource} ${vnf}=${vnf_data}
739 \ LOG ${demo_catalog_resource}
740 [Return] ${demo_catalog_resource}
741
742Get VNF From Group Name
743 [Documentation] Looks up VNF key from service mapping for a regex on group_name and service_name
744 [Arguments] ${group_name} ${service_name}
745 ${vnf}= Set Variable If
746 ... ('${service_name}'=='demoVFWCL') and ('base_vfw' in '${group_name}') vFWCLvFWSNK
747 ... ('${service_name}'=='demoVFWCL') and ('base_vpkg' in '${group_name}') vFWCLvPKG
748 ... ('${service_name}'=='demoVLB') and ('base_vlb' in '${group_name}') vLB
749 [Return] ${vnf}
750
751Checkin SDC Catalog Resource
752 [Documentation] Checks in an SDC Catalog Resource by its id
753 [Arguments] ${catalog_resource_id}
754 ${map}= Create Dictionary user_remarks=Robot remarks
755 Templating.Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER}
756 ${data}= Templating.Apply Template sdc ${SDC_USER_REMARKS_TEMPLATE} ${map}
757 ${resp}= SDC.Run Post Request ${SDC_BE_ENDPOINT} ${SDC_DESIGNER_USER_ID} ${SDC_CATALOG_RESOURCES_PATH}/${catalog_resource_id}${SDC_CATALOG_LIFECYCLE_PATH}/checkin ${data} auth=${GLOBAL_SDC_AUTHENTICATION}
758 Should Be Equal As Strings ${resp.status_code} 200
759 [Return] ${resp.json()}
760
761Request Certify SDC Catalog Resource
762 [Documentation] Requests certification of an SDC Catalog Resource by its id
763 [Arguments] ${catalog_resource_id}
764 ${map}= Create Dictionary user_remarks=Robot remarks
765 Templating.Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER}
766 ${data}= Templating.Apply Template sdc ${SDC_USER_REMARKS_TEMPLATE} ${map}
767 ${resp}= SDC.Run Post Request ${SDC_BE_ENDPOINT} ${SDC_CATALOG_RESOURCES_PATH}/${catalog_resource_id}${SDC_CATALOG_LIFECYCLE_PATH}/certificationRequest ${data} ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
768 Should Be Equal As Strings ${resp.status_code} 200
769 [Return] ${resp.json()}
770
771Start Certify SDC Catalog Resource
772 [Documentation] Start certification of an SDC Catalog Resource by its id
773 [Arguments] ${catalog_resource_id}
774 ${resp}= SDC.Run Post Request ${SDC_BE_ENDPOINT} ${SDC_CATALOG_RESOURCES_PATH}/${catalog_resource_id}${SDC_CATALOG_LIFECYCLE_PATH}/startCertification ${None} ${SDC_TESTER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
775 Should Be Equal As Strings ${resp.status_code} 200
776 [Return] ${resp.json()}
777
778Certify SDC Catalog Resource
779 [Documentation] Certifies an SDC Catalog Resource by its id and returns the new id
780 [Arguments] ${catalog_resource_id} ${user_id}=${SDC_TESTER_USER_ID}
781 ${map}= Create Dictionary user_remarks=Robot remarks
782 Templating.Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER}
783 ${data}= Templating.Apply Template sdc ${SDC_USER_REMARKS_TEMPLATE} ${map}
784 ${resp}= SDC.Run Post Request ${SDC_BE_ENDPOINT} ${SDC_CATALOG_RESOURCES_PATH}/${catalog_resource_id}${SDC_CATALOG_LIFECYCLE_PATH}/certify ${data} ${user_id} auth=${GLOBAL_SDC_AUTHENTICATION}
785 Should Be Equal As Strings ${resp.status_code} 200
786 [Return] ${resp.json()['uniqueId']}
787
788Upload SDC Heat Package
789 [Documentation] Creates an SDC Software Product and returns its id
790 [Arguments] ${software_product_id} ${file_path} ${version_id}=0.1
791 ${files}= Create Dictionary
792 Create Multi Part ${files} upload ${file_path} contentType=application/zip
793 ${resp}= SDC.Run Post Files Request ${SDC_BE_ONBOARD_ENDPOINT} ${SDC_VENDOR_SOFTWARE_PRODUCT_PATH}/${software_product_id}/versions/${version_id}${SDC_VENDOR_SOFTWARE_UPLOAD_PATH} ${files} ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
794 Should Be Equal As Strings ${resp.status_code} 200
795
796Add SDC Catalog Service
797 [Documentation] Creates an SDC Catalog Service and returns its id
krzysztof kuzmickidadd0e62019-07-31 20:08:36 +0200798 [Arguments] ${catalog_service_name} ${instantiationType}=A-la-carte
DR695Hc0cf6a42019-07-26 16:42:36 -0400799 ${uuid}= Generate UUID4
800 ${shortened_uuid}= Evaluate str("${uuid}")[:23]
801 ${catalog_service_name}= Set Variable If '${catalog_service_name}' =='' ${shortened_uuid} ${catalog_service_name}
krzysztof kuzmickidadd0e62019-07-31 20:08:36 +0200802 ${map}= Create Dictionary service_name=${catalog_service_name} instantiation_type=${instantiationType}
DR695Hc0cf6a42019-07-26 16:42:36 -0400803 Templating.Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER}
804 ${data}= Templating.Apply Template sdc ${SDC_CATALOG_SERVICE_TEMPLATE} ${map}
805 ${resp}= SDC.Run Post Request ${SDC_BE_ENDPOINT} ${SDC_CATALOG_SERVICES_PATH} ${data} ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
806 Should Be Equal As Strings ${resp.status_code} 201
807 [Return] ${resp.json()['uniqueId']}
808
809Mark SDC Catalog Service Inactive
810 [Documentation] Deletes an SDC Catalog Service
811 [Arguments] ${catalog_service_id}
812 ${resp}= SDC.Run Delete Request ${SDC_BE_ENDPOINT} ${SDC_CATALOG_SERVICES_PATH}/${catalog_service_id} ${None} ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
813 Should Be Equal As Strings ${resp.status_code} 204
814 [Return] ${resp}
815
816Delete Inactive SDC Catalog Services
817 [Documentation] Delete all SDC Catalog Services that are inactive
818 ${resp}= SDC.Run Delete Request ${SDC_BE_ENDPOINT} ${SDC_CATALOG_INACTIVE_SERVICES_PATH} ${None} ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
819 Should Be Equal As Strings ${resp.status_code} 200
820 [Return] ${resp.json()}
821
822Get SDC Catalog Service
823 [Documentation] Gets an SDC Catalog Service by its id
824 [Arguments] ${catalog_service_id}
825 ${resp}= SDC.Run Get Request ${SDC_BE_ENDPOINT} ${SDC_CATALOG_SERVICES_PATH}/${catalog_service_id} ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
826 [Return] ${resp.json()}
827
828Checkin SDC Catalog Service
829 [Documentation] Checks in an SDC Catalog Service by its id
830 [Arguments] ${catalog_service_id}
831 ${map}= Create Dictionary user_remarks=Robot remarks
832 Templating.Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER}
833 ${data}= Templating.Apply Template sdc ${SDC_USER_REMARKS_TEMPLATE} ${map}
834 ${resp}= SDC.Run Post Request ${SDC_BE_ENDPOINT} ${SDC_CATALOG_SERVICES_PATH}/${catalog_service_id}${SDC_CATALOG_LIFECYCLE_PATH}/checkin ${data} ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
835 Should Be Equal As Strings ${resp.status_code} 200
836 [Return] ${resp.json()}
837
838Request Certify SDC Catalog Service
839 [Documentation] Requests certification of an SDC Catalog Service by its id
840 [Arguments] ${catalog_service_id}
841 ${map}= Create Dictionary user_remarks=Robot remarks
842 Templating.Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER}
843 ${data}= Templating.Apply Template sdc ${SDC_USER_REMARKS_TEMPLATE} ${map}
844 ${resp}= SDC.Run Post Request ${SDC_BE_ENDPOINT} ${SDC_CATALOG_SERVICES_PATH}/${catalog_service_id}${SDC_CATALOG_LIFECYCLE_PATH}/certificationRequest ${data} ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
845 Should Be Equal As Strings ${resp.status_code} 200
846 [Return] ${resp.json()}
847
848Start Certify SDC Catalog Service
849 [Documentation] Start certification of an SDC Catalog Service by its id
850 [Arguments] ${catalog_service_id}
851 ${resp}= SDC.Run Post Request ${SDC_BE_ENDPOINT} ${SDC_CATALOG_SERVICES_PATH}/${catalog_service_id}${SDC_CATALOG_LIFECYCLE_PATH}/startCertification ${None} ${SDC_TESTER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
852 Should Be Equal As Strings ${resp.status_code} 200
853 [Return] ${resp.json()}
854
855Certify SDC Catalog Service
856 [Documentation] Certifies an SDC Catalog Service by its id and returns the new id
857 [Arguments] ${catalog_service_id}
858 ${map}= Create Dictionary user_remarks=Robot remarks
859 Templating.Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER}
860 ${data}= Templating.Apply Template sdc ${SDC_USER_REMARKS_TEMPLATE} ${map}
861 ${resp}= SDC.Run Post Request ${SDC_BE_ENDPOINT} ${SDC_CATALOG_SERVICES_PATH}/${catalog_service_id}${SDC_CATALOG_LIFECYCLE_PATH}/certify ${data} ${SDC_TESTER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
862 Should Be Equal As Strings ${resp.status_code} 200
863 [Return] ${resp.json()['uniqueId']}
864
865Approve SDC Catalog Service
866 [Documentation] Approves an SDC Catalog Service by its id
867 [Arguments] ${catalog_service_id}
868 ${map}= Create Dictionary user_remarks=Robot remarks
869 Templating.Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER}
870 ${data}= Templating.Apply Template sdc ${SDC_USER_REMARKS_TEMPLATE} ${map}
871 ${resp}= SDC.Run Post Request ${SDC_BE_ENDPOINT} ${SDC_CATALOG_SERVICES_PATH}/${catalog_service_id}${SDC_CATALOG_SERVICE_DISTRIBUTION_STATE_PATH}${SDC_DISTRIBUTION_STATE_APPROVE_PATH} ${data} ${SDC_GOVERNOR_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
872 Should Be Equal As Strings ${resp.status_code} 200
873 [Return] ${resp.json()}
874
875Distribute SDC Catalog Service
876 [Documentation] distribute an SDC Catalog Service by its id
877 [Arguments] ${catalog_service_id}
878 ${resp}= SDC.Run Post Request ${SDC_BE_ENDPOINT} ${SDC_CATALOG_SERVICES_PATH}/${catalog_service_id}${SDC_CATALOG_SERVICE_DISTRIBUTION_ACTIVATE_PATH} ${None} ${SDC_OPS_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
879 Should Be Equal As Strings ${resp.status_code} 200
880 [Return] ${resp.json()}
881
882Add SDC Resource Instance
883 [Documentation] Creates an SDC Resource Instance and returns its id
884 [Arguments] ${catalog_service_id} ${catalog_resource_id} ${catalog_resource_name} ${xoffset}=${0} ${yoffset}=${0} ${resourceType}=VF
885 ${milli_timestamp}= Generate Timestamp
886 ${xoffset}= Set Variable ${xoffset+306}
887 ${yoffset}= Set Variable ${yoffset+248}
888 ${map}= Create Dictionary catalog_resource_id=${catalog_resource_id} catalog_resource_name=${catalog_resource_name} milli_timestamp=${milli_timestamp} posX=${xoffset} posY=${yoffset} originType=${resourceType}
889 Templating.Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER}
890 ${data}= Templating.Apply Template sdc ${SDC_RESOURCE_INSTANCE_TEMPLATE} ${map}
891 ${resp}= SDC.Run Post Request ${SDC_BE_ENDPOINT} ${SDC_CATALOG_SERVICES_PATH}/${catalog_service_id}${SDC_CATALOG_SERVICE_RESOURCE_INSTANCE_PATH} ${data} ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
892 Should Be Equal As Strings ${resp.status_code} 201
893 [Return] ${resp.json()['uniqueId']}
894
895Add SDC Resource Instance To Resource
896 [Documentation] Creates an SDC Resource Instance in a Resource (VF) and returns its id
897 [Arguments] ${parent_catalog_resource_id} ${catalog_resource_id} ${catalog_resource_name} ${xoffset}=${0} ${yoffset}=${0} ${resourceType}=VF
898 ${milli_timestamp}= Generate Timestamp
899 ${xoffset}= Set Variable ${xoffset+306}
900 ${yoffset}= Set Variable ${yoffset+248}
901 ${map}= Create Dictionary catalog_resource_id=${catalog_resource_id} catalog_resource_name=${catalog_resource_name} milli_timestamp=${milli_timestamp} posX=${xoffset} posY=${yoffset} originType=${resourceType}
902 Templating.Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER}
903 ${data}= Templating.Apply Template sdc ${SDC_RESOURCE_INSTANCE_TEMPLATE} ${map}
904 ${resp}= SDC.Run Post Request ${SDC_BE_ENDPOINT} ${SDC_CATALOG_RESOURCES_PATH}/${parent_catalog_resource_id}${SDC_CATALOG_SERVICE_RESOURCE_INSTANCE_PATH} ${data} ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
905 Should Be Equal As Strings ${resp.status_code} 201
906 [Return] ${resp.json()['uniqueId']}
907
908Get Catalog Service Distribution
909 [Documentation] Gets an SDC Catalog Service distribution
910 [Arguments] ${catalog_service_uuid}
911 ${resp}= SDC.Run Get Request ${SDC_BE_ENDPOINT} ${SDC_CATALOG_SERVICES_PATH}/${catalog_service_uuid}${SDC_CATALOG_SERVICE_DISTRIBUTION_PATH} ${SDC_OPS_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
912 Should Be Equal As Strings ${resp.status_code} 200
913 [Return] ${resp.json()}
914
915Check Catalog Service Distributed
916 [Documentation] Checks if an SDC Catalog Service is distributed
917 [Arguments] ${catalog_service_uuid} ${dist_status}
918 ${dist_resp}= Get Catalog Service Distribution ${catalog_service_uuid}
919 Should Be Equal As Strings ${dist_resp['distributionStatusOfServiceList'][0]['deployementStatus']} Distributed
920 ${det_resp}= Get Catalog Service Distribution Details ${dist_resp['distributionStatusOfServiceList'][0]['distributionID']}
921 @{ITEMS}= Copy List ${det_resp['distributionStatusList']}
922 Should Not Be Empty ${ITEMS}
923 ${SO_COMPLETE} Set Variable FALSE
924 ${dist_status} Set Variable CONTINUE
925 Should Not Be Empty ${ITEMS}
926 :FOR ${ELEMENT} IN @{ITEMS}
927 \ Log ${ELEMENT['omfComponentID']}
928 \ Log ${ELEMENT['status']}
929 \ ${SO_COMPLETE} Set Variable If (('${ELEMENT['status']}' == 'DISTRIBUTION_COMPLETE_OK')) or ('${SO_COMPLETE}'=='TRUE') TRUE
930 \ Exit For Loop If ('${SO_COMPLETE}'=='TRUE')
931 \ Exit For Loop If ('${ELEMENT['status']}' == 'DISTRIBUTION_COMPLETE_ERROR')
932 \ ${dist_status}= Set Variable If (('${ELEMENT['status']}' == 'COMPONENT_DONE_ERROR') and ('${ELEMENT['omfComponentID']}' == 'aai-ml')) EXIT
933 \ Exit For Loop If (('${ELEMENT['status']}' == 'COMPONENT_DONE_ERROR') and ('${ELEMENT['omfComponentID']}' == 'aai-ml'))
934 Should Be True ( '${SO_COMPLETE}'=='TRUE') SO Test
935
936Get Catalog Service Distribution Details
937 [Documentation] Gets SDC Catalog Service distribution details
938 [Arguments] ${catalog_service_distribution_id}
939 ${resp}= SDC.Run Get Request ${SDC_BE_ENDPOINT} ${SDC_CATALOG_SERVICES_PATH}${SDC_CATALOG_SERVICE_DISTRIBUTION_PATH}/${catalog_service_distribution_id} ${SDC_OPS_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
940 Should Be Equal As Strings ${resp.status_code} 200
941 [Return] ${resp.json()}
942
943Run SDC Health Check
944 [Documentation] Runs a SDC health check
945 ${resp}= SDC.Run Get Request ${SDC_FE_ENDPOINT} ${SDC_HEALTH_CHECK_PATH} user=${None}
946 # only test for HTTP 200 to determine SDC Health. SDC_DE_HEALTH is informational
947 Should Be Equal As Strings ${resp.status_code} 200 SDC DOWN
948 ${SDC_DE_HEALTH}= Catenate DOWN
949 @{ITEMS}= Copy List ${resp.json()['componentsInfo']}
950 :FOR ${ELEMENT} IN @{ITEMS}
951 \ Log ${ELEMENT['healthCheckStatus']}
952 \ ${SDC_DE_HEALTH} Set Variable If (('DE' in '${ELEMENT['healthCheckComponent']}') and ('${ELEMENT['healthCheckStatus']}' == 'UP')) or ('${SDC_DE_HEALTH}'=='UP') UP
DR695Hf23314c2019-08-19 10:39:16 -0400953 Log (DMaaP:${SDC_DE_HEALTH}) console=True
DR695Hc0cf6a42019-07-26 16:42:36 -0400954
955Open SDC GUI
956 [Documentation] Logs in to SDC GUI
957 [Arguments] ${PATH}
958 ## Setup Browever now being managed by the test case
959 ##Setup Browser
960 Go To ${SDC_FE_ENDPOINT}${PATH}
961 Maximize Browser Window
962
963 Set Browser Implicit Wait ${GLOBAL_SELENIUM_BROWSER_IMPLICIT_WAIT}
964 Log Logging in to ${SDC_FE_ENDPOINT}${PATH}
965 Title Should Be SDC
966 Wait Until Page Contains Element xpath=//div/a[text()='SDC'] ${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT}
967 Log Logged in to ${SDC_FE_ENDPOINT}${PATH}
968
969
970Create Multi Part
971 [Arguments] ${addTo} ${partName} ${filePath} ${contentType}=${None}
972 ${fileData}= Get Binary File ${filePath}
973 ${fileDir} ${fileName}= Split Path ${filePath}
974 ${partData}= Create List ${fileName} ${fileData} ${contentType}
975 Set To Dictionary ${addTo} ${partName}=${partData}
976
977
Abdelmuhaimen Seaudi498057b2019-08-02 18:36:00 +0000978Add CDS Parameters
979 [Arguments] ${catalog_service_name}
DR695Hc0cf6a42019-07-26 16:42:36 -0400980 ${resp}= SDC.Run Get Request ${SDC_BE_ENDPOINT} ${SDC_CATALOG_SERVICES_PATH}/serviceName/${catalog_service_name}/serviceVersion/0.1 ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
DR695Hc0cf6a42019-07-26 16:42:36 -0400981 ${service_uuid}= Set Variable ${resp.json()['uniqueId']}
982 ${component_uuid}= Set Variable ${resp.json()['componentInstances'][0]['uniqueId']}
Abdelmuhaimen Seaudi498057b2019-08-02 18:36:00 +0000983 ${skip_post_instatiation}= Set Variable If '${catalog_service_name}' == "demoVLB_CDS" false true
DR695Hc0cf6a42019-07-26 16:42:36 -0400984 @{inputs}= Copy List ${resp.json()['componentInstances'][0]['inputs']}
985 :FOR ${input} IN @{inputs}
Abdelmuhaimen Seaudi498057b2019-08-02 18:36:00 +0000986 \ Run Keyword If '${input['name']}' == "sdnc_artifact_name" Set Input Parameter ${service_uuid} ${component_uuid} ${input} string vnf
DR695H0ccf9e32019-08-06 17:28:56 -0400987 ... ELSE IF '${input['name']}' == "sdnc_model_name" Set Input Parameter ${service_uuid} ${component_uuid} ${input} string vlb_cds_test
988 ... ELSE IF '${input['name']}' == "sdnc_model_version" Set Input Parameter ${service_uuid} ${component_uuid} ${input} string 1.0.0
989 ... ELSE IF '${input['name']}' == "skip_post_instantiation_configuration" Set Input Parameter ${service_uuid} ${component_uuid} ${input} boolean ${skip_post_instatiation}
Abdelmuhaimen Seaudi498057b2019-08-02 18:36:00 +0000990
DR695Hc0cf6a42019-07-26 16:42:36 -0400991
Abdelmuhaimen Seaudi498057b2019-08-02 18:36:00 +0000992Set Input Parameter
993 [Arguments] ${service_uuid} ${component_uuid} ${input} ${input_type} ${input_value}
krzysztof kuzmickidadd0e62019-07-31 20:08:36 +0200994 ${resp}= SDC.Run Post Request ${SDC_BE_ENDPOINT} ${SDC_CATALOG_SERVICES_PATH}/${service_uuid}/resourceInstance/${component_uuid}/inputs {"constraints":[],"name":"${input['name']}","parentUniqueId":"${input['parentUniqueId']}","password":false,"required":false,"schema":{"property":{}},"type":"${input_type}","uniqueId":"${input['uniqueId']}","value":"${input_value}","definition":false,"toscaPresentation":{"ownerId":"${input['ownerId']}"}} ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
DR695Hc0cf6a42019-07-26 16:42:36 -0400995 Should Be Equal As Strings ${resp.status_code} 200
krzysztof kuzmickidadd0e62019-07-31 20:08:36 +0200996
997
998Get Service Model Parameter from SDC Service Catalog
999 [Documentation] Returns Service Model UUID
1000 [Arguments] ${service_name} ${parameter_name}
1001 ${resp}= SDC.Run Get Request ${SDC_BE_ENDPOINT} ${SDC_CATALOG_SERVICES_PATH}/serviceName/${service_name}/serviceVersion/1.0 ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
1002 ${json_resp}= Set Variable ${resp.json()}
1003 ${parameter_value}= Set Variable ${json_resp["${parameter_name}"]}
Abdelmuhaimen Seaudi498057b2019-08-02 18:36:00 +00001004 [Return] ${parameter_value}