diff options
Diffstat (limited to 'tests/dcaegen2')
13 files changed, 303 insertions, 76 deletions
diff --git a/tests/dcaegen2/prh-testcases/prh_tests.robot b/tests/dcaegen2/prh-testcases/prh_tests.robot index 62698455..634f37f8 100644 --- a/tests/dcaegen2/prh-testcases/prh_tests.robot +++ b/tests/dcaegen2/prh-testcases/prh_tests.robot @@ -1,15 +1,16 @@ *** Settings *** Documentation Integration tests for PRH. ... PRH receive events from DMaaP and produce or not PNF_READY notification depends on required fields in received event. -Suite Setup Run keywords Create header Create sessions +Suite Setup Run keywords Create header AND Create sessions AND Ensure Container Is Running prh AND Ensure Container Is Exited ssl_prh +Suite Teardown Ensure Container Is Running ssl_prh +Test Teardown Reset Simulators Library resources/PrhLibrary.py Resource resources/prh_library.robot Resource ../../common.robot *** Variables *** -${DMAAP_SIMULATOR_URL} http://${DMAAP_SIMULATOR} -${AAI_SIMULATOR_URL} http://${AAI_SIMULATOR} -${PRH_URL} http://${PRH} +${DMAAP_SIMULATOR_SETUP_URL} http://${DMAAP_SIMULATOR_SETUP} +${AAI_SIMULATOR_SETUP_URL} http://${AAI_SIMULATOR_SETUP} ${EVENT_WITH_ALL_VALID_REQUIRED_FIELDS} %{WORKSPACE}/tests/dcaegen2/prh-testcases/assets/json_events/event_with_all_fields.json ${EVENT_WITH_IPV4} %{WORKSPACE}/tests/dcaegen2/prh-testcases/assets/json_events/event_with_IPV4.json ${EVENT_WITH_IPV6} %{WORKSPACE}/tests/dcaegen2/prh-testcases/assets/json_events/event_with_IPV6.json @@ -62,6 +63,7 @@ Get valid event from DMaaP and AAI is not responding [Tags] PRH AAI [Timeout] 180s ${data}= Get Data From File ${EVENT_WITH_ALL_VALID_REQUIRED_FIELDS} - Stop AAI + Ensure Container Is Exited aai_simulator Set event in DMaaP ${data} Wait Until Keyword Succeeds 100x 300ms Check PRH log java.net.UnknownHostException: aai + Ensure Container Is Running aai_simulator diff --git a/tests/dcaegen2/prh-testcases/resources/PrhLibrary.py b/tests/dcaegen2/prh-testcases/resources/PrhLibrary.py index 656f6fc3..dc589369 100644 --- a/tests/dcaegen2/prh-testcases/resources/PrhLibrary.py +++ b/tests/dcaegen2/prh-testcases/resources/PrhLibrary.py @@ -1,6 +1,7 @@ import json import docker +import time class PrhLibrary(object): @@ -35,10 +36,45 @@ class PrhLibrary(object): return correlation_id @staticmethod - def stop_aai(): + def ensure_container_is_running(name): client = docker.from_env() - container = client.containers.get('aai_simulator') - container.stop() + + if not PrhLibrary.is_in_status(client, name, "running"): + print ("starting container", name) + container = client.containers.get(name) + container.start() + PrhLibrary.wait_for_status(client, name, "running") + + PrhLibrary.print_status(client) + + @staticmethod + def ensure_container_is_exited(name): + client = docker.from_env() + + if not PrhLibrary.is_in_status(client, name, "exited"): + print ("stopping container", name) + container = client.containers.get(name) + container.stop() + PrhLibrary.wait_for_status(client, name, "exited") + + PrhLibrary.print_status(client) + + @staticmethod + def print_status(client): + print("containers status") + for c in client.containers.list(all=True): + print(c.name, " ", c.status) + + @staticmethod + def wait_for_status(client, name, status): + while not PrhLibrary.is_in_status(client, name, status): + print ("waiting for container: ", name, "to be in status: ", status) + time.sleep(3) + + @staticmethod + def is_in_status(client, name, status): + return len(client.containers.list(all=True, filters={"name": "^/"+name+"$", "status": status})) == 1 + def create_invalid_notification(self, json_file): return self.create_pnf_ready_notification(json_file).replace("\":", "\": ")\ diff --git a/tests/dcaegen2/prh-testcases/resources/docker-compose.yml b/tests/dcaegen2/prh-testcases/resources/docker-compose.yml index 67921e8e..6d646801 100644 --- a/tests/dcaegen2/prh-testcases/resources/docker-compose.yml +++ b/tests/dcaegen2/prh-testcases/resources/docker-compose.yml @@ -24,12 +24,38 @@ services: - dmaap - aai + ssl_prh: + image: nexus3.onap.org:10001/onap/org.onap.dcaegen2.services.prh.prh-app-server:latest + command: > + --dmaap.dmaapConsumerConfiguration.dmaapHostName=dmaap + --dmaap.dmaapConsumerConfiguration.dmaapPortNumber=2222 + --dmaap.dmaapProducerConfiguration.dmaapHostName=dmaap + --dmaap.dmaapProducerConfiguration.dmaapPortNumber=2222 + --aai.aaiClientConfiguration.aaiHostPortNumber=3333 + --aai.aaiClientConfiguration.aaiHost=aai + --aai.aaiClientConfiguration.aaiProtocol=http + entrypoint: + - java + - -Dspring.profiles.active=dev + - -Dlogging.level.org.onap.dcaegen2.services.prh=TRACE + - -jar + - /opt/prh-app-server.jar + ports: + - "8200:8100" + - "8533:8433" + container_name: ssl_prh + depends_on: + - dmaap + - aai + dmaap: build: context: simulator dockerfile: DMaaP_simulator ports: - "2222:2222" + - "2223:2223" + - "2224:2224" container_name: dmaap_simulator aai: @@ -38,4 +64,6 @@ services: dockerfile: AAI_simulator ports: - "3333:3333" + - "3334:3334" + - "3335:3335" container_name: aai_simulator diff --git a/tests/dcaegen2/prh-testcases/resources/prh_library.robot b/tests/dcaegen2/prh-testcases/resources/prh_library.robot index 73ce2a2c..71753875 100644 --- a/tests/dcaegen2/prh-testcases/resources/prh_library.robot +++ b/tests/dcaegen2/prh-testcases/resources/prh_library.robot @@ -10,10 +10,14 @@ Create header Set Suite Variable ${suite_headers} ${headers} Create sessions - Create Session dmaap_session ${DMAAP_SIMULATOR_URL} - Set Suite Variable ${suite_dmaap_session} dmaap_session - Create Session aai_session ${AAI_SIMULATOR_URL} - Set Suite Variable ${suite_aai_session} aai_session + Create Session dmaap_setup_session ${DMAAP_SIMULATOR_SETUP_URL} + Set Suite Variable ${dmaap_setup_session} dmaap_setup_session + Create Session aai_setup_session ${AAI_SIMULATOR_SETUP_URL} + Set Suite Variable ${aai_setup_session} aai_setup_session + +Reset Simulators + Reset AAI simulator + Reset DMaaP simulator Invalid event processing [Arguments] ${input_invalid_event_in_dmaap} @@ -21,7 +25,7 @@ Invalid event processing ${data}= Get Data From File ${input_invalid_event_in_dmaap} Set event in DMaaP ${data} ${invalid_notification}= Create invalid notification ${data} - ${notification}= Catenate SEPARATOR= \\n |org.onap.dcaegen2.services.prh.exceptions.DmaapNotFoundException: Incorrect json, consumerDmaapModel can not be created: ${invalid_notification} + ${notification}= Catenate SEPARATOR= \\n |Incorrect json, consumerDmaapModel can not be created: ${invalid_notification} Wait Until Keyword Succeeds 100x 100ms Check PRH log ${notification} Valid event processing @@ -41,16 +45,24 @@ Check PRH log Check PNF_READY notification [Arguments] ${posted_event_to_dmaap} - ${resp}= Get Request ${suite_dmaap_session} /events/pnfReady headers=${suite_headers} + ${resp}= Get Request ${dmaap_setup_session} /events/pnfReady headers=${suite_headers} Should Be Equal ${resp.text} ${posted_event_to_dmaap} Set PNF name in AAI [Arguments] ${pnfs_name} ${headers}= Create Dictionary Accept=application/json Content-Type=text/html - ${resp}= Put Request ${suite_aai_session} /set_pnfs headers=${headers} data=${pnfs_name} + ${resp}= Put Request ${aai_setup_session} /set_pnfs headers=${headers} data=${pnfs_name} Should Be Equal As Strings ${resp.status_code} 200 Set event in DMaaP [Arguments] ${event_in_dmaap} - ${resp}= Put Request ${suite_dmaap_session} /set_get_event headers=${suite_headers} data=${event_in_dmaap} + ${resp}= Put Request ${dmaap_setup_session} /set_get_event headers=${suite_headers} data=${event_in_dmaap} + Should Be Equal As Strings ${resp.status_code} 200 + +Reset AAI simulator + ${resp}= Post Request ${aai_setup_session} /reset Should Be Equal As Strings ${resp.status_code} 200 + +Reset DMaaP simulator + ${resp}= Post Request ${dmaap_setup_session} /reset + Should Be Equal As Strings ${resp.status_code} 200
\ No newline at end of file diff --git a/tests/dcaegen2/prh-testcases/resources/simulator/AAI.py b/tests/dcaegen2/prh-testcases/resources/simulator/AAI.py index c57903c3..76823b0d 100644 --- a/tests/dcaegen2/prh-testcases/resources/simulator/AAI.py +++ b/tests/dcaegen2/prh-testcases/resources/simulator/AAI.py @@ -1,12 +1,14 @@ +import _thread +import re +import ssl +import time from http.server import BaseHTTPRequestHandler from http.server import HTTPServer -import re -import sys pnfs = 'Empty' -class AAIHandler(BaseHTTPRequestHandler): +class AAISetup(BaseHTTPRequestHandler): def do_PUT(self): if re.search('/set_pnfs', self.path): @@ -14,9 +16,19 @@ class AAIHandler(BaseHTTPRequestHandler): content_length = int(self.headers['Content-Length']) pnfs = self.rfile.read(content_length) _header_200_and_json(self) - + + return + + def do_POST(self): + if re.search('/reset', self.path): + global pnfs + pnfs = 'Empty' + _header_200_and_json(self) + return +class AAIHandler(BaseHTTPRequestHandler): + def do_PATCH(self): pnfs_name = '/aai/v12/network/pnfs/pnf/' + pnfs.decode() if re.search('wrong_aai_record', self.path): @@ -35,21 +47,30 @@ def _header_200_and_json(self): self.end_headers() -def _main_(handler_class=AAIHandler, server_class=HTTPServer, protocol="HTTP/1.0"): +def _main_(handler_class=AAIHandler, protocol="HTTP/1.0"): + handler_class.protocol_version = protocol + _thread.start_new_thread(_init_http_endpoints, (3333, AAIHandler)) + _thread.start_new_thread(_init_https_endpoints, (3334, AAIHandler)) + _thread.start_new_thread(_init_http_endpoints, (3335, AAISetup)) + while 1: + time.sleep(10) - if sys.argv[1:]: - port = int(sys.argv[1]) - else: - port = 3333 - server_address = ('', port) +def _init_http_endpoints(port, handler_class, server_class=HTTPServer): + server = server_class(('', port), handler_class) + sa = server.socket.getsockname() + print("Serving HTTP on", sa[0], "port", sa[1], "for", handler_class, "...") + server.serve_forever() - handler_class.protocol_version = protocol - httpd = server_class(server_address, handler_class) - sa = httpd.socket.getsockname() - print("Serving HTTP on", sa[0], "port", sa[1], "...") - httpd.serve_forever() +def _init_https_endpoints(port, handler_class, server_class=HTTPServer): + server = server_class(('', port), handler_class) + server.socket = ssl.wrap_socket(server.socket, + keyfile="certs/server.key", certfile="certs/server.crt", + ca_certs="certs/client.crt", server_side=True) + sa = server.socket.getsockname() + print("Serving HTTPS on", sa[0], "port", sa[1], "for", handler_class, "...") + server.serve_forever() if __name__ == '__main__': diff --git a/tests/dcaegen2/prh-testcases/resources/simulator/AAI_simulator b/tests/dcaegen2/prh-testcases/resources/simulator/AAI_simulator index 89a266eb..7364769f 100644 --- a/tests/dcaegen2/prh-testcases/resources/simulator/AAI_simulator +++ b/tests/dcaegen2/prh-testcases/resources/simulator/AAI_simulator @@ -1,15 +1,6 @@ -FROM alpine:3.8 - -RUN apk add --no-cache python3 && \ - python3 -m ensurepip && \ - rm -r /usr/lib/python*/ensurepip && \ - pip3 install --upgrade pip setuptools && \ - if [ ! -e /usr/bin/pip ]; then ln -s pip3 /usr/bin/pip ; fi && \ - if [[ ! -e /usr/bin/python ]]; then ln -sf /usr/bin/python3 /usr/bin/python; fi && \ - rm -r /root/.cache +FROM python:3-alpine ADD AAI.py / - -EXPOSE 3333 +COPY certs/* /certs/ CMD [ "python", "./AAI.py" ] diff --git a/tests/dcaegen2/prh-testcases/resources/simulator/DMaaP.py b/tests/dcaegen2/prh-testcases/resources/simulator/DMaaP.py index 96e22a14..3ff951e8 100644 --- a/tests/dcaegen2/prh-testcases/resources/simulator/DMaaP.py +++ b/tests/dcaegen2/prh-testcases/resources/simulator/DMaaP.py @@ -1,13 +1,15 @@ +import _thread +import re +import ssl +import time from http.server import BaseHTTPRequestHandler from http.server import HTTPServer -import re -import sys posted_event_from_prh = b'Empty' -received_event_to_get_method = 'Empty' +received_event_to_get_method = b'Empty' -class DMaaPHandler(BaseHTTPRequestHandler): +class DmaapSetup(BaseHTTPRequestHandler): def do_PUT(self): if re.search('/set_get_event', self.path): @@ -15,25 +17,42 @@ class DMaaPHandler(BaseHTTPRequestHandler): content_length = int(self.headers['Content-Length']) received_event_to_get_method = self.rfile.read(content_length) _header_200_and_json(self) - + + return + + def do_GET(self): + if re.search('/events/pnfReady', self.path): + _header_200_and_json(self) + self.wfile.write(posted_event_from_prh) + return def do_POST(self): + if re.search('/reset', self.path): + global posted_event_from_prh + global received_event_to_get_method + posted_event_from_prh = b'Empty' + received_event_to_get_method = b'Empty' + _header_200_and_json(self) + + return + + +class DMaaPHandler(BaseHTTPRequestHandler): + + def do_POST(self): if re.search('/events/unauthenticated.PNF_READY', self.path): global posted_event_from_prh content_length = int(self.headers['Content-Length']) posted_event_from_prh = self.rfile.read(content_length) _header_200_and_json(self) - + return def do_GET(self): if re.search('/events/unauthenticated.VES_PNFREG_OUTPUT/OpenDcae-c12/c12', self.path): _header_200_and_json(self) self.wfile.write(received_event_to_get_method) - elif re.search('/events/pnfReady', self.path): - _header_200_and_json(self) - self.wfile.write(posted_event_from_prh) return @@ -44,21 +63,30 @@ def _header_200_and_json(self): self.end_headers() -def _main_(handler_class=DMaaPHandler, server_class=HTTPServer, protocol="HTTP/1.0"): - - if sys.argv[1:]: - port = int(sys.argv[1]) - else: - port = 2222 - - server_address = ('', port) - +def _main_(handler_class=DMaaPHandler, protocol="HTTP/1.0"): handler_class.protocol_version = protocol - httpd = server_class(server_address, handler_class) - - sa = httpd.socket.getsockname() - print("Serving HTTP on", sa[0], "port", sa[1], "...") - httpd.serve_forever() + _thread.start_new_thread(_init_http_endpoints, (2222, DMaaPHandler)) + _thread.start_new_thread(_init_https_endpoints, (2223, DMaaPHandler)) + _thread.start_new_thread(_init_http_endpoints, (2224, DmaapSetup)) + while 1: + time.sleep(10) + + +def _init_http_endpoints(port, handler_class, server_class=HTTPServer): + server = server_class(('', port), handler_class) + sa = server.socket.getsockname() + print("Serving HTTP on", sa[0], "port", sa[1], "for", handler_class, "...") + server.serve_forever() + + +def _init_https_endpoints(port, handler_class, server_class=HTTPServer): + server = server_class(('', port), handler_class) + server.socket = ssl.wrap_socket(server.socket, + keyfile="certs/server.key", certfile="certs/server.crt", + ca_certs="certs/client.crt", server_side=True) + sa = server.socket.getsockname() + print("Serving HTTPS on", sa[0], "port", sa[1], "for", handler_class, "...") + server.serve_forever() if __name__ == '__main__': diff --git a/tests/dcaegen2/prh-testcases/resources/simulator/DMaaP_simulator b/tests/dcaegen2/prh-testcases/resources/simulator/DMaaP_simulator index 9cf21dc9..40e1af09 100644 --- a/tests/dcaegen2/prh-testcases/resources/simulator/DMaaP_simulator +++ b/tests/dcaegen2/prh-testcases/resources/simulator/DMaaP_simulator @@ -1,15 +1,6 @@ -FROM alpine:3.8 - -RUN apk add --no-cache python3 && \ - python3 -m ensurepip && \ - rm -r /usr/lib/python*/ensurepip && \ - pip3 install --upgrade pip setuptools && \ - if [ ! -e /usr/bin/pip ]; then ln -s pip3 /usr/bin/pip ; fi && \ - if [[ ! -e /usr/bin/python ]]; then ln -sf /usr/bin/python3 /usr/bin/python; fi && \ - rm -r /root/.cache +FROM python:3-alpine ADD DMaaP.py / - -EXPOSE 2222 +COPY certs/* /certs/ CMD [ "python", "./DMaaP.py" ] diff --git a/tests/dcaegen2/prh-testcases/resources/simulator/certs/client.crt b/tests/dcaegen2/prh-testcases/resources/simulator/certs/client.crt new file mode 100644 index 00000000..35123683 --- /dev/null +++ b/tests/dcaegen2/prh-testcases/resources/simulator/certs/client.crt @@ -0,0 +1,18 @@ +-----BEGIN CERTIFICATE----- +MIIC+DCCAeCgAwIBAgIJAKCcXOpDPyjQMA0GCSqGSIb3DQEBCwUAMBExDzANBgNV +BAMMBmNsaWVudDAeFw0xODEwMTgwNzU1NDlaFw0zODEwMTMwNzU1NDlaMBExDzAN +BgNVBAMMBmNsaWVudDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAM/V +zZE2xloz06wO+Fj6GA26pzEFhTHpMOG20woWIkzL7N/TuTyPi24ZqzhyFvGmn71K +eDC14zYeZVTj+8OoJKRSPYcPiyGqMK46hkUNJ9LjVCLGBhqqgTGYd4YTn2FeTAiR +2/rduOD4N7AzYiJlZHcd1zls+QQOyQkFcuO4xKQiwjyC2djDx7W9qUsPZVha/9v9 +u7PcPZ7LnsAPdDSaL/bBz5aYFTX8IMo1nBIujpETCPyQoNc3h+lMilFhY4A1Nj0F +hkwF7GB9Xh7aLC2rEobVbn6s6biUq9+hg7OgTYZtQX7/SfD+6nioXSHMJNGYm7j9 +Z4Yf26BfQStd0cL9GwkCAwEAAaNTMFEwHQYDVR0OBBYEFK+hMFIwHNrVNqudmcQ+ +sLABdVMuMB8GA1UdIwQYMBaAFK+hMFIwHNrVNqudmcQ+sLABdVMuMA8GA1UdEwEB +/wQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBAMzawFZ8j99zdWhavqBpTeulsisL +IthHkRT8sIBnAkimS5Bujjix8NHsaqUc/1d56KPerDWJ4tXx7Sd4+F7aNIpIkp+1 +lFxKLPU4Fnsbq/IEWAJOuVOWZ0Lug/8UcJbp0Ma/ac1t76uHBQ/mmiJUu/22FUrA +X0Udg3q/xAT2H0QLLK/s2jfR511rNOY5u9zcdKArmHoN13ZuVeZ6HMVO6U78rqZk +TTbdhO9BieARIhoPC+/G9eTV7uJyzi4n60HDpxA0j+ZsH5L6CdU5M3XATMCxpxm4 +xAnHVb0fcudNzIsqZlP0jrJdrNOKkX8qij1poKvvJ2Ap/vKtZZVPL76GHCk= +-----END CERTIFICATE----- diff --git a/tests/dcaegen2/prh-testcases/resources/simulator/certs/client.key b/tests/dcaegen2/prh-testcases/resources/simulator/certs/client.key new file mode 100644 index 00000000..17eebd2a --- /dev/null +++ b/tests/dcaegen2/prh-testcases/resources/simulator/certs/client.key @@ -0,0 +1,27 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIEowIBAAKCAQEAz9XNkTbGWjPTrA74WPoYDbqnMQWFMekw4bbTChYiTMvs39O5 +PI+LbhmrOHIW8aafvUp4MLXjNh5lVOP7w6gkpFI9hw+LIaowrjqGRQ0n0uNUIsYG +GqqBMZh3hhOfYV5MCJHb+t244Pg3sDNiImVkdx3XOWz5BA7JCQVy47jEpCLCPILZ +2MPHtb2pSw9lWFr/2/27s9w9nsuewA90NJov9sHPlpgVNfwgyjWcEi6OkRMI/JCg +1zeH6UyKUWFjgDU2PQWGTAXsYH1eHtosLasShtVufqzpuJSr36GDs6BNhm1Bfv9J +8P7qeKhdIcwk0ZibuP1nhh/boF9BK13Rwv0bCQIDAQABAoIBAA2Fs6JHFhC4XoVL +VA01+GqsQkSGP2xH585HvuNhHUox2m+Vru+px0CamvFJOwTt+mauebNxoh7bS2yC +iNbqEbg/QZGQCVVfZVtwo1vKx1SJRegdSjhh75XyfZRTooMLR5cnJlDkLCs2+yiT +r0bdofO+FUq/NFR3Qc08dYUreF/VZQzGT86vgpxTqFE1xdVX3mL5X/RFYED25s/n +nw+v8uRVcb21OGsEnHar4wV5VyyG6g0nZGk4uAfLGvvYKwcmMTtKulYtqnZ+0RNI +Iqu3siXOq6BcKly+TzKZ6kpqn+hsD9V9plQ45yPOswboToOnOBanZUxsEJ1mT5lO +wbpqYoECgYEA9IbxrWMri2b5kXz8o6O33RsG6qLrkaOU8M4PJOvxn7LaD9WLbsZZ +J6vv6eXAbHqF1ZfXv52sSZu9Bug3x8cv0ItOiOCPf5T6nTrdLjnCthivNUfLHVJ8 +nonzA2YJWaYe6u5sFtUSifQaHnrAMKqoX2D1qY7SD1QWWbSoK7cRxY0CgYEA2ZYl +T7OYKGKP8Ra2mLFpwY/84n+Rx/A3p0rzZ1cge9Xldo8pGbGduI+aII+XKPC4/lDx +dhS7rbOtIA08aF8htkunSErNUiDtZ+i386KYR3JsQuDruKbk51YYWpRhBPvs0mOT +7lBSeqbJZEJ2vDMU/oNJyUOW+0eL2Jjo28URdm0CgYEA2yucsPFDVVZ9+LZTZ4TV +xvtzjplqlYZOeCvpjQlh7+cJ5slbiXWE8bb9eeLxPwnurUzFFz2G8A8ENY2seYcC +R2Slhq/oTs1Ed+sL1mP1LuwfFp1745NMmXlB9NjfJphr+9ypyyk9zaKaSplxa+16 +rsqkRk753r1arxrq5QvYhP0CgYB8nJW/wI4qys++9hAbALgdh7X/janSxMtKvw0J +KQfMhCKHNNQICAXY9j0B2tpqMvrvgzHWO2eEwnsq+QmYiKsI+OjT6SsPlxX/xXLc +UEk/2dMQtjmppcNAjbki3wl1TkZB8498E3o5Dh4Wkk3n2KV0YYI3hsMII+B+aowp +mQI4PQKBgH8MZj1WDB05mgxC3jK6wNEM+0V08xL8sooYCEST11uZ1Pj7vZmRNjWn +/4pUrIOp1P9EnrS9RsWlVgRKUo6+yvPqdmenq5k7w7dSSowmAnW68rUV+HHuueXQ +9V98fkg3hAnI7ioV19bDaL6EtMvYLg+xSq2GmKvUqRcBRmlObW1L +-----END RSA PRIVATE KEY----- diff --git a/tests/dcaegen2/prh-testcases/resources/simulator/certs/server.crt b/tests/dcaegen2/prh-testcases/resources/simulator/certs/server.crt new file mode 100644 index 00000000..e154aee0 --- /dev/null +++ b/tests/dcaegen2/prh-testcases/resources/simulator/certs/server.crt @@ -0,0 +1,19 @@ +-----BEGIN CERTIFICATE----- +MIIC/jCCAeagAwIBAgIJALu8otyWP3z1MA0GCSqGSIb3DQEBCwUAMBQxEjAQBgNV +BAMMCWxvY2FsaG9zdDAeFw0xODEwMTgwNzU1MzNaFw0zODEwMTMwNzU1MzNaMBQx +EjAQBgNVBAMMCWxvY2FsaG9zdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC +ggEBAMILA9ZYh8vo1ui3mNYtF185/qauRgJ5EP1ROqD445hX5T014BrlWzpsRD6B +/uGCxSwNnIE+tGChk4zQBnOSC2Pah2QjMGWUPjgWXgnL4vp1Mb4rKrVNQsaqMi7I +8aCdbO66rZirK04RD2hp09Vy7KGsK6TKjAnQn6UJJD2agHZtcMfQ5Kf/B0yZvlb6 +T3Yet+gefXH/iCZ+bzz4P1Ij6zetetw5S++SzsgxWJECfkk3ISkqu9DBLjfzacKz +ixq+twq5f+kzg3zhUBtpJ4BvC9HKiJ5ZTi/NjapmgJG1WEyhI4cVcpVwoBylJwpV +TyuVaSjVOoqprnvYre6ch9vz2JUCAwEAAaNTMFEwHQYDVR0OBBYEFGG+MZfFt5OH +Kxr4GyBu7mYArZ5aMB8GA1UdIwQYMBaAFGG+MZfFt5OHKxr4GyBu7mYArZ5aMA8G +A1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBACoxYrR17mEPOhOxxyRp +ulAxTIbkhiskAI1YF4XRK3FtuWhiuivSyTWmNYfbuhl01U75tyQjd9TCKYKZsaM7 +MaaYWFaSlynFx9SZdKWMPv84re7xdUIzhH9dH+YsGij/ocdedfg/kyhdto88zB5C ++BGEopkOnXEZGZnuhgWVlwT9Aw4MCt9P/+3baJMU0MOSjLX+CnJZ7TsXpnupH3ej +kTPJaooiVig7V84e2jmLx4iuxDgtDSnxYN9fZeDW0SJq+7b7VlyJ9QIpQYt3kUIn +FMAtnxv6FEeMi6k5hUXmRg/XKt/K0WQ2dopwq9XQKMiyHlA4rIJ1Ar3jX3trDyCh +qBU= +-----END CERTIFICATE----- diff --git a/tests/dcaegen2/prh-testcases/resources/simulator/certs/server.key b/tests/dcaegen2/prh-testcases/resources/simulator/certs/server.key new file mode 100644 index 00000000..e86fdc42 --- /dev/null +++ b/tests/dcaegen2/prh-testcases/resources/simulator/certs/server.key @@ -0,0 +1,27 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIEogIBAAKCAQEAwgsD1liHy+jW6LeY1i0XXzn+pq5GAnkQ/VE6oPjjmFflPTXg +GuVbOmxEPoH+4YLFLA2cgT60YKGTjNAGc5ILY9qHZCMwZZQ+OBZeCcvi+nUxvisq +tU1CxqoyLsjxoJ1s7rqtmKsrThEPaGnT1XLsoawrpMqMCdCfpQkkPZqAdm1wx9Dk +p/8HTJm+VvpPdh636B59cf+IJn5vPPg/UiPrN6163DlL75LOyDFYkQJ+STchKSq7 +0MEuN/NpwrOLGr63Crl/6TODfOFQG2kngG8L0cqInllOL82NqmaAkbVYTKEjhxVy +lXCgHKUnClVPK5VpKNU6iqmue9it7pyH2/PYlQIDAQABAoIBAAlOS+3QqxqNXRkm +DO9glDld56eIvhTKR5VOevhTV17sADNyTQAdNcXUgWVaCKY6Bki5kmLkZfQoa5Ia +O+T5ARDV3x5fTafhdyZrdDEWFRmb2znaih7NyMEMUoHJ40SnqBy+2Sp0Mwx4ZvvD +74PSEiUiw6kQiazC05UvngxSR4zmV1pimJAKmKxQynWAeAAFZNl7CDG+aeoaI483 +ipaPaxNc/2i1bi+dva9Hsc1q5C4+hQZIbCdHpbZfZj5bA36vyBo/NcRcicomfuVh +IBFRM8J7jaet68KWqNE3db+ji3xwHwJoypwF/yKtmFueWByv/HrZnaHS2gnKQQ4K +lYbW24ECgYEA5UiqxCeZGiWW+QU3X99hUkE3FlRRp6CWlw58ffn2Ztc5uZsXf0is +EsNHT47jIKFUqkHxBHCX4vSuAcphT/FGeXo6QkRhcSfrlQrifFGfTMbNGbrGnOZU +FVjknQUig3GLfm99Ed4jpyf7ps+iqIXQXlt2F2FRWygnqOVmK2AA2KECgYEA2Kcl +PDlxBuXk0LLbVIxIMymkZS3re1Gw+WJw21GpRUUpAGcZ6EKPUC0zlB4A75rLoucb +i0DmgUNX7T5ZFczrRCjduP7MhUjM64m5Ib0/Pwci46umnLhLf6i3+Z0/QLK3iGDV +8/6FUtKOX/UU5xKUe96MysBlnPzXUG92arQed3UCgYBHB+cXU6kjp4eI5+vKwLo2 +sEtvmHmfc6mTbIJ2yIxkOcMBVCHIZewg9+xMoliM0E4ZXMpc9MCpJ+IMXfUdvgJ2 +Ob54rxR86MAb8T5PAz5Vm7UIhotnKhfccSiJ2IBjtjZf2gwmD+p9q25TtDmQ+bue +r7j670Qz+FGpCkBHqbs5YQKBgEj9Lqc2duSrCMZiq0+1nxFVgyPvL3kxUV0DFCBf +R5alsSWIlorP+bY6NDk/TnNqhBZSo83rRHzh8jpkGeElU1F4LxKHDOIOX7Muh+dc ++XTDc7ad+pir4guVDL4Ugt3KF9jjPtFfuwznEL41NCCQ+uMsW+RmoxUbfXKEyrEy +E12NAoGAGBeR3ghlmhyasnbe7TyJbCAPU/Yut1NI4Rgb4sZcN8gwI5/wkRk0QryQ +eo9th+0e98Y8Rxa0t9k0dkmGOM9WwVdBHZCyzgs6ihLzgy7nZAGi86+pe4BiqDmb +NyfiL8LW+EADax5koWLQpPqrVQ66Gy2BAx4/ODBNzr3ox64jQpE= +-----END RSA PRIVATE KEY----- diff --git a/tests/dcaegen2/prh-testcases/ssl_prh_tests.robot b/tests/dcaegen2/prh-testcases/ssl_prh_tests.robot new file mode 100644 index 00000000..49d2c45a --- /dev/null +++ b/tests/dcaegen2/prh-testcases/ssl_prh_tests.robot @@ -0,0 +1,27 @@ +*** Settings *** +Documentation Integration tests for PRH. +... PRH receive events from DMaaP and produce or not PNF_READY notification depends on required fields in received event. PRH comunicates with AAI and DMaaP through SSL +Suite Setup Run keywords Create header AND Create sessions AND Ensure Container Is Running ssl_prh AND Ensure Container Is Exited prh +Suite Teardown Ensure Container Is Running prh +Test Teardown Reset Simulators +Library resources/PrhLibrary.py +Resource resources/prh_library.robot +Resource ../../common.robot + +*** Variables *** +${DMAAP_SIMULATOR_SETUP_URL} http://${DMAAP_SIMULATOR_SETUP} +${AAI_SIMULATOR_SETUP_URL} http://${AAI_SIMULATOR_SETUP} +${EVENT_WITH_ALL_VALID_REQUIRED_FIELDS} %{WORKSPACE}/tests/dcaegen2/prh-testcases/assets/json_events/event_with_all_fields.json +${EVENT_WITH_IPV4} %{WORKSPACE}/tests/dcaegen2/prh-testcases/assets/json_events/event_with_IPV4.json +${EVENT_WITH_IPV6} %{WORKSPACE}/tests/dcaegen2/prh-testcases/assets/json_events/event_with_IPV6.json +${EVENT_WITHOUT_IPV6_FILED} %{WORKSPACE}/tests/dcaegen2/prh-testcases/assets/json_events/event_without_IPV6_field.json + +*** Test Cases *** +Valid DMaaP event can be converted to PNF_READY notification with ssl connection to AAI + [Documentation] PRH get valid event from DMaaP with required fields - PRH produce PNF_READY notification + [Tags] PRH Valid event + [Template] Valid event processing + ${EVENT_WITH_ALL_VALID_REQUIRED_FIELDS} + ${EVENT_WITH_IPV4} + ${EVENT_WITH_IPV6} + ${EVENT_WITHOUT_IPV6_FILED} |