Add test for csar validation get result using execution id.
[integration/csit.git] / tests / vnfsdk-refrepo / resources / vnfsdk_keywords.robot
index 1bdcf71..11bb601 100644 (file)
@@ -1,4 +1,6 @@
 *** Settings ***
+Resource          ./vnfsdk_properties.robot
+
 Library           OperatingSystem
 Library           Process
 Library           String
@@ -6,10 +8,18 @@ Library           Collections
 Library           RequestsLibrary
 Library           json
 
-*** Variables ***
-${base_url}=    http://${REFREPO_IP}:8702/onapapi/vnfsdk-marketplace/v1
+*** Keywords ***
 
-${csarpath}=    ${SCRIPTS}/../tests/vnfsdk-refrepo/csar
+Validate CSAR usign Post request
+    [Documentation]    Perform POST Request to vnfsdk marketplace with CSAR and execution options, in order to perfvorm CSAR validation
+    [Arguments]    ${csar_name}  ${execution_json}
+    ${response}=   Run   curl -s --location --request POST '${base_url}/vtp/executions' --header 'Content-Type: multipart/form-data' --header 'Accept: application/json' --form 'file=@${csarpath}/${csar_name}' --form 'executions=${execution_json}'
+    ${response}=    String.Replace String    ${response}    \\n   ${SPACE}
+    [Return]     ${response}
 
-${csar_valid_no_security}=  valid_no_security.csar
-${execute_no_security_csar_validation}=  [{"scenario": "onap-dublin","testSuiteName": "validation","testCaseName": "csar-validate","parameters": {"csar": "file://${csar_valid_no_security}","pnf":"true"}}]
+Get validation result using GET request
+    [Documentation]    Perform GET request to vnfsdk marketplace with request id or execution id, in order to get that request/execution result
+    [Arguments]    ${requestId}
+    ${response}=   Run   curl -s --location --request GET '${base_url}/vtp/executions?requestId=${requestId}' --header 'Accept: application/json'
+    ${response}=    String.Replace String    ${response}    \\n   ${SPACE}
+    [Return]     ${response}