ROBOT test cases improvements for PnP PNF in El Alto release

Issue-ID: INT-1179

Signed-off-by: Krzysztof Kuzmicki <krzysztof.kuzmicki@nokia.com>
Change-Id: I7b840e4fa53c9058d74872cbaf3e1922651b7997
diff --git a/robot/resources/test_templates/model_test_template.robot b/robot/resources/test_templates/model_test_template.robot
index 8cfecc2..7c40e49 100644
--- a/robot/resources/test_templates/model_test_template.robot
+++ b/robot/resources/test_templates/model_test_template.robot
@@ -11,15 +11,17 @@
 *** Variables ***
 ${SDC_ASSETS_DIRECTORY}    ${GLOBAL_HEAT_TEMPLATES_FOLDER}
 ${SDC_ZIP_DIRECTORY}    ${SDC_ASSETS_DIRECTORY}/temp
+${SDC_TOSCA_ONBOARDING_PACKAGES_DIRECTORY}    ${GLOBAL_TOSCA_ONBOARDING_PACKAGES_FOLDER}
+${SDC_CSAR_DIRECTORY}   ${SDC_TOSCA_ONBOARDING_PACKAGES_DIRECTORY}/temp
 
 *** Keywords ***
 Model Distribution For Directory With Teardown
-    [Arguments]    ${service}   ${catalog_service_name}=    ${cds}=None
+    [Arguments]    ${service}   ${catalog_service_name}=    ${cds}=False
     ${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}
     [Teardown]    Teardown Models    ${catalog_service_id}    ${catalog_resource_ids}
-    
+
 Model Distribution For Directory
-    [Arguments]    ${service}   ${catalog_service_name}=    ${cds}=None
+    [Arguments]    ${service}   ${catalog_service_name}=    ${cds}=False  ${instantiationType}=A-la-carte  ${resourceType}=VF
     ServiceMapping.Set Directory    default    ${GLOBAL_SERVICE_MAPPING_DIRECTORY}
     ${directory_list}=    ServiceMapping.Get Service Folder Mapping    default    ${service}
     ${ziplist}=    Create List
@@ -27,6 +29,14 @@
     ${service_name}=    Catenate    ${service}    ${uuid}
     ${shortened_uuid}=     Evaluate    str("${service_name}")[:23]
     ${catalog_service_name}=   Set Variable If   '${catalog_service_name}' ==''   ${shortened_uuid}   ${catalog_service_name}
+    Run Keyword If  '${resourceType}'=='PNF'  Create CSARSs in SDC Onboarding Packages Directory  ${directory_list}  ${ziplist}
+    ...  ELSE  Create ZIPs in SDC ZIP Directory  ${directory_list}  ${ziplist}
+    ${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}
+    Download CSAR    ${catalog_service_id}   
+    [Return]    ${catalog_service_name}    ${catalog_resource_name}    ${vf_modules}   ${catalog_resources}    ${catalog_resource_ids}   ${catalog_service_id}
+
+Create ZIPs in SDC ZIP Directory
+    [Arguments]  ${directory_list}  ${ziplist}
     :FOR   ${directory}    IN    @{directory_list}
     \    ${zipname}=   Replace String    ${directory}    /    _
     \    ${zip}=    Catenate    ${SDC_ZIP_DIRECTORY}/${zipname}.zip
@@ -34,9 +44,38 @@
     \    OperatingSystem.Create Directory    ${SDC_ASSETS_DIRECTORY}/temp
     \    Create Zip From Files In Directory        ${folder}    ${zip}
     \    Append To List    ${ziplist}    ${zip}
-    ${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}
-    Download CSAR    ${catalog_service_id}   
-    [Return]    ${catalog_service_name}    ${catalog_resource_name}    ${vf_modules}   ${catalog_resources}    ${catalog_resource_ids}   ${catalog_service_id}
+    [Return]  ${ziplist}
+
+Create CSARSs in SDC Onboarding Packages Directory
+    [Arguments]  ${directory_list}  ${ziplist}
+    :FOR   ${directory}    IN    @{directory_list}
+    \    ${zipname}=   Replace String    ${directory}    /    _
+    \    ${csar}=    Catenate    ${SDC_CSAR_DIRECTORY}/${zipname}.csar
+    \    ${folder}=    Catenate    ${SDC_TOSCA_ONBOARDING_PACKAGES_DIRECTORY}/${directory}
+    \    OperatingSystem.Create Directory    ${SDC_TOSCA_ONBOARDING_PACKAGES_DIRECTORY}/temp
+    \    Create Zip From Files In Directory        ${folder}    ${csar}    sub_directories=${true}
+    \    Append To List    ${ziplist}    ${csar}
+    [Return]  ${ziplist}
+
+TOSCA Based PNF Model Distribution For Directory
+    [Arguments]    ${service}   ${catalog_service_name}=
+    ServiceMapping.Set Directory    default    ${GLOBAL_SERVICE_MAPPING_DIRECTORY}
+    ${directory_list}=    ServiceMapping.Get Service Folder Mapping    default    ${service}
+    ${csarlist}=    Create List
+    ${uuid}=    Get Current Date
+    ${service_name}=    Catenate    ${service}    ${uuid}
+    ${shortened_uuid}=     Evaluate    str("${service_name}")[:23]
+    ${catalog_service_name}=   Set Variable If   '${catalog_service_name}' ==''   ${shortened_uuid}   ${catalog_service_name}
+    :for   ${directory}    IN    @{directory_list}
+    \    ${zipname}=   Replace String    ${directory}    /    _
+    \    ${csar}=    Catenate    ${SDC_CSAR_DIRECTORY}/${zipname}.csar
+    \    ${folder}=    Catenate    ${SDC_TOSCA_ONBOARDING_PACKAGES_DIRECTORY}/${directory}
+    \    OperatingSystem.Create Directory    ${SDC_TOSCA_ONBOARDING_PACKAGES_DIRECTORY}/temp
+    \    Create Zip From Files In Directory        ${folder}    ${csar}    sub_directories=${true}
+    \    Append To List    ${csarlist}    ${csar}
+    ${catalog_service_name}    ${catalog_resource_name}    ${catalog_resource_ids}   ${catalog_service_id}   ${catalog_resources}   Distribute TOSCA Model From SDC    ${csarlist}    ${catalog_service_name}   ${service}
+    Download CSAR    ${catalog_service_id}
+    [Return]    ${catalog_service_name}    ${catalog_resource_name}    ${catalog_resources}
 
 Teardown Models
     [Documentation]    Clean up at the end of the test