aboutsummaryrefslogtreecommitdiffstats
path: root/test/csit/tests/dcaegen2/prh-testcases/resources
diff options
context:
space:
mode:
authorGary Wu <gary.i.wu@huawei.com>2018-06-20 15:22:59 +0000
committerGerrit Code Review <gerrit@onap.org>2018-06-20 15:22:59 +0000
commit7657b0e2cb4a8b1833b10bc6c91297981d376a5b (patch)
treee67350d0575907483a743ee225fea4a690fb2920 /test/csit/tests/dcaegen2/prh-testcases/resources
parent285a9db4548eba445c34933e6da6f22ef1af1b68 (diff)
parent26b89ecb973531dfcc0fd30bd50f083e585e1f4f (diff)
Merge "Rename folder for jenkins job"
Diffstat (limited to 'test/csit/tests/dcaegen2/prh-testcases/resources')
-rw-r--r--test/csit/tests/dcaegen2/prh-testcases/resources/PrhLibrary.py16
-rw-r--r--test/csit/tests/dcaegen2/prh-testcases/resources/docker-compose.yml44
-rw-r--r--test/csit/tests/dcaegen2/prh-testcases/resources/simulator/AAI.py59
-rw-r--r--test/csit/tests/dcaegen2/prh-testcases/resources/simulator/AAI_simulator11
-rw-r--r--test/csit/tests/dcaegen2/prh-testcases/resources/simulator/DMaaP.py75
-rw-r--r--test/csit/tests/dcaegen2/prh-testcases/resources/simulator/DMaaP_simulator11
6 files changed, 216 insertions, 0 deletions
diff --git a/test/csit/tests/dcaegen2/prh-testcases/resources/PrhLibrary.py b/test/csit/tests/dcaegen2/prh-testcases/resources/PrhLibrary.py
new file mode 100644
index 000000000..f07f385f5
--- /dev/null
+++ b/test/csit/tests/dcaegen2/prh-testcases/resources/PrhLibrary.py
@@ -0,0 +1,16 @@
+import docker
+
+class PrhLibrary(object):
+
+ def __init__(self):
+ pass
+
+ def check_for_log(self, 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
+ \ No newline at end of file
diff --git a/test/csit/tests/dcaegen2/prh-testcases/resources/docker-compose.yml b/test/csit/tests/dcaegen2/prh-testcases/resources/docker-compose.yml
new file mode 100644
index 000000000..e773b76a9
--- /dev/null
+++ b/test/csit/tests/dcaegen2/prh-testcases/resources/docker-compose.yml
@@ -0,0 +1,44 @@
+version: '3'
+services:
+ prh:
+ image: nexus3.onap.org:10003/onap/org.onap.dcaegen2.services.prh.prh-app-server
+ command: >
+ --dmaap.dmaapConsumerConfiguration.dmaapPortNumber=2222
+ --dmaap.dmaapProducerConfiguration.dmaapPortNumber=2222
+ --aai.aaiClientConfiguration.aaiHostPortNumber=3333
+ --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
+
+ dmaap_simulator:
+ build:
+ context: simulator
+ dockerfile: DMaaP_simulator
+ args:
+ - https_proxy=${HTTPS_PROXY}
+ ports:
+ - "2222:2222"
+ container_name: dmaap_simulator
+ depends_on:
+ - prh
+
+ aai_simulator:
+ build:
+ context: simulator
+ dockerfile: AAI_simulator
+ args:
+ - https_proxy=${HTTPS_PROXY}
+ ports:
+ - "3333:3333"
+ container_name: aai_simulator
+ depends_on:
+ - prh
+
diff --git a/test/csit/tests/dcaegen2/prh-testcases/resources/simulator/AAI.py b/test/csit/tests/dcaegen2/prh-testcases/resources/simulator/AAI.py
new file mode 100644
index 000000000..2c0b42dcd
--- /dev/null
+++ b/test/csit/tests/dcaegen2/prh-testcases/resources/simulator/AAI.py
@@ -0,0 +1,59 @@
+import BaseHTTPServer
+import re
+import sys
+
+from robot.api import logger
+
+pnfs = 'Empty'
+
+class AAIHandler(BaseHTTPServer.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)
+ self.send_response(200)
+ self.send_header('Content-Type', 'application/json')
+ self.end_headers()
+
+ return
+
+ def do_PATCH(self):
+ pnfs_name = '/aai/v12/network/pnfs/pnf/' + pnfs
+ 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 do_GET(self):
+ self.send_response(200)
+ self.send_header('Content-Type', 'application/json')
+ self.end_headers()
+ self.wfile.write('GET')
+ self.wfile.close()
+
+ return
+
+def _main_ (HandlerClass = AAIHandler,
+ ServerClass = BaseHTTPServer.HTTPServer, protocol="HTTP/1.0"):
+
+ if sys.argv[1:]:
+ port = int(sys.argv[1])
+ else:
+ port = 3333
+
+ server_address = ('', port)
+
+ HandlerClass.protocol_version = protocol
+ httpd = ServerClass(server_address, HandlerClass)
+
+ sa = httpd.socket.getsockname()
+ print "Serving HTTP on", sa[0], "port", sa[1], "..."
+ httpd.serve_forever()
+
+if __name__ == '__main__':
+ _main_()
diff --git a/test/csit/tests/dcaegen2/prh-testcases/resources/simulator/AAI_simulator b/test/csit/tests/dcaegen2/prh-testcases/resources/simulator/AAI_simulator
new file mode 100644
index 000000000..2d96d8925
--- /dev/null
+++ b/test/csit/tests/dcaegen2/prh-testcases/resources/simulator/AAI_simulator
@@ -0,0 +1,11 @@
+FROM python:2
+
+ENV https_proxy "$https_proxy"
+
+ADD AAI.py /
+
+RUN pip install robotframework
+
+EXPOSE 3333
+
+CMD [ "python", "./AAI.py" ]
diff --git a/test/csit/tests/dcaegen2/prh-testcases/resources/simulator/DMaaP.py b/test/csit/tests/dcaegen2/prh-testcases/resources/simulator/DMaaP.py
new file mode 100644
index 000000000..af716fd06
--- /dev/null
+++ b/test/csit/tests/dcaegen2/prh-testcases/resources/simulator/DMaaP.py
@@ -0,0 +1,75 @@
+import BaseHTTPServer
+import re
+import sys
+
+from robot.api import logger
+
+posted_event_from_prh = 'Empty'
+received_event_to_get_method = 'Empty'
+
+class DMaaPHandler(BaseHTTPServer.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)
+ self.send_response(200)
+ self.send_header('Content-Type', 'application/json')
+ self.end_headers()
+
+ return
+
+ def do_POST(self):
+ if re.search('/events/pnfReady', self.path):
+ global posted_event_from_prh
+ content_length = int(self.headers['Content-Length'])
+ posted_event_from_prh = self.rfile.read(content_length)
+ self.send_response(200)
+ self.send_header('Content-Type', 'application/json')
+ self.end_headers()
+
+ return
+
+ def do_GET(self):
+ if re.search('/events/unauthenticated.SEC_OTHER_OUTPUT', self.path):
+ self.send_response(200)
+ self.send_header('Content-Type', 'application/json')
+ self.end_headers()
+ self.wfile.write(received_event_to_get_method)
+ self.wfile.close()
+ elif re.search('/events/pnfReady', self.path):
+ self.send_response(200)
+ self.send_header('Content-Type', 'application/json')
+ self.end_headers()
+ self.wfile.write(posted_event_from_prh)
+ global posted_event_from_prh
+ posted_event_from_prh = 'Empty'
+ self.wfile.close()
+ else:
+ self.send_response(200)
+ self.send_header('Content-Type', 'application/json')
+ self.end_headers()
+ self.wfile.write('GET else')
+ self.wfile.close()
+
+ return
+
+def _main_ (HandlerClass = DMaaPHandler,
+ ServerClass = BaseHTTPServer.HTTPServer, protocol="HTTP/1.0"):
+
+ if sys.argv[1:]:
+ port = int(sys.argv[1])
+ else:
+ port = 2222
+
+ server_address = ('', port)
+
+ HandlerClass.protocol_version = protocol
+ httpd = ServerClass(server_address, HandlerClass)
+
+ sa = httpd.socket.getsockname()
+ print "Serving HTTP on", sa[0], "port", sa[1], "..."
+ httpd.serve_forever()
+
+if __name__ == '__main__':
+ _main_()
diff --git a/test/csit/tests/dcaegen2/prh-testcases/resources/simulator/DMaaP_simulator b/test/csit/tests/dcaegen2/prh-testcases/resources/simulator/DMaaP_simulator
new file mode 100644
index 000000000..4de65393d
--- /dev/null
+++ b/test/csit/tests/dcaegen2/prh-testcases/resources/simulator/DMaaP_simulator
@@ -0,0 +1,11 @@
+FROM python:2
+
+ENV https_proxy "$https_proxy"
+
+ADD DMaaP.py /
+
+RUN pip install robotframework
+
+EXPOSE 2222
+
+CMD [ "python", "./DMaaP.py" ]