aboutsummaryrefslogtreecommitdiffstats
path: root/tests/dcaegen2/prh-testcases/resources
diff options
context:
space:
mode:
authorpkaras <piotr.karas@nokia.com>2018-10-17 15:08:34 +0200
committerpkaras <piotr.karas@nokia.com>2018-10-19 10:27:41 +0200
commit55d368698ab39f8a039831f9d244f01742aac419 (patch)
treecebea8a33e90ee501ae22a71605088fd1420cc78 /tests/dcaegen2/prh-testcases/resources
parent0c84081327f5a8e116ad62a641d353bfc5d07704 (diff)
SSL setup for AAI and simulator
Change-Id: I6b29013032809e8ded110d06d132f765cfc13a7d Issue-ID: DCAEGEN2-878 Signed-off-by: piotr.karas <piotr.karas@nokia.com>
Diffstat (limited to 'tests/dcaegen2/prh-testcases/resources')
-rw-r--r--tests/dcaegen2/prh-testcases/resources/docker-compose.yml26
-rw-r--r--tests/dcaegen2/prh-testcases/resources/prh_library.robot13
-rw-r--r--tests/dcaegen2/prh-testcases/resources/simulator/AAI.py48
-rw-r--r--tests/dcaegen2/prh-testcases/resources/simulator/AAI_simulator3
-rw-r--r--tests/dcaegen2/prh-testcases/resources/simulator/DMaaP.py2
-rw-r--r--tests/dcaegen2/prh-testcases/resources/simulator/certs/client.crt18
-rw-r--r--tests/dcaegen2/prh-testcases/resources/simulator/certs/client.key27
-rw-r--r--tests/dcaegen2/prh-testcases/resources/simulator/certs/server.crt19
-rw-r--r--tests/dcaegen2/prh-testcases/resources/simulator/certs/server.key27
9 files changed, 162 insertions, 21 deletions
diff --git a/tests/dcaegen2/prh-testcases/resources/docker-compose.yml b/tests/dcaegen2/prh-testcases/resources/docker-compose.yml
index 67921e8e..04d5763f 100644
--- a/tests/dcaegen2/prh-testcases/resources/docker-compose.yml
+++ b/tests/dcaegen2/prh-testcases/resources/docker-compose.yml
@@ -24,6 +24,30 @@ 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=3334
+ --aai.aaiClientConfiguration.aaiHost=aai
+ --aai.aaiClientConfiguration.aaiProtocol=https
+ 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
@@ -38,4 +62,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 fcad88d7..b7653671 100644
--- a/tests/dcaegen2/prh-testcases/resources/prh_library.robot
+++ b/tests/dcaegen2/prh-testcases/resources/prh_library.robot
@@ -12,8 +12,11 @@ Create header
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 aai_setup_session ${AAI_SIMULATOR_SETUP_URL}
+ Set Suite Variable ${aai_setup_session} aai_setup_session
+
+Reset Simulators
+ Reset AAI simulator
Invalid event processing
[Arguments] ${input_invalid_event_in_dmaap}
@@ -47,10 +50,14 @@ Check PNF_READY notification
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}
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
diff --git a/tests/dcaegen2/prh-testcases/resources/simulator/AAI.py b/tests/dcaegen2/prh-testcases/resources/simulator/AAI.py
index c57903c3..b6c9c0f9 100644
--- a/tests/dcaegen2/prh-testcases/resources/simulator/AAI.py
+++ b/tests/dcaegen2/prh-testcases/resources/simulator/AAI.py
@@ -1,12 +1,11 @@
from http.server import BaseHTTPRequestHandler
from http.server import HTTPServer
-import re
-import sys
+import _thread, ssl, time, re
pnfs = 'Empty'
-class AAIHandler(BaseHTTPRequestHandler):
+class AAISetup(BaseHTTPRequestHandler):
def do_PUT(self):
if re.search('/set_pnfs', self.path):
@@ -14,9 +13,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 +44,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..b44add60 100644
--- a/tests/dcaegen2/prh-testcases/resources/simulator/AAI_simulator
+++ b/tests/dcaegen2/prh-testcases/resources/simulator/AAI_simulator
@@ -9,7 +9,6 @@ RUN apk add --no-cache python3 && \
rm -r /root/.cache
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..85c36109 100644
--- a/tests/dcaegen2/prh-testcases/resources/simulator/DMaaP.py
+++ b/tests/dcaegen2/prh-testcases/resources/simulator/DMaaP.py
@@ -4,7 +4,7 @@ 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):
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/jCCAeagAwIBAgIJALu8otyWP3z1MA0G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/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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