1 # -------------------------------------------------------------------------
2 # Copyright (c) 2019 AT&T Intellectual Property
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
16 # -------------------------------------------------------------------------
19 from flask import Flask
20 from flask import request
21 from flask import Response
22 from flask import json
23 from flask import send_from_directory
25 from threading import Thread
35 ROOT_MOCK_DIR = os.path.dirname(os.path.abspath(__file__))
36 DATA_DIR = os.path.join(ROOT_MOCK_DIR, "data")
40 ########################################################################
41 ########################################################################
42 @app.route('/onap/so/infra/orchestrationRequests/v7/schedule/<VNFNAME>', methods=['GET', 'POST'])
43 def soSchedule(VNFNAME):
44 if request.method == 'POST':
45 testid = request.headers.environ["HTTP_X_TRANSACTIONID"]
49 "requestReferences" : {
50 "requestId" : "000001"
54 resp = Response(json.dumps(response), 200, mimetype='application/json')
59 return "Helloooooo!!!!"
61 ########################################################################
62 ########################################################################
63 @app.route('/onap/so/infra/orchestrationRequests/v7/<REQUESTID>', methods=['GET'])
64 def soStatus(REQUESTID):
65 response = {"request" : { "requestStatus" : {
66 "requestState" : "COMPLETE",
67 "statusMessage" : "Done.",
68 "percentProgress" : 100,
71 now = datetime.datetime.utcnow()
72 #response["finishTime"] = now.strftime("%Y-%m-%dT%H:%M:%SZ")
73 response["request"]["requestStatus"]["finishTime"] = now.strftime("%a, %d %b %Y %H:%M:%S GMT")
74 resp = Response(json.dumps(response), 200, mimetype='application/json')
78 ########################################################################
79 ########################################################################
80 if __name__ == "__main__":
81 app.run(host= '0.0.0.0',port=5000)