bf851d821c1a6b9fe684e34a9743aa4c6cd760d6
[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 Resource          global_properties.robot
10 Resource          browser_setup.robot
11 Resource          json_templater.robot
12 *** Variables ***
13 ${ASDC_DESIGNER_USER_ID}    cs0008
14 ${ASDC_TESTER_USER_ID}    jm0007
15 ${ASDC_GOVERNOR_USER_ID}    gv0001
16 ${ASDC_OPS_USER_ID}    op0001
17 ${ASDC_HEALTH_CHECK_PATH}    /sdc1/rest/healthCheck
18 ${ASDC_VENDOR_LICENSE_MODEL_PATH}    /onboarding-api/v1.0/vendor-license-models
19 ${ASDC_VENDOR_SOFTWARE_PRODUCT_PATH}    /onboarding-api/v1.0/vendor-software-products
20 ${ASDC_VENDOR_KEY_GROUP_PATH}    /license-key-groups
21 ${ASDC_VENDOR_ENTITLEMENT_POOL_PATH}    /entitlement-pools
22 ${ASDC_VENDOR_FEATURE_GROUP_PATH}    /feature-groups
23 ${ASDC_VENDOR_LICENSE_AGREEMENT_PATH}    /license-agreements
24 ${ASDC_VENDOR_ACTIONS_PATH}    /actions
25 ${ASDC_VENDOR_SOFTWARE_UPLOAD_PATH}    /orchestration-template-candidate
26 ${ASDC_CATALOG_RESOURCES_PATH}    /sdc2/rest/v1/catalog/resources
27 ${ASDC_CATALOG_SERVICES_PATH}    /sdc2/rest/v1/catalog/services
28 ${ASDC_CATALOG_INACTIVE_RESOURCES_PATH}    /sdc2/rest/v1/inactiveComponents/resource
29 ${ASDC_CATALOG_INACTIVE_SERVICES_PATH}    /sdc2/rest/v1/inactiveComponents/service
30 ${ASDC_CATALOG_LIFECYCLE_PATH}    /lifecycleState
31 ${ASDC_CATALOG_SERVICE_RESOURCE_INSTANCE_PATH}    /resourceInstance
32 ${ASDC_CATALOG_SERVICE_DISTRIBUTION_STATE_PATH}    /distribution-state
33 ${ASDC_CATALOG_SERVICE_DISTRIBUTION_PATH}    /distribution
34 ${ASDC_DISTRIBUTION_STATE_APPROVE_PATH}    /approve
35 ${ASDC_CATALOG_SERVICE_DISTRIBUTION_ACTIVATE_PATH}    /distribution/PROD/activate
36 ${ASDC_LICENSE_MODEL_TEMPLATE}    robot/assets/templates/asdc/license_model.template
37 ${ASDC_KEY_GROUP_TEMPLATE}    robot/assets/templates/asdc/key_group.template
38 ${ASDC_ENTITLEMENT_POOL_TEMPLATE}    robot/assets/templates/asdc/entitlement_pool.template
39 ${ASDC_FEATURE_GROUP_TEMPLATE}    robot/assets/templates/asdc/feature_group.template
40 ${ASDC_LICENSE_AGREEMENT_TEMPLATE}    robot/assets/templates/asdc/license_agreement.template
41 ${ASDC_ACTION_TEMPLATE}    robot/assets/templates/asdc/action.template
42 ${ASDC_SOFTWARE_PRODUCT_TEMPLATE}    robot/assets/templates/asdc/software_product.template
43 ${ASDC_CATALOG_RESOURCE_TEMPLATE}    robot/assets/templates/asdc/catalog_resource.template
44 ${ASDC_USER_REMARKS_TEMPLATE}    robot/assets/templates/asdc/user_remarks.template
45 ${ASDC_CATALOG_SERVICE_TEMPLATE}    robot/assets/templates/asdc/catalog_service.template
46 ${ASDC_RESOURCE_INSTANCE_TEMPLATE}    robot/assets/templates/asdc/resource_instance.template
47 *** Keywords ***
48 Distribute Model From ASDC
49     [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
50     [Arguments]    ${model_zip_path}   ${catalog_service_name}=
51     ${catalog_service_id}=    Add ASDC Catalog Service    ${catalog_service_name}
52     ${catalog_resource_ids}=    Create List
53     : FOR    ${zip}     IN     @{model_zip_path}
54     \    ${loop_catalog_resource_id}=    Setup ASDC Catalog Resource    ${zip}
55     \    Append To List    ${catalog_resource_ids}   ${loop_catalog_resource_id}
56     \    ${loop_catalog_resource_resp}=    Get ASDC Catalog Resource    ${loop_catalog_resource_id}
57     \    Add ASDC Resource Instance    ${catalog_service_id}    ${loop_catalog_resource_id}    ${loop_catalog_resource_resp['name']}
58     ${catalog_service_resp}=    Get ASDC Catalog Service    ${catalog_service_id}
59     Checkin ASDC Catalog Service    ${catalog_service_id}
60     Request Certify ASDC Catalog Service    ${catalog_service_id}
61     Start Certify ASDC Catalog Service    ${catalog_service_id}
62     # on certify it gets a new id
63     ${catalog_service_id}=    Certify ASDC Catalog Service    ${catalog_service_id}
64     Approve ASDC Catalog Service    ${catalog_service_id}
65         Distribute ASDC Catalog Service    ${catalog_service_id}
66         ${catalog_service_resp}=    Get ASDC Catalog Service    ${catalog_service_id}
67         ${vf_module}=    Find Element In Array    ${loop_catalog_resource_resp['groups']}    type    org.openecomp.groups.VfModule
68     [Return]    ${catalog_service_resp['name']}    ${loop_catalog_resource_resp['name']}    ${vf_module}   ${catalog_resource_ids}    ${catalog_service_id}
69         Check Catalog Service Distributed    ${catalog_service_resp['uuid']}
70 Setup ASDC Catalog Resource
71     [Documentation]    Creates all the steps a vf needs for an asdc catalog resource and returns the id
72     [Arguments]    ${model_zip_path}
73     ${license_model_id}=    Add ASDC License Model
74     ${key_group_id}=    Add ASDC License Group    ${license_model_id}
75     ${pool_id}=    Add ASDC Entitlement Pool    ${license_model_id}
76     ${feature_group_id}=    Add ASDC Feature Group    ${license_model_id}    ${key_group_id}    ${pool_id}
77     ${license_agreement_id}=    Add ASDC License Agreement    ${license_model_id}    ${feature_group_id}
78     Checkin ASDC License Model    ${license_model_id}
79     Submit ASDC License Model    ${license_model_id}
80     ${license_model_resp}=    Get ASDC License Model    ${license_model_id}   1.0
81     ${software_product_id}=    Add ASDC Software Product    ${license_agreement_id}    ${feature_group_id}    ${license_model_resp['vendorName']}    ${license_model_id}
82     Upload ASDC Heat Package    ${software_product_id}    ${model_zip_path}
83     Validate ASDC Software Product    ${software_product_id}
84     Checkin ASDC Software Product    ${software_product_id}
85     Submit ASDC Software Product    ${software_product_id}
86     Package ASDC Software Product    ${software_product_id}
87     ${software_product_resp}=    Get ASDC Software Product    ${software_product_id}   1.0
88     ${catalog_resource_id}=    Add ASDC Catalog Resource     ${license_agreement_id}    ${software_product_resp['name']}    ${license_model_resp['vendorName']}    ${software_product_id}
89     Checkin ASDC Catalog Resource    ${catalog_resource_id}
90     Request Certify ASDC Catalog Resource    ${catalog_resource_id}
91     Start Certify ASDC Catalog Resource    ${catalog_resource_id}
92     # on certify it gets a new id
93     [Return]    ${catalog_resource_id}
94     ${catalog_resource_id}=    Certify ASDC Catalog Resource    ${catalog_resource_id}
95 Add ASDC License Model
96     [Documentation]    Creates an asdc license model and returns its id
97     ${uuid}=    Generate UUID
98     ${shortened_uuid}=     Evaluate    str("${uuid}")[:23]
99     ${map}=    Create Dictionary    vendor_name=${shortened_uuid}
100     ${data}=   Fill JSON Template File    ${ASDC_LICENSE_MODEL_TEMPLATE}    ${map}
101     ${resp}=    Run ASDC Post Request    ${ASDC_VENDOR_LICENSE_MODEL_PATH}    ${data}
102     Should Be Equal As Strings  ${resp.status_code}     200
103     [Return]    ${resp.json()['value']}
104 Get ASDC License Model
105     [Documentation]    gets an asdc license model by its id
106     [Arguments]    ${id}   ${version_id}=0.1
107     ${resp}=    Run ASDC Get Request    ${ASDC_VENDOR_LICENSE_MODEL_PATH}/${id}/versions/${version_id}
108     [Return]    ${resp.json()}
109 Get ASDC License Models
110     [Documentation]    gets an asdc license model by its id
111     ${resp}=    Run ASDC Get Request    ${ASDC_VENDOR_LICENSE_MODEL_PATH}
112     [Return]    ${resp.json()}
113 Checkin ASDC License Model
114     [Documentation]    checksin an asdc license model by its id
115     [Arguments]    ${id}   ${version_id}=0.1
116     ${map}=    Create Dictionary    action=Checkin
117     ${data}=   Fill JSON Template File    ${ASDC_ACTION_TEMPLATE}    ${map}
118     ${resp}=    Run ASDC Put Request    ${ASDC_VENDOR_LICENSE_MODEL_PATH}/${id}/versions/${version_id}${ASDC_VENDOR_ACTIONS_PATH}    ${data}
119     Should Be Equal As Strings  ${resp.status_code}     200
120     [Return]    ${resp.json()}
121 Submit ASDC License Model
122     [Documentation]    submits an asdc license model by its id
123     [Arguments]    ${id}   ${version_id}=0.1
124     ${map}=    Create Dictionary    action=Submit
125     ${data}=   Fill JSON Template File    ${ASDC_ACTION_TEMPLATE}    ${map}
126     ${resp}=    Run ASDC Put Request    ${ASDC_VENDOR_LICENSE_MODEL_PATH}/${id}/versions/${version_id}${ASDC_VENDOR_ACTIONS_PATH}    ${data}
127     Should Be Equal As Strings  ${resp.status_code}     200
128     [Return]    ${resp.json()}
129 Checkin ASDC Software Product
130     [Documentation]    checksin an asdc Software Product by its id
131     [Arguments]    ${id}   ${version_id}=0.1
132     ${map}=    Create Dictionary    action=Checkin
133     ${data}=   Fill JSON Template File    ${ASDC_ACTION_TEMPLATE}    ${map}
134     ${resp}=    Run ASDC Put Request    ${ASDC_VENDOR_SOFTWARE_PRODUCT_PATH}/${id}/versions/${version_id}${ASDC_VENDOR_ACTIONS_PATH}    ${data}
135     Should Be Equal As Strings  ${resp.status_code}     200
136     [Return]    ${resp.json()}
137 Validate ASDC Software Product
138     [Documentation]    checksin an asdc Software Product by its id
139     [Arguments]    ${id}   ${version_id}=0.1
140     ${data}=   Catenate
141     ${resp}=    Run ASDC Put Request    ${ASDC_VENDOR_SOFTWARE_PRODUCT_PATH}/${id}/versions/${version_id}/orchestration-template-candidate/process    ${data}
142     Should Be Equal As Strings  ${resp.status_code}     200
143     [Return]    ${resp.json()}
144 Submit ASDC Software Product
145     [Documentation]    submits an asdc Software Product by its id
146     [Arguments]    ${id}   ${version_id}=0.1
147     ${map}=    Create Dictionary    action=Submit
148     ${data}=   Fill JSON Template File    ${ASDC_ACTION_TEMPLATE}    ${map}
149     ${resp}=    Run ASDC Put Request    ${ASDC_VENDOR_SOFTWARE_PRODUCT_PATH}/${id}/versions/${version_id}${ASDC_VENDOR_ACTIONS_PATH}    ${data}
150     Should Be Equal As Strings  ${resp.status_code}     200
151     [Return]    ${resp.json()}
152 Package ASDC Software Product
153     [Documentation]    creates_package on an asdc Software Product by its id
154     [Arguments]    ${id}   ${version_id}=0.1
155     ${map}=    Create Dictionary    action=Create_Package
156     ${data}=   Fill JSON Template File    ${ASDC_ACTION_TEMPLATE}    ${map}
157     ${resp}=    Run ASDC Put Request    ${ASDC_VENDOR_SOFTWARE_PRODUCT_PATH}/${id}/versions/${version_id}${ASDC_VENDOR_ACTIONS_PATH}    ${data}
158     Should Be Equal As Strings  ${resp.status_code}     200
159     [Return]    ${resp.json()}
160 Add ASDC Entitlement Pool
161     [Documentation]    Creates an asdc Entitlement Pool and returns its id
162     [Arguments]    ${license_model_id}   ${version_id}=0.1
163     ${uuid}=    Generate UUID
164     ${shortened_uuid}=     Evaluate    str("${uuid}")[:23]
165     ${map}=    Create Dictionary    entitlement_pool_name=${shortened_uuid}
166     ${data}=   Fill JSON Template File    ${ASDC_ENTITLEMENT_POOL_TEMPLATE}    ${map}
167     ${resp}=    Run ASDC Post Request    ${ASDC_VENDOR_LICENSE_MODEL_PATH}/${license_model_id}/versions/${version_id}${ASDC_VENDOR_ENTITLEMENT_POOL_PATH}     ${data}
168     Should Be Equal As Strings  ${resp.status_code}     200
169     [Return]    ${resp.json()['value']}
170 Get ASDC Entitlement Pool
171     [Documentation]    gets an asdc Entitlement Pool by its id
172     [Arguments]    ${license_model_id}    ${pool_id}
173     ${resp}=    Run ASDC Get Request    ${ASDC_VENDOR_LICENSE_MODEL_PATH}/${license_model_id}${ASDC_VENDOR_ENTITLEMENT_POOL_PATH}/${pool_id}
174     [Return]    ${resp.json()}
175 Add ASDC License Group
176     [Documentation]    Creates an asdc license group and returns its id
177     [Arguments]    ${license_model_id}   ${version_id}=0.1
178     ${uuid}=    Generate UUID
179     ${shortened_uuid}=     Evaluate    str("${uuid}")[:23]
180     ${map}=    Create Dictionary    key_group_name=${shortened_uuid}
181     ${data}=   Fill JSON Template File    ${ASDC_KEY_GROUP_TEMPLATE}    ${map}
182     ${resp}=    Run ASDC Post Request    ${ASDC_VENDOR_LICENSE_MODEL_PATH}/${license_model_id}/versions/${version_id}${ASDC_VENDOR_KEY_GROUP_PATH}     ${data}
183     Should Be Equal As Strings  ${resp.status_code}     200
184     [Return]    ${resp.json()['value']}
185 Get ASDC License Group
186     [Documentation]    gets an asdc license group by its id
187     [Arguments]    ${license_model_id}    ${group_id}      ${version_id}
188     ${resp}=    Run ASDC Get Request    ${ASDC_VENDOR_LICENSE_MODEL_PATH}/${license_model_id}/versions/${version_id}${ASDC_VENDOR_KEY_GROUP_PATH}/${group_id}
189     [Return]    ${resp.json()}
190 Add ASDC Feature Group
191     [Documentation]    Creates an asdc Feature Group and returns its id
192     [Arguments]    ${license_model_id}    ${key_group_id}    ${entitlement_pool_id}      ${version_id}=0.1
193     ${uuid}=    Generate UUID
194     ${shortened_uuid}=     Evaluate    str("${uuid}")[:23]
195     ${map}=    Create Dictionary    feature_group_name=${shortened_uuid}    key_group_id=${key_group_id}    entitlement_pool_id=${entitlement_pool_id}
196     ${data}=   Fill JSON Template File    ${ASDC_FEATURE_GROUP_TEMPLATE}    ${map}
197     ${resp}=    Run ASDC Post Request    ${ASDC_VENDOR_LICENSE_MODEL_PATH}/${license_model_id}/versions/${version_id}${ASDC_VENDOR_FEATURE_GROUP_PATH}     ${data}
198     Should Be Equal As Strings  ${resp.status_code}     200
199     [Return]    ${resp.json()['value']}
200 Get ASDC Feature Group
201     [Documentation]    gets an asdc Feature Group by its id
202     [Arguments]    ${license_model_id}    ${group_id}
203     ${resp}=    Run ASDC Get Request    ${ASDC_VENDOR_LICENSE_MODEL_PATH}/${license_model_id}${ASDC_VENDOR_FEATURE_GROUP_PATH}/${group_id}
204     [Return]    ${resp.json()}
205 Add ASDC License Agreement
206     [Documentation]    Creates an asdc License Agreement and returns its id
207     [Arguments]    ${license_model_id}    ${feature_group_id}      ${version_id}=0.1
208     ${uuid}=    Generate UUID
209     ${shortened_uuid}=     Evaluate    str("${uuid}")[:23]
210     ${map}=    Create Dictionary    license_agreement_name=${shortened_uuid}    feature_group_id=${feature_group_id}
211     ${data}=   Fill JSON Template File    ${ASDC_LICENSE_AGREEMENT_TEMPLATE}    ${map}
212     ${resp}=    Run ASDC Post Request    ${ASDC_VENDOR_LICENSE_MODEL_PATH}/${license_model_id}/versions/${version_id}${ASDC_VENDOR_LICENSE_AGREEMENT_PATH}     ${data}
213     Should Be Equal As Strings  ${resp.status_code}     200
214     [Return]    ${resp.json()['value']}
215 Get ASDC License Agreement
216     [Documentation]    gets an asdc License Agreement by its id
217     [Arguments]    ${license_model_id}    ${agreement_id}
218     ${resp}=    Run ASDC Get Request    ${ASDC_VENDOR_LICENSE_MODEL_PATH}/${license_model_id}${ASDC_VENDOR_LICENSE_AGREEMENT_PATH}/${agreement_id}
219     [Return]    ${resp.json()}
220 Add ASDC Software Product
221     [Documentation]    Creates an asdc Software Product and returns its id
222     [Arguments]    ${license_agreement_id}    ${feature_group_id}    ${license_model_name}    ${license_model_id}
223     ${uuid}=    Generate UUID
224     ${shortened_uuid}=     Evaluate    str("${uuid}")[:23]
225     ${map}=    Create Dictionary    software_product_name=${shortened_uuid}    feature_group_id=${feature_group_id}    license_agreement_id=${license_agreement_id}    vendor_name=${license_model_name}    vendor_id=${license_model_id}
226     ${data}=   Fill JSON Template File    ${ASDC_SOFTWARE_PRODUCT_TEMPLATE}    ${map}
227     ${resp}=    Run ASDC Post Request    ${ASDC_VENDOR_SOFTWARE_PRODUCT_PATH}     ${data}
228     Should Be Equal As Strings  ${resp.status_code}     200
229     [Return]    ${resp.json()['vspId']}
230 Get ASDC Software Product
231     [Documentation]    gets an asdc Software Product by its id
232     [Arguments]    ${software_product_id}   ${version_id}=0.1
233     ${resp}=    Run ASDC Get Request    ${ASDC_VENDOR_SOFTWARE_PRODUCT_PATH}/${software_product_id}/versions/${version_id}
234     [Return]    ${resp.json()}
235 Add ASDC Catalog Resource
236     [Documentation]    Creates an asdc Catalog Resource and returns its id
237     [Arguments]    ${license_agreement_id}    ${software_product_name}    ${license_model_name}    ${software_product_id}
238     ${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}
239     ${data}=   Fill JSON Template File    ${ASDC_CATALOG_RESOURCE_TEMPLATE}    ${map}
240     ${resp}=    Run ASDC Post Request    ${ASDC_CATALOG_RESOURCES_PATH}     ${data}    ${ASDC_DESIGNER_USER_ID}
241     Should Be Equal As Strings  ${resp.status_code}     201
242     [Return]    ${resp.json()['uniqueId']}
243 Mark ASDC Catalog Resource Inactive
244     [Documentation]    deletes an asdc Catalog Resource
245     [Arguments]    ${catalog_resource_id}
246     ${resp}=    Run ASDC Delete Request    ${ASDC_CATALOG_RESOURCES_PATH}/${catalog_resource_id}     ${ASDC_DESIGNER_USER_ID}
247     Should Be Equal As Strings  ${resp.status_code}     204
248     [Return]    ${resp}
249 Delete Inactive ASDC Catalog Resources
250     [Documentation]    delete all asdc Catalog Resources that are inactive
251     ${resp}=    Run ASDC Delete Request    ${ASDC_CATALOG_INACTIVE_RESOURCES_PATH}     ${ASDC_DESIGNER_USER_ID}
252     Should Be Equal As Strings  ${resp.status_code}     200
253     [Return]    ${resp.json()}
254 Get ASDC Catalog Resource
255     [Documentation]    gets an asdc Catalog Resource by its id
256     [Arguments]    ${catalog_resource_id}
257     ${resp}=    Run ASDC Get Request    ${ASDC_CATALOG_RESOURCES_PATH}/${catalog_resource_id}    ${ASDC_DESIGNER_USER_ID}
258     [Return]    ${resp.json()}
259 Checkin ASDC Catalog Resource
260     [Documentation]    checksin an asdc Catalog Resource by its id
261     [Arguments]    ${catalog_resource_id}
262     ${map}=    Create Dictionary    user_remarks=Robot remarks
263     ${data}=   Fill JSON Template File    ${ASDC_USER_REMARKS_TEMPLATE}    ${map}
264     ${resp}=    Run ASDC Post Request    ${ASDC_CATALOG_RESOURCES_PATH}/${catalog_resource_id}${ASDC_CATALOG_LIFECYCLE_PATH}/checkin    ${data}    ${ASDC_DESIGNER_USER_ID}
265     Should Be Equal As Strings  ${resp.status_code}     200
266     [Return]    ${resp.json()}
267 Request Certify ASDC Catalog Resource
268     [Documentation]    requests certify on an asdc Catalog Resource by its id
269     [Arguments]    ${catalog_resource_id}
270     ${map}=    Create Dictionary    user_remarks=Robot remarks
271     ${data}=   Fill JSON Template File    ${ASDC_USER_REMARKS_TEMPLATE}    ${map}
272     ${resp}=    Run ASDC Post Request    ${ASDC_CATALOG_RESOURCES_PATH}/${catalog_resource_id}${ASDC_CATALOG_LIFECYCLE_PATH}/certificationRequest    ${data}    ${ASDC_DESIGNER_USER_ID}
273     Should Be Equal As Strings  ${resp.status_code}     200
274     [Return]    ${resp.json()}
275 Start Certify ASDC Catalog Resource
276     [Documentation]    start certify an asdc Catalog Resource by its id
277     [Arguments]    ${catalog_resource_id}
278     ${resp}=    Run ASDC Post Request    ${ASDC_CATALOG_RESOURCES_PATH}/${catalog_resource_id}${ASDC_CATALOG_LIFECYCLE_PATH}/startCertification    ${None}    ${ASDC_TESTER_USER_ID}
279     Should Be Equal As Strings  ${resp.status_code}     200
280     [Return]    ${resp.json()}
281 Certify ASDC Catalog Resource
282     [Documentation]    start certify an asdc Catalog Resource by its id and returns the new id
283     [Arguments]    ${catalog_resource_id}
284     ${map}=    Create Dictionary    user_remarks=Robot remarks
285     ${data}=   Fill JSON Template File    ${ASDC_USER_REMARKS_TEMPLATE}    ${map}
286     ${resp}=    Run ASDC Post Request    ${ASDC_CATALOG_RESOURCES_PATH}/${catalog_resource_id}${ASDC_CATALOG_LIFECYCLE_PATH}/certify    ${data}    ${ASDC_TESTER_USER_ID}
287     Should Be Equal As Strings  ${resp.status_code}     200
288     [Return]    ${resp.json()['uniqueId']}
289 Upload ASDC Heat Package
290     [Documentation]    Creates an asdc Software Product and returns its id
291     [Arguments]    ${software_product_id}    ${file_path}   ${version_id}=0.1
292     ${file}=    Get Binary File     ${file_path}
293     ${files}=     Create Dictionary     upload=${file}
294     ${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}
295         Should Be Equal As Strings      ${resp.status_code}     200
296 Add ASDC Catalog Service
297     [Documentation]    Creates an asdc Catalog Service and returns its id
298     [Arguments]   ${catalog_service_name}
299     ${uuid}=    Generate UUID
300     ${shortened_uuid}=     Evaluate    str("${uuid}")[:23]
301     ${catalog_service_name}=   Set Variable If   '${catalog_service_name}' ==''   ${shortened_uuid}   ${catalog_service_name}
302     ${map}=    Create Dictionary    service_name=${catalog_service_name}
303     ${data}=   Fill JSON Template File    ${ASDC_CATALOG_SERVICE_TEMPLATE}    ${map}
304     ${resp}=    Run ASDC Post Request    ${ASDC_CATALOG_SERVICES_PATH}     ${data}    ${ASDC_DESIGNER_USER_ID}
305     Should Be Equal As Strings  ${resp.status_code}     201
306     [Return]    ${resp.json()['uniqueId']}
307 Mark ASDC Catalog Service Inactive
308     [Documentation]    Deletes an asdc Catalog Service
309     [Arguments]    ${catalog_service_id}
310     ${resp}=    Run ASDC Delete Request    ${ASDC_CATALOG_SERVICES_PATH}/${catalog_service_id}     ${ASDC_DESIGNER_USER_ID}
311     Should Be Equal As Strings  ${resp.status_code}     204
312     [Return]    ${resp}
313 Delete Inactive ASDC Catalog Services
314     [Documentation]    delete all asdc Catalog Serivces that are inactive
315     ${resp}=    Run ASDC Delete Request    ${ASDC_CATALOG_INACTIVE_SERVICES_PATH}     ${ASDC_DESIGNER_USER_ID}
316     Should Be Equal As Strings  ${resp.status_code}     200
317     [Return]    ${resp.json()}
318 Get ASDC Catalog Service
319     [Documentation]    gets an asdc Catalog Service by its id
320     [Arguments]    ${catalog_service_id}
321     ${resp}=    Run ASDC Get Request    ${ASDC_CATALOG_SERVICES_PATH}/${catalog_service_id}    ${ASDC_DESIGNER_USER_ID}
322     [Return]    ${resp.json()}
323 Checkin ASDC Catalog Service
324     [Documentation]    checksin an asdc Catalog Service by its id
325     [Arguments]    ${catalog_service_id}
326     ${map}=    Create Dictionary    user_remarks=Robot remarks
327     ${data}=   Fill JSON Template File    ${ASDC_USER_REMARKS_TEMPLATE}    ${map}
328     ${resp}=    Run ASDC Post Request    ${ASDC_CATALOG_SERVICES_PATH}/${catalog_service_id}${ASDC_CATALOG_LIFECYCLE_PATH}/checkin    ${data}    ${ASDC_DESIGNER_USER_ID}
329     Should Be Equal As Strings  ${resp.status_code}     200
330     [Return]    ${resp.json()}
331 Request Certify ASDC Catalog Service
332     [Documentation]    requests certify on an asdc Catalog Service by its id
333     [Arguments]    ${catalog_service_id}
334     ${map}=    Create Dictionary    user_remarks=Robot remarks
335     ${data}=   Fill JSON Template File    ${ASDC_USER_REMARKS_TEMPLATE}    ${map}
336     ${resp}=    Run ASDC Post Request    ${ASDC_CATALOG_SERVICES_PATH}/${catalog_service_id}${ASDC_CATALOG_LIFECYCLE_PATH}/certificationRequest    ${data}    ${ASDC_DESIGNER_USER_ID}
337     Should Be Equal As Strings  ${resp.status_code}     200
338     [Return]    ${resp.json()}
339 Start Certify ASDC Catalog Service
340     [Documentation]    start certify an asdc Catalog Service by its id
341     [Arguments]    ${catalog_service_id}
342     ${resp}=    Run ASDC Post Request    ${ASDC_CATALOG_SERVICES_PATH}/${catalog_service_id}${ASDC_CATALOG_LIFECYCLE_PATH}/startCertification    ${None}    ${ASDC_TESTER_USER_ID}
343     Should Be Equal As Strings  ${resp.status_code}     200
344     [Return]    ${resp.json()}
345 Certify ASDC Catalog Service
346     [Documentation]    start certify an asdc Catalog Service by its id and returns the new id
347     [Arguments]    ${catalog_service_id}
348     ${map}=    Create Dictionary    user_remarks=Robot remarks
349     ${data}=   Fill JSON Template File    ${ASDC_USER_REMARKS_TEMPLATE}    ${map}
350     ${resp}=    Run ASDC Post Request    ${ASDC_CATALOG_SERVICES_PATH}/${catalog_service_id}${ASDC_CATALOG_LIFECYCLE_PATH}/certify    ${data}    ${ASDC_TESTER_USER_ID}
351     Should Be Equal As Strings  ${resp.status_code}     200
352     [Return]    ${resp.json()['uniqueId']}
353 Approve ASDC Catalog Service
354     [Documentation]    approve an asdc Catalog Service by its id
355     [Arguments]    ${catalog_service_id}
356     ${map}=    Create Dictionary    user_remarks=Robot remarks
357     ${data}=   Fill JSON Template File    ${ASDC_USER_REMARKS_TEMPLATE}    ${map}
358     ${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}
359     Should Be Equal As Strings  ${resp.status_code}     200
360     [Return]    ${resp.json()}
361 Distribute ASDC Catalog Service
362     [Documentation]    distribute an asdc Catalog Service by its id
363     [Arguments]    ${catalog_service_id}
364     ${resp}=    Run ASDC Post Request    ${ASDC_CATALOG_SERVICES_PATH}/${catalog_service_id}${ASDC_CATALOG_SERVICE_DISTRIBUTION_ACTIVATE_PATH}    ${None}    ${ASDC_OPS_USER_ID}
365     Should Be Equal As Strings  ${resp.status_code}     200
366     [Return]    ${resp.json()}
367 Add ASDC Resource Instance
368     [Documentation]    Creates an asdc Resource Instance and returns its id
369     [Arguments]    ${catalog_service_id}    ${catalog_resource_id}    ${catalog_resource_name}
370     ${milli_timestamp}=    Generate MilliTimestamp UUID
371     ${map}=    Create Dictionary    catalog_resource_id=${catalog_resource_id}    catalog_resource_name=${catalog_resource_name}    milli_timestamp=${milli_timestamp}
372     ${data}=   Fill JSON Template File    ${ASDC_RESOURCE_INSTANCE_TEMPLATE}    ${map}
373     ${resp}=    Run ASDC Post Request    ${ASDC_CATALOG_SERVICES_PATH}/${catalog_service_id}${ASDC_CATALOG_SERVICE_RESOURCE_INSTANCE_PATH}     ${data}    ${ASDC_DESIGNER_USER_ID}
374     Should Be Equal As Strings  ${resp.status_code}     201
375     [Return]    ${resp.json()['uniqueId']}
376 Get Catalog Service Distribution
377     [Documentation]    gets an asdc catalog Service distrbution
378     [Arguments]    ${catalog_service_uuid}
379     ${resp}=    Run ASDC Get Request    ${ASDC_CATALOG_SERVICES_PATH}/${catalog_service_uuid}${ASDC_CATALOG_SERVICE_DISTRIBUTION_PATH}    ${ASDC_OPS_USER_ID}
380     Should Be Equal As Strings  ${resp.status_code}     200
381     [Return]    ${resp.json()}
382 Check Catalog Service Distributed
383     [Documentation]    gets an asdc catalog Service distrbution
384     [Arguments]    ${catalog_service_uuid}
385     ${dist_resp}=    Get Catalog Service Distribution    ${catalog_service_uuid}
386     Should Be Equal As Strings  ${dist_resp['distributionStatusOfServiceList'][0]['deployementStatus']}         Distributed
387     ${det_resp}=    Get Catalog Service Distribution Details    ${dist_resp['distributionStatusOfServiceList'][0]['distributionID']}
388     @{ITEMS}=    Copy List    ${det_resp['distributionStatusList']}
389     :FOR    ${ELEMENT}    IN    @{ITEMS}
390     \    Log    ${ELEMENT['status']}
391     \    Should Match Regexp    ${ELEMENT['status']}    ^(DEPLOY_OK|NOTIFIED|DOWNLOAD_OK|NOT_NOTIFIED)$
392 Get Catalog Service Distribution Details
393     [Documentation]    gets an asdc catalog Service distrbution details
394     [Arguments]    ${catalog_service_distribution_id}
395     ${resp}=    Run ASDC Get Request    ${ASDC_CATALOG_SERVICES_PATH}${ASDC_CATALOG_SERVICE_DISTRIBUTION_PATH}/${catalog_service_distribution_id}    ${ASDC_OPS_USER_ID}
396     Should Be Equal As Strings  ${resp.status_code}     200
397     [Return]    ${resp.json()}
398 Run ASDC Health Check
399     [Documentation]    Runs a ASDC health check
400     ${session}=    Create Session       asdc    ${GLOBAL_ASDC_SERVER}:${GLOBAL_ASDC_FE_PORT}
401     ${uuid}=    Generate UUID
402     ${headers}=  Create Dictionary     Accept=application/json    Content-Type=application/json    X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid}    X-FromAppId=${GLOBAL_APPLICATION_ID}
403     ${resp}=    Get Request     asdc    ${ASDC_HEALTH_CHECK_PATH}     headers=${headers}
404     Should Be Equal As Strings  ${resp.status_code}     200
405     @{ITEMS}=    Copy List    ${resp.json()['componentsInfo']}
406     :FOR    ${ELEMENT}    IN    @{ITEMS}
407     \    Log    ${ELEMENT['healthCheckStatus']}
408     \    Should Be Equal As Strings     ${ELEMENT['healthCheckStatus']}         UP
409 Run ASDC Get Request
410     [Documentation]    Runs an ASDC get request
411     [Arguments]    ${data_path}    ${user}=${ASDC_DESIGNER_USER_ID}
412     ${auth}=  Create List  ${GLOBAL_ASDC_BE_USERNAME}    ${GLOBAL_ASDC_BE_PASSWORD}
413     Log    Creating session ${GLOBAL_ASDC_SERVER}
414     ${session}=    Create Session       asdc    ${GLOBAL_ASDC_SERVER}:${GLOBAL_ASDC_BE_PORT}    auth=${auth}
415     ${uuid}=    Generate UUID
416     ${headers}=  Create Dictionary     Accept=application/json    Content-Type=application/json    USER_ID=${user}    X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid}    X-FromAppId=${GLOBAL_APPLICATION_ID}
417     ${resp}=    Get Request     asdc    ${data_path}     headers=${headers}
418     Log    Received response from asdc ${resp.text}
419     [Return]    ${resp}
420 Run ASDC Put Request
421     [Documentation]    Runs an ASDC put request
422     [Arguments]    ${data_path}    ${data}    ${user}=${ASDC_DESIGNER_USER_ID}
423     ${auth}=  Create List  ${GLOBAL_ASDC_BE_USERNAME}    ${GLOBAL_ASDC_BE_PASSWORD}
424     Log    Creating session ${GLOBAL_ASDC_SERVER}
425     ${session}=    Create Session       asdc    ${GLOBAL_ASDC_SERVER}:${GLOBAL_ASDC_BE_PORT}    auth=${auth}
426     ${uuid}=    Generate UUID
427     ${headers}=  Create Dictionary     Accept=application/json    Content-Type=application/json    USER_ID=${user}    X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid}    X-FromAppId=${GLOBAL_APPLICATION_ID}
428     ${resp}=    Put Request     asdc    ${data_path}     data=${data}    headers=${headers}
429     Log    Received response from asdc ${resp.text}
430     [Return]    ${resp}
431 Run ASDC Post Files Request
432     [Documentation]    Runs an ASDC post request
433     [Arguments]    ${data_path}    ${files}    ${user}=${ASDC_DESIGNER_USER_ID}
434     ${auth}=  Create List  ${GLOBAL_ASDC_BE_USERNAME}    ${GLOBAL_ASDC_BE_PASSWORD}
435     Log    Creating session ${GLOBAL_ASDC_SERVER}
436     ${session}=    Create Session       asdc    ${GLOBAL_ASDC_SERVER}:${GLOBAL_ASDC_BE_PORT}    auth=${auth}
437     ${uuid}=    Generate UUID
438     ${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}
439     ${resp}=    Post Request    asdc    ${data_path}     files=${files}    headers=${headers}
440     Log    Received response from asdc ${resp.text}
441     [Return]    ${resp}
442 Run ASDC Post Request
443     [Documentation]    Runs an ASDC post request
444     [Arguments]    ${data_path}    ${data}    ${user}=${ASDC_DESIGNER_USER_ID}
445     ${auth}=  Create List  ${GLOBAL_ASDC_BE_USERNAME}    ${GLOBAL_ASDC_BE_PASSWORD}
446     Log    Creating session ${GLOBAL_ASDC_SERVER}
447     ${session}=    Create Session       asdc    ${GLOBAL_ASDC_SERVER}:${GLOBAL_ASDC_BE_PORT}    auth=${auth}
448     ${uuid}=    Generate UUID
449     ${headers}=  Create Dictionary     Accept=application/json    Content-Type=application/json    USER_ID=${user}    X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid}    X-FromAppId=${GLOBAL_APPLICATION_ID}
450     ${resp}=    Post Request    asdc    ${data_path}     data=${data}    headers=${headers}
451     Log    Received response from asdc ${resp.text}
452     [Return]    ${resp}
453 Run ASDC Delete Request
454     [Documentation]    Runs an ASDC delete request
455     [Arguments]    ${data_path}    ${user}=${ASDC_DESIGNER_USER_ID}
456     ${auth}=  Create List  ${GLOBAL_ASDC_BE_USERNAME}    ${GLOBAL_ASDC_BE_PASSWORD}
457     Log    Creating session ${GLOBAL_ASDC_SERVER}
458     ${session}=    Create Session       asdc    ${GLOBAL_ASDC_SERVER}:${GLOBAL_ASDC_BE_PORT}    auth=${auth}
459     ${uuid}=    Generate UUID
460     ${headers}=  Create Dictionary     Accept=application/json    Content-Type=application/json    USER_ID=${user}    X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid}    X-FromAppId=${GLOBAL_APPLICATION_ID}
461     ${resp}=    Delete Request  asdc    ${data_path}        headers=${headers}
462     Log    Received response from asdc ${resp.text}
463     [Return]    ${resp}
464 Open ASDC GUI
465     [Documentation]   Logs in to ASDC GUI
466     [Arguments]    ${PATH}
467     ## Setup Browever now being managed by the test case
468     ##Setup Browser
469     Go To    ${GLOBAL_ASDC_SERVER}${PATH}
470     Maximize Browser Window
471     Set Selenium Speed    ${GLOBAL_SELENIUM_DELAY}
472     Set Browser Implicit Wait    ${GLOBAL_SELENIUM_BROWSER_IMPLICIT_WAIT}
473     Log    Logging in to ${GLOBAL_ASDC_SERVER}${PATH}
474     Title Should Be    ASDC
475     Wait Until Page Contains Element    xpath=//div/a[text()='SDC']    ${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT}
476     Log    Logged in to ${GLOBAL_PORTAL_SERVER}${PATH}