cntr_msg_responses_fetched=0
# Request and response constants
+ORU_WRITE_URL="/events/unauthenticated.SEC_FAULT_OUTPUT"
+ORU_READ_URL="/events/unauthenticated.SEC_FAULT_OUTPUT/users/test/"
AGENT_WRITE_URL="/events/A1-POLICY-AGENT-WRITE"
AGENT_READ_URL="/events/A1-POLICY-AGENT-READ/users/policy-agent"
APP_WRITE_URL="/send-request"
### MR-stub interface, for MR control
# Send a message to MR
-# URI and parameters (GET): /send-request?operation=<GET|PUT|POST|DELETE>&url=<url>
+# URI and parameters (PUT or POST): /send-request?operation=<GET|PUT|POST|DELETE>&url=<url>
# response: <correlation-id> (http 200) o4 400 for parameter error or 500 for other errors
@app.route(APP_WRITE_URL,
methods=['PUT','POST'])
return Response('{}', status=200, mimetype=MIME_JSON)
+@app.route(ORU_WRITE_URL,
+ methods=['PUT','POST'])
+def oru_write():
+ global msg_requests
+ msg=json.dumps(request.json)
+ msg_requests.append(msg)
+ return Response('{}', status=200, mimetype=MIME_JSON)
+
+@app.route(ORU_READ_URL,
+ methods=['GET'])
+def oru_read():
+ global msg_requests
+ if(len(msg_requests)>0):
+ rsp=msg_requests.pop(0)
+ res=[]
+ res.append(rsp)
+ return Response(json.dumps(res), status=200, mimetype=MIME_JSON)
+ return Response("[]", status=200, mimetype=MIME_JSON)
### Functions for metrics read out ###
print("No env variables - OK")
if __name__ == "__main__":
- app.run(port=HOST_PORT, host=HOST_IP)
\ No newline at end of file
+ app.run(port=HOST_PORT, host=HOST_IP)