upgrade to python3 libraries
[testsuite.git] / robot / resources / test_templates / model_test_template_vcperescust.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           OperatingSystem
4 Library            ArchiveLibrary
5 Library           Collections
6 Library           String
7 Library           DateTime
8 Resource          ../asdc_interface.robot
9
10 Variables       ../../assets/service_mappings.py
11
12 *** Variables ***
13 ${ASDC_BASE_PATH}    /sdc1
14 ${ASDC_DESIGNER_PATH}    /proxy-designer1#/dashboard
15 ${ASDC_ASSETS_DIRECTORY}    ${GLOBAL_HEAT_TEMPLATES_FOLDER}
16 ${ASDC_ZIP_DIRECTORY}    ${ASDC_ASSETS_DIRECTORY}/temp
17
18 #***************** Test Case Variables *********************
19 ${CATALOG_RESOURCE_IDS}
20 ${CATALOG_SERVICE_ID}
21
22 *** Keywords ***
23
24 Model Distribution For vCPEResCust Directory
25     [Arguments]    ${service}   ${catalog_service_name}=    ${cds}=
26     ${directory_list}=    Get From Dictionary    ${GLOBAL_SERVICE_FOLDER_MAPPING}    ${service}
27     ${ziplist}=    Create List
28     ${uuid}=    Get Current Date
29     ${service_name}=    Catenate    ${service}    ${uuid}
30     ${shortened_uuid}=     Evaluate    str("${service_name}")[:23]
31     ${catalog_service_name}=   Set Variable If   '${catalog_service_name}' ==''   ${shortened_uuid}   ${catalog_service_name}
32     :FOR   ${directory}    IN    @{directory_list}
33     \    ${zipname}=   Replace String    ${directory}    /    _
34     \    ${zip}=    Catenate    ${ASDC_ZIP_DIRECTORY}/${zipname}.zip
35     \    ${folder}=    Catenate    ${ASDC_ASSETS_DIRECTORY}/${directory}
36     \    OperatingSystem.Create Directory    ${ASDC_ASSETS_DIRECTORY}/temp
37     \    Create Zip From Files In Directory        ${folder}    ${zip}
38     \    Append To List    ${ziplist}    ${zip}
39     ${catalog_service_name}    ${catalog_resource_name}    ${vf_modules}    ${catalog_resource_ids}   ${catalog_service_id}   ${catalog_resources}   Distribute vCPEResCust Model From ASDC    ${ziplist}    ${catalog_service_name}    ${cds}   ${service}
40     Set Test Variable   ${CATALOG_RESOURCE_IDS}   ${catalog_resource_ids}
41     Set Test Variable   ${CATALOG_SERVICE_ID}   ${catalog_service_id}
42     Set Test Variable   ${CATALOG_RESOURCES}   ${catalog_resources}
43     Download CSAR    ${catalog_service_id}   
44     [Return]    ${catalog_service_name}    ${catalog_resource_name}    ${vf_modules}   ${catalog_resources}
45
46
47
48
49 Teardown Model Distribution
50     [Documentation]    Clean up at the end of the test
51     Log   ${CATALOG_SERVICE_ID} ${CATALOG_RESOURCE_IDS}
52     # Teardown is removing allotted resources for some reason
53     #Teardown Models    ${CATALOG_SERVICE_ID}   ${CATALOG_RESOURCE_IDS}
54
55 Teardown Models
56     [Documentation]    Clean up at the end of the test
57     [Arguments]     ${catalog_service_id}    ${catalog_resource_ids}
58     Return From Keyword If    '${catalog_service_id}' == ''
59     :FOR    ${catalog_resource_id}   IN   @{catalog_resource_ids}
60     \   ${resourece_json}=   Mark ASDC Catalog Resource Inactive    ${catalog_resource_id}
61     ${service_json}=   Mark ASDC Catalog Service Inactive    ${catalog_service_id}
62     ${services_json}=   Delete Inactive ASDC Catalog Services
63     ${resources_json}=    Delete Inactive ASDC Catalog Resources