blob: a85ba27f179b37f9ddaf967acf7bbcbdb8fbc109 [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]}
Krzysztof Kuzmicki888614e2020-03-06 14:06:48 +010094 \ Set To Dictionary ${resource_types} ${resource_type_string} ${loop_catalog_resource_id}
DR695Hc0cf6a42019-07-26 16:42:36 -040095 \ 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
Brian Freeman4c540162020-03-10 15:20:18 -0500136 ${catalog_service_id}= Wait Until Keyword Succeeds 60s 10s 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}
Brian Freeman4c540162020-03-10 15:20:18 -0500206 \ ${loop_catalog_resource_id} ${loop_catalog_resource_uuid} Wait Until Keyword Succeeds 60s 10s 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
Brian Freeman4c540162020-03-10 15:20:18 -0500212 ${catalog_service_id}= Wait Until Keyword Succeeds 60s 10s 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
Krzysztof Kuzmicki888614e2020-03-06 14:06:48 +0100263 ${json}= Get Resource Catalog Generic%20NeutronNet
264 [Return] ${json['allVersions']['1.0']}
DR695Hc0cf6a42019-07-26 16:42:36 -0400265
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
Krzysztof Kuzmicki888614e2020-03-06 14:06:48 +0100269 ${json}= Get Resource Catalog AllottedResource
270 [Return] ${json['allVersions']['1.0']}
271
272Get Resource Catalog
273 [Arguments] ${resource_name}
274 ${resp}= SDC.Run Get Request ${SDC_BE_ENDPOINT} ${SDC_CATALOG_RESOURCES_QUERY_PATH}/${resource_name}/resourceVersion/1.0 ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
275 [Return] ${resp.json()}
DR695Hc0cf6a42019-07-26 16:42:36 -0400276
277Loop Over Check Catalog Service Distributed
278 [Arguments] ${catalog_service_id}
279 # SO watchdog timeout is 300 seconds need buffer
280 ${dist_status}= Set Variable CONTINUE
281 :FOR ${CHECK_INDEX} IN RANGE 20
282 \ ${status} ${_} = Run Keyword And Ignore Error Check Catalog Service Distributed ${catalog_service_id} ${dist_status}
283 \ Sleep 20s
284 \ Return From Keyword If '${status}'=='PASS'
285 # need a way to exit the loop early on DISTRIBUTION_COMPLETE_ERROR ${dist_status} doesnt work
286 #\ Exit For Loop If '${dist_status}'=='EXIT'
287 Should Be Equal As Strings ${status} PASS
288
289Setup SDC Catalog Resource
krzysztof kuzmickidadd0e62019-07-31 20:08:36 +0200290 [Documentation] Creates all the steps a VF/PNF needs for an SDC Catalog Resource and returns the id
291 [Arguments] ${model_zip_path} ${cds}=None ${resourceType}=VF
DR695Hc0cf6a42019-07-26 16:42:36 -0400292 ${license_model_id} ${license_model_version_id}= Add SDC License Model
293
294
295 ${license_temp_date}= Get Current Date
296 ${license_start_date}= Get Current Date result_format=%m/%d/%Y
297 ${license_end_date}= Add Time To Date ${license_temp_date} 365 days result_format=%m/%d/%Y
298 ${key_group_id}= Add SDC License Group ${license_model_id} ${license_model_version_id} ${license_start_date} ${license_end_date}
299 ${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 -0400300 ${feature_group_id}= Add SDC Feature Group ${license_model_id} ${key_group_id} ${pool_id} ${license_model_version_id}
301 ${license_agreement_id}= Add SDC License Agreement ${license_model_id} ${feature_group_id} ${license_model_version_id}
302 Submit SDC License Model ${license_model_id} ${license_model_version_id}
303 ${license_model_resp}= Get SDC License Model ${license_model_id} ${license_model_version_id}
krzysztof kuzmickidadd0e62019-07-31 20:08:36 +0200304 ${matches}= Run Keyword If '${resourceType}'=='PNF' Get Regexp Matches ${model_zip_path} temp/(.*)\.csar 1
305 ... ELSE Get Regexp Matches ${model_zip_path} temp/(.*)\.zip 1
DR695Hc0cf6a42019-07-26 16:42:36 -0400306 ${software_product_name_prefix}= Set Variable ${matches[0]}
307 ${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}
308 Upload SDC Heat Package ${software_product_id} ${model_zip_path} ${software_product_version_id}
309 Validate SDC Software Product ${software_product_id} ${software_product_version_id}
310 Submit SDC Software Product ${software_product_id} ${software_product_version_id}
311 Package SDC Software Product ${software_product_id} ${software_product_version_id}
312 ${software_product_resp}= Get SDC Software Product ${software_product_id} ${software_product_version_id}
krzysztof kuzmickidadd0e62019-07-31 20:08:36 +0200313 ${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 -0400314 # Check if need to set up CDS properties
315 Run Keyword If '${cds}' == 'vfwng' Setup SDC Catalog Resource CDS Properties ${catalog_resource_id}
Brian Freeman4c540162020-03-10 15:20:18 -0500316 ${catalog_resource_id} ${catalog_resource_uuid} Wait Until Keyword Succeeds 60s 10s Certify SDC Catalog Resource ${catalog_resource_id} ${SDC_DESIGNER_USER_ID}
DR695Hc0cf6a42019-07-26 16:42:36 -0400317 [Return] ${catalog_resource_id}
318
DR695Hc0cf6a42019-07-26 16:42:36 -0400319Setup SDC Catalog Resource Deployment Artifact Properties
320 [Documentation] Set up Deployment Artiface properties
321 [Arguments] ${catalog_service_id} ${catalog_parent_service_id} ${catalog_resource_unique_id} ${blueprint_file}
322 ${resp}= Get SDC Catalog Resource Component Instances Properties ${catalog_service_id}
323 ${blueprint_data} OperatingSystem.Get File ${SDC_CATALOG_DEPLOYMENT_ARTIFACT_PATH}${blueprint_file}
324 ${payloadData}= Base64 Encode ${blueprint_data}
325 ${dict}= Create Dictionary artifactLabel=blueprint artifactName=${blueprint_file} artifactType=DCAE_INVENTORY_BLUEPRINT artifactGroupType=DEPLOYMENT description=${blueprint_file} payloadData=${payloadData}
326 Templating.Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER}
327 ${data}= Templating.Apply Template sdc ${SDC_ARTIFACT_UPLOAD_TEMPLATE} ${dict}
328 # POST artifactUpload to resource
329 ${artifact_upload_path}= Catenate ${SDC_CATALOG_SERVICES_PATH}/${catalog_service_id}/resourceInstance/${catalog_resource_unique_id}${SDC_CATALOG_SERVICE_RESOURCE_ARTIFACT_PATH}
330 ${resp}= SDC.Run Post Request ${SDC_BE_ENDPOINT} ${artifact_upload_path} ${data} ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
331 Should Be Equal As Strings ${resp.status_code} 200
332 [Return] ${resp}
333
334
335Setup SDC Catalog Resource GenericNeutronNet Properties
336 [Documentation] Set up GenericNeutronNet properties and inputs
337 [Arguments] ${catalog_service_id} ${nf_role} ${catalog_parent_service_id}
338 ${resp}= Get SDC Catalog Resource Component Instances Properties ${catalog_service_id}
339 ${componentInstances} Set Variable @{resp['componentInstancesProperties']}
340 # componentInstances can have 1 or more than 1 entry
341 ${passed}= Run Keyword And Return Status Evaluate type(${componentInstances})
342 ${type}= Run Keyword If ${passed} Evaluate type(${componentInstances})
343 ${componentInstancesList}= Run Keyword If "${type}"!="<type 'list'>" Create List ${componentInstances}
344 ... ELSE Set Variable ${componentInstances}
345 :FOR ${item} IN @{componentInstancesList}
346 \ ${test} ${v}= Run Keyword and Ignore Error Should Contain ${item} ${nf_role}
347 \ Run Keyword If '${test}' == 'FAIL' Continue For Loop
348 \ ${componentInstance1}= Set Variable ${item}
349 :FOR ${comp} IN @{resp['componentInstancesProperties']["${componentInstance1}"]}
350 \ ${name} Set Variable ${comp['name']}
351 \ ${test} ${v}= Run Keyword and Ignore Error Should Contain ${name} network_role
352 \ Run Keyword If '${test}' == 'FAIL' Continue For Loop
353 \ ${description} Set Variable ${comp['description']}
354 \ ${description}= Replace String ${description} ${\n} \
355 \ ${uniqueId} Set Variable ${comp['uniqueId']}
356 \ ${parentUniqueId} Set Variable ${comp['parentUniqueId']}
357 \ ${ownerId} Set Variable ${comp['ownerId']}
358 \ ${dict}= Create Dictionary parentUniqueId=${parentUniqueId} ownerId=${ownerId} uniqueId=${uniqueId} description=${description}
359 \ Run Keyword If '${name}'=='network_role' Set To Dictionary ${dict} name=${name} value=${nf_role}
360 \ Templating.Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER}
361 \ ${data}= Templating.Apply Template sdc ${SDC_CATALOG_NET_RESOURCE_INPUT_TEMPLATE} ${dict}
362 \ ${response}= Set SDC Catalog Resource Component Instance Properties ${catalog_parent_service_id} ${catalog_service_id} ${data}
363
364
365Setup SDC Catalog Resource AllottedResource Properties
366 [Documentation] Set up Allotted Resource properties and inputs
367 [Arguments] ${catalog_service_id} ${nf_role} ${catalog_resource_id} ${invariantUUID} ${UUID} ${node_type}
368 # Set component instances properties
369 ${nf_role_lc}= Convert To Lowercase ${nf_role}
370 ${resp}= Get SDC Catalog Resource Component Instances Properties For Resource ${catalog_resource_id}
371 ${componentInstances} Set Variable @{resp['componentInstancesProperties']}
372 # componentInstances can have 1 or more than 1 entry
373 ${passed}= Run Keyword And Return Status Evaluate type(${componentInstances})
374 ${type}= Run Keyword If ${passed} Evaluate type(${componentInstances})
375 ${componentInstancesList}= Run Keyword If "${type}"!="<type 'list'>" Create List ${componentInstances}
376 ... ELSE Set Variable ${componentInstances}
377 :FOR ${item} IN @{componentInstancesList}
378 \ ${test} ${v}= Run Keyword and Ignore Error Should Contain ${item} ${nf_role_lc}
379 \ Run Keyword If '${test}' == 'FAIL' Continue For Loop
380 \ ${componentInstance1}= Set Variable ${item}
381 ${dict}= Create Dictionary
382 :FOR ${comp} IN @{resp['componentInstancesProperties']["${componentInstance1}"]}
383 \ ${name} Set Variable ${comp['name']}
384 \ ${test} ${v}= Run Keyword and Ignore Error Should Contain Any ${name} network_role providing_service_invariant_uuid providing_service_uuid providing_service_name uniqueId
385 \ Run Keyword If '${test}' == 'FAIL' Continue For Loop
386 \ ${parentUniqueId} Set Variable ${comp['parentUniqueId']}
387 \ ${ownerId} Set Variable ${comp['ownerId']}
388 \ Set To Dictionary ${dict} parentUniqueId=${parentUniqueId} ownerId=${ownerId}
389 \ Run Keyword If '${name}'=='providing_service_invariant_uuid' Set To Dictionary ${dict} providing_service_invariant_uuid=${invariantUUID}
390 \ Run Keyword If '${name}'=='providing_service_uuid' Set To Dictionary ${dict} providing_service_uuid=${UUID}
391 \ Run Keyword If '${name}'=='providing_service_name' Set To Dictionary ${dict} providing_service_name=${node_type}
392 # Sets it for each loop but should be one
393 \ ${uniqueId} Set Variable ${comp['uniqueId']}
394 \ ${uniqueId} Fetch From Left ${uniqueId} .
395 \ Set To Dictionary ${dict} uniqueId=${uniqueId}
396 Templating.Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER}
397 ${data}= Templating.Apply Template sdc ${SDC_CATALOG_ALLOTTED_RESOURCE_PROPERTIES_TEMPLATE} ${dict}
398 ${response}= Set SDC Catalog Resource Component Instance Properties For Resource ${catalog_resource_id} ${componentInstance1} ${data}
399 Log resp=${response}
400
401
402Setup SDC Catalog Resource AllottedResource Inputs
403 [Documentation] Set up Allotted Resource inputs
404 [Arguments] ${catalog_service_id} ${nf_role} ${catalog_resource_id}
405 # Set vnf inputs
406 ${resp}= Get SDC Catalog Resource Inputs ${catalog_resource_id}
407 ${dict}= Create Dictionary
408 :FOR ${comp} IN @{resp['inputs']}
409 \ ${name} Set Variable ${comp['name']}
410 \ ${uid} Set Variable ${comp['uniqueId']}
411 \ Run Keyword If '${name}'=='nf_type' Set To Dictionary ${dict} nf_type=${nf_role} nf_type_uid=${uid}
412 \ Run Keyword If '${name}'=='nf_role' Set To Dictionary ${dict} nf_role=${nf_role} nf_role_uid=${uid}
413 Templating.Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER}
414 ${data}= Templating.Apply Template sdc ${SDC_CATALOG_ALLOTTED_RESOURCE_INPUTS_TEMPLATE} ${dict}
415 ${response}= Set SDC Catalog Resource VNF Inputs ${catalog_resource_id} ${data}
416 [Return] ${response}
417
418Setup SDC Catalog Resource CDS Properties
419 [Documentation] Set up vfwng VNF properties and inputs for CDS
420 [Arguments] ${catalog_resource_id}
421 # Set vnf module properties
422 ${resp}= Get SDC Catalog Resource Component Instances ${catalog_resource_id}
423 :FOR ${comp} IN @{resp['componentInstances']}
424 \ ${name} Set Variable ${comp['name']}
425 \ ${uniqueId} Set Variable ${comp['uniqueId']}
426 \ ${actualComponentUid} Set Variable ${comp['actualComponentUid']}
427 \ ${test} ${v}= Run Keyword and Ignore Error Should Contain ${name} abstract_
428 \ Run Keyword If '${test}' == 'FAIL' Continue For Loop
429 \ ${response}= Get SDC Catalog Resource Component Instance Properties ${catalog_resource_id} ${uniqueId} ${actualComponentUid}
430 \ ${dict}= Create Dictionary parent_id=${response[6]['parentUniqueId']}
431 \ Run Keyword If '${name}'=='abstract_vfw' Set To Dictionary ${dict} nfc_function=vfw nfc_naming_policy=SDNC_Policy.ONAP_VFW_NAMING_TIMESTAMP
432 \ Run Keyword If '${name}'=='abstract_vpg' Set To Dictionary ${dict} nfc_function=vpg nfc_naming_policy=SDNC_Policy.ONAP_VPG_NAMING_TIMESTAMP
433 \ Run Keyword If '${name}'=='abstract_vsn' Set To Dictionary ${dict} nfc_function=vsn nfc_naming_policy=SDNC_Policy.ONAP_VSN_NAMING_TIMESTAMP
434 \ Templating.Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER}
435 \ ${data}= Templating.Apply Template sdc ${SDC_RESOURCE_INSTANCE_VNF_PROPERTIES_TEMPLATE} ${dict}
436 \ ${response}= Set SDC Catalog Resource Component Instance Properties ${catalog_resource_id} ${uniqueId} ${data}
437 \ Log resp=${response}
438
439 # Set vnf inputs
440 ${resp}= Get SDC Catalog Resource Inputs ${catalog_resource_id}
441 ${dict}= Create Dictionary
442 :FOR ${comp} IN @{resp['inputs']}
443 \ ${name} Set Variable ${comp['name']}
444 \ ${uid} Set Variable ${comp['uniqueId']}
445 \ Run Keyword If '${name}'=='nf_function' Set To Dictionary ${dict} nf_function=ONAP-FIREWALL nf_function_uid=${uid}
446 \ Run Keyword If '${name}'=='nf_type' Set To Dictionary ${dict} nf_type=FIREWALL nf_type_uid=${uid}
447 \ Run Keyword If '${name}'=='nf_naming_code' Set To Dictionary ${dict} nf_naming_code=vfw nf_naming_code_uid=${uid}
448 \ Run Keyword If '${name}'=='nf_role' Set To Dictionary ${dict} nf_role=vFW nf_role_uid=${uid}
449 \ Run Keyword If '${name}'=='cloud_env' Set To Dictionary ${dict} cloud_env=openstack cloud_env_uid=${uid}
450 Templating.Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER}
451 ${data}= Templating.Apply Template sdc ${SDC_RESOURCE_INSTANCE_VNF_INPUTS_TEMPLATE} ${dict}
452 ${response}= Set SDC Catalog Resource VNF Inputs ${catalog_resource_id} ${data}
453
454Add SDC License Model
455 [Documentation] Creates an SDC License Model and returns its id
456 ${uuid}= Generate UUID4
457 ${shortened_uuid}= Evaluate str("${uuid}")[:23]
458 ${map}= Create Dictionary vendor_name=${shortened_uuid}
459 Templating.Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER}
460 ${data}= Templating.Apply Template sdc ${SDC_LICENSE_MODEL_TEMPLATE} ${map}
461 ${resp}= SDC.Run Post Request ${SDC_BE_ONBOARD_ENDPOINT} ${SDC_VENDOR_LICENSE_MODEL_PATH} ${data} ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
462 Should Be Equal As Strings ${resp.status_code} 200
463 [Return] ${resp.json()['itemId']} ${resp.json()['version']['id']}
Krzysztof Kuzmicki888614e2020-03-06 14:06:48 +0100464
DR695Hc0cf6a42019-07-26 16:42:36 -0400465Get SDC License Model
466 [Documentation] gets an SDC license model by its id
467 [Arguments] ${id} ${version_id}=0.1
468 ${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}
469 [Return] ${resp.json()}
470
471Get SDC License Models
472 [Documentation] Gets all SDC License Models
473 ${resp}= SDC.Run Get Request ${SDC_BE_ONBOARD_ENDPOINT} ${SDC_VENDOR_LICENSE_MODEL_PATH} ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
474 [Return] ${resp.json()}
475
476Checkin SDC License Model
477 [Documentation] Checks in an SDC License Model by its id
478 [Arguments] ${id} ${version_id}=0.1
479 ${map}= Create Dictionary action=Checkin
480 Templating.Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER}
481 ${data}= Templating.Apply Template sdc ${SDC_ACTION_TEMPLATE} ${map}
482 ${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}
483 Should Be Equal As Strings ${resp.status_code} 200
484 [Return] ${resp.json()}
485
486Submit SDC License Model
487 [Documentation] Submits an SDC License Model by its id
488 [Arguments] ${id} ${version_id}=0.1
489 ${map}= Create Dictionary action=Submit
490 Templating.Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER}
491 ${data}= Templating.Apply Template sdc ${SDC_ACTION_TEMPLATE} ${map}
492 ${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}
493 [Return] ${resp.json()}
494
495Checkin SDC Software Product
496 [Documentation] Checks in an SDC Software Product by its id
497 [Arguments] ${id} ${version_id}=0.1
498 ${map}= Create Dictionary action=Checkin
499 Templating.Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER}
500 ${data}= Templating.Apply Template sdc ${SDC_ACTION_TEMPLATE} ${map}
501 ${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}
502 Should Be Equal As Strings ${resp.status_code} 200
503 [Return] ${resp.json()}
504
505Validate SDC Software Product
506 [Documentation] Validates an SDC Software Product by its id
507 [Arguments] ${id} ${version_id}=0.1
508 ${data}= Catenate
509 ${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}
510 Should Be Equal As Strings ${resp.status_code} 200
511 [Return] ${resp.json()}
512
513Submit SDC Software Product
514 [Documentation] Submits an SDC Software Product by its id
515 [Arguments] ${id} ${version_id}=0.1
516 ${map}= Create Dictionary action=Submit
517 Templating.Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER}
518 ${data}= Templating.Apply Template sdc ${SDC_ACTION_TEMPLATE} ${map}
519 ${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}
520 Should Be Equal As Strings ${resp.status_code} 200
521 [Return] ${resp.json()}
522
523Package SDC Software Product
524 [Documentation] Creates a package of an SDC Software Product by its id
525 [Arguments] ${id} ${version_id}=0.1
526 ${map}= Create Dictionary action=Create_Package
527 Templating.Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER}
528 ${data}= Templating.Apply Template sdc ${SDC_ACTION_TEMPLATE} ${map}
529 ${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}
530 Should Be Equal As Strings ${resp.status_code} 200
531 [Return] ${resp.json()}
532
533Add SDC Entitlement Pool
534 [Documentation] Creates an SDC Entitlement Pool and returns its id
535 [Arguments] ${license_model_id} ${version_id}=0.1 ${license_start_date}="01/01/1960" ${license_end_date}="01/01/1961"
536 ${uuid}= Generate UUID4
537 ${shortened_uuid}= Evaluate str("${uuid}")[:23]
538 ${map}= Create Dictionary entitlement_pool_name=${shortened_uuid} license_start_date=${license_start_date} license_end_date=${license_end_date}
539 Templating.Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER}
540 ${data}= Templating.Apply Template sdc ${SDC_ENTITLEMENT_POOL_TEMPLATE} ${map}
541 ${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}
542 Should Be Equal As Strings ${resp.status_code} 200
543 [Return] ${resp.json()['value']}
544
545Get SDC Entitlement Pool
546 [Documentation] Gets an SDC Entitlement Pool by its id
547 [Arguments] ${license_model_id} ${pool_id}
548 ${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}
549 [Return] ${resp.json()}
550
551Add SDC License Group
552 [Documentation] Creates an SDC License Group and returns its id
553 [Arguments] ${license_model_id} ${version_id}=1.0 ${license_start_date}="01/01/1960" ${license_end_date}="01/01/1961"
554 ${uuid}= Generate UUID4
555 ${shortened_uuid}= Evaluate str("${uuid}")[:23]
556 ${map}= Create Dictionary key_group_name=${shortened_uuid} license_start_date=${license_start_date} license_end_date=${license_end_date}
557 Templating.Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER}
558 ${data}= Templating.Apply Template sdc ${SDC_KEY_GROUP_TEMPLATE} ${map}
559 ${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}
560 Should Be Equal As Strings ${resp.status_code} 200
561 [Return] ${resp.json()['value']}
562
563Get SDC License Group
564 [Documentation] Gets an SDC License Group by its id
565 [Arguments] ${license_model_id} ${group_id} ${version_id}
566 ${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}
567 [Return] ${resp.json()}
568
569Add SDC Feature Group
570 [Documentation] Creates an SDC Feature Group and returns its id
571 [Arguments] ${license_model_id} ${key_group_id} ${entitlement_pool_id} ${version_id}=0.1
572 ${uuid}= Generate UUID4
573 ${shortened_uuid}= Evaluate str("${uuid}")[:23]
574 ${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}
575 Templating.Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER}
576 ${data}= Templating.Apply Template sdc ${SDC_FEATURE_GROUP_TEMPLATE} ${map}
577 ${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}
578 Should Be Equal As Strings ${resp.status_code} 200
579 [Return] ${resp.json()['value']}
580
581Get SDC Feature Group
582 [Documentation] Gets an SDC Feature Group by its id
583 [Arguments] ${license_model_id} ${group_id}
584 ${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}
585 [Return] ${resp.json()}
586
587Add SDC License Agreement
588 [Documentation] Creates an SDC License Agreement and returns its id
589 [Arguments] ${license_model_id} ${feature_group_id} ${version_id}=0.1
590 ${uuid}= Generate UUID4
591 ${shortened_uuid}= Evaluate str("${uuid}")[:23]
592 ${map}= Create Dictionary license_agreement_name=${shortened_uuid} feature_group_id=${feature_group_id}
593 Templating.Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER}
594 ${data}= Templating.Apply Template sdc ${SDC_LICENSE_AGREEMENT_TEMPLATE} ${map}
595 ${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}
596 Should Be Equal As Strings ${resp.status_code} 200
597 [Return] ${resp.json()['value']}
598
599Get SDC License Agreement
600 [Documentation] Gets an SDC License Agreement by its id
601 [Arguments] ${license_model_id} ${agreement_id}
602 ${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}
603 [Return] ${resp.json()}
604
605Add SDC Software Product
606 [Documentation] Creates an SDC Software Product and returns its id
607 [Arguments] ${license_agreement_id} ${feature_group_id} ${license_model_name} ${license_model_id} ${license_model_version_id} ${name_prefix}
608 ${uuid}= Generate UUID4
609 ${shortened_uuid}= Evaluate str("${uuid}")[:13]
610 ${software_product_name}= Catenate ${name_prefix} ${shortened_uuid}
611 ${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}
612 Templating.Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER}
613 ${data}= Templating.Apply Template sdc ${SDC_SOFTWARE_PRODUCT_TEMPLATE} ${map}
614 ${resp}= SDC.Run Post Request ${SDC_BE_ONBOARD_ENDPOINT} ${SDC_VENDOR_SOFTWARE_PRODUCT_PATH} ${data} ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
615 Should Be Equal As Strings ${resp.status_code} 200
616 [Return] ${resp.json()['itemId']} ${resp.json()['version']['id']}
617
618Get SDC Software Product
619 [Documentation] Gets an SDC Software Product by its id
620 [Arguments] ${software_product_id} ${version_id}=0.1
621 ${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}
622 [Return] ${resp.json()}
623
624Add SDC Catalog Resource
625 [Documentation] Creates an SDC Catalog Resource and returns its id
krzysztof kuzmickidadd0e62019-07-31 20:08:36 +0200626 [Arguments] ${license_agreement_id} ${software_product_name} ${license_model_name} ${software_product_id} ${resourceType}=VF
627 ${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 -0400628 Templating.Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER}
629 ${data}= Templating.Apply Template sdc ${SDC_CATALOG_RESOURCE_TEMPLATE} ${map}
630 ${resp}= SDC.Run Post Request ${SDC_BE_ENDPOINT} ${SDC_CATALOG_RESOURCES_PATH} ${data} ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
631 Should Be Equal As Strings ${resp.status_code} 201
632 [Return] ${resp.json()['uniqueId']}
633
634Add SDC Allotted Resource Catalog Resource
635 [Documentation] Creates an SDC Allotted Resource Catalog Resource and returns its id
636 [Arguments] ${license_agreement_id} ${software_product_name} ${license_model_name} ${software_product_id} ${subcategory}
637 ${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}
638 Templating.Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER}
639 ${data}= Templating.Apply Template sdc ${SDC_ALLOTTED_RESOURCE_CATALOG_RESOURCE_TEMPLATE} ${map}
640 ${resp}= SDC.Run Post Request ${SDC_BE_ENDPOINT} ${SDC_CATALOG_RESOURCES_PATH} ${data} ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
641 Should Be Equal As Strings ${resp.status_code} 201
642 [Return] ${resp.json()['uniqueId']}
643
644Mark SDC Catalog Resource Inactive
645 [Documentation] Marks SDC Catalog Resource as inactive
646 [Arguments] ${catalog_resource_id}
647 ${resp}= SDC.Run Delete Request ${SDC_BE_ENDPOINT} ${SDC_CATALOG_RESOURCES_PATH}/${catalog_resource_id} ${None} ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
648 Should Be Equal As Strings ${resp.status_code} 204
649 [Return] ${resp}
650
651Delete Inactive SDC Catalog Resources
652 [Documentation] Delete all SDC Catalog Resources that are inactive
653 ${resp}= SDC.Run Delete Request ${SDC_BE_ENDPOINT} ${SDC_CATALOG_INACTIVE_RESOURCES_PATH} ${None} ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
654 Should Be Equal As Strings ${resp.status_code} 200
655 [Return] ${resp.json()}
656
657Get SDC Catalog Resource
658 [Documentation] Gets an SDC Catalog Resource by its id
659 [Arguments] ${catalog_resource_id}
660 ${resp}= SDC.Run Get Request ${SDC_BE_ENDPOINT} ${SDC_CATALOG_RESOURCES_PATH}/${catalog_resource_id} ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
661 [Return] ${resp.json()}
662
663Get SDC Catalog Resource Component Instances
664 [Documentation] Gets component instances of an SDC Catalog Resource by its id
665 [Arguments] ${catalog_resource_id}
666 ${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}
667 [Return] ${resp.json()}
668
669Get SDC Catalog Resource Deployment Artifact Properties
670 [Documentation] Gets deployment artifact properties of an SDC Catalog Resource by its id
671 [Arguments] ${catalog_resource_id}
672 ${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}
673 [Return] ${resp.json()}
674
675
676Get SDC Catalog Resource Component Instances Properties
677 [Documentation] Gets SDC Catalog Resource component instances properties by its id
678 [Arguments] ${catalog_resource_id}
679 ${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}
680 [Return] ${resp.json()}
681
682Get SDC Catalog Resource Component Instances Properties For Resource
683 [Documentation] Gets SDC Catalog Resource component instances properties for a Resource (VF) by its id
684 [Arguments] ${catalog_resource_id}
685 ${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}
686 [Return] ${resp.json()}
687
688Get SDC Catalog Resource Inputs
689 [Documentation] Gets SDC Catalog Resource inputs by its id
690 [Arguments] ${catalog_resource_id}
691 ${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}
692 [Return] ${resp.json()}
693
694Get SDC Catalog Resource Component Instance Properties
695 [Documentation] Gets component instance properties of an SDC Catalog Resource by their ids
696 [Arguments] ${catalog_resource_id} ${component_instance_id} ${component_id}
697 ${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}
698 [Return] ${resp.json()}
699
700Set SDC Catalog Resource Component Instance Properties
701 [Documentation] Sets SDC Catalog Resource component instance properties by ids
702 [Arguments] ${catalog_resource_id} ${component_parent_service_id} ${data}
703 ${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}
704 [Return] ${resp.json()}
705
706Set SDC Catalog Resource Component Instance Properties For Resource
707 [Documentation] Sets SDC Resource component instance properties by ids
708 [Arguments] ${catalog_parent_resource_id} ${catalog_resource_id} ${data}
709 ${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}
710 [Return] ${resp.json()}
711
712Set CDS Catalog Resource Component Instance Properties
713 [Documentation] Sets CDS Catalog Resource component instance properties by ids
714 [Arguments] ${catalog_resource_id} ${component_instance_id} ${data}
715 ${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}
716 [Return] ${resp.json()}
717
718Set SDC Catalog Resource VNF Inputs
719 [Documentation] Sets VNF Inputs for an SDC Catalog Resource by its id
720 [Arguments] ${catalog_resource_id} ${data}
721 ${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}
722 [Return] ${resp.json()}
723
DR695Hcccad652019-09-16 13:21:47 -0400724Get Service Catalog
Krzysztof Kuzmicki888614e2020-03-06 14:06:48 +0100725 [Arguments] ${service_name}
DR695Hcccad652019-09-16 13:21:47 -0400726 ${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}
727 [Return] ${resp.json()}
728
DR695Hc0cf6a42019-07-26 16:42:36 -0400729Get SDC Demo Vnf Catalog Resource
730 [Documentation] Gets Resource ids of demonstration VNFs for instantiation
731 [Arguments] ${service_name}
DR695Hcccad652019-09-16 13:21:47 -0400732 ${resp}= Get Service Catalog ${service_name}
Brian Freemanc86db412019-11-13 13:18:59 -0500733 @{ITEMS}= Copy List ${resp['componentInstances']}
DR695Hc0cf6a42019-07-26 16:42:36 -0400734 ${demo_catalog_resource}= Create Dictionary
735 :FOR ${ELEMENT} IN @{ITEMS}
736 \ Log ${ELEMENT['name']}
737 \ Log ${ELEMENT['groupInstances'][0]['groupName']}
738 \ ${vnf}= Get VNF From Group Name ${ELEMENT['groupInstances'][0]['groupName']} ${service_name}
739 \ ${vnf_data}= Create Dictionary vnf_type=${ELEMENT['name']} vf_module=${ELEMENT['groupInstances'][0]['groupName']}
740 \ LOG ${vnf_data}
741 \ Set To Dictionary ${demo_catalog_resource} ${vnf}=${vnf_data}
742 \ LOG ${demo_catalog_resource}
743 [Return] ${demo_catalog_resource}
744
745Get VNF From Group Name
746 [Documentation] Looks up VNF key from service mapping for a regex on group_name and service_name
747 [Arguments] ${group_name} ${service_name}
748 ${vnf}= Set Variable If
749 ... ('${service_name}'=='demoVFWCL') and ('base_vfw' in '${group_name}') vFWCLvFWSNK
750 ... ('${service_name}'=='demoVFWCL') and ('base_vpkg' in '${group_name}') vFWCLvPKG
751 ... ('${service_name}'=='demoVLB') and ('base_vlb' in '${group_name}') vLB
752 [Return] ${vnf}
753
754Checkin SDC Catalog Resource
755 [Documentation] Checks in an SDC Catalog Resource by its id
756 [Arguments] ${catalog_resource_id}
757 ${map}= Create Dictionary user_remarks=Robot remarks
758 Templating.Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER}
759 ${data}= Templating.Apply Template sdc ${SDC_USER_REMARKS_TEMPLATE} ${map}
760 ${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}
761 Should Be Equal As Strings ${resp.status_code} 200
762 [Return] ${resp.json()}
763
DR695Hc0cf6a42019-07-26 16:42:36 -0400764Certify SDC Catalog Resource
kaihlavia724b232019-08-07 12:37:17 +0300765 [Documentation] Certifies an SDC Catalog Resource by its id and returns the new uniqueId and uuid
Brian Freemancc3c8692020-03-05 15:53:41 -0500766 [Arguments] ${catalog_resource_id} ${user_id}=${SDC_DESIGNER_USER_ID}
DR695Hc0cf6a42019-07-26 16:42:36 -0400767 ${map}= Create Dictionary user_remarks=Robot remarks
768 Templating.Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER}
769 ${data}= Templating.Apply Template sdc ${SDC_USER_REMARKS_TEMPLATE} ${map}
770 ${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}
771 Should Be Equal As Strings ${resp.status_code} 200
kaihlavia724b232019-08-07 12:37:17 +0300772 [Return] ${resp.json()['uniqueId']} ${resp.json()['uuid']}
DR695Hc0cf6a42019-07-26 16:42:36 -0400773
774Upload SDC Heat Package
775 [Documentation] Creates an SDC Software Product and returns its id
776 [Arguments] ${software_product_id} ${file_path} ${version_id}=0.1
777 ${files}= Create Dictionary
778 Create Multi Part ${files} upload ${file_path} contentType=application/zip
779 ${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}
780 Should Be Equal As Strings ${resp.status_code} 200
781
782Add SDC Catalog Service
783 [Documentation] Creates an SDC Catalog Service and returns its id
krzysztof kuzmickidadd0e62019-07-31 20:08:36 +0200784 [Arguments] ${catalog_service_name} ${instantiationType}=A-la-carte
DR695Hc0cf6a42019-07-26 16:42:36 -0400785 ${uuid}= Generate UUID4
786 ${shortened_uuid}= Evaluate str("${uuid}")[:23]
787 ${catalog_service_name}= Set Variable If '${catalog_service_name}' =='' ${shortened_uuid} ${catalog_service_name}
krzysztof kuzmickidadd0e62019-07-31 20:08:36 +0200788 ${map}= Create Dictionary service_name=${catalog_service_name} instantiation_type=${instantiationType}
DR695Hc0cf6a42019-07-26 16:42:36 -0400789 Templating.Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER}
790 ${data}= Templating.Apply Template sdc ${SDC_CATALOG_SERVICE_TEMPLATE} ${map}
791 ${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 -0500792 Run Keyword If ('${resp.status_code}'=='409') Log ${\n} ${catalog_service_name} Service Already Exists console=yes
DR695Hc0cf6a42019-07-26 16:42:36 -0400793 Should Be Equal As Strings ${resp.status_code} 201
794 [Return] ${resp.json()['uniqueId']}
795
796Mark SDC Catalog Service Inactive
797 [Documentation] Deletes an SDC Catalog Service
798 [Arguments] ${catalog_service_id}
799 ${resp}= SDC.Run Delete Request ${SDC_BE_ENDPOINT} ${SDC_CATALOG_SERVICES_PATH}/${catalog_service_id} ${None} ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
800 Should Be Equal As Strings ${resp.status_code} 204
801 [Return] ${resp}
802
803Delete Inactive SDC Catalog Services
804 [Documentation] Delete all SDC Catalog Services that are inactive
805 ${resp}= SDC.Run Delete Request ${SDC_BE_ENDPOINT} ${SDC_CATALOG_INACTIVE_SERVICES_PATH} ${None} ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
806 Should Be Equal As Strings ${resp.status_code} 200
807 [Return] ${resp.json()}
808
809Get SDC Catalog Service
810 [Documentation] Gets an SDC Catalog Service by its id
811 [Arguments] ${catalog_service_id}
812 ${resp}= SDC.Run Get Request ${SDC_BE_ENDPOINT} ${SDC_CATALOG_SERVICES_PATH}/${catalog_service_id} ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
813 [Return] ${resp.json()}
814
815Checkin SDC Catalog Service
816 [Documentation] Checks in an SDC Catalog Service by its id
817 [Arguments] ${catalog_service_id}
818 ${map}= Create Dictionary user_remarks=Robot remarks
819 Templating.Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER}
820 ${data}= Templating.Apply Template sdc ${SDC_USER_REMARKS_TEMPLATE} ${map}
821 ${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}
822 Should Be Equal As Strings ${resp.status_code} 200
823 [Return] ${resp.json()}
824
DR695Hc0cf6a42019-07-26 16:42:36 -0400825Certify SDC Catalog Service
826 [Documentation] Certifies an SDC Catalog Service by its id and returns the new id
827 [Arguments] ${catalog_service_id}
828 ${map}= Create Dictionary user_remarks=Robot remarks
829 Templating.Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER}
830 ${data}= Templating.Apply Template sdc ${SDC_USER_REMARKS_TEMPLATE} ${map}
Brian Freemancc3c8692020-03-05 15:53:41 -0500831 ${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 -0400832 Should Be Equal As Strings ${resp.status_code} 200
833 [Return] ${resp.json()['uniqueId']}
834
DR695Hc0cf6a42019-07-26 16:42:36 -0400835Distribute SDC Catalog Service
836 [Documentation] distribute an SDC Catalog Service by its id
837 [Arguments] ${catalog_service_id}
Brian Freemancc3c8692020-03-05 15:53:41 -0500838 ${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 -0400839 Should Be Equal As Strings ${resp.status_code} 200
840 [Return] ${resp.json()}
841
842Add SDC Resource Instance
kaihlavia724b232019-08-07 12:37:17 +0300843 [Documentation] Creates an SDC Resource Instance and returns its id and name
DR695Hc0cf6a42019-07-26 16:42:36 -0400844 [Arguments] ${catalog_service_id} ${catalog_resource_id} ${catalog_resource_name} ${xoffset}=${0} ${yoffset}=${0} ${resourceType}=VF
845 ${milli_timestamp}= Generate Timestamp
846 ${xoffset}= Set Variable ${xoffset+306}
847 ${yoffset}= Set Variable ${yoffset+248}
848 ${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}
849 Templating.Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER}
850 ${data}= Templating.Apply Template sdc ${SDC_RESOURCE_INSTANCE_TEMPLATE} ${map}
851 ${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}
852 Should Be Equal As Strings ${resp.status_code} 201
kaihlavia724b232019-08-07 12:37:17 +0300853 [Return] ${resp.json()['uniqueId']} ${resp.json()['name']}
DR695Hc0cf6a42019-07-26 16:42:36 -0400854
855Add SDC Resource Instance To Resource
856 [Documentation] Creates an SDC Resource Instance in a Resource (VF) and returns its id
857 [Arguments] ${parent_catalog_resource_id} ${catalog_resource_id} ${catalog_resource_name} ${xoffset}=${0} ${yoffset}=${0} ${resourceType}=VF
858 ${milli_timestamp}= Generate Timestamp
859 ${xoffset}= Set Variable ${xoffset+306}
860 ${yoffset}= Set Variable ${yoffset+248}
861 ${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}
862 Templating.Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER}
863 ${data}= Templating.Apply Template sdc ${SDC_RESOURCE_INSTANCE_TEMPLATE} ${map}
864 ${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}
865 Should Be Equal As Strings ${resp.status_code} 201
866 [Return] ${resp.json()['uniqueId']}
867
868Get Catalog Service Distribution
869 [Documentation] Gets an SDC Catalog Service distribution
870 [Arguments] ${catalog_service_uuid}
Brian Freemancc3c8692020-03-05 15:53:41 -0500871 ${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 -0400872 Should Be Equal As Strings ${resp.status_code} 200
873 [Return] ${resp.json()}
874
875Check Catalog Service Distributed
876 [Documentation] Checks if an SDC Catalog Service is distributed
877 [Arguments] ${catalog_service_uuid} ${dist_status}
878 ${dist_resp}= Get Catalog Service Distribution ${catalog_service_uuid}
879 Should Be Equal As Strings ${dist_resp['distributionStatusOfServiceList'][0]['deployementStatus']} Distributed
880 ${det_resp}= Get Catalog Service Distribution Details ${dist_resp['distributionStatusOfServiceList'][0]['distributionID']}
881 @{ITEMS}= Copy List ${det_resp['distributionStatusList']}
882 Should Not Be Empty ${ITEMS}
883 ${SO_COMPLETE} Set Variable FALSE
884 ${dist_status} Set Variable CONTINUE
885 Should Not Be Empty ${ITEMS}
886 :FOR ${ELEMENT} IN @{ITEMS}
887 \ Log ${ELEMENT['omfComponentID']}
888 \ Log ${ELEMENT['status']}
889 \ ${SO_COMPLETE} Set Variable If (('${ELEMENT['status']}' == 'DISTRIBUTION_COMPLETE_OK')) or ('${SO_COMPLETE}'=='TRUE') TRUE
890 \ Exit For Loop If ('${SO_COMPLETE}'=='TRUE')
Brian Freemand1339742019-10-07 11:37:14 -0500891 \ Run Keyword If ('${ELEMENT['status']}' == 'DISTRIBUTION_COMPLETE_ERROR') Fatal Error "SO DISTRIBUTION_COMPLETE_ERROR"
DR695Hc0cf6a42019-07-26 16:42:36 -0400892 \ ${dist_status}= Set Variable If (('${ELEMENT['status']}' == 'COMPONENT_DONE_ERROR') and ('${ELEMENT['omfComponentID']}' == 'aai-ml')) EXIT
893 \ Exit For Loop If (('${ELEMENT['status']}' == 'COMPONENT_DONE_ERROR') and ('${ELEMENT['omfComponentID']}' == 'aai-ml'))
894 Should Be True ( '${SO_COMPLETE}'=='TRUE') SO Test
895
896Get Catalog Service Distribution Details
897 [Documentation] Gets SDC Catalog Service distribution details
898 [Arguments] ${catalog_service_distribution_id}
Brian Freemancc3c8692020-03-05 15:53:41 -0500899 ${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 -0400900 Should Be Equal As Strings ${resp.status_code} 200
901 [Return] ${resp.json()}
Krzysztof Kuzmicki888614e2020-03-06 14:06:48 +0100902
DR695Hc0cf6a42019-07-26 16:42:36 -0400903Run SDC Health Check
904 [Documentation] Runs a SDC health check
905 ${resp}= SDC.Run Get Request ${SDC_FE_ENDPOINT} ${SDC_HEALTH_CHECK_PATH} user=${None}
906 # only test for HTTP 200 to determine SDC Health. SDC_DE_HEALTH is informational
907 Should Be Equal As Strings ${resp.status_code} 200 SDC DOWN
908 ${SDC_DE_HEALTH}= Catenate DOWN
909 @{ITEMS}= Copy List ${resp.json()['componentsInfo']}
910 :FOR ${ELEMENT} IN @{ITEMS}
911 \ Log ${ELEMENT['healthCheckStatus']}
912 \ ${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 -0400913 Log (DMaaP:${SDC_DE_HEALTH}) console=True
DR695Hc0cf6a42019-07-26 16:42:36 -0400914
915Open SDC GUI
916 [Documentation] Logs in to SDC GUI
917 [Arguments] ${PATH}
918 ## Setup Browever now being managed by the test case
919 ##Setup Browser
920 Go To ${SDC_FE_ENDPOINT}${PATH}
921 Maximize Browser Window
922
923 Set Browser Implicit Wait ${GLOBAL_SELENIUM_BROWSER_IMPLICIT_WAIT}
924 Log Logging in to ${SDC_FE_ENDPOINT}${PATH}
925 Title Should Be SDC
926 Wait Until Page Contains Element xpath=//div/a[text()='SDC'] ${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT}
927 Log Logged in to ${SDC_FE_ENDPOINT}${PATH}
928
929
930Create Multi Part
931 [Arguments] ${addTo} ${partName} ${filePath} ${contentType}=${None}
932 ${fileData}= Get Binary File ${filePath}
933 ${fileDir} ${fileName}= Split Path ${filePath}
934 ${partData}= Create List ${fileName} ${fileData} ${contentType}
935 Set To Dictionary ${addTo} ${partName}=${partData}
936
937
kaihlavia724b232019-08-07 12:37:17 +0300938Add CDS Parameters
939 [Arguments] ${catalog_service_name}
DR695Hc0cf6a42019-07-26 16:42:36 -0400940 ${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 -0400941 ${service_uuid}= Set Variable ${resp.json()['uniqueId']}
942 ${component_uuid}= Set Variable ${resp.json()['componentInstances'][0]['uniqueId']}
Abdelmuhaimen Seaudi498057b2019-08-02 18:36:00 +0000943 ${skip_post_instatiation}= Set Variable If '${catalog_service_name}' == "demoVLB_CDS" false true
DR695Hc0cf6a42019-07-26 16:42:36 -0400944 @{inputs}= Copy List ${resp.json()['componentInstances'][0]['inputs']}
945 :FOR ${input} IN @{inputs}
Abdelmuhaimen Seaudi498057b2019-08-02 18:36:00 +0000946 \ Run Keyword If '${input['name']}' == "sdnc_artifact_name" Set Input Parameter ${service_uuid} ${component_uuid} ${input} string vnf
hanybaki3bee75e2019-10-14 17:43:47 +0200947 ... ELSE IF '${input['name']}' == "sdnc_model_name" Set Input Parameter ${service_uuid} ${component_uuid} ${input} string vLB_CDS
DR695H0ccf9e32019-08-06 17:28:56 -0400948 ... ELSE IF '${input['name']}' == "sdnc_model_version" Set Input Parameter ${service_uuid} ${component_uuid} ${input} string 1.0.0
949 ... 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 -0400950
kaihlavia724b232019-08-07 12:37:17 +0300951
952Set Input Parameter
Krzysztof Kuzmicki888614e2020-03-06 14:06:48 +0100953 [Arguments] ${service_uuid} ${component_uuid} ${input} ${input_type} ${input_value}
krzysztof kuzmickidadd0e62019-07-31 20:08:36 +0200954 ${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 -0400955 Should Be Equal As Strings ${resp.status_code} 200
krzysztof kuzmickidadd0e62019-07-31 20:08:36 +0200956
957
958Get Service Model Parameter from SDC Service Catalog
959 [Documentation] Returns Service Model UUID
960 [Arguments] ${service_name} ${parameter_name}
961 ${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}
962 ${json_resp}= Set Variable ${resp.json()}
963 ${parameter_value}= Set Variable ${json_resp["${parameter_name}"]}
Abdelmuhaimen Seaudi498057b2019-08-02 18:36:00 +0000964 [Return] ${parameter_value}
kaihlavia724b232019-08-07 12:37:17 +0300965
966Onboard DCAE Microservice
967 [Documentation] Create DCAE Microservice with a given name, add Tosca artifacts to it and certify it
968 ... Return the unique_id and uuid of the certified VF
969 [Arguments] ${test_vf_name}
970 ${data}= Create SDC Catalog Resource For DCAE Component MicroService Data ${test_vf_name} TestVendor
971 ${resp}= SDC.Run Post Request ${SDC_BE_ENDPOINT} ${SDC_CATALOG_RESOURCES_PATH} ${data} ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
972 Should Be Equal As Strings ${resp.status_code} 201
973
974 ${vf_unique_id}= Set Variable ${resp.json()['uniqueId']}
975
976 Add Tosca Artifact to Resource template ${vf_unique_id}
977 Add Tosca Artifact to Resource translate ${vf_unique_id}
978 Add Tosca Artifact to Resource schema ${vf_unique_id}
979
Brian Freeman4c540162020-03-10 15:20:18 -0500980 ${cert_vf_unique_id} ${cert_vf_uuid} Wait Until Keyword Succeeds 60s 10s Certify SDC Catalog Resource ${vf_unique_id} ${SDC_DESIGNER_USER_ID}
kaihlavia724b232019-08-07 12:37:17 +0300981 [return] ${cert_vf_unique_id} ${cert_vf_uuid}
982
983Create SDC Catalog Resource For DCAE Component MicroService Data
984 [Documentation] Creates and returns data for DCAE Component MicroService SDC Catalog Resource
985 [Arguments] ${resource_name} ${vendor_name}
986 ${map}= Create Dictionary resource_name=${resource_name} vendor_name=${vendor_name}
987 Templating.Create Environment sdc_dcaed ${GLOBAL_TEMPLATE_FOLDER}
988 ${data}= Templating.Apply Template sdc_dcaed ${SDC_DCAE_COMPONENT_MICROSERVICE_TEMPLATE} ${map}
989 [Return] ${data}
990
991Add Tosca Artifact To Resource
992 [Documentation] Add Tosca artifacts to given resource id
993 [Arguments] ${artifact} ${vf_id}
994 ${blueprint_data} OperatingSystem.Get File ${SDC_CATALOG_DEPLOYMENT_ARTIFACT_PATH}${artifact}.yaml
995 ${payloadData}= Base64 Encode ${blueprint_data}
996 ${dict}= Create Dictionary artifactLabel=${artifact} artifactName=${artifact}.yaml artifactType=DCAE_TOSCA artifactGroupType=DEPLOYMENT description=${artifact}.yaml payloadData=${payloadData}
997 Templating.Create Environment sdc_artifact_upload ${GLOBAL_TEMPLATE_FOLDER}
998 ${data}= Templating.Apply Template sdc_artifact_upload ${SDC_ARTIFACT_UPLOAD_TEMPLATE} ${dict}
999 # POST artifactUpload to resource
1000 ${resp}= SDC.Run Post Request ${SDC_BE_ENDPOINT} ${SDC_CATALOG_RESOURCES_PATH}/${vf_id}/artifacts ${data} ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
1001 Should Be Equal As Strings ${resp.status_code} 200
1002 [Return] ${resp}
1003
1004Add Catalog Service For Monitoring Template
1005 [Documentation] Creates SDC Catalog Service for Monitoring Template with given name
1006 [Arguments] ${service_name}
1007 ${map}= Create Dictionary service_name=${service_name}
1008 Templating.Create Environment sdc_catalog_service ${GLOBAL_TEMPLATE_FOLDER}
1009 ${data}= Templating.Apply Template sdc_catalog_service ${SDC_CATALOG_SERVICE_MONITORING_TEMPLATE} ${map}
1010 ${resp}= SDC.Run Post Request ${SDC_BE_ENDPOINT} ${SDC_CATALOG_SERVICES_PATH} ${data} ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION}
1011 Should Be Equal As Strings ${resp.status_code} 201
1012 [Return] ${resp.json()['uniqueId']} ${resp.json()['uuid']}
1013
1014Generate Unique Postfix
1015 [Documentation] Create and return unique postfix to be used in various unique names
1016 ${tmp_id} = Generate Timestamp
1017 ${tmp_str} = Convert To String ${tmp_id}
1018 [return] ${tmp_str}
1019
1020Certify And Approve SDC Catalog Service
1021 [Documentation] Perform the required steps to certify and approve the given SDC catalog service
1022 [Arguments] ${cs_unique_id}
kaihlavia724b232019-08-07 12:37:17 +03001023 Checkin SDC Catalog Service ${cs_unique_id}
Brian Freeman4c540162020-03-10 15:20:18 -05001024 ${cert_cs_unique_id}= Wait Until Keyword Succeeds 60s 10s Certify SDC Catalog Service ${cs_unique_id}
kaihlavia724b232019-08-07 12:37:17 +03001025
1026Create Monitoring Configuration
1027 [Documentation] Create a monitoring configuration for a given service based on a previously created VFCMT
1028 ... Return the unique_id and uuid of the created catalog service for the monitoring configuration
1029 ... and the name of the related VFCMT instance
1030 [Arguments] ${service_name} ${vf_unique_id} ${vf_name}
1031 ${cs_unique_id} ${cs_uuid} Add Catalog Service For Monitoring Template ${service_name}
1032 ${vfi_uuid} ${vfi_name} Add SDC Resource Instance ${cs_unique_id} ${vf_unique_id} ${vf_name}
1033 [return] ${cs_unique_id} ${cs_uuid} ${vfi_name}
1034