From: YongchaoWu Date: Thu, 7 May 2020 10:21:42 +0000 (+0200) Subject: Add webserver support for mr simulator X-Git-Tag: 2.0.0~52 X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;ds=inline;h=db6bb3802115a45cece80aed62683e02cd7d3282;p=nonrtric.git Add webserver support for mr simulator - build nginx, wsgi, flask mr in one container - support multi-threading and multi-processing - support both http and https call - support both IPv4 and IPv6 Issue-ID: NONRTRIC-208 Signed-off-by: YongchaoWu Change-Id: Idf905923a1419e62ea4ec2d07fdcfccd0f85f12c --- diff --git a/test/mrstub/.gitignore b/test/mrstub/.gitignore index 4aa3a7ae..e7940a26 100644 --- a/test/mrstub/.gitignore +++ b/test/mrstub/.gitignore @@ -1,2 +1,3 @@ .tmp.json -.dockererr \ No newline at end of file +.dockererr +nginx_wsgi_flask/__init__.py diff --git a/test/mrstub/nginx_wsgi_flask/Dockerfile b/test/mrstub/nginx_wsgi_flask/Dockerfile new file mode 100644 index 00000000..d6e84645 --- /dev/null +++ b/test/mrstub/nginx_wsgi_flask/Dockerfile @@ -0,0 +1,25 @@ +# ============LICENSE_START=============================================== +# Copyright (C) 2020 Nordix Foundation. All rights reserved. +# ======================================================================== +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END================================================= +# + +FROM tiangolo/uwsgi-nginx-flask:python3.7 + +COPY ./cert/cert.crt /etc/ssl/private/ +COPY ./cert/key.crt /etc/ssl/private/ +COPY ./cert/pass /etc/ssl/private/ + +COPY ./app /app + diff --git a/test/mrstub/nginx_wsgi_flask/app/main.py b/test/mrstub/nginx_wsgi_flask/app/main.py new file mode 100644 index 00000000..9c5a2c8d --- /dev/null +++ b/test/mrstub/nginx_wsgi_flask/app/main.py @@ -0,0 +1,276 @@ + +# ============LICENSE_START=============================================== +# Copyright (C) 2020 Nordix Foundation. All rights reserved. +# ======================================================================== +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END================================================= +# + +from flask import Flask, request +from time import sleep +import time +import datetime +import json +from flask import Flask +from flask import Response +import traceback + +app = Flask(__name__) + +# list of messages to/from Dmaap +msg_requests=[] +msg_responses={} + +# Server info +HOST_IP = "127.0.0.1" +HOST_PORT = 2222 + +# Metrics vars +cntr_msg_requests_submitted=0 +cntr_msg_requests_fetched=0 +cntr_msg_responses_submitted=0 +cntr_msg_responses_fetched=0 + +# Request and response constants +AGENT_WRITE_URL="/events/A1-POLICY-AGENT-WRITE" +AGENT_READ_URL="/events/A1-POLICY-AGENT-READ/users/policy-agent" +APP_WRITE_URL="/send-request" +APP_READ_URL="/receive-response" +MIME_TEXT="text/plain" +MIME_JSON="application/json" +CAUGHT_EXCEPTION="Caught exception: " +SERVER_ERROR="Server error :" + +#I'm alive function +@app.route('/', + methods=['GET']) +def index(): + return 'OK', 200 + + +# Helper function to create a Dmaap request message +# args : +# response: json formatted string of a complete Dmaap message +def create_message(operation, correlation_id, payload, url): + if (payload is None): + payload="{}" + time_stamp=datetime.datetime.utcnow() + msg = '{\"apiVersion\":\"1.0\",\"operation\":\"'+operation+'\",\"correlationId\":\"'+correlation_id+'\",\"originatorId\": \"849e6c6b420\",' + msg = msg + '\"payload\":'+payload+',\"requestId\":\"23343221\", \"target\":\"policy-agent\", \"timestamp\":\"'+str(time_stamp)+'\", \"type\":\"request\",\"url\":\"'+url+'\"}' + return msg + + +### MR-stub interface, for MR control + +# Send a message to MR +# URI and parameters (GET): /send-request?operation=&url= +# response: (http 200) o4 400 for parameter error or 500 for other errors +@app.route(APP_WRITE_URL, + methods=['PUT','POST']) +def sendrequest(): + global msg_requests + global cntr_msg_requests_submitted + + try: + + oper=request.args.get('operation') + if (oper is None): + print(APP_WRITE_URL+" parameter 'operation' missing") + return Response('Parameter operation missing in request', status=400, mimetype=MIME_TEXT) + + url=request.args.get('url') + if (url is None): + print(APP_WRITE_URL+" parameter 'url' missing") + return Response('Parameter url missing in request', status=400, mimetype=MIME_TEXT) + + if (oper != "GET" and oper != "PUT" and oper != "POST" and oper != "DELETE"): + print(APP_WRITE_URL+" parameter 'operation' need to be: DEL|PUT|POST|DELETE") + return Response('Parameter operation does not contain DEL|PUT|POST|DELETE in request', status=400, mimetype=MIME_TEXT) + + print(APP_WRITE_URL+" operation="+oper+" url="+url) + correlation_id=str(time.time_ns()) + payload=None + if (oper == "PUT") and (request.json is not None): + payload=json.dumps(request.json) + + msg=create_message(oper, correlation_id, payload, url) + print(msg) + print(APP_WRITE_URL+" MSG(correlationid = "+correlation_id+"): " + json.dumps(json.loads(msg), indent=2)) + msg_requests.append(msg) + cntr_msg_requests_submitted += 1 + return Response(correlation_id, status=200, mimetype=MIME_TEXT) + except Exception as e: + print(APP_WRITE_URL+"-"+CAUGHT_EXCEPTION+" "+str(e) + " "+traceback.format_exc()) + return Response(SERVER_ERROR+" "+str(e), status=500, mimetype=MIME_TEXT) + +# Receive a message response for MR for the included correlation id +# URI and parameter, (GET): /receive-response?correlationid= +# response: 200 or empty 204 or other errors 500 +@app.route(APP_READ_URL, + methods=['GET']) +def receiveresponse(): + global msg_responses + global cntr_msg_responses_fetched + + try: + id=request.args.get('correlationid') + if (id is None): + print(APP_READ_URL+" parameter 'correclationid' missing") + return Response('Parameter correlationid missing in json', status=500, mimetype=MIME_TEXT) + + if (id in msg_responses): + answer=msg_responses[id] + del msg_responses[id] + print(APP_READ_URL+" response (correlationid="+id+"): " + answer) + cntr_msg_responses_fetched += 1 + return Response(answer, status=200, mimetype=MIME_JSON) + + print(APP_READ_URL+" - no messages (correlationid="+id+"): ") + return Response('', status=204, mimetype=MIME_JSON) + except Exception as e: + print(APP_READ_URL+"-"+CAUGHT_EXCEPTION+" "+str(e) + " "+traceback.format_exc()) + return Response(SERVER_ERROR+" "+str(e), status=500, mimetype=MIME_TEXT) + +### Dmaap interface ### + +# Read messages stream. URI according to agent configuration. +# URI, (GET): /events/A1-POLICY-AGENT-READ/users/policy-agent +# response: 200 , or 500 for other errors +@app.route(AGENT_READ_URL, + methods=['GET']) +def events_read(): + global msg_requests + global cntr_msg_requests_fetched + + limit=request.args.get('limit') + if (limit is None): + limit=4096 + else: + limit=int(limit) + if (limit<0): + limit=0 + if (limit>4096): + limit=4096 + print("Limting number of returned messages to: "+str(limit)) + try: + msgs='' + cntr=0 + while(cntr0): + if (len(msgs)>1): + msgs=msgs+',' + msgs=msgs+msg_requests.pop(0) + cntr_msg_requests_fetched += 1 + cntr=cntr+1 + msgs='['+msgs+']' + print(AGENT_READ_URL+" MSGs: "+json.dumps(json.loads(msgs), indent=2)) + return Response(msgs, status=200, mimetype=MIME_JSON) + except Exception as e: + print(AGENT_READ_URL+"-"+CAUGHT_EXCEPTION+" "+str(e) + " "+traceback.format_exc()) + return Response(SERVER_ERROR+" "+str(e), status=500, mimetype=MIME_TEXT) + +# Write messages stream. URI according to agent configuration. +# URI and payload, (PUT or POST): /events/A1-POLICY-AGENT-WRITE +# response: OK 200 or 400 for missing json parameters, 500 for other errors +@app.route(AGENT_WRITE_URL, + methods=['PUT','POST']) +def events_write(): + global msg_responses + global cntr_msg_responses_submitted + + try: + answer=request.json + print(AGENT_WRITE_URL+ " json=" + json.dumps(answer, indent=2)) + for item in answer: + id=item['correlationId'] + if (id is None): + print(AGENT_WRITE_URL+" parameter 'correlatonid' missing") + return Response('Parameter missing in json', status=400, mimetype=MIME_TEXT) + msg=item['message'] + if (msg is None): + print(AGENT_WRITE_URL+" parameter 'msgs' missing") + return Response('Parameter >message> missing in json', status=400, mimetype=MIME_TEXT) + status=item['status'] + if (status is None): + print(AGENT_WRITE_URL+" parameter 'status' missing") + return Response('Parameter missing in json', status=400, mimetype=MIME_TEXT) + if isinstance(msg, list) or isinstance(msg, dict): + msg_str=json.dumps(msg)+status[0:3] + else: + msg_str=msg+status[0:3] + msg_responses[id]=msg_str + cntr_msg_responses_submitted += 1 + print(AGENT_WRITE_URL+ " msg+status (correlationid="+id+") :" + str(msg_str)) + except Exception as e: + print(AGENT_WRITE_URL+"-"+CAUGHT_EXCEPTION+" "+str(e) + " "+traceback.format_exc()) + return Response('{"message": "' + SERVER_ERROR + ' ' + str(e) + '","status":"500"}', status=200, mimetype=MIME_JSON) + + return Response('{}', status=200, mimetype=MIME_JSON) + + +### Functions for metrics read out ### + +@app.route('/counter/requests_submitted', + methods=['GET']) +def requests_submitted(): + return Response(str(cntr_msg_requests_submitted), status=200, mimetype=MIME_TEXT) + +@app.route('/counter/requests_fetched', + methods=['GET']) +def requests_fetched(): + return Response(str(cntr_msg_requests_fetched), status=200, mimetype=MIME_TEXT) + +@app.route('/counter/responses_submitted', + methods=['GET']) +def responses_submitted(): + return Response(str(cntr_msg_responses_submitted), status=200, mimetype=MIME_TEXT) + +@app.route('/counter/responses_fetched', + methods=['GET']) +def responses_fetched(): + return Response(str(cntr_msg_responses_fetched), status=200, mimetype=MIME_TEXT) + +@app.route('/counter/current_requests', + methods=['GET']) +def current_requests(): + return Response(str(len(msg_requests)), status=200, mimetype=MIME_TEXT) + +@app.route('/counter/current_responses', + methods=['GET']) +def current_responses(): + return Response(str(len(msg_responses)), status=200, mimetype=MIME_TEXT) + +### Admin ### + +# Reset all messsages and counters +@app.route('/reset', + methods=['GET', 'POST', 'PUT']) +def reset(): + global cntr_msg_requests_submitted + global cntr_msg_requests_fetched + global cntr_msg_responses_submitted + global cntr_msg_responses_fetched + global msg_requests + global msg_responses + + cntr_msg_requests_submitted=0 + cntr_msg_requests_fetched=0 + cntr_msg_responses_submitted=0 + cntr_msg_responses_fetched=0 + msg_requests=[] + msg_responses={} + return Response('OK', status=200, mimetype=MIME_TEXT) + +### Main function ### + +if __name__ == "__main__": + app.run(port=HOST_PORT, host=HOST_IP) diff --git a/test/mrstub/nginx_wsgi_flask/app/nginx.conf b/test/mrstub/nginx_wsgi_flask/app/nginx.conf new file mode 100644 index 00000000..387303c6 --- /dev/null +++ b/test/mrstub/nginx_wsgi_flask/app/nginx.conf @@ -0,0 +1,58 @@ +# ============LICENSE_START=============================================== +# Copyright (C) 2020 Nordix Foundation. All rights reserved. +# ======================================================================== +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END================================================= +# + +user nginx; +worker_processes 1; +error_log /var/log/nginx/error.log warn; +pid /var/run/nginx.pid; +events { + worker_connections 1024; +} +http { + ssl_password_file /etc/ssl/private/pass; + include /etc/nginx/mime.types; + default_type application/octet-stream; + log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + '$status $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for"'; + access_log /var/log/nginx/access.log main; + sendfile on; + keepalive_timeout 65; + include /etc/nginx/conf.d/*.conf; + + server { + listen 80 ; + listen [::]:80; + listen 443 ssl ; + listen [::]:443 ssl; + server_name localhost; + ssl_certificate /etc/ssl/private/cert.crt; + ssl_certificate_key /etc/ssl/private/key.crt; + + location / { + try_files $uri @app; + } + location @app { + include uwsgi_params; + uwsgi_pass unix:///tmp/uwsgi.sock; + } + location /static { + alias /app/static; + } + } +} +daemon off; diff --git a/test/mrstub/nginx_wsgi_flask/app/prestart.sh b/test/mrstub/nginx_wsgi_flask/app/prestart.sh new file mode 100644 index 00000000..d4f4576a --- /dev/null +++ b/test/mrstub/nginx_wsgi_flask/app/prestart.sh @@ -0,0 +1,22 @@ +#! /usr/bin/env bash + +# ============LICENSE_START=============================================== +# Copyright (C) 2020 Nordix Foundation. All rights reserved. +# ======================================================================== +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END================================================= +# + +echo "start nginx, uwsgi, flask application..." + + diff --git a/test/mrstub/nginx_wsgi_flask/app/uwsgi.ini b/test/mrstub/nginx_wsgi_flask/app/uwsgi.ini new file mode 100644 index 00000000..4bd92fc4 --- /dev/null +++ b/test/mrstub/nginx_wsgi_flask/app/uwsgi.ini @@ -0,0 +1,21 @@ +# ============LICENSE_START=============================================== +# Copyright (C) 2020 Nordix Foundation. All rights reserved. +# ======================================================================== +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END================================================= +# + +[uwsgi] +module = main +callable = app +cheaper = 1 \ No newline at end of file diff --git a/test/mrstub/nginx_wsgi_flask/basic_test.sh b/test/mrstub/nginx_wsgi_flask/basic_test.sh new file mode 100755 index 00000000..2a11e506 --- /dev/null +++ b/test/mrstub/nginx_wsgi_flask/basic_test.sh @@ -0,0 +1,135 @@ +#!/bin/bash + +# ============LICENSE_START=============================================== +# Copyright (C) 2020 Nordix Foundation. All rights reserved. +# ======================================================================== +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END================================================= +# + +# Automated test script for mrstub container + +# Run the build_and_start with the same arg as this script +if [ $# -ne 1 ]; then + echo "Usage: ./basic_test nonsecure|secure" + exit 1 +fi +if [ "$1" != "nonsecure" ] && [ "$1" != "secure" ]; then + echo "Usage: ./basic_test nonsecure|secure" + exit 1 +fi + +if [ $1 == "nonsecure" ]; then + #Default http port for the simulator + PORT=3905 + # Set http protocol + HTTPX="http" +else + #Default https port for the mr-stub + PORT=3906 + # Set https protocol + HTTPX="https" +fi + +# source function to do curl and check result +. ../../common/do_curl_function.sh + +echo "=== Stub hello world ===" +RESULT="OK" +do_curl GET / 200 + +echo "=== Stub reset ===" +RESULT="OK" +do_curl GET /reset 200 + +## Test with json response + +echo "=== Send a request ===" +RESULT="*" +#create payload +echo "{\"data\": \"data-value\"}" > .tmp.json + +do_curl POST '/send-request?operation=PUT&url=/test' 200 .tmp.json +#Save id for later +CORRID=$body + +echo "=== Fetch a response, shall be empty ===" +RESULT="" +do_curl GET '/receive-response?correlationid='$CORRID 204 + +echo "=== Fetch a request ===" +RESULT="json:[{\"apiVersion\":\"1.0\",\"operation\":\"PUT\",\"correlationId\":\""$CORRID"\",\"originatorId\": \"849e6c6b420\",\"payload\":{\"data\": \"data-value\"},\"requestId\":\"23343221\", \"target\":\"policy-agent\", \"timestamp\":\"????\", \"type\":\"request\",\"url\":\"/test\"}]" +do_curl GET '/events/A1-POLICY-AGENT-READ/users/policy-agent' 200 + +echo "=== Send a json response ===" +# Create minimal accepted response message +echo "[{\"correlationId\": \""$CORRID"\", \"message\": {\"test\":\"testresponse\"}, \"status\": \"200\"}]" > .tmp.json +RESULT="OK" +do_curl POST /events/A1-POLICY-AGENT-WRITE 200 .tmp.json + +echo "=== Fetch a response ===" +RESULT="{\"test\": \"testresponse\"}200" +do_curl GET '/receive-response?correlationid='$CORRID 200 + +### Test with plain text response + +echo "=== Send a request ===" +RESULT="*" +do_curl POST '/send-request?operation=GET&url=/test2' 200 +#Save id for later +CORRID=$body + +echo "=== Fetch a response, shall be empty ===" +RESULT="" +do_curl GET '/receive-response?correlationid='$CORRID 204 + +echo "=== Fetch a request ===" +RESULT="json:[{\"apiVersion\":\"1.0\",\"operation\":\"GET\",\"correlationId\":\""$CORRID"\",\"originatorId\": \"849e6c6b420\",\"payload\":{},\"requestId\":\"23343221\", \"target\":\"policy-agent\", \"timestamp\":\"????\", \"type\":\"request\",\"url\":\"/test2\"}]" +do_curl GET '/events/A1-POLICY-AGENT-READ/users/policy-agent' 200 + +echo "=== Fetch a request with limit 25, shall be empty. ===" +RESULT="json-array-size:0" +do_curl GET '/events/A1-POLICY-AGENT-READ/users/policy-agent?timeout=1000&limit=25' 200 + +echo "=== Send 5 request to test limit on MR GET===" +RESULT="*" +for i in {1..5} +do + do_curl POST '/send-request?operation=GET&url=/test2' 200 +done + +echo "=== Fetch a request with limit 3. ===" +RESULT="json-array-size:3" +do_curl GET '/events/A1-POLICY-AGENT-READ/users/policy-agent?timeout=1000&limit=3' 200 + +echo "=== Fetch a request with limit 3, shall return 2. ===" +RESULT="json-array-size:2" +do_curl GET '/events/A1-POLICY-AGENT-READ/users/policy-agent?timeout=1000&limit=3' 200 + +echo "=== Fetch a request with limit 3, shall return 0. ===" +RESULT="json-array-size:0" +do_curl GET '/events/A1-POLICY-AGENT-READ/users/policy-agent?timeout=1000&limit=3' 200 + +echo "=== Send a json response ===" +# Create minimal accepted response message +echo "[{\"correlationId\": \""$CORRID"\", \"message\": \"test2-response\", \"status\": \"200\"}]" > .tmp.json +RESULT="OK" +do_curl POST /events/A1-POLICY-AGENT-WRITE 200 .tmp.json + +echo "=== Fetch a response ===" +RESULT="test2-response200" +do_curl GET '/receive-response?correlationid='$CORRID 200 + +echo "********************" +echo "*** All tests ok ***" +echo "********************" diff --git a/test/mrstub/nginx_wsgi_flask/cert/cert.crt b/test/mrstub/nginx_wsgi_flask/cert/cert.crt new file mode 100644 index 00000000..a24dfc49 --- /dev/null +++ b/test/mrstub/nginx_wsgi_flask/cert/cert.crt @@ -0,0 +1,16 @@ +-----BEGIN CERTIFICATE----- +MIICljCCAX4CCQCv7SV/aTc/YjANBgkqhkiG9w0BAQsFADANMQswCQYDVQQGEwJT +RTAeFw0yMDA1MDMwMDI0MzdaFw00NzA5MTgwMDI0MzdaMA0xCzAJBgNVBAYTAlNF +MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEApsGQcCv+Ce/+AbHx+3Wu +ujGtWF7uLX+/MahOHPfdXqidwG7OpmYnGkL06cA52P0BcZdc1hPGQbQdFJC8aW6U +5X9owRz9IRiwpzRhRqmMJfeqrLaqLL9K5MpCv+qsDzXu9ngRLJDk5CyeEfTjosEr +GWDywWahQKHChamdH701djFGwWGP3gttGvQoMnaSpzeyDKitBZql6bSxKkhWgFop +yxfU7qjbzOASLWaMx2r+MIJ88+AYDqYBTj649N534AYrIdjlQnvEKzGH0sOgHFYO +oaTTvmE/vRPlmbSX1U7mo/SvMWNPZkKUPDltyapOpBltfMiRJH4ndLOXJWRgmYha +SQIDAQABMA0GCSqGSIb3DQEBCwUAA4IBAQAdAwQpntpgUWUxCTk/Pw2+w5v+VxMM +K6QWhm9JdRn3XKQnKrFexVRso/x8TA8V50EUGwQwbnKApNXvJsV2jvbP/YwDsG2u +jBxs0DSspjDvbhUTkuWNYufQZIUGYMyccHap+CKD4rD2loMkmwbh5rII3SGEzUFE +rOY4VhqDjGCcILbChiY/QMA6Uyb6jLGxTARhgblWi9RWr9LuKv7raaUcnAIz1GO8 +z559kUnOKbsB46RZKRa0uIumz9qqXqxnVLWnIwT3DinpXsnzcPqNyyhTk6XR+W5o +0AuUCyT1WKlejrfMmmV6hRNHbT4x7cQrx4EjNf5hM00mN++F+QdGMa/G +-----END CERTIFICATE----- diff --git a/test/mrstub/nginx_wsgi_flask/cert/key.crt b/test/mrstub/nginx_wsgi_flask/cert/key.crt new file mode 100644 index 00000000..105ee75b --- /dev/null +++ b/test/mrstub/nginx_wsgi_flask/cert/key.crt @@ -0,0 +1,30 @@ +-----BEGIN ENCRYPTED PRIVATE KEY----- +MIIFHzBJBgkqhkiG9w0BBQ0wPDAbBgkqhkiG9w0BBQwwDgQIpz2Uxhl1+ZwCAggA +MB0GCWCGSAFlAwQBKgQQu1or54X1Bk5IMPGoDrdxkASCBNCBKcePejHXlG0fb2qt +TtQrpEr8UR60iFOaeUQ2Lc1zK0wzFCXAIXEWEcaozv75mJ5ReemkBMCyuzPJnoiM +LTeKuoUw8l48S9arB9l+/vVgUnMY0fm+QDsnPffkXKxC2kNwwFgGCT7tIGezuo/e +a9a5JJY707YEnkhUKWAQI2Oz/I95tbeYu64d/WtSN2OLu5JVLsCGAhV4cqcShjEb +pFlfgOHrT0z+qK7YXVR9P74qAZtGsH2ydUrtPtdvddKRpOAm4LzDNmox4Bs6e9nr +jY56sVRiHGhqeeqW04qRks5ReZF7zuwEgUSzGNlAcbbHn6FNJPOZKuN0e8KYexEM +y0G04rSNW8qppMsvez6txsou62CeIZ5LyAumwaJJYzwkob0nCmWYcZl5tSpkXZly +HsQKI2UlO3tiRKd057a46/kxcK85Pwav3Il+FaRXJkzl2rkU3DSy9SjaGL0ROD0U +1EaZCjeDdzN2GmqRQ1WhN5ivowQyWVf6H/mrxtkWZ3qLKmpa1JmvUgOybPcbqqQr +tqjj3Oj0zvLFZDqBjfIlTAAimXPgh6qLHH+qUGrI62pMpaldNZNy/swnpPuTX2sF +TUxFZvnGOmG3qHyvPm91+PypbdVSMb0PeB75XQFqWmajwnua7xfWrH8PLSijp5xQ +aLyiJ1jjFqXWE9D2v7JhB2BNCYlHxP98UI8kHxh7Fw5y0EKT5pCcbrg2nuLzMrCz +D4QaxZRuiIiPgy21kowk3WbHLYAjG7f9cIcbbX6Khc/3ulbB8xJ24WNRuzv4EHeh +TATHqk8nIgpkn1zmvPsKILdWzqZh70IlSctSzoIGzI6C2J76ycSZmcKtar2BZya9 +f1coUlFgXMvdmrf4bt4j2u/biA48OJaVlWBYVfIXUbliFTAQ8biRZFC2n3Xg+W8t +U2xqW14lZWBOIQFJp27foG6Z4JzyL2WZgQ0PWe0m0+tDaKA/LSWB2Qpwt4o2n0cb +RCs++c0eFCeOgErEfmmeburMhzQsfkUqpsL+J/ZMaRSiuTCpYM8qbz+KKT/Z6zbl +2cHWxSFRIqRKAMsj2a61IANjNIdwi2uBHZrWH1HMVVXAbGUJQFKZhxdpn5PBrXqg +vHRa9u0MQFCjs9NcQAGnBQDS6u+pUVO02WT4MvTker+hbu+f6NPU9FMLu+QbQUEP +SUdEZL4W9ZuBTdS3n/fTHEL8wKRB5yEW/CS5JuD+8YinZZXrsd3n3Oky05fdk6Bk +QH9cjMXdsd0Sb0Epw3CWGtXZ6YTHlVWqjdTNlOQdzQ7qfzktgcKujGwvQK0Mgd8x +nmG+f/HWMOss0JEL3ZR+K9Rr50u8/R+W5+e4VE57yw1fg9Jpq2/sVe2Pt8S7isFK +qDLoFZtF5RXi1O9KcA9BpnQX1ihPSC1RoY1pGXoF2D4KkV9U4/4j2qM6MGxjQ6lw +MN0qJ/N70Lti3YWqvYiTymLwVJr8FqoMQsV19MB8012Xd51Bvy6igddhrO83wuuV +b8PlUzl3Tl7yOviYqxiJ0xd8qw+Hs4+FkHbZIFJcUzTHVbb4SlPUE3wn6nrrIcfK +rT4wsYhK3afrlvK3ILi6kzzazS1dK+Hv9+mNozNf5u5nNBFQ+7MhtttzLWIaiV6D +ilLpOwcoO0X0qrzXKR7a+rQ/Dw== +-----END ENCRYPTED PRIVATE KEY----- diff --git a/test/mrstub/nginx_wsgi_flask/cert/pass b/test/mrstub/nginx_wsgi_flask/cert/pass new file mode 100644 index 00000000..30d74d25 --- /dev/null +++ b/test/mrstub/nginx_wsgi_flask/cert/pass @@ -0,0 +1 @@ +test \ No newline at end of file diff --git a/test/mrstub/nginx_wsgi_flask/start-mr.sh b/test/mrstub/nginx_wsgi_flask/start-mr.sh new file mode 100755 index 00000000..b201df75 --- /dev/null +++ b/test/mrstub/nginx_wsgi_flask/start-mr.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +# ============LICENSE_START=============================================== +# Copyright (C) 2020 Nordix Foundation. All rights reserved. +# ======================================================================== +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END================================================= +# + +docker build -t testmr . +docker run --name testmrcontainer -p 3905:80 -p 3906:443 testmr \ No newline at end of file