diff --git a/near-rt-ric-simulator/cr/cr.py b/near-rt-ric-simulator/cr/cr.py
new file mode 100644
index 0000000..28e3b10
--- /dev/null
+++ b/near-rt-ric-simulator/cr/cr.py
@@ -0,0 +1,158 @@
+
+#  ============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 callback messages
+msg_callbacks={}
+
+# Server info
+HOST_IP = "0.0.0.0"
+HOST_PORT = 8090
+
+# Metrics vars
+cntr_msg_callbacks=0
+cntr_msg_fetched=0
+
+# Request and response constants
+CALLBACK_URL="/callbacks/<string:id>"
+APP_READ_URL="/get-event/<string:id>"
+
+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
+
+### Callback interface, for control
+
+# Fetch the oldest callback message for an id
+# URI and parameter, (GET): /get-event/<id>
+# response: message + 200 or 204
+@app.route(APP_READ_URL,
+    methods=['GET'])
+def receiveresponse(id):
+    global msg_callbacks
+    global cntr_msg_fetched
+
+    try:
+        if ((id in msg_callbacks.keys()) and (len(msg_callbacks[id]) > 0)):
+            cntr_msg_fetched+=1
+            msg=str(msg_callbacks[id][0])
+            print("Fetching msg for id: "+id+", msg="+msg)
+            del msg_callbacks[id][0]
+            return msg,200
+        print("No messages for id: "+id)
+    except Exception as e:
+        print(CAUGHT_EXCEPTION+str(e))
+
+    return "",204
+
+
+# Receive a callback message
+# URI and payload, (PUT or POST): /callbacks/<id> <json array of response messages>
+# response: OK 200 or 500 for other errors
+@app.route(CALLBACK_URL,
+    methods=['PUT','POST'])
+def events_write(id):
+    global msg_callbacks
+    global cntr_msg_callbacks
+
+    try:
+        print("Received callback for id: "+id +", content-type="+request.content_type)
+        try:
+            print("data:"+request.get_data)
+            if (request.content_type == MIME_JSON):
+                msg = request.json
+                print("Payload(json): "+str(msg))
+            elif (request.content_type == MIME_TEXT):
+                msg= request.form
+                print("Payload(text): "+str(msg))
+            else:
+                msg="\"\""
+                print("Payload(content-type="+request.content_type+"). Setting data to empty, quoted, string")
+        except:
+            msg="\"\""
+            print("Payload does not contain any json or text data, setting empty string as payload")
+
+        cntr_msg_callbacks += 1
+        if (id in msg_callbacks.keys()):
+            msg_callbacks[id].append(msg)
+        else:
+            msg_callbacks[id]=[]
+            msg_callbacks[id].append(msg)
+    except Exception as e:
+        print(CAUGHT_EXCEPTION+str(e))
+        return 'OK',500
+
+    return 'OK',200
+
+
+### Functions for metrics read out ###
+
+@app.route('/counter/received_callbacks',
+    methods=['GET'])
+def requests_submitted():
+    return Response(str(cntr_msg_callbacks), status=200, mimetype=MIME_TEXT)
+
+@app.route('/counter/fetched_callbacks',
+    methods=['GET'])
+def requests_fetched():
+    return Response(str(cntr_msg_fetched), status=200, mimetype=MIME_TEXT)
+
+@app.route('/counter/current_messages',
+    methods=['GET'])
+def current_messages():
+    return Response(str(cntr_msg_callbacks-cntr_msg_fetched), status=200, mimetype=MIME_TEXT)
+
+
+
+### Admin ###
+
+# Reset all messsages and counters
+@app.route('/reset',
+    methods=['GET', 'POST', 'PUT'])
+def reset():
+    global msg_callbacks
+    global cntr_msg_fetched
+    global cntr_msg_callbacks
+
+    msg_callbacks={}
+    cntr_msg_fetched=0
+    cntr_msg_callbacks=0
+
+    return Response('OK', status=200, mimetype=MIME_TEXT)
+
+### Main function ###
+
+if __name__ == "__main__":
+    app.run(port=HOST_PORT, host=HOST_IP)
