From a279ba36fb0a92d5986190d059db1fcf04afa8c2 Mon Sep 17 00:00:00 2001 From: Murali Date: Mon, 4 Sep 2017 12:02:49 +0000 Subject: Add csit test cases for VNF Repository Added test cases for upload, get, download and delete Change-Id: I8b2d5cd97b510135b75e6a41110bbf8507fbfda1 Jira:VNFSDK-34 Signed-off-by: Murali --- .../plans/vnfsdk-refrepo/sanity-check/setup.sh | 8 ++++- .../provision/sanity_test_vnfsdktestfunction.robot | 37 ++++++++++++++++++---- 2 files changed, 37 insertions(+), 8 deletions(-) (limited to 'test') diff --git a/test/csit/plans/vnfsdk-refrepo/sanity-check/setup.sh b/test/csit/plans/vnfsdk-refrepo/sanity-check/setup.sh index b54ea56ad..91e931e91 100644 --- a/test/csit/plans/vnfsdk-refrepo/sanity-check/setup.sh +++ b/test/csit/plans/vnfsdk-refrepo/sanity-check/setup.sh @@ -21,10 +21,16 @@ #Start market place docker run -d -i -t --name=refrepo -p 8702:8702 nexus3.onap.org:10001/onap/refrepo:1.0-STAGING-latest +# Wait for Market place initialization +echo Wait for VNF Repository initialization +for i in {1..30}; do + sleep 1 +done + REPO_IP=`docker inspect --format '{{ .NetworkSettings.IPAddress }}' refrepo` # Pass any variables required by Robot test suites in ROBOT_VARIABLES -ROBOT_VARIABLES="-v SCRIPTS:{SCRIPTS} -v REPO_IP:${REPO_IP}" +ROBOT_VARIABLES="-v SCRIPTS:${SCRIPTS} -v REPO_IP:${REPO_IP}" echo ${ROBOT_VARIABLES} diff --git a/test/csit/tests/vnfsdk-marketplace/provision/sanity_test_vnfsdktestfunction.robot b/test/csit/tests/vnfsdk-marketplace/provision/sanity_test_vnfsdktestfunction.robot index 473415eab..b06d5b544 100644 --- a/test/csit/tests/vnfsdk-marketplace/provision/sanity_test_vnfsdktestfunction.robot +++ b/test/csit/tests/vnfsdk-marketplace/provision/sanity_test_vnfsdktestfunction.robot @@ -1,17 +1,40 @@ *** settings *** Library OperatingSystem Library Process +Library String +Library Collections +Library RequestsLibrary +Library json *** Variables *** -${csarpath} ${SCRIPTS}/../tests/vnfsdk-marketplace/provision/enterprise2DC.csar -${upload} ${SCRIPTS}/../tests/vnfsdk-marketplace/provision/uploadCSAR.sh - +${csarpath} ${SCRIPTS}/../tests/vnfsdk-marketplace/provision/enterprise2DC.csar +${csarId} 0 *** Test Cases *** - -E2E Test case for VNF SDK + +Upload VNF Package to VNF Repository [Documentation] Upload the VNF Package - ${status}= Run Process bash ${upload} ${REPO_IP} ${csarpath} > log.txt shell=yes - Log Status is ${status} + ${resp}= Run curl -s -X POST -H "Content-Type: multipart/form-data" -F "file=@${csarpath}" http://${REPO_IP}:8702/openoapi/vnfsdk-marketplace/v1/PackageResource/csars + Should Contain ${resp} csarId + ${csarjson}= Evaluate ${resp} + ${csarId}= Set Variable ${csarjson["csarId"]} + Set Global Variable ${csarId} + +Get VNF Package Information from Repository + Create Session refrepo http://${REPO_IP}:8702 + &{headers}= Create Dictionary Content-Type=application/json + ${resp}= Get Request refrepo /openoapi/vnfsdk-marketplace/v1/PackageResource/csars/${csarId} headers=${headers} + Should Be Equal As Strings ${resp.status_code} 200 + +Download VNF Package from Repository + Create Session refrepo http://${REPO_IP}:8702 + &{headers}= Create Dictionary Content-Type=application/json + ${resp}= Get Request refrepo /openoapi/vnfsdk-marketplace/v1/PackageResource/csars/${csarId}/files headers=${headers} + Should Be Equal As Strings ${resp.status_code} 200 +Delete VNF Package from Repository + Create Session refrepo http://${REPO_IP}:8702 + &{headers}= Create Dictionary Content-Type=application/json + ${resp}= Delete Request refrepo /openoapi/vnfsdk-marketplace/v1/PackageResource/csars/${csarId} headers=${headers} + Should Be Equal As Strings ${resp.status_code} 200 -- cgit 1.2.3-korg