blob: 67987ed239096144219636df1faa95c8600ea150 [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
DR695Hc0cf6a42019-07-26 16:42:36 -040021${SDC_HEALTH_CHECK_PATH} /sdc1/rest/healthCheck
22${SDC_VENDOR_LICENSE_MODEL_PATH} /onboarding-api/v1.0/vendor-license-models
23${SDC_VENDOR_SOFTWARE_PRODUCT_PATH} /onboarding-api/v1.0/vendor-software-products
24${SDC_VENDOR_KEY_GROUP_PATH} /license-key-groups
25${SDC_VENDOR_ENTITLEMENT_POOL_PATH} /entitlement-pools
26${SDC_VENDOR_FEATURE_GROUP_PATH} /feature-groups
27${SDC_VENDOR_LICENSE_AGREEMENT_PATH} /license-agreements
28${SDC_VENDOR_ACTIONS_PATH} /actions
29${SDC_VENDOR_SOFTWARE_UPLOAD_PATH} /orchestration-template-candidate
30${SDC_FE_CATALOG_RESOURCES_PATH} /sdc1/feProxy/rest/v1/catalog/resources
31${SDC_FE_CATALOG_SERVICES_PATH} /sdc1/feProxy/rest/v1/catalog/services
32${SDC_CATALOG_RESOURCES_PATH} /sdc2/rest/v1/catalog/resources
33${SDC_CATALOG_SERVICES_PATH} /sdc2/rest/v1/catalog/services
34${SDC_CATALOG_INACTIVE_RESOURCES_PATH} /sdc2/rest/v1/inactiveComponents/resource
35${SDC_CATALOG_RESOURCES_QUERY_PATH} /sdc2/rest/v1/catalog/resources/resourceName
36${SDC_CATALOG_INACTIVE_SERVICES_PATH} /sdc2/rest/v1/inactiveComponents/service
37${SDC_CATALOG_LIFECYCLE_PATH} /lifecycleState
38${SDC_CATALOG_SERVICE_RESOURCE_INSTANCE_PATH} /resourceInstance
39${SDC_CATALOG_SERVICE_RESOURCE_ARTIFACT_PATH} /artifacts
40${SDC_CATALOG_SERVICE_DISTRIBUTION_STATE_PATH} /distribution-state
41${SDC_CATALOG_SERVICE_DISTRIBUTION_PATH} /distribution
42${SDC_DISTRIBUTION_STATE_APPROVE_PATH} /approve
43${SDC_CATALOG_SERVICE_DISTRIBUTION_ACTIVATE_PATH} /distribution/PROD/activate
44${SDC_LICENSE_MODEL_TEMPLATE} sdc/license_model.jinja
45${SDC_KEY_GROUP_TEMPLATE} sdc/key_group.jinja
46${SDC_ENTITLEMENT_POOL_TEMPLATE} sdc/entitlement_pool.jinja
47${SDC_FEATURE_GROUP_TEMPLATE} sdc/feature_group.jinja
48${SDC_LICENSE_AGREEMENT_TEMPLATE} sdc/license_agreement.jinja
49${SDC_ACTION_TEMPLATE} sdc/action.jinja
50${SDC_SOFTWARE_PRODUCT_TEMPLATE} sdc/software_product.jinja
51${SDC_ARTIFACT_UPLOAD_TEMPLATE} sdc/artifact_upload.jinja
52${SDC_CATALOG_RESOURCE_TEMPLATE} sdc/catalog_resource.jinja
53${SDC_USER_REMARKS_TEMPLATE} sdc/user_remarks.jinja
54${SDC_CATALOG_SERVICE_TEMPLATE} sdc/catalog_service.jinja
55${SDC_RESOURCE_INSTANCE_TEMPLATE} sdc/resource_instance.jinja
56${SDC_RESOURCE_INSTANCE_VNF_PROPERTIES_TEMPLATE} sdc/catalog_vnf_properties.jinja
57${SDC_RESOURCE_INSTANCE_VNF_INPUTS_TEMPLATE} sdc/catalog_vnf_inputs.jinja
58${SDC_CATALOG_NET_RESOURCE_INPUT_TEMPLATE} sdc/catalog_net_input_properties.jinja
59${SDC_ALLOTTED_RESOURCE_CATALOG_RESOURCE_TEMPLATE} sdc/catalog_resource_alloted_resource.jinja
60${SDC_CATALOG_ALLOTTED_RESOURCE_PROPERTIES_TEMPLATE} sdc/catalog_allotted_properties.jinja
61${SDC_CATALOG_ALLOTTED_RESOURCE_INPUTS_TEMPLATE} sdc/catalog_allotted_inputs.jinja
kaihlavia724b232019-08-07 12:37:17 +030062${SDC_CATALOG_SERVICE_MONITORING_TEMPLATE} sdc/catalog_service_monitoring.jinja
63${SDC_DCAE_COMPONENT_MICROSERVICE_TEMPLATE} sdc/dcae_component_microservice.jinja
DR695Hc0cf6a42019-07-26 16:42:36 -040064${SDC_CATALOG_DEPLOYMENT_ARTIFACT_PATH} robot/assets/sdc/blueprints/
65${SDC_FE_ENDPOINT} ${GLOBAL_SDC_SERVER_PROTOCOL}://${GLOBAL_INJECTED_SDC_FE_IP_ADDR}:${GLOBAL_SDC_FE_PORT}
66${SDC_BE_ENDPOINT} ${GLOBAL_SDC_SERVER_PROTOCOL}://${GLOBAL_INJECTED_SDC_BE_IP_ADDR}:${GLOBAL_SDC_BE_PORT}
67${SDC_BE_ONBOARD_ENDPOINT} ${GLOBAL_SDC_SERVER_PROTOCOL}://${GLOBAL_INJECTED_SDC_BE_ONBOARD_IP_ADDR}:${GLOBAL_SDC_BE_ONBOARD_PORT}
68
69*** Keywords ***
70Distribute Model From SDC
krzysztof kuzmickidadd0e62019-07-31 20:08:36 +020071 [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
72 [Arguments] ${model_zip_path} ${catalog_service_name}= ${cds}=False ${service}= ${instantiationType}=A-la-carte ${resourceType}=VF
Brian Freeman026df1b2019-12-05 16:21:20 -050073 # add logic to handle service name already exists
74 ${status} ${catalog_service_id}= Run Keyword And Ignore Error Add SDC Catalog Service ${catalog_service_name} ${instantiationType}
75 Return From Keyword If '${status}' == 'FAIL'
DR695Hc0cf6a42019-07-26 16:42:36 -040076 ${catalog_resource_ids}= Create List
77 ${catalog_resources}= Create Dictionary
78 ##### TODO: Support for Multiple resources of one type in a service ######
79 # The zip list is the resources - no mechanism to indicate more than 1 of the items in the zip list
80 # Get Service Vnf Mapping has the logical mapping but it is not the same key as model_zip_path
81 # ${vnflist}= Get Service Vnf Mapping alias ${service}
82 # Save the resource_id in a dictionary keyed by the resource name in the zipfile name (vFWDT_vFWSNK.zip or vFWDT_vPKG.zip)
83 # Create the resources but do not immediately add resource
84 # Add Resource to Service in a separate FOR loop
85 ${resource_types}= Create Dictionary
86
87 :FOR ${zip} IN @{model_zip_path}
krzysztof kuzmickidadd0e62019-07-31 20:08:36 +020088 \ ${loop_catalog_resource_id}= Setup SDC Catalog Resource ${zip} ${cds} ${resourceType}
DR695Hc0cf6a42019-07-26 16:42:36 -040089 # zip can be vFW.zip or vFWDT_VFWSNK.zip
krzysztof kuzmickidadd0e62019-07-31 20:08:36 +020090 \ ${resource_type_match}= Run Keyword If "${resourceType}"=='PNF' Get Regexp Matches ${zip} ${service}_(.*)\.csar 1
DR695Hfacbc292019-08-07 11:15:46 -040091 ... ELSE Get Regexp Matches ${zip} ${service}_(.*)\.zip 1
DR695Hc0cf6a42019-07-26 16:42:36 -040092 # Need to be able to distribute preload for vFWCL vFWSNK and vFWDT vFWSNK to prepend service to vnf_type
93 \ ${resource_type_string}= Set Variable If len(${resource_type_match})==0 ${service} ${service}${resource_type_match[0]}
94 \ Set To Dictionary ${resource_types} ${resource_type_string} ${loop_catalog_resource_id}
95 \ Append To List ${catalog_resource_ids} ${loop_catalog_resource_id}
96
97 ServiceMapping.Set Directory default ${GLOBAL_SERVICE_MAPPING_DIRECTORY}
98 ${vnflist}= ServiceMapping.Get Service Vnf Mapping default ${service}
99
100 # Spread the icons on the pallette starting on the left
101 ${xoffset}= Set Variable ${0}
102
103 :FOR ${vnf} IN @{vnflist}
104 \ ${loop_catalog_resource_resp}= Get SDC Catalog Resource ${resource_types['${vnf}']}
105 \ Set To Dictionary ${catalog_resources} ${resource_types['${vnf}']}=${loop_catalog_resource_resp}
kaihlavia724b232019-08-07 12:37:17 +0300106 \ ${catalog_resource_unique_name} ${catalog_resource_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 -0400107 \ ${xoffset}= Set Variable ${xoffset+100}
108 #
109 # do this here because the loop_catalog_resource_resp is different format after adding networks
krzysztof kuzmickidadd0e62019-07-31 20:08:36 +0200110 ${vf_module}= Run Keyword If "${resourceType}"=='PNF' Set Variable It is PNF
111 ... ELSE Find Element In Array ${loop_catalog_resource_resp['groups']} type org.openecomp.groups.VfModule
DR695Hc0cf6a42019-07-26 16:42:36 -0400112 #
113 # do network
114 ${networklist}= ServiceMapping.Get Service Neutron Mapping default ${service}
115 ${generic_neutron_net_uuid}= Get Generic NeutronNet UUID
116 :FOR ${network} IN @{networklist}
117 \ ${loop_catalog_resource_id}= Set Variable ${generic_neutron_net_uuid}
118 \ Append To List ${catalog_resource_ids} ${loop_catalog_resource_id}
119 \ ${loop_catalog_resource_resp}= Get SDC Catalog Resource ${loop_catalog_resource_id}
kaihlavia724b232019-08-07 12:37:17 +0300120 \ ${loop_catalog_resource_id} ${loop_catalog_resource_name} Add SDC Resource Instance ${catalog_service_id} ${loop_catalog_resource_id} ${network} ${xoffset} ${0} VL
DR695Hc0cf6a42019-07-26 16:42:36 -0400121 \ ${nf_role}= Convert To Lowercase ${network}
122 \ Setup SDC Catalog Resource GenericNeutronNet Properties ${catalog_service_id} ${nf_role} ${loop_catalog_resource_id}
123 \ ${xoffset}= Set Variable ${xoffset+100}
124 \ Set To Dictionary ${catalog_resources} ${loop_catalog_resource_id}=${loop_catalog_resource_resp}
125 ${catalog_service_resp}= Get SDC Catalog Service ${catalog_service_id}
126 #
127 # do deployment artifacts
128 #
129 ${deploymentlist}= ServiceMapping.Get Service Deployment Artifact Mapping default ${service}
130 :FOR ${deployment} IN @{deploymentlist}
131 \ ${loop_catalog_resource_resp}= Get SDC Catalog Resource ${loop_catalog_resource_id}
132 \ Setup SDC Catalog Resource Deployment Artifact Properties ${catalog_service_id} ${loop_catalog_resource_resp} ${catalog_resource_unique_name} ${deployment}
133 Run Keyword If ${cds} == True Add CDS Parameters ${catalog_service_name}
134 Checkin SDC Catalog Service ${catalog_service_id}
DR695Hc0cf6a42019-07-26 16:42:36 -0400135 # on certify it gets a new id
136 ${catalog_service_id}= Certify SDC Catalog Service ${catalog_service_id}
DR695Hc0cf6a42019-07-26 16:42:36 -0400137 :FOR ${DIST_INDEX} IN RANGE 1
138 \ Log Distribution Attempt ${DIST_INDEX}
139 \ Distribute SDC Catalog Service ${catalog_service_id}
140 \ ${catalog_service_resp}= Get SDC Catalog Service ${catalog_service_id}
141 \ ${status} ${_} = Run Keyword And Ignore Error Loop Over Check Catalog Service Distributed ${catalog_service_resp['uuid']}
142 \ Exit For Loop If '${status}'=='PASS'
143 Should Be Equal As Strings ${status} PASS
144 [Return] ${catalog_service_resp['name']} ${loop_catalog_resource_resp['name']} ${vf_module} ${catalog_resource_ids} ${catalog_service_id} ${catalog_resources}
145
146Distribute vCPEResCust Model From SDC
147 [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
148 [Arguments] ${model_zip_path} ${catalog_service_name}= ${cds}= ${service}=
149 # For testing use random service name
150 #${random}= Get Current Date
151 ${uuid}= Generate UUID4
152 ${random}= Evaluate str("${uuid}")[:4]
153 ${catalog_service_id}= Add SDC Catalog Service ${catalog_service_name}_${random}
154 # catalog_service_name already
155 #${catalog_service_id}= Add SDC Catalog Service ${catalog_service_name}
156 Log ${\n}ServiceName: ${catalog_service_name}_${random}
157 #${catalog_service_id}= Add SDC Catalog Service ${catalog_service_name}
158 ${catalog_resource_ids}= Create List
159 ${catalog_resources}= Create Dictionary
160 :FOR ${zip} IN @{model_zip_path}
161 \ ${loop_catalog_resource_id}= Setup SDC Catalog Resource ${zip} ${cds}
162 \ Append To List ${catalog_resource_ids} ${loop_catalog_resource_id}
163 \ ${loop_catalog_resource_resp}= Get SDC Catalog Resource ${loop_catalog_resource_id}
164 \ Add SDC Resource Instance ${catalog_service_id} ${loop_catalog_resource_id} ${loop_catalog_resource_resp['name']}
165 \ Set To Dictionary ${catalog_resources} ${loop_catalog_resource_id}=${loop_catalog_resource_resp}
166 #
167 # do this here because the loop_catalog_resource_resp is different format after adding networks
168 ${vf_module}= Find Element In Array ${loop_catalog_resource_resp['groups']} type org.openecomp.groups.VfModule
169 #
170 # do allottedresource
171 ${allottedresource_list}= Create List TunnelXConn BRG
172 # Example data
173 #${tunnelxconn_dict}= Create Dictionary invariantUUID=8ac029e7-77aa-40d4-b28a-d17c02d5fd82 UUID=2ddc1b37-d7da-4aab-b645-ed7db34a5d03 node_type=org.openecomp.service.Demovcpevgmux
174 #${brg_dict}= Create Dictionary invariantUUID=ff0337b9-dbe2-4d88-bb74-18bf027ae586 UUID=1b6974f1-4aed-47f4-b962-816aa1261927 node_type=org.openecomp.service.Demovcpevbrgemu
175 # Create /tmp/vcpe_allotted_resource_data.json with demo vgmux and brgemu CSARs
176 Create Allotted Resource Data File
DR695H7cf5e642019-08-21 16:57:54 -0400177 ${vcpe_ar_data_string} OperatingSystem.Get File /tmp/vcpe_allotted_resource_data.json
178 ${vcpe_ar_data_file}= Evaluate json.loads('''${vcpe_ar_data_string}''') json
179 ${tunnelxconn_invariant_uuid}= Catenate ${vcpe_ar_data_file['tunnelxconn']['invariantUUID']}
180 ${tunnelxconn_uuid}= Catenate ${vcpe_ar_data_file['tunnelxconn']['UUID']}
181 ${tunnelxconn_node_type}= Catenate ${vcpe_ar_data_file['tunnelxconn']['node_type']}
182 ${brg_invariant_uuid}= Catenate ${vcpe_ar_data_file['brg']['invariantUUID']}
183 ${brg_uuid}= Catenate ${vcpe_ar_data_file['brg']['UUID']}
184 ${brg_node_type}= Catenate ${vcpe_ar_data_file['brg']['node_type']}
DR695Hc0cf6a42019-07-26 16:42:36 -0400185 ${tunnelxconn_dict}= Create Dictionary invariantUUID=${tunnelxconn_invariant_uuid} UUID=${tunnelxconn_uuid} node_type=${tunnelxconn_node_type}
186 ${brg_dict}= Create Dictionary invariantUUID=${brg_invariant_uuid} UUID=${brg_uuid} node_type=${brg_node_type}
187 ${xoffset}= Set Variable ${100}
188 ${allottedresource_uuid}= Get AllottedResource UUID
189 ${random}= Get Current Date
190 :FOR ${allottedresource} IN @{allottedresource_list}
191 \ ${loop_catalog_resource_id}= Set Variable ${allottedresource_uuid}
192 \ Append To List ${catalog_resource_ids} ${loop_catalog_resource_id}
193 \ ${loop_catalog_resource_id}= Add SDC Allotted Resource Catalog Resource 00000 ${allottedresource}_${random} ONAP ${loop_catalog_resource_id} ${allottedresource}
194 \ ${loop_catalog_resource_id2}= Add SDC Resource Instance To Resource ${loop_catalog_resource_id} ${allottedresource_uuid} ${allottedresource} ${xoffset} ${0}
195 \ ${loop_catalog_resource_resp}= Get SDC Catalog Resource ${loop_catalog_resource_id}
196 #
197 # Set the properties to relate to the brg and gmux
198 #
199 \ 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']}
200 \ 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']}
201 #
202 # Set the nf_role nf_type
203 #
204 \ Run Keyword If '${allottedresource}'=='TunnelXConn' Setup SDC Catalog Resource AllottedResource Inputs ${catalog_service_id} ${allottedresource} ${loop_catalog_resource_id}
205 \ Run Keyword If '${allottedresource}'=='BRG' Setup SDC Catalog Resource AllottedResource Inputs ${catalog_service_id} ${allottedresource} ${loop_catalog_resource_id}
kaihlavia724b232019-08-07 12:37:17 +0300206 \ ${loop_catalog_resource_id} ${loop_catalog_resource_uuid} Certify SDC Catalog Resource ${loop_catalog_resource_id} ${SDC_DESIGNER_USER_ID}
DR695Hc0cf6a42019-07-26 16:42:36 -0400207 \ Add SDC Resource Instance ${catalog_service_id} ${loop_catalog_resource_id} ${loop_catalog_resource_resp['name']}
208 \ Set To Dictionary ${catalog_resources} ${loop_catalog_resource_id}=${loop_catalog_resource_resp}
209 ${catalog_service_resp}= Get SDC Catalog Service ${catalog_service_id}
210 Checkin SDC Catalog Service ${catalog_service_id}
DR695Hc0cf6a42019-07-26 16:42:36 -0400211 # on certify it gets a new id
212 ${catalog_service_id}= Certify SDC Catalog Service ${catalog_service_id}
DR695Hc0cf6a42019-07-26 16:42:36 -0400213 :FOR ${DIST_INDEX} IN RANGE 1
214 \ Log Distribution Attempt ${DIST_INDEX}
215 \ Distribute SDC Catalog Service ${catalog_service_id}
216 \ ${catalog_service_resp}= Get SDC Catalog Service ${catalog_service_id}
217 \ ${status} ${_} = Run Keyword And Ignore Error Loop Over Check Catalog Service Distributed ${catalog_service_resp['uuid']}
218 \ Exit For Loop If '${status}'=='PASS'
219 Should Be Equal As Strings ${status} PASS
220 [Return] ${catalog_service_resp['name']} ${loop_catalog_resource_resp['name']} ${vf_module} ${catalog_resource_ids} ${catalog_service_id} ${catalog_resources}
221
222
223Create Allotted Resource Data File
224 [Documentation] Create Allotted Resource json data file
225 ${allotted_resource}= Create Dictionary
226 ${allotted_csar_map}= Create Dictionary
227 Set To Dictionary ${allotted_csar_map} tunnelxconn=service-Demovcpevgmux-csar.csar
228 Set To Dictionary ${allotted_csar_map} brg=service-Demovcpevbrgemu-csar.csar
229 ${keys}= Get Dictionary Keys ${allotted_csar_map}
230 :FOR ${key} IN @{keys}
231 \ ${csar}= Get From Dictionary ${allotted_csar_map} ${key}
232 \ ${dir} ${ext}= Split String From Right ${csar} - 1
233 \ Extract Zip File /tmp/csar/${csar} /tmp/csar/${dir}
234 \ ${template}= Catenate /tmp/csar/${dir}/Definitions/${dir}-template.yml
235 \ ${json_str}= Template Yaml To Json ${template}
236 \ ${json_obj}= To Json ${json_str}
237 \ ${attrs}= Create Dictionary
238 \ Set To Dictionary ${attrs} invariantUUID=${json_obj['metadata']['invariantUUID']}
239 \ Set To Dictionary ${attrs} UUID=${json_obj['metadata']['UUID']}
240 \ Set To Dictionary ${attrs} node_type=${json_obj['topology_template']['substitution_mappings']['node_type']}
241 \ Set To Dictionary ${allotted_resource} ${key}=${attrs}
242 ${result_str}= Evaluate json.dumps(${allotted_resource}, indent=2) json
243 Log ${result_str}
244 Create File /tmp/vcpe_allotted_resource_data.json ${result_str}
245
246Download CSAR
247 [Documentation] Download CSAR
248 [Arguments] ${catalog_service_id} ${save_directory}=/tmp/csar
Brian Freeman026df1b2019-12-05 16:21:20 -0500249 Return From Keyword If '${catalog_service_id}'=='None'
DR695Hc0cf6a42019-07-26 16:42:36 -0400250 # get meta data
251 ${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}
252 ${csar_resource_id}= Set Variable ${resp.json()['toscaArtifacts']['assettoscacsar']['uniqueId']}
253 ${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}
254 ${csar_file_name}= Set Variable ${resp.json()['artifactName']}
255 ${base64Obj}= Set Variable ${resp.json()['base64Contents']}
256 ${binObj}= Base64 Decode ${base64Obj}
257 Create Binary File ${save_directory}/${csar_file_name} ${binObj}
258 Log ${\n}Downloaded:${csar_file_name}
259
260
261Get Generic NeutronNet UUID
262 [Documentation] Look up the UUID of the Generic NeutronNetwork Resource
263 ${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}
264 [Return] ${resp.json()['allVersions']['1.0']}
265
266Get AllottedResource UUID
267 [Documentation] Look up the UUID of the Allotted Resource
268 # if this fails then the AllottedResource template got deleted from SDC by mistake
269 ${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}
270 [Return] ${resp.json()['allVersions']['1.0']}
271
272Loop Over Check Catalog Service Distributed
273 [Arguments] ${catalog_service_id}
274 # SO watchdog timeout is 300 seconds need buffer
275 ${dist_status}= Set Variable CONTINUE
276 :FOR ${CHECK_INDEX} IN RANGE 20
277 \ ${status} ${_} = Run Keyword And Ignore Error Check Catalog Service Distributed ${catalog_service_id} ${dist_status}
278 \ Sleep 20s
279 \ Return From Keyword If '${status}'=='PASS'
280 # need a way to exit the loop early on DISTRIBUTION_COMPLETE_ERROR ${dist_status} doesnt work
281 #\ Exit For Loop If '${dist_status}'=='EXIT'
282 Should Be Equal As Strings ${status} PASS
283
284Setup SDC Catalog Resource
krzysztof kuzmickidadd0e62019-07-31 20:08:36 +0200285 [Documentation] Creates all the steps a VF/PNF needs for an SDC Catalog Resource and returns the id
286 [Arguments] ${model_zip_path} ${cds}=None ${resourceType}=VF
DR695Hc0cf6a42019-07-26 16:42:36 -0400287 ${license_model_id} ${license_model_version_id}= Add SDC License Model
288
289
290 ${license_temp_date}= Get Current Date
291 ${license_start_date}= Get Current Date result_format=%m/%d/%Y
292 ${license_end_date}= Add Time To Date ${license_temp_date} 365 days result_format=%m/%d/%Y
293 ${key_group_id}= Add SDC License Group ${license_model_id} ${license_model_version_id} ${license_start_date} ${license_end_date}
294 ${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 -0400295 ${feature_group_id}= Add SDC Feature Group ${license_model_id} ${key_group_id} ${pool_id} ${license_model_version_id}
296 ${license_agreement_id}= Add SDC License Agreement ${license_model_id} ${feature_group_id} ${license_model_version_id}
297 Submit SDC License Model ${license_model_id} ${license_model_version_id}
298 ${license_model_resp}= Get SDC License Model ${license_model_id} ${license_model_version_id}
krzysztof kuzmickidadd0e62019-07-31 20:08:36 +0200299 ${matches}= Run Keyword If '${resourceType}'=='PNF' Get Regexp Matches ${model_zip_path} temp/(.*)\.csar 1
300 ... ELSE Get Regexp Matches ${model_zip_path} temp/(.*)\.zip 1
DR695Hc0cf6a42019-07-26 16:42:36 -0400301 ${software_product_name_prefix}= Set Variable ${matches[0]}
302 ${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}
303 Upload SDC Heat Package ${software_product_id} ${model_zip_path} ${software_product_version_id}
304 Validate SDC Software Product ${software_product_id} ${software_product_version_id}
305 Submit SDC Software Product ${software_product_id} ${software_product_version_id}
306 Package SDC Software Product ${software_product_id} ${software_product_version_id}
307 ${software_product_resp}= Get SDC Software Product ${software_product_id} ${software_product_version_id}
krzysztof kuzmickidadd0e62019-07-31 20:08:36 +0200308 ${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 -0400309 # Check if need to set up CDS properties
310 Run Keyword If '${cds}' == 'vfwng' Setup SDC Catalog Resource CDS Properties ${catalog_resource_id}
311
kaihlavia724b232019-08-07 12:37:17 +0300312 ${catalog_resource_id} ${catalog_resource_uuid} Certify SDC Catalog Resource ${catalog_resource_id} ${SDC_DESIGNER_USER_ID}
DR695Hc0cf6a42019-07-26 16:42:36 -0400313 [Return] ${catalog_resource_id}
314
DR695Hc0cf6a42019-07-26 16:42:36 -0400315Setup SDC Catalog Resource Deployment Artifact Properties
316 [Documentation] Set up Deployment Artiface properties
317 [Arguments] ${catalog_service_id} ${catalog_parent_service_id} ${catalog_resource_unique_id} ${blueprint_file}
318 ${resp}= Get SDC Catalog Resource Component Instances Properties ${catalog_service_id}
319 ${blueprint_data} OperatingSystem.Get File ${SDC_CATALOG_DEPLOYMENT_ARTIFACT_PATH}${blueprint_file}
320 ${payloadData}= Base64 Encode ${blueprint_data}
321 ${dict}= Create Dictionary artifactLabel=blueprint artifactName=${blueprint_file} artifactType=DCAE_INVENTORY_BLUEPRINT artifactGroupType=DEPLOYMENT description=${blueprint_file} payloadData=${payloadData}
322 Templating.Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER}
323 ${data}= Templating.Apply Template sdc ${SDC_ARTIFACT_UPLOAD_TEMPLATE} ${dict}
324 # POST artifactUpload to resource
325 ${artifact_upload_path}= Catenate ${SDC_CATALOG_SERVICES_PATH}/${catalog_service_id}/resourceInstance/${catalog_resource_unique_id}${SDC_CATALOG_SERVICE_RESOURCE_ARTIFACT_PATH}
326 ${resp}= SDC.Run Post Request ${SDC_BE_ENDPOINT} ${artifact_upload_path} ${data} ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
327 Should Be Equal As Strings ${resp.status_code} 200
328 [Return] ${resp}
329
330
331Setup SDC Catalog Resource GenericNeutronNet Properties
332 [Documentation] Set up GenericNeutronNet properties and inputs
333 [Arguments] ${catalog_service_id} ${nf_role} ${catalog_parent_service_id}
334 ${resp}= Get SDC Catalog Resource Component Instances Properties ${catalog_service_id}
335 ${componentInstances} Set Variable @{resp['componentInstancesProperties']}
336 # componentInstances can have 1 or more than 1 entry
337 ${passed}= Run Keyword And Return Status Evaluate type(${componentInstances})
338 ${type}= Run Keyword If ${passed} Evaluate type(${componentInstances})
339 ${componentInstancesList}= Run Keyword If "${type}"!="<type 'list'>" Create List ${componentInstances}
340 ... ELSE Set Variable ${componentInstances}
341 :FOR ${item} IN @{componentInstancesList}
342 \ ${test} ${v}= Run Keyword and Ignore Error Should Contain ${item} ${nf_role}
343 \ Run Keyword If '${test}' == 'FAIL' Continue For Loop
344 \ ${componentInstance1}= Set Variable ${item}
345 :FOR ${comp} IN @{resp['componentInstancesProperties']["${componentInstance1}"]}
346 \ ${name} Set Variable ${comp['name']}
347 \ ${test} ${v}= Run Keyword and Ignore Error Should Contain ${name} network_role
348 \ Run Keyword If '${test}' == 'FAIL' Continue For Loop
349 \ ${description} Set Variable ${comp['description']}
350 \ ${description}= Replace String ${description} ${\n} \
351 \ ${uniqueId} Set Variable ${comp['uniqueId']}
352 \ ${parentUniqueId} Set Variable ${comp['parentUniqueId']}
353 \ ${ownerId} Set Variable ${comp['ownerId']}
354 \ ${dict}= Create Dictionary parentUniqueId=${parentUniqueId} ownerId=${ownerId} uniqueId=${uniqueId} description=${description}
355 \ Run Keyword If '${name}'=='network_role' Set To Dictionary ${dict} name=${name} value=${nf_role}
356 \ Templating.Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER}
357 \ ${data}= Templating.Apply Template sdc ${SDC_CATALOG_NET_RESOURCE_INPUT_TEMPLATE} ${dict}
358 \ ${response}= Set SDC Catalog Resource Component Instance Properties ${catalog_parent_service_id} ${catalog_service_id} ${data}
359
360
361Setup SDC Catalog Resource AllottedResource Properties
362 [Documentation] Set up Allotted Resource properties and inputs
363 [Arguments] ${catalog_service_id} ${nf_role} ${catalog_resource_id} ${invariantUUID} ${UUID} ${node_type}
364 # Set component instances properties
365 ${nf_role_lc}= Convert To Lowercase ${nf_role}
366 ${resp}= Get SDC Catalog Resource Component Instances Properties For Resource ${catalog_resource_id}
367 ${componentInstances} Set Variable @{resp['componentInstancesProperties']}
368 # componentInstances can have 1 or more than 1 entry
369 ${passed}= Run Keyword And Return Status Evaluate type(${componentInstances})
370 ${type}= Run Keyword If ${passed} Evaluate type(${componentInstances})
371 ${componentInstancesList}= Run Keyword If "${type}"!="<type 'list'>" Create List ${componentInstances}
372 ... ELSE Set Variable ${componentInstances}
373 :FOR ${item} IN @{componentInstancesList}
374 \ ${test} ${v}= Run Keyword and Ignore Error Should Contain ${item} ${nf_role_lc}
375 \ Run Keyword If '${test}' == 'FAIL' Continue For Loop
376 \ ${componentInstance1}= Set Variable ${item}
377 ${dict}= Create Dictionary
378 :FOR ${comp} IN @{resp['componentInstancesProperties']["${componentInstance1}"]}
379 \ ${name} Set Variable ${comp['name']}
380 \ ${test} ${v}= Run Keyword and Ignore Error Should Contain Any ${name} network_role providing_service_invariant_uuid providing_service_uuid providing_service_name uniqueId
381 \ Run Keyword If '${test}' == 'FAIL' Continue For Loop
382 \ ${parentUniqueId} Set Variable ${comp['parentUniqueId']}
383 \ ${ownerId} Set Variable ${comp['ownerId']}
384 \ Set To Dictionary ${dict} parentUniqueId=${parentUniqueId} ownerId=${ownerId}
385 \ Run Keyword If '${name}'=='providing_service_invariant_uuid' Set To Dictionary ${dict} providing_service_invariant_uuid=${invariantUUID}
386 \ Run Keyword If '${name}'=='providing_service_uuid' Set To Dictionary ${dict} providing_service_uuid=${UUID}
387 \ Run Keyword If '${name}'=='providing_service_name' Set To Dictionary ${dict} providing_service_name=${node_type}
388 # Sets it for each loop but should be one
389 \ ${uniqueId} Set Variable ${comp['uniqueId']}
390 \ ${uniqueId} Fetch From Left ${uniqueId} .
391 \ Set To Dictionary ${dict} uniqueId=${uniqueId}
392 Templating.Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER}
393 ${data}= Templating.Apply Template sdc ${SDC_CATALOG_ALLOTTED_RESOURCE_PROPERTIES_TEMPLATE} ${dict}
394 ${response}= Set SDC Catalog Resource Component Instance Properties For Resource ${catalog_resource_id} ${componentInstance1} ${data}
395 Log resp=${response}
396
397
398Setup SDC Catalog Resource AllottedResource Inputs
399 [Documentation] Set up Allotted Resource inputs
400 [Arguments] ${catalog_service_id} ${nf_role} ${catalog_resource_id}
401 # Set vnf inputs
402 ${resp}= Get SDC Catalog Resource Inputs ${catalog_resource_id}
403 ${dict}= Create Dictionary
404 :FOR ${comp} IN @{resp['inputs']}
405 \ ${name} Set Variable ${comp['name']}
406 \ ${uid} Set Variable ${comp['uniqueId']}
407 \ Run Keyword If '${name}'=='nf_type' Set To Dictionary ${dict} nf_type=${nf_role} nf_type_uid=${uid}
408 \ Run Keyword If '${name}'=='nf_role' Set To Dictionary ${dict} nf_role=${nf_role} nf_role_uid=${uid}
409 Templating.Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER}
410 ${data}= Templating.Apply Template sdc ${SDC_CATALOG_ALLOTTED_RESOURCE_INPUTS_TEMPLATE} ${dict}
411 ${response}= Set SDC Catalog Resource VNF Inputs ${catalog_resource_id} ${data}
412 [Return] ${response}
413
414Setup SDC Catalog Resource CDS Properties
415 [Documentation] Set up vfwng VNF properties and inputs for CDS
416 [Arguments] ${catalog_resource_id}
417 # Set vnf module properties
418 ${resp}= Get SDC Catalog Resource Component Instances ${catalog_resource_id}
419 :FOR ${comp} IN @{resp['componentInstances']}
420 \ ${name} Set Variable ${comp['name']}
421 \ ${uniqueId} Set Variable ${comp['uniqueId']}
422 \ ${actualComponentUid} Set Variable ${comp['actualComponentUid']}
423 \ ${test} ${v}= Run Keyword and Ignore Error Should Contain ${name} abstract_
424 \ Run Keyword If '${test}' == 'FAIL' Continue For Loop
425 \ ${response}= Get SDC Catalog Resource Component Instance Properties ${catalog_resource_id} ${uniqueId} ${actualComponentUid}
426 \ ${dict}= Create Dictionary parent_id=${response[6]['parentUniqueId']}
427 \ Run Keyword If '${name}'=='abstract_vfw' Set To Dictionary ${dict} nfc_function=vfw nfc_naming_policy=SDNC_Policy.ONAP_VFW_NAMING_TIMESTAMP
428 \ Run Keyword If '${name}'=='abstract_vpg' Set To Dictionary ${dict} nfc_function=vpg nfc_naming_policy=SDNC_Policy.ONAP_VPG_NAMING_TIMESTAMP
429 \ Run Keyword If '${name}'=='abstract_vsn' Set To Dictionary ${dict} nfc_function=vsn nfc_naming_policy=SDNC_Policy.ONAP_VSN_NAMING_TIMESTAMP
430 \ Templating.Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER}
431 \ ${data}= Templating.Apply Template sdc ${SDC_RESOURCE_INSTANCE_VNF_PROPERTIES_TEMPLATE} ${dict}
432 \ ${response}= Set SDC Catalog Resource Component Instance Properties ${catalog_resource_id} ${uniqueId} ${data}
433 \ Log resp=${response}
434
435 # Set vnf inputs
436 ${resp}= Get SDC Catalog Resource Inputs ${catalog_resource_id}
437 ${dict}= Create Dictionary
438 :FOR ${comp} IN @{resp['inputs']}
439 \ ${name} Set Variable ${comp['name']}
440 \ ${uid} Set Variable ${comp['uniqueId']}
441 \ Run Keyword If '${name}'=='nf_function' Set To Dictionary ${dict} nf_function=ONAP-FIREWALL nf_function_uid=${uid}
442 \ Run Keyword If '${name}'=='nf_type' Set To Dictionary ${dict} nf_type=FIREWALL nf_type_uid=${uid}
443 \ Run Keyword If '${name}'=='nf_naming_code' Set To Dictionary ${dict} nf_naming_code=vfw nf_naming_code_uid=${uid}
444 \ Run Keyword If '${name}'=='nf_role' Set To Dictionary ${dict} nf_role=vFW nf_role_uid=${uid}
445 \ Run Keyword If '${name}'=='cloud_env' Set To Dictionary ${dict} cloud_env=openstack cloud_env_uid=${uid}
446 Templating.Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER}
447 ${data}= Templating.Apply Template sdc ${SDC_RESOURCE_INSTANCE_VNF_INPUTS_TEMPLATE} ${dict}
448 ${response}= Set SDC Catalog Resource VNF Inputs ${catalog_resource_id} ${data}
449
450Add SDC License Model
451 [Documentation] Creates an SDC License Model and returns its id
452 ${uuid}= Generate UUID4
453 ${shortened_uuid}= Evaluate str("${uuid}")[:23]
454 ${map}= Create Dictionary vendor_name=${shortened_uuid}
455 Templating.Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER}
456 ${data}= Templating.Apply Template sdc ${SDC_LICENSE_MODEL_TEMPLATE} ${map}
457 ${resp}= SDC.Run Post Request ${SDC_BE_ONBOARD_ENDPOINT} ${SDC_VENDOR_LICENSE_MODEL_PATH} ${data} ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
458 Should Be Equal As Strings ${resp.status_code} 200
459 [Return] ${resp.json()['itemId']} ${resp.json()['version']['id']}
460
461Get SDC License Model
462 [Documentation] gets an SDC license model by its id
463 [Arguments] ${id} ${version_id}=0.1
464 ${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}
465 [Return] ${resp.json()}
466
467Get SDC License Models
468 [Documentation] Gets all SDC License Models
469 ${resp}= SDC.Run Get Request ${SDC_BE_ONBOARD_ENDPOINT} ${SDC_VENDOR_LICENSE_MODEL_PATH} ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
470 [Return] ${resp.json()}
471
472Checkin SDC License Model
473 [Documentation] Checks in an SDC License Model by its id
474 [Arguments] ${id} ${version_id}=0.1
475 ${map}= Create Dictionary action=Checkin
476 Templating.Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER}
477 ${data}= Templating.Apply Template sdc ${SDC_ACTION_TEMPLATE} ${map}
478 ${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}
479 Should Be Equal As Strings ${resp.status_code} 200
480 [Return] ${resp.json()}
481
482Submit SDC License Model
483 [Documentation] Submits an SDC License Model by its id
484 [Arguments] ${id} ${version_id}=0.1
485 ${map}= Create Dictionary action=Submit
486 Templating.Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER}
487 ${data}= Templating.Apply Template sdc ${SDC_ACTION_TEMPLATE} ${map}
488 ${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}
489 [Return] ${resp.json()}
490
491Checkin SDC Software Product
492 [Documentation] Checks in an SDC Software Product by its id
493 [Arguments] ${id} ${version_id}=0.1
494 ${map}= Create Dictionary action=Checkin
495 Templating.Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER}
496 ${data}= Templating.Apply Template sdc ${SDC_ACTION_TEMPLATE} ${map}
497 ${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}
498 Should Be Equal As Strings ${resp.status_code} 200
499 [Return] ${resp.json()}
500
501Validate SDC Software Product
502 [Documentation] Validates an SDC Software Product by its id
503 [Arguments] ${id} ${version_id}=0.1
504 ${data}= Catenate
505 ${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}
506 Should Be Equal As Strings ${resp.status_code} 200
507 [Return] ${resp.json()}
508
509Submit SDC Software Product
510 [Documentation] Submits an SDC Software Product by its id
511 [Arguments] ${id} ${version_id}=0.1
512 ${map}= Create Dictionary action=Submit
513 Templating.Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER}
514 ${data}= Templating.Apply Template sdc ${SDC_ACTION_TEMPLATE} ${map}
515 ${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}
516 Should Be Equal As Strings ${resp.status_code} 200
517 [Return] ${resp.json()}
518
519Package SDC Software Product
520 [Documentation] Creates a package of an SDC Software Product by its id
521 [Arguments] ${id} ${version_id}=0.1
522 ${map}= Create Dictionary action=Create_Package
523 Templating.Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER}
524 ${data}= Templating.Apply Template sdc ${SDC_ACTION_TEMPLATE} ${map}
525 ${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}
526 Should Be Equal As Strings ${resp.status_code} 200
527 [Return] ${resp.json()}
528
529Add SDC Entitlement Pool
530 [Documentation] Creates an SDC Entitlement Pool and returns its id
531 [Arguments] ${license_model_id} ${version_id}=0.1 ${license_start_date}="01/01/1960" ${license_end_date}="01/01/1961"
532 ${uuid}= Generate UUID4
533 ${shortened_uuid}= Evaluate str("${uuid}")[:23]
534 ${map}= Create Dictionary entitlement_pool_name=${shortened_uuid} license_start_date=${license_start_date} license_end_date=${license_end_date}
535 Templating.Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER}
536 ${data}= Templating.Apply Template sdc ${SDC_ENTITLEMENT_POOL_TEMPLATE} ${map}
537 ${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}
538 Should Be Equal As Strings ${resp.status_code} 200
539 [Return] ${resp.json()['value']}
540
541Get SDC Entitlement Pool
542 [Documentation] Gets an SDC Entitlement Pool by its id
543 [Arguments] ${license_model_id} ${pool_id}
544 ${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}
545 [Return] ${resp.json()}
546
547Add SDC License Group
548 [Documentation] Creates an SDC License Group and returns its id
549 [Arguments] ${license_model_id} ${version_id}=1.0 ${license_start_date}="01/01/1960" ${license_end_date}="01/01/1961"
550 ${uuid}= Generate UUID4
551 ${shortened_uuid}= Evaluate str("${uuid}")[:23]
552 ${map}= Create Dictionary key_group_name=${shortened_uuid} license_start_date=${license_start_date} license_end_date=${license_end_date}
553 Templating.Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER}
554 ${data}= Templating.Apply Template sdc ${SDC_KEY_GROUP_TEMPLATE} ${map}
555 ${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}
556 Should Be Equal As Strings ${resp.status_code} 200
557 [Return] ${resp.json()['value']}
558
559Get SDC License Group
560 [Documentation] Gets an SDC License Group by its id
561 [Arguments] ${license_model_id} ${group_id} ${version_id}
562 ${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}
563 [Return] ${resp.json()}
564
565Add SDC Feature Group
566 [Documentation] Creates an SDC Feature Group and returns its id
567 [Arguments] ${license_model_id} ${key_group_id} ${entitlement_pool_id} ${version_id}=0.1
568 ${uuid}= Generate UUID4
569 ${shortened_uuid}= Evaluate str("${uuid}")[:23]
570 ${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}
571 Templating.Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER}
572 ${data}= Templating.Apply Template sdc ${SDC_FEATURE_GROUP_TEMPLATE} ${map}
573 ${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}
574 Should Be Equal As Strings ${resp.status_code} 200
575 [Return] ${resp.json()['value']}
576
577Get SDC Feature Group
578 [Documentation] Gets an SDC Feature Group by its id
579 [Arguments] ${license_model_id} ${group_id}
580 ${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}
581 [Return] ${resp.json()}
582
583Add SDC License Agreement
584 [Documentation] Creates an SDC License Agreement and returns its id
585 [Arguments] ${license_model_id} ${feature_group_id} ${version_id}=0.1
586 ${uuid}= Generate UUID4
587 ${shortened_uuid}= Evaluate str("${uuid}")[:23]
588 ${map}= Create Dictionary license_agreement_name=${shortened_uuid} feature_group_id=${feature_group_id}
589 Templating.Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER}
590 ${data}= Templating.Apply Template sdc ${SDC_LICENSE_AGREEMENT_TEMPLATE} ${map}
591 ${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}
592 Should Be Equal As Strings ${resp.status_code} 200
593 [Return] ${resp.json()['value']}
594
595Get SDC License Agreement
596 [Documentation] Gets an SDC License Agreement by its id
597 [Arguments] ${license_model_id} ${agreement_id}
598 ${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}
599 [Return] ${resp.json()}
600
601Add SDC Software Product
602 [Documentation] Creates an SDC Software Product and returns its id
603 [Arguments] ${license_agreement_id} ${feature_group_id} ${license_model_name} ${license_model_id} ${license_model_version_id} ${name_prefix}
604 ${uuid}= Generate UUID4
605 ${shortened_uuid}= Evaluate str("${uuid}")[:13]
606 ${software_product_name}= Catenate ${name_prefix} ${shortened_uuid}
607 ${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}
608 Templating.Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER}
609 ${data}= Templating.Apply Template sdc ${SDC_SOFTWARE_PRODUCT_TEMPLATE} ${map}
610 ${resp}= SDC.Run Post Request ${SDC_BE_ONBOARD_ENDPOINT} ${SDC_VENDOR_SOFTWARE_PRODUCT_PATH} ${data} ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
611 Should Be Equal As Strings ${resp.status_code} 200
612 [Return] ${resp.json()['itemId']} ${resp.json()['version']['id']}
613
614Get SDC Software Product
615 [Documentation] Gets an SDC Software Product by its id
616 [Arguments] ${software_product_id} ${version_id}=0.1
617 ${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}
618 [Return] ${resp.json()}
619
620Add SDC Catalog Resource
621 [Documentation] Creates an SDC Catalog Resource and returns its id
krzysztof kuzmickidadd0e62019-07-31 20:08:36 +0200622 [Arguments] ${license_agreement_id} ${software_product_name} ${license_model_name} ${software_product_id} ${resourceType}=VF
623 ${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 -0400624 Templating.Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER}
625 ${data}= Templating.Apply Template sdc ${SDC_CATALOG_RESOURCE_TEMPLATE} ${map}
626 ${resp}= SDC.Run Post Request ${SDC_BE_ENDPOINT} ${SDC_CATALOG_RESOURCES_PATH} ${data} ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
627 Should Be Equal As Strings ${resp.status_code} 201
628 [Return] ${resp.json()['uniqueId']}
629
630Add SDC Allotted Resource Catalog Resource
631 [Documentation] Creates an SDC Allotted Resource Catalog Resource and returns its id
632 [Arguments] ${license_agreement_id} ${software_product_name} ${license_model_name} ${software_product_id} ${subcategory}
633 ${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}
634 Templating.Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER}
635 ${data}= Templating.Apply Template sdc ${SDC_ALLOTTED_RESOURCE_CATALOG_RESOURCE_TEMPLATE} ${map}
636 ${resp}= SDC.Run Post Request ${SDC_BE_ENDPOINT} ${SDC_CATALOG_RESOURCES_PATH} ${data} ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
637 Should Be Equal As Strings ${resp.status_code} 201
638 [Return] ${resp.json()['uniqueId']}
639
640Mark SDC Catalog Resource Inactive
641 [Documentation] Marks SDC Catalog Resource as inactive
642 [Arguments] ${catalog_resource_id}
643 ${resp}= SDC.Run Delete Request ${SDC_BE_ENDPOINT} ${SDC_CATALOG_RESOURCES_PATH}/${catalog_resource_id} ${None} ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
644 Should Be Equal As Strings ${resp.status_code} 204
645 [Return] ${resp}
646
647Delete Inactive SDC Catalog Resources
648 [Documentation] Delete all SDC Catalog Resources that are inactive
649 ${resp}= SDC.Run Delete Request ${SDC_BE_ENDPOINT} ${SDC_CATALOG_INACTIVE_RESOURCES_PATH} ${None} ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
650 Should Be Equal As Strings ${resp.status_code} 200
651 [Return] ${resp.json()}
652
653Get SDC Catalog Resource
654 [Documentation] Gets an SDC Catalog Resource by its id
655 [Arguments] ${catalog_resource_id}
656 ${resp}= SDC.Run Get Request ${SDC_BE_ENDPOINT} ${SDC_CATALOG_RESOURCES_PATH}/${catalog_resource_id} ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
657 [Return] ${resp.json()}
658
659Get SDC Catalog Resource Component Instances
660 [Documentation] Gets component instances of an SDC Catalog Resource by its id
661 [Arguments] ${catalog_resource_id}
662 ${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}
663 [Return] ${resp.json()}
664
665Get SDC Catalog Resource Deployment Artifact Properties
666 [Documentation] Gets deployment artifact properties of an SDC Catalog Resource by its id
667 [Arguments] ${catalog_resource_id}
668 ${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}
669 [Return] ${resp.json()}
670
671
672Get SDC Catalog Resource Component Instances Properties
673 [Documentation] Gets SDC Catalog Resource component instances properties by its id
674 [Arguments] ${catalog_resource_id}
675 ${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}
676 [Return] ${resp.json()}
677
678Get SDC Catalog Resource Component Instances Properties For Resource
679 [Documentation] Gets SDC Catalog Resource component instances properties for a Resource (VF) by its id
680 [Arguments] ${catalog_resource_id}
681 ${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}
682 [Return] ${resp.json()}
683
684Get SDC Catalog Resource Inputs
685 [Documentation] Gets SDC Catalog Resource inputs 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=inputs ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
688 [Return] ${resp.json()}
689
690Get SDC Catalog Resource Component Instance Properties
691 [Documentation] Gets component instance properties of an SDC Catalog Resource by their ids
692 [Arguments] ${catalog_resource_id} ${component_instance_id} ${component_id}
693 ${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}
694 [Return] ${resp.json()}
695
696Set SDC Catalog Resource Component Instance Properties
697 [Documentation] Sets SDC Catalog Resource component instance properties by ids
698 [Arguments] ${catalog_resource_id} ${component_parent_service_id} ${data}
699 ${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}
700 [Return] ${resp.json()}
701
702Set SDC Catalog Resource Component Instance Properties For Resource
703 [Documentation] Sets SDC Resource component instance properties by ids
704 [Arguments] ${catalog_parent_resource_id} ${catalog_resource_id} ${data}
705 ${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}
706 [Return] ${resp.json()}
707
708Set CDS Catalog Resource Component Instance Properties
709 [Documentation] Sets CDS Catalog Resource component instance properties by ids
710 [Arguments] ${catalog_resource_id} ${component_instance_id} ${data}
711 ${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}
712 [Return] ${resp.json()}
713
714Set SDC Catalog Resource VNF Inputs
715 [Documentation] Sets VNF Inputs for an SDC Catalog Resource by its id
716 [Arguments] ${catalog_resource_id} ${data}
717 ${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}
718 [Return] ${resp.json()}
719
DR695Hcccad652019-09-16 13:21:47 -0400720Get Service Catalog
721 [Arguments] ${service_name}
722 ${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}
723 [Return] ${resp.json()}
724
DR695Hc0cf6a42019-07-26 16:42:36 -0400725Get SDC Demo Vnf Catalog Resource
726 [Documentation] Gets Resource ids of demonstration VNFs for instantiation
727 [Arguments] ${service_name}
DR695Hcccad652019-09-16 13:21:47 -0400728 ${resp}= Get Service Catalog ${service_name}
Brian Freemanc86db412019-11-13 13:18:59 -0500729 @{ITEMS}= Copy List ${resp['componentInstances']}
DR695Hc0cf6a42019-07-26 16:42:36 -0400730 ${demo_catalog_resource}= Create Dictionary
731 :FOR ${ELEMENT} IN @{ITEMS}
732 \ Log ${ELEMENT['name']}
733 \ Log ${ELEMENT['groupInstances'][0]['groupName']}
734 \ ${vnf}= Get VNF From Group Name ${ELEMENT['groupInstances'][0]['groupName']} ${service_name}
735 \ ${vnf_data}= Create Dictionary vnf_type=${ELEMENT['name']} vf_module=${ELEMENT['groupInstances'][0]['groupName']}
736 \ LOG ${vnf_data}
737 \ Set To Dictionary ${demo_catalog_resource} ${vnf}=${vnf_data}
738 \ LOG ${demo_catalog_resource}
739 [Return] ${demo_catalog_resource}
740
741Get VNF From Group Name
742 [Documentation] Looks up VNF key from service mapping for a regex on group_name and service_name
743 [Arguments] ${group_name} ${service_name}
744 ${vnf}= Set Variable If
745 ... ('${service_name}'=='demoVFWCL') and ('base_vfw' in '${group_name}') vFWCLvFWSNK
746 ... ('${service_name}'=='demoVFWCL') and ('base_vpkg' in '${group_name}') vFWCLvPKG
747 ... ('${service_name}'=='demoVLB') and ('base_vlb' in '${group_name}') vLB
748 [Return] ${vnf}
749
750Checkin SDC Catalog Resource
751 [Documentation] Checks in an SDC Catalog Resource by its id
752 [Arguments] ${catalog_resource_id}
753 ${map}= Create Dictionary user_remarks=Robot remarks
754 Templating.Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER}
755 ${data}= Templating.Apply Template sdc ${SDC_USER_REMARKS_TEMPLATE} ${map}
756 ${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}
757 Should Be Equal As Strings ${resp.status_code} 200
758 [Return] ${resp.json()}
759
DR695Hc0cf6a42019-07-26 16:42:36 -0400760Certify SDC Catalog Resource
kaihlavia724b232019-08-07 12:37:17 +0300761 [Documentation] Certifies an SDC Catalog Resource by its id and returns the new uniqueId and uuid
Brian Freemancc3c8692020-03-05 15:53:41 -0500762 [Arguments] ${catalog_resource_id} ${user_id}=${SDC_DESIGNER_USER_ID}
DR695Hc0cf6a42019-07-26 16:42:36 -0400763 ${map}= Create Dictionary user_remarks=Robot remarks
764 Templating.Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER}
765 ${data}= Templating.Apply Template sdc ${SDC_USER_REMARKS_TEMPLATE} ${map}
766 ${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}
767 Should Be Equal As Strings ${resp.status_code} 200
kaihlavia724b232019-08-07 12:37:17 +0300768 [Return] ${resp.json()['uniqueId']} ${resp.json()['uuid']}
DR695Hc0cf6a42019-07-26 16:42:36 -0400769
770Upload SDC Heat Package
771 [Documentation] Creates an SDC Software Product and returns its id
772 [Arguments] ${software_product_id} ${file_path} ${version_id}=0.1
773 ${files}= Create Dictionary
774 Create Multi Part ${files} upload ${file_path} contentType=application/zip
775 ${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}
776 Should Be Equal As Strings ${resp.status_code} 200
777
778Add SDC Catalog Service
779 [Documentation] Creates an SDC Catalog Service and returns its id
krzysztof kuzmickidadd0e62019-07-31 20:08:36 +0200780 [Arguments] ${catalog_service_name} ${instantiationType}=A-la-carte
DR695Hc0cf6a42019-07-26 16:42:36 -0400781 ${uuid}= Generate UUID4
782 ${shortened_uuid}= Evaluate str("${uuid}")[:23]
783 ${catalog_service_name}= Set Variable If '${catalog_service_name}' =='' ${shortened_uuid} ${catalog_service_name}
krzysztof kuzmickidadd0e62019-07-31 20:08:36 +0200784 ${map}= Create Dictionary service_name=${catalog_service_name} instantiation_type=${instantiationType}
DR695Hc0cf6a42019-07-26 16:42:36 -0400785 Templating.Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER}
786 ${data}= Templating.Apply Template sdc ${SDC_CATALOG_SERVICE_TEMPLATE} ${map}
787 ${resp}= SDC.Run Post Request ${SDC_BE_ENDPOINT} ${SDC_CATALOG_SERVICES_PATH} ${data} ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
Brian Freeman026df1b2019-12-05 16:21:20 -0500788 Run Keyword If ('${resp.status_code}'=='409') Log ${\n} ${catalog_service_name} Service Already Exists console=yes
DR695Hc0cf6a42019-07-26 16:42:36 -0400789 Should Be Equal As Strings ${resp.status_code} 201
790 [Return] ${resp.json()['uniqueId']}
791
792Mark SDC Catalog Service Inactive
793 [Documentation] Deletes an SDC Catalog Service
794 [Arguments] ${catalog_service_id}
795 ${resp}= SDC.Run Delete Request ${SDC_BE_ENDPOINT} ${SDC_CATALOG_SERVICES_PATH}/${catalog_service_id} ${None} ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
796 Should Be Equal As Strings ${resp.status_code} 204
797 [Return] ${resp}
798
799Delete Inactive SDC Catalog Services
800 [Documentation] Delete all SDC Catalog Services that are inactive
801 ${resp}= SDC.Run Delete Request ${SDC_BE_ENDPOINT} ${SDC_CATALOG_INACTIVE_SERVICES_PATH} ${None} ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
802 Should Be Equal As Strings ${resp.status_code} 200
803 [Return] ${resp.json()}
804
805Get SDC Catalog Service
806 [Documentation] Gets an SDC Catalog Service by its id
807 [Arguments] ${catalog_service_id}
808 ${resp}= SDC.Run Get Request ${SDC_BE_ENDPOINT} ${SDC_CATALOG_SERVICES_PATH}/${catalog_service_id} ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
809 [Return] ${resp.json()}
810
811Checkin SDC Catalog Service
812 [Documentation] Checks in an SDC Catalog Service by its id
813 [Arguments] ${catalog_service_id}
814 ${map}= Create Dictionary user_remarks=Robot remarks
815 Templating.Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER}
816 ${data}= Templating.Apply Template sdc ${SDC_USER_REMARKS_TEMPLATE} ${map}
817 ${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}
818 Should Be Equal As Strings ${resp.status_code} 200
819 [Return] ${resp.json()}
820
DR695Hc0cf6a42019-07-26 16:42:36 -0400821Certify SDC Catalog Service
822 [Documentation] Certifies an SDC Catalog Service by its id and returns the new id
823 [Arguments] ${catalog_service_id}
824 ${map}= Create Dictionary user_remarks=Robot remarks
825 Templating.Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER}
826 ${data}= Templating.Apply Template sdc ${SDC_USER_REMARKS_TEMPLATE} ${map}
Brian Freemancc3c8692020-03-05 15:53:41 -0500827 ${resp}= SDC.Run Post Request ${SDC_BE_ENDPOINT} ${SDC_CATALOG_SERVICES_PATH}/${catalog_service_id}${SDC_CATALOG_LIFECYCLE_PATH}/certify ${data} ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
DR695Hc0cf6a42019-07-26 16:42:36 -0400828 Should Be Equal As Strings ${resp.status_code} 200
829 [Return] ${resp.json()['uniqueId']}
830
DR695Hc0cf6a42019-07-26 16:42:36 -0400831Distribute SDC Catalog Service
832 [Documentation] distribute an SDC Catalog Service by its id
833 [Arguments] ${catalog_service_id}
Brian Freemancc3c8692020-03-05 15:53:41 -0500834 ${resp}= SDC.Run Post Request ${SDC_BE_ENDPOINT} ${SDC_CATALOG_SERVICES_PATH}/${catalog_service_id}${SDC_CATALOG_SERVICE_DISTRIBUTION_ACTIVATE_PATH} ${None} ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
DR695Hc0cf6a42019-07-26 16:42:36 -0400835 Should Be Equal As Strings ${resp.status_code} 200
836 [Return] ${resp.json()}
837
838Add SDC Resource Instance
kaihlavia724b232019-08-07 12:37:17 +0300839 [Documentation] Creates an SDC Resource Instance and returns its id and name
DR695Hc0cf6a42019-07-26 16:42:36 -0400840 [Arguments] ${catalog_service_id} ${catalog_resource_id} ${catalog_resource_name} ${xoffset}=${0} ${yoffset}=${0} ${resourceType}=VF
841 ${milli_timestamp}= Generate Timestamp
842 ${xoffset}= Set Variable ${xoffset+306}
843 ${yoffset}= Set Variable ${yoffset+248}
844 ${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}
845 Templating.Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER}
846 ${data}= Templating.Apply Template sdc ${SDC_RESOURCE_INSTANCE_TEMPLATE} ${map}
847 ${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}
848 Should Be Equal As Strings ${resp.status_code} 201
kaihlavia724b232019-08-07 12:37:17 +0300849 [Return] ${resp.json()['uniqueId']} ${resp.json()['name']}
DR695Hc0cf6a42019-07-26 16:42:36 -0400850
851Add SDC Resource Instance To Resource
852 [Documentation] Creates an SDC Resource Instance in a Resource (VF) and returns its id
853 [Arguments] ${parent_catalog_resource_id} ${catalog_resource_id} ${catalog_resource_name} ${xoffset}=${0} ${yoffset}=${0} ${resourceType}=VF
854 ${milli_timestamp}= Generate Timestamp
855 ${xoffset}= Set Variable ${xoffset+306}
856 ${yoffset}= Set Variable ${yoffset+248}
857 ${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}
858 Templating.Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER}
859 ${data}= Templating.Apply Template sdc ${SDC_RESOURCE_INSTANCE_TEMPLATE} ${map}
860 ${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}
861 Should Be Equal As Strings ${resp.status_code} 201
862 [Return] ${resp.json()['uniqueId']}
863
864Get Catalog Service Distribution
865 [Documentation] Gets an SDC Catalog Service distribution
866 [Arguments] ${catalog_service_uuid}
Brian Freemancc3c8692020-03-05 15:53:41 -0500867 ${resp}= SDC.Run Get Request ${SDC_BE_ENDPOINT} ${SDC_CATALOG_SERVICES_PATH}/${catalog_service_uuid}${SDC_CATALOG_SERVICE_DISTRIBUTION_PATH} ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
DR695Hc0cf6a42019-07-26 16:42:36 -0400868 Should Be Equal As Strings ${resp.status_code} 200
869 [Return] ${resp.json()}
870
871Check Catalog Service Distributed
872 [Documentation] Checks if an SDC Catalog Service is distributed
873 [Arguments] ${catalog_service_uuid} ${dist_status}
874 ${dist_resp}= Get Catalog Service Distribution ${catalog_service_uuid}
875 Should Be Equal As Strings ${dist_resp['distributionStatusOfServiceList'][0]['deployementStatus']} Distributed
876 ${det_resp}= Get Catalog Service Distribution Details ${dist_resp['distributionStatusOfServiceList'][0]['distributionID']}
877 @{ITEMS}= Copy List ${det_resp['distributionStatusList']}
878 Should Not Be Empty ${ITEMS}
879 ${SO_COMPLETE} Set Variable FALSE
880 ${dist_status} Set Variable CONTINUE
881 Should Not Be Empty ${ITEMS}
882 :FOR ${ELEMENT} IN @{ITEMS}
883 \ Log ${ELEMENT['omfComponentID']}
884 \ Log ${ELEMENT['status']}
885 \ ${SO_COMPLETE} Set Variable If (('${ELEMENT['status']}' == 'DISTRIBUTION_COMPLETE_OK')) or ('${SO_COMPLETE}'=='TRUE') TRUE
886 \ Exit For Loop If ('${SO_COMPLETE}'=='TRUE')
Brian Freemand1339742019-10-07 11:37:14 -0500887 \ Run Keyword If ('${ELEMENT['status']}' == 'DISTRIBUTION_COMPLETE_ERROR') Fatal Error "SO DISTRIBUTION_COMPLETE_ERROR"
DR695Hc0cf6a42019-07-26 16:42:36 -0400888 \ ${dist_status}= Set Variable If (('${ELEMENT['status']}' == 'COMPONENT_DONE_ERROR') and ('${ELEMENT['omfComponentID']}' == 'aai-ml')) EXIT
889 \ Exit For Loop If (('${ELEMENT['status']}' == 'COMPONENT_DONE_ERROR') and ('${ELEMENT['omfComponentID']}' == 'aai-ml'))
890 Should Be True ( '${SO_COMPLETE}'=='TRUE') SO Test
891
892Get Catalog Service Distribution Details
893 [Documentation] Gets SDC Catalog Service distribution details
894 [Arguments] ${catalog_service_distribution_id}
Brian Freemancc3c8692020-03-05 15:53:41 -0500895 ${resp}= SDC.Run Get Request ${SDC_BE_ENDPOINT} ${SDC_CATALOG_SERVICES_PATH}${SDC_CATALOG_SERVICE_DISTRIBUTION_PATH}/${catalog_service_distribution_id} ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
DR695Hc0cf6a42019-07-26 16:42:36 -0400896 Should Be Equal As Strings ${resp.status_code} 200
897 [Return] ${resp.json()}
898
899Run SDC Health Check
900 [Documentation] Runs a SDC health check
901 ${resp}= SDC.Run Get Request ${SDC_FE_ENDPOINT} ${SDC_HEALTH_CHECK_PATH} user=${None}
902 # only test for HTTP 200 to determine SDC Health. SDC_DE_HEALTH is informational
903 Should Be Equal As Strings ${resp.status_code} 200 SDC DOWN
904 ${SDC_DE_HEALTH}= Catenate DOWN
905 @{ITEMS}= Copy List ${resp.json()['componentsInfo']}
906 :FOR ${ELEMENT} IN @{ITEMS}
907 \ Log ${ELEMENT['healthCheckStatus']}
908 \ ${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 -0400909 Log (DMaaP:${SDC_DE_HEALTH}) console=True
DR695Hc0cf6a42019-07-26 16:42:36 -0400910
911Open SDC GUI
912 [Documentation] Logs in to SDC GUI
913 [Arguments] ${PATH}
914 ## Setup Browever now being managed by the test case
915 ##Setup Browser
916 Go To ${SDC_FE_ENDPOINT}${PATH}
917 Maximize Browser Window
918
919 Set Browser Implicit Wait ${GLOBAL_SELENIUM_BROWSER_IMPLICIT_WAIT}
920 Log Logging in to ${SDC_FE_ENDPOINT}${PATH}
921 Title Should Be SDC
922 Wait Until Page Contains Element xpath=//div/a[text()='SDC'] ${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT}
923 Log Logged in to ${SDC_FE_ENDPOINT}${PATH}
924
925
926Create Multi Part
927 [Arguments] ${addTo} ${partName} ${filePath} ${contentType}=${None}
928 ${fileData}= Get Binary File ${filePath}
929 ${fileDir} ${fileName}= Split Path ${filePath}
930 ${partData}= Create List ${fileName} ${fileData} ${contentType}
931 Set To Dictionary ${addTo} ${partName}=${partData}
932
933
kaihlavia724b232019-08-07 12:37:17 +0300934Add CDS Parameters
935 [Arguments] ${catalog_service_name}
DR695Hc0cf6a42019-07-26 16:42:36 -0400936 ${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 -0400937 ${service_uuid}= Set Variable ${resp.json()['uniqueId']}
938 ${component_uuid}= Set Variable ${resp.json()['componentInstances'][0]['uniqueId']}
Abdelmuhaimen Seaudi498057b2019-08-02 18:36:00 +0000939 ${skip_post_instatiation}= Set Variable If '${catalog_service_name}' == "demoVLB_CDS" false true
DR695Hc0cf6a42019-07-26 16:42:36 -0400940 @{inputs}= Copy List ${resp.json()['componentInstances'][0]['inputs']}
941 :FOR ${input} IN @{inputs}
Abdelmuhaimen Seaudi498057b2019-08-02 18:36:00 +0000942 \ Run Keyword If '${input['name']}' == "sdnc_artifact_name" Set Input Parameter ${service_uuid} ${component_uuid} ${input} string vnf
hanybaki3bee75e2019-10-14 17:43:47 +0200943 ... ELSE IF '${input['name']}' == "sdnc_model_name" Set Input Parameter ${service_uuid} ${component_uuid} ${input} string vLB_CDS
DR695H0ccf9e32019-08-06 17:28:56 -0400944 ... ELSE IF '${input['name']}' == "sdnc_model_version" Set Input Parameter ${service_uuid} ${component_uuid} ${input} string 1.0.0
945 ... ELSE IF '${input['name']}' == "skip_post_instantiation_configuration" Set Input Parameter ${service_uuid} ${component_uuid} ${input} boolean ${skip_post_instatiation}
DR695Hc0cf6a42019-07-26 16:42:36 -0400946
kaihlavia724b232019-08-07 12:37:17 +0300947
948Set Input Parameter
Abdelmuhaimen Seaudi498057b2019-08-02 18:36:00 +0000949 [Arguments] ${service_uuid} ${component_uuid} ${input} ${input_type} ${input_value}
krzysztof kuzmickidadd0e62019-07-31 20:08:36 +0200950 ${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 -0400951 Should Be Equal As Strings ${resp.status_code} 200
krzysztof kuzmickidadd0e62019-07-31 20:08:36 +0200952
953
954Get Service Model Parameter from SDC Service Catalog
955 [Documentation] Returns Service Model UUID
956 [Arguments] ${service_name} ${parameter_name}
957 ${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}
958 ${json_resp}= Set Variable ${resp.json()}
959 ${parameter_value}= Set Variable ${json_resp["${parameter_name}"]}
Abdelmuhaimen Seaudi498057b2019-08-02 18:36:00 +0000960 [Return] ${parameter_value}
kaihlavia724b232019-08-07 12:37:17 +0300961
962Onboard DCAE Microservice
963 [Documentation] Create DCAE Microservice with a given name, add Tosca artifacts to it and certify it
964 ... Return the unique_id and uuid of the certified VF
965 [Arguments] ${test_vf_name}
966 ${data}= Create SDC Catalog Resource For DCAE Component MicroService Data ${test_vf_name} TestVendor
967 ${resp}= SDC.Run Post Request ${SDC_BE_ENDPOINT} ${SDC_CATALOG_RESOURCES_PATH} ${data} ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
968 Should Be Equal As Strings ${resp.status_code} 201
969
970 ${vf_unique_id}= Set Variable ${resp.json()['uniqueId']}
971
972 Add Tosca Artifact to Resource template ${vf_unique_id}
973 Add Tosca Artifact to Resource translate ${vf_unique_id}
974 Add Tosca Artifact to Resource schema ${vf_unique_id}
975
976 ${cert_vf_unique_id} ${cert_vf_uuid} Certify SDC Catalog Resource ${vf_unique_id} ${SDC_DESIGNER_USER_ID}
977 [return] ${cert_vf_unique_id} ${cert_vf_uuid}
978
979Create SDC Catalog Resource For DCAE Component MicroService Data
980 [Documentation] Creates and returns data for DCAE Component MicroService SDC Catalog Resource
981 [Arguments] ${resource_name} ${vendor_name}
982 ${map}= Create Dictionary resource_name=${resource_name} vendor_name=${vendor_name}
983 Templating.Create Environment sdc_dcaed ${GLOBAL_TEMPLATE_FOLDER}
984 ${data}= Templating.Apply Template sdc_dcaed ${SDC_DCAE_COMPONENT_MICROSERVICE_TEMPLATE} ${map}
985 [Return] ${data}
986
987Add Tosca Artifact To Resource
988 [Documentation] Add Tosca artifacts to given resource id
989 [Arguments] ${artifact} ${vf_id}
990 ${blueprint_data} OperatingSystem.Get File ${SDC_CATALOG_DEPLOYMENT_ARTIFACT_PATH}${artifact}.yaml
991 ${payloadData}= Base64 Encode ${blueprint_data}
992 ${dict}= Create Dictionary artifactLabel=${artifact} artifactName=${artifact}.yaml artifactType=DCAE_TOSCA artifactGroupType=DEPLOYMENT description=${artifact}.yaml payloadData=${payloadData}
993 Templating.Create Environment sdc_artifact_upload ${GLOBAL_TEMPLATE_FOLDER}
994 ${data}= Templating.Apply Template sdc_artifact_upload ${SDC_ARTIFACT_UPLOAD_TEMPLATE} ${dict}
995 # POST artifactUpload to resource
996 ${resp}= SDC.Run Post Request ${SDC_BE_ENDPOINT} ${SDC_CATALOG_RESOURCES_PATH}/${vf_id}/artifacts ${data} ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
997 Should Be Equal As Strings ${resp.status_code} 200
998 [Return] ${resp}
999
1000Add Catalog Service For Monitoring Template
1001 [Documentation] Creates SDC Catalog Service for Monitoring Template with given name
1002 [Arguments] ${service_name}
1003 ${map}= Create Dictionary service_name=${service_name}
1004 Templating.Create Environment sdc_catalog_service ${GLOBAL_TEMPLATE_FOLDER}
1005 ${data}= Templating.Apply Template sdc_catalog_service ${SDC_CATALOG_SERVICE_MONITORING_TEMPLATE} ${map}
1006 ${resp}= SDC.Run Post Request ${SDC_BE_ENDPOINT} ${SDC_CATALOG_SERVICES_PATH} ${data} ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
1007 Should Be Equal As Strings ${resp.status_code} 201
1008 [Return] ${resp.json()['uniqueId']} ${resp.json()['uuid']}
1009
1010Generate Unique Postfix
1011 [Documentation] Create and return unique postfix to be used in various unique names
1012 ${tmp_id} = Generate Timestamp
1013 ${tmp_str} = Convert To String ${tmp_id}
1014 [return] ${tmp_str}
1015
1016Certify And Approve SDC Catalog Service
1017 [Documentation] Perform the required steps to certify and approve the given SDC catalog service
1018 [Arguments] ${cs_unique_id}
kaihlavia724b232019-08-07 12:37:17 +03001019 Checkin SDC Catalog Service ${cs_unique_id}
kaihlavia724b232019-08-07 12:37:17 +03001020 ${cert_cs_unique_id}= Certify SDC Catalog Service ${cs_unique_id}
kaihlavia724b232019-08-07 12:37:17 +03001021
1022Create Monitoring Configuration
1023 [Documentation] Create a monitoring configuration for a given service based on a previously created VFCMT
1024 ... Return the unique_id and uuid of the created catalog service for the monitoring configuration
1025 ... and the name of the related VFCMT instance
1026 [Arguments] ${service_name} ${vf_unique_id} ${vf_name}
1027 ${cs_unique_id} ${cs_uuid} Add Catalog Service For Monitoring Template ${service_name}
1028 ${vfi_uuid} ${vfi_name} Add SDC Resource Instance ${cs_unique_id} ${vf_unique_id} ${vf_name}
1029 [return] ${cs_unique_id} ${cs_uuid} ${vfi_name}
1030