DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 1 | *** Settings *** |
DR695H | c0cf6a4 | 2019-07-26 16:42:36 -0400 | [diff] [blame] | 2 | Documentation Model distribution |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 3 | Library OperatingSystem |
| 4 | Library ArchiveLibrary |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame] | 5 | Library Collections |
Jerry Flood | 3a169a3 | 2017-12-01 12:39:10 -0500 | [diff] [blame] | 6 | Library String |
Brian Freeman | f508ab2 | 2018-03-15 21:19:41 -0500 | [diff] [blame] | 7 | Library DateTime |
DR695H | a6ce951 | 2019-07-19 14:25:43 -0400 | [diff] [blame] | 8 | Library ONAPLibrary.ServiceMapping WITH NAME ServiceMapping |
DR695H | c0cf6a4 | 2019-07-26 16:42:36 -0400 | [diff] [blame] | 9 | Resource ../sdc_interface.robot |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 10 | |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 11 | *** Variables *** |
DR695H | c0cf6a4 | 2019-07-26 16:42:36 -0400 | [diff] [blame] | 12 | ${SDC_ASSETS_DIRECTORY} ${GLOBAL_HEAT_TEMPLATES_FOLDER} |
| 13 | ${SDC_ZIP_DIRECTORY} ${SDC_ASSETS_DIRECTORY}/temp |
krzysztof kuzmicki | dadd0e6 | 2019-07-31 20:08:36 +0200 | [diff] [blame] | 14 | ${SDC_TOSCA_ONBOARDING_PACKAGES_DIRECTORY} ${GLOBAL_TOSCA_ONBOARDING_PACKAGES_FOLDER} |
| 15 | ${SDC_CSAR_DIRECTORY} ${SDC_TOSCA_ONBOARDING_PACKAGES_DIRECTORY}/temp |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 16 | |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 17 | *** Keywords *** |
DR695H | 3c98fb3 | 2019-07-25 17:10:53 -0400 | [diff] [blame] | 18 | Model Distribution For Directory With Teardown |
krzysztof kuzmicki | dadd0e6 | 2019-07-31 20:08:36 +0200 | [diff] [blame] | 19 | [Arguments] ${service} ${catalog_service_name}= ${cds}=False |
DR695H | 3c98fb3 | 2019-07-25 17:10:53 -0400 | [diff] [blame] | 20 | ${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 kuzmicki | dadd0e6 | 2019-07-31 20:08:36 +0200 | [diff] [blame] | 22 | |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 23 | Model Distribution For Directory |
krzysztof kuzmicki | dadd0e6 | 2019-07-31 20:08:36 +0200 | [diff] [blame] | 24 | [Arguments] ${service} ${catalog_service_name}= ${cds}=False ${instantiationType}=A-la-carte ${resourceType}=VF |
DR695H | 102f320 | 2019-05-24 15:05:03 -0400 | [diff] [blame] | 25 | ServiceMapping.Set Directory default ${GLOBAL_SERVICE_MAPPING_DIRECTORY} |
DR695H | a6ce951 | 2019-07-19 14:25:43 -0400 | [diff] [blame] | 26 | ${directory_list}= ServiceMapping.Get Service Folder Mapping default ${service} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 27 | ${ziplist}= Create List |
Brian Freeman | f508ab2 | 2018-03-15 21:19:41 -0500 | [diff] [blame] | 28 | ${uuid}= Get Current Date |
| 29 | ${service_name}= Catenate ${service} ${uuid} |
Brian Freeman | cc3c869 | 2020-03-05 15:53:41 -0500 | [diff] [blame] | 30 | # ':' is not an allowed character in the service_name. '-' is allowed |
Brian Freeman | 7347b7a | 2020-03-10 10:49:03 -0500 | [diff] [blame] | 31 | ${service_name}= Replace String ${service_name} : - |
Brian Freeman | f508ab2 | 2018-03-15 21:19:41 -0500 | [diff] [blame] | 32 | ${shortened_uuid}= Evaluate str("${service_name}")[:23] |
| 33 | ${catalog_service_name}= Set Variable If '${catalog_service_name}' =='' ${shortened_uuid} ${catalog_service_name} |
krzysztof kuzmicki | dadd0e6 | 2019-07-31 20:08:36 +0200 | [diff] [blame] | 34 | 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} |
mrichomme | 3256fa2 | 2020-03-09 11:23:35 +0100 | [diff] [blame] | 37 | Download CSAR ${catalog_service_id} |
krzysztof kuzmicki | dadd0e6 | 2019-07-31 20:08:36 +0200 | [diff] [blame] | 38 | [Return] ${catalog_service_name} ${catalog_resource_name} ${vf_modules} ${catalog_resources} ${catalog_resource_ids} ${catalog_service_id} |
| 39 | |
| 40 | Create ZIPs in SDC ZIP Directory |
| 41 | [Arguments] ${directory_list} ${ziplist} |
DR695H | 910097e | 2019-05-08 13:55:32 -0400 | [diff] [blame] | 42 | :FOR ${directory} IN @{directory_list} |
Jerry Flood | 3a169a3 | 2017-12-01 12:39:10 -0500 | [diff] [blame] | 43 | \ ${zipname}= Replace String ${directory} / _ |
DR695H | c0cf6a4 | 2019-07-26 16:42:36 -0400 | [diff] [blame] | 44 | \ ${zip}= Catenate ${SDC_ZIP_DIRECTORY}/${zipname}.zip |
| 45 | \ ${folder}= Catenate ${SDC_ASSETS_DIRECTORY}/${directory} |
| 46 | \ OperatingSystem.Create Directory ${SDC_ASSETS_DIRECTORY}/temp |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 47 | \ Create Zip From Files In Directory ${folder} ${zip} |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame] | 48 | \ Append To List ${ziplist} ${zip} |
krzysztof kuzmicki | dadd0e6 | 2019-07-31 20:08:36 +0200 | [diff] [blame] | 49 | [Return] ${ziplist} |
| 50 | |
| 51 | Create 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 | |
| 62 | TOSCA 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} |
DR695H | 87b84d0 | 2019-08-02 17:18:13 -0400 | [diff] [blame] | 71 | :FOR ${directory} IN @{directory_list} |
krzysztof kuzmicki | dadd0e6 | 2019-07-31 20:08:36 +0200 | [diff] [blame] | 72 | \ ${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} |
DR695H | 87b84d0 | 2019-08-02 17:18:13 -0400 | [diff] [blame] | 78 | ${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 kuzmicki | dadd0e6 | 2019-07-31 20:08:36 +0200 | [diff] [blame] | 79 | Download CSAR ${catalog_service_id} |
| 80 | [Return] ${catalog_service_name} ${catalog_resource_name} ${catalog_resources} |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame] | 81 | |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 82 | Teardown 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}' == '' |
DR695H | 910097e | 2019-05-08 13:55:32 -0400 | [diff] [blame] | 86 | :FOR ${catalog_resource_id} IN @{catalog_resource_ids} |
DR695H | c0cf6a4 | 2019-07-26 16:42:36 -0400 | [diff] [blame] | 87 | \ ${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 Freeman | cc3c869 | 2020-03-05 15:53:41 -0500 | [diff] [blame] | 90 | ${resources_json}= Delete Inactive SDC Catalog Resources |