diff options
author | LiamBurke <Liam.Burke@ericsson.com> | 2019-02-11 12:28:55 +0000 |
---|---|---|
committer | LiamBurke <liam.burke@ericsson.com> | 2019-02-11 13:34:34 +0000 |
commit | a4516196eeb9c244f5a044a42aca21f1a0d97da8 (patch) | |
tree | 5b7e01245aabefa4a3de9ba900d6a90591f2a69d | |
parent | 47abceca6dcbb8d559277d92ad9cc0f1ea806196 (diff) |
Changes to CSIT so it executes in ONAP also
Change-Id: I518b92a1e6aa72e441bc62cc149870df6a8575e4
Issue-ID: INT-832
Signed-off-by: LiamBurke <liam.burke@ericsson.com>
-rw-r--r-- | plans/usecases/5G-bulkpm/README.txt | 55 | ||||
-rw-r--r-- | plans/usecases/5G-bulkpm/composefile/onap.docker-compose-e2e | 19 | ||||
-rw-r--r-- | plans/usecases/5G-bulkpm/onap.teardown.sh | 8 | ||||
-rw-r--r-- | plans/usecases/5G-bulkpm/setup.sh | 92 | ||||
-rw-r--r-- | tests/usecases/5G-bulkpm/BulkpmE2E.robot | 5 | ||||
-rw-r--r-- | tests/usecases/5G-bulkpm/assets/json_events/FileExistNotification.json | 2 |
6 files changed, 176 insertions, 5 deletions
diff --git a/plans/usecases/5G-bulkpm/README.txt b/plans/usecases/5G-bulkpm/README.txt new file mode 100644 index 00000000..1d0fc415 --- /dev/null +++ b/plans/usecases/5G-bulkpm/README.txt @@ -0,0 +1,55 @@ +################################################################################################################### +By executing the below commands it will change the CSIT test from executing on a docker envirnoment to an ONAP one. +################################################################################################################### + +1) Login to an ONAP instance,switch user and verify that the command kubectl executes before proceeding . +# sudo -s +# kubectl get svc -n onap| grep dcae + +2) Clone the csit repositry +# git clone https://gerrit.onap.org/r/integration/csit + +3) Install docker-compose +# sudo apt-get update +# sudo curl -L https://github.com/docker/compose/releases/download/1.22.0/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose +# sudo chmod +x /usr/local/bin/docker-compose +# docker-compose --version + +4) Install the packages required for the RobotFramework. +# apt install python-pip +# sudo apt install python-pip virtualenv unzip sshuttle netcat libffi-dev libssl-dev +# sudo pip install robotframework +# sudo pip install -U requests +# sudo pip install -U robotframework-requests + +5) Expose the Ves-collector +# kubectl expose svc dcae-ves-collector --type=LoadBalancer --name=vesc -n onap + service "vesc" exposed + +6) Verify the Ves-collector is expose +# kubectl get svc -n onap | grep vesc + vesc LoadBalancer 10.43.203.47 10.209.63.55 8080:31835/TCP 1m + +7) Modify the file setup.sh and make the below change +# cd csit +# vi plans/usecases/5G-bulkpm/setup.sh +CSIT=TRUE + to +CSIT=FALSE + +8) Excute the Bulk PM e2e csit. +# ./run-csit.sh plans/usecases/5G-bulkpm/ + + +--> Trobleshooting +If the Test case "Verify Default Feed And File Consumer Subscription On Datarouter" is hanging, quit the test and execute the below +Get the DR-PROV IP address +# kubectl -n onap -o=wide get pods | grep dmaap-dr-prov | awk '{print $6}' + 10.42.123.76 +Make sure there are no feeds +# curl -k https://10.42.123.76:8443/internal/prov + +If there is feeds delete them +curl -X DELETE -H "Content-Type:application/vnd.att-dr.subscription" -H "X-ATT-DR-ON-BEHALF-OF:dradmin" -k https://10.42.123.76:8443/subs/XX + +Where XX is the number of the feeds in the previous command. diff --git a/plans/usecases/5G-bulkpm/composefile/onap.docker-compose-e2e b/plans/usecases/5G-bulkpm/composefile/onap.docker-compose-e2e new file mode 100644 index 00000000..1c05ca5b --- /dev/null +++ b/plans/usecases/5G-bulkpm/composefile/onap.docker-compose-e2e @@ -0,0 +1,19 @@ +version: '2.1' +services: + datarouter-subscriber: + image: nexus3.onap.org:10001/onap/dmaap/datarouter-subscriber:2.0.0-SNAPSHOT + container_name: fileconsumer-node + hostname: subscriber.com + ports: + - "7070:7070" + volumes: + - ../subscriber_data/subscriber.properties:/opt/app/subscriber/etc/subscriber.properties + + sftp: + container_name: sftp + image: atmoz/sftp + ports: + - "2222:22" + volumes: + - /host/upload:/home/admin + command: admin:admin:1001
\ No newline at end of file diff --git a/plans/usecases/5G-bulkpm/onap.teardown.sh b/plans/usecases/5G-bulkpm/onap.teardown.sh new file mode 100644 index 00000000..966be45d --- /dev/null +++ b/plans/usecases/5G-bulkpm/onap.teardown.sh @@ -0,0 +1,8 @@ +#!/bin/bash +echo "Starting teardown script" +DFC_POD=$(kubectl -n onap get pods | grep datafile-collector | awk '{print $1}') +kubectl -n onap exec $DFC_POD -it cat /opt/log/application.log > /tmp/dfc_docker.log +cat /tmp/dfc_docker.log +sleep 3 +kill-instance.sh fileconsumer-node +kill-instance.sh sftp
\ No newline at end of file diff --git a/plans/usecases/5G-bulkpm/setup.sh b/plans/usecases/5G-bulkpm/setup.sh index 47e2532f..5f3c4a3c 100644 --- a/plans/usecases/5G-bulkpm/setup.sh +++ b/plans/usecases/5G-bulkpm/setup.sh @@ -2,6 +2,18 @@ # Place the scripts in run order: source ${SCRIPTS}/common_functions.sh +CSIT=TRUE +if [ ${CSIT} = "TRUE" ] ; then +#################################################### +#Executes the below setup in an Docker Environment # +#################################################### + +echo "CSIT Test get executed in here" +SFTP_PORT=22 +VESC_PORT=8080 +export VESC_PORT=${VESC_PORT} +export CLI_EXEC_CLI_DFC="docker exec dfc /bin/sh -c \"ls /target | grep .gz\"" + # Clone DMaaP Message Router repo mkdir -p $WORKSPACE/archives/dmaapmr cd $WORKSPACE/archives/dmaapmr @@ -116,7 +128,7 @@ export HOST_IP=${HOST_IP} export DMAAP_MR_IP=${DMAAP_MR_IP} #Pass any variables required by Robot test suites in ROBOT_VARIABLES -ROBOT_VARIABLES="-v DR_PROV_IP:${DR_PROV_IP} -v DR_NODE_IP:${DR_NODE_IP} -v DMAAP_MR_IP:${DMAAP_MR_IP} -v VESC_IP:${VESC_IP} -v DR_SUBSCIBER_IP:${DR_SUBSCIBER_IP}" +ROBOT_VARIABLES="-v DR_PROV_IP:${DR_PROV_IP} -v DR_NODE_IP:${DR_NODE_IP} -v DMAAP_MR_IP:${DMAAP_MR_IP} -v VESC_IP:${VESC_IP} -v VESC_PORT:${VESC_PORT} -v DR_SUBSCIBER_IP:${DR_SUBSCIBER_IP}" pip install jsonschema uuid # Wait container ready @@ -141,6 +153,7 @@ docker exec dfc /bin/sh -c "echo '${DR_NODE_IP}' dmaap-dr-node >> /etc/hosts" # Update the File Ready Notification with actual sftp ip address and copy pm files to sftp server. cp $WORKSPACE/tests/usecases/5G-bulkpm/assets/json_events/FileExistNotification.json $WORKSPACE/tests/usecases/5G-bulkpm/assets/json_events/FileExistNotificationUpdated.json sed -i 's/sftpserver/'${SFTP_IP}'/g' $WORKSPACE/tests/usecases/5G-bulkpm/assets/json_events/FileExistNotificationUpdated.json +sed -i 's/sftpport/'${SFTP_PORT}'/g' $WORKSPACE/tests/usecases/5G-bulkpm/assets/json_events/FileExistNotificationUpdated.json docker cp $WORKSPACE/plans/usecases/5G-bulkpm/assets/xNF.pm.xml.gz sftp:/home/admin/ # Data Router Configuration: @@ -151,3 +164,80 @@ sed -i 's/fileconsumer/'${DR_SUBSCIBER_IP}'/g' /tmp/addSubscriber.json curl -v -X POST -H "Content-Type:application/vnd.dmaap-dr.subscription" -H "X-DMAAP-DR-ON-BEHALF-OF:dradmin" --data-ascii @/tmp/addSubscriber.json --post301 --location-trusted -k https://${DR_PROV_IP}:8443/subscribe/1 sleep 10 curl -k https://$DR_PROV_IP:8443/internal/prov + +else +############################################################ +############################################################ +# Executes the below setup in an ONAP Environment # +# Make sure the steps in the README are completed first !! # +############################################################ +############################################################ +SFTP_PORT=2222 + +cp $WORKSPACE/plans/usecases/5G-bulkpm/teardown.sh $WORKSPACE/plans/usecases/5G-bulkpm/teardown.sh.orig +cp $WORKSPACE/plans/usecases/5G-bulkpm/onap.teardown.sh $WORKSPACE/plans/usecases/5G-bulkpm/teardown.sh + +#Get DataFileCollector POD name in this ONAP Deployment +DFC_POD=$(kubectl -n onap get pods | grep datafile-collector | awk '{print $1}') +export DFC_POD=${DFC_POD} +export CLI_EXEC_CLI_DFC="kubectl exec -n onap ${DFC_POD} -it ls /target | grep .gz" + +# Get IP address of datarrouter-prov +DR_PROV_IP=$(kubectl -n onap -o wide get pods | grep dmaap-dr-prov | awk '{print $6}') +echo DR_PROV_IP=${DR_PROV_IP} +DR_NODE_IP=$(kubectl -n onap -o=wide get pods | grep dmaap-dr-node | awk '{print $6}') +echo DR_NODE_IP=${DR_NODE_IP} + +# Get IP address of exposed Ves and its port +DMAAP_MR_IP=$(kubectl -n onap -o=wide get pods | grep dev-dmaap-message-router | grep -Ev "kafka|zookeeper" | awk '{print $6}') +VESC_IP=$(kubectl get svc -n onap | grep vesc | awk '{print $4}') +VESC_PORT=$(kubectl get svc -n onap | grep vesc | awk '{print $5}' | cut -d ":" -f2 | cut -d "/" -f1) +echo VESC_IP=${VESC_IP} +echo VESC_PORT=${VESC_PORT} + +export VESC_IP=${VESC_IP} +export VESC_PORT=${VESC_PORT} +export HOST_IP=${HOST_IP} +export DMAAP_MR_IP=${DMAAP_MR_IP} + +#Get DataFileCollector POD name in this ONAP Deployment +DFC_POD=$(kubectl -n onap get pods | grep datafile-collector | awk '{print $1}') +export DFC_POD=${DFC_POD} + +pip install jsonschema uuid + +# Clone DMaaP Data Router repo +mkdir -p $WORKSPACE/archives/dmaapdr +cd $WORKSPACE/archives/dmaapdr +git clone --depth 1 https://gerrit.onap.org/r/dmaap/datarouter -b master +cd $WORKSPACE/archives/dmaapdr/datarouter/datarouter-docker-compose/src/main/resources +mkdir docker-compose +cd $WORKSPACE/archives/dmaapdr/datarouter/datarouter-docker-compose/src/main/resources/docker-compose +cp $WORKSPACE/plans/usecases/5G-bulkpm/composefile/onap.docker-compose-e2e $WORKSPACE/archives/dmaapdr/datarouter/datarouter-docker-compose/src/main/resources/docker-compose/docker-compose.yml + +#Statup the SFTP and FileConsumer containers. +docker login -u docker -p docker nexus3.onap.org:10001 +docker-compose up -d + +# Wait container ready +sleep 2 +HOST_IP=$(ip route get 8.8.8.8 | awk '/8.8.8.8/ {print $NF}') +# SFTP Configuration: +# Update the File Ready Notification with actual sftp ip address and copy pm files to sftp server. +cp $WORKSPACE/tests/usecases/5G-bulkpm/assets/json_events/FileExistNotification.json $WORKSPACE/tests/usecases/5G-bulkpm/assets/json_events/FileExistNotificationUpdated.json +sed -i 's/sftpserver/'${HOST_IP}'/g' $WORKSPACE/tests/usecases/5G-bulkpm/assets/json_events/FileExistNotificationUpdated.json +sed -i 's/sftpport/'${SFTP_PORT}'/g' $WORKSPACE/tests/usecases/5G-bulkpm/assets/json_events/FileExistNotificationUpdated.json +docker cp $WORKSPACE/plans/usecases/5G-bulkpm/assets/xNF.pm.xml.gz sftp:/home/admin/ + +# Create default feed and create file consumer subscriber on data router +curl -v -X POST -H "Content-Type:application/vnd.att-dr.feed" -H "X-ATT-DR-ON-BEHALF-OF:dradmin" --data-ascii @$WORKSPACE/plans/usecases/5G-bulkpm/assets/createFeed.json --post301 --location-trusted -k https://${DR_PROV_IP}:8443 +cp $WORKSPACE/plans/usecases/5G-bulkpm/assets/addSubscriber.json /tmp/addSubscriber.json +sed -i 's/fileconsumer/'${HOST_IP}'/g' /tmp/addSubscriber.json +curl -v -X POST -H "Content-Type:application/vnd.att-dr.subscription" -H "X-ATT-DR-ON-BEHALF-OF:dradmin" --data-ascii @/tmp/addSubscriber.json --post301 --location-trusted -k https://${DR_PROV_IP}:8443/subscribe/1 +sleep 10 +curl -k https://$DR_PROV_IP:8443/internal/prov + +#Pass any variables required by Robot test suites in ROBOT_VARIABLES +ROBOT_VARIABLES="-v DR_PROV_IP:${DR_PROV_IP} -v DR_NODE_IP:${DR_NODE_IP} -v DMAAP_MR_IP:${DMAAP_MR_IP} -v VESC_IP:${VESC_IP} -v VESC_PORT:${VESC_PORT} -v DR_SUBSCIBER_IP:${DR_SUBSCIBER_IP} -v DFC_POD:${DFC_POD} -v HOST_IP:${HOST_IP} " + +fi;
\ No newline at end of file diff --git a/tests/usecases/5G-bulkpm/BulkpmE2E.robot b/tests/usecases/5G-bulkpm/BulkpmE2E.robot index fcc1cc76..28de4c24 100644 --- a/tests/usecases/5G-bulkpm/BulkpmE2E.robot +++ b/tests/usecases/5G-bulkpm/BulkpmE2E.robot @@ -8,7 +8,7 @@ Resource resources/bulkpm_keywords.robot *** Variables *** -${VESC_URL} http://%{VESC_IP}:8080 +${VESC_URL} http://%{VESC_IP}:%{VESC_PORT} ${GLOBAL_APPLICATION_ID} robot-ves ${VES_ANY_EVENT_PATH} /eventListener/v7 ${HEADER_STRING} content-type=application/json @@ -17,7 +17,6 @@ ${EVENT_DATA_FILE} %{WORKSPACE}/tests/usecases/5G-bulkpm/a ${TARGETURL_TOPICS} http://${DMAAP_MR_IP}:3904/topics ${TARGETURL_SUBSCR} http://${DMAAP_MR_IP}:3904/events/unauthenticated.VES_NOTIFICATION_OUTPUT/OpenDcae-c12/C12?timeout=1000 ${CLI_EXEC_CLI} curl -k https://${DR_PROV_IP}:8443/internal/prov -${CLI_EXEC_CLI_DFC} docker exec dfc /bin/sh -c "ls /target | grep .gz" ${CLI_EXEC_CLI_FILECONSUMER} docker exec fileconsumer-node /bin/sh -c "ls /opt/app/subscriber/delivery | grep .gz" *** Test Cases *** @@ -55,7 +54,7 @@ Check VES Notification Topic is existing in Message Router Verify Downloaded PM file from xNF exist on Data File Collector [Tags] Bulk_PM_E2E_03 [Documentation] Check the PM XML file exists on the data file collector - ${cli_cmd_output}= Run Process ${CLI_EXEC_CLI_DFC} shell=yes + ${cli_cmd_output}= Run Process %{CLI_EXEC_CLI_DFC} shell=yes Log ${cli_cmd_output.stdout} Should Be Equal As Strings ${cli_cmd_output.rc} 0 Should Contain ${cli_cmd_output.stdout} xNF.pm.xml.gz diff --git a/tests/usecases/5G-bulkpm/assets/json_events/FileExistNotification.json b/tests/usecases/5G-bulkpm/assets/json_events/FileExistNotification.json index 4064ea31..d5d8fd05 100644 --- a/tests/usecases/5G-bulkpm/assets/json_events/FileExistNotification.json +++ b/tests/usecases/5G-bulkpm/assets/json_events/FileExistNotification.json @@ -21,7 +21,7 @@ "arrayOfNamedHashMap": [ { "name": "xNF.pm.xml.gz", "hashMap":{ - "location": "sftp://admin:admin@sftpserver:22/xNF.pm.xml.gz", + "location": "sftp://admin:admin@sftpserver:sftpport/xNF.pm.xml.gz", "compression": "gzip", "fileFormatType": "org.3GPP.32.435#measCollec", "fileFormatVersion": "V10" |