diff options
author | Jerry Flood <jflood@att.com> | 2019-04-25 16:46:35 -0400 |
---|---|---|
committer | Jerry Flood <jflood@att.com> | 2019-04-25 16:46:46 -0400 |
commit | 131273f73ec21a5632de9069f8b04f75631ce790 (patch) | |
tree | 1beca0f4aceb0a255eff938291a7bd7a1f0f634a /cmso-robot/mocking/mock.py | |
parent | d4014abb85d839c14c9a2572098571e7a8523104 (diff) |
Remove dead code. Add robot tests
Move interface mocking test code from cmso to robot.
Issue-ID: OPTFRA-474
Change-Id: Ib98f0b16d783e01f888279266dfdee858e30b787
Signed-off-by: Jerry Flood <jflood@att.com>
Diffstat (limited to 'cmso-robot/mocking/mock.py')
-rwxr-xr-x | cmso-robot/mocking/mock.py | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/cmso-robot/mocking/mock.py b/cmso-robot/mocking/mock.py new file mode 100755 index 0000000..2cb8c3c --- /dev/null +++ b/cmso-robot/mocking/mock.py @@ -0,0 +1,100 @@ +from flask import Flask
+from flask import request
+from flask import Response
+from flask import json
+from flask import send_from_directory
+import requests
+from threading import Thread
+import time
+
+import os
+import fnmatch
+import re
+import time
+import datetime
+
+app = Flask(__name__)
+ROOT_MOCK_DIR = os.path.dirname(os.path.abspath(__file__))
+DATA_DIR = os.path.join(ROOT_MOCK_DIR, "data")
+global requestNum
+requestNum = 1
+
+########################################################################
+########################################################################
+@app.route('/onap/so/infra/orchestrationRequests/v7/schedule/<VNFNAME>', methods=['GET', 'POST'])
+def soSchedule(VNFNAME):
+ if request.method == 'POST':
+ testid = request.headers.environ["HTTP_X_TRANSACTIONID"]
+ response = {
+ "status" : "202",
+ "entity" : {
+ "requestReferences" : {
+ "requestId" : "000001"
+ }
+ }
+ }
+ resp = Response(json.dumps(response), 200, mimetype='application/json')
+ return resp
+
+
+ else :
+ return "Helloooooo!!!!"
+
+########################################################################
+########################################################################
+@app.route('/onap/so/infra/orchestrationRequests/v7/<REQUESTID>', methods=['GET'])
+def soStatus(REQUESTID):
+ response = {"request" : { "requestStatus" : {
+ "requestState" : "COMPLETE",
+ "statusMessage" : "Done.",
+ "percentProgress" : 100,
+ "finishTime" : ""
+ }}}
+ now = datetime.datetime.utcnow()
+ #response["finishTime"] = now.strftime("%Y-%m-%dT%H:%M:%SZ")
+ response["request"]["requestStatus"]["finishTime"] = now.strftime("%a, %d %b %Y %H:%M:%S GMT")
+ resp = Response(json.dumps(response), 200, mimetype='application/json')
+
+ return resp
+
+
+########################################################################
+########################################################################
+@app.route('/optimizer/v1/optimize/schedule', methods=['POST'])
+def optimizePost():
+ response = {}
+ resp = Response(json.dumps(response), 200, mimetype='application/json')
+ return resp
+
+
+########################################################################
+########################################################################
+@app.route('/optimizer/v1/optimize/schedule/<ID>', methods=['GET'])
+def optimizeGet(ID):
+ response = {}
+ resp = Response(json.dumps(response), 200, mimetype='application/json')
+
+ return resp
+
+########################################################################
+########################################################################
+@app.route('/optimizer/v1/optimize/schedule/<ID>', methods=['DELETE'])
+def optimizeDelete(ID):
+ response = {}
+ resp = Response(json.dumps(response), 200, mimetype='application/json')
+ return resp
+
+########################################################################
+########################################################################
+@app.route('/optimizer/v1/policies', methods=['GET'])
+def getPolicies():
+ reponse = []
+ resp = Response(json.dumps(response), 200, mimetype='application/json')
+
+ return resp
+
+########################################################################
+########################################################################
+if __name__ == "__main__":
+ app.run(host= '0.0.0.0',port=5000)
+ #app.run()
\ No newline at end of file |