blob: 40fb38d8fc5cdfa6b3f262ea8bff0bbf5ae11473 [file] [log] [blame]
DR695Hccff30b2017-02-17 18:44:24 -05001*** Settings ***
DR695Hc0cf6a42019-07-26 16:42:36 -04002Documentation Model distribution
DR695Hccff30b2017-02-17 18:44:24 -05003Library OperatingSystem
4Library ArchiveLibrary
jf986099c63292017-03-09 15:28:42 -05005Library Collections
Jerry Flood3a169a32017-12-01 12:39:10 -05006Library String
Brian Freemanf508ab22018-03-15 21:19:41 -05007Library DateTime
DR695Ha6ce9512019-07-19 14:25:43 -04008Library ONAPLibrary.ServiceMapping WITH NAME ServiceMapping
DR695Hc0cf6a42019-07-26 16:42:36 -04009Resource ../sdc_interface.robot
DR695Hccff30b2017-02-17 18:44:24 -050010
DR695Hccff30b2017-02-17 18:44:24 -050011*** Variables ***
DR695Hc0cf6a42019-07-26 16:42:36 -040012${SDC_ASSETS_DIRECTORY} ${GLOBAL_HEAT_TEMPLATES_FOLDER}
13${SDC_ZIP_DIRECTORY} ${SDC_ASSETS_DIRECTORY}/temp
krzysztof kuzmickidadd0e62019-07-31 20:08:36 +020014${SDC_TOSCA_ONBOARDING_PACKAGES_DIRECTORY} ${GLOBAL_TOSCA_ONBOARDING_PACKAGES_FOLDER}
15${SDC_CSAR_DIRECTORY} ${SDC_TOSCA_ONBOARDING_PACKAGES_DIRECTORY}/temp
DR695Hccff30b2017-02-17 18:44:24 -050016
DR695Hccff30b2017-02-17 18:44:24 -050017*** Keywords ***
DR695H3c98fb32019-07-25 17:10:53 -040018Model Distribution For Directory With Teardown
krzysztof kuzmickidadd0e62019-07-31 20:08:36 +020019 [Arguments] ${service} ${catalog_service_name}= ${cds}=False
DR695H3c98fb32019-07-25 17:10:53 -040020 ${catalog_service_name} ${catalog_resource_name} ${vf_modules} ${catalog_resources} ${catalog_resource_ids} ${catalog_service_id}= Model Distribution For Directory ${service} ${catalog_service_name} ${cds}
21 [Teardown] Teardown Models ${catalog_service_id} ${catalog_resource_ids}
krzysztof kuzmickidadd0e62019-07-31 20:08:36 +020022
DR695Hccff30b2017-02-17 18:44:24 -050023Model Distribution For Directory
krzysztof kuzmickidadd0e62019-07-31 20:08:36 +020024 [Arguments] ${service} ${catalog_service_name}= ${cds}=False ${instantiationType}=A-la-carte ${resourceType}=VF
DR695H102f3202019-05-24 15:05:03 -040025 ServiceMapping.Set Directory default ${GLOBAL_SERVICE_MAPPING_DIRECTORY}
DR695Ha6ce9512019-07-19 14:25:43 -040026 ${directory_list}= ServiceMapping.Get Service Folder Mapping default ${service}
DR695Hccff30b2017-02-17 18:44:24 -050027 ${ziplist}= Create List
Brian Freemanf508ab22018-03-15 21:19:41 -050028 ${uuid}= Get Current Date
29 ${service_name}= Catenate ${service} ${uuid}
Brian Freemancc3c8692020-03-05 15:53:41 -050030 # ':' is not an allowed character in the service_name. '-' is allowed
Brian Freeman7347b7a2020-03-10 10:49:03 -050031 ${service_name}= Replace String ${service_name} : -
Brian Freemanf508ab22018-03-15 21:19:41 -050032 ${shortened_uuid}= Evaluate str("${service_name}")[:23]
33 ${catalog_service_name}= Set Variable If '${catalog_service_name}' =='' ${shortened_uuid} ${catalog_service_name}
krzysztof kuzmickidadd0e62019-07-31 20:08:36 +020034 Run Keyword If '${resourceType}'=='PNF' Create CSARSs in SDC Onboarding Packages Directory ${directory_list} ${ziplist}
35 ... ELSE Create ZIPs in SDC ZIP Directory ${directory_list} ${ziplist}
36 ${catalog_service_name} ${catalog_resource_name} ${vf_modules} ${catalog_resource_ids} ${catalog_service_id} ${catalog_resources} Distribute Model From SDC ${ziplist} ${catalog_service_name} ${cds} ${service} instantiationType=${instantiationType} resourceType=${resourceType}
mrichomme3256fa22020-03-09 11:23:35 +010037 Download CSAR ${catalog_service_id}
krzysztof kuzmickidadd0e62019-07-31 20:08:36 +020038 [Return] ${catalog_service_name} ${catalog_resource_name} ${vf_modules} ${catalog_resources} ${catalog_resource_ids} ${catalog_service_id}
39
40Create ZIPs in SDC ZIP Directory
41 [Arguments] ${directory_list} ${ziplist}
DR695H910097e2019-05-08 13:55:32 -040042 :FOR ${directory} IN @{directory_list}
Jerry Flood3a169a32017-12-01 12:39:10 -050043 \ ${zipname}= Replace String ${directory} / _
DR695Hc0cf6a42019-07-26 16:42:36 -040044 \ ${zip}= Catenate ${SDC_ZIP_DIRECTORY}/${zipname}.zip
45 \ ${folder}= Catenate ${SDC_ASSETS_DIRECTORY}/${directory}
46 \ OperatingSystem.Create Directory ${SDC_ASSETS_DIRECTORY}/temp
DR695Hccff30b2017-02-17 18:44:24 -050047 \ Create Zip From Files In Directory ${folder} ${zip}
jf986099c63292017-03-09 15:28:42 -050048 \ Append To List ${ziplist} ${zip}
krzysztof kuzmickidadd0e62019-07-31 20:08:36 +020049 [Return] ${ziplist}
50
51Create CSARSs in SDC Onboarding Packages Directory
52 [Arguments] ${directory_list} ${ziplist}
53 :FOR ${directory} IN @{directory_list}
54 \ ${zipname}= Replace String ${directory} / _
55 \ ${csar}= Catenate ${SDC_CSAR_DIRECTORY}/${zipname}.csar
56 \ ${folder}= Catenate ${SDC_TOSCA_ONBOARDING_PACKAGES_DIRECTORY}/${directory}
57 \ OperatingSystem.Create Directory ${SDC_TOSCA_ONBOARDING_PACKAGES_DIRECTORY}/temp
58 \ Create Zip From Files In Directory ${folder} ${csar} sub_directories=${true}
59 \ Append To List ${ziplist} ${csar}
60 [Return] ${ziplist}
61
62TOSCA Based PNF Model Distribution For Directory
63 [Arguments] ${service} ${catalog_service_name}=
64 ServiceMapping.Set Directory default ${GLOBAL_SERVICE_MAPPING_DIRECTORY}
65 ${directory_list}= ServiceMapping.Get Service Folder Mapping default ${service}
66 ${csarlist}= Create List
67 ${uuid}= Get Current Date
68 ${service_name}= Catenate ${service} ${uuid}
69 ${shortened_uuid}= Evaluate str("${service_name}")[:23]
70 ${catalog_service_name}= Set Variable If '${catalog_service_name}' =='' ${shortened_uuid} ${catalog_service_name}
DR695H87b84d02019-08-02 17:18:13 -040071 :FOR ${directory} IN @{directory_list}
krzysztof kuzmickidadd0e62019-07-31 20:08:36 +020072 \ ${zipname}= Replace String ${directory} / _
73 \ ${csar}= Catenate ${SDC_CSAR_DIRECTORY}/${zipname}.csar
74 \ ${folder}= Catenate ${SDC_TOSCA_ONBOARDING_PACKAGES_DIRECTORY}/${directory}
75 \ OperatingSystem.Create Directory ${SDC_TOSCA_ONBOARDING_PACKAGES_DIRECTORY}/temp
76 \ Create Zip From Files In Directory ${folder} ${csar} sub_directories=${true}
77 \ Append To List ${csarlist} ${csar}
DR695H87b84d02019-08-02 17:18:13 -040078 ${catalog_service_name} ${catalog_resource_name} ${catalog_resource_ids} ${catalog_service_id} ${catalog_resources} Distribute Model From SDC ${csarlist} ${catalog_service_name} ${service} resourceType=PNF
krzysztof kuzmickidadd0e62019-07-31 20:08:36 +020079 Download CSAR ${catalog_service_id}
80 [Return] ${catalog_service_name} ${catalog_resource_name} ${catalog_resources}
jf986099c63292017-03-09 15:28:42 -050081
DR695Hccff30b2017-02-17 18:44:24 -050082Teardown Models
83 [Documentation] Clean up at the end of the test
84 [Arguments] ${catalog_service_id} ${catalog_resource_ids}
85 Return From Keyword If '${catalog_service_id}' == ''
DR695H910097e2019-05-08 13:55:32 -040086 :FOR ${catalog_resource_id} IN @{catalog_resource_ids}
DR695Hc0cf6a42019-07-26 16:42:36 -040087 \ ${resourece_json}= Mark SDC Catalog Resource Inactive ${catalog_resource_id}
88 ${service_json}= Mark SDC Catalog Service Inactive ${catalog_service_id}
89 ${services_json}= Delete Inactive SDC Catalog Services
Brian Freemancc3c8692020-03-05 15:53:41 -050090 ${resources_json}= Delete Inactive SDC Catalog Resources