diff options
Diffstat (limited to 'test')
18 files changed, 407 insertions, 64 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/plans/dcaegen2-collectors-hv-ves/testsuites/docker-compose.yml b/test/csit/plans/dcaegen2-collectors-hv-ves/testsuites/docker-compose.yml index 66cbde22f..1673715cb 100644 --- a/test/csit/plans/dcaegen2-collectors-hv-ves/testsuites/docker-compose.yml +++ b/test/csit/plans/dcaegen2-collectors-hv-ves/testsuites/docker-compose.yml @@ -60,6 +60,25 @@ services: networks: - ves-hv-default + unencrypted-ves-hv-collector: + image: $DOCKER_REGISTRY/onap/org.onap.dcaegen2.collectors.hv-ves.hv-collector-main:latest + ports: + - "7060:6060" + - "7061:6061/tcp" + entrypoint: ["java", "-Dio.netty.leakDetection.level=paranoid", "-cp", "*:", "org.onap.dcae.collectors.veshv.main.MainKt"] + command: ["--listen-port", "6061","--config-url", "http://consul:8500/v1/kv/veshv-config", "--ssl-disable"] + healthcheck: + interval: 10s + timeout: 5s + retries: 2 + test: "curl --request GET --fail --silent --show-error localhost:6060/health/ready && nc -vz localhost 6061" + depends_on: + - kafka + volumes: + - ./ssl/:/etc/ves-hv/ + networks: + - ves-hv-default + dcae-app-simulator: image: $DOCKER_REGISTRY/onap/org.onap.dcaegen2.collectors.hv-ves.hv-collector-dcae-app-simulator:latest ports: 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 diff --git a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/authorization.robot b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/authorization.robot index 1b832f27d..15c1c4896 100644 --- a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/authorization.robot +++ b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/authorization.robot @@ -11,21 +11,47 @@ Test Teardown VES-HV Collector Test Shutdown Client Authorization Suite Setup Log Started Suite: VES-HV Client Authorization ${XNF_PORTS_LIST}= Create List 7000 - Configure Invalid xNF Simulators On Ports ${XNF_PORTS_LIST} + ${XNF_WITH_INVALID_CERTIFICATES}= Configure xNF Simulators ${XNF_PORTS_LIST} + ... should_use_valid_certs=${false} + Set Suite Variable ${XNF_WITH_INVALID_CERTIFICATES} + ${XNF_PORTS_LIST}= Create List 7001 + ${XNF_WITHOUT_SSL}= Configure xNF Simulators ${XNF_PORTS_LIST} + ... should_disable_ssl=${true} + Set Suite Variable ${XNF_WITHOUT_SSL} + ${XNF_PORTS_LIST}= Create List 7002 + ${XNF_WITHOUT_SSL_CONNECTING_TO_UNENCRYPTED_HV_VES}= Configure xNF Simulators ${XNF_PORTS_LIST} + ... should_disable_ssl=${true} + ... should_connect_to_unencrypted_hv_ves=${true} + Set Suite Variable ${XNF_WITHOUT_SSL_CONNECTING_TO_UNENCRYPTED_HV_VES} Log Suite setup finished - *** Test Cases *** Authorization [Documentation] VES-HV Collector should not authorize XNF with invalid certificate and not route any message ... to topics - ${SIMULATORS_LIST}= Get Invalid xNF Simulators 1 - Send Messages From xNF Simulators ${SIMULATORS_LIST} ${XNF_VALID_MESSAGES_REQUEST} + Send Messages From xNF Simulators ${XNF_WITH_INVALID_CERTIFICATES} ${XNF_VALID_MESSAGES_REQUEST} + + Wait until keyword succeeds 60 sec 5 sec + ... Assert Dcae App Consumed ${DCAE_APP_API_MESSAGES_COUNT_URL} ${AMOUNT_0} + +Unencrypted connection from client + [Documentation] VES-HV Collector should not authorize XNF trying to connect through unencrypted connection + + Send Messages From xNF Simulators ${XNF_WITHOUT_SSL} ${XNF_VALID_MESSAGES_REQUEST} Wait until keyword succeeds 60 sec 5 sec ... Assert Dcae App Consumed ${DCAE_APP_API_MESSAGES_COUNT_URL} ${AMOUNT_0} +Unencrypted connection on both ends + [Documentation] When run without SSL turned on, VES-HV Collector should route all valid messages + ... from xNF trying to connect through unencrypted connection + + Send Messages From xNF Simulators ${XNF_WITHOUT_SSL_CONNECTING_TO_UNENCRYPTED_HV_VES} ${XNF_VALID_MESSAGES_REQUEST} + + Wait until keyword succeeds 60 sec 5 sec + ... Assert Dcae App Consumed ${DCAE_APP_API_MESSAGES_COUNT_URL} ${AMOUNT_5000} + *** Variables *** ${VES_HV_SCENARIOS} %{WORKSPACE}/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios @@ -33,3 +59,4 @@ ${VES_HV_SCENARIOS} %{WORKSPACE}/test/csit/tests/dcae ${XNF_VALID_MESSAGES_REQUEST} ${VES_HV_SCENARIOS}/authorization/xnf-valid-messages-request.json ${AMOUNT_0} 0 +${AMOUNT_5000} 5000 diff --git a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/libraries/XnfSimulatorLibrary.py b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/libraries/XnfSimulatorLibrary.py index b2466d7ca..26d5a91c2 100644 --- a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/libraries/XnfSimulatorLibrary.py +++ b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/libraries/XnfSimulatorLibrary.py @@ -1,4 +1,3 @@ -from VesHvContainersUtilsLibrary import copy_to_container import HttpRequests import os import docker @@ -16,13 +15,22 @@ ONE_SECOND_IN_NANOS = 10 ** 9 class XnfSimulatorLibrary: - def start_xnf_simulators(self, list_of_ports, valid_certs=True): + def start_xnf_simulators(self, list_of_ports, + should_use_valid_certs=True, + should_disable_ssl=False, + should_connect_to_unencrypted_hv_ves=False): logger.info("Creating " + str(len(list_of_ports)) + " xNF Simulator containers") dockerClient = docker.from_env() - cert_name_prefix = "" if valid_certs else "invalid_" + self.pullImageIfAbsent(dockerClient) logger.info("Using image: " + SIMULATOR_IMAGE_FULL_NAME) - simulators_addresses = self.create_simulators(dockerClient, list_of_ports, cert_name_prefix) + + simulators_addresses = self.create_containers(dockerClient, + list_of_ports, + should_use_valid_certs, + should_disable_ssl, + should_connect_to_unencrypted_hv_ves) + self.assert_containers_startup_was_successful(dockerClient) dockerClient.close() return simulators_addresses @@ -35,34 +43,24 @@ class XnfSimulatorLibrary: "This can take a while.") dockerClient.images.pull(SIMULATOR_IMAGE_FULL_NAME) - def create_simulators(self, dockerClient, list_of_ports, cert_name_prefix): + def create_containers(self, + dockerClient, + list_of_ports, + should_use_valid_certs, + should_disable_ssl, + should_connect_to_unencrypted_hv_ves): simulators_addresses = [] for port in list_of_ports: - container = self.run_simulator(dockerClient, port, - collector_certs_lookup_dir + cert_name_prefix + "client.crt", - collector_certs_lookup_dir + cert_name_prefix + "client.key", - collector_certs_lookup_dir + cert_name_prefix + "trust.crt" - ) - + xnf = XnfSimulator(port, should_use_valid_certs, should_disable_ssl, should_connect_to_unencrypted_hv_ves) + container = self.run_simulator(dockerClient, xnf) logger.info("Started container: " + container.name + " " + container.id) - simulators_addresses.append(container.name + ":" + port) + simulators_addresses.append(container.name + ":" + xnf.port) return simulators_addresses - def run_simulator(self, dockerClient, port, client_crt_path, client_key_path, client_trust_store): - xNF_startup_command = ["--listen-port", port, - "--ves-host", "ves-hv-collector", - "--ves-port", "6061", - "--cert-file", client_crt_path, - "--private-key-file", client_key_path, - "--trust-cert-file", client_trust_store] - xNF_healthcheck_command = { - "interval": 5 * ONE_SECOND_IN_NANOS, - "timeout": 3 * ONE_SECOND_IN_NANOS, - "retries": 1, - "test": ["CMD", "curl", "--request", "GET", - "--fail", "--silent", "--show-error", - "localhost:" + port + "/healthcheck"] - } + def run_simulator(self, dockerClient, xnf): + xNF_startup_command = xnf.get_startup_command() + xNF_healthcheck_command = xnf.get_healthcheck_command() + port = xnf.port logger.info("Startup command: " + str(xNF_startup_command)) logger.info("Healthcheck command: " + str(xNF_healthcheck_command)) return dockerClient.containers.run(SIMULATOR_IMAGE_FULL_NAME, @@ -72,7 +70,7 @@ class XnfSimulatorLibrary: network="ves-hv-default", ports={port + "/tcp": port}, volumes=self.container_volumes(), - name="ves-hv-collector-xnf-simulator" + port) + name=xnf.container_name_prefix + port) def container_volumes(self): return {certificates_dir_path: {"bind": collector_certs_lookup_dir, "mode": 'rw'}} @@ -121,6 +119,46 @@ class XnfSimulatorLibrary: HttpRequests.checkStatusCode(resp.status_code, XNF_SIMULATOR_NAME) +class XnfSimulator: + container_name_prefix = "ves-hv-collector-xnf-simulator" + + def __init__(self, + port, + should_use_valid_certs, + should_disable_ssl, + should_connect_to_unencrypted_hv_ves): + self.port = port + cert_name_prefix = "" if should_use_valid_certs else "invalid_" + certificates_path_with_file_prefix = collector_certs_lookup_dir + cert_name_prefix + self.cert_path = certificates_path_with_file_prefix + "client.crt" + self.key_path = certificates_path_with_file_prefix + "client.key" + self.trust_cert_path = certificates_path_with_file_prefix + "trust.crt" + self.disable_ssl = should_disable_ssl + self.hv_collector_host = "unencrypted-ves-hv-collector" \ + if should_connect_to_unencrypted_hv_ves else "ves-hv-collector" + + def get_startup_command(self): + startup_command = ["--listen-port", self.port, + "--ves-host", self.hv_collector_host, + "--ves-port", "6061", + "--cert-file", self.cert_path, + "--private-key-file", self.key_path, + "--trust-cert-file", self.trust_cert_path] + if (self.disable_ssl): + startup_command.append("--ssl-disable") + return startup_command + + def get_healthcheck_command(self): + return { + "interval": 5 * ONE_SECOND_IN_NANOS, + "timeout": 3 * ONE_SECOND_IN_NANOS, + "retries": 1, + "test": ["CMD", "curl", "--request", "GET", + "--fail", "--silent", "--show-error", + "localhost:" + self.port + "/healthcheck"] + } + + class ContainerException(Exception): def __init__(self, message): super(ContainerException, self).__init__(message) diff --git a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/message-routing.robot b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/message-routing.robot index 6153afa0a..89208e456 100644 --- a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/message-routing.robot +++ b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/message-routing.robot @@ -14,7 +14,7 @@ Test Teardown VES-HV Collector Test Shutdown Message Routing Suite Setup Log Started Suite: VES-HV Message Routing ${XNF_PORTS_LIST}= Create List 7000 - Configure Valid xNF Simulators On Ports ${XNF_PORTS_LIST} + Configure xNF Simulators Using Valid Certificates On Ports ${XNF_PORTS_LIST} Log Suite setup finished *** Test Cases *** @@ -22,8 +22,8 @@ Correct Messages Routing [Documentation] VES-HV Collector should route all valid messages to topics specified in configuration ... and do not change message payload generated in XNF simulator - ${SIMULATORS_LIST}= Get Valid xNF Simulators 1 - Send Messages From xNF Simulators ${SIMULATORS_LIST} ${XNF_FIXED_PAYLOAD_REQUEST} + ${XNF_SIMULATOR}= Get xNF Simulators Using Valid Certificates + Send Messages From xNF Simulators ${XNF_SIMULATOR} ${XNF_FIXED_PAYLOAD_REQUEST} Wait until keyword succeeds 60 sec 5 sec ... Assert Dcae App Consumed ${DCAE_APP_API_MESSAGES_COUNT_URL} ${AMOUNT_25000} @@ -33,8 +33,8 @@ Correct Messages Routing Too big payload message handling [Documentation] VES-HV Collector should interrupt the stream when encountered message with too big payload - ${SIMULATORS_LIST}= Get Valid xNF Simulators 1 - Send Messages From xNF Simulators ${SIMULATORS_LIST} ${XNF_TOO_BIG_PAYLOAD_REQUEST} + ${XNF_SIMULATOR}= Get xNF Simulators Using Valid Certificates + Send Messages From xNF Simulators ${XNF_SIMULATOR} ${XNF_TOO_BIG_PAYLOAD_REQUEST} Wait until keyword succeeds 60 sec 5 sec ... Assert Dcae App Consumed Less Equal Than ${DCAE_APP_API_MESSAGES_COUNT_URL} ${AMOUNT_25000} @@ -43,8 +43,8 @@ Too big payload message handling Invalid wire frame message handling [Documentation] VES-HV Collector should skip messages with invalid wire frame - ${SIMULATORS_LIST}= Get Valid xNF Simulators 1 - Send Messages From xNF Simulators ${SIMULATORS_LIST} ${XNF_INVALID_WIRE_FRAME_REQUEST} + ${XNF_SIMULATOR}= Get xNF Simulators Using Valid Certificates + Send Messages From xNF Simulators ${XNF_SIMULATOR} ${XNF_INVALID_WIRE_FRAME_REQUEST} Wait until keyword succeeds 60 sec 5 sec ... Assert Dcae App Consumed ${DCAE_APP_API_MESSAGES_COUNT_URL} ${AMOUNT_50000} @@ -54,8 +54,8 @@ Invalid wire frame message handling Invalid GPB data message handling [Documentation] VES-HV Collector should skip messages with invalid GPB data - ${SIMULATORS_LIST}= Get Valid xNF Simulators 1 - Send Messages From xNF Simulators ${SIMULATORS_LIST} ${XNF_INVALID_GPB_DATA_REQUEST} + ${XNF_SIMULATOR}= Get xNF Simulators Using Valid Certificates + Send Messages From xNF Simulators ${XNF_SIMULATOR} ${XNF_INVALID_GPB_DATA_REQUEST} Wait until keyword succeeds 60 sec 5 sec ... Assert Dcae App Consumed ${DCAE_APP_API_MESSAGES_COUNT_URL} ${AMOUNT_50000} @@ -65,8 +65,8 @@ Invalid GPB data message handling Unsupported domain message handling [Documentation] VES-HV Collector should skip messages with unsupported domain - ${SIMULATORS_LIST}= Get Valid xNF Simulators 1 - Send Messages From xNF Simulators ${SIMULATORS_LIST} ${XNF_UNSUPPORTED_DOMAIN_REQUEST} + ${XNF_SIMULATOR}= Get xNF Simulators Using Valid Certificates + Send Messages From xNF Simulators ${XNF_SIMULATOR} ${XNF_UNSUPPORTED_DOMAIN_REQUEST} Wait until keyword succeeds 60 sec 5 sec ... Assert Dcae App Consumed ${DCAE_APP_API_MESSAGES_COUNT_URL} ${AMOUNT_50000} diff --git a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/multiple-clients.robot b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/multiple-clients.robot index 862a2bc6a..9b1982a6b 100644 --- a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/multiple-clients.robot +++ b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/multiple-clients.robot @@ -11,14 +11,14 @@ Test Teardown VES-HV Collector Test Shutdown Multiple Clients Handling Suite Setup Log Started Suite: VES-HV Multiple Clients Handling ${XNF_PORTS_LIST}= Create List 7000 7001 7002 - Configure Valid xNF Simulators On Ports ${XNF_PORTS_LIST} + Configure xNF Simulators Using Valid Certificates On Ports ${XNF_PORTS_LIST} Log Suite setup finished *** Test Cases *** Handle Multiple Connections [Documentation] VES-HV Collector should handle multiple incoming transmissions - ${SIMULATORS_LIST}= Get Valid xNF Simulators 3 + ${SIMULATORS_LIST}= Get xNF Simulators Using Valid Certificates 3 Send Messages From xNF Simulators ${SIMULATORS_LIST} ${XNF_SMALLER_PAYLOAD_REQUEST} Wait until keyword succeeds 60 sec 5 sec diff --git a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/common-keywords.robot b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/common-keywords.robot index bc03de232..58f5cbc16 100644 --- a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/common-keywords.robot +++ b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/common-keywords.robot @@ -4,30 +4,28 @@ Library VesHvContainersUtilsLibrary Library Collections *** Keywords *** -Configure Valid xNF Simulators On Ports +Configure xNF Simulators Using Valid Certificates On Ports [Arguments] ${XNF_PORTS_LIST} - ${VALID_XNF_SIMULATORS_ADDRESSES}= Start Xnf Simulators ${XNF_PORTS_LIST} ${true} + ${VALID_XNF_SIMULATORS_ADDRESSES}= Configure xNF Simulators ${XNF_PORTS_LIST} Set Suite Variable ${VALID_XNF_SIMULATORS_ADDRESSES} - -Configure Invalid xNF Simulators On Ports +Configure xNF Simulators [Arguments] ${XNF_PORTS_LIST} - ${INVALID_XNF_SIMULATORS_ADDRESSES}= Start Xnf Simulators ${XNF_PORTS_LIST} ${false} - Set Suite Variable ${INVALID_XNF_SIMULATORS_ADDRESSES} - - -Get Valid xNF Simulators - [Arguments] ${AMOUNT} + ... ${should_use_valid_certs}=${true} + ... ${should_disable_ssl}=${false} + ... ${should_connect_to_unencrypted_hv_ves}=${false} + ${XNF_SIMULATORS_ADDRESSES}= Start Xnf Simulators ${XNF_PORTS_LIST} + ... ${should_use_valid_certs} + ... ${should_disable_ssl} + ... ${should_connect_to_unencrypted_hv_ves} + [Return] ${XNF_SIMULATORS_ADDRESSES} + +Get xNF Simulators Using Valid Certificates + [Arguments] ${AMOUNT}=1 ${SIMULATORS}= Get Slice From List ${VALID_XNF_SIMULATORS_ADDRESSES} 0 ${AMOUNT} [Return] ${SIMULATORS} -Get Invalid xNF Simulators - [Arguments] ${AMOUNT} - ${SIMULATORS}= Get Slice From List ${INVALID_XNF_SIMULATORS_ADDRESSES} 0 ${AMOUNT} - [Return] ${SIMULATORS} - - Send Messages From xNF Simulators [Arguments] ${XNF_HOSTS_LIST} ${MESSAGE_FILEPATH} :FOR ${HOST} IN @{XNF_HOSTS_LIST} diff --git a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/authorization/xnf-valid-messages-request.json b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/authorization/xnf-valid-messages-request.json index c71793d7d..75d938766 100644 --- a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/authorization/xnf-valid-messages-request.json +++ b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/authorization/xnf-valid-messages-request.json @@ -18,6 +18,6 @@ "sourceName": "sample-source-name" }, "messageType": "VALID", - "messagesAmount": 500000 + "messagesAmount": 5000 } ]
\ No newline at end of file diff --git a/test/csit/tests/dcaegen2/prh-testcases/resources/PrhLibrary.py b/test/csit/tests/dcaegen2/prh-testcases/resources/PrhLibrary.py index c2a8b78a2..7c52f5430 100644 --- a/test/csit/tests/dcaegen2/prh-testcases/resources/PrhLibrary.py +++ b/test/csit/tests/dcaegen2/prh-testcases/resources/PrhLibrary.py @@ -43,4 +43,4 @@ class PrhLibrary(object): def create_invalid_notification(self, json_file): return self.create_pnf_ready_notification(json_file).replace("\":", "\": ")\ .replace("ipaddress-v4-oam", "oamV4IpAddress").replace("ipaddress-v6-oam", "oamV6IpAddress")\ - .replace("}", "\\\\n}") + .replace("}", "\\n}") diff --git a/test/csit/tests/dcaegen2/prh-testcases/resources/prh_library.robot b/test/csit/tests/dcaegen2/prh-testcases/resources/prh_library.robot index fa8c0d052..b7e339bc9 100644 --- a/test/csit/tests/dcaegen2/prh-testcases/resources/prh_library.robot +++ b/test/csit/tests/dcaegen2/prh-testcases/resources/prh_library.robot @@ -19,7 +19,7 @@ Invalid event processing [Timeout] 30s Set event in DMaaP ${input_invalid_event_in_dmaap} ${invalid_notification}= Create invalid notification ${input_invalid_event_in_dmaap} - ${notification}= Catenate SEPARATOR= \\\\n |org.onap.dcaegen2.services.prh.exceptions.DmaapNotFoundException: Incorrect json, consumerDmaapModel can not be created: ${invalid_notification} + ${notification}= Catenate SEPARATOR= \\n |org.onap.dcaegen2.services.prh.exceptions.DmaapNotFoundException: Incorrect json, consumerDmaapModel can not be created: ${invalid_notification} Wait Until Keyword Succeeds 100x 100ms Check PRH log ${notification} Valid event processing |