diff options
Diffstat (limited to 'test/csit')
-rwxr-xr-x | test/csit/plans/music/music-test-plan/setup.sh | 60 | ||||
-rwxr-xr-x | test/csit/plans/music/music-test-plan/teardown.sh | 5 | ||||
-rw-r--r-- | test/csit/plans/sdnc/healthcheck/setup.sh | 4 | ||||
-rw-r--r-- | test/csit/plans/vnfsdk-ice/sanity-check/setup.sh | 34 | ||||
-rw-r--r-- | test/csit/plans/vnfsdk-ice/sanity-check/teardown.sh | 22 | ||||
-rw-r--r-- | test/csit/plans/vnfsdk-ice/sanity-check/testplan.txt | 3 | ||||
-rw-r--r-- | test/csit/tests/music/music-suite/music-test.robot | 134 | ||||
-rw-r--r-- | test/csit/tests/vnfsdk-ice/ice-server/validation_test.robot | 69 |
8 files changed, 307 insertions, 24 deletions
diff --git a/test/csit/plans/music/music-test-plan/setup.sh b/test/csit/plans/music/music-test-plan/setup.sh index 900ccf660..63d2ef93f 100755 --- a/test/csit/plans/music/music-test-plan/setup.sh +++ b/test/csit/plans/music/music-test-plan/setup.sh @@ -25,32 +25,51 @@ source ${WORKSPACE}/test/csit/scripts/music/music-scripts/music_script.sh # add here all the configuration steps eventually needed to be carried out for music CSIT testing # echo "# music configuration step"; + +CASS_IMG=nexus3.onap.org:10001/onap/music/cassandra_music:latest +TOMCAT_IMG=nexus3.onap.org:10001/library/tomcat:8.0 +ZK_IMG=nexus3.onap.org:10001/library/zookeeper:3.4 +MUSIC_IMG=nexus3.onap.org:10001/onap/music/music:latest +WORK_DIR=/tmp/music +CASS_USERNAME=nelson24 +CASS_PASSWORD=winman123 MUSIC_SOURCE_PROPERTIES=${WORKSPACE}/test/csit/scripts/music/music-properties MUSIC_PROPERTIES=/tmp/music/properties MUSIC_LOGS=/tmp/music/logs - mkdir -p ${MUSIC_PROPERTIES} mkdir -p ${MUSIC_LOGS} -cp ${MUSIC_SOURCE_PROPERTIES}/* ${MUSIC_PROPERTIES} +cp ${MUSIC_SOURCE_PROPERTIES}/* ${WORK_DIR}/properties + +# Create Volume for mapping war file and tomcat +docker volume create --name music-vol; + +# Create a network for all the containers to run in. +docker network create music-net; + +# Start Cassandra +docker run -d --name music-db --network music-net -p "7000:7000" -p "7001:7001" -p "7199:7199" -p "9042:9042" -p "9160:9160" -e CASSUSER=${CASS_USERNAME} -e CASSPASS=${CASS_PASSWORD} ${CASS_IMG}; + +# Start Music war +docker run -d --name music-war -v music-vol:/app ${MUSIC_IMG}; -#docker cp /home/lb7254/integration/test/csit/scripts/music/music-scripts/music_init.cql cassandra:/tmp/music_init.cql -#docker cp ${WORKSPACE}/test/csit/scripts/music/music-scripts/music_init.cql cassandra:/tmp/music_init.cql -#docker exec -it cassandra /usr/bin/cqlsh -umusic -pmusic -f /tmp/music_init.cql +# Start Zookeeper +docker run -d --name music-zk --network music-net -p "2181:2181" -p "2888:2888" -p "3888:3888" ${ZK_IMG}; +# Delay for Cassandra +sleep 20; +# Start Up tomcat - Needs to have properties,logs dir and war file volume mapped. +docker run -d --name music-tomcat --network music-net -p "8080:8080" -v music-vol:/usr/local/tomcat/webapps -v ${WORK_DIR}/properties:/opt/app/music/etc:ro -v ${WORK_DIR}/logs:/opt/app/music/logs ${TOMCAT_IMG}; + +# Connect tomcat to host bridge network so that its port can be seen. +docker network connect bridge music-tomcat; + +################################## # # add here below the start of all docker containers needed for music CSIT testing # -echo "# music docker containers spinoff"; - - -docker volume create --name music-vol -docker run -d --name music-war -v music-vol:/app nexus3.onap.org:10001/onap/music/music:latest -docker run -d --name music-db -p 7000:7000 -p 7001:7001 -p 7199:7199 -p 9042:9042 -p 9160:9160 nexus3.onap.org:10001/onap/music/cassandra_music:latest -docker run -d --name music-zk -p 2181:2181 -p 2888:2888 -p 3888:3888 nexus3.onap.org:10001/library/zookeeper:3.4 -sleep 30 CASSA_IP=`docker inspect --format '{{ .NetworkSettings.Networks.bridge.IPAddress}}' music-db` echo "CASSANDRA_IP=${CASSA_IP}" @@ -60,20 +79,19 @@ echo "ZOOKEEPER_IP=${ZOO_IP}" ${WORKSPACE}/test/csit/scripts/music/music-scripts/wait_for_port.sh ${CASSA_IP} 9042 -docker run -d --name music-tomcat -p 8080:8080 -v music-vol:/usr/local/tomcat/webapps -v ${MUSIC_PROPERTIES}:/opt/app/music/etc:ro -v ${MUSIC_LOGS}:/opt/app/music/logs nexus3.onap.org:10001/library/tomcat:8.0 -sleep 10 - TOMCAT_IP=`docker inspect --format '{{ .NetworkSettings.Networks.bridge.IPAddress}}' music-tomcat` echo "TOMCAT_IP=${TOMCAT_IP}" ${WORKSPACE}/test/csit/scripts/music/music-scripts/wait_for_port.sh ${TOMCAT_IP} 8080 ---- old part: it will be removed -#docker run --name cassandra -d -p 9042:9042 -p 7000:7000 -p 7001:7001 -p 7199:7199 -p 9160:9160 nexus3.onap.org:10001/library/cassandra -#docker run --name zookeeper -d -p 2181:2181 -p 2888:2888 -p 3888:3888 nexus3.onap.org:10001/library/zookeeper -#docker run --name music -d -v /app nexus3.onap.org:10001/music -#docker run --name tomcat -d -p 8080:8080 --volumes-from music nexus3.onap.org:10001/library/tomcat +echo "inspect docker things for tracing purpose" +docker inspect music-db +docker inspect music-zk +docker inspect music-tomcat +docker inspect music-war +docker volume inspect music-vol +docker network inspect music-net diff --git a/test/csit/plans/music/music-test-plan/teardown.sh b/test/csit/plans/music/music-test-plan/teardown.sh index 315be04a8..e9982ae27 100755 --- a/test/csit/plans/music/music-test-plan/teardown.sh +++ b/test/csit/plans/music/music-test-plan/teardown.sh @@ -34,12 +34,17 @@ docker rm music-tomcat docker rm music-war docker rm music-db +docker network rm music-net; +sleep 5; + docker volume rm music-vol echo "dump music.log files" ls -alF /tmp/music ls -alF /tmp/music/properties +cat /tmp/music/properties/music.properties cat /tmp/music/logs/MUSIC/music.log +cat /tmp/music/logs/MUSIC/error.log #rm -Rf /tmp/music diff --git a/test/csit/plans/sdnc/healthcheck/setup.sh b/test/csit/plans/sdnc/healthcheck/setup.sh index 3ffed5d26..f2d7f6e45 100644 --- a/test/csit/plans/sdnc/healthcheck/setup.sh +++ b/test/csit/plans/sdnc/healthcheck/setup.sh @@ -64,9 +64,7 @@ docker tag $NEXUS_DOCKER_REPO/onap/sdnc-dmaap-listener-image:$DOCKER_IMAGE_VERSI # start SDNC containers with docker compose and configuration from docker-compose.yml -curl -L https://github.com/docker/compose/releases/download/1.9.0/docker-compose-`uname -s`-`uname -m` > docker-compose -chmod +x docker-compose -./docker-compose up -d +docker-compose up -d # WAIT 10 minutes maximum and test every 5 seconds if SDNC is up using HealthCheck API TIME_OUT=1000 diff --git a/test/csit/plans/vnfsdk-ice/sanity-check/setup.sh b/test/csit/plans/vnfsdk-ice/sanity-check/setup.sh new file mode 100644 index 000000000..7e777a133 --- /dev/null +++ b/test/csit/plans/vnfsdk-ice/sanity-check/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# +# Copyright 2018 Orange Labs. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# These scripts are sourced by run-csit.sh. + + +#Start ice server +docker run --rm --name vnfsdk-ice -d -p 5000:5000 onap/vnfsdk/ice + +# Wait for server initialization +echo Wait for vnfsdk-ice initialization +until [ "`/usr/bin/docker inspect -f {{.State.Running}} vnfsdk-ice`"=="true" ]; do + sleep 1; +done; +ICE_IP=`docker inspect --format '{{ .NetworkSettings.IPAddress }}' vnfsdk-ice` + + +# Pass any variables required by Robot test suites in ROBOT_VARIABLES +ROBOT_VARIABLES="-v SCRIPTS:${SCRIPTS} -v ICE_IP:${ICE_IP}" +echo ${ROBOT_VARIABLES} + diff --git a/test/csit/plans/vnfsdk-ice/sanity-check/teardown.sh b/test/csit/plans/vnfsdk-ice/sanity-check/teardown.sh new file mode 100644 index 000000000..c84ea757b --- /dev/null +++ b/test/csit/plans/vnfsdk-ice/sanity-check/teardown.sh @@ -0,0 +1,22 @@ +#!/bin/bash +# +# Copyright 2018 Orange Labs. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This script is sourced by run-csit.sh after Robot test completion. + + +kill-instance.sh vnfsdk-ice + + diff --git a/test/csit/plans/vnfsdk-ice/sanity-check/testplan.txt b/test/csit/plans/vnfsdk-ice/sanity-check/testplan.txt new file mode 100644 index 000000000..c84eb0312 --- /dev/null +++ b/test/csit/plans/vnfsdk-ice/sanity-check/testplan.txt @@ -0,0 +1,3 @@ +## Test suites are relative paths under [integration.git]/test/csit/tests/. +## Place the suites in run order. +vnfsdk-ice/ice-server/validation_test.robot diff --git a/test/csit/tests/music/music-suite/music-test.robot b/test/csit/tests/music/music-suite/music-test.robot index 27806103a..9f8e435c8 100644 --- a/test/csit/tests/music/music-suite/music-test.robot +++ b/test/csit/tests/music/music-suite/music-test.robot @@ -46,6 +46,140 @@ Check Music War Docker Container Should Be Equal As Integers ${rc} 0 Should Contain ${output} music-war +Get Music Version + [Documentation] It sends a REST GET request to retrieve the Music.war version + Create Session musicaas ${MUSIC_HOSTNAME}:${MUSIC_PORT} + &{headers}= Create Dictionary Content-Type=application/json Accept=application/json + ${resp}= Get Request musicaas /MUSIC/rest/v2/version headers=${headers} + Log To Console ********************* + Log To Console response = ${resp} + Log To Console body = ${resp.text} + Should Be Equal As Integers ${resp.status_code} 200 + +Music AddOnBoarding + [Documentation] It sends a REST POST request to Music to Onboard a new application + Create Session musicaas ${MUSIC_HOSTNAME}:${MUSIC_PORT} + ${data}= Get Binary File ${CURDIR}${/}data${/}onboard.json + &{headers}= Create Dictionary ns=lb7254 userId=music password=music Content-Type=application/json Accept=application/json + ${resp}= Post Request musicaas /MUSIC/rest/v2/admin/onboardAppWithMusic data=${data} headers=${headers} + Log To Console ********************* + Log To Console response = ${resp} + Log To Console body = ${resp.text} + ${response_json} json.loads ${resp.content} + ${generatedAID}= Convert To String ${response_json['Generated AID']} + Set Global Variable ${generatedAID} + Log To Console generatedAID = ${generatedAID} + Should Be Equal As Integers ${resp.status_code} 200 + +Music CreateKeyspace + [Documentation] It sends a REST POST request to Music to create a new keyspace in Cassandra + Create Session musicaas ${MUSIC_HOSTNAME}:${MUSIC_PORT} + ${data}= Get Binary File ${CURDIR}${/}data${/}createkeyspace.json + &{headers}= Create Dictionary ns=lb7254 userId=music password=music aid=${generatedAID} Content-Type=application/json Accept=application/json + ${resp}= Post Request musicaas /MUSIC/rest/v2/keyspaces/MusicOnapKeyspace data=${data} headers=${headers} + Log To Console ********************* + Log To Console response = ${resp} + Log To Console body = ${resp.text} + Should Be Equal As Integers ${resp.status_code} 200 + +Music CreateTable + [Documentation] It sends a REST POST request to Music to create a new Table in Cassandra + Create Session musicaas ${MUSIC_HOSTNAME}:${MUSIC_PORT} + ${data}= Get Binary File ${CURDIR}${/}data${/}createtable.json + &{headers}= Create Dictionary ns=lb7254 userId=music password=music aid=${generatedAID} Content-Type=application/json Accept=application/json + ${resp}= Post Request musicaas /MUSIC/rest/v2/keyspaces/MusicOnapKeyspace/tables/MusicOnapTable data=${data} headers=${headers} + Log To Console ********************* + Log To Console response = ${resp} + Log To Console body = ${resp.text} + Should Be Equal As Integers ${resp.status_code} 200 + +Music InsertRow + [Documentation] It sends a REST POST request to Music to create a new row in Cassandra + Create Session musicaas ${MUSIC_HOSTNAME}:${MUSIC_PORT} + ${data}= Get Binary File ${CURDIR}${/}data${/}insertrow_eventual.json + &{headers}= Create Dictionary ns=lb7254 userId=music password=music aid=${generatedAID} Content-Type=application/json Accept=application/json + ${resp}= Post Request musicaas /MUSIC/rest/v2/keyspaces/MusicOnapKeyspace/tables/MusicOnapTable/rows/?row=emp1 data=${data} headers=${headers} + Log To Console ********************* + Log To Console response = ${resp} + Log To Console body = ${resp.text} + Should Be Equal As Integers ${resp.status_code} 200 + +Music ReadRowJustInserted + [Documentation] It sends a REST GET request to Music to Read the row just inserted in Cassandra + Create Session musicaas ${MUSIC_HOSTNAME}:${MUSIC_PORT} + &{headers}= Create Dictionary ns=lb7254 userId=music password=music aid=${generatedAID} Content-Type=application/json Accept=application/json + ${resp}= Get Request musicaas /MUSIC/rest/v2/keyspaces/MusicOnapKeyspace/tables/MusicOnapTable/rows?name=emp1 headers=${headers} + Log To Console ********************* + Log To Console response = ${resp} + Log To Console body = ${resp.text} + Should Be Equal As Integers ${resp.status_code} 200 + +Music UpdateRowInAtomicWay + [Documentation] It sends a REST PUT request to Music to create a new row in Cassandra + Create Session musicaas ${MUSIC_HOSTNAME}:${MUSIC_PORT} + ${data}= Get Binary File ${CURDIR}${/}data${/}updaterow_atomic.json + &{headers}= Create Dictionary ns=lb7254 userId=music password=music aid=${generatedAID} Content-Type=application/json Accept=application/json + ${resp}= Put Request musicaas /MUSIC/rest/v2/keyspaces/MusicOnapKeyspace/tables/MusicOnapTable/rows?name=emp1 data=${data} headers=${headers} + Log To Console ********************* + Log To Console response = ${resp} + Log To Console body = ${resp.text} + Should Be Equal As Integers ${resp.status_code} 200 + +Music ReadRowAfterUpdate + [Documentation] It sends a REST GET request to Music to Read the row just inserted in Cassandra + Create Session musicaas ${MUSIC_HOSTNAME}:${MUSIC_PORT} + &{headers}= Create Dictionary ns=lb7254 userId=music password=music aid=${generatedAID} Content-Type=application/json Accept=application/json + ${resp}= Get Request musicaas /MUSIC/rest/v2/keyspaces/MusicOnapKeyspace/tables/MusicOnapTable/rows?name=emp1 headers=${headers} + Log To Console ********************* + Log To Console response = ${resp} + Log To Console body = ${resp.text} + Should Be Equal As Integers ${resp.status_code} 200 + +Music DeleteRow + [Documentation] It sends a REST DELETE request to Music to delete a row in Cassandra + Create Session musicaas ${MUSIC_HOSTNAME}:${MUSIC_PORT} + ${data}= Get Binary File ${CURDIR}${/}data${/}deleterow_eventual.json + &{headers}= Create Dictionary ns=lb7254 userId=music password=music aid=${generatedAID} Content-Type=application/json Accept=application/json + ${resp}= Delete Request musicaas /MUSIC/rest/v2/keyspaces/MusicOnapKeyspace/tables/MusicOnapTable/rows?name=emp1 data=${data} headers=${headers} + Log To Console ********************* + Log To Console response = ${resp} + Log To Console body = ${resp.text} + Should Be Equal As Integers ${resp.status_code} 200 + +Music DropTable + [Documentation] It sends a REST Delete request to Music to drop one existing Table in Cassandra + Create Session musicaas ${MUSIC_HOSTNAME}:${MUSIC_PORT} + ${data}= Get Binary File ${CURDIR}${/}data${/}droptable.json + &{headers}= Create Dictionary ns=lb7254 userId=music password=music aid=${generatedAID} Content-Type=application/json Accept=application/json + ${resp}= Delete Request musicaas /MUSIC/rest/v2/keyspaces/MusicOnapKeyspace/tables/MusicOnapTable data=${data} headers=${headers} + Log To Console ********************* + Log To Console response = ${resp} + Log To Console body = ${resp.text} + Should Be Equal As Integers ${resp.status_code} 200 + +Music DropKeyspace + [Documentation] It sends a REST DELETE request to Music to drop one existing keyspace in Cassandra + Create Session musicaas ${MUSIC_HOSTNAME}:${MUSIC_PORT} + ${data}= Get Binary File ${CURDIR}${/}data${/}dropkeyspace.json + &{headers}= Create Dictionary ns=lb7254 userId=music password=music aid=${generatedAID} Content-Type=application/json Accept=application/json + ${resp}= Delete Request musicaas /MUSIC/rest/v2/keyspaces/MusicOnapKeyspace data=${data} headers=${headers} + Log To Console ********************* + Log To Console response = ${resp} + Log To Console body = ${resp.text} + Should Be Equal As Integers ${resp.status_code} 200 + + +Music DeleteOnBoarding + [Documentation] It sends a REST DELETE request to Music to remove a previosly onboarded application + Create Session musicaas ${MUSIC_HOSTNAME}:${MUSIC_PORT} + ${data}= Get Binary File ${CURDIR}${/}data${/}onboard.json + &{headers}= Create Dictionary ns=lb7254 userId=music password=music aid=${generatedAID} Content-Type=application/json Accept=application/json + ${resp}= Delete Request musicaas /MUSIC/rest/v2/admin/onboardAppWithMusic data=${data} headers=${headers} + Log To Console ********************* + Log To Console response = ${resp} + Log To Console body = ${resp.text} + Should Be Equal As Integers ${resp.status_code} 200 + *** Keywords *** diff --git a/test/csit/tests/vnfsdk-ice/ice-server/validation_test.robot b/test/csit/tests/vnfsdk-ice/ice-server/validation_test.robot new file mode 100644 index 000000000..1a134b017 --- /dev/null +++ b/test/csit/tests/vnfsdk-ice/ice-server/validation_test.robot @@ -0,0 +1,69 @@ +*** settings *** +Library OperatingSystem +Library Process +Library String +Library Collections +Library RequestsLibrary +Library json + + +*** Variables *** +${valid_heat_zip} ${SCRIPTS}/../tests/vnfsdk-ice/ice-server/heat_template_ok.zip +${empty_heat_zip} ${SCRIPTS}/../tests/vnfsdk-ice/ice-server/heat_template_empty.zip +${ice_uri} /onapapi/ice/v1/ + +*** Test Cases *** + +ICE health Check + [Documentation] Validate that ICE is up + Create Session ice_session http://${ICE_IP}:5000 + &{headers}= Create Dictionary Content-Type=application/json + + ${resp}= Get Request ice_session ${ice_uri} headers=${headers} + + Should Be Equal As Strings ${resp.status_code} 200 + +Check status code for valid HEAT based VNF package + [Documentation] Post a valid VNF package and expect 200 Response + ${fileData}= Get Binary File ${valid_heat_zip} + ${fileDir} ${fileName}= Split Path ${valid_heat_zip} + ${partData}= Create List ${fileName} ${fileData} application/octet-stream + &{fileParts}= Create Dictionary + Set To Dictionary ${fileParts} file=${partData} + + ${resp}= Post Request ice_session ${ice_uri} files=${fileParts} + + Log Receive HTTP Status code ${resp.status_code} + Should Be Equal As Strings ${resp.status_code} 200 + ${json} = Set Variable ${resp.json()} + ${message} = Get From Dictionary ${json} message + Should Be Equal ${message} OK + +Check status code for empty VNF package + [Documentation] Post an empty VNF package and expect 422 Response + ${fileData}= Get Binary File ${empty_heat_zip} + ${fileDir} ${fileName}= Split Path ${empty_heat_zip} + ${partData}= Create List ${fileName} ${fileData} application/octet-stream + &{fileParts}= Create Dictionary + Set To Dictionary ${fileParts} file=${partData} + + ${resp}= Post Request ice_session ${ice_uri} files=${fileParts} + + Log Receive HTTP Status code ${resp.status_code} + Should Be Equal As Strings ${resp.status_code} 422 + ${json} = Set Variable ${resp.json()} + ${message} = Get From Dictionary ${json} message + Should Be Equal ${message} Tests failed + +Check status code for invalid request + [Documentation] Post an invalid request and expect 400 Response + ${fileData}= Get Binary File ${empty_heat_zip} + ${fileDir} ${fileName}= Split Path ${empty_heat_zip} + ${partData}= Create List ${fileName} ${fileData} application/octet-stream + &{fileParts}= Create Dictionary + Set To Dictionary ${fileParts} foo=${partData} + + ${resp}= Post Request ice_session ${ice_uri} files=${fileParts} + + Log Receive HTTP Status code ${resp.status_code} + Should Be Equal As Strings ${resp.status_code} 400 |