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