From 9abb61ca2cea1907cab2cec312d6dca6e53a93cd Mon Sep 17 00:00:00 2001 From: Gary Wu Date: Thu, 27 Sep 2018 10:38:50 -0700 Subject: Move CSIT to integration/csit repo To facilite branching of CSIT tests, all CSIT test code and scripts are relocated to the integration/csit repo. Change-Id: I1e4c0eff44691f73f8098b3c52764107f6b8b8df Issue-ID: INT-671 Signed-off-by: Gary Wu --- .../testcases/__init__.robot | 56 +++++++ .../testcases/authorization.robot | 62 ++++++++ .../testcases/libraries/ConsulLibrary.py | 16 ++ .../testcases/libraries/DcaeAppSimulatorLibrary.py | 46 ++++++ .../testcases/libraries/HttpRequests.py | 19 +++ .../libraries/VesHvContainersUtilsLibrary.py | 69 +++++++++ .../testcases/libraries/XnfSimulatorLibrary.py | 166 +++++++++++++++++++++ .../testcases/message-routing.robot | 93 ++++++++++++ .../testcases/multiple-clients.robot | 35 +++++ .../testcases/resources/common-keywords.robot | 48 ++++++ .../authorization/xnf-valid-messages-request.json | 24 +++ .../fixed-payload/dcae-fixed-payload-request.json | 24 +++ .../fixed-payload/xnf-fixed-payload-request.json | 24 +++ .../dcae-invalid-gpb-data-request.json | 24 +++ .../xnf-invalid-gpb-data-request.json | 68 +++++++++ .../dcae-invalid-wire-frame-request.json | 24 +++ .../xnf-invalid-wire-frame-request.json | 68 +++++++++ .../dcae-smaller-valid-request.json | 24 +++ .../xnf-simulator-smaller-valid-request.json | 24 +++ .../xnf-too-big-payload-request.json | 68 +++++++++ .../dcae-unsupported-domain-request.json | 24 +++ .../xnf-unsupported-domain-request.json | 68 +++++++++ .../testcases/resources/ves-hv-configuration.json | 9 ++ 23 files changed, 1083 insertions(+) create mode 100644 tests/dcaegen2-collectors-hv-ves/testcases/__init__.robot create mode 100644 tests/dcaegen2-collectors-hv-ves/testcases/authorization.robot create mode 100644 tests/dcaegen2-collectors-hv-ves/testcases/libraries/ConsulLibrary.py create mode 100644 tests/dcaegen2-collectors-hv-ves/testcases/libraries/DcaeAppSimulatorLibrary.py create mode 100644 tests/dcaegen2-collectors-hv-ves/testcases/libraries/HttpRequests.py create mode 100644 tests/dcaegen2-collectors-hv-ves/testcases/libraries/VesHvContainersUtilsLibrary.py create mode 100644 tests/dcaegen2-collectors-hv-ves/testcases/libraries/XnfSimulatorLibrary.py create mode 100644 tests/dcaegen2-collectors-hv-ves/testcases/message-routing.robot create mode 100644 tests/dcaegen2-collectors-hv-ves/testcases/multiple-clients.robot create mode 100644 tests/dcaegen2-collectors-hv-ves/testcases/resources/common-keywords.robot create mode 100644 tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/authorization/xnf-valid-messages-request.json create mode 100644 tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/fixed-payload/dcae-fixed-payload-request.json create mode 100644 tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/fixed-payload/xnf-fixed-payload-request.json create mode 100644 tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/invalid-gpb-data/dcae-invalid-gpb-data-request.json create mode 100644 tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/invalid-gpb-data/xnf-invalid-gpb-data-request.json create mode 100644 tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/invalid-wire-frame/dcae-invalid-wire-frame-request.json create mode 100644 tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/invalid-wire-frame/xnf-invalid-wire-frame-request.json create mode 100644 tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/multiple-simulators-payload/dcae-smaller-valid-request.json create mode 100644 tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/multiple-simulators-payload/xnf-simulator-smaller-valid-request.json create mode 100644 tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/too-big-payload/xnf-too-big-payload-request.json create mode 100644 tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/unsupported-domain/dcae-unsupported-domain-request.json create mode 100644 tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/unsupported-domain/xnf-unsupported-domain-request.json create mode 100644 tests/dcaegen2-collectors-hv-ves/testcases/resources/ves-hv-configuration.json (limited to 'tests/dcaegen2-collectors-hv-ves/testcases') diff --git a/tests/dcaegen2-collectors-hv-ves/testcases/__init__.robot b/tests/dcaegen2-collectors-hv-ves/testcases/__init__.robot new file mode 100644 index 00000000..c0a96dbc --- /dev/null +++ b/tests/dcaegen2-collectors-hv-ves/testcases/__init__.robot @@ -0,0 +1,56 @@ +*** Settings *** +Library DcaeAppSimulatorLibrary +Library ConsulLibrary +Library VesHvContainersUtilsLibrary + +Suite Setup HV-VES Collector Suites Setup + +*** Keywords *** +HV-VES Collector Suites Setup + Log Started Suite: HV-VES + Configure collector + Configure Dcae App + Log Suite setup finished + + +Configure collector + ${CONSUL_API_ACCESS}= Get Consul Api Access Url ${HTTP_METHOD_URL} ${CONSUL_CONTAINER_HOST} ${CONSUL_CONTAINER_PORT} + ${CONSUL_API_URL}= Catenate SEPARATOR= ${CONSUL_API_ACCESS} ${CONSUL_VES_HV_CONFIGURATION_KEY_PATH} + Publish HV VES Configuration In Consul ${CONSUL_API_URL} ${VES_HV_CONFIGURATION_JSON_FILEPATH} + +Configure Dcae App + ${DCAE_APP_API_ACCESS}= Get Dcae App Api Access Url ${HTTP_METHOD_URL} ${DCAE_APP_CONTAINER_HOST} ${DCAE_APP_CONTAINER_PORT} + + ${DCAE_APP_API_MESSAGE_RESET_URL}= Catenate SEPARATOR= ${DCAE_APP_API_ACCESS} ${DCAE_APP_API_MESSAGES_RESET_PATH} + Set Suite Variable ${DCAE_APP_API_MESSAGE_RESET_URL} children=True + + ${DCAE_APP_API_MESSAGES_COUNT_URL}= Catenate SEPARATOR= ${DCAE_APP_API_ACCESS} ${DCAE_APP_API_MESSAGES_COUNT_PATH} + Set Suite Variable ${DCAE_APP_API_MESSAGES_COUNT_URL} children=True + + ${DCAE_APP_API_MESSAGES_VALIDATION_URL}= Catenate SEPARATOR= ${DCAE_APP_API_ACCESS} ${DCAE_APP_API_MESSAGES_VALIDATION_PATH} + Set Suite Variable ${DCAE_APP_API_MESSAGES_VALIDATION_URL} children=True + + ${DCAE_APP_API_TOPIC_CONFIGURATION_URL}= Catenate SEPARATOR= ${DCAE_APP_API_ACCESS} ${DCAE_APP_API_TOPIC_CONFIGURATION_PATH} + Wait until keyword succeeds 10 sec 5 sec + ... Configure Dcae App Simulator To Consume Messages From Topics ${DCAE_APP_API_TOPIC_CONFIGURATION_URL} ${ROUTED_MESSAGES_TOPIC} + + +*** Variables *** +${HTTP_METHOD_URL} http:// + +${CONSUL_CONTAINER_HOST} consul +${CONSUL_CONTAINER_PORT} 8500 +${CONSUL_VES_HV_CONFIGURATION_KEY_PATH} /v1/kv/veshv-config + +${DCAE_APP_CONTAINER_HOST} dcae-app-simulator +${DCAE_APP_CONTAINER_PORT} 6063 +${DCAE_APP_API_TOPIC_CONFIGURATION_PATH} /configuration/topics +${DCAE_APP_API_MESSAGES_RESET_PATH} /messages +${DCAE_APP_API_MESSAGES_PATH} /messages/all +${DCAE_APP_API_MESSAGES_COUNT_PATH} ${DCAE_APP_API_MESSAGES_PATH}/count +${DCAE_APP_API_MESSAGES_VALIDATION_PATH} ${DCAE_APP_API_MESSAGES_PATH}/validate + +${ROUTED_MESSAGES_TOPIC} test-hv-ran-meas + +${VES_HV_RESOURCES} %{WORKSPACE}/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources +${VES_HV_CONFIGURATION_JSON_FILEPATH} ${VES_HV_RESOURCES}/ves-hv-configuration.json diff --git a/tests/dcaegen2-collectors-hv-ves/testcases/authorization.robot b/tests/dcaegen2-collectors-hv-ves/testcases/authorization.robot new file mode 100644 index 00000000..15c1c489 --- /dev/null +++ b/tests/dcaegen2-collectors-hv-ves/testcases/authorization.robot @@ -0,0 +1,62 @@ +*** Settings *** +Library DcaeAppSimulatorLibrary + +Resource resources/common-keywords.robot + +Suite Setup Client Authorization Suite Setup +Suite Teardown VES-HV Collector Suite Teardown +Test Teardown VES-HV Collector Test Shutdown + +*** Keywords *** +Client Authorization Suite Setup + Log Started Suite: VES-HV Client Authorization + ${XNF_PORTS_LIST}= Create List 7000 + ${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 + + 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 + +${XNF_VALID_MESSAGES_REQUEST} ${VES_HV_SCENARIOS}/authorization/xnf-valid-messages-request.json + +${AMOUNT_0} 0 +${AMOUNT_5000} 5000 diff --git a/tests/dcaegen2-collectors-hv-ves/testcases/libraries/ConsulLibrary.py b/tests/dcaegen2-collectors-hv-ves/testcases/libraries/ConsulLibrary.py new file mode 100644 index 00000000..52d7e0ea --- /dev/null +++ b/tests/dcaegen2-collectors-hv-ves/testcases/libraries/ConsulLibrary.py @@ -0,0 +1,16 @@ +from robot.api import logger +import HttpRequests + +CONSUL_NAME = "Consul" + +class ConsulLibrary: + + def publish_hv_ves_configuration_in_consul(self, consul_url, consul_configuration_filepath): + logger.info("Reading consul configuration file from: " + consul_configuration_filepath) + file = open(consul_configuration_filepath, "rb") + data = file.read() + file.close() + + logger.info("PUT at: " + consul_url) + resp = HttpRequests.session_without_env().put(consul_url, data=data, timeout=5) + HttpRequests.checkStatusCode(resp.status_code, CONSUL_NAME) \ No newline at end of file diff --git a/tests/dcaegen2-collectors-hv-ves/testcases/libraries/DcaeAppSimulatorLibrary.py b/tests/dcaegen2-collectors-hv-ves/testcases/libraries/DcaeAppSimulatorLibrary.py new file mode 100644 index 00000000..9edad2cc --- /dev/null +++ b/tests/dcaegen2-collectors-hv-ves/testcases/libraries/DcaeAppSimulatorLibrary.py @@ -0,0 +1,46 @@ +import HttpRequests +from robot.api import logger + +DCAE_APP_NAME = "DCAE App" + + +class DcaeAppSimulatorLibrary: + + def configure_dcae_app_simulator_to_consume_messages_from_topics(self, app_url, topics): + logger.info("PUT at: " + app_url) + resp = HttpRequests.session_without_env().put(app_url, data={'topics': topics}, timeout=10) + HttpRequests.checkStatusCode(resp.status_code, DCAE_APP_NAME) + + def assert_DCAE_app_consumed(self, app_url, expected_messages_amount): + logger.info("GET at: " + app_url) + resp = HttpRequests.session_without_env().get(app_url, timeout=10) + HttpRequests.checkStatusCode(resp.status_code, DCAE_APP_NAME) + + assert resp.content == expected_messages_amount, \ + "Messages consumed by simulator: " + resp.content + " expecting: " + expected_messages_amount + + def assert_DCAE_app_consumed_less_equal_than(self, app_url, messages_threshold): + logger.info("GET at: " + app_url) + resp = HttpRequests.session_without_env().get(app_url, timeout=10) + HttpRequests.checkStatusCode(resp.status_code, DCAE_APP_NAME) + + logger.debug("Messages consumed by simulator: " + resp.content + + " expecting more than 0 and less/equal than " + messages_threshold) + + assert 0 < int(resp.content) <= int(messages_threshold), \ + "Messages consumed by simulator: " + resp.content + \ + " expecting more than 0 and less/equal than " + messages_threshold + + def reset_DCAE_app_simulator(self, app_url): + logger.info("DELETE at: " + app_url) + resp = HttpRequests.session_without_env().delete(app_url, timeout=10) + HttpRequests.checkStatusCode(resp.status_code, DCAE_APP_NAME) + + def assert_DCAE_app_consumed_proper_messages(self, app_url, message_filepath): + logger.info("POST at: " + app_url) + file = open(message_filepath, "rb") + data = file.read() + file.close() + + resp = HttpRequests.session_without_env().post(app_url, data=data, timeout=10) + HttpRequests.checkStatusCode(resp.status_code, DCAE_APP_NAME) diff --git a/tests/dcaegen2-collectors-hv-ves/testcases/libraries/HttpRequests.py b/tests/dcaegen2-collectors-hv-ves/testcases/libraries/HttpRequests.py new file mode 100644 index 00000000..c0dcd81d --- /dev/null +++ b/tests/dcaegen2-collectors-hv-ves/testcases/libraries/HttpRequests.py @@ -0,0 +1,19 @@ +import requests +from robot.api import logger + +valid_status_codes = [ + requests.codes.ok, + requests.codes.accepted +] + + +def session_without_env(): + session = requests.Session() + session.trust_env = False + return session + + +def checkStatusCode(status_code, server_name): + if status_code not in valid_status_codes: + logger.error("Response status code from " + server_name + ": " + str(status_code)) + raise (Exception(server_name + " returned status code " + status_code)) diff --git a/tests/dcaegen2-collectors-hv-ves/testcases/libraries/VesHvContainersUtilsLibrary.py b/tests/dcaegen2-collectors-hv-ves/testcases/libraries/VesHvContainersUtilsLibrary.py new file mode 100644 index 00000000..989a796c --- /dev/null +++ b/tests/dcaegen2-collectors-hv-ves/testcases/libraries/VesHvContainersUtilsLibrary.py @@ -0,0 +1,69 @@ +from time import time + +from robot.api import logger +import os.path +import docker +from io import BytesIO +from os.path import basename +from tarfile import TarFile, TarInfo + +LOCALHOST = "localhost" + + +class VesHvContainersUtilsLibrary: + + def get_consul_api_access_url(self, method, image_name, port): + return self.create_url( + method, + self.get_instance_address(image_name, port) + ) + + def get_xnf_sim_api_access_url(self, method, host): + if is_running_inside_docker(): + return self.create_url(method, host) + else: + logger.info("File `/.dockerenv` not found. Assuming local environment and using localhost.") + port_from_container_name = str(host)[-4:] + return self.create_url(method, LOCALHOST + ":" + port_from_container_name) + + def get_dcae_app_api_access_url(self, method, image_name, port): + return self.create_url( + method, + self.get_instance_address(image_name, port) + ) + + def get_instance_address(self, image_name, port): + if is_running_inside_docker(): + return image_name + ":" + port + else: + logger.info("File `/.dockerenv` not found. Assuming local environment and using localhost.") + return LOCALHOST + ":" + port + + def create_url(self, method, host_address): + return method + host_address + +def is_running_inside_docker(): + return os.path.isfile("/.dockerenv") + +def copy_to_container(container_id, filepaths, path='/etc/ves-hv'): + with create_archive(filepaths) as archive: + docker.APIClient('unix:///var/run/docker.sock') \ + .put_archive(container=container_id, path=(path), data=archive) + + +def create_archive(filepaths): + tarstream = BytesIO() + tarfile = TarFile(fileobj=tarstream, mode='w') + for filepath in filepaths: + file = open(filepath, 'r') + file_data = file.read() + + tarinfo = TarInfo(name=basename(file.name)) + tarinfo.size = len(file_data) + tarinfo.mtime = time() + + tarfile.addfile(tarinfo, BytesIO(file_data)) + + tarfile.close() + tarstream.seek(0) + return tarstream diff --git a/tests/dcaegen2-collectors-hv-ves/testcases/libraries/XnfSimulatorLibrary.py b/tests/dcaegen2-collectors-hv-ves/testcases/libraries/XnfSimulatorLibrary.py new file mode 100644 index 00000000..f6a97875 --- /dev/null +++ b/tests/dcaegen2-collectors-hv-ves/testcases/libraries/XnfSimulatorLibrary.py @@ -0,0 +1,166 @@ +import HttpRequests +import os +import docker +from robot.api import logger +from time import sleep + +XNF_SIMULATOR_NAME = "xNF Simulator" +SIMULATOR_IMAGE_NAME = "onap/org.onap.dcaegen2.collectors.hv-ves.hv-collector-xnf-simulator" +SIMULATOR_IMAGE_FULL_NAME = os.getenv("DOCKER_REGISTRY_PREFIX") + SIMULATOR_IMAGE_NAME + ":latest" +WORKSPACE_ENV = os.getenv("WORKSPACE") +certificates_dir_path = WORKSPACE_ENV + "/test/csit/plans/dcaegen2-collectors-hv-ves/testsuites/ssl/" +collector_certs_lookup_dir = "/etc/ves-hv/" +ONE_SECOND_IN_NANOS = 10 ** 9 + + +class XnfSimulatorLibrary: + + 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() + + self.pullImageIfAbsent(dockerClient) + logger.info("Using image: " + SIMULATOR_IMAGE_FULL_NAME) + + 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 + + def pullImageIfAbsent(self, dockerClient): + try: + dockerClient.images.get(SIMULATOR_IMAGE_FULL_NAME) + except: + logger.console("Image " + SIMULATOR_IMAGE_FULL_NAME + " will be pulled from repository. " + "This can take a while.") + dockerClient.images.pull(SIMULATOR_IMAGE_FULL_NAME) + + 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: + 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 + ":" + xnf.port) + return simulators_addresses + + 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, + command=xNF_startup_command, + healthcheck=xNF_healthcheck_command, + detach=True, + network="ves-hv-default", + ports={port + "/tcp": port}, + volumes=self.container_volumes(), + name=xnf.container_name_prefix + port) + + def container_volumes(self): + return {certificates_dir_path: {"bind": collector_certs_lookup_dir, "mode": 'rw'}} + + def assert_containers_startup_was_successful(self, dockerClient): + checks_amount = 6 + check_interval_in_seconds = 5 + for _ in range(checks_amount): + sleep(check_interval_in_seconds) + all_containers_healthy = True + for container in self.get_simulators_list(dockerClient): + all_containers_healthy = all_containers_healthy and self.is_container_healthy(container) + if (all_containers_healthy): + return + raise ContainerException("One of xNF simulators containers did not pass the healthcheck.") + + def is_container_healthy(self, container): + container_health = container.attrs['State']['Health']['Status'] + return container_health == 'healthy' and container.status == 'running' + + def stop_and_remove_all_xnf_simulators(self, suite_name): + dockerClient = docker.from_env() + for container in self.get_simulators_list(dockerClient): + logger.info("Stopping and removing container: " + container.id) + log_filename = WORKSPACE_ENV + "/archives/containers_logs/" + \ + suite_name.split(".")[-1] + "_" + container.name + ".log" + file = open(log_filename, "w+") + file.write(container.logs()) + file.close() + container.stop() + container.remove() + dockerClient.close() + + def get_simulators_list(self, dockerClient): + return dockerClient.containers.list(filters={"ancestor": SIMULATOR_IMAGE_FULL_NAME}, all=True) + + def send_messages(self, simulator_url, message_filepath): + logger.info("Reading message to simulator from: " + message_filepath) + + file = open(message_filepath, "rb") + data = file.read() + file.close() + + logger.info("POST at: " + simulator_url) + resp = HttpRequests.session_without_env().post(simulator_url, data=data, timeout=5) + 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 "untrusted" + certificates_path_with_file_prefix = collector_certs_lookup_dir + cert_name_prefix + self.key_store_path = certificates_path_with_file_prefix + "client.p12" + self.trust_store_path = certificates_path_with_file_prefix + "trust.p12" + self.sec_store_passwd = "onaponap" + 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", + "--key-store", self.key_store_path, + "--trust-store", self.trust_store_path, + "--key-store-password", self.sec_store_passwd, + "--trust-store-password", self.sec_store_passwd + ] + 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/tests/dcaegen2-collectors-hv-ves/testcases/message-routing.robot b/tests/dcaegen2-collectors-hv-ves/testcases/message-routing.robot new file mode 100644 index 00000000..89208e45 --- /dev/null +++ b/tests/dcaegen2-collectors-hv-ves/testcases/message-routing.robot @@ -0,0 +1,93 @@ +*** Settings *** +Library DcaeAppSimulatorLibrary +Library XnfSimulatorLibrary +Library VesHvContainersUtilsLibrary +Library Collections + +Resource resources/common-keywords.robot + +Suite Setup Message Routing Suite Setup +Suite Teardown VES-HV Collector Suite Teardown +Test Teardown VES-HV Collector Test Shutdown + +*** Keywords *** +Message Routing Suite Setup + Log Started Suite: VES-HV Message Routing + ${XNF_PORTS_LIST}= Create List 7000 + Configure xNF Simulators Using Valid Certificates On Ports ${XNF_PORTS_LIST} + Log Suite setup finished + +*** Test Cases *** +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 + + ${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} + Assert Dcae App Consumed Proper Messages ${DCAE_APP_API_MESSAGES_VALIDATION_URL} ${DCAE_FIXED_PAYLOAD_REQUEST} + + +Too big payload message handling + [Documentation] VES-HV Collector should interrupt the stream when encountered message with too big payload + + ${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} + + +Invalid wire frame message handling + [Documentation] VES-HV Collector should skip messages with invalid wire frame + + ${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} + Assert Dcae App Consumed Proper Messages ${DCAE_APP_API_MESSAGES_VALIDATION_URL} ${DCAE_INVALID_WIRE_FRAME_REQUEST} + + +Invalid GPB data message handling + [Documentation] VES-HV Collector should skip messages with invalid GPB data + + ${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} + Assert Dcae App Consumed Proper Messages ${DCAE_APP_API_MESSAGES_VALIDATION_URL} ${DCAE_INVALID_GPB_DATA_REQUEST} + + +Unsupported domain message handling + [Documentation] VES-HV Collector should skip messages with unsupported domain + + ${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} + Assert Dcae App Consumed Proper Messages ${DCAE_APP_API_MESSAGES_VALIDATION_URL} ${DCAE_UNSUPPORTED_DOMAIN_REQUEST} + +*** Variables *** +${HTTP_METHOD_URL} http:// + +${XNF_SIM_API_PATH} /simulator/async + +${VES_HV_SCENARIOS} %{WORKSPACE}/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios +${XNF_FIXED_PAYLOAD_REQUEST} ${VES_HV_SCENARIOS}/fixed-payload/xnf-fixed-payload-request.json +${XNF_TOO_BIG_PAYLOAD_REQUEST} ${VES_HV_SCENARIOS}/too-big-payload/xnf-too-big-payload-request.json +${XNF_INVALID_WIRE_FRAME_REQUEST} ${VES_HV_SCENARIOS}/invalid-wire-frame/xnf-invalid-wire-frame-request.json +${XNF_INVALID_GPB_DATA_REQUEST} ${VES_HV_SCENARIOS}/invalid-gpb-data/xnf-invalid-gpb-data-request.json +${XNF_UNSUPPORTED_DOMAIN_REQUEST} ${VES_HV_SCENARIOS}/unsupported-domain/xnf-unsupported-domain-request.json + +${DCAE_FIXED_PAYLOAD_REQUEST} ${VES_HV_SCENARIOS}/fixed-payload/dcae-fixed-payload-request.json +${DCAE_INVALID_WIRE_FRAME_REQUEST} ${VES_HV_SCENARIOS}/invalid-wire-frame/dcae-invalid-wire-frame-request.json +${DCAE_INVALID_GPB_DATA_REQUEST} ${VES_HV_SCENARIOS}/invalid-gpb-data/dcae-invalid-gpb-data-request.json +${DCAE_UNSUPPORTED_DOMAIN_REQUEST} ${VES_HV_SCENARIOS}/unsupported-domain/dcae-unsupported-domain-request.json + +${AMOUNT_25000} 25000 +${AMOUNT_50000} 50000 diff --git a/tests/dcaegen2-collectors-hv-ves/testcases/multiple-clients.robot b/tests/dcaegen2-collectors-hv-ves/testcases/multiple-clients.robot new file mode 100644 index 00000000..9b1982a6 --- /dev/null +++ b/tests/dcaegen2-collectors-hv-ves/testcases/multiple-clients.robot @@ -0,0 +1,35 @@ +*** Settings *** +Library DcaeAppSimulatorLibrary + +Resource resources/common-keywords.robot + +Suite Setup Multiple Clients Handling Suite Setup +Suite Teardown VES-HV Collector Suite Teardown +Test Teardown VES-HV Collector Test Shutdown + +*** Keywords *** +Multiple Clients Handling Suite Setup + Log Started Suite: VES-HV Multiple Clients Handling + ${XNF_PORTS_LIST}= Create List 7000 7001 7002 + 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 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 + ... Assert Dcae App Consumed ${DCAE_APP_API_MESSAGES_COUNT_URL} ${AMOUNT_15000} + Assert Dcae App Consumed Proper Messages ${DCAE_APP_API_MESSAGES_VALIDATION_URL} ${DCAE_SMALLER_PAYLOAD_REQUEST} + + +*** Variables *** +${VES_HV_SCENARIOS} %{WORKSPACE}/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios + +${XNF_SMALLER_PAYLOAD_REQUEST} ${VES_HV_SCENARIOS}/multiple-simulators-payload/xnf-simulator-smaller-valid-request.json +${DCAE_SMALLER_PAYLOAD_REQUEST} ${VES_HV_SCENARIOS}/multiple-simulators-payload/dcae-smaller-valid-request.json + +${AMOUNT_15000} 15000 diff --git a/tests/dcaegen2-collectors-hv-ves/testcases/resources/common-keywords.robot b/tests/dcaegen2-collectors-hv-ves/testcases/resources/common-keywords.robot new file mode 100644 index 00000000..58f5cbc1 --- /dev/null +++ b/tests/dcaegen2-collectors-hv-ves/testcases/resources/common-keywords.robot @@ -0,0 +1,48 @@ +*** Settings *** +Library XnfSimulatorLibrary +Library VesHvContainersUtilsLibrary +Library Collections + +*** Keywords *** +Configure xNF Simulators Using Valid Certificates On Ports + [Arguments] ${XNF_PORTS_LIST} + ${VALID_XNF_SIMULATORS_ADDRESSES}= Configure xNF Simulators ${XNF_PORTS_LIST} + Set Suite Variable ${VALID_XNF_SIMULATORS_ADDRESSES} + +Configure xNF Simulators + [Arguments] ${XNF_PORTS_LIST} + ... ${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} + + +Send Messages From xNF Simulators + [Arguments] ${XNF_HOSTS_LIST} ${MESSAGE_FILEPATH} + :FOR ${HOST} IN @{XNF_HOSTS_LIST} + \ ${XNF_SIM_API_ACCESS}= Get xNF Sim Api Access Url ${HTTP_METHOD_URL} ${HOST} + \ ${XNF_SIM_API_URL}= Catenate SEPARATOR= ${XNF_SIM_API_ACCESS} ${XNF_SIM_API_PATH} + \ Send messages ${XNF_SIM_API_URL} ${MESSAGE_FILEPATH} + + +VES-HV Collector Test Shutdown + Reset DCAE App Simulator ${DCAE_APP_API_MESSAGE_RESET_URL} + + +VES-HV Collector Suite Teardown + Stop And Remove All Xnf Simulators ${SUITE NAME} + +*** Variables *** +${HTTP_METHOD_URL} http:// + +${XNF_SIM_API_PATH} /simulator/async + diff --git a/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/authorization/xnf-valid-messages-request.json b/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/authorization/xnf-valid-messages-request.json new file mode 100644 index 00000000..9aca4015 --- /dev/null +++ b/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/authorization/xnf-valid-messages-request.json @@ -0,0 +1,24 @@ +[ + { + "commonEventHeader": { + "version": "sample-version", + "domain": "HVMEAS", + "sequence": 1, + "priority": 1, + "eventId": "sample-event-id", + "eventName": "sample-event-name", + "eventType": "sample-event-type", + "startEpochMicrosec": 120034455, + "lastEpochMicrosec": 120034455, + "nfNamingCode": "sample-nf-naming-code", + "nfcNamingCode": "sample-nfc-naming-code", + "reportingEntityId": "sample-reporting-entity-id", + "reportingEntityName": "sample-reporting-entity-name", + "sourceId": "sample-source-id", + "sourceName": "sample-source-name", + "vesEventListenerVersion": "another-version" + }, + "messageType": "VALID", + "messagesAmount": 5000 + } +] \ No newline at end of file diff --git a/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/fixed-payload/dcae-fixed-payload-request.json b/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/fixed-payload/dcae-fixed-payload-request.json new file mode 100644 index 00000000..642c7d56 --- /dev/null +++ b/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/fixed-payload/dcae-fixed-payload-request.json @@ -0,0 +1,24 @@ +[ + { + "commonEventHeader": { + "version": "sample-version", + "domain": "HVMEAS", + "sequence": 1, + "priority": 1, + "eventId": "sample-event-id", + "eventName": "sample-event-name", + "eventType": "sample-event-type", + "startEpochMicrosec": 120034455, + "lastEpochMicrosec": 120034455, + "nfNamingCode": "sample-nf-naming-code", + "nfcNamingCode": "sample-nfc-naming-code", + "reportingEntityId": "sample-reporting-entity-id", + "reportingEntityName": "sample-reporting-entity-name", + "sourceId": "sample-source-id", + "sourceName": "sample-source-name", + "vesEventListenerVersion": "another-version" + }, + "messageType": "FIXED_PAYLOAD", + "messagesAmount": 25000 + } +] diff --git a/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/fixed-payload/xnf-fixed-payload-request.json b/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/fixed-payload/xnf-fixed-payload-request.json new file mode 100644 index 00000000..642c7d56 --- /dev/null +++ b/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/fixed-payload/xnf-fixed-payload-request.json @@ -0,0 +1,24 @@ +[ + { + "commonEventHeader": { + "version": "sample-version", + "domain": "HVMEAS", + "sequence": 1, + "priority": 1, + "eventId": "sample-event-id", + "eventName": "sample-event-name", + "eventType": "sample-event-type", + "startEpochMicrosec": 120034455, + "lastEpochMicrosec": 120034455, + "nfNamingCode": "sample-nf-naming-code", + "nfcNamingCode": "sample-nfc-naming-code", + "reportingEntityId": "sample-reporting-entity-id", + "reportingEntityName": "sample-reporting-entity-name", + "sourceId": "sample-source-id", + "sourceName": "sample-source-name", + "vesEventListenerVersion": "another-version" + }, + "messageType": "FIXED_PAYLOAD", + "messagesAmount": 25000 + } +] diff --git a/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/invalid-gpb-data/dcae-invalid-gpb-data-request.json b/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/invalid-gpb-data/dcae-invalid-gpb-data-request.json new file mode 100644 index 00000000..f38e9aa0 --- /dev/null +++ b/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/invalid-gpb-data/dcae-invalid-gpb-data-request.json @@ -0,0 +1,24 @@ +[ + { + "commonEventHeader": { + "version": "sample-version", + "domain": "HVMEAS", + "sequence": 1, + "priority": 1, + "eventId": "sample-event-id", + "eventName": "sample-event-name", + "eventType": "sample-event-type", + "startEpochMicrosec": 120034455, + "lastEpochMicrosec": 120034455, + "nfNamingCode": "sample-nf-naming-code", + "nfcNamingCode": "sample-nfc-naming-code", + "reportingEntityId": "sample-reporting-entity-id", + "reportingEntityName": "sample-reporting-entity-name", + "sourceId": "sample-source-id", + "sourceName": "sample-source-name", + "vesEventListenerVersion": "another-version" + }, + "messageType": "VALID", + "messagesAmount": 50000 + } +] diff --git a/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/invalid-gpb-data/xnf-invalid-gpb-data-request.json b/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/invalid-gpb-data/xnf-invalid-gpb-data-request.json new file mode 100644 index 00000000..22d48c5f --- /dev/null +++ b/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/invalid-gpb-data/xnf-invalid-gpb-data-request.json @@ -0,0 +1,68 @@ +[ + { + "commonEventHeader": { + "version": "sample-version", + "domain": "HVMEAS", + "sequence": 1, + "priority": 1, + "eventId": "sample-event-id", + "eventName": "sample-event-name", + "eventType": "sample-event-type", + "startEpochMicrosec": 120034455, + "lastEpochMicrosec": 120034455, + "nfNamingCode": "sample-nf-naming-code", + "nfcNamingCode": "sample-nfc-naming-code", + "reportingEntityId": "sample-reporting-entity-id", + "reportingEntityName": "sample-reporting-entity-name", + "sourceId": "sample-source-id", + "sourceName": "sample-source-name", + "vesEventListenerVersion": "another-version" + }, + "messageType": "VALID", + "messagesAmount": 25000 + }, + { + "commonEventHeader": { + "version": "sample-version", + "domain": "HVMEAS", + "sequence": 1, + "priority": 1, + "eventId": "sample-event-id", + "eventName": "sample-event-name", + "eventType": "sample-event-type", + "startEpochMicrosec": 120034455, + "lastEpochMicrosec": 120034455, + "nfNamingCode": "sample-nf-naming-code", + "nfcNamingCode": "sample-nfc-naming-code", + "reportingEntityId": "sample-reporting-entity-id", + "reportingEntityName": "sample-reporting-entity-name", + "sourceId": "sample-source-id", + "sourceName": "sample-source-name", + "vesEventListenerVersion": "another-version" + }, + "messageType": "INVALID_GPB_DATA", + "messagesAmount": 100 + }, + { + "commonEventHeader": { + "version": "sample-version", + "domain": "HVMEAS", + "sequence": 1, + "priority": 1, + "eventId": "sample-event-id", + "eventName": "sample-event-name", + "eventType": "sample-event-type", + "startEpochMicrosec": 120034455, + "lastEpochMicrosec": 120034455, + "nfNamingCode": "sample-nf-naming-code", + "nfcNamingCode": "sample-nfc-naming-code", + "reportingEntityId": "sample-reporting-entity-id", + "reportingEntityName": "sample-reporting-entity-name", + "sourceId": "sample-source-id", + "sourceName": "sample-source-name", + "vesEventListenerVersion": "another-version" + }, + "messageType": "VALID", + "messagesAmount": 25000 + } +] diff --git a/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/invalid-wire-frame/dcae-invalid-wire-frame-request.json b/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/invalid-wire-frame/dcae-invalid-wire-frame-request.json new file mode 100644 index 00000000..f38e9aa0 --- /dev/null +++ b/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/invalid-wire-frame/dcae-invalid-wire-frame-request.json @@ -0,0 +1,24 @@ +[ + { + "commonEventHeader": { + "version": "sample-version", + "domain": "HVMEAS", + "sequence": 1, + "priority": 1, + "eventId": "sample-event-id", + "eventName": "sample-event-name", + "eventType": "sample-event-type", + "startEpochMicrosec": 120034455, + "lastEpochMicrosec": 120034455, + "nfNamingCode": "sample-nf-naming-code", + "nfcNamingCode": "sample-nfc-naming-code", + "reportingEntityId": "sample-reporting-entity-id", + "reportingEntityName": "sample-reporting-entity-name", + "sourceId": "sample-source-id", + "sourceName": "sample-source-name", + "vesEventListenerVersion": "another-version" + }, + "messageType": "VALID", + "messagesAmount": 50000 + } +] diff --git a/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/invalid-wire-frame/xnf-invalid-wire-frame-request.json b/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/invalid-wire-frame/xnf-invalid-wire-frame-request.json new file mode 100644 index 00000000..a7d22190 --- /dev/null +++ b/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/invalid-wire-frame/xnf-invalid-wire-frame-request.json @@ -0,0 +1,68 @@ +[ + { + "commonEventHeader": { + "version": "sample-version", + "domain": "HVMEAS", + "sequence": 1, + "priority": 1, + "eventId": "sample-event-id", + "eventName": "sample-event-name", + "eventType": "sample-event-type", + "startEpochMicrosec": 120034455, + "lastEpochMicrosec": 120034455, + "nfNamingCode": "sample-nf-naming-code", + "nfcNamingCode": "sample-nfc-naming-code", + "reportingEntityId": "sample-reporting-entity-id", + "reportingEntityName": "sample-reporting-entity-name", + "sourceId": "sample-source-id", + "sourceName": "sample-source-name", + "vesEventListenerVersion": "another-version" + }, + "messageType": "VALID", + "messagesAmount": 25000 + }, + { + "commonEventHeader": { + "version": "sample-version", + "domain": "HVMEAS", + "sequence": 1, + "priority": 1, + "eventId": "sample-event-id", + "eventName": "sample-event-name", + "eventType": "sample-event-type", + "startEpochMicrosec": 120034455, + "lastEpochMicrosec": 120034455, + "nfNamingCode": "sample-nf-naming-code", + "nfcNamingCode": "sample-nfc-naming-code", + "reportingEntityId": "sample-reporting-entity-id", + "reportingEntityName": "sample-reporting-entity-name", + "sourceId": "sample-source-id", + "sourceName": "sample-source-name", + "vesEventListenerVersion": "another-version" + }, + "messageType": "INVALID_WIRE_FRAME", + "messagesAmount": 100 + }, + { + "commonEventHeader": { + "version": "sample-version", + "domain": "HVMEAS", + "sequence": 1, + "priority": 1, + "eventId": "sample-event-id", + "eventName": "sample-event-name", + "eventType": "sample-event-type", + "startEpochMicrosec": 120034455, + "lastEpochMicrosec": 120034455, + "nfNamingCode": "sample-nf-naming-code", + "nfcNamingCode": "sample-nfc-naming-code", + "reportingEntityId": "sample-reporting-entity-id", + "reportingEntityName": "sample-reporting-entity-name", + "sourceId": "sample-source-id", + "sourceName": "sample-source-name", + "vesEventListenerVersion": "another-version" + }, + "messageType": "VALID", + "messagesAmount": 25000 + } +] diff --git a/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/multiple-simulators-payload/dcae-smaller-valid-request.json b/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/multiple-simulators-payload/dcae-smaller-valid-request.json new file mode 100644 index 00000000..89f3e067 --- /dev/null +++ b/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/multiple-simulators-payload/dcae-smaller-valid-request.json @@ -0,0 +1,24 @@ +[ + { + "commonEventHeader": { + "version": "sample-version", + "domain": "HVMEAS", + "sequence": 1, + "priority": 1, + "eventId": "sample-event-id", + "eventName": "sample-event-name", + "eventType": "sample-event-type", + "startEpochMicrosec": 120034455, + "lastEpochMicrosec": 120034455, + "nfNamingCode": "sample-nf-naming-code", + "nfcNamingCode": "sample-nfc-naming-code", + "reportingEntityId": "sample-reporting-entity-id", + "reportingEntityName": "sample-reporting-entity-name", + "sourceId": "sample-source-id", + "sourceName": "sample-source-name", + "vesEventListenerVersion": "another-version" + }, + "messageType": "FIXED_PAYLOAD", + "messagesAmount": 15000 + } +] \ No newline at end of file diff --git a/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/multiple-simulators-payload/xnf-simulator-smaller-valid-request.json b/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/multiple-simulators-payload/xnf-simulator-smaller-valid-request.json new file mode 100644 index 00000000..60c81a89 --- /dev/null +++ b/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/multiple-simulators-payload/xnf-simulator-smaller-valid-request.json @@ -0,0 +1,24 @@ +[ + { + "commonEventHeader": { + "version": "sample-version", + "domain": "HVMEAS", + "sequence": 1, + "priority": 1, + "eventId": "sample-event-id", + "eventName": "sample-event-name", + "eventType": "sample-event-type", + "startEpochMicrosec": 120034455, + "lastEpochMicrosec": 120034455, + "nfNamingCode": "sample-nf-naming-code", + "nfcNamingCode": "sample-nfc-naming-code", + "reportingEntityId": "sample-reporting-entity-id", + "reportingEntityName": "sample-reporting-entity-name", + "sourceId": "sample-source-id", + "sourceName": "sample-source-name", + "vesEventListenerVersion": "another-version" + }, + "messageType": "FIXED_PAYLOAD", + "messagesAmount": 5000 + } +] \ No newline at end of file diff --git a/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/too-big-payload/xnf-too-big-payload-request.json b/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/too-big-payload/xnf-too-big-payload-request.json new file mode 100644 index 00000000..54836bf3 --- /dev/null +++ b/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/too-big-payload/xnf-too-big-payload-request.json @@ -0,0 +1,68 @@ +[ + { + "commonEventHeader": { + "version": "sample-version", + "domain": "HVMEAS", + "sequence": 1, + "priority": 1, + "eventId": "sample-event-id", + "eventName": "sample-event-name", + "eventType": "sample-event-type", + "startEpochMicrosec": 120034455, + "lastEpochMicrosec": 120034455, + "nfNamingCode": "sample-nf-naming-code", + "nfcNamingCode": "sample-nfc-naming-code", + "reportingEntityId": "sample-reporting-entity-id", + "reportingEntityName": "sample-reporting-entity-name", + "sourceId": "sample-source-id", + "sourceName": "sample-source-name", + "vesEventListenerVersion": "another-version" + }, + "messageType": "VALID", + "messagesAmount": 25000 + }, + { + "commonEventHeader": { + "version": "sample-version", + "domain": "HVMEAS", + "sequence": 1, + "priority": 1, + "eventId": "sample-event-id", + "eventName": "sample-event-name", + "eventType": "sample-event-type", + "startEpochMicrosec": 120034455, + "lastEpochMicrosec": 120034455, + "nfNamingCode": "sample-nf-naming-code", + "nfcNamingCode": "sample-nfc-naming-code", + "reportingEntityId": "sample-reporting-entity-id", + "reportingEntityName": "sample-reporting-entity-name", + "sourceId": "sample-source-id", + "sourceName": "sample-source-name", + "vesEventListenerVersion": "another-version" + }, + "messageType": "TOO_BIG_PAYLOAD", + "messagesAmount": 100 + }, + { + "commonEventHeader": { + "version": "sample-version", + "domain": "HVMEAS", + "sequence": 1, + "priority": 1, + "eventId": "sample-event-id", + "eventName": "sample-event-name", + "eventType": "sample-event-type", + "startEpochMicrosec": 120034455, + "lastEpochMicrosec": 120034455, + "nfNamingCode": "sample-nf-naming-code", + "nfcNamingCode": "sample-nfc-naming-code", + "reportingEntityId": "sample-reporting-entity-id", + "reportingEntityName": "sample-reporting-entity-name", + "sourceId": "sample-source-id", + "sourceName": "sample-source-name", + "vesEventListenerVersion": "another-version" + }, + "messageType": "VALID", + "messagesAmount": 25000 + } +] diff --git a/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/unsupported-domain/dcae-unsupported-domain-request.json b/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/unsupported-domain/dcae-unsupported-domain-request.json new file mode 100644 index 00000000..f38e9aa0 --- /dev/null +++ b/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/unsupported-domain/dcae-unsupported-domain-request.json @@ -0,0 +1,24 @@ +[ + { + "commonEventHeader": { + "version": "sample-version", + "domain": "HVMEAS", + "sequence": 1, + "priority": 1, + "eventId": "sample-event-id", + "eventName": "sample-event-name", + "eventType": "sample-event-type", + "startEpochMicrosec": 120034455, + "lastEpochMicrosec": 120034455, + "nfNamingCode": "sample-nf-naming-code", + "nfcNamingCode": "sample-nfc-naming-code", + "reportingEntityId": "sample-reporting-entity-id", + "reportingEntityName": "sample-reporting-entity-name", + "sourceId": "sample-source-id", + "sourceName": "sample-source-name", + "vesEventListenerVersion": "another-version" + }, + "messageType": "VALID", + "messagesAmount": 50000 + } +] diff --git a/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/unsupported-domain/xnf-unsupported-domain-request.json b/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/unsupported-domain/xnf-unsupported-domain-request.json new file mode 100644 index 00000000..b3aada5b --- /dev/null +++ b/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/unsupported-domain/xnf-unsupported-domain-request.json @@ -0,0 +1,68 @@ +[ + { + "commonEventHeader": { + "version": "sample-version", + "domain": "HVMEAS", + "sequence": 1, + "priority": 1, + "eventId": "sample-event-id", + "eventName": "sample-event-name", + "eventType": "sample-event-type", + "startEpochMicrosec": 120034455, + "lastEpochMicrosec": 120034455, + "nfNamingCode": "sample-nf-naming-code", + "nfcNamingCode": "sample-nfc-naming-code", + "reportingEntityId": "sample-reporting-entity-id", + "reportingEntityName": "sample-reporting-entity-name", + "sourceId": "sample-source-id", + "sourceName": "sample-source-name", + "vesEventListenerVersion": "another-version" + }, + "messageType": "VALID", + "messagesAmount": 25000 + }, + { + "commonEventHeader": { + "version": "sample-version", + "domain": "FAULT", + "sequence": 1, + "priority": 1, + "eventId": "sample-event-id", + "eventName": "sample-event-name", + "eventType": "sample-event-type", + "startEpochMicrosec": 120034455, + "lastEpochMicrosec": 120034455, + "nfNamingCode": "sample-nf-naming-code", + "nfcNamingCode": "sample-nfc-naming-code", + "reportingEntityId": "sample-reporting-entity-id", + "reportingEntityName": "sample-reporting-entity-name", + "sourceId": "sample-source-id", + "sourceName": "sample-source-name", + "vesEventListenerVersion": "another-version" + }, + "messageType": "VALID", + "messagesAmount": 100 + }, + { + "commonEventHeader": { + "version": "sample-version", + "domain": "HVMEAS", + "sequence": 1, + "priority": 1, + "eventId": "sample-event-id", + "eventName": "sample-event-name", + "eventType": "sample-event-type", + "startEpochMicrosec": 120034455, + "lastEpochMicrosec": 120034455, + "nfNamingCode": "sample-nf-naming-code", + "nfcNamingCode": "sample-nfc-naming-code", + "reportingEntityId": "sample-reporting-entity-id", + "reportingEntityName": "sample-reporting-entity-name", + "sourceId": "sample-source-id", + "sourceName": "sample-source-name", + "vesEventListenerVersion": "another-version" + }, + "messageType": "VALID", + "messagesAmount": 25000 + } +] diff --git a/tests/dcaegen2-collectors-hv-ves/testcases/resources/ves-hv-configuration.json b/tests/dcaegen2-collectors-hv-ves/testcases/resources/ves-hv-configuration.json new file mode 100644 index 00000000..b9e1a4b5 --- /dev/null +++ b/tests/dcaegen2-collectors-hv-ves/testcases/resources/ves-hv-configuration.json @@ -0,0 +1,9 @@ +{ + "dmaap.kafkaBootstrapServers": "kafka:9092", + "collector.routing": [ + { + "fromDomain": "HVMEAS", + "toTopic": "test-hv-ran-meas" + } + ] +} \ No newline at end of file -- cgit 1.2.3-korg