aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrajendrajaiswal <rajendra.jaiswal@ericsson.com>2018-09-07 15:23:18 +0100
committerrajendrajaiswal <rajendra.jaiswal@ericsson.com>2018-09-12 11:27:20 +0100
commit6823ae7e627761d0a3eb1a0c4dde30043d25c865 (patch)
tree370d613765bbc0ede9d6c523a0aa8a4bb1948aae
parentdc0afcbbd39a144f0d7c57760b219576049fc67c (diff)
Integration Test Cases for 5G Bulk PM
Change-Id: Ibec3e9726354b8f3818084b03f61c0e9aed09df2 Issue-ID: INT-649 Signed-off-by: Rajendra Jaiswal <rajendra.jaiswal@ericsson.com>
-rw-r--r--test/csit/plans/dcae-bulkpm/bulkpm-suite/setup.sh86
-rw-r--r--test/csit/plans/dcae-bulkpm/bulkpm-suite/teardown.sh8
-rw-r--r--test/csit/plans/dcae-bulkpm/bulkpm-suite/testplan.txt3
-rw-r--r--test/csit/scripts/dcae-bulkpm/xNFSimulator.sh28
-rw-r--r--test/csit/tests/dcae-bulkpm/testcases/__init__.robot2
-rw-r--r--test/csit/tests/dcae-bulkpm/testcases/assets/json_events/FileExistNotification.json30
-rw-r--r--test/csit/tests/dcae-bulkpm/testcases/e2e.robot40
-rw-r--r--test/csit/tests/dcae-bulkpm/testcases/resources/VesLibrary.py25
-rw-r--r--test/csit/tests/dcae-bulkpm/testcases/resources/ves_keywords.robot39
9 files changed, 261 insertions, 0 deletions
diff --git a/test/csit/plans/dcae-bulkpm/bulkpm-suite/setup.sh b/test/csit/plans/dcae-bulkpm/bulkpm-suite/setup.sh
new file mode 100644
index 000000000..530d97da1
--- /dev/null
+++ b/test/csit/plans/dcae-bulkpm/bulkpm-suite/setup.sh
@@ -0,0 +1,86 @@
+#!/bin/bash
+# Place the scripts in run order:
+#Make sure python-uuid is installed
+
+# Place the scripts in run order:
+source ${SCRIPTS}/dcae-bulkpm/xNFSimulator.sh
+
+# Place the scripts in run order:
+source ${SCRIPTS}/common_functions.sh
+
+#get current host IP addres
+HOST_IP=$(ip route get 8.8.8.8 | awk '/8.8.8.8/ {print $NF}')
+
+VESC_IMAGE=nexus3.onap.org:10001/onap/org.onap.dcaegen2.collectors.ves.vescollector:1.3.1
+echo VESC_IMAGE=${VESC_IMAGE}
+
+# Start DCAE VES Collector
+docker run -d -p 8080:8080/tcp -p 8443:8443/tcp -P --name vesc -e DMAAPHOST=${HOST_IP} ${VESC_IMAGE}
+
+# Clone DMaaP Message Router repo
+mkdir -p $WORKSPACE/archives/dmaapmr
+cd $WORKSPACE/archives/dmaapmr
+#unset http_proxy https_proxy
+git clone --depth 1 http://gerrit.onap.org/r/dmaap/messagerouter/messageservice -b master
+git pull
+cd $WORKSPACE/archives/dmaapmr/messageservice/src/main/resources/docker-compose
+cp $WORKSPACE/archives/dmaapmr/messageservice/bundleconfig-local/etc/appprops/MsgRtrApi.properties /var/tmp/
+
+# Update kafkfa and zookeeper properties in MsgRtrApi.propeties which will be copied to DMaaP Container
+sed -i -e 's#nexus3.onap.org:10001/onap/dmaap/kafka01101:0.0.1#wurstmeister/kafka:1.1.0#' $WORKSPACE/archives/dmaapmr/messageservice/src/main/resources/docker-compose/docker-compose.yml
+
+# start DMaaP MR containers with docker compose and configuration from docker-compose.yml
+docker login -u docker -p docker nexus3.onap.org:10001
+docker-compose up -d
+
+# Wait for initialization of Docker contaienr for DMaaP MR, Kafka and Zookeeper
+for i in {1..50}; do
+if [ $(docker inspect --format '{{ .State.Running }}' dockercompose_kafka_1) ] && \
+[ $(docker inspect --format '{{ .State.Running }}' dockercompose_zookeeper_1) ] && \
+[ $(docker inspect --format '{{ .State.Running }}' dockercompose_dmaap_1) ]
+then
+ echo "DMaaP Service Running"
+ break
+else
+ echo sleep $i
+ sleep $i
+fi
+done
+
+# Get IP address of DMAAP, KAFKA, Zookeeper
+DMAAP_MR_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' dockercompose_dmaap_1)
+KAFKA_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' dockercompose_kafka_1)
+ZOOKEEPER_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' dockercompose_zookeeper_1)
+
+echo DMAAP_MR_IP=${DMAAP_MR_IP}
+echo KAFKA_IP=${KAFKA_IP}
+echo ZOOKEEPER_IP=${ZOOKEEPER_IP}
+
+# Shutdown DMAAP Container
+docker kill dockercompose_dmaap_1
+
+# Initial docker-compose up and down is for populating kafka and zookeeper IPs in /var/tmp/MsgRtrApi.properites
+sed -i -e '/config.zk.servers=/ s/=.*/='$ZOOKEEPER_IP'/' /var/tmp/MsgRtrApi.properties
+sed -i -e '/kafka.metadata.broker.list=/ s/=.*/='$KAFKA_IP':9092/' /var/tmp/MsgRtrApi.properties
+
+# Start DMaaP MR containers with docker compose and configuration from docker-compose.yml
+docker-compose build
+docker login -u docker -p docker nexus3.onap.org:10001
+docker-compose up -d
+sleep 5
+
+# Get IP address of DMAAP, KAFKA, Zookeeper and VESC
+DMAAP_MR_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' dockercompose_dmaap_1)
+KAFKA_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' dockercompose_kafka_1)
+ZOOKEEPER_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' dockercompose_zookeeper_1)
+
+VESC_IP=`get-instance-ip.sh vesc`
+export VESC_IP=${VESC_IP}
+export HOST_IP=${HOST_IP}
+export DMAAP_MR_IP=${DMAAP_MR_IP}
+
+ROBOT_VARIABLES="-v DMAAP_MR_IP:${DMAAP_MR_IP} -v VESC_IP:${VESC_IP}"
+
+pip install jsonschema uuid
+# Wait container ready
+sleep 2
diff --git a/test/csit/plans/dcae-bulkpm/bulkpm-suite/teardown.sh b/test/csit/plans/dcae-bulkpm/bulkpm-suite/teardown.sh
new file mode 100644
index 000000000..85428dad9
--- /dev/null
+++ b/test/csit/plans/dcae-bulkpm/bulkpm-suite/teardown.sh
@@ -0,0 +1,8 @@
+#!/bin/bash
+echo "Starting teardown script"
+kill-instance.sh vesc
+kill-instance.sh dockercompose_dmaap_1
+kill-instance.sh dockercompose_kafka_1
+kill-instance.sh dockercompose_zookeeper_1
+
+
diff --git a/test/csit/plans/dcae-bulkpm/bulkpm-suite/testplan.txt b/test/csit/plans/dcae-bulkpm/bulkpm-suite/testplan.txt
new file mode 100644
index 000000000..25a5d6e8b
--- /dev/null
+++ b/test/csit/plans/dcae-bulkpm/bulkpm-suite/testplan.txt
@@ -0,0 +1,3 @@
+# Test suites are relative paths under [integration.git]/test/csit/tests/.
+# Place the suites in run order.
+dcae-bulkpm/testcases
diff --git a/test/csit/scripts/dcae-bulkpm/xNFSimulator.sh b/test/csit/scripts/dcae-bulkpm/xNFSimulator.sh
new file mode 100644
index 000000000..1728ef75b
--- /dev/null
+++ b/test/csit/scripts/dcae-bulkpm/xNFSimulator.sh
@@ -0,0 +1,28 @@
+#!/bin/bash
+#This scritt will simulate xNF ftpes functionality.
+#This script will automatic install vsftpd and it will make necessary changes to vsftpd.conf
+sudo apt-get install vsftpd -y
+sudo useradd -m -u 12345 -g users -d /home/ftpuser -s /bin/bash -p "$(echo ftpuser | openssl passwd -1 -stdin)" ftpuser
+sudo chown root:root /home/ftpuser
+sudo mkdir -p /tmp/ftp/rop
+sudo chown nobody:nogroup /tmp/ftp/rop
+sudo openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout /etc/ssl/private/vsftpd.pem -out /etc/ssl/private/vsftpd.pem -subj "/C=IE/ST=ftp/L=Springfield/O=Dis/CN=www.onap.org"
+sudo sed -i -e '/anonymous_enable=/ s/=.*/=NO/' /etc/vsftpd.conf
+sudo sed -i -e '/local_enable=/ s/=.*/=NO/' /etc/vsftpd.conf
+sudo sed -i -e '/write_enable=/ s/=.*/=YES/' /etc/vsftpd.conf
+sudo sed -i -e '/#write_enable=/ s/#write_enable=.*/write_enable=YES/' /etc/vsftpd.conf
+sudo sed -i -e '/chroot_local_user=/ s/=.*/=YES/' /etc/vsftpd.conf
+sudo sed -i -e '0,/#chroot_local_user=/ s/#chroot_local_user=.*/chroot_local_user=YES/' /etc/vsftpd.conf
+sudo sed -i -e '/ssl_enable=/ s/=.*/=YES/' /etc/vsftpd.conf
+sudo sed -i -e "/ssl_enable=YES/a\\allow_anon_ssl=YES" /etc/vsftpd.conf
+sudo sed -i -e "/allow_anon_ssl=NO/a\\force_local_data_ssl=NO" /etc/vsftpd.conf
+sudo sed -i -e "/force_local_data_ssl=NO/a\\force_local_logins_ssl=NO" /etc/vsftpd.conf
+sudo sed -i -e "/force_local_logins_ssl=NO/a\\ssl_tlsv1=YES" /etc/vsftpd.conf
+sudo sed -i -e "/ssl_tlsv1=YES/a\\ssl_sslv2=NO" /etc/vsftpd.conf
+sudo sed -i -e "/ssl_sslv2=NO/a\\ssl_sslv3=NO" /etc/vsftpd.conf
+sudo sed -i -e "/ssl_sslv3=NO/a\\require_ssl_reuse=NO" /etc/vsftpd.conf
+sudo sed -i -e "/require_ssl_reuse=NO/a\\ssl_ciphers=HIGH" /etc/vsftpd.conf
+sudo sed -i -e "/ssl_ciphers=HIGH/a\\hide_ids=YES" /etc/vsftpd.conf
+sudo sed -i -e "/ssl_ciphers=HIGH/a\\anon_root=/var/ftp/" /etc/vsftpd.conf
+sudo sed -i -e "/ssl_ciphers=HIGH/a\\no_anon_password=YES" /etc/vsftpd.conf
+sudo service vsftpd restart \ No newline at end of file
diff --git a/test/csit/tests/dcae-bulkpm/testcases/__init__.robot b/test/csit/tests/dcae-bulkpm/testcases/__init__.robot
new file mode 100644
index 000000000..7114fd447
--- /dev/null
+++ b/test/csit/tests/dcae-bulkpm/testcases/__init__.robot
@@ -0,0 +1,2 @@
+*** Settings ***
+Documentation 5G Bulk PM E2E Testcases
diff --git a/test/csit/tests/dcae-bulkpm/testcases/assets/json_events/FileExistNotification.json b/test/csit/tests/dcae-bulkpm/testcases/assets/json_events/FileExistNotification.json
new file mode 100644
index 000000000..96068e39a
--- /dev/null
+++ b/test/csit/tests/dcae-bulkpm/testcases/assets/json_events/FileExistNotification.json
@@ -0,0 +1,30 @@
+{
+ "event": {
+ "commonEventHeader": {
+ "version": "4.0.1",
+ "vesEventListenerVersion": "7.0.1",
+ "domain": "notification",
+ "eventName": "Noti_RnNode-Ericsson_FileReady",
+ "eventId": "FileReady_1797490e-10ae-4d48-9ea7-3d7d790b25e1",
+ "lastEpochMicrosec": 8745745764578,
+ "priority": "Normal",
+ "reportingEntityName": "otenb5309",
+ "sequence": 0,
+ "sourceName": "oteNB5309",
+ "startEpochMicrosec": 8745745764578,
+ "timeZoneOffset": "UTC+05.30"
+ },
+ "notificationFields": {
+ "changeIdentifier": "PM_MEAS_FILES",
+ "changeType": "FileReady",
+ "notificationFieldsVersion": "2.0",
+ "additionalFields":
+ {
+ "location": "ftpes://192.168.0.101:22/ftp/rop/A20161224.1030-1045.bin.gz",
+ "compression": "gzip",
+ "fileformatType": "org.3GPP.32.435#measCollec",
+ "fileFormatVersion": "V10"
+ }
+ }
+ }
+ } \ No newline at end of file
diff --git a/test/csit/tests/dcae-bulkpm/testcases/e2e.robot b/test/csit/tests/dcae-bulkpm/testcases/e2e.robot
new file mode 100644
index 000000000..69c795341
--- /dev/null
+++ b/test/csit/tests/dcae-bulkpm/testcases/e2e.robot
@@ -0,0 +1,40 @@
+*** Settings ***
+Documentation Testing E2E VES,Dmaap,DFC,DR with File Ready event feed from xNF
+Library RequestsLibrary
+Library OperatingSystem
+Library Collections
+Resource resources/ves_keywords.robot
+
+
+*** Variables ***
+${VESC_URL} http://%{VESC_IP}:8080
+${GLOBAL_APPLICATION_ID} robot-ves
+${VES_ANY_EVENT_PATH} /eventListener/v7
+${HEADER_STRING} content-type=application/json
+${EVENT_DATA_FILE} %{WORKSPACE}/test/csit/tests/dcae-bulkpm/testcases/assets/json_events/FileExistNotification.json
+
+${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
+*** Test Cases ***
+
+Send VES File Ready Event to VES Collector
+ [Tags] DCAE-VESC-R1
+ [Documentation] Post single event and expect 200 Response
+ ${evtdata}= Get Event Data From File ${EVENT_DATA_FILE}
+ ${headers}= Create Header From String ${HEADER_STRING}
+ ${resp}= Publish Event To VES Collector ${VESC_URL} ${VES_ANY_EVENT_PATH} ${headers} ${evtdata}
+ Log Receive HTTP Status code ${resp.status_code}
+ Should Be Equal As Strings ${resp.status_code} 202
+
+Check VES Notification Topic is existing in Message Router
+ [Documentation] Get the count of the Topics
+ [Timeout] 1 minute
+ Sleep 10s
+ ${resp}= GetCall ${TARGETURL_TOPICS}
+ log ${TARGETURL_TOPICS}
+ log 'JSON Response Code :'${resp}
+ ${topics}= Evaluate $resp.json().get('topics')
+ log ${topics}
+ ${ListLength}= Get Length ${topics}
+ log ${ListLength}
+ List Should Contain Value ${topics} unauthenticated.VES_NOTIFICATION_OUTPUT
diff --git a/test/csit/tests/dcae-bulkpm/testcases/resources/VesLibrary.py b/test/csit/tests/dcae-bulkpm/testcases/resources/VesLibrary.py
new file mode 100644
index 000000000..d1ec9811d
--- /dev/null
+++ b/test/csit/tests/dcae-bulkpm/testcases/resources/VesLibrary.py
@@ -0,0 +1,25 @@
+'''
+Created on Aug 18, 2017
+
+@author: sw6830
+'''
+from robot.api import logger
+from Queue import Queue
+import uuid, time, json, threading,os, platform, subprocess,paramiko
+
+class VesLibrary(object):
+
+ def __init__(self):
+ pass
+
+ def create_header_from_string(self, dictStr):
+ logger.info("Enter create_header_from_string: dictStr")
+ return dict(u.split("=") for u in dictStr.split(","))
+
+ def Generate_UUID(self):
+ """generate a uuid"""
+ return uuid.uuid4()
+
+if __name__ == '__main__':
+ lib = VesLibrary()
+ time.sleep(100000) \ No newline at end of file
diff --git a/test/csit/tests/dcae-bulkpm/testcases/resources/ves_keywords.robot b/test/csit/tests/dcae-bulkpm/testcases/resources/ves_keywords.robot
new file mode 100644
index 000000000..76bc33f47
--- /dev/null
+++ b/test/csit/tests/dcae-bulkpm/testcases/resources/ves_keywords.robot
@@ -0,0 +1,39 @@
+ *** Settings ***
+Documentation The main interface for interacting with VES. It handles low level stuff like managing the http request library and VES required fields
+Library RequestsLibrary
+Library ../resources/VesLibrary.py
+Library OperatingSystem
+Library Collections
+Library requests
+Library Collections
+Library String
+
+*** Variables ***
+
+*** Keywords ***
+
+Get Event Data From File
+ [Arguments] ${jsonfile}
+ ${data}= OperatingSystem.Get File ${jsonfile}
+ #Should Not Be_Equal ${data} None
+ [return] ${data}
+
+Publish Event To VES Collector
+ [Documentation] Send an event to VES Collector
+ [Arguments] ${url} ${evtpath} ${httpheaders} ${evtdata}
+ Log Creating session ${url}
+ ${session}= Create Session dcaegen2-d1 ${url}
+ ${resp}= Post Request dcaegen2-d1 ${evtpath} data=${evtdata} headers=${httpheaders}
+ #Log Received response from dcae ${resp.json()}
+ [return] ${resp}
+PostCall
+ [Arguments] ${url} ${data}
+ ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
+ ${resp}= Evaluate requests.post('${url}',data='${data}', headers=${headers},verify=False) requests
+ [Return] ${resp}
+
+GetCall
+ [Arguments] ${url}
+ ${resp}= Evaluate requests.get('${url}') requests
+ [Return] ${resp}
+ \ No newline at end of file