aboutsummaryrefslogtreecommitdiffstats
path: root/tests/dcaegen2/prh-testcases
diff options
context:
space:
mode:
authorGary Wu <gary.i.wu@huawei.com>2018-09-27 10:38:50 -0700
committerGary Wu <gary.i.wu@huawei.com>2018-09-27 10:39:43 -0700
commit9abb61ca2cea1907cab2cec312d6dca6e53a93cd (patch)
treec8ff0718b6626832efd3ff3acc48590dbd6cb64c /tests/dcaegen2/prh-testcases
parenta328a3e2e531240ea4a9ed2ce4a284af1be5e225 (diff)
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 <gary.i.wu@huawei.com>
Diffstat (limited to 'tests/dcaegen2/prh-testcases')
-rw-r--r--tests/dcaegen2/prh-testcases/__init__.robot2
-rw-r--r--tests/dcaegen2/prh-testcases/assets/json_events/event_with_IPV4.json11
-rw-r--r--tests/dcaegen2/prh-testcases/assets/json_events/event_with_IPV6.json11
-rw-r--r--tests/dcaegen2/prh-testcases/assets/json_events/event_with_all_fields.json11
-rw-r--r--tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_IPV4_and_IPV6.json11
-rw-r--r--tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_sourceName.json11
-rw-r--r--tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_sourceName_IPV4_and_IPV6.json11
-rw-r--r--tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_sourceName_and_IPV4.json11
-rw-r--r--tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_sourceName_and_IPV6.json11
-rw-r--r--tests/dcaegen2/prh-testcases/assets/json_events/not_json_format.json11
-rw-r--r--tests/dcaegen2/prh-testcases/prh_tests.robot65
-rw-r--r--tests/dcaegen2/prh-testcases/resources/PrhLibrary.py46
-rw-r--r--tests/dcaegen2/prh-testcases/resources/docker-compose.yml41
-rw-r--r--tests/dcaegen2/prh-testcases/resources/prh_library.robot56
-rw-r--r--tests/dcaegen2/prh-testcases/resources/simulator/AAI.py56
-rw-r--r--tests/dcaegen2/prh-testcases/resources/simulator/AAI_simulator15
-rw-r--r--tests/dcaegen2/prh-testcases/resources/simulator/DMaaP.py65
-rw-r--r--tests/dcaegen2/prh-testcases/resources/simulator/DMaaP_simulator15
18 files changed, 460 insertions, 0 deletions
diff --git a/tests/dcaegen2/prh-testcases/__init__.robot b/tests/dcaegen2/prh-testcases/__init__.robot
new file mode 100644
index 00000000..f13ba6df
--- /dev/null
+++ b/tests/dcaegen2/prh-testcases/__init__.robot
@@ -0,0 +1,2 @@
+*** Settings ***
+Documentation Integration - PRH suite \ No newline at end of file
diff --git a/tests/dcaegen2/prh-testcases/assets/json_events/event_with_IPV4.json b/tests/dcaegen2/prh-testcases/assets/json_events/event_with_IPV4.json
new file mode 100644
index 00000000..2ffe356f
--- /dev/null
+++ b/tests/dcaegen2/prh-testcases/assets/json_events/event_with_IPV4.json
@@ -0,0 +1,11 @@
+{
+ "event": {
+ "commonEventHeader": {
+ "sourceName":"NOK6061ZW2"
+ },
+ "pnfRegistrationFields": {
+ "oamV4IpAddress":"10.17.123.234",
+ "oamV6IpAddress":""
+ }
+ }
+}
diff --git a/tests/dcaegen2/prh-testcases/assets/json_events/event_with_IPV6.json b/tests/dcaegen2/prh-testcases/assets/json_events/event_with_IPV6.json
new file mode 100644
index 00000000..c4a0e727
--- /dev/null
+++ b/tests/dcaegen2/prh-testcases/assets/json_events/event_with_IPV6.json
@@ -0,0 +1,11 @@
+{
+ "event": {
+ "commonEventHeader": {
+ "sourceName":"ERI6061ZW3"
+ },
+ "pnfRegistrationFields": {
+ "oamV4IpAddress":"",
+ "oamV6IpAddress":"2001:0db8:85a3:0000:0000:8b2e:0370:7334"
+ }
+ }
+}
diff --git a/tests/dcaegen2/prh-testcases/assets/json_events/event_with_all_fields.json b/tests/dcaegen2/prh-testcases/assets/json_events/event_with_all_fields.json
new file mode 100644
index 00000000..16963e1b
--- /dev/null
+++ b/tests/dcaegen2/prh-testcases/assets/json_events/event_with_all_fields.json
@@ -0,0 +1,11 @@
+{
+ "event": {
+ "commonEventHeader": {
+ "sourceName":"NOK6061ZW1"
+ },
+ "pnfRegistrationFields": {
+ "oamV4IpAddress":"10.16.123.234",
+ "oamV6IpAddress":"2001:0db8:85a3:0000:0000:8a2e:0370:7334"
+ }
+ }
+}
diff --git a/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_IPV4_and_IPV6.json b/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_IPV4_and_IPV6.json
new file mode 100644
index 00000000..1e3afa9d
--- /dev/null
+++ b/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_IPV4_and_IPV6.json
@@ -0,0 +1,11 @@
+{
+ "event": {
+ "commonEventHeader": {
+ "sourceName":"NOK6061ZW4"
+ },
+ "pnfRegistrationFields": {
+ "oamV4IpAddress":"",
+ "oamV6IpAddress":""
+ }
+ }
+}
diff --git a/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_sourceName.json b/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_sourceName.json
new file mode 100644
index 00000000..126987fd
--- /dev/null
+++ b/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_sourceName.json
@@ -0,0 +1,11 @@
+{
+ "event": {
+ "commonEventHeader": {
+ "sourceName":""
+ },
+ "pnfRegistrationFields": {
+ "oamV4IpAddress":"10.18.123.234",
+ "oamV6IpAddress":"2001:0db8:85a3:0000:0000:8a2a:0370:7334"
+ }
+ }
+}
diff --git a/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_sourceName_IPV4_and_IPV6.json b/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_sourceName_IPV4_and_IPV6.json
new file mode 100644
index 00000000..de1f576c
--- /dev/null
+++ b/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_sourceName_IPV4_and_IPV6.json
@@ -0,0 +1,11 @@
+{
+ "event": {
+ "commonEventHeader": {
+ "sourceName":""
+ },
+ "pnfRegistrationFields": {
+ "oamV4IpAddress":"",
+ "oamV6IpAddress":""
+ }
+ }
+}
diff --git a/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_sourceName_and_IPV4.json b/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_sourceName_and_IPV4.json
new file mode 100644
index 00000000..4838f1b0
--- /dev/null
+++ b/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_sourceName_and_IPV4.json
@@ -0,0 +1,11 @@
+{
+ "event": {
+ "commonEventHeader": {
+ "sourceName":""
+ },
+ "pnfRegistrationFields": {
+ "oamV4IpAddress":"",
+ "oamV6IpAddress":"2001:0db8:85a3:0000:0000:8b2f:0370:7334"
+ }
+ }
+}
diff --git a/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_sourceName_and_IPV6.json b/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_sourceName_and_IPV6.json
new file mode 100644
index 00000000..04ab7ceb
--- /dev/null
+++ b/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_sourceName_and_IPV6.json
@@ -0,0 +1,11 @@
+{
+ "event": {
+ "commonEventHeader": {
+ "sourceName":""
+ },
+ "pnfRegistrationFields": {
+ "oamV4IpAddress":"10.17.163.234",
+ "oamV6IpAddress":""
+ }
+ }
+}
diff --git a/tests/dcaegen2/prh-testcases/assets/json_events/not_json_format.json b/tests/dcaegen2/prh-testcases/assets/json_events/not_json_format.json
new file mode 100644
index 00000000..c87e188f
--- /dev/null
+++ b/tests/dcaegen2/prh-testcases/assets/json_events/not_json_format.json
@@ -0,0 +1,11 @@
+{
+ "event": {
+ "commonEventHeader": {
+ "sourceName":"NOK6061ZW1"
+ },
+ "pnfRegistrationFields": {
+ "oamV4IpAddress":"10.16.123.234",
+ "oamV6IpAddress":"2001:0db8:85a3:0000:0000:8a2e:0370:7334",
+ }
+ }
+}
diff --git a/tests/dcaegen2/prh-testcases/prh_tests.robot b/tests/dcaegen2/prh-testcases/prh_tests.robot
new file mode 100644
index 00000000..23d86663
--- /dev/null
+++ b/tests/dcaegen2/prh-testcases/prh_tests.robot
@@ -0,0 +1,65 @@
+*** 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
+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}
+${EVENT_WITH_ALL_VALID_REQUIRED_FIELDS} %{WORKSPACE}/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_all_fields.json
+${EVENT_WITH_IPV4} %{WORKSPACE}/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_IPV4.json
+${EVENT_WITH_IPV6} %{WORKSPACE}/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_IPV6.json
+${EVENT_WITH_MISSING_IPV4_AND_IPV6} %{WORKSPACE}/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_IPV4_and_IPV6.json
+${EVENT_WITH_MISSING_SOURCENAME} %{WORKSPACE}/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_sourceName.json
+${EVENT_WITH_MISSING_SOURCENAME_AND_IPV4} %{WORKSPACE}/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_sourceName_and_IPV4.json
+${EVENT_WITH_MISSING_SOURCENAME_AND_IPV6} %{WORKSPACE}/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_sourceName_and_IPV6.json
+${EVENT_WITH_MISSING_SOURCENAME_IPV4_AND_IPV6} %{WORKSPACE}/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_sourceName_IPV4_and_IPV6.json
+${Not_json_format} %{WORKSPACE}/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/not_json_format.json
+
+*** Test Cases ***
+Valid DMaaP event can be converted to PNF_READY notification
+ [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}
+
+Invalid DMaaP event cannot be converted to PNF_READY notification
+ [Documentation] PRH get invalid event from DMaaP with missing required fields - PRH does not produce PNF_READY notification
+ [Tags] PRH Invalid event
+ [Template] Invalid event processing
+ ${EVENT_WITH_MISSING_IPV4_AND_IPV6}
+ ${EVENT_WITH_MISSING_SOURCENAME}
+ ${EVENT_WITH_MISSING_SOURCENAME_AND_IPV4}
+ ${EVENT_WITH_MISSING_SOURCENAME_AND_IPV6}
+ ${EVENT_WITH_MISSING_SOURCENAME_IPV4_AND_IPV6}
+
+Get valid event from DMaaP and record in AAI does not exist
+ [Documentation] PRH get valid event from DMaaP with all required fields and in AAI record doesn't exist - PRH does not produce PNF_READY notification
+ [Tags] PRH Missing AAI record
+ [Timeout] 30s
+ ${data}= Get Data From File ${EVENT_WITH_ALL_VALID_REQUIRED_FIELDS}
+ Set PNF name in AAI wrong_aai_record
+ Set event in DMaaP ${data}
+ Wait Until Keyword Succeeds 100x 300ms Check PRH log java.io.IOException: Connection closed prematurely
+
+Event in DMaaP is not JSON format
+ [Documentation] PRH get not JSON format event from DMaaP - PRH does not produce PNF_READY notification
+ [Tags] PRH
+ ${data}= Get Data From File ${Not_json_format}
+ Set event in DMaaP ${data}
+ Wait Until Keyword Succeeds 100x 300ms Check PRH log |java.lang.IllegalStateException: Not a JSON Array:
+
+Get valid event from DMaaP and AAI is not responding
+ [Documentation] PRH get valid event from DMaaP with all required fields and AAI is not responding - PRH does not produce PNF_READY notification
+ [Tags] PRH AAI
+ [Timeout] 180s
+ ${data}= Get Data From File ${EVENT_WITH_ALL_VALID_REQUIRED_FIELDS}
+ Stop AAI
+ Set event in DMaaP ${data}
+ Wait Until Keyword Succeeds 100x 300ms Check PRH log java.net.UnknownHostException: aai
diff --git a/tests/dcaegen2/prh-testcases/resources/PrhLibrary.py b/tests/dcaegen2/prh-testcases/resources/PrhLibrary.py
new file mode 100644
index 00000000..6a95c71e
--- /dev/null
+++ b/tests/dcaegen2/prh-testcases/resources/PrhLibrary.py
@@ -0,0 +1,46 @@
+import json
+
+import docker
+
+
+class PrhLibrary(object):
+
+ def __init__(self):
+ pass
+
+ @staticmethod
+ def check_for_log(search_for):
+ client = docker.from_env()
+ container = client.containers.get('prh')
+ for line in container.logs(stream=True):
+ if search_for in line.strip():
+ return True
+ else:
+ return False
+
+ @staticmethod
+ def create_pnf_ready_notification(json_file):
+ json_to_python = json.loads(json_file)
+ ipv4 = json_to_python["event"]["pnfRegistrationFields"]["oamV4IpAddress"]
+ ipv6 = json_to_python["event"]["pnfRegistrationFields"]["oamV6IpAddress"]
+ correlationId = json_to_python["event"]["commonEventHeader"]["sourceName"]
+ str_json = '{"correlationId":"' + correlationId + '","ipaddress-v4-oam":"' + ipv4 + '","ipaddress-v6-oam":"' + ipv6 + '"}'
+ python_to_json = json.dumps(str_json)
+ return python_to_json.replace("\\", "")[1:-1]
+
+ @staticmethod
+ def create_pnf_name(json_file):
+ json_to_python = json.loads(json_file)
+ correlationId = json_to_python["event"]["commonEventHeader"]["sourceName"]
+ return correlationId
+
+ @staticmethod
+ def stop_aai():
+ client = docker.from_env()
+ container = client.containers.get('aai_simulator')
+ container.stop()
+
+ 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}")
diff --git a/tests/dcaegen2/prh-testcases/resources/docker-compose.yml b/tests/dcaegen2/prh-testcases/resources/docker-compose.yml
new file mode 100644
index 00000000..67921e8e
--- /dev/null
+++ b/tests/dcaegen2/prh-testcases/resources/docker-compose.yml
@@ -0,0 +1,41 @@
+version: '3'
+services:
+ 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:
+ - "8100:8100"
+ - "8433:8433"
+ container_name: prh
+ depends_on:
+ - dmaap
+ - aai
+
+ dmaap:
+ build:
+ context: simulator
+ dockerfile: DMaaP_simulator
+ ports:
+ - "2222:2222"
+ container_name: dmaap_simulator
+
+ aai:
+ build:
+ context: simulator
+ dockerfile: AAI_simulator
+ ports:
+ - "3333:3333"
+ container_name: aai_simulator
diff --git a/tests/dcaegen2/prh-testcases/resources/prh_library.robot b/tests/dcaegen2/prh-testcases/resources/prh_library.robot
new file mode 100644
index 00000000..73ce2a2c
--- /dev/null
+++ b/tests/dcaegen2/prh-testcases/resources/prh_library.robot
@@ -0,0 +1,56 @@
+*** Settings ***
+Library RequestsLibrary
+Library Collections
+Library PrhLibrary.py
+Resource ../../../common.robot
+
+*** Keywords ***
+Create header
+ ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
+ 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
+
+Invalid event processing
+ [Arguments] ${input_invalid_event_in_dmaap}
+ [Timeout] 30s
+ ${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}
+ Wait Until Keyword Succeeds 100x 100ms Check PRH log ${notification}
+
+Valid event processing
+ [Arguments] ${input_valid_event_in_dmaap}
+ [Timeout] 30s
+ ${data}= Get Data From File ${input_valid_event_in_dmaap}
+ ${posted_event_to_dmaap}= Create PNF_Ready notification ${data}
+ ${pnf_name}= Create PNF name ${data}
+ Set PNF name in AAI ${pnf_name}
+ Set event in DMaaP ${data}
+ Wait Until Keyword Succeeds 100x 300ms Check PNF_READY notification ${posted_event_to_dmaap}
+
+Check PRH log
+ [Arguments] ${searched_log}
+ ${status}= Check for log ${searched_log}
+ Should Be Equal As Strings ${status} True
+
+Check PNF_READY notification
+ [Arguments] ${posted_event_to_dmaap}
+ ${resp}= Get Request ${suite_dmaap_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}
+ 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}
+ Should Be Equal As Strings ${resp.status_code} 200
diff --git a/tests/dcaegen2/prh-testcases/resources/simulator/AAI.py b/tests/dcaegen2/prh-testcases/resources/simulator/AAI.py
new file mode 100644
index 00000000..c57903c3
--- /dev/null
+++ b/tests/dcaegen2/prh-testcases/resources/simulator/AAI.py
@@ -0,0 +1,56 @@
+from http.server import BaseHTTPRequestHandler
+from http.server import HTTPServer
+import re
+import sys
+
+pnfs = 'Empty'
+
+
+class AAIHandler(BaseHTTPRequestHandler):
+
+ def do_PUT(self):
+ if re.search('/set_pnfs', self.path):
+ global pnfs
+ content_length = int(self.headers['Content-Length'])
+ pnfs = self.rfile.read(content_length)
+ _header_200_and_json(self)
+
+ return
+
+ def do_PATCH(self):
+ pnfs_name = '/aai/v12/network/pnfs/pnf/' + pnfs.decode()
+ if re.search('wrong_aai_record', self.path):
+ self.send_response(400)
+ self.end_headers()
+ elif re.search(pnfs_name, self.path):
+ self.send_response(200)
+ self.end_headers()
+
+ return
+
+
+def _header_200_and_json(self):
+ self.send_response(200)
+ self.send_header('Content-Type', 'application/json')
+ self.end_headers()
+
+
+def _main_(handler_class=AAIHandler, server_class=HTTPServer, protocol="HTTP/1.0"):
+
+ if sys.argv[1:]:
+ port = int(sys.argv[1])
+ else:
+ port = 3333
+
+ server_address = ('', port)
+
+ 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()
+
+
+if __name__ == '__main__':
+ _main_()
diff --git a/tests/dcaegen2/prh-testcases/resources/simulator/AAI_simulator b/tests/dcaegen2/prh-testcases/resources/simulator/AAI_simulator
new file mode 100644
index 00000000..89a266eb
--- /dev/null
+++ b/tests/dcaegen2/prh-testcases/resources/simulator/AAI_simulator
@@ -0,0 +1,15 @@
+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
+
+ADD AAI.py /
+
+EXPOSE 3333
+
+CMD [ "python", "./AAI.py" ]
diff --git a/tests/dcaegen2/prh-testcases/resources/simulator/DMaaP.py b/tests/dcaegen2/prh-testcases/resources/simulator/DMaaP.py
new file mode 100644
index 00000000..96e22a14
--- /dev/null
+++ b/tests/dcaegen2/prh-testcases/resources/simulator/DMaaP.py
@@ -0,0 +1,65 @@
+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'
+
+
+class DMaaPHandler(BaseHTTPRequestHandler):
+
+ def do_PUT(self):
+ if re.search('/set_get_event', self.path):
+ global received_event_to_get_method
+ 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_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
+
+
+def _header_200_and_json(self):
+ self.send_response(200)
+ self.send_header('Content-Type', 'application/json')
+ 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)
+
+ 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()
+
+
+if __name__ == '__main__':
+ _main_()
diff --git a/tests/dcaegen2/prh-testcases/resources/simulator/DMaaP_simulator b/tests/dcaegen2/prh-testcases/resources/simulator/DMaaP_simulator
new file mode 100644
index 00000000..9cf21dc9
--- /dev/null
+++ b/tests/dcaegen2/prh-testcases/resources/simulator/DMaaP_simulator
@@ -0,0 +1,15 @@
+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
+
+ADD DMaaP.py /
+
+EXPOSE 2222
+
+CMD [ "python", "./DMaaP.py" ]