onap on kubernetes source files
[oom.git] / kubernetes / config / docker / init / src / config / robot / 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}    /upload
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}
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     Checkin ASDC Software Product    ${software_product_id}
84     Submit ASDC Software Product    ${software_product_id}
85     Package ASDC Software Product    ${software_product_id}
86     ${software_product_resp}=    Get ASDC Software Product    ${software_product_id}
87     ${catalog_resource_id}=    Add ASDC Catalog Resource     ${license_agreement_id}    ${software_product_resp['name']}    ${license_model_resp['vendorName']}    ${software_product_id}
88     Checkin ASDC Catalog Resource    ${catalog_resource_id}
89     Request Certify ASDC Catalog Resource    ${catalog_resource_id}
90     Start Certify ASDC Catalog Resource    ${catalog_resource_id}
91     # on certify it gets a new id
92     [Return]    ${catalog_resource_id}
93     ${catalog_resource_id}=    Certify ASDC Catalog Resource    ${catalog_resource_id}
94 Add ASDC License Model
95     [Documentation]    Creates an asdc license model and returns its id
96     ${uuid}=    Generate UUID
97     ${shortened_uuid}=     Evaluate    str("${uuid}")[:23]
98     ${map}=    Create Dictionary    vendor_name=${shortened_uuid}
99     ${data}=   Fill JSON Template File    ${ASDC_LICENSE_MODEL_TEMPLATE}    ${map}
100     ${resp}=    Run ASDC Post Request    ${ASDC_VENDOR_LICENSE_MODEL_PATH}    ${data}
101     Should Be Equal As Strings  ${resp.status_code}     200
102     [Return]    ${resp.json()['value']}
103 Get ASDC License Model
104     [Documentation]    gets an asdc license model by its id
105     [Arguments]    ${id}
106     ${resp}=    Run ASDC Get Request    ${ASDC_VENDOR_LICENSE_MODEL_PATH}/${id}
107     [Return]    ${resp.json()}
108 Checkin ASDC License Model
109     [Documentation]    checksin an asdc license model by its id
110     [Arguments]    ${id}
111     ${map}=    Create Dictionary    action=Checkin
112     ${data}=   Fill JSON Template File    ${ASDC_ACTION_TEMPLATE}    ${map}
113     ${resp}=    Run ASDC Put Request    ${ASDC_VENDOR_LICENSE_MODEL_PATH}/${id}${ASDC_VENDOR_ACTIONS_PATH}    ${data}
114     Should Be Equal As Strings  ${resp.status_code}     200
115     [Return]    ${resp.json()}
116 Submit ASDC License Model
117     [Documentation]    submits an asdc license model by its id
118     [Arguments]    ${id}
119     ${map}=    Create Dictionary    action=Submit
120     ${data}=   Fill JSON Template File    ${ASDC_ACTION_TEMPLATE}    ${map}
121     ${resp}=    Run ASDC Put Request    ${ASDC_VENDOR_LICENSE_MODEL_PATH}/${id}${ASDC_VENDOR_ACTIONS_PATH}    ${data}
122     Should Be Equal As Strings  ${resp.status_code}     200
123     [Return]    ${resp.json()}
124 Checkin ASDC Software Product
125     [Documentation]    checksin an asdc Software Product by its id
126     [Arguments]    ${id}
127     ${map}=    Create Dictionary    action=Checkin
128     ${data}=   Fill JSON Template File    ${ASDC_ACTION_TEMPLATE}    ${map}
129     ${resp}=    Run ASDC Put Request    ${ASDC_VENDOR_SOFTWARE_PRODUCT_PATH}/${id}${ASDC_VENDOR_ACTIONS_PATH}    ${data}
130     Should Be Equal As Strings  ${resp.status_code}     200
131     [Return]    ${resp.json()}
132 Submit ASDC Software Product
133     [Documentation]    submits an asdc Software Product by its id
134     [Arguments]    ${id}
135     ${map}=    Create Dictionary    action=Submit
136     ${data}=   Fill JSON Template File    ${ASDC_ACTION_TEMPLATE}    ${map}
137     ${resp}=    Run ASDC Put Request    ${ASDC_VENDOR_SOFTWARE_PRODUCT_PATH}/${id}${ASDC_VENDOR_ACTIONS_PATH}    ${data}
138     Should Be Equal As Strings  ${resp.status_code}     200
139     [Return]    ${resp.json()}
140 Package ASDC Software Product
141     [Documentation]    creates_package on an asdc Software Product by its id
142     [Arguments]    ${id}
143     ${map}=    Create Dictionary    action=Create_Package
144     ${data}=   Fill JSON Template File    ${ASDC_ACTION_TEMPLATE}    ${map}
145     ${resp}=    Run ASDC Put Request    ${ASDC_VENDOR_SOFTWARE_PRODUCT_PATH}/${id}${ASDC_VENDOR_ACTIONS_PATH}    ${data}
146     Should Be Equal As Strings  ${resp.status_code}     200
147     [Return]    ${resp.json()}
148 Add ASDC Entitlement Pool
149     [Documentation]    Creates an asdc Entitlement Pool and returns its id
150     [Arguments]    ${license_model_id}
151     ${uuid}=    Generate UUID
152     ${shortened_uuid}=     Evaluate    str("${uuid}")[:23]
153     ${map}=    Create Dictionary    entitlement_pool_name=${shortened_uuid}
154     ${data}=   Fill JSON Template File    ${ASDC_ENTITLEMENT_POOL_TEMPLATE}    ${map}
155     ${resp}=    Run ASDC Post Request    ${ASDC_VENDOR_LICENSE_MODEL_PATH}/${license_model_id}${ASDC_VENDOR_ENTITLEMENT_POOL_PATH}     ${data}
156     Should Be Equal As Strings  ${resp.status_code}     200
157     [Return]    ${resp.json()['value']}
158 Get ASDC Entitlement Pool
159     [Documentation]    gets an asdc Entitlement Pool by its id
160     [Arguments]    ${license_model_id}    ${pool_id}
161     ${resp}=    Run ASDC Get Request    ${ASDC_VENDOR_LICENSE_MODEL_PATH}/${license_model_id}${ASDC_VENDOR_ENTITLEMENT_POOL_PATH}/${pool_id}
162     [Return]    ${resp.json()}
163 Add ASDC License Group
164     [Documentation]    Creates an asdc license group and returns its id
165     [Arguments]    ${license_model_id}
166     ${uuid}=    Generate UUID
167     ${shortened_uuid}=     Evaluate    str("${uuid}")[:23]
168     ${map}=    Create Dictionary    key_group_name=${shortened_uuid}
169     ${data}=   Fill JSON Template File    ${ASDC_KEY_GROUP_TEMPLATE}    ${map}
170     ${resp}=    Run ASDC Post Request    ${ASDC_VENDOR_LICENSE_MODEL_PATH}/${license_model_id}${ASDC_VENDOR_KEY_GROUP_PATH}     ${data}
171     Should Be Equal As Strings  ${resp.status_code}     200
172     [Return]    ${resp.json()['value']}
173 Get ASDC License Group
174     [Documentation]    gets an asdc license group by its id
175     [Arguments]    ${license_model_id}    ${group_id}
176     ${resp}=    Run ASDC Get Request    ${ASDC_VENDOR_LICENSE_MODEL_PATH}/${license_model_id}${ASDC_VENDOR_KEY_GROUP_PATH}/${group_id}
177     [Return]    ${resp.json()}
178 Add ASDC Feature Group
179     [Documentation]    Creates an asdc Feature Group and returns its id
180     [Arguments]    ${license_model_id}    ${key_group_id}    ${entitlement_pool_id}
181     ${uuid}=    Generate UUID
182     ${shortened_uuid}=     Evaluate    str("${uuid}")[:23]
183     ${map}=    Create Dictionary    feature_group_name=${shortened_uuid}    key_group_id=${key_group_id}    entitlement_pool_id=${entitlement_pool_id}
184     ${data}=   Fill JSON Template File    ${ASDC_FEATURE_GROUP_TEMPLATE}    ${map}
185     ${resp}=    Run ASDC Post Request    ${ASDC_VENDOR_LICENSE_MODEL_PATH}/${license_model_id}${ASDC_VENDOR_FEATURE_GROUP_PATH}     ${data}
186     Should Be Equal As Strings  ${resp.status_code}     200
187     [Return]    ${resp.json()['value']}
188 Get ASDC Feature Group
189     [Documentation]    gets an asdc Feature Group by its id
190     [Arguments]    ${license_model_id}    ${group_id}
191     ${resp}=    Run ASDC Get Request    ${ASDC_VENDOR_LICENSE_MODEL_PATH}/${license_model_id}${ASDC_VENDOR_FEATURE_GROUP_PATH}/${group_id}
192     [Return]    ${resp.json()}
193 Add ASDC License Agreement
194     [Documentation]    Creates an asdc License Agreement and returns its id
195     [Arguments]    ${license_model_id}    ${feature_group_id}
196     ${uuid}=    Generate UUID
197     ${shortened_uuid}=     Evaluate    str("${uuid}")[:23]
198     ${map}=    Create Dictionary    license_agreement_name=${shortened_uuid}    feature_group_id=${feature_group_id}
199     ${data}=   Fill JSON Template File    ${ASDC_LICENSE_AGREEMENT_TEMPLATE}    ${map}
200     ${resp}=    Run ASDC Post Request    ${ASDC_VENDOR_LICENSE_MODEL_PATH}/${license_model_id}${ASDC_VENDOR_LICENSE_AGREEMENT_PATH}     ${data}
201     Should Be Equal As Strings  ${resp.status_code}     200
202     [Return]    ${resp.json()['value']}
203 Get ASDC License Agreement
204     [Documentation]    gets an asdc License Agreement by its id
205     [Arguments]    ${license_model_id}    ${agreement_id}
206     ${resp}=    Run ASDC Get Request    ${ASDC_VENDOR_LICENSE_MODEL_PATH}/${license_model_id}${ASDC_VENDOR_LICENSE_AGREEMENT_PATH}/${agreement_id}
207     [Return]    ${resp.json()}
208 Add ASDC Software Product
209     [Documentation]    Creates an asdc Software Product and returns its id
210     [Arguments]    ${license_agreement_id}    ${feature_group_id}    ${license_model_name}    ${license_model_id}
211     ${uuid}=    Generate UUID
212     ${shortened_uuid}=     Evaluate    str("${uuid}")[:23]
213     ${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}
214     ${data}=   Fill JSON Template File    ${ASDC_SOFTWARE_PRODUCT_TEMPLATE}    ${map}
215     ${resp}=    Run ASDC Post Request    ${ASDC_VENDOR_SOFTWARE_PRODUCT_PATH}     ${data}
216     Should Be Equal As Strings  ${resp.status_code}     200
217     [Return]    ${resp.json()['vspId']}
218 Get ASDC Software Product
219     [Documentation]    gets an asdc Software Product by its id
220     [Arguments]    ${software_product_id}
221     ${resp}=    Run ASDC Get Request    ${ASDC_VENDOR_SOFTWARE_PRODUCT_PATH}/${software_product_id}
222     [Return]    ${resp.json()}
223 Add ASDC Catalog Resource
224     [Documentation]    Creates an asdc Catalog Resource and returns its id
225     [Arguments]    ${license_agreement_id}    ${software_product_name}    ${license_model_name}    ${software_product_id}
226     ${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}
227     ${data}=   Fill JSON Template File    ${ASDC_CATALOG_RESOURCE_TEMPLATE}    ${map}
228     ${resp}=    Run ASDC Post Request    ${ASDC_CATALOG_RESOURCES_PATH}     ${data}    ${ASDC_DESIGNER_USER_ID}
229     Should Be Equal As Strings  ${resp.status_code}     201
230     [Return]    ${resp.json()['uniqueId']}
231 Mark ASDC Catalog Resource Inactive
232     [Documentation]    deletes an asdc Catalog Resource
233     [Arguments]    ${catalog_resource_id}
234     ${resp}=    Run ASDC Delete Request    ${ASDC_CATALOG_RESOURCES_PATH}/${catalog_resource_id}     ${ASDC_DESIGNER_USER_ID}
235     Should Be Equal As Strings  ${resp.status_code}     204
236     [Return]    ${resp}
237 Delete Inactive ASDC Catalog Resources
238     [Documentation]    delete all asdc Catalog Resources that are inactive
239     ${resp}=    Run ASDC Delete Request    ${ASDC_CATALOG_INACTIVE_RESOURCES_PATH}     ${ASDC_DESIGNER_USER_ID}
240     Should Be Equal As Strings  ${resp.status_code}     200
241     [Return]    ${resp.json()}
242 Get ASDC Catalog Resource
243     [Documentation]    gets an asdc Catalog Resource by its id
244     [Arguments]    ${catalog_resource_id}
245     ${resp}=    Run ASDC Get Request    ${ASDC_CATALOG_RESOURCES_PATH}/${catalog_resource_id}    ${ASDC_DESIGNER_USER_ID}
246     [Return]    ${resp.json()}
247 Checkin ASDC Catalog Resource
248     [Documentation]    checksin an asdc Catalog Resource by its id
249     [Arguments]    ${catalog_resource_id}
250     ${map}=    Create Dictionary    user_remarks=Robot remarks
251     ${data}=   Fill JSON Template File    ${ASDC_USER_REMARKS_TEMPLATE}    ${map}
252     ${resp}=    Run ASDC Post Request    ${ASDC_CATALOG_RESOURCES_PATH}/${catalog_resource_id}${ASDC_CATALOG_LIFECYCLE_PATH}/checkin    ${data}    ${ASDC_DESIGNER_USER_ID}
253     Should Be Equal As Strings  ${resp.status_code}     200
254     [Return]    ${resp.json()}
255 Request Certify ASDC Catalog Resource
256     [Documentation]    requests certify on an asdc Catalog Resource by its id
257     [Arguments]    ${catalog_resource_id}
258     ${map}=    Create Dictionary    user_remarks=Robot remarks
259     ${data}=   Fill JSON Template File    ${ASDC_USER_REMARKS_TEMPLATE}    ${map}
260     ${resp}=    Run ASDC Post Request    ${ASDC_CATALOG_RESOURCES_PATH}/${catalog_resource_id}${ASDC_CATALOG_LIFECYCLE_PATH}/certificationRequest    ${data}    ${ASDC_DESIGNER_USER_ID}
261     Should Be Equal As Strings  ${resp.status_code}     200
262     [Return]    ${resp.json()}
263 Start Certify ASDC Catalog Resource
264     [Documentation]    start certify an asdc Catalog Resource by its id
265     [Arguments]    ${catalog_resource_id}
266     ${resp}=    Run ASDC Post Request    ${ASDC_CATALOG_RESOURCES_PATH}/${catalog_resource_id}${ASDC_CATALOG_LIFECYCLE_PATH}/startCertification    ${None}    ${ASDC_TESTER_USER_ID}
267     Should Be Equal As Strings  ${resp.status_code}     200
268     [Return]    ${resp.json()}
269 Certify ASDC Catalog Resource
270     [Documentation]    start certify an asdc Catalog Resource by its id and returns the new id
271     [Arguments]    ${catalog_resource_id}
272     ${map}=    Create Dictionary    user_remarks=Robot remarks
273     ${data}=   Fill JSON Template File    ${ASDC_USER_REMARKS_TEMPLATE}    ${map}
274     ${resp}=    Run ASDC Post Request    ${ASDC_CATALOG_RESOURCES_PATH}/${catalog_resource_id}${ASDC_CATALOG_LIFECYCLE_PATH}/certify    ${data}    ${ASDC_TESTER_USER_ID}
275     Should Be Equal As Strings  ${resp.status_code}     200
276     [Return]    ${resp.json()['uniqueId']}
277 Upload ASDC Heat Package
278     [Documentation]    Creates an asdc Software Product and returns its id
279     [Arguments]    ${software_product_id}    ${file_path}
280     ${file}=    Get Binary File     ${file_path}
281     ${files}=     Create Dictionary     upload=${file}
282     ${resp}=    Run ASDC Post Files Request    ${ASDC_VENDOR_SOFTWARE_PRODUCT_PATH}/${software_product_id}${ASDC_VENDOR_SOFTWARE_UPLOAD_PATH}     ${files}    ${ASDC_DESIGNER_USER_ID}
283         Should Be Equal As Strings      ${resp.status_code}     200
284 Add ASDC Catalog Service
285     [Documentation]    Creates an asdc Catalog Service and returns its id
286     [Arguments]   ${catalog_service_name}
287     ${uuid}=    Generate UUID
288     ${shortened_uuid}=     Evaluate    str("${uuid}")[:23]
289     ${catalog_service_name}=   Set Variable If   '${catalog_service_name}' ==''   ${shortened_uuid}   ${catalog_service_name}
290     ${map}=    Create Dictionary    service_name=${catalog_service_name}
291     ${data}=   Fill JSON Template File    ${ASDC_CATALOG_SERVICE_TEMPLATE}    ${map}
292     ${resp}=    Run ASDC Post Request    ${ASDC_CATALOG_SERVICES_PATH}     ${data}    ${ASDC_DESIGNER_USER_ID}
293     Should Be Equal As Strings  ${resp.status_code}     201
294     [Return]    ${resp.json()['uniqueId']}
295 Mark ASDC Catalog Service Inactive
296     [Documentation]    Deletes an asdc Catalog Service
297     [Arguments]    ${catalog_service_id}
298     ${resp}=    Run ASDC Delete Request    ${ASDC_CATALOG_SERVICES_PATH}/${catalog_service_id}     ${ASDC_DESIGNER_USER_ID}
299     Should Be Equal As Strings  ${resp.status_code}     204
300     [Return]    ${resp}
301 Delete Inactive ASDC Catalog Services
302     [Documentation]    delete all asdc Catalog Serivces that are inactive
303     ${resp}=    Run ASDC Delete Request    ${ASDC_CATALOG_INACTIVE_SERVICES_PATH}     ${ASDC_DESIGNER_USER_ID}
304     Should Be Equal As Strings  ${resp.status_code}     200
305     [Return]    ${resp.json()}
306 Get ASDC Catalog Service
307     [Documentation]    gets an asdc Catalog Service by its id
308     [Arguments]    ${catalog_service_id}
309     ${resp}=    Run ASDC Get Request    ${ASDC_CATALOG_SERVICES_PATH}/${catalog_service_id}    ${ASDC_DESIGNER_USER_ID}
310     [Return]    ${resp.json()}
311 Checkin ASDC Catalog Service
312     [Documentation]    checksin an asdc Catalog Service by its id
313     [Arguments]    ${catalog_service_id}
314     ${map}=    Create Dictionary    user_remarks=Robot remarks
315     ${data}=   Fill JSON Template File    ${ASDC_USER_REMARKS_TEMPLATE}    ${map}
316     ${resp}=    Run ASDC Post Request    ${ASDC_CATALOG_SERVICES_PATH}/${catalog_service_id}${ASDC_CATALOG_LIFECYCLE_PATH}/checkin    ${data}    ${ASDC_DESIGNER_USER_ID}
317     Should Be Equal As Strings  ${resp.status_code}     200
318     [Return]    ${resp.json()}
319 Request Certify ASDC Catalog Service
320     [Documentation]    requests certify on an asdc Catalog Service by its id
321     [Arguments]    ${catalog_service_id}
322     ${map}=    Create Dictionary    user_remarks=Robot remarks
323     ${data}=   Fill JSON Template File    ${ASDC_USER_REMARKS_TEMPLATE}    ${map}
324     ${resp}=    Run ASDC Post Request    ${ASDC_CATALOG_SERVICES_PATH}/${catalog_service_id}${ASDC_CATALOG_LIFECYCLE_PATH}/certificationRequest    ${data}    ${ASDC_DESIGNER_USER_ID}
325     Should Be Equal As Strings  ${resp.status_code}     200
326     [Return]    ${resp.json()}
327 Start Certify ASDC Catalog Service
328     [Documentation]    start certify an asdc Catalog Service by its id
329     [Arguments]    ${catalog_service_id}
330     ${resp}=    Run ASDC Post Request    ${ASDC_CATALOG_SERVICES_PATH}/${catalog_service_id}${ASDC_CATALOG_LIFECYCLE_PATH}/startCertification    ${None}    ${ASDC_TESTER_USER_ID}
331     Should Be Equal As Strings  ${resp.status_code}     200
332     [Return]    ${resp.json()}
333 Certify ASDC Catalog Service
334     [Documentation]    start certify an asdc Catalog Service by its id and returns the new id
335     [Arguments]    ${catalog_service_id}
336     ${map}=    Create Dictionary    user_remarks=Robot remarks
337     ${data}=   Fill JSON Template File    ${ASDC_USER_REMARKS_TEMPLATE}    ${map}
338     ${resp}=    Run ASDC Post Request    ${ASDC_CATALOG_SERVICES_PATH}/${catalog_service_id}${ASDC_CATALOG_LIFECYCLE_PATH}/certify    ${data}    ${ASDC_TESTER_USER_ID}
339     Should Be Equal As Strings  ${resp.status_code}     200
340     [Return]    ${resp.json()['uniqueId']}
341 Approve ASDC Catalog Service
342     [Documentation]    approve an asdc Catalog Service by its id
343     [Arguments]    ${catalog_service_id}
344     ${map}=    Create Dictionary    user_remarks=Robot remarks
345     ${data}=   Fill JSON Template File    ${ASDC_USER_REMARKS_TEMPLATE}    ${map}
346     ${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}
347     Should Be Equal As Strings  ${resp.status_code}     200
348     [Return]    ${resp.json()}
349 Distribute ASDC Catalog Service
350     [Documentation]    distribute an asdc Catalog Service by its id
351     [Arguments]    ${catalog_service_id}
352     ${resp}=    Run ASDC Post Request    ${ASDC_CATALOG_SERVICES_PATH}/${catalog_service_id}${ASDC_CATALOG_SERVICE_DISTRIBUTION_ACTIVATE_PATH}    ${None}    ${ASDC_OPS_USER_ID}
353     Should Be Equal As Strings  ${resp.status_code}     200
354     [Return]    ${resp.json()}
355 Add ASDC Resource Instance
356     [Documentation]    Creates an asdc Resource Instance and returns its id
357     [Arguments]    ${catalog_service_id}    ${catalog_resource_id}    ${catalog_resource_name}
358     ${milli_timestamp}=    Generate MilliTimestamp UUID
359     ${map}=    Create Dictionary    catalog_resource_id=${catalog_resource_id}    catalog_resource_name=${catalog_resource_name}    milli_timestamp=${milli_timestamp}
360     ${data}=   Fill JSON Template File    ${ASDC_RESOURCE_INSTANCE_TEMPLATE}    ${map}
361     ${resp}=    Run ASDC Post Request    ${ASDC_CATALOG_SERVICES_PATH}/${catalog_service_id}${ASDC_CATALOG_SERVICE_RESOURCE_INSTANCE_PATH}     ${data}    ${ASDC_DESIGNER_USER_ID}
362     Should Be Equal As Strings  ${resp.status_code}     201
363     [Return]    ${resp.json()['uniqueId']}
364 Get Catalog Service Distribution
365     [Documentation]    gets an asdc catalog Service distrbution
366     [Arguments]    ${catalog_service_uuid}
367     ${resp}=    Run ASDC Get Request    ${ASDC_CATALOG_SERVICES_PATH}/${catalog_service_uuid}${ASDC_CATALOG_SERVICE_DISTRIBUTION_PATH}    ${ASDC_OPS_USER_ID}
368     Should Be Equal As Strings  ${resp.status_code}     200
369     [Return]    ${resp.json()}
370 Check Catalog Service Distributed
371     [Documentation]    gets an asdc catalog Service distrbution
372     [Arguments]    ${catalog_service_uuid}
373     ${dist_resp}=    Get Catalog Service Distribution    ${catalog_service_uuid}
374     Should Be Equal As Strings  ${dist_resp['distributionStatusOfServiceList'][0]['deployementStatus']}         Distributed
375     ${det_resp}=    Get Catalog Service Distribution Details    ${dist_resp['distributionStatusOfServiceList'][0]['distributionID']}
376     @{ITEMS}=    Copy List    ${det_resp['distributionStatusList']}
377     :FOR    ${ELEMENT}    IN    @{ITEMS}
378     \    Log    ${ELEMENT['status']}
379     \    Should Match Regexp    ${ELEMENT['status']}    ^(DEPLOY_OK|NOTIFIED|DOWNLOAD_OK|NOT_NOTIFIED)$
380 Get Catalog Service Distribution Details
381     [Documentation]    gets an asdc catalog Service distrbution details
382     [Arguments]    ${catalog_service_distribution_id}
383     ${resp}=    Run ASDC Get Request    ${ASDC_CATALOG_SERVICES_PATH}${ASDC_CATALOG_SERVICE_DISTRIBUTION_PATH}/${catalog_service_distribution_id}    ${ASDC_OPS_USER_ID}
384     Should Be Equal As Strings  ${resp.status_code}     200
385     [Return]    ${resp.json()}
386 Run ASDC Health Check
387     [Documentation]    Runs a ASDC health check
388     ${session}=    Create Session       asdc    ${GLOBAL_ASDC_FE_SERVER}:${GLOBAL_ASDC_FE_PORT}
389     ${uuid}=    Generate UUID
390     ${headers}=  Create Dictionary     Accept=application/json    Content-Type=application/json    X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid}    X-FromAppId=${GLOBAL_APPLICATION_ID}
391     ${resp}=    Get Request     asdc    ${ASDC_HEALTH_CHECK_PATH}     headers=${headers}
392     Should Be Equal As Strings  ${resp.status_code}     200
393     @{ITEMS}=    Copy List    ${resp.json()['componentsInfo']}
394     :FOR    ${ELEMENT}    IN    @{ITEMS}
395     \    Log    ${ELEMENT['healthCheckStatus']}
396     \    Should Be Equal As Strings     ${ELEMENT['healthCheckStatus']}         UP
397 Run ASDC Get Request
398     [Documentation]    Runs an ASDC get request
399     [Arguments]    ${data_path}    ${user}=${ASDC_DESIGNER_USER_ID}
400     ${auth}=  Create List  ${GLOBAL_ASDC_BE_USERNAME}    ${GLOBAL_ASDC_BE_PASSWORD}
401     Log    Creating session ${GLOBAL_ASDC_BE_SERVER}
402     ${session}=    Create Session       asdc    ${GLOBAL_ASDC_BE_SERVER}:${GLOBAL_ASDC_BE_PORT}    auth=${auth}
403     ${uuid}=    Generate UUID
404     ${headers}=  Create Dictionary     Accept=application/json    Content-Type=application/json    USER_ID=${user}    X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid}    X-FromAppId=${GLOBAL_APPLICATION_ID}
405     ${resp}=    Get Request     asdc    ${data_path}     headers=${headers}
406     Log    Received response from asdc ${resp.text}
407     [Return]    ${resp}
408 Run ASDC Put Request
409     [Documentation]    Runs an ASDC put request
410     [Arguments]    ${data_path}    ${data}    ${user}=${ASDC_DESIGNER_USER_ID}
411     ${auth}=  Create List  ${GLOBAL_ASDC_BE_USERNAME}    ${GLOBAL_ASDC_BE_PASSWORD}
412     Log    Creating session ${GLOBAL_ASDC_BE_SERVER}
413     ${session}=    Create Session       asdc    ${GLOBAL_ASDC_BE_SERVER}:${GLOBAL_ASDC_BE_PORT}    auth=${auth}
414     ${uuid}=    Generate UUID
415     ${headers}=  Create Dictionary     Accept=application/json    Content-Type=application/json    USER_ID=${user}    X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid}    X-FromAppId=${GLOBAL_APPLICATION_ID}
416     ${resp}=    Put Request     asdc    ${data_path}     data=${data}    headers=${headers}
417     Log    Received response from asdc ${resp.text}
418     [Return]    ${resp}
419 Run ASDC Post Files Request
420     [Documentation]    Runs an ASDC post request
421     [Arguments]    ${data_path}    ${files}    ${user}=${ASDC_DESIGNER_USER_ID}
422     ${auth}=  Create List  ${GLOBAL_ASDC_BE_USERNAME}    ${GLOBAL_ASDC_BE_PASSWORD}
423     Log    Creating session ${GLOBAL_ASDC_BE_SERVER}
424     ${session}=    Create Session       asdc    ${GLOBAL_ASDC_BE_SERVER}:${GLOBAL_ASDC_BE_PORT}    auth=${auth}
425     ${uuid}=    Generate UUID
426     ${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}
427     ${resp}=    Post Request    asdc    ${data_path}     files=${files}    headers=${headers}
428     Log    Received response from asdc ${resp.text}
429     [Return]    ${resp}
430 Run ASDC Post Request
431     [Documentation]    Runs an ASDC post request
432     [Arguments]    ${data_path}    ${data}    ${user}=${ASDC_DESIGNER_USER_ID}
433     ${auth}=  Create List  ${GLOBAL_ASDC_BE_USERNAME}    ${GLOBAL_ASDC_BE_PASSWORD}
434     Log    Creating session ${GLOBAL_ASDC_BE_SERVER}
435     ${session}=    Create Session       asdc    ${GLOBAL_ASDC_BE_SERVER}:${GLOBAL_ASDC_BE_PORT}    auth=${auth}
436     ${uuid}=    Generate UUID
437     ${headers}=  Create Dictionary     Accept=application/json    Content-Type=application/json    USER_ID=${user}    X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid}    X-FromAppId=${GLOBAL_APPLICATION_ID}
438     ${resp}=    Post Request    asdc    ${data_path}     data=${data}    headers=${headers}
439     Log    Received response from asdc ${resp.text}
440     [Return]    ${resp}
441 Run ASDC Delete Request
442     [Documentation]    Runs an ASDC delete request
443     [Arguments]    ${data_path}    ${user}=${ASDC_DESIGNER_USER_ID}
444     ${auth}=  Create List  ${GLOBAL_ASDC_BE_USERNAME}    ${GLOBAL_ASDC_BE_PASSWORD}
445     Log    Creating session ${GLOBAL_ASDC_BE_SERVER}
446     ${session}=    Create Session       asdc    ${GLOBAL_ASDC_BE_SERVER}:${GLOBAL_ASDC_BE_PORT}    auth=${auth}
447     ${uuid}=    Generate UUID
448     ${headers}=  Create Dictionary     Accept=application/json    Content-Type=application/json    USER_ID=${user}    X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid}    X-FromAppId=${GLOBAL_APPLICATION_ID}
449     ${resp}=    Delete Request  asdc    ${data_path}        headers=${headers}
450     Log    Received response from asdc ${resp.text}
451     [Return]    ${resp}
452 Open ASDC GUI
453     [Documentation]   Logs in to ASDC GUI
454     [Arguments]    ${PATH}
455     ## Setup Browever now being managed by the test case
456     ##Setup Browser
457     Go To    ${GLOBAL_ASDC_FE_SERVER}${PATH}
458     Maximize Browser Window
459     Set Selenium Speed    ${GLOBAL_SELENIUM_DELAY}
460     Set Browser Implicit Wait    ${GLOBAL_SELENIUM_BROWSER_IMPLICIT_WAIT}
461     Log    Logging in to ${GLOBAL_ASDC_FE_SERVER}${PATH}
462     Title Should Be    ASDC
463     Wait Until Page Contains Element    xpath=//div/a[text()='SDC']    ${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT}
464     Log    Logged in to ${GLOBAL_PORTAL_SERVER}${PATH}